Lijy 3 lat temu
rodzic
commit
91de9c5396

+ 162 - 72
fhKeeper/formulahousekeeper/timesheet/src/views/team/index.vue

@@ -11,9 +11,9 @@
             <el-divider style="margin: 0px 0px !important;height:0.5px;"></el-divider>
             <div class="tree" :style="'height:'+ (tableHeight + 83) + 'px'">
                 <!-- <el-tree :data="data" :props="defaultProps" @node-click="handleNodeClick" accordion></el-tree> -->
-                <el-tree :data="data" :props="defaultProps" node-key="id" :expand-on-click-node="false" accordion @node-click="handleNodeClick" :default-expanded-keys="jDarr" @node-expand="jieDian" @node-collapse="shutDown">
+                <el-tree :data="data" :props="defaultProps" node-key="id" :expand-on-click-node="false" accordion @node-click="handleNodeClick" :default-expanded-keys="jDarr" @node-expand="jieDian" @node-collapse="shutDown" @current-change="chufa">
                     <span class="custom-tree-node" slot-scope="{ node }" @mouseleave= mouseleave(data,$event)>
-                        <span @mouseover= mouseover(data,$event) style="width: 100px;display: inline-block;">{{ node.label }}</span>
+                        <span style="width: 100%;display: inline-block;" @mouseover= mouseover(data,$event)>{{ node.label }}</span>
                         <span v-if="node.label != '全部人员'" class="node none">
                         <el-button type="text" size="mini" @click="createDepartment(-2)" >
                             <i class="el-icon-circle-plus-outline"></i> <!-- 新增 -->
@@ -81,7 +81,7 @@
                         <el-link type="primary" v-if="depData != null && depData.id != -1 && depData.id != 0" :underline="false" @click="createDepartment(-2)">新增子部门</el-link>
                     </el-form-item> -->
                     <el-form-item style="float:right;">
-                        <span>角色</span>
+                        <span style="color: #666666">角色</span>
                         <el-select v-model="role" placeholder="请选择" @change="getUser()" style="width: 120px">
                             <el-option
                             v-for="item in rolesa"
@@ -92,7 +92,7 @@
                         </el-select>
                     </el-form-item>
                     <el-form-item style="float:right;">
-                        <span>状态</span>
+                        <span style="color: #666666">状态</span>
                         <el-select v-model="status" placeholder="请选择" @change="getUser()" style="width: 120px">
                             <el-option
                             v-for="item in states"
