Browse Source

2022.3.28新增请假审批流

17613754660 3 years ago
parent
commit
c549bca399
1 changed files with 279 additions and 4 deletions
  1. 279 4
      fhKeeper/formulahousekeeper/timesheet/src/views/leave/list.vue

+ 279 - 4
fhKeeper/formulahousekeeper/timesheet/src/views/leave/list.vue

@@ -37,6 +37,13 @@
                 <span slot="title">请假统计</span>
               </template>
           </el-menu-item>
+
+          <el-menu-item index="5" v-if="user.role != 0">
+              <template slot="title">
+                <i class="iconfont firerock-iconliucheng"></i>
+                <span slot="title">请假审批流程</span>
+              </template>
+          </el-menu-item>
           </el-menu>
       </el-col>
     </div>
@@ -242,7 +249,7 @@
     </div>
 
     <!-- 统计部分 -->
-    <div v-if="displayTable && apk" class="tops">
+    <div v-if="displayTable && apk && apk2 == false" class="tops">
       <!-- 公共 -->
         <div class="ctons">
           <div style="display: flex;align-items: center;padding-bottom: 20px;border-bottom: 1px solid #f2f2f2">
@@ -305,6 +312,71 @@
           </div>
         </div>
     </div>
+
+    <div v-if="displayTable && apk && apk2" class="tops">
+        
+        <div class="ctons">
+        <el-col :span="6" >
+            <el-scrollbar style="height:100%;border:1px solid #dddddd;margin-left:15px;" >
+            <div class="tree" :style="'height:'+ (tableHeight-120) + 'px'">
+                <el-tree :data="sdata" :props="sdefaultProps" @node-click="handleNodeClick" accordion></el-tree>
+            </div>
+            </el-scrollbar>
+        </el-col>
+        <el-col :span="18" >
+            <el-scrollbar style="height:100%;border:1px solid #dddddd;margin-right:20px;" >
+            <div class="tree" :style="'height:'+ (tableHeight-120) + 'px'">
+                <div style="padding:5px;color:#333;" v-if="depData != null">设置 &lt;<span style="color:#20a0ff;">{{depData.label}}&gt;</span> 直属人员请假审批流程
+                    <el-tooltip effect="dark" v-if="depData != null && depData.children!=null" content="仅适用于当前部门的直属人员,子部门人员的审批流程需要单独设置" placement="top-start">
+                    <i class="el-icon-question"></i>
+                    </el-tooltip>
+                </div>
+                <div style="padding:5px;" v-if="depData == null">请选择部门</div>
+                <div style="width:100%;margin:0 auto;text-align: center; margin-top:50px;" v-if="depData != null">
+                    <span>员工填报</span>
+                    <icon class="iconfont firerock-iconright"></icon>
+                    <icon class="iconfont firerock-iconInsertLine addNode" @click="showNodeDialog(0)"></icon>
+                    <icon class="iconfont firerock-iconright"></icon>
+                    <span v-for="(item, index) in dataArray" :key="item.seq" >
+                        
+                        <el-button type="primary" v-if="item.auditorType == 1" @click="editNodeDialog(index, item)">{{item.auditDeptName}}</el-button>
+                        <el-button type="primary" v-if="item.auditorType == 0" >项目负责人</el-button>
+                        <el-button type="primary" v-if="item.auditorType == 2" @click="editNodeDialog(index, item)">{{item.userName}}</el-button>
+                        <icon class="iconfont firerock-iconright"></icon>
+                        <icon class="iconfont firerock-iconInsertLine addNode" @click="showNodeDialog(index+1)"></icon>
+                        <icon class="iconfont firerock-iconright"></icon>
+                    </span>
+
+                    <!--结束点 -->
+                    <icon class="iconfont firerock-iconApp_New_Line" style="color:#20A0FF;"></icon>
+                    审批完成
+                </div>
+
+                <div style="width:100%;margin:0 auto;margin-bottom:30px;position: absolute;bottom: 0px;text-align: center; ">
+                    <el-button type="primary" @click="submitInsert" :loading="addLoading">保存</el-button>
+                </div>
+            </div>
+            </el-scrollbar>
+            
+        </el-col>
+        </div>
+
+        <!--部门选择列表 -->
+        <el-dialog  title="请选择审批人" v-if="dialogVisible" :visible.sync="dialogVisible"  width="460px">
+              <el-form label-width="140px">
+              <el-form-item label="选择部门/指定人员" >
+                  <el-cascader filterable ref="deptCascader"  v-model="curDeptId" placeholder="请选择部门/指定人员" style="width: 100%" @change="chooseDept"
+                    :options="soption" :props="{ checkStrictly: true,expandTrigger: 'hover' }" :show-all-levels="false" clearable></el-cascader>
+              </el-form-item>
+              </el-form>
+            <div slot="footer" class="dialog-footer">
+              <el-button type="default" @click="deleteNode" v-if="!isAdd" style="float:left;">删除</el-button>
+                <el-button type="primary" @click="addNode" >确定</el-button>
+            </div>
+        </el-dialog>
+
+    </div>
+
   </div>
   <!-- 请假单详情 -->
   <el-dialog title="请假单详情" :visible.sync="dialog" width="1000px" @close="bangd()">
