From 15738642b0c81e56735933d002225cbb2cd274e8 Mon Sep 17 00:00:00 2001 From: lb Date: Fri, 23 Feb 2024 16:32:01 +0800 Subject: [PATCH] update --- src/views/specialEquipment/check/Config.vue | 15 +- .../specialEquipment/check/Content-edit.vue | 27 +- src/views/specialEquipment/check/Content.vue | 74 +++- src/views/specialEquipment/check/Record.vue | 344 ++++-------------- 4 files changed, 157 insertions(+), 303 deletions(-) diff --git a/src/views/specialEquipment/check/Config.vue b/src/views/specialEquipment/check/Config.vue index 1ec798e2..aef4b49b 100644 --- a/src/views/specialEquipment/check/Config.vue +++ b/src/views/specialEquipment/check/Config.vue @@ -354,18 +354,21 @@ export default { }, /** 导出按钮操作 */ handleExport() { - // 处理查询参数 - let params = { ...this.queryParams }; - params.pageNo = undefined; - params.pageSize = undefined; this.$modal .confirm('是否确认导出所有巡检设置?') .then(() => { this.exportLoading = true; - return exportEquipmentTypeExcel(params); + return this.$axios({ + url: '/base/equipment-check-order/export-excel', + params: { + name: this.queryParams.name, + status: 0, + special: true, + }, + }); }) .then((response) => { - this.$download.excel(response, '巡检设置.xls'); + this.$download.excel(response, '巡检单设置.xls'); this.exportLoading = false; }) .catch(() => {}); diff --git a/src/views/specialEquipment/check/Content-edit.vue b/src/views/specialEquipment/check/Content-edit.vue index 010b46b5..95082642 100644 --- a/src/views/specialEquipment/check/Content-edit.vue +++ b/src/views/specialEquipment/check/Content-edit.vue @@ -32,6 +32,7 @@ @@ -42,6 +43,7 @@ v-model="form.departmentId" filterable clearable + :disabled="disableEdit" :placeholder="`请选择部门`"> @@ -123,7 +128,9 @@
-
+
添加内容 @@ -139,6 +146,7 @@ @@ -154,8 +162,14 @@
@@ -314,6 +328,7 @@ export default { ], row: null, groupOptions: [], + disableEdit: false, }; }, computed: { @@ -375,8 +390,8 @@ export default { console.log('handleEmitFun', val); }, - init(row) { - console.log('row', row); + init(row, detail) { + if (detail) this.disableEdit = true; this.visible = true; this.row = row; this.getInfo(row); @@ -390,7 +405,7 @@ export default { if (res.code == 0) { this.form = res.data; this.form.groupClass = res.data.groupClass.split(','); - this.form.checkPerson = res.data.checkPerson.split(','); + this.form.checkPerson = res.data.checkPerson?.split(','); this.formLoading = false; } this.formLoading = false; diff --git a/src/views/specialEquipment/check/Content.vue b/src/views/specialEquipment/check/Content.vue index 43debe1f..7044619a 100644 --- a/src/views/specialEquipment/check/Content.vue +++ b/src/views/specialEquipment/check/Content.vue @@ -233,6 +233,32 @@ export default { this.title = ''; }, + /** search bar click */ + async searchBarClicked(btn) { + switch (btn.btnName) { + /** 批量确认 */ + case 'batch-confirm': + if (this.$refs['check-order-list-table'].selectedOrder.length == 0) { + this.$message.warning('请选择待确认的巡检单'); + return; + } + const res = await this.$axios({ + url: + '/base/equipment-check-order/confirm?confirmPerson=' + + this.$store.getters.userId, + method: 'put', + data: this.$refs['check-order-list-table'].selectedOrder.map( + (item) => item.id + ), + }); + if (res.code == 0) { + this.$message.success('确认成功'); + this.getList(); + } + break; + } + }, + /** 搜索按钮操作 */ handleQuery() { this.queryParams.pageNo = 1; @@ -258,15 +284,35 @@ export default { }, /** 编辑 */ - handleEdit(row) { + handleEdit(row, detail) { this.editOpen = true; this.$nextTick(() => { - this.$refs['content-edit'].init(row); + this.$refs['content-edit'].init(row, detail ?? false); }); }, /** 确认巡检单 */ - handleConfirm(row) {}, + handleConfirm(row) { + const id = row.id; + this.$modal + .confirm('是否确认巡检单"' + row.name + '"?') + .then(() => { + return this.$axios({ + url: + '/base/equipment-check-order/confirm?confirmPerson=' + + this.$store.getters.userId, + // '/base/equipment-check-order/confirm?ids=' + JSON.stringify([id]).replaceAll("\"", ''), + method: 'put', + data: [id], + }); + }) + .then((res) => { + this.getList(); + res.code == 0 && this.$modal.msgSuccess('确认成功'); + res.code != 0 && this.$modal.msgError('确认失败'); + }) + .catch(() => {}); + }, /** 删除巡检单 */ handleDelete(row) { @@ -284,27 +330,27 @@ export default { }, handleDetail(row) { - this.addOrUpdateVisible = true; - this.addOrEditTitle = '详情'; - this.$nextTick(() => { - this.$refs.addOrUpdate.init(row?.id, true); - }); + this.handleEdit(row, true); }, /** 导出按钮操作 */ handleExport() { - // 处理查询参数 - let params = { ...this.queryParams }; - params.pageNo = undefined; - params.pageSize = undefined; this.$modal .confirm('是否确认导出所有巡检设置?') .then(() => { this.exportLoading = true; - return exportEquipmentTypeExcel(params); + return this.$axios({ + url: '/base/equipment-check-order/export-excel', + // params: { + // name: this.queryParams.name, + // status: 1, + // special: true, + // }, + responseType: 'blob', + }); }) .then((response) => { - this.$download.excel(response, '巡检设置.xls'); + this.$download.excel(response, '巡检单待确认.xls'); this.exportLoading = false; }) .catch(() => {}); diff --git a/src/views/specialEquipment/check/Record.vue b/src/views/specialEquipment/check/Record.vue index f76dbbe2..54ed0c51 100644 --- a/src/views/specialEquipment/check/Record.vue +++ b/src/views/specialEquipment/check/Record.vue @@ -11,7 +11,6 @@ @@ -25,7 +24,7 @@ v-if="tableBtn.length" slot="handleBtn" label="操作" - :width="120" + :width="70" :method-list="tableBtn" @clickBtn="handleTableBtnClick" /> @@ -37,45 +36,16 @@ :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" @pagination="getList" /> - - - - - - -