diff --git a/src/components/autocomplete/index.vue b/src/components/autocomplete/index.vue index 8d80889..8c7cacb 100644 --- a/src/components/autocomplete/index.vue +++ b/src/components/autocomplete/index.vue @@ -11,30 +11,17 @@ @clear="list = []" @change="change" > - @@ -43,7 +30,7 @@ export default { props: { params: Object, - config: Object, + config: Object // config: { // serveTarget: {}, // 远程搜索接口 // autocompleteKey: "", //远程搜索接口参数名 @@ -54,81 +41,94 @@ export default { }, data() { return { - text: "", - labelIsMore: false, + text: '', + // labelIsMore: false, list: [], - isDisabled: false, - }; - }, - watch: { - "config.echoId": { - handler(nval, oval) { - this.list = []; - let type = this.$utils.typeJudgment(this.config.echoName); - if (nval && ["String"].includes(type)) { - let resultName = this.config.echoName.replace(/\s*/g, ""); - if (!resultName) return; - this.remoteMethod(resultName); - } - }, - deep: true, - immediate: true, - }, - "config.isDisabled": { - handler(nval, oval) { - let type = this.$utils.typeJudgment(nval); - if (["Boolean", "String"].includes(type)) { - this.isDisabled = !!this.config.isDisabled; - } - }, - deep: true, - immediate: true, - }, - }, - created() { - let { labelKey } = this.config; - let type = this.$utils.typeJudgment(labelKey); - if (type === "Array") { - this.labelIsMore = true; + isDisabled: false } }, + watch: { + 'config.echoId': { + handler(nval, oval) { + this.list = [] + let type = this.$utils.typeJudgment(this.config.echoName) + if (nval && ['String'].includes(type)) { + let resultName = this.config.echoName.replace(/\s*/g, '') + if (!resultName) return + this.remoteMethod(resultName) + } + }, + deep: true, + immediate: true + }, + 'config.isDisabled': { + handler(nval, oval) { + let type = this.$utils.typeJudgment(nval) + if (['Boolean', 'String'].includes(type)) { + this.isDisabled = !!this.config.isDisabled + } + }, + deep: true, + immediate: true + } + }, + created() { + let { labelKey } = this.config + let type = this.$utils.typeJudgment(labelKey) + // if (type === 'Array') { + // this.labelIsMore = true + // } + this.labelHandler = this.labelHandler(type) + // console.log(this.labelHandler()) + }, methods: { + labelHandler(type) { + if (type === 'Array') { + return item => { + return this.config.labelKey.reduce((prev, cur) => { + prev += /^[^0-9a-zA-Z]/.test(cur) ? cur : item[cur] + return prev + }, '') + } + } + return item => { + return item[this.config.labelKey] + } + }, // 远程搜索 remoteMethod(query) { - if (query !== "") { - this.loading = true; - let type = this.$utils.typeJudgment(this.config.autocompleteKey); + if (query !== '') { + this.loading = true + let type = this.$utils.typeJudgment(this.config.autocompleteKey) // if (!type.includes("Object") && !type.includes("String")) { // this.loading = false; // this.$message.warning("config.autocompleteKey格式有误"); // return; // } - let params = {}; - if (["Object"].includes(type)) { - params[this.config.autocompleteKey.key] = query; - params["enableMark"] = this.config.autocompleteKey.enableMark; + let params = {} + if (['Object'].includes(type)) { + params[this.config.autocompleteKey.key] = query + params['enableMark'] = this.config.autocompleteKey.enableMark } - if (["String", "Undefined", "Null"].includes(type)) { + if (['String', 'Undefined', 'Null'].includes(type)) { // 接口为get类型时需将autocompleteKey值设为空 - this.config.autocompleteKey - ? (params[this.config.autocompleteKey] = query) - : (params = query); + this.config.autocompleteKey ? (params[this.config.autocompleteKey] = query) : (params = query) } - this.config.serveTarget(params).then((res) => { - this.loading = false; + this.config.serveTarget(params).then(res => { + this.loading = false if (res.data.length) { - this.list = res.data; - } else this.list = []; - }); + this.list = res.data + } else this.list = [] + }) } else { - this.list = []; + this.list = [] } }, change(val) { - this.$emit("change", val, this.list); - }, - }, -}; + this.$emit('change', val, this.list) + } + } +} diff --git a/src/views/customerManagement/companyManagement/index.vue b/src/views/customerManagement/companyManagement/index.vue index e4e302e..e148d7b 100644 --- a/src/views/customerManagement/companyManagement/index.vue +++ b/src/views/customerManagement/companyManagement/index.vue @@ -3,57 +3,24 @@
- + - + - + - - + + - + - - + + - + - + @@ -123,76 +82,45 @@ @@ -202,8 +130,8 @@ :active-value="1" :inactive-value="0" @change=" - (val) => { - enableMark(val, row); + val => { + enableMark(val, row) } " > @@ -224,27 +152,21 @@ --> @@ -252,40 +174,17 @@ 详情 - - 更多 - + 更多 - - 基础资料 - - - 认证信息 - - - 银行信息 - - - 财务信息 - + 基础资料 + 认证信息 + 银行信息 + 财务信息 @@ -297,11 +196,7 @@
- + @@ -310,13 +205,7 @@ - + @@ -442,19 +314,19 @@