ysy 1 tahun lalu
induk
melakukan
3dddedc7c3

+ 19 - 5
src/views/workforceManagement/team/components/edit.vue

@@ -173,7 +173,7 @@
         header="员工配置"
         body-style="padding: 22px 22px 0 22px;"
       >
-        <userTable ref="userTable"></userTable>
+        <userTable ref="userTable" @deleteIds="deleteIds"></userTable>
       </el-card>
     </el-form>
     <template v-slot:footer>
@@ -222,6 +222,7 @@
         defaultForm,
         factoryList: [],
 
+        deleteUserIds: [],
 
         
         statusList: [
@@ -287,6 +288,8 @@
       async open(type, row) {
         this.type = type;
         this.visible = true;
+        this.deleteUserIds = []
+
         if (type == 'edit') {
           for (const key of Object.keys(this.form)) {
             if (row[key]) {
@@ -307,11 +310,16 @@
 
           // 获取下拉列表
           await this.getlistWorkshopByParentId();
+          await this.getlistCf()
           await this.getlistFactoryLineByParentId();
+          await  this.getlistByProductionLineId();
         }
         this.getVersionList();
 
       },
+      deleteIds(ids) {
+        this.deleteUserIds = ids || [];
+      },
       /* 保存编辑 */
       save() {
         this.$refs.form.validate((valid) => {
@@ -320,6 +328,7 @@
           }
           this.loading = true;
           let userIds = this.$refs.userTable.datasource.map((n) => n.id);
+          
           if (userIds.length <= 0) {
             this.$message.error('请选择员工');
             this.loading = false;
@@ -328,6 +337,7 @@
 
           let par = this.form;
           par.userIds = userIds;
+          par.deleteUserIds = this.deleteUserIds;
           par.leaderUserId = this.$refs.userTable.getTwi();
           par.userNumber = par.userIds.length;
           if (this.type == 'add') {
@@ -381,6 +391,14 @@
         this.form.productionLineId = '';
         this.options.productionLineId = [];
 
+       this.getlistCf()
+         this.form.workCenterIds = ''
+        this.options.workCenterIds = [];
+
+        this.getlistWorkshopPlanId();
+      },
+
+      getlistCf() {
         let par = {
           type: 2,
           parentId: this.form.factoryId,
@@ -390,10 +408,6 @@
           this.workshopPlanList = res.list;
         });
 
-         this.form.workCenterIds = ''
-        this.options.workCenterIds = [];
-
-        this.getlistByProductionLineId();
       },
 
       // 获取车间

+ 0 - 1
src/views/workforceManagement/team/components/search.vue

@@ -38,7 +38,6 @@
             style="width: 100%"
             clearable
             v-model="where.workshopPlanId"
-            @change="change_workshopPlanId"
             filterable
             placeholder="请选择所属厂房"
           >

+ 8 - 1
src/views/workforceManagement/team/components/userTable.vue

@@ -89,7 +89,9 @@
             fixed:'right'
           }
         ],
-        datasource: []
+        datasource: [],
+
+        deleteUserIds: []
       };
     },
     methods: {
@@ -97,7 +99,10 @@
         let index = this.datasource.findIndex((n) => n.id == row.id);
         if (index !== -1) {
           this.datasource.splice(index, 1);
+          this.deleteUserIds.push((row.id));
+          this.$emit('deleteIds', this.deleteUserIds);
         }
+
       },
       handlAdd () {
         this.$refs.staffSelection.open(
@@ -147,6 +152,8 @@
       restTable () {
         this.datasource = [];
       },
+
+    
       // 获取班组长id
       getTwi () {
         let result = this.datasource.find((n) => n.isLeader == true);