diff --git a/src/views/modules/base/community/buildTable.vue b/src/views/modules/base/community/buildTable.vue index 337a7c28..17b182b6 100644 --- a/src/views/modules/base/community/buildTable.vue +++ b/src/views/modules/base/community/buildTable.vue @@ -164,10 +164,12 @@
- 全选 - 批量删除 @@ -216,7 +218,9 @@ export default { agencyObj: {},//树所选的小区对象 ownerName: '', ownerPhone: '', - tableData: [], + validTableDataNum: 0,//有效的数据数量,即有权限操作的数据数量 + selection: [], + showDeletBtn: false, //form相关 formShow: false, @@ -282,10 +286,12 @@ export default { const { data, code, msg } = await requestPost(url, params) if (code === 0) { + this.validTableDataNum = 0 this.total = data.total data.list.forEach(item => { if (item.agencyId === this.staffAgencyId) { item.showBtn = true + this.validTableDataNum++ } else { item.showBtn = false } @@ -376,7 +382,7 @@ export default { selectAll (selection) { this.selection = selection - if (selection.length > 0) { + if (selection.length === this.validTableDataNum) { this.selAllFlag = true } else { this.selAllFlag = false @@ -385,19 +391,15 @@ export default { }, selectionChange (selection) { this.selection = selection - - if (selection.length === this.tableData.length) { + this.isIndeterminate = false + if (selection.length === this.validTableDataNum) { this.selAllFlag = true - this.isIndeterminate = false - } else if (selection.length > 0) { - this.selAllFlag = false - this.isIndeterminate = true + } else { this.selAllFlag = false - this.isIndeterminate = false + } }, - async handleDelete (row) { this.$confirm("确认删除?", "提示", { @@ -691,8 +693,13 @@ export default { } }, watch: { - filterText (val) { - this.$refs.tree.filter(val); + selection (val) { + + if (val.length > 0) { + this.showDeletBtn = true + } else { + this.showDeletBtn = false + } } }, props: { diff --git a/src/views/modules/base/community/community.vue b/src/views/modules/base/community/community.vue index 2800a96b..7f91ed38 100644 --- a/src/views/modules/base/community/community.vue +++ b/src/views/modules/base/community/community.vue @@ -215,6 +215,10 @@ export default { let agencyNode = this.$refs.ref_tree.getNode(gridNode.data.pid)//所属社区 obj.agencyId = agencyNode.data.id obj.agencyName = agencyNode.data.label + obj.gridId = gridNode.data.id + obj.gridName = gridNode.data.label + obj.neighborHoodId = neighborHoodNode.data.id + obj.neighborHoodName = neighborHoodNode.data.label if (obj.agencyId === this.staffAgencyId) { this.showImportBtn = true } else { diff --git a/src/views/modules/base/community/communityTable.vue b/src/views/modules/base/community/communityTable.vue index c58a4ca9..0f3e390e 100644 --- a/src/views/modules/base/community/communityTable.vue +++ b/src/views/modules/base/community/communityTable.vue @@ -185,10 +185,12 @@
- 全选 - 批量删除 @@ -238,7 +240,9 @@ export default { ownerName: '', ownerPhone: '', tableData: [], + validTableDataNum: 0,//有效的数据数量,即有权限操作的数据数量 selection: [], + showDeletBtn: false, //form相关 @@ -309,10 +313,12 @@ export default { const { data, code, msg } = await requestPost(url, params) if (code === 0) { + this.validTableDataNum = 0 this.total = data.total data.list.forEach(item => { if (item.agencyId === this.staffAgencyId) { item.showBtn = true + this.validTableDataNum++ } else { item.showBtn = false } @@ -412,9 +418,10 @@ export default { } }, selectAll (selection) { + this.selection = selection - if (selection.length > 0) { + if (selection.length === this.validTableDataNum) { this.selAllFlag = true } else { this.selAllFlag = false @@ -423,16 +430,13 @@ export default { }, selectionChange (selection) { this.selection = selection - - if (selection.length === this.tableData.length) { + this.isIndeterminate = false + if (selection.length === this.validTableDataNum) { this.selAllFlag = true - this.isIndeterminate = false - } else if (selection.length > 0) { - this.selAllFlag = false - this.isIndeterminate = true + } else { this.selAllFlag = false - this.isIndeterminate = false + } }, @@ -739,8 +743,13 @@ export default { } }, watch: { - filterText (val) { - this.$refs.tree.filter(val); + selection (val) { + + if (val.length > 0) { + this.showDeletBtn = true + } else { + this.showDeletBtn = false + } } }, props: { diff --git a/src/views/modules/base/community/roomForm.vue b/src/views/modules/base/community/roomForm.vue index 548762b7..2263b645 100644 --- a/src/views/modules/base/community/roomForm.vue +++ b/src/views/modules/base/community/roomForm.vue @@ -163,9 +163,10 @@ export default { methods: { async initForm (type, row, agencyObj) { + debugger this.$refs.ref_form.resetFields(); this.agencyObj = agencyObj - this.dataForm.neighborHoodId = agencyObj.communityId + this.dataForm.neighborHoodId = agencyObj.neighborHoodId this.dataForm.buildingId = agencyObj.id this.formType = type diff --git a/src/views/modules/base/community/roomTable.vue b/src/views/modules/base/community/roomTable.vue index 1cfead15..3beb3b0b 100644 --- a/src/views/modules/base/community/roomTable.vue +++ b/src/views/modules/base/community/roomTable.vue @@ -156,10 +156,12 @@
- 全选 - 批量删除 @@ -206,7 +208,9 @@ export default { agencyObj: {},//树所选的小区对象 ownerName: '', ownerPhone: '', - tableData: [], + validTableDataNum: 0,//有效的数据数量,即有权限操作的数据数量 + selection: [], + showDeletBtn: false, //form相关 formShow: false, @@ -282,9 +286,11 @@ export default { if (code === 0) { this.total = data.total + this.validTableDataNum = 0 data.list.forEach(item => { if (item.agencyId === this.staffAgencyId) { item.showBtn = true + this.validTableDataNum++ } else { item.showBtn = false } @@ -370,8 +376,7 @@ export default { }, selectAll (selection) { this.selection = selection - - if (selection.length > 0) { + if (selection.length === this.validTableDataNum) { this.selAllFlag = true } else { this.selAllFlag = false @@ -380,16 +385,13 @@ export default { }, selectionChange (selection) { this.selection = selection - - if (selection.length === this.tableData.length) { + this.isIndeterminate = false + if (selection.length === this.validTableDataNum) { this.selAllFlag = true - this.isIndeterminate = false - } else if (selection.length > 0) { - this.selAllFlag = false - this.isIndeterminate = true + } else { this.selAllFlag = false - this.isIndeterminate = false + } }, @@ -654,8 +656,13 @@ export default { } }, watch: { - filterText (val) { - this.$refs.tree.filter(val); + selection (val) { + + if (val.length > 0) { + this.showDeletBtn = true + } else { + this.showDeletBtn = false + } } }, props: {