ysy 1 tahun lalu
induk
melakukan
733692f7f3
1 mengubah file dengan 40 tambahan dan 2 penghapusan
  1. 40 2
      src/views/workforceManagement/team/components/userTable.vue

+ 40 - 2
src/views/workforceManagement/team/components/userTable.vue

@@ -5,6 +5,7 @@
       :needPage="false"
       :columns="columns"
       :datasource="datasource"
+      :selection.sync="selection"
       cache-key="systemRoleTable21"
     >
       <!-- 表头工具栏 -->
@@ -18,6 +19,16 @@
         >
           新增
         </el-button>
+
+        <el-button
+          size="small"
+          @click="handAllDel"
+          icon="el-icon-delete"
+          type="danger"
+        >
+          删除
+        </el-button>
+
       </template>
       <!-- 操作列 -->
       <template v-slot:action="{ row }">
@@ -59,12 +70,20 @@
     data () {
       return {
         columns: [
+        {
+          columnKey: 'selection',
+            type: 'selection',
+            width: 45,
+            align: 'center',
+            fixed: 'left'
+          },
+
           {
             width: 45,
             type: 'index',
             columnKey: 'index',
             align: 'center',
-            fixed:'left'
+          
           },
           {
             prop: 'name',
@@ -91,7 +110,8 @@
         ],
         datasource: [],
 
-        deleteUserIds: []
+        deleteUserIds: [],
+        selection: []
       };
     },
     methods: {
@@ -104,6 +124,24 @@
         }
 
       },
+
+      handAllDel() {
+        console.log(this.selection);
+        console.log(this.datasource)
+
+        this.selection.forEach((e) => {
+          this.datasource.forEach((f,i) => {
+            if(e.id == f.id){
+              this.datasource.splice(i, 1);
+              this.deleteUserIds.push((f.id));
+              this.$emit('deleteIds', this.deleteUserIds);
+            }
+
+          })
+        });
+
+      },
+
       handlAdd () {
         this.$refs.staffSelection.open(
           JSON.parse(JSON.stringify(this.datasource))