@@ -505,18 +577,206 @@ export default {
       dialog: false,
       adform: {},
       affId: '',
-      qjType: [{name: '事假',id: 0},{name: '病假',id: 1},{name: '年假',id: 2},{name: '产假',id: 3},{name: '婚假',id: 4},{name: '丧假',id: 5},{name: '调休假',id: 6},{name: '陪产假',id: 7},{name: '其他', id: 8}]
+      qjType: [{name: '事假',id: 0},{name: '病假',id: 1},{name: '年假',id: 2},{name: '产假',id: 3},{name: '婚假',id: 4},{name: '丧假',id: 5},{name: '调休假',id: 6},{name: '陪产假',id: 7},{name: '其他', id: 8}],
+      // 
+      apk2: false,
+      sdata:[],
+      dataArray:[],
+      sdefaultProps: {
+          children: 'children',
+          label: 'label'
+      },
+      depData: null,
+      isAdd : false,
+      sindex : 0,
+      curDeptId : null,
+      curUserId : null,
+      dialogVisible: false,
+      soption : null,
+      susers: []
+
+      // 
     };
   },
   computed: {},
   watch: {},
-  created() {},
+  created() {
+    let height = window.innerHeight;
+            this.tableHeight = height - 195;
+            const that = this;
+            window.onresize = function temp() {
+                that.tableHeight = window.innerHeight - 195;
+            };
+  },
 
   mounted() {
     this.getUsers() // 获取人员信息
+    this.getDepartment();
   },
   filters: {},
   methods: {
+
+    handleNodeClick(data) {
+                if(this.depData == null || data.id != this.depData.id) {
+                    this.depData = data;
+                    console.log("depdata",this.depData);
+                    this.getSettings();
+                }
+            },
+
+    getSettings() {
+                this.http.post('/audit-workflow-setting/get',{deptId: this.depData.id},
+                    res => {
+                        this.listLoading = false;
+                        if (res.code == "ok") {
+                            this.dataArray = res.data;
+                            console.log("请求1",res.data);
+                        } else {
+                            this.$message({
+                                message: res.msg,
+                                type: "error"
+                            });
+                        }
+                    },
+                    error => {
+                        this.listLoading = false;
+                        this.$message({
+                            message: error,
+                            type: "error"
+                        });
+                        }
+                    );
+            },
+    // 获取部门列表
+    getDepartment() {
+                this.http.post( this.port.manage.depList, {},
+                res => {
+                    if (res.code == "ok") {
+                        var list = res.data , list1 = JSON.parse(JSON.stringify(res.data));
+                        this.sdata = list;
+                        this.soption = [
+                          {value: 1 , label : "部门" , children : this.changeArr(list1)},
+                          {value: 2 , label : "指定人员",children : this.susers}
+                        ]
+                        console.log("列表",this.soption);
+                    } else {
+                        this.$message({
+                            message: res.msg,
+                            type: "error"
+                        });
+                    }
+                },
+                error => {
+                    this.$message({
+                        message: error,
+                        type: "error"
+                    });
+                });
+            },
+
+    changeArr(arr) {
+                for (var i = 0; i < arr.length; i++) {
+                    if(arr[i].id != -1 && arr[i].id != 0) {
+                        if (arr[i].children != null && arr[i].children.length>0) {
+                            arr[i].children = this.changeArr(arr[i].children);
+                        }
+                        arr[i].id && (arr[i].value = arr[i].id);
+                        delete arr[i].id;
+                    }
+                }
+                for(var i in arr) {
+                    if(arr[i].id == -1 || arr[i].id == 0) {
+                        arr.splice(i,1)
+                    }    
+                }
+                return arr;
+            },
+    showNodeDialog(index) {
+              this.isAdd = true;
+              this.sindex = index;
+              this.curDeptId = null;
+              this.curUserId = null;
+              this.dialogVisible = true;
+            },
+    editNodeDialog(index, item) {
+                //检查是否可编辑
+                this.http.post('/audit-workflow-setting/checkNodeInUse',{auditDeptId: item.auditDeptId, deptId: this.depData.id},
+                    res => {
+                        this.listLoading = false;
+                        if (res.code == "ok") {
+                            this.isAdd = false;
+                            this.sindex = index;
+                            this.curUserId = item.userId;
+                            this.dialogVisible = true;
+                            this.curDeptId = item.auditDeptId;
+                        } else {
+                            this.$message({
+                                message: res.msg,
+                                type: "error"
+                            });
+                        }
+                    },
+                    error => {
+                        this.listLoading = false;
+                        this.$message({
+                            message: error,
+                            type: "error"
+                        });
+                        }
+                    );
+                
+            },
+    addNode() {
+              this.dialogVisible = false;
+              if (this.curDeptId == null) return;
+              var node = this.$refs.deptCascader.getCheckedNodes()[0];
+              console.log("node",node);
+              
+              if (this.isAdd) {
+                if(node.path[0] == 1){
+                  var node = {auditDeptId: node.value, auditDeptName: node.label, auditorType: 1};
+                }else if(node.path[0] == 2){
+                  var node = {userId: node.value, userName: node.label, auditorType: 2};
+                }
+                this.dataArray.splice(this.sindex, 0, node);
+                
+              } else {
+                //编辑
+                this.dataArray[this.sindex].auditDeptId = node.value;
+                this.dataArray[this.sindex].auditDeptName = node.label;
+              }
+            },
+    deleteNode() {
+                this.dialogVisible = false;
+                this.dataArray.splice(this.sindex, 1);
+            },
+    submitInsert() {
+                this.http.post('/audit-workflow-setting/add',{json:JSON.stringify(this.dataArray), deptId: this.depData.id},
+                            res => {
+                                this.listLoading = false;
+                                if (res.code == "ok") {
+                                    this.$message({
+                                        message: '保存成功',
+                                        type: "success"
+                                    });
+                                } else {
+                                    this.$message({
+                                        message: res.msg,
+                                        type: "error"
+                                    });
+                                }
+                            },
+                            error => {
+                                this.listLoading = false;
+                                this.$message({
+                                    message: error,
+                                    type: "error"
+                                });
+                                }
+                            );
+            },
+    
+    // 
     approve(item) {
       //审核通过
       this.http.post('/leave-sheet/approve', {id:item.id
@@ -568,6 +828,9 @@ export default {
         res => {
             if (res.code == "ok") {
                 this.users = res.data.records;
+                for (let i = 0; i < this.users.length; i++) {
+                  this.susers.push({value:this.users[i].id,label:this.users[i].name})
+                }
                 if (this.user.role == 0) {
                     this.addForm.ownerId = this.user.id;
                     this.ownerIds = this.user.id
@@ -594,15 +857,21 @@ export default {
       this.addForm.leaveType = index
     },
     staffs(key, keyPath) {
-      console.log(keyPath)
+      console.log("keypath",keyPath)
       if (keyPath[0] == '1') {
         this.displayTable = false;
         this.apk = false
       } else if(keyPath[0] == '2' || keyPath[0] == '3') {
         this.displayTable = true;
         this.apk = false
+      } else if(keyPath[0] == '4'){
+        this.displayTable = true;
+        this.apk = true
+        this.apk2 = false
+        this.statistical()
       } else {
         this.displayTable = true;
+        this.apk2 = true
         this.apk = true
         this.statistical()
       }
@@ -987,6 +1256,12 @@ export default {
 };
 </script>
 <style scoped>
+.addNode {
+  cursor:pointer;
+}
+.addNode:hover {
+  color:#20a0ff;
+}
 .apls {
   width: 200px;
   white-space:nowrap;