diff --git a/src/components/DialogForm/index.vue b/src/components/DialogForm/index.vue index ac7e32ac..3d19ec29 100644 --- a/src/components/DialogForm/index.vue +++ b/src/components/DialogForm/index.vue @@ -360,8 +360,9 @@ export default { promiseList.push(async () => { const response = await this.$axios(opt.url, { method: opt.method ?? 'get', + // data: opt.method == 'post' ? opt.queryParams : null }); - console.log('[dialogForm:handleOptions:response]', response); + // console.log('[dialogForm:handleOptions:response]', response); if (opt.select) { // 处理下拉框选项 const list = diff --git a/src/views/specialEquipment/maintain/Record--detail.vue b/src/views/specialEquipment/maintain/Record--detail.vue index 8eaee473..9d85a4d1 100644 --- a/src/views/specialEquipment/maintain/Record--detail.vue +++ b/src/views/specialEquipment/maintain/Record--detail.vue @@ -27,7 +27,7 @@
- 保养信息 +
保养详情
- (val != null ? val : '---'), }, { prop: 'departmentName', @@ -514,30 +515,7 @@ export default { }, created() { this.initSearchBar(); - // if (this.$route.query) { - // this.queryParams.specialType = - // this.$route.query?.specialType ?? undefined; - // this.queryParams.equipmentId = - // this.$route.query?.equipmentId ?? undefined; - // this.queryParams.maintainPlanId = - // this.$route.query?.maintainPlanId ?? undefined; - // this.queryParams.relatePlan = this.$route.query?.relatePlan ?? undefined; - // this.queryParams.startTime = this.$route.query?.createTime ?? undefined; - // this.searchBarFormConfig[0].defaultSelect = - // this.$route.query.specialType ?? undefined; - // this.searchBarFormConfig[1].defaultSelect = - // this.$route.query.equipmentId ?? undefined; - // this.searchBarFormConfig[2].defaultSelect = - // this.$route.query.maintainPlanId ?? undefined; - // this.searchBarFormConfig[3].defaultSelect = - // this.$route.query?.createTime ?? undefined; - // this.searchBarFormConfig[4].defaultSelect = - // Number(this.$route.query.relatePlan) ?? undefined; - // } this.getList(); - // if (this.$route.query.addRecord) { - // this.handleAdd(); - // } }, methods: { handleEmitFun({ action, value }) { @@ -546,7 +524,7 @@ export default { this.recordDetailVisible = true; this.$nextTick(() => { this.$refs.recordDetailDrawer.show({ - id: value.id, + id: value.maintainPlanId, planMaintainWorker: value.planMaintainWorker, maintainWorker: value.maintainWorker, }); @@ -566,21 +544,7 @@ export default { ); } }, - // setSearchBarEquipmentList(eqList) { - // this.$set( - // this.searchBarFormConfig[1], - // 'selectOptions', - // eqList.map((item) => ({ - // name: item.name, - // id: item.id, - // })) - // ); - // }, initSearchBar() { - // this.http('/base/core-equipment/listAll', 'get').then(({ data }) => { - // this.allSpecialEquipments = data.filter((item) => item.special); - // this.setSearchBarEquipmentList(data.filter((item) => item.special)); - // }); this.http('/base/equipment-maintain-plan/page', 'get', { pageNo: 1, pageSize: 100, @@ -588,7 +552,6 @@ export default { }).then(({ data }) => { this.$set( this.searchBarFormConfig[0], - // this.searchBarFormConfig[2], 'selectOptions', (data?.list || []).map((item) => ({ name: item.name, @@ -602,20 +565,7 @@ export default { this.loading = true; // 执行查询 this.recv({ ...this.queryParams, special: true }).then((response) => { - this.list = [ - { - id: 213, - maintainOrderNumber: 123, - planName: 'hhh', - departmentName: 'asdf', - lineName: 456, - planStartTime: '2024-01-01', - planEndTime: '2024-01-01', - startTime: '2024-01-01', - endTime: '2024-01-01', - relatePlan: 1, - }, - ]; // response.data.list; + this.list = response.data.list; this.total = response.data.total; this.loading = false; }); @@ -670,19 +620,6 @@ export default { this.form.relatePlan = tempRow.nextMaintainTime ? 1 : 2; this.form.startTime = tempRow.nextMaintainTime; this.form.maintainPlanId = tempRow.id; - // await (() => { - // return new Promise((acpt, rejt) => { - // this.form.relatePlan = - // this.$route.query.relatePlan || - // (tempRow.nextMaintainTime ? 1 : 2); - // this.form.startTime = tempRow.nextMaintainTime; - // acpt(); - // }); - // })(); - // this.$nextTick(() => { - // this.form.maintainPlanId = tempRow.id; - // this.form.equipmentId = tempRow.equipmentId; - // }); } if (this.$route.query.isAdd) { // 赋值 diff --git a/src/views/specialEquipment/maintain/WaitingList.vue b/src/views/specialEquipment/maintain/WaitingList.vue index 2a836a57..d23031f5 100644 --- a/src/views/specialEquipment/maintain/WaitingList.vue +++ b/src/views/specialEquipment/maintain/WaitingList.vue @@ -488,17 +488,25 @@ export default { // } }, methods: { - searchBarClicked(btn) { - console.log('searchBarClicked', btn); + /** 批量确认 */ + async searchBarClicked(btn) { switch (btn.btnName) { case 'batchConfirm': if (this.$refs['waiting-list-table'].selectedPlan.length == 0) { this.$message.warning('请选择待确认的设备保养记录'); + return; + } + const res = await this.$axios({ + url: '/base/equipment-maintain-log/confirm', + method: 'put', + data: this.$refs['waiting-list-table'].selectedPlan.map( + (item) => item.id + ), + }); + if (res.code == 0) { + this.$message.success('确认成功'); + this.getList(); } - console.log( - 'selectedPlan', - this.$refs['waiting-list-table'].selectedPlan - ); break; } }, @@ -599,11 +607,7 @@ export default { relatePlan: 2, confirmed: false, }).then((response) => { - this.list = response.data.list.map((item) => ({ - ...item, - planName: '---', - _selection: 0b10, - })); + this.list = response.data.list; this.total = response.data.total; this.loading = false; }); @@ -627,7 +631,7 @@ export default { endTime: null, planStartTime: null, planEndTime: null, - confirmed: null, + confirmed: false, remark: null, special: false, }; @@ -646,36 +650,18 @@ export default { /** 新增按钮操作 */ handleAdd() { this.reset(); - // if (this.$route.query.addRecord) { - // // 赋值 - // const tempRow = this.$route.query.row; - // this.form.equipmentId = tempRow.equipmentId; - // this.form.relatePlan = tempRow.nextMaintainTime ? 1 : 2; - // this.form.startTime = tempRow.nextMaintainTime; - // this.form.maintainPlanId = tempRow.id; - // // await (() => { - // // return new Promise((acpt, rejt) => { - // // this.form.relatePlan = - // // this.$route.query.relatePlan || - // // (tempRow.nextMaintainTime ? 1 : 2); - // // this.form.startTime = tempRow.nextMaintainTime; - // // acpt(); - // // }); - // // })(); - // // this.$nextTick(() => { - // // this.form.maintainPlanId = tempRow.id; - // // this.form.equipmentId = tempRow.equipmentId; - // // }); - // } - // if (this.$route.query.isAdd) { - // // 赋值 - // this.form.equipmentId = this.$route.query.equipmentId; - // this.form.maintainPlanId = this.$route.query.maintainPlanId; - // } this.open = true; this.title = '添加待确认保养记录'; }, + getConfirmed() { + return this.$confirm('是否直接确认保养记录', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + }); + }, + /** 提交按钮 */ submitForm() { this.$refs['form'].validate((valid) => { @@ -696,37 +682,48 @@ export default { }); return; } + // 添加的提交 - this.post({ - ...this.form, - maintainWorker: this.form.maintainWorker.join(','), - special: true, - relatePlan: 2, - }).then((response) => { - this.$modal.msgSuccess('新增成功'); - - // 跳转至 备品备件 保养 - // const toSparePartsMaintain = () => { - // this.open = false; - // }; - - // this.$confirm('是否有备品备件更换?', '提示', { - // confirmButtonText: '有', - // cancelButtonText: '没有', - // }) - // .then(toSparePartsMaintain) - // .catch(() => { - // this.open = false; - // this.getList(); - // }); - this.open = false; - this.getList(); - }); + this.getConfirmed() + .then((confirmed) => { + this.post({ + ...this.form, + maintainWorker: this.form.maintainWorker.join(','), + special: true, + relatePlan: 2, + confirmed: true, + }).then((response) => { + this.$modal.msgSuccess('新增成功'); + this.open = false; + this.getList(); + }); + }) + .catch((err) => { + this.post({ + ...this.form, + maintainWorker: this.form.maintainWorker.join(','), + special: true, + relatePlan: 2, + confirmed: false, + }).then((response) => { + this.$modal.msgSuccess('新增成功'); + this.open = false; + this.getList(); + }); + }); }); }, /** 确认 */ - handleConfirm(row) { - console.log('confirm', row); + async handleConfirm(row) { + const res = await this.$axios({ + url: '/base/equipment-maintain-log/confirm', + method: 'put', + data: [row.id], + }); + if (res.code == 0) { + this.$message.success('确认成功'); + this.getList(); + } }, /** 编辑 */ async handleEdit(row) { @@ -738,10 +735,6 @@ export default { this.form.maintainWorker = res.data.maintainWorker.split(','); this.openPlannedDrawer = true; } else { - // 非计划型 2 - // const res = await this.info({ id: row.id }); - // this.form = res.data; - // this.form.maintainWorker = res.data.maintainWorker.split(','); this.openUnplannedDrawer = true; this.$nextTick(() => { this.$refs.unplanned.init(row); @@ -750,21 +743,21 @@ export default { }, /** 删除按钮操作 */ handleDelete(row) { - console.log('delete', row); - return; - const id = row.id; this.$modal .confirm( '是否确认删除设备保养单号为"' + row.maintainOrderNumber + '"的数据项?' ) - .then(function () { - // return deleteEqMaintainLog(id); + .then(() => { + return this.$axios({ + url: '/base/equipment-maintain-log/delete?id=' + row.id, + method: 'delete', + }); }) .then(() => { this.getList(); this.$modal.msgSuccess('删除成功'); }) - .catch(() => {}); + .catch(console.error); }, handleDetail(row) { console.log('detail', row); diff --git a/src/views/specialEquipment/maintain/WaitingListTable.vue b/src/views/specialEquipment/maintain/WaitingListTable.vue index 52262a61..edad3470 100644 --- a/src/views/specialEquipment/maintain/WaitingListTable.vue +++ b/src/views/specialEquipment/maintain/WaitingListTable.vue @@ -39,18 +39,21 @@ width="128" label="设备保养单号" prop="maintainOrderNumber"> - - - + + + + + + + + + +
+
@@ -245,16 +247,18 @@ @close="closeAttrForm" @cancel="closeAttrForm" @confirm="submitAttrForm"> - + v-model="attrForm" + :rows="attrRows" />