@@ -120,8 +128,9 @@
:size="tableSize"
:height="tableHeight"
style="width: 100%;margin: 15px 0;"
+ @selection-change="handleSelectionChange"
>
-
+
{{ scope.$index +1 }}
@@ -230,14 +239,15 @@ export default {
pageSize: 20,
ruleTypeId: '',
ruleName: '',
- ruleType: 'jj'
+ ruleType: 'jg'
},
// 左侧树
ruleTypeOptions: [],
defaultProps: {
children: 'children',
label: 'name'
- }
+ },
+ selectedRows: []
}
},
created() {
@@ -318,7 +328,7 @@ export default {
pageSize: 20,
ruleTypeId: '',
ruleName: '',
- ruleType: 'jj'
+ ruleType: 'jg'
}
this.handleQuery()
},
@@ -374,6 +384,26 @@ export default {
}).catch(() => {
})
},
+ handleSelectionChange(selection) {
+ this.selectedRows = selection
+ },
+ async deleteSelected() {
+ if (this.selectedRows.length === 0) {
+ this.$message.warning('请勾选需要删除的数据')
+ return
+ }
+ try {
+ await this.$confirm('选中数据将被永久删除, 是否继续?', '提示', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning'
+ })
+ await Promise.all(this.selectedRows.map(row => delCheckRule(row.id)))
+ this.$message.success('删除成功')
+ this.getList()
+ } catch (error) {
+ }
+ },
handleSizeChange(val) {
console.log(`每页 ${val} 条`)
this.queryParams.pageNum = 1