Browse Source

[政策找人/公共服务/服务找人]完成批量删除

V1.0
wxz 3 years ago
parent
commit
7101b89923
  1. 39
      src/views/modules/communityService/commonDemand/index.vue
  2. 45
      src/views/modules/communityService/fuwuzhaoren/index.vue
  3. 40
      src/views/modules/communityService/policy/policyList.vue

39
src/views/modules/communityService/commonDemand/index.vue

@ -153,7 +153,15 @@
v-loading="tableLoading"
class="m-table-item"
style="width: 100%"
:height="maxTableHeight">
:height="maxTableHeight"
@selection-change="onMultiSelection">
<el-table-column
type="selection"
fixed="left"
align="center"
width="50"
/>
<el-table-column label="序号"
fixed="left"
type="index"
@ -256,6 +264,9 @@
</el-table>
<div>
<el-button @click="onDeleteBatch" size="small" style="margin-top: 15px;">
批量删除
</el-button>
<el-pagination @size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page.sync="pageNo"
@ -458,7 +469,8 @@
policyId: '',
showPersonList: false,
ruleList: []
ruleList: [],
multiSelection: [], //
};
},
computed: {
@ -805,6 +817,29 @@
this.pageNo = 1
this.getTableData()
},
//
onMultiSelection(rows) {
this.multiSelection = rows;
},
//
onDeleteBatch() {
if (this.multiSelection.length == 0) {
this.$message.warning('请先选中至少一项');
return;
}
this.$confirm('删除之后无法恢复,确认删除?', '提示', {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
this.cancelFuwu(this.multiSelection.map(e => e.serviceRecordId));
}).catch((err) => {
console.error(err);
this.$message.error('删除失败');
});
},
},
props: {

45
src/views/modules/communityService/fuwuzhaoren/index.vue

@ -171,7 +171,16 @@
v-loading="tableLoading"
class="m-table-item"
style="width: 100%"
:height="maxTableHeight">
:height="maxTableHeight"
@select-all="onMultiSelect"
@selection-change="onMultiSelect">
<el-table-column
type="selection"
fixed="left"
align="center"
width="50"/>
<el-table-column label="序号"
fixed="left"
type="index"
@ -271,6 +280,9 @@
</el-table>
<div>
<el-button @click="onDeleteBatch" size="small" style="margin-top: 15px;">
批量删除
</el-button>
<el-pagination @size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page.sync="pageNo"
@ -469,7 +481,10 @@ export default {
policyId: '',
showPersonList: false,
ruleList: []
ruleList: [],
//
multiSelectedRows: []
};
},
computed: {
@ -796,6 +811,32 @@ export default {
this.pageNo = 1
this.getTableData()
},
//
onMultiSelect(row) {
this.multiSelectedRows = row;
},
//
onDeleteBatch() {
if (this.multiSelectedRows.length == 0) {
return;
}
this.$confirm("删除之后无法恢复,确认删除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
let serviceRecordIds = this.multiSelectedRows.map(item => item.serviceRecordId)
this.cancelFuwu(serviceRecordIds)
})
.catch((err) => {
if (err == "cancel") {
}
});
}
},
props: {

40
src/views/modules/communityService/policy/policyList.vue

@ -125,7 +125,7 @@
<el-button
type="primary"
size="small"
@click="deleteBatch"
@click="onDeleteBatch"
>批量删除</el-button
>
</div>
@ -377,27 +377,21 @@ export default {
this.getTableData();
},
methods: {
deleteBatch () {
onDeleteBatch () {
if (this.selection.length > 0) {
this.$confirm("确认删除选择的楼栋?", "提示", {
this.$confirm("删除的数据无法恢复,确认删除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
this.delPolicy()
})
.catch(err => {
if (err == "cancel") {
// this.$message({
// type: "info",
// message: ""
// });
}
});
.then(() => {
this.delPolicyBatch(this.selection.map(i => i.id));
})
.catch(err => {
console.error(err)
});
} else {
this.$message.warning('请先选择要删除的楼栋')
this.$message.warning('请先选择要删除的政策')
}
},
@ -564,6 +558,20 @@ export default {
this.$message.error("操作失败!");
}
},
//
async delPolicyBatch(policyIds) {
const url = `/governance/policy/deletePolicyBatch`;
const { data, code, msg } = await requestPost(url, policyIds);
if (code === 0) {
this.$message.success("删除成功!");
this.getTableData();
} else {
this.$message.error("操作失败!");
}
},
//
// async delPolicy() {
// if (this.selection.length === 0)

Loading…
Cancel
Save