From 29b5fdc39b337bc0167dcdb8010ffeff39c89c75 Mon Sep 17 00:00:00 2001 From: xiaozhiyong Date: Mon, 10 Jul 2023 10:22:28 +0800 Subject: [PATCH 1/2] =?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 | 28 +++++++------------------- src/utils/index.js | 29 +++++++++++++++------------ 2 files changed, 23 insertions(+), 34 deletions(-) diff --git a/src/components/autocomplete/index.vue b/src/components/autocomplete/index.vue index 9293467..ba3e6d6 100644 --- a/src/components/autocomplete/index.vue +++ b/src/components/autocomplete/index.vue @@ -11,15 +11,6 @@ @clear="list = []" @change="change" > - @@ -33,17 +24,17 @@ export default { config: Object // config: { // serveTarget: {}, // 远程搜索接口 - // autocompleteKey: "", //远程搜索接口参数名 - // labelKey: [] || '', //接口返回数据label - // valueKey: "", //接口返回数据id - // querykey: "", //查询接口参数名 - // echoId:'', // + // autocompleteKey: "" || {}, // 远程搜索接口参数名 + // labelKey: "" || [], // 接口返回数据label + // valueKey: "", // 接口返回数据id + // querykey: "", // 查询接口参数名 + // echoId: "", // 用于回显的id + // echoName: "", // 用于回显的name // }, }, data() { return { text: '', - // labelIsMore: false, list: [], isDisabled: false } @@ -51,7 +42,6 @@ export default { watch: { 'config.echoId': { handler(nval, oval) { - console.log('nvalnvalnvalnvalnval', nval) this.list = [] let type = this.$utils.typeJudgment(this.config.echoName) if (nval && ['String'].includes(type)) { @@ -77,11 +67,8 @@ export default { created() { let { labelKey } = this.config let type = this.$utils.typeJudgment(labelKey) - // if (type === 'Array') { - // this.labelIsMore = true - // } + // 重构labelHandler this.labelHandler = this.labelHandler(type) - // console.log(this.labelHandler()) }, methods: { labelHandler(type) { @@ -99,7 +86,6 @@ export default { }, // 远程搜索 remoteMethod(query) { - console.log('query', query) if (query !== '') { this.loading = true let type = this.$utils.typeJudgment(this.config.autocompleteKey) diff --git a/src/utils/index.js b/src/utils/index.js index 1f9850f..69503b4 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -17,32 +17,35 @@ export function parseTime(time) { } const formatRes = { y: date.getFullYear(), - M: date.getMonth() + 1, - d: date.getDate(), - h: date.getHours(), - m: date.getMinutes(), - s: date.getSeconds(), + M: (date.getMonth() + 1 + '').padStart(2, 0), + d: (date.getDate() + '').padStart(2, 0), + h: (date.getHours() + '').padStart(2, 0), + m: (date.getMinutes() + '').padStart(2, 0), + s: (date.getSeconds() + '').padStart(2, 0), week: ['日', '一', '二', '三', '四', '五', '六'][date.getDay()] } - formatRes.M < 10 && (formatRes.M = '0' + formatRes.M) - formatRes.d < 10 && (formatRes.d = '0' + formatRes.d) - formatRes.h < 10 && (formatRes.h = '0' + formatRes.h) - formatRes.m < 10 && (formatRes.m = '0' + formatRes.m) - formatRes.s < 10 && (formatRes.s = '0' + formatRes.s) + // formatRes.M < 10 && (formatRes.M = '0' + formatRes.M) + // formatRes.d < 10 && (formatRes.d = '0' + formatRes.d) + // formatRes.h < 10 && (formatRes.h = '0' + formatRes.h) + // formatRes.m < 10 && (formatRes.m = '0' + formatRes.m) + // formatRes.s < 10 && (formatRes.s = '0' + formatRes.s) return formatRes } // 防抖 export function debounce(fn, delay) { let timer = null - return function () { + function _implementer(...args) { if (timer) clearTimeout(timer) let _this = this - let _arguments = arguments timer = setTimeout(function () { - fn.apply(_this, _arguments) + fn.call(_this, ...args) }, delay) } + _implementer.cancel = () => { + clearTimeout(timer) + } + return _implementer } // 车牌校验 export function isLicensePlate(number) { From 27a14874a4c04a48ca70a4fd8b84e220df360ad2 Mon Sep 17 00:00:00 2001 From: xiaozhiyong Date: Mon, 10 Jul 2023 13:49:36 +0800 Subject: [PATCH 2/2] =?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 | 9 ++++++++- src/views/oilFinalStatement/oilFinalStatementAddList.vue | 4 ++-- .../oilFinalStatement/oilFinalStatementListInfo.vue | 5 +---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/components/autocomplete/index.vue b/src/components/autocomplete/index.vue index ba3e6d6..406bead 100644 --- a/src/components/autocomplete/index.vue +++ b/src/components/autocomplete/index.vue @@ -75,7 +75,14 @@ export default { if (type === 'Array') { return item => { return this.config.labelKey.reduce((prev, cur) => { - prev += /^[^0-9a-zA-Z]/.test(cur) ? cur : item[cur] + let type = this.$utils.typeJudgment(cur) + let _function = + type != 'Function' + ? item => { + return /^[^0-9a-zA-Z]/.test(cur) ? cur : item[cur] + } + : cur + prev += _function(item) return prev }, '') } diff --git a/src/views/oilFinalStatement/oilFinalStatementAddList.vue b/src/views/oilFinalStatement/oilFinalStatementAddList.vue index f6ae314..f8a2b1d 100644 --- a/src/views/oilFinalStatement/oilFinalStatementAddList.vue +++ b/src/views/oilFinalStatement/oilFinalStatementAddList.vue @@ -207,7 +207,7 @@
-
+
取消 确认提交
@@ -654,7 +654,7 @@ export default { /* flex: 1; */ display: flex; align-items: center; - justify-content: end; + justify-content: flex-end; font-size: 16px; } diff --git a/src/views/oilFinalStatement/oilFinalStatementListInfo.vue b/src/views/oilFinalStatement/oilFinalStatementListInfo.vue index e0c91d9..614f8cb 100644 --- a/src/views/oilFinalStatement/oilFinalStatementListInfo.vue +++ b/src/views/oilFinalStatement/oilFinalStatementListInfo.vue @@ -179,10 +179,8 @@