@@ -482,6 +482,13 @@
             };
         },
         methods: {
+            chufa(data, b, c, e) {
+                if(this.depData == null || data.id != this.depData.id) {
+                    this.depData = data;
+                    this.page = 1;
+                    this.getUser();
+                }
+            },
             jieDian(a, b, c) {
                 var ids = a.id
                 var arrs = this.jDarr
@@ -1134,6 +1141,7 @@
 
             // 部门列表点击
             handleNodeClick(data) {
+                console.log(data)
                 if(this.depData == null || data.id != this.depData.id) {
                     this.depData = data;
                     this.page = 1;
@@ -1143,45 +1151,87 @@
 
             // 新增、修改部门
             createDepartment(i) {
-                if(i == -2) {//创建子部门
-                    this.depForm = {
-                        id: null,
-                        name: null,
-                        parentId: null,
-                        managerId: null,
-                    }
-                    if(this.depData.id != -1 && this.depData.id != 0) {
-                        this.depForm.parentId = this.depData.id;
-                    }
-                    this.depTitle = "新增子部门";
-                } else if(i == -1) {//创建一级部门
-                    this.depForm = {
-                        id: null,
-                        name: null,
-                        parentId: null,
-                        managerId: null,
-                    }
-                    this.depTitle = "新增部门";
-                } else {
-                    if(this.depData.managerId == "null") {
-                        this.depData.managerId = ''
-                    }
-                    if(this.depData.reportAuditUserid == "null") {
-                        this.depData.reportAuditUserid = ''
-                    }
-                    this.depForm = {
-                        id: this.depData.id,
-                        name: this.depData.label,
-                        parentId: this.depData.parentId,
-                        managerId: this.depData.managerId,
-                        reportAuditUserid: this.depData.reportAuditUserid
+                setTimeout(() => {
+                    var that = this
+                    if(i == -2) {//创建子部门
+                        that.depForm = {
+                            id: null,
+                            name: null,
+                            parentId: null,
+                            managerId: null,
+                        }
+                        if(that.depData.id != -1 && that.depData.id != 0) {
+                            that.depForm.parentId = that.depData.id;
+                        }
+                        that.depTitle = "新增子部门";
+                    } else if(i == -1) {//创建一级部门
+                        that.depForm = {
+                            id: null,
+                            name: null,
+                            parentId: null,
+                            managerId: null,
+                        }
+                        that.depTitle = "新增部门";
+                    } else {
+                        if(that.depData.managerId == "null") {
+                            that.depData.managerId = ''
+                        }
+                        if(that.depData.reportAuditUserid == "null") {
+                            that.depData.reportAuditUserid = ''
+                        }
+                        that.depForm = {
+                            id: that.depData.id,
+                            name: that.depData.label,
+                            parentId: that.depData.parentId,
+                            managerId: that.depData.managerId,
+                            reportAuditUserid: that.depData.reportAuditUserid
+                        }
+                        // if(that.depData.reportAuditUserid != null && that.depData.reportAuditUserid != "null" && that.depData.reportAuditUserid.length > 0) {
+                        //     that.depForm.reportAuditUserid = that.depData.reportAuditUserid
+                        // }
+                        that.depTitle = "编辑部门";
                     }
-                    // if(this.depData.reportAuditUserid != null && this.depData.reportAuditUserid != "null" && this.depData.reportAuditUserid.length > 0) {
-                    //     this.depForm.reportAuditUserid = this.depData.reportAuditUserid
-                    // }
-                    this.depTitle = "编辑部门";
-                }
-                this.departmentVisible = true;
+                    that.departmentVisible = true;
+                })
+                // if(i == -2) {//创建子部门
+                //     this.depForm = {
+                //         id: null,
+                //         name: null,
+                //         parentId: null,
+                //         managerId: null,
+                //     }
+                //     if(this.depData.id != -1 && this.depData.id != 0) {
+                //         this.depForm.parentId = this.depData.id;
+                //     }
+                //     this.depTitle = "新增子部门";
+                // } else if(i == -1) {//创建一级部门
+                //     this.depForm = {
+                //         id: null,
+                //         name: null,
+                //         parentId: null,
+                //         managerId: null,
+                //     }
+                //     this.depTitle = "新增部门";
+                // } else {
+                //     if(this.depData.managerId == "null") {
+                //         this.depData.managerId = ''
+                //     }
+                //     if(this.depData.reportAuditUserid == "null") {
+                //         this.depData.reportAuditUserid = ''
+                //     }
+                //     this.depForm = {
+                //         id: this.depData.id,
+                //         name: this.depData.label,
+                //         parentId: this.depData.parentId,
+                //         managerId: this.depData.managerId,
+                //         reportAuditUserid: this.depData.reportAuditUserid
+                //     }
+                //     // if(this.depData.reportAuditUserid != null && this.depData.reportAuditUserid != "null" && this.depData.reportAuditUserid.length > 0) {
+                //     //     this.depForm.reportAuditUserid = this.depData.reportAuditUserid
+                //     // }
+                //     this.depTitle = "编辑部门";
+                // }
+                // this.departmentVisible = true;
             },
             
             submitDepartment() {
@@ -1241,43 +1291,83 @@
 
             // 删除部门
             deleteDep() {
-                this.$confirm( "确定要删除部门" + this.depData.label + "吗?", "删除部门", {
+                var that = this
+                setTimeout(() =>{
+                    that.$confirm( "确定要删除部门" + that.depData.label + "吗?", "删除部门", {
                     confirmButtonText: "确定",
                     cancelButtonText: "取消",
                     type: "warning"
-                })
-                .then(() => {
-                    this.listLoading = true;
-                    this.http.post( this.port.manage.del, { id: this.depData.id },
-                    res => {
-                        this.listLoading = false;
-                        if (res.code == "ok") {
-                            this.$message({
-                                message: "删除成功",
-                                type: "success"
-                            });
-                            this.depData = {
-                                id: -1,
-                                label: '全部人员',
+                    })
+                    .then(() => {
+                        that.listLoading = true;
+                        that.http.post( that.port.manage.del, { id: that.depData.id },
+                        res => {
+                            that.listLoading = false;
+                            if (res.code == "ok") {
+                                that.$message({
+                                    message: "删除成功",
+                                    type: "success"
+                                });
+                                that.depData = {
+                                    id: -1,
+                                    label: '全部人员',
+                                }
+                                that.getDepartment();
+                                that.getUser();
+                            } else {
+                                that.$message({
+                                    message: res.msg,
+                                    type: "error"
+                                });
                             }
-                            this.getDepartment();
-                            this.getUser();
-                        } else {
-                            this.$message({
-                                message: res.msg,
+                        },
+                        error => {
+                            that.listLoading = false;
+                            that.$message({
+                                message: error,
                                 type: "error"
                             });
-                        }
-                    },
-                    error => {
-                        this.listLoading = false;
-                        this.$message({
-                            message: error,
-                            type: "error"
                         });
-                    });
-                })
-                .catch(() => {});
+                    })
+                    .catch(() => {});
+                },500);
+                // this.$confirm( "确定要删除部门" + this.depData.label + "吗?", "删除部门", {
+                //     confirmButtonText: "确定",
+                //     cancelButtonText: "取消",
+                //     type: "warning"
+                // })
+                // .then(() => {
+                //     this.listLoading = true;
+                //     this.http.post( this.port.manage.del, { id: this.depData.id },
+                //     res => {
+                //         this.listLoading = false;
+                //         if (res.code == "ok") {
+                //             this.$message({
+                //                 message: "删除成功",
+                //                 type: "success"
+                //             });
+                //             this.depData = {
+                //                 id: -1,
+                //                 label: '全部人员',
+                //             }
+                //             this.getDepartment();
+                //             this.getUser();
+                //         } else {
+                //             this.$message({
+                //                 message: res.msg,
+                //                 type: "error"
+                //             });
+                //         }
+                //     },
+                //     error => {
+                //         this.listLoading = false;
+                //         this.$message({
+                //             message: error,
+                //             type: "error"
+                //         });
+                //     });
+                // })
+                // .catch(() => {});
             },
 
             // 关键搜索