Bläddra i källkod

师傅管理增加批量离职按钮

FengChaoYu 1 månad sedan
förälder
incheckning
640324f693
1 ändrade filer med 49 tillägg och 4 borttagningar
  1. 49 4
      src/views/userManagement/masterManagement/index.vue

+ 49 - 4
src/views/userManagement/masterManagement/index.vue

@@ -173,18 +173,16 @@ import ImageUpload from '@/components/file-upload'
 import editTable from '@/components/template/editTable.js'
 import { tableDataParsing } from '@/utils/common.js'
 import { workerTeamList } from '@/api/masterGroup.js'
-
 export default {
   components: { TemplatePage, ImageUpload },
   mixins: [import_mixin, operation_mixin, editTable],
   data() {
     return {
-      // 事件组合
-      optionsEvensGroup: [],
+      
       // 表格属性
       tableAttributes: {
         // 启用勾选列
-        selectColumn: false,
+        selectColumn: true,
         'row-class-name': this.tableRowClassName
       },
       // 表格事件
@@ -226,6 +224,52 @@ export default {
     }
   },
   computed: {
+    // 事件组合
+      optionsEvensGroup(){
+        return [
+          [
+            [
+            this.optionsEvensAuth("batchQuit", {
+              click: () => {
+                if (this.recordSelected.length === 0) {
+                  this.$message.warning('请勾选数据')
+                  return
+                }
+                this.$confirm('确定要批量离职吗?', '提示', {
+                  confirmButtonText: '确定',
+                  cancelButtonText: '取消',
+                  type: 'warning'
+                }).then(() => {
+                  console.log("选中",this.recordSelected)
+                  // 使用 for 循环替代 forEach,以便在出错时能停止执行
+                  const loop = async () => {
+                    for (let i = 0; i < this.recordSelected.length; i++) {
+                      const item = this.recordSelected[i];
+                      if (item.examineStatus === 'OK') {
+                        try {
+                          await workerManagerQuit({ id: item.id });
+                        } catch (err) {
+                          this.$message.error(err);
+                          this.$refs.pageRef.refreshList();
+                          return; // 出错时停止执行
+                        }
+                      }
+                    }
+                    this.$message({ type: 'success', message: '操作成功!' });
+                    this.$refs.pageRef.refreshList();
+                  };
+                  loop();
+                  // workerManagerQuit({ id: row.id }).then(res => {
+                  //   this.$message({ type: 'success', message: '离职成功!' })
+                  //   this.$refs.pageRef.refreshList()
+                  // })                  
+                })
+              }
+            }),
+          ]
+          ]
+        ]
+      },
     // 更多参数
     moreParameters() {
       return []
@@ -982,6 +1026,7 @@ export default {
     // 监听勾选变化
     selectionChange(data) {
       this.recordSelected = data
+      console.log(this.recordSelected)
     },
     // 表格操作列
     operation() {