diff --git a/src/components/autocomplete/index.vue b/src/components/autocomplete/index.vue index dbc3c1f..9c9614f 100644 --- a/src/components/autocomplete/index.vue +++ b/src/components/autocomplete/index.vue @@ -11,13 +11,31 @@ :disabled="isDisabled" @change="change" > - - + + @@ -37,6 +55,8 @@ export default { data() { return { text: "", + labelIsMore: false, + // labelKeyArr:[], list: [], isDisabled: false, }; @@ -58,8 +78,7 @@ export default { "config.isDisabled": { handler(nval, oval) { let type = this.$utils.typeJudgment(nval); - console.log("type", type); - if (type.includes("Boolean") || type.includes("String")) { + if (["Boolean", "String"].includes(type)) { this.isDisabled = !!this.config.isDisabled; } }, @@ -67,6 +86,16 @@ export default { immediate: true, }, }, + created() { + let { labelKey } = this.config; + let type = this.$utils.typeJudgment(labelKey); + // console.log(type); + if (type === "Array") { + // let + this.labelIsMore = true; + // console.log(this.labelIsMore); + } + }, methods: { // 远程搜索 remoteMethod(query) { @@ -79,17 +108,12 @@ export default { // return; // } let params = {}; - if (type.includes("Object")) { + if (["Object"].includes(type)) { params[this.config.autocompleteKey.key] = query; params["enableMark"] = this.config.autocompleteKey.enableMark; } - if ( - type.includes("String") || - type.includes("Undefined") || - type.includes("Null") - ) { + if (["String", "Undefined", "Null"].includes(type)) { // 接口为get类型时需将autocompleteKey值设为空 - console.log(); this.config.autocompleteKey ? (params[this.config.autocompleteKey] = query) : (params = query); diff --git a/src/utils/index.js b/src/utils/index.js index e192493..ce47b84 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -58,5 +58,6 @@ export function cellStyle() { // 类型判断 export function typeJudgment(object) { let res = {}.__proto__.toString.call(object); - return res || ""; + let type = /(?<= ).+(?=\])/.exec(res); + return type.length ? type[0] : ""; } diff --git a/src/views/customerManagement/companyManagement/index.vue b/src/views/customerManagement/companyManagement/index.vue index 721d4bc..4ca305e 100644 --- a/src/views/customerManagement/companyManagement/index.vue +++ b/src/views/customerManagement/companyManagement/index.vue @@ -509,7 +509,7 @@ export default { }, configAutocompleteLeader: { serveTarget: commonServe.liekQuery, - labelKey: "nickName", + labelKey: ["id", "nickName", "phone"], valueKey: "id", placeholder: "企业负责人姓名或联系方式", querykey: "businessLeader", diff --git a/src/views/customerManagement/position.html b/src/views/customerManagement/position.html new file mode 100644 index 0000000..e69de29 diff --git a/src/views/financialCenter/accountManagement/index.vue b/src/views/financialCenter/accountManagement/index.vue index 361e9dd..378fd9c 100644 --- a/src/views/financialCenter/accountManagement/index.vue +++ b/src/views/financialCenter/accountManagement/index.vue @@ -275,7 +275,7 @@ export default { configAutocompleteBusinessLeader: { serveTarget: commonServe.liekQuery, autocompleteKey: "", - labelKey: "nickName", + labelKey: ["id", "nickName", "phone"], valueKey: "id", placeholder: "业务负责人", querykey: "businessLeader", diff --git a/src/views/financialCenter/enterpriseRecharge/index.vue b/src/views/financialCenter/enterpriseRecharge/index.vue index 3abd508..53e4aca 100644 --- a/src/views/financialCenter/enterpriseRecharge/index.vue +++ b/src/views/financialCenter/enterpriseRecharge/index.vue @@ -395,7 +395,7 @@ export default { configAutocompleteSec: { serveTarget: commonServe.liekQuery, autocompleteKey: "", - labelKey: "nickName", + labelKey: ["id", "nickName", "phone"], valueKey: "id", placeholder: "业务负责人", querykey: "businessLeader", diff --git a/src/views/financialCenter/enterpriseRechargeDetails/index.vue b/src/views/financialCenter/enterpriseRechargeDetails/index.vue index 3707730..fa53ac3 100644 --- a/src/views/financialCenter/enterpriseRechargeDetails/index.vue +++ b/src/views/financialCenter/enterpriseRechargeDetails/index.vue @@ -257,7 +257,7 @@ export default { configAutocompleteSec: { serveTarget: commonServe.liekQuery, autocompleteKey: "", - labelKey: "nickName", + labelKey: ["id", "nickName", "phone"], valueKey: "id", placeholder: "业务负责人", querykey: "businessLeader",