Forráskód Böngészése

2022.3.17组织架构页面批量修改部门

17613754660 3 éve
szülő
commit
5f5a893af6

+ 92 - 14
fhKeeper/formulahousekeeper/timesheet/src/views/team/index.vue

@@ -113,7 +113,8 @@
             </el-col>
 
             <!--列表-->
-            <el-table :data="list" highlight-current-row v-loading="listLoading" :height="tableHeight" style="width: 100%;">
+            <el-table ref="handleSelectTable" :data="list" highlight-current-row v-loading="listLoading" :height="tableHeight" style="width: 100%;" @selection-change="handleSelectionZzjg">
+                <el-table-column type="selection" width="50"></el-table-column>
                 <el-table-column type="index" width="50">
                     <template slot-scope="scope" >
                         {{scope.$index+1+(page-1)*size}}
@@ -150,6 +151,13 @@
 
             <!--工具条-->
             <el-col :span="24" class="toolbar">
+                <!-- 123 -->
+                <span v-if="handleSelectionZzjgshow">
+                <el-button size="small" @click="handleSelectionZzjgbtn1">取消选择</el-button>
+                <el-cascader v-model="handleSelectionZzjgwillchange" size="small" placeholder="请选择部门" style="width: 13%;margin-left: 1%;margin-right: 1%;"
+                    :options="option" :props="{ checkStrictly: false,expandTrigger: 'hover' }" :show-all-levels="false" clearable></el-cascader>
+                <el-button size="small" type="primary" @click="handleSelectionZzjgbtn2">批量修改</el-button>
+                </span>
                 <el-pagination
                     @size-change="handleSizeChange"
                     @current-change="handleCurrentChange"
@@ -363,6 +371,7 @@
     export default {
         data() {
             return {
+                handleSelectionZzjgshow: false,
                 submitLoading:false,
                 deactiveUser:null,
                 deactiveDate:null,
@@ -480,10 +489,39 @@
                 }],
                 status: '',
                 role: '',
-                jDarr: []
+                jDarr: [],
+                handleSelectionZzjgDate:[],
+                handleSelectionZzjgwillchange : null
             };
         },
         methods: {
+
+            // 批量修改部门
+            handleSelectionZzjg(e){
+                if (e.length == 0) {
+                    this.handleSelectionZzjgshow = false
+                }else{
+                    this.handleSelectionZzjgshow = true
+                }
+                this.handleSelectionZzjgDate = e
+            },
+            handleSelectionZzjgbtn1(){
+                this.handleSelectionZzjgshow = false
+                this.$refs.handleSelectTable.clearSelection()
+            },
+            handleSelectionZzjgbtn2(){
+                for (let index = 0; index < this.handleSelectionZzjgDate.length; index++) {
+                    this.handleSelectionZzjgDate[index].departmentId = this.handleSelectionZzjgwillchange[this.handleSelectionZzjgwillchange.length - 1]
+                    if (this.handleSelectionZzjgDate[index].role == 1) {
+                        this.submitInsert1(this.handleSelectionZzjgDate[index],1)
+                    }else{
+                        this.submitInsert(this.handleSelectionZzjgDate[index],1)
+                    }
+                    
+                }
+            },
+
+
             deleteUser(targetUser) {
                 this.$confirm("确定要删除该员工吗?", "提示", {
                     //type: 'warning'
@@ -924,11 +962,31 @@
                 this.dialogVisible = true;
             },
 
-            submitInsert() {
-                this.$refs.form1.validate(valid => {
+            submitInsert(event,i) {
+                var form = {}
+                if (i == 1) {
+                    form = {
+                            name: event.name,
+                            phone: event.phone,
+                            role: event.role,
+                            monthCost: event.monthCost,
+                            cost: event.cost,
+                            salaryType: event.salaryType,
+                        };
+                    if (event.id != null) {
+                            form.id = event.id;
+                        }
+                        if (event.costApplyDate != null) {
+                            form.costApplyDate = event.costApplyDate;
+                        }
+                        if (event.departmentId != null) {
+                            form.departmentId = event.departmentId;
+                        }
+                } else {
+                     this.$refs.form1.validate(valid => {
                     if (valid) {
                         this.submitLoading = true;
-                        var form = {
+                        form = {
                             name: this.insertForm.name,
                             phone: this.insertForm.phone,
                             role: this.insertForm.role,
@@ -945,7 +1003,10 @@
                         if (this.insertForm.departmentId != null) {
                             form.departmentId = this.insertForm.departmentId[this.insertForm.departmentId.length-1];
                         }
-                        this.http.post( this.port.manage.insert, form,
+                    }
+                });
+                }
+                this.http.post( this.port.manage.insert, form,
                         res => {
                             this.submitLoading = false;
                             if (res.code == "ok") {
@@ -970,8 +1031,6 @@
                                 type: "error"
                             });
                         });
-                    }
-                });
             },
 
             // 切换角色
@@ -1070,11 +1129,29 @@
                 this.dialogVisible1 = true;
             },
 
-            submitInsert1() {
-                this.$refs.form1.validate(valid => {
+            submitInsert1(event,i) {
+                var form = {}
+                if (i == 1) {
+                    this.submitLoading = true;
+                        form = {
+                            id: event.id,
+                            name: event.name,
+                            phone: event.phone,
+                            role: event.role,
+                            monthCost: event.monthCost,
+                            cost: event.cost
+                        };
+                        if (event.departmentId != null) {
+                            form.departmentId = event.departmentId;
+                        }
+                        if (event.costApplyDate != null) {
+                            form.costApplyDate = event.costApplyDate;
+                        }
+                } else {
+                    this.$refs.form1.validate(valid => {
                     if (valid) {
                         this.submitLoading = true;
-                        var form = {
+                        form = {
                             id: this.insertForm.id,
                             name: this.insertForm.name,
                             phone: this.insertForm.phone,
@@ -1088,7 +1165,10 @@
                         if (this.insertForm.costApplyDate != null) {
                             form.costApplyDate = this.insertForm.costApplyDate;
                         }
-                        this.http.post( this.port.manage.insert, form,
+                    }
+                });
+                }
+                this.http.post( this.port.manage.insert, form,
                         res => {
                             this.submitLoading = false;
                             if (res.code == "ok") {
@@ -1114,8 +1194,6 @@
                                 type: "error"
                             });
                         });
-                    }
-                });
             },
 
             // 获取部门列表