diff --git a/src/views/purchase/purchaseOrder/relation/chooseproducts.vue b/src/views/purchase/purchaseOrder/relation/chooseproducts.vue index 7a721ab..e5a2323 100644 --- a/src/views/purchase/purchaseOrder/relation/chooseproducts.vue +++ b/src/views/purchase/purchaseOrder/relation/chooseproducts.vue @@ -32,8 +32,8 @@
- + @@ -96,7 +96,10 @@ goodsSkuCode: '', }, total: 0 - } + }, + tableData: [], + selectedItems: [], + randomKey: Math.random(), } }, methods: { @@ -122,6 +125,7 @@ if (response.success) { this.listQuery.total = response.data.total this.list = response.data.records + this.selectedPreExisting(this.selectedItems) } }) }, @@ -139,9 +143,9 @@ this.listQuery.params.goodsSkuCode = '' this.getList() }, - handleSelectionChange(row) { - this.sids = row - }, + // handleSelectionChange(row) { + // this.sids = row + // }, showAdd(createOrgSid) { // const aa = [] // if (value.length > 0) { @@ -160,7 +164,13 @@ }, // 添加修改返回 AddUpdateReturn() { + this.sids = [] + this.selectedItems.forEach(row => { + this.sids.push(row) + }) + if (this.sids.length > 0) { + this.selectedItems = [] this.$emit('backData', this.sids) } else { this.$notify({ @@ -174,6 +184,82 @@ // 返回 handleReturn() { this.$emit('doback') + this.selectedItems = [] + }, + // //设置页面数据 + // setTabelData() { + // let { + // current, + // size + // } = this.pages + // this.tableData = this.list.slice((current - 1) * size, (current - 1) * size + size) + // //randomKey是table数据改动时,刷新table的 + // this.randomKey = Math.random() + // this.selectedPreExisting(this.selectedItems) + // }, + // //监听翻页 + // handleCurrentChange(index) { + // this.listQuery.current = index + // this.setTabelData() + // }, + //选中table已有数据 + selectedPreExisting(rows) { + if (rows.length > 0) { + //这里使用this.$nextTick是防止表格未渲染完成就执行,导致无法添加选中效果 + this.$nextTick(() => { + rows.forEach(row => { + //判断row是存在当前tableData + let selectedItem = this.list.find(item => item.sid == row.sid) + this.$refs.multipleTable.toggleRowSelection(selectedItem); + }); + }) + } else { + this.$refs.multipleTable.clearSelection(); + } + }, + //表格单选 + select(selection, row) { + + console.log("selection", selection) + //因为翻页之后,点选时selection会出现undefined,所以这里需要进行判断 + //这里可以通过判断选择selection中有没有row,就可以判断出是增加还是删减 + if (selection && selection.find(item => item && (item.sid == row.sid))) { + console.log("this.selectedItems+++++", this.selectedItems) + this.addRows([row]) + } else { + console.log("this.selectedItems------", this.selectedItems) + this.deleteRows([row]) + } + }, + //表格全选 + selectAll(selection) { + //判断是选中还是取消 + if (selection.length > 0) { + this.addRows(this.list) + } else { + this.deleteRows(this.list) + } + }, + //添加选中 + addRows(rows) { + rows.forEach(row => { + //过滤,当selectedItems有此条数据时,则直接返回,不执行添加 + if (this.selectedItems.find(item => item.sid == row.sid)) { + return + } + this.selectedItems.push(row) + }); + }, + //取消选中 + deleteRows(rows) { + //当selectedItems为空数组时,不执行删除 + if (this.selectedItems.length == 0) { + return + } + rows.forEach(row => { + var index = this.selectedItems.findIndex(item => item.sid == row.sid) + this.selectedItems.splice(index, 1) + }) } } } diff --git a/src/views/purchase/purchaseReview/index.vue b/src/views/purchase/purchaseReview/index.vue index 5cbebbd..f975c9d 100644 --- a/src/views/purchase/purchaseReview/index.vue +++ b/src/views/purchase/purchaseReview/index.vue @@ -279,7 +279,10 @@ purchaseAppendixList: [], purchaseBillDetailList: {} }, - orderInfo: {}, + orderInfo: { + state: 1, + remarks: "" + }, btnList: [{ type: 'primary', size: 'small', @@ -732,8 +735,19 @@ }, handleSave() { + console.log("handleSave》》》》", this.orderInfo) + this.orderInfo.sid = this.sids[0] + if (this.orderInfo.state == 1) { + this.$message({ + type: 'warning', + message: '请选择审核意见', + showClose: true + }) + return + } + if (this.orderInfo.state == 3) { if (this.orderInfo.remarks == '') { this.$message({ @@ -741,8 +755,9 @@ message: '请填写备注', showClose: true }) + return } - return + } req.examine(this.orderInfo).then((resp) => { diff --git a/src/views/system/userManage/userManageList.vue b/src/views/system/userManage/userManageList.vue index 7131a15..c3687a7 100644 --- a/src/views/system/userManage/userManageList.vue +++ b/src/views/system/userManage/userManageList.vue @@ -55,6 +55,7 @@ +