From e8fba4e48cf0ab5444b6e1c1fdae9f4e4cbc0af3 Mon Sep 17 00:00:00 2001 From: 曹睿 <360930172@qq.com> Date: 星期二, 25 二月 2025 13:49:06 +0800 Subject: [PATCH] feat: 完成7.1页面接口没测 --- src/views/CNAS/process/demand/Edit.vue | 26 +++++++- src/api/cnas/process/demand/demand.js | 49 ++++++++++++++++ src/views/CNAS/process/demand/index.vue | 11 ++- src/views/CNAS/process/demand/AddContracts.vue | 69 +++++++++++++++++++--- 4 files changed, 137 insertions(+), 18 deletions(-) diff --git a/src/api/cnas/process/demand/demand.js b/src/api/cnas/process/demand/demand.js index 42e3e73..5ab8327 100644 --- a/src/api/cnas/process/demand/demand.js +++ b/src/api/cnas/process/demand/demand.js @@ -1,3 +1,7 @@ +/** + * @description 妫�楠屽鎵樺崟 + */ + // 瀹為獙瀹ょ殑妫�娴嬭兘鍔涙。妗堢浉鍏虫帴鍙� import request from "@/utils/request"; @@ -8,4 +12,49 @@ method: "get", params: params }) +} + +// 鏂板鏃舵牴鎹垚鍝佽鍗曟煡璇㈠鎵樺崟璇︽儏 +export const getInspectionOrderByInsOderId = (params) => { + return request({ + url: "/inspectionOrder/getInspectionOrderByInsOderId", + method: "get", + params: params + }) +} + +// 鏌ヨ鍙柊澧炵殑妫�楠屽崟 +export const getInsOrderOnInspection = (data) => { + return request({ + url: "/inspectionOrder/getInsOrderOnInspection", + method: "post", + data: data + }) +} + +// 鏌ョ湅濮旀墭鍗曡鎯� +export const getInspectionOrderOne = (params) => { + return request({ + url: "/inspectionOrder/getInspectionOrderOne", + method: "get", + params: params + }) +} + +// 鏂板妫�楠屽崟 +export const addInspectionOrder = (data) => { + return request({ + url: "/inspectionOrder/addInspectionOrder", + method: "post", + data: data + }) +} + +// 缂栬緫妫�楠屽崟 +export const editInspectionOrder = (data) => { + return request({ + url: "/inspectionOrder/editInspectionOrder", + method: "post", + data: data + }) } \ No newline at end of file diff --git a/src/views/CNAS/process/demand/AddContracts.vue b/src/views/CNAS/process/demand/AddContracts.vue index 5fb73f0..22fd026 100644 --- a/src/views/CNAS/process/demand/AddContracts.vue +++ b/src/views/CNAS/process/demand/AddContracts.vue @@ -1,5 +1,5 @@ <template> - <el-dialog title="鏂板妫�楠屽鎵樺崟" :visible.sync="visible" width="1200px"> + <el-dialog :title="title" :visible.sync="visible" width="1200px"> <div id="dialogBody"> <div style="max-height: 75vh;overflow-y: auto;"> <div id="dialogBody"> @@ -119,7 +119,6 @@ <el-radio-group v-if="operationType !== 'view'" v-model="currentInfo.isLeave" - v-removeAriaHidden > <el-radio :label="1">鏄�</el-radio> <el-radio :label="0">鍚�</el-radio> @@ -133,7 +132,7 @@ <p>鏍峰搧澶勭悊鏂瑰紡</p> </td> <td v-if="operationType !== 'view'"> - <el-radio-group v-model="currentInfo.processing" v-removeAriaHidden> + <el-radio-group v-model="currentInfo.processing"> <el-radio :label="0">濮旀墭鍗曚綅鍙栧洖</el-radio> <el-radio :label="1">瀹為獙瀹ゅ鐞�</el-radio> </el-radio-group> @@ -169,7 +168,7 @@ <td > <el-radio-group v-if="operationType !== 'view'" - v-model="currentInfo.send" v-removeAriaHidden + v-model="currentInfo.send" > <el-radio :label="1">鑷彇</el-radio> <el-radio :label="0">鍏朵粬</el-radio> @@ -222,7 +221,7 @@ <p>鍒ゅ畾瑙勫垯</p> </td> <td v-if="operationType !== 'view'" colspan="3"> - <el-radio-group v-model="currentInfo.criterionRule" v-removeAriaHidden> + <el-radio-group v-model="currentInfo.criterionRule"> <el-radio :label="0">涓嶈�冭檻涓嶇‘瀹氬害</el-radio> <el-radio :label="1">鑰冭檻涓嶇‘瀹氬害</el-radio> </el-radio-group> @@ -348,10 +347,7 @@ </div> <span v-if="operationType !== 'view'" slot="footer" class="dialog-footer"> <el-button @click="detailDialogVisible = false">鍙� 娑�</el-button> - <el-button v-if="operationType === 'add'" :loading="buttonLoading" type="primary" @click="handleAdd"> - 纭� 瀹� - </el-button> - <el-button v-if="operationType === 'edit'" :loading="buttonLoading" type="primary" @click="handleEdit"> + <el-button :loading="buttonLoading" type="primary" @click="handleSubmit"> 纭� 瀹� </el-button> </span> @@ -359,21 +355,72 @@ </template> <script> import ZTTLogo from "@/assets/logo/ZTTlogo.png" +import { getInspectionOrderByInsOderId, getInspectionOrderOne, addInspectionOrder, editInspectionOrder } from "@/api/cnas/process/demand/demand.js" + export default { name: 'AddContracts', + props: { + operationType: { + type: String, + default: '' + }, + }, data() { return { + title: '', ZTTLogo, visible: false, - operationType: '', currentInfo:{ orderDetailList: [] }, + buttonLoading: false } }, methods: { - open() { + open(row) { this.visible = true + if(operationType == 'add') { + this.goAddOrder(row) + } else { + + } + }, + // 鎵撳紑寮圭獥鐨勬椂鍊欙紝鏌ヨ闇�瑕佹柊澧炵殑濮旀墭鍗曡鎯� + async goAddOrder(row) { + this.title = '鏂板妫�楠屽鎵樺崟'; + const { code, data } = await getInspectionOrderByInsOderId({ + insOrderId: row.id + }) + if(code == 200) { + this.currentInfo = res.data + this.detailDialogVisible = true + } + }, + async goUpdateOrder(row) { + this.title = '缂栬緫妫�楠屽鎵樺崟'; + const { code, data } = await getInspectionOrderOne({ + insOrderId: row.inspectionOrderId + }) + if(code == 200) { + this.currentInfo = res.data + this.detailDialogVisible = true + } + }, + addOrderDetailList() { + if (this.currentInfo.orderDetailList == null) { + this.currentInfo.orderDetailList = [] + } + this.currentInfo.orderDetailList.push({ + sampleNumber: '', + testItem: '', + testStandard: '', + standardMethodList: '', + remark: '', + }) + }, + + async handleSubmit() { + this.operationType == 'add' ? await addInspectionOrder(this.currentInfo) : await editInspectionOrder(this.currentInfo) } } } diff --git a/src/views/CNAS/process/demand/Edit.vue b/src/views/CNAS/process/demand/Edit.vue index b9223b4..46f3efa 100644 --- a/src/views/CNAS/process/demand/Edit.vue +++ b/src/views/CNAS/process/demand/Edit.vue @@ -16,13 +16,15 @@ :page="page" /> </el-dialog> - <AddContracts ref="addContractsRef" /> + <AddContracts ref="addContractsRef" :operationType="operationType" /> </div> </template> <script> import limsTable from "@/components/Table/lims-table.vue"; import AddContracts from "./AddContracts.vue"; + import { getInsOrderOnInspection } from "@/api/cnas/process/demand/demand.js" + export default { name: 'EditDemand', components: { @@ -33,6 +35,7 @@ return { visible: false, search: {}, + operationType: '', column: [ { label: '搴忓彿', minWidth: '100px' }, { label: '濮旀墭缂栧彿', minWidth: '100px' }, @@ -46,7 +49,8 @@ name: "鏂板濮旀墭鍗�", type: "text", clickFun: (row) => { - this.$refs.addContractsRef.open() + this.operationType = 'add' + this.$refs.addContractsRef.open(row) } } ], @@ -60,9 +64,25 @@ }, } }, + // 鎵撳紑寮圭獥 methods: { - open() { + open(type) { this.visible = true + this.operationType = type + this.getTableData() + }, + openAddContracts(row) { + this.operationType = 'edit' + this.$refs.addContractsRef.open(row) + }, + async getTableData() { + // 鏌ヨ褰撳墠寮圭獥琛ㄦ暟鎹� + const { code, data } = await getInsOrderOnInspection({ + ...this.search, ...this.page + }) + if (code === 200) { + this.tableData = data + } } } } diff --git a/src/views/CNAS/process/demand/index.vue b/src/views/CNAS/process/demand/index.vue index cd4ecad..137aba5 100644 --- a/src/views/CNAS/process/demand/index.vue +++ b/src/views/CNAS/process/demand/index.vue @@ -75,7 +75,7 @@ </el-form-item> </el-form> <div style="margin-bottom: 10px"> - <el-button size="small" type="primary" icon="el-icon-plus" @click="openDialog"> + <el-button size="small" type="primary" icon="el-icon-plus" @click="openDialog('add')"> 鏂� 澧� </el-button> </div> @@ -126,7 +126,10 @@ operation: [ { name: "缂� 杈�", - type: "text" + type: "text", + clickFun: (row) => { + this.$refs.editRef.openAddContracts(row) + } } ], }, @@ -152,8 +155,8 @@ /** * @desc 鎵撳紑妯℃�佹 */ - openDialog() { - this.$refs.editRef.open() + openDialog(type) { + this.$refs.editRef.open(type) } } } -- Gitblit v1.9.3