From d2d13cd468bde491684536bf96fc146c2a2f8991 Mon Sep 17 00:00:00 2001 From: mhsnet Date: Thu, 15 Aug 2024 17:55:30 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BF=BB=E9=A1=B5=E9=80=89=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yys/yysdevice/MaterialListDialog.vue | 69 +++++++++++++++++-- .../jnpf-web/src/views/yys/yysdevice/form.vue | 2 +- 2 files changed, 65 insertions(+), 6 deletions(-) diff --git a/jnpf-java-boot/jnpf-web/src/views/yys/yysdevice/MaterialListDialog.vue b/jnpf-java-boot/jnpf-web/src/views/yys/yysdevice/MaterialListDialog.vue index 82ce515..400381a 100644 --- a/jnpf-java-boot/jnpf-web/src/views/yys/yysdevice/MaterialListDialog.vue +++ b/jnpf-java-boot/jnpf-web/src/views/yys/yysdevice/MaterialListDialog.vue @@ -51,7 +51,7 @@ { + let _row = { + pieceId: o1.materialId, + pieceName: o1.materialName + }; + return _row; + }); + this.sltdRows = _nowRows; + this.pageCurrent = 1; + this.queryParams.pieceId = ""; + this.queryParams.pieceName = ""; + }, getList() { this.listLoading = true; let _query = { @@ -156,13 +174,54 @@ export default { method: "post", data: _query }).then(res => { - var _list = res.data.list; + let _list = res.data.list; this.dbList = _list; this.pageTotal = res.data.pagination.total; + let _sltdRows = this.sltdRows + setTimeout(() => { + this.fnSltdDo(_sltdRows); + }, 500); + }); + }, + fnSltdDo(sltdRowsN) { + this.sltdRows = sltdRowsN.map(o1 => { + let _item = this.dbList.find(o2 => { + return o1.pieceId == o2.pieceId; + }); + if (_item) { + return _item; + } else { + return o1; + } + }); + this.$nextTick(() => { + let _dbListId = this.dbList.map(o1 => { + return o1.pieceId; + }); + let _sltdRows = this.sltdRows.filter(o1 => { + if (_dbListId.includes(o1.pieceId)) { + return true; + } else { + return false; + } + }); + _sltdRows.forEach(row => { + this.$refs.sltTable.toggleRowSelection(row); + }); }); }, fnSltChg(sltdRowsNow) { - this.sltdRows = sltdRowsNow; + let _dbListId = this.dbList.map(o1 => { + return o1.pieceId; + }); + let _sltdRows = this.sltdRows.filter(o1 => { + if (_dbListId.includes(o1.pieceId)) { + return false; + } else { + return true; + } + }); + this.sltdRows = [...sltdRowsNow, ..._sltdRows]; }, fnPageSizeChg(pageSizeNow) { this.pageSize = pageSizeNow; @@ -185,7 +244,7 @@ export default { this.visible = false; }, fnOk() { - this.$emit('cbSltdChg', this.sltdRows) + this.$emit("cbSltdChg", this.sltdRows); this.fnCancel(); } } diff --git a/jnpf-java-boot/jnpf-web/src/views/yys/yysdevice/form.vue b/jnpf-java-boot/jnpf-web/src/views/yys/yysdevice/form.vue index c22e6a6..340247b 100644 --- a/jnpf-java-boot/jnpf-web/src/views/yys/yysdevice/form.vue +++ b/jnpf-java-boot/jnpf-web/src/views/yys/yysdevice/form.vue @@ -287,7 +287,7 @@ export default { methods: { fnMaterialListDialog() { this.$nextTick(() => { - this.$refs.materialListDialog.init(); + this.$refs.materialListDialog.init(this.dataForm.data); }); }, fnSltdMaterialChg(nowRows) {