Authored by 鲁尚清

【无】对比分析增加批量删除

@@ -26,6 +26,9 @@ @@ -26,6 +26,9 @@
26 <i class="el-icon-plus"></i>新增 26 <i class="el-icon-plus"></i>新增
27 </el-button> 27 </el-button>
28 </router-link> 28 </router-link>
  29 + <el-button :size="$global.elementConfig.size.button" @click="handleDelete()" style="margin-left:6px;" class="search-text button-flex-div-center"
  30 + type="primary">删除
  31 + </el-button>
29 </div> 32 </div>
30 33
31 </el-col> 34 </el-col>
@@ -35,7 +38,7 @@ @@ -35,7 +38,7 @@
35 <el-col :span="24"> 38 <el-col :span="24">
36 <el-table :data="tableData" @selection-change="handleSelectionChange" border ref="multipleTable" stripe 39 <el-table :data="tableData" @selection-change="handleSelectionChange" border ref="multipleTable" stripe
37 style="width: 100%"> 40 style="width: 100%">
38 - <!-- <el-table-column align="center" type="selection" width="55" />--> 41 + <el-table-column align="center" type="selection" width="55" />
39 <el-table-column align="center" label="配置项名称" prop="configName" sortable/> 42 <el-table-column align="center" label="配置项名称" prop="configName" sortable/>
40 <el-table-column align="center" label="配置项描述" prop="configDepict" sortable/> 43 <el-table-column align="center" label="配置项描述" prop="configDepict" sortable/>
41 <el-table-column align="center" label="时间范围" prop="timeScopeName" sortable></el-table-column> 44 <el-table-column align="center" label="时间范围" prop="timeScopeName" sortable></el-table-column>
@@ -38,7 +38,6 @@ export default { @@ -38,7 +38,6 @@ export default {
38 } 38 }
39 $.get(proxy.domainName + proxy.apiUrl + '?access_token=' + localStorage.getItem('access_token'), params, function (res) { 39 $.get(proxy.domainName + proxy.apiUrl + '?access_token=' + localStorage.getItem('access_token'), params, function (res) {
40 if (res) { 40 if (res) {
41 - console.log("res", res)  
42 proxy.totalCount = res.count; 41 proxy.totalCount = res.count;
43 proxy.tableData = res.data; 42 proxy.tableData = res.data;
44 proxy.tableData.map((item, index) => { 43 proxy.tableData.map((item, index) => {
@@ -67,14 +66,31 @@ export default { @@ -67,14 +66,31 @@ export default {
67 this.$refs.multipleTable.clearSelection() 66 this.$refs.multipleTable.clearSelection()
68 } 67 }
69 } 68 }
  69 + let multipleSelection=Vue.ref([]);
70 const handleSelectionChange = (val) => { 70 const handleSelectionChange = (val) => {
71 - this.multipleSelection = val 71 + multipleSelection.value = val
72 } 72 }
73 //单个删除 73 //单个删除
74 const handleDelete = (item) => { 74 const handleDelete = (item) => {
75 - 75 + //lsq 增加批量删除 2022-08-29
  76 + let idList='';
  77 + if(item){
  78 + idList=item.id
  79 + }else{
  80 + if(multipleSelection.value && multipleSelection.value.length>0){
  81 + let idArr=[];
  82 + multipleSelection.value.map(item=>{
  83 + idArr.push(item.id)
  84 + })
  85 + if(idArr.length>0){
  86 + idList=idArr.join(',')
  87 + }
  88 + }else{
  89 + proxy.$global.showMsg("请选择数据", "warning");
  90 + }
  91 + }
76 let params = { 92 let params = {
77 - id: item.id 93 + id: idList
78 } 94 }
79 95
80 proxy.$global.confirm("确认删除数据吗?", function () { 96 proxy.$global.confirm("确认删除数据吗?", function () {
@@ -90,7 +106,6 @@ export default { @@ -90,7 +106,6 @@ export default {
90 } 106 }
91 }) 107 })
92 108
93 -  
94 // $.get(proxy.domainName +proxy.apiUrl1+'?access_token='+localStorage.getItem('access_token'),params,function (res) { 109 // $.get(proxy.domainName +proxy.apiUrl1+'?access_token='+localStorage.getItem('access_token'),params,function (res) {
95 // if(res){ 110 // if(res){
96 // proxy.$global.confirm("确认删除数据吗?", function () { 111 // proxy.$global.confirm("确认删除数据吗?", function () {