Browse Source

提交代码

Lijy 1 tháng trước cách đây
mục cha
commit
81e1d77ff1

+ 1 - 0
fhKeeper/formulahousekeeper/timesheet_mld/src/views/project/gantt.vue

@@ -686,4 +686,5 @@ export default {
 .greyStr {
   background: #e0e0e0;
 }
+
 </style>

+ 61 - 1
fhKeeper/formulahousekeeper/timesheet_mld/src/views/project/project_gantt.vue

@@ -160,6 +160,16 @@
         </div>
       </template>
 
+      <!-- 部门 -->
+      <template v-if="radio1 == $t('an-ren-yuan-cha-kan')">
+        <div class="eachLayout">
+          <div class="eachLayout-title">部门</div>
+          <el-cascader v-model="departmentValue" :placeholder="$t('defaultText.pleaseChoose')" style="width: 125px"
+            :options="departmentOptions" :props="{ checkStrictly: false,expandTrigger: 'hover' }" :show-all-levels="false" clearable
+            @change="optupdata()" size="small"></el-cascader>
+        </div>
+      </template>
+
       <!-- 人员 -->
       <template v-if="radio1 == $t('an-ren-yuan-cha-kan')">
         <div class="eachLayout">
@@ -332,7 +342,9 @@ export default {
       valuex2: '',
 
       user: JSON.parse(sessionStorage.getItem("user")),
-      typeList: []
+      typeList: [],
+      departmentOptions: [],
+      departmentValue: []
     };
   },
   computed: {},
@@ -356,10 +368,52 @@ export default {
 
     this.getTaskTypeList()
 
+    this.getDepartment()
+
     console.log('<===== 开始执行咯')
     localStorage.removeItem('ganttChartTaskId')
   },
   methods: {
+    // 获取部门列表
+    getDepartment() {
+        this.http.post( this.port.manage.depList, {},
+        res => {
+            if (res.code == "ok") {
+                var list1 = JSON.parse(JSON.stringify(res.data));
+                
+                this.departmentOptions = this.changeArr(list1);
+                console.log(this.departmentOptions, '部门')
+            } 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;
+    },
     // 周的切换
     weekSwitching(weekType) {
       // const now = weekType == 'next' ? this.dayjs(this.valueDate[1]) : this.dayjs(this.valueDate[0]); // 获取当前日期
@@ -512,6 +566,7 @@ export default {
         this.valuex = null
         // console.log("切换按钮",this.radio1);
         if (this.radio1 == this.$t('an-ren-yuan-cha-kan')) {
+          this.departmentValue = []
           this.isDataLoaded = true
           this.reqpar1 = 0
           this.getList()
@@ -689,6 +744,11 @@ export default {
             getlistcs.userId = this.valuex
           }
         }
+        if(this.radio1 == this.$t('an-ren-yuan-cha-kan')) {
+          if(this.departmentValue.length > 0) {
+            getlistcs.deptId = this.departmentValue[this.departmentValue.length - 1]
+          }
+        }
         var urls = '/project/getGanttData';
         this.http.post(urls, getlistcs,
         // this.http.post('/project/getGanttDataNew', getlistcs,