From ead85633109bcb3cc8d8b3c6804c280dd6ee1e5d Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期二, 06 一月 2026 11:38:51 +0800
Subject: [PATCH] 省人民维护
---
src/views/project/components/orgselect/index.vue | 114 +++++++++++++++++++++++++++++++++++++-------------------
1 files changed, 75 insertions(+), 39 deletions(-)
diff --git a/src/views/project/components/orgselect/index.vue b/src/views/project/components/orgselect/index.vue
index be20106..7471f43 100644
--- a/src/views/project/components/orgselect/index.vue
+++ b/src/views/project/components/orgselect/index.vue
@@ -14,6 +14,7 @@
@focus="focusEvents.func"
@change="change"
@blur="changeBlur"
+ @visible-change="handleVisibleChange"
value-key="organizationid"
allow-create
reserve-keyword
@@ -22,8 +23,8 @@
ref="selecter"
>
<el-option
- v-for="(spec, index) in dataList"
- :key="index"
+ v-for="(spec, index) in displayList"
+ :key="spec.organizationid"
:label="spec.organizationname"
:value="spec.organizationid"
>
@@ -101,8 +102,10 @@
return {
pageData: { pageNum: 1, pageSize: 100 },
isLoading: false,
- // dataList: [],
- tempList: [],
+ // 涓変釜鐙珛鐨勬暟鎹簮锛岄伩鍏嶇浉浜掓薄鏌�
+ originalList: [], // 瀹屾暣鐨勫師濮嬫暟鎹簮
+ tempList: [], // 涓棿缂撳瓨鏁版嵁
+ displayList: [], // 鐢ㄤ簬娓叉煋鏄剧ず鐨勫垪琛�
myValue: this.multiple ? [] : "",
focusEvents: {
func: () => {},
@@ -145,15 +148,17 @@
let userType = { userType: "1" };
if (this.orgType == 4) {
let arr = this.$store.state.user.organization;
- this.dataList.push(...arr);
+ this.originalList.push(...arr);
if (this.isAll) {
let all = {
organizationid: "",
organizationname: "鍏ㄩ儴"
};
- this.dataList.unshift(all);
+ this.originalList.unshift(all);
}
- this.tempList = this.dataList.map(item => item);
+ // 鍒濆鍖栦笁涓垪琛ㄤ负鐩稿悓鏁版嵁
+ this.tempList = [...this.originalList];
+ this.displayList = [...this.originalList];
this.focusEvents.loaded = true;
this.isLoading = false;
return;
@@ -161,57 +166,64 @@
listOrganization(searchData)
.then(response => {
- this.dataList.push(...response.rows);
+ this.originalList.push(...response.rows);
if (this.isAll) {
let all = {
organizationid: "",
organizationname: "鍏ㄩ儴"
};
- this.dataList.unshift(all);
+ this.originalList.unshift(all);
}
- this.tempList = this.dataList.map(item => item);
+ // 鍒濆鍖栦笁涓垪琛ㄤ负鐩稿悓鏁版嵁
+ this.tempList = [...this.originalList];
+ this.displayList = [...this.originalList];
this.focusEvents.loaded = true;
})
.catch(error => {
- // 鏆傛棤澶勭悊
+ console.error("鑾峰彇鏈烘瀯鍒楄〃澶辫触:", error);
})
.finally(() => {
this.isLoading = false;
});
},
- getOptionByValue(key) {
- let outValue = null;
- this.dataList.forEach(e => {
- if (e.organizationid == key) {
- outValue = e;
- }
- });
-
- return outValue;
- },
-
+ /**
+ * 鑷畾涔夌瓫閫夋柟娉� - 淇鎼滅储鏃犳晥闂
+ * @param {string} val - 鎼滅储鍏抽敭璇�
+ */
filterMethod(val) {
- this.myValue = val;
if (val) {
- this.dataList = this.tempList.filter(item => {
- if (
- (item.PYM &&
- !!~item.PYM.toUpperCase().indexOf(val.toUpperCase())) ||
- (item.WBM &&
- !!~item.WBM.toUpperCase().indexOf(val.toUpperCase())) ||
+ // 瀵逛复鏃跺垪琛ㄨ繘琛岀瓫閫夛紝涓嶄慨鏀瑰師濮嬫暟鎹�
+ this.displayList = this.tempList.filter(item => {
+ return (
+ (item.PYM && item.PYM.toUpperCase().includes(val.toUpperCase())) ||
+ (item.WBM && item.WBM.toUpperCase().includes(val.toUpperCase())) ||
(item.organizationname &&
- !!~item.organizationname.toUpperCase().indexOf(val.toUpperCase()))
- ) {
- return true;
- } else {
- return false;
- }
+ item.organizationname.toUpperCase().includes(val.toUpperCase()))
+ );
});
} else {
- this.dataList = this.tempList.map(item => item);
+ // 鎼滅储璇嶄负绌烘椂鏄剧ず瀹屾暣鍒楄〃
+ this.displayList = [...this.tempList];
}
},
+
+ /**
+ * 澶勭悊涓嬫媺妗嗘樉绀�/闅愯棌浜嬩欢 - 淇鏁版嵁鎭㈠闂
+ * @param {boolean} visible - 鏄惁鍙
+ */
+ handleVisibleChange(visible) {
+ if (!visible) {
+ // 涓嬫媺妗嗗叧闂椂閲嶇疆鏄剧ず鍒楄〃涓哄畬鏁存暟鎹�
+ this.displayList = [...this.originalList];
+ this.tempList = [...this.originalList];
+ }
+ },
+
+ getOptionByValue(key) {
+ return this.originalList.find(item => item.organizationid == key) || null;
+ },
+
focus() {
this.$refs.selecter.focus();
},
@@ -227,9 +239,10 @@
this.$emit("change", data);
});
},
+
defaultInit(defaultItem, defaultItemName) {
if (defaultItem && defaultItemName) {
- let list = this.dataList.filter(
+ let list = this.originalList.filter(
r =>
r.organizationid == defaultItem &&
r.organizationname == defaultItemName
@@ -239,10 +252,11 @@
organizationname: defaultItemName,
organizationid: defaultItem
};
- this.dataList.push(data);
+ this.originalList.push(data);
+ this.tempList = [...this.originalList];
+ this.displayList = [...this.originalList];
}
}
- this.tempList = this.dataList.map(item => item);
}
},
computed: {},
@@ -254,6 +268,18 @@
myValue(newVal) {
this.$emit("input", newVal);
this.$emit("change", newVal);
+ },
+ // 鐩戝惉props涓殑dataList鍙樺寲
+ dataList: {
+ handler(newList) {
+ if (newList && newList.length > 0) {
+ this.originalList = [...newList];
+ this.tempList = [...newList];
+ this.displayList = [...newList];
+ }
+ },
+ immediate: true,
+ deep: true
}
}
};
@@ -265,4 +291,14 @@
position: relative;
width: 90%;
}
+
+// 浼樺寲鎼滅储妗嗘牱寮�
+::v-deep.selectclass .el-select__input {
+ min-width: 80px;
+}
+
+// 纭繚閫夐」鍒楄〃姝e父鏄剧ず
+::v-deep.selectclass .el-select-dropdown {
+ z-index: 9999 !important;
+}
</style>
--
Gitblit v1.9.3