pull/3/head^2
xiaozhiyong 2 years ago
parent 1d0e1bd34e
commit dee2e346bc
  1. 42
      src/components/autocomplete/index.vue
  2. 3
      src/utils/index.js
  3. 2
      src/views/customerManagement/companyManagement/index.vue
  4. 0
      src/views/customerManagement/position.html
  5. 2
      src/views/financialCenter/accountManagement/index.vue
  6. 2
      src/views/financialCenter/enterpriseRecharge/index.vue
  7. 2
      src/views/financialCenter/enterpriseRechargeDetails/index.vue

@ -11,6 +11,23 @@
:disabled="isDisabled" :disabled="isDisabled"
@change="change" @change="change"
> >
<template v-if="labelIsMore">
<el-option
v-for="(item, index) in list"
:key="item.id + index"
:label="
item[config.labelKey[0]] +
'(' +
item[config.labelKey[1]] +
'-' +
item[config.labelKey[2]] +
')'
"
:value="item[config.valueKey]"
>
</el-option>
</template>
<template>
<el-option <el-option
v-for="(item, index) in list" v-for="(item, index) in list"
:key="item.id + index" :key="item.id + index"
@ -18,6 +35,7 @@
:value="item[config.valueKey]" :value="item[config.valueKey]"
> >
</el-option> </el-option>
</template>
</el-select> </el-select>
</template> </template>
@ -37,6 +55,8 @@ export default {
data() { data() {
return { return {
text: "", text: "",
labelIsMore: false,
// labelKeyArr:[],
list: [], list: [],
isDisabled: false, isDisabled: false,
}; };
@ -58,8 +78,7 @@ export default {
"config.isDisabled": { "config.isDisabled": {
handler(nval, oval) { handler(nval, oval) {
let type = this.$utils.typeJudgment(nval); let type = this.$utils.typeJudgment(nval);
console.log("type", type); if (["Boolean", "String"].includes(type)) {
if (type.includes("Boolean") || type.includes("String")) {
this.isDisabled = !!this.config.isDisabled; this.isDisabled = !!this.config.isDisabled;
} }
}, },
@ -67,6 +86,16 @@ export default {
immediate: true, 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: { methods: {
// //
remoteMethod(query) { remoteMethod(query) {
@ -79,17 +108,12 @@ export default {
// return; // return;
// } // }
let params = {}; let params = {};
if (type.includes("Object")) { if (["Object"].includes(type)) {
params[this.config.autocompleteKey.key] = query; params[this.config.autocompleteKey.key] = query;
params["enableMark"] = this.config.autocompleteKey.enableMark; params["enableMark"] = this.config.autocompleteKey.enableMark;
} }
if ( if (["String", "Undefined", "Null"].includes(type)) {
type.includes("String") ||
type.includes("Undefined") ||
type.includes("Null")
) {
// getautocompleteKey // getautocompleteKey
console.log();
this.config.autocompleteKey this.config.autocompleteKey
? (params[this.config.autocompleteKey] = query) ? (params[this.config.autocompleteKey] = query)
: (params = query); : (params = query);

@ -58,5 +58,6 @@ export function cellStyle() {
// 类型判断 // 类型判断
export function typeJudgment(object) { export function typeJudgment(object) {
let res = {}.__proto__.toString.call(object); let res = {}.__proto__.toString.call(object);
return res || ""; let type = /(?<= ).+(?=\])/.exec(res);
return type.length ? type[0] : "";
} }

@ -509,7 +509,7 @@ export default {
}, },
configAutocompleteLeader: { configAutocompleteLeader: {
serveTarget: commonServe.liekQuery, serveTarget: commonServe.liekQuery,
labelKey: "nickName", labelKey: ["id", "nickName", "phone"],
valueKey: "id", valueKey: "id",
placeholder: "企业负责人姓名或联系方式", placeholder: "企业负责人姓名或联系方式",
querykey: "businessLeader", querykey: "businessLeader",

@ -275,7 +275,7 @@ export default {
configAutocompleteBusinessLeader: { configAutocompleteBusinessLeader: {
serveTarget: commonServe.liekQuery, serveTarget: commonServe.liekQuery,
autocompleteKey: "", autocompleteKey: "",
labelKey: "nickName", labelKey: ["id", "nickName", "phone"],
valueKey: "id", valueKey: "id",
placeholder: "业务负责人", placeholder: "业务负责人",
querykey: "businessLeader", querykey: "businessLeader",

@ -395,7 +395,7 @@ export default {
configAutocompleteSec: { configAutocompleteSec: {
serveTarget: commonServe.liekQuery, serveTarget: commonServe.liekQuery,
autocompleteKey: "", autocompleteKey: "",
labelKey: "nickName", labelKey: ["id", "nickName", "phone"],
valueKey: "id", valueKey: "id",
placeholder: "业务负责人", placeholder: "业务负责人",
querykey: "businessLeader", querykey: "businessLeader",

@ -257,7 +257,7 @@ export default {
configAutocompleteSec: { configAutocompleteSec: {
serveTarget: commonServe.liekQuery, serveTarget: commonServe.liekQuery,
autocompleteKey: "", autocompleteKey: "",
labelKey: "nickName", labelKey: ["id", "nickName", "phone"],
valueKey: "id", valueKey: "id",
placeholder: "业务负责人", placeholder: "业务负责人",
querykey: "businessLeader", querykey: "businessLeader",

Loading…
Cancel
Save