diff --git a/src/components/autocomplete/index.vue b/src/components/autocomplete/index.vue index 9293467..406bead 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,18 +67,22 @@ 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) { 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 }, '') } @@ -99,7 +93,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) { diff --git a/src/views/oilFinalStatement/oilFinalStatementAddList.vue b/src/views/oilFinalStatement/oilFinalStatementAddList.vue index 89fe0c7..d6217e8 100644 --- a/src/views/oilFinalStatement/oilFinalStatementAddList.vue +++ b/src/views/oilFinalStatement/oilFinalStatementAddList.vue @@ -197,7 +197,7 @@
-
+
取消 确认提交
@@ -625,7 +625,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 226d3cd..857ee66 100644 --- a/src/views/oilFinalStatement/oilFinalStatementListInfo.vue +++ b/src/views/oilFinalStatement/oilFinalStatementListInfo.vue @@ -181,11 +181,8 @@