|
@@ -26,7 +26,7 @@
|
|
|
<el-form-item label="可用分部">
|
|
|
<el-select v-model="listQuery.orgId" clearable @change="getList">
|
|
|
<el-option
|
|
|
- v-for="item in organList"
|
|
|
+ v-for="item in organSearchList"
|
|
|
:label="item.name"
|
|
|
:value="item.id"
|
|
|
:key="item.id"
|
|
@@ -405,12 +405,14 @@
|
|
|
class="select"
|
|
|
collapse-tags
|
|
|
ref="select"
|
|
|
+ @change="handleOrganChange"
|
|
|
>
|
|
|
<el-option
|
|
|
- v-for="item in organList"
|
|
|
+ v-for="item in organSearchList"
|
|
|
:label="item.name"
|
|
|
:value="item.id"
|
|
|
:key="item.id"
|
|
|
+ :disabled="item.disabled"
|
|
|
></el-option>
|
|
|
</el-select>
|
|
|
<el-button class="btn" @click="selectAll">全选</el-button>
|
|
@@ -518,7 +520,9 @@ export default {
|
|
|
},
|
|
|
openOrgin: false,
|
|
|
tenantId: 1,
|
|
|
+ organSearchList: [], // 只是搜索使用
|
|
|
organList: [],
|
|
|
+ organSetList: [], // 只是设置使用
|
|
|
ruleOrganForm: {
|
|
|
id: null,
|
|
|
orgIds: [],
|
|
@@ -904,29 +908,74 @@ export default {
|
|
|
queryAllToOrgan({ tenantId: this.tenantId }).then((res) => {
|
|
|
if (res.code == 200) {
|
|
|
const result = res.data;
|
|
|
- let filterOrganId = [
|
|
|
+ const filterOrganId = [
|
|
|
1, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
|
|
|
- 22, 23, 25, 26, 27, 28, 34, 37, 40, 71, 72, 124, 125, 128, 134
|
|
|
+ 22, 23, 25, 26, 27, 28, 34, 37, 40, 71, 72, 123, 124, 125, 128, 134,
|
|
|
+ 148, 147, 127, 139, 151, 36, 149, 152, 153,
|
|
|
+ ];
|
|
|
+
|
|
|
+ // 搜索的分部
|
|
|
+ const filterSearchOrganId = [
|
|
|
+ 148, 147, 127, 151, 36, 149, 152, 16, 1, 40, 15, 23, 28, 17, 6, 8,
|
|
|
+ 13, 134, 139, 153,
|
|
|
];
|
|
|
|
|
|
let tempOrgan = [];
|
|
|
+ let tempSearchOrgan = [];
|
|
|
// 过滤不会显示的分部
|
|
|
result.forEach((item) => {
|
|
|
if (filterOrganId.includes(item.id)) {
|
|
|
tempOrgan.push(item);
|
|
|
}
|
|
|
+ if (filterSearchOrganId.includes(item.id)) {
|
|
|
+ tempSearchOrgan.push(item);
|
|
|
+ }
|
|
|
});
|
|
|
this.organList = tempOrgan;
|
|
|
+ this.organSearchList = tempSearchOrgan;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
handleSetting(row) {
|
|
|
this.ruleOrganForm.id = row.id;
|
|
|
- this.ruleOrganForm.orgIds = row.org_ids
|
|
|
+ const ids = row.org_ids
|
|
|
? row.org_ids.split(",").map((item) => Number(item))
|
|
|
: [];
|
|
|
+
|
|
|
+ const tempOrganSet = [...this.organSearchList];
|
|
|
+ const lastIds = []
|
|
|
+ tempOrganSet.forEach((item) => {
|
|
|
+ if(ids.includes(item.id)){
|
|
|
+ lastIds.push(item.id)
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ tempOrganSet.sort((a, b) => {
|
|
|
+ return a.id - b.id;
|
|
|
+ });
|
|
|
+
|
|
|
+ this.ruleOrganForm.orgIds = lastIds;
|
|
|
+ this.organSetList = tempOrganSet;
|
|
|
+
|
|
|
this.openOrgin = true;
|
|
|
},
|
|
|
+ handleOrganChange(val) {
|
|
|
+ // console.log(val)
|
|
|
+ // const tempOrganSet = [...this.organSetList];
|
|
|
+ // tempOrganSet.forEach((item) => {
|
|
|
+ // if (!val.includes(item.id)) {
|
|
|
+ // const index = this.organSearchList.findIndex((tempItem) => {
|
|
|
+ // return tempItem.id === item.id;
|
|
|
+ // });
|
|
|
+ // if (index === -1) {
|
|
|
+ // item.disabled = true;
|
|
|
+ // } else {
|
|
|
+ // item.disabled = false;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // this.organSetList = tempOrganSet;
|
|
|
+ },
|
|
|
setOrgIdsForm(formName) {
|
|
|
this.$refs[formName].validate(async (valid) => {
|
|
|
if (valid) {
|