From c856bb53183949a8ec144f04b1e3e7eb4d4073f4 Mon Sep 17 00:00:00 2001 From: xiaozhiyong Date: Wed, 22 Feb 2023 17:21:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/autocomplete/index.vue | 18 ++++++++++++------ src/utils/index.js | 5 +++++ src/views/product/components/add.vue | 5 ++++- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/components/autocomplete/index.vue b/src/components/autocomplete/index.vue index fd22263..476e150 100644 --- a/src/components/autocomplete/index.vue +++ b/src/components/autocomplete/index.vue @@ -59,12 +59,18 @@ export default { if (query !== "") { this.loading = true; let params = {}; - // if() { - - // } - this.config.autocompleteKey - ? (params[this.config.autocompleteKey] = query) - : (params["queryTypeGet"] = query); + if ( + this.$utils + .typeJudgment(this.config.autocompleteKey) + .includes("Object") + ) { + params[this.config.autocompleteKey.key] = query; + params["enableMark"] = this.config.autocompleteKey.enableMark; + } else { + this.config.autocompleteKey + ? (params[this.config.autocompleteKey] = query) + : (params["queryTypeGet"] = query); + } this.config.serveTarget(params).then((res) => { let timeInstance = setTimeout(() => { this.loading = false; diff --git a/src/utils/index.js b/src/utils/index.js index 4b6ed6c..49fcf20 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -55,3 +55,8 @@ export function isLicensePlate(no) { export function cellStyle() { return "text-align:center"; } + +export function typeJudgment(object) { + let res = {}.__proto__.toString.call(object); + return res ? res : ""; +} diff --git a/src/views/product/components/add.vue b/src/views/product/components/add.vue index dfbd6db..b3f6ba3 100644 --- a/src/views/product/components/add.vue +++ b/src/views/product/components/add.vue @@ -110,7 +110,10 @@ export default { refineryList: [], configAutocomplete: { serveTarget: refineryInfoServe.findByEntity, - autocompleteKey: "refineryName", + autocompleteKey: { + key: "refineryName", + enableMark: "ENABLE", + }, labelKey: "refineryName", valueKey: "id", placeholder: "炼厂名称",