diff --git a/src/pages/src/store/modules/organization.js b/src/pages/src/store/modules/organization.js index 68ebf1d14..e19652d99 100644 --- a/src/pages/src/store/modules/organization.js +++ b/src/pages/src/store/modules/organization.js @@ -122,5 +122,10 @@ export default { getMultiConditionQuery(context, params, config = {}) { return http.get(`api/v3/profiles/?${params}`); }, + // 获取部门列表 + getDepartmentsList(context, params, config = {}) { + const { categoryId } = params; + return http.get(`api/v3/departments/?category_id=${categoryId}`); + }, }, }; diff --git a/src/pages/src/views/organization/index.vue b/src/pages/src/views/organization/index.vue index a289e1817..e08b5fe9c 100644 --- a/src/pages/src/views/organization/index.vue +++ b/src/pages/src/views/organization/index.vue @@ -156,7 +156,8 @@ :data="searchFilterList" :show-condition="false" v-model="tableSearchKey" - @change="handleTableSearch" /> + @change="handleTableSearch" + @input-click.once="handleSearchList" />
@@ -174,7 +175,8 @@ :data="searchFilterList" :show-condition="false" v-model="tableSearchKey" - @change="handleTableSearch" /> + @change="handleTableSearch" + @input-click.once="handleSearchList" />

{ - if (item.id) { - const key = item.id; - const value = []; - item.values.forEach((v) => { - value.push(v.id); - }); - valueList.push(`${key}=${value}`); + if (item.id === 'department_name') { + key = 'departments'; + } else if (item.id === 'leader') { + key = 'leaders'; + } else { + key = item.id; } + item.values.forEach((v) => { + value.push(v.id); + }); + valueList.push(`${key}=${value}`); }); const params = valueList.join('&'); this.$store.dispatch('organization/getMultiConditionQuery', params).then((res) => { @@ -761,6 +768,59 @@ export default { this.clickSecond = false; }); }, + // 搜索文件配置列表 + handleSearchList() { + this.getDepartmentsList(); + this.getLeadersList(); + }, + // 获取部门列表 + async getDepartmentsList() { + try { + const params = { + categoryId: this.currentCategoryId, + }; + const list = []; + const res = await this.$store.dispatch('organization/getDepartmentsList', params); + res.data.results.forEach((item) => { + list.push({ + id: item.id, + name: item.full_name, + }); + this.heardList.filter((v) => { + if (v.id === 'department_name') { + this.$set(v, 'children', []); + this.$set(v, 'multiable', true); + v.children = list; + } + }); + }); + } catch (e) { + console.warn(e); + } + }, + // 获取上级列表 + async getLeadersList() { + try { + const params = `category_id=${this.currentCategoryId}`; + const list = []; + const res = await this.$store.dispatch('organization/getMultiConditionQuery', params); + res.data.results.forEach((item) => { + list.push({ + id: item.id, + name: `${item.username}(${item.display_name})`, + }); + this.heardList.filter((v) => { + if (v.id === 'leader') { + this.$set(v, 'children', []); + this.$set(v, 'multiable', true); + v.children = list; + } + }); + }); + } catch (e) { + console.warn(e); + } + }, // 搜索结果: 1.展开tree 找到对应的node 加载用户信息列表 async handleSearchTree(searchResult) { // 消除之前空组织对搜索结果的影响