Эх сурвалжийг харах

设备管理 资产台账 设备台账 增加删除跟批量删除操作

jingshuyong 10 сар өмнө
parent
commit
3d1e8b5356

+ 34 - 5
src/views/ledgerAssets/equipment/components/equipment-list.vue

@@ -56,10 +56,15 @@
         >
           设置片区负责人
         </el-button>
-        <!-- <el-button size="small" class="ele-btn-icon" @click="handlDelete"
-          >删除</el-button
-        >
         <el-button
+          size="small"
+          type="danger"
+          icon="el-icon-delete"
+          class="ele-btn-icon"
+          @click="handlDelete"
+          >批量删除</el-button
+        >
+        <!-- <el-button
           size="small"
           @click="moveTo(checkRadioData, 'move')"
           :disabled="checkRadioData.length == 0"
@@ -75,6 +80,17 @@
       </template>
       <!-- 操作列 -->
       <template v-slot:action="{ row }">
+        <el-popconfirm
+          class="ele-action"
+          title="确定要删除此设备数据吗?"
+          @confirm="handleRemove(row)"
+        >
+          <template v-slot:reference>
+            <el-link type="danger" :underline="false" icon="el-icon-delete"
+              >删除</el-link
+            >
+          </template>
+        </el-popconfirm>
         <el-link
           type="primary"
           :underline="false"
@@ -327,7 +343,8 @@
             columnKey: 'action',
             slot: 'action',
             label: '操作',
-            minWidth: 120,
+            minWidth: 170,
+            align: 'center',
             fixed: 'right'
           }
         ],
@@ -403,6 +420,10 @@
         }
       },
       handlDelete() {
+        if (this.checkRadioData.length == 0) {
+          this.$message.warning('请至少选择一条数据');
+          return;
+        }
         if (this.checkRadioData.length != 0) {
           this.$confirm('是否删除?', '提示', {
             confirmButtonText: '确定',
@@ -414,12 +435,20 @@
                 return item.id;
               });
               await batchDel(paramsArr);
+              this.$message.success('操作成功');
               this.sucesstion(true);
             })
             .catch(() => {});
         }
       },
-
+      async handleRemove(row) {
+        let arr = [row.id];
+        const res = await batchDel(arr);
+        if (res) {
+          this.$message.success('操作成功');
+          this.sucesstion(true);
+        }
+      },
       /* 表格数据源 */
       datasource({ page, limit, where, order }) {
         console.log('------reload-------');