Bläddra i källkod

正北公司项目新增部门筛选框方便筛选

lxy_01 1 månad sedan
förälder
incheckning
e7322ba429

+ 37 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/centerManage/centerManage.vue

@@ -2,6 +2,15 @@
     <section>
         <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
             <el-form :inline="true">
+                <el-form-item :label="$t('lable.department')" style="width: 165px">
+                      <el-cascader v-if="zhengbeiCompanysId.includes(user.companyId)" v-model="searchDepartmentId" :placeholder="$t('defaultText.pleaseChoose')" style="width: 125px"
+                      :options="option" :props="{ checkStrictly: false,expandTrigger: 'hover' }" :show-all-levels="false" clearable
+                       size="mini"></el-cascader>
+
+                      <vueCascader :size="'mini'" :widthStr="'125'" :clearable="true" :subject="option" :radios="false" :distinction="'1'" @vueCasader="vueCasader" v-if="user.userNameNeedTranslate == 1"></vueCascader>
+                </el-form-item>
+                
+                
                 <el-form-item :label="user.timeType.customDegreeName + $t('guan-li')">
                     <el-input :placeholder="$t('qing-shu-ru-guan-jian-ming-cheng')" v-model.trim="searchNameVal" clearable class="input-with-select"
                         style="margin-left: 50px" @keyup.enter.native="searchName()">
@@ -23,7 +32,7 @@
 
             </el-form>
         </el-col>
-        <el-table :data="subProjectList" highlight-current-row v-loading="listLoading" :height="heightDoms"
+        <el-table :data="filteredSubProjectList" highlight-current-row v-loading="listLoading" :height="heightDoms"
             style="width: 100%;" @selection-change="selectionChange">
             <el-table-column type="selection"></el-table-column>
             <el-table-column prop="id" width="200" :label="$t('headerTop.serialNumber')" align="center">
@@ -111,6 +120,29 @@
 </template>
 <script>
 export default {
+    computed:{
+        //过滤筛选结果
+        filteredSubProjectList(){
+            const list = this.subProjectList
+            const searchDepartmentId = this.searchDepartmentId
+            let result = []
+            if(!searchDepartmentId){
+                return this.subProjectList
+            }
+            for(const item of list){
+                console.log(item)
+                console.log(item.departmentIdList + " searchDepartmentId: " + searchDepartmentId)
+                console.log("ListItem:" + typeof(item.departmentIdList) + "searchDepartmentId type:" + typeof(searchDepartmentId))
+                for(const id of item.departmentIdList){
+                    if(id == searchDepartmentId){
+                        result.push(item)
+                    }
+                }
+            }
+            return result
+        }
+
+    },
     data() {
         return {
             user: JSON.parse(sessionStorage.getItem("user")),
@@ -134,6 +166,7 @@ export default {
             subProjectList: [],//子项目列表
             subProjectListArr: [], // 备用列表
             searchNameVal: '',
+            searchDepartmentId:null,
             options: [],
             value: '',
             zhengbeiCompanysId:[8138,8261,8264,8268]
@@ -455,9 +488,12 @@ export default {
         },
         getDepartmentName(id) {
             if (!id || !this.option) return null
+            console.log(this.option)
+            console.log(id)
             const findName = (list) => {
                 for (let item of list) {
                     if (item.value === id) {
+                        console.log(item.value + "id:" + id)
                         return item.label
                     }
                     if (item.children && item.children.length) {