From f72cd9d68e0f02bdb9b567c127a5368595a57eff Mon Sep 17 00:00:00 2001 From: lb Date: Fri, 23 Feb 2024 15:11:36 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E5=BE=85=E7=A1=AE=E8=AE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../check/CheckOrderListTable.vue | 2 +- .../specialEquipment/check/Content-add.vue | 18 ++- .../specialEquipment/check/Content-edit.vue | 98 ++++++++-------- src/views/specialEquipment/check/Content.vue | 106 +++--------------- src/views/specialEquipment/check/Record.vue | 7 +- 5 files changed, 81 insertions(+), 150 deletions(-) diff --git a/src/views/specialEquipment/check/CheckOrderListTable.vue b/src/views/specialEquipment/check/CheckOrderListTable.vue index 8d1400e5..042771ef 100644 --- a/src/views/specialEquipment/check/CheckOrderListTable.vue +++ b/src/views/specialEquipment/check/CheckOrderListTable.vue @@ -64,7 +64,7 @@ label="确认截止时间" prop="confirmDueTime"> - + - + @@ -157,7 +155,9 @@ @@ -230,7 +230,7 @@ export default { label: '巡检项目', }, { - prop: 'maintenanceDes', + prop: 'checkResult', label: '巡检结果', }, ], @@ -239,10 +239,10 @@ export default { attrTitle: '', attrForm: { id: null, - logId: null, + orderId: null, program: null, - maintenanceDes: null, - remark: null, + checkResult: null, + equipmentId: null, }, attrFormVisible: false, attrRows: [ @@ -252,12 +252,6 @@ export default { label: '设备名称', prop: 'equipmentId', url: '/base/core-equipment/page?pageNo=1&pageSize=100&special=true', - // method: 'post', - // queryParams: { - // pageNo: 1, - // pageSize: 100, - // special: true, - // }, rules: [ { required: true, message: '设备不能为空', trigger: 'blur' }, ], @@ -266,22 +260,21 @@ export default { [ { input: true, - label: '保养项目', + label: '巡检项目', prop: 'program', + rules: [ + { required: true, message: '巡检项目不能为空', trigger: 'blur' }, + ], }, ], [ { input: true, - label: '保养描述', - prop: 'maintenanceDes', - }, - ], - [ - { - input: true, - label: '备注', - prop: 'remark', + label: '巡检结果', + prop: 'checkResult', + rules: [ + { required: true, message: '巡检结果不能为空', trigger: 'blur' }, + ], }, ], ], @@ -333,6 +326,7 @@ export default { }, }, mounted() { + this.formLoading = true; this.getList('department'); this.getList('groupClass'); this.getList('inspector'); @@ -360,12 +354,12 @@ export default { this.btnLoading = true; this.$nextTick(async () => { const { code, data } = await this.$axios({ - url: '/base/equipment-maintain-log/update', + url: '/base/equipment-check-order/update', method: 'put', data: { ...this.form, - maintainWorker: this.form.maintainWorker.join(','), - planMaintainWorker: this.form.planMaintainWorker?.join(','), + groupClass: this.form.groupClass.join(','), + checkPerson: this.form.checkPerson.join(','), }, }); if (code == 0) { @@ -385,19 +379,18 @@ export default { console.log('row', row); this.visible = true; this.row = row; - // this.getInfo(row); - // this.getAttrList(row); + this.getInfo(row); + this.getAttrList(row); }, async getInfo(row) { - this.formLoading = true; const res = await this.$axios( - '/base/equipment-maintain-log/get?id=' + row.id + '/base/equipment-check-order/get?id=' + row.id ); if (res.code == 0) { this.form = res.data; - this.form.maintainWorker = res.data.maintainWorker.split(','); - this.form.planMaintainWorker = res.data.planMaintainWorker?.split(','); + this.form.groupClass = res.data.groupClass.split(','); + this.form.checkPerson = res.data.checkPerson.split(','); this.formLoading = false; } this.formLoading = false; @@ -407,11 +400,11 @@ export default { if (!row) row = this.row; this.attrListLoading = true; const res = await this.$axios({ - url: '/base/equipment-maintain-log-det/page', + url: '/base/equipment-check-order-det/page', method: 'get', params: { ...this.attrQuery.params, - logId: row.id, + orderId: row.id, ...condition, }, }); @@ -456,11 +449,14 @@ export default { })) ); } - this.inspectorOptions = inspectorList; + this.inspectorOptions = inspectorList; break; case 'groupClass': res = await this.$axios(urls[1]); - this.lineList = res.data || []; + this.groupOptions = (res.data || []).map((item) => ({ + label: item.name, + value: item.id, + })); break; } this.formLoading = false; @@ -489,10 +485,10 @@ export default { resetAttrform() { this.attrForm = { id: null, - logId: this.row.id, - maintenanceDes: '', + orderId: null, + equipmentId: null, program: null, - remark: null, + checkResult: null, }; }, @@ -507,27 +503,27 @@ export default { // 编辑属性 async handleEditAttr(attrId) { const res = await this.$axios({ - url: '/base/equipment-maintain-log-det/get', + url: '/base/equipment-check-order-det/get', method: 'get', params: { id: attrId }, }); if (res.code == 0) { this.attrForm = res.data; - this.attrTitle = '编辑设备属性'; + this.attrTitle = '编辑巡检单详情'; this.attrFormVisible = true; } }, // 删除属性 handleDeleteAttr(attrId) { - this.$confirm('确定删除该保养内容?', '提示', { + this.$confirm('确定删除该巡检内容?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning', }) .then(async () => { const res = await this.$axios({ - url: '/base/equipment-maintain-log-det/delete?id=' + attrId, + url: '/base/equipment-check-order-det/delete?id=' + attrId, method: 'delete', }); if (res.code == 0) { @@ -556,10 +552,10 @@ export default { this.attrFormSubmitting = true; const res = await this.$axios({ url: isEdit - ? '/base/equipment-maintain-log-det/update' - : '/base/equipment-maintain-log-det/create', + ? '/base/equipment-check-order-det/update' + : '/base/equipment-check-order-det/create', method: isEdit ? 'put' : 'post', - data: this.attrForm, + data: { ...this.attrForm, orderId: this.row.id }, }); if (res.code == 0) { diff --git a/src/views/specialEquipment/check/Content.vue b/src/views/specialEquipment/check/Content.vue index 3c8c66fe..43debe1f 100644 --- a/src/views/specialEquipment/check/Content.vue +++ b/src/views/specialEquipment/check/Content.vue @@ -11,25 +11,8 @@ - - - // val != null && val > 24 // ? `${(val - (val % 24)) / 24}天${val % 24}小时` @@ -207,28 +191,19 @@ export default { handleSubmit() { this.$refs.add.dataFormSubmit(); }, + successSubmit() { this.cancel(); this.getList(); }, + initSearchBar() { this.http('/base/core-equipment/listAll', 'get').then(({ data }) => { this.allSpecialEquipments = data.filter((item) => item.special); this.setSearchBarEquipmentList(data.filter((item) => item.special)); }); }, - // 设备大类改变 - handleSearchBarChange({ param, value }) { - if ('specialType' === param) { - if (!value) { - this.setSearchBarEquipmentList(this.allSpecialEquipments); - return; - } - this.setSearchBarEquipmentList( - this.allSpecialEquipments.filter((item) => item.specialType == value) - ); - } - }, + setSearchBarEquipmentList(eqList) { this.$set( this.searchBarFormConfig[2], @@ -239,6 +214,7 @@ export default { })) ); }, + /** 查询列表 */ getList() { this.loading = true; @@ -249,33 +225,20 @@ export default { this.loading = false; }); }, + /** 取消按钮 */ cancel() { this.$refs.add.reset(); this.open = false; this.title = ''; }, - /** 表单重置 */ - reset() { - this.form = { - id: null, - name: null, - content: null, - program: null, - remark: null, - }; - this.resetForm('form'); - }, + /** 搜索按钮操作 */ handleQuery() { this.queryParams.pageNo = 1; this.getList(); }, - /** 重置按钮操作 */ - resetQuery() { - this.resetForm('queryForm'); - this.handleQuery(); - }, + /** 新增按钮操作 */ handleAdd() { this.open = true; @@ -284,6 +247,7 @@ export default { this.$refs.add.init(); }); }, + /** 修改按钮操作 */ handleUpdate(row) { this.open = true; @@ -292,29 +256,7 @@ export default { this.$refs.add.init(row); }); }, - /** 提交按钮 */ - submitForm() { - this.$refs['form'].validate((valid) => { - if (!valid) { - return; - } - // 修改的提交 - if (this.form.id != null) { - this.put(this.form).then((response) => { - this.$modal.msgSuccess('修改成功'); - this.open = false; - this.getList(); - }); - return; - } - // 添加的提交 - this.post(this.form).then((response) => { - this.$modal.msgSuccess('新增成功'); - this.open = false; - this.getList(); - }); - }); - }, + /** 编辑 */ handleEdit(row) { this.editOpen = true; @@ -322,8 +264,10 @@ export default { this.$refs['content-edit'].init(row); }); }, + /** 确认巡检单 */ handleConfirm(row) {}, + /** 删除巡检单 */ handleDelete(row) { const id = row.id; @@ -338,23 +282,7 @@ export default { }) .catch(() => {}); }, - // 处理表格按钮 - handleTableBtnClick({ data, type }) { - switch (type) { - case 'edit': - this.handleUpdate(data); - break; - case 'delete': - this.handleDelete(data); - break; - case 'detail': - this.handleDetail(data); - break; - case 'add': - this.handleAddDetail(data); - break; - } - }, + handleDetail(row) { this.addOrUpdateVisible = true; this.addOrEditTitle = '详情'; @@ -362,13 +290,7 @@ export default { this.$refs.addOrUpdate.init(row?.id, true); }); }, - handleAddDetail(row) { - this.addOrUpdateVisible = true; - this.addOrEditTitle = '添加内容'; - this.$nextTick(() => { - this.$refs.addOrUpdate.init(row); - }); - }, + /** 导出按钮操作 */ handleExport() { // 处理查询参数 diff --git a/src/views/specialEquipment/check/Record.vue b/src/views/specialEquipment/check/Record.vue index 59de97e6..f76dbbe2 100644 --- a/src/views/specialEquipment/check/Record.vue +++ b/src/views/specialEquipment/check/Record.vue @@ -278,10 +278,8 @@ export default { queryParams: { pageNo: 1, pageSize: 10, - actualTime: null, - configId: null, special: true, - specialType: null, + status: 2, }, // 表单参数 form: {}, @@ -328,8 +326,7 @@ export default { this.loading = true; // 执行查询 this.recv(this.queryParams).then((response) => { - // this.list = response.data.list; - this.list = [{}]; + this.list = response.data.list; this.total = response.data.total; this.loading = false; });