From 3b0a9e44ac5983e3fce48d2c244481ac143fb2e3 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Thu, 23 Mar 2023 18:24:19 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E8=BF=87=E6=BB=A4=E5=99=A8):=20=E8=8B=B1?= =?UTF-8?q?=E6=96=87=E9=80=97=E5=8F=B7=E5=BC=95=E8=B5=B7=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/widget/deWidget/DeSelect.vue | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/frontend/src/components/widget/deWidget/DeSelect.vue b/frontend/src/components/widget/deWidget/DeSelect.vue index 7038e8938b..ccc83a9494 100644 --- a/frontend/src/components/widget/deWidget/DeSelect.vue +++ b/frontend/src/components/widget/deWidget/DeSelect.vue @@ -84,7 +84,8 @@ export default { value: null, data: [], onFocus: false, - keyWord: '' + keyWord: '', + separator: ',' } }, computed: { @@ -149,7 +150,7 @@ export default { if (!token && linkToken) { method = linkMultFieldValues } - const param = { fieldIds: this.element.options.attrs.fieldId.split(','), sort: this.element.options.attrs.sort } + const param = { fieldIds: this.element.options.attrs.fieldId.split(this.separator), sort: this.element.options.attrs.sort } if (this.panelInfo.proxy) { param.userId = this.panelInfo.proxy } @@ -188,7 +189,7 @@ export default { if (!token && linkToken) { method = linkMultFieldValues } - const param = { fieldIds: this.element.options.attrs.fieldId.split(','), sort: this.element.options.attrs.sort } + const param = { fieldIds: this.element.options.attrs.fieldId.split(this.separator), sort: this.element.options.attrs.sort } if (this.panelInfo.proxy) { param.userId = this.panelInfo.proxy } @@ -245,8 +246,8 @@ export default { this.element.options.value = '' return } - const tempValueArray = JSON.parse(JSON.stringify(this.element.options.value.split(','))) - this.element.options.value = tempValueArray.filter(item => optionList.some(option => option === item)).join(',') + const tempValueArray = JSON.parse(JSON.stringify(this.element.options.value.split(this.separator))) + this.element.options.value = tempValueArray.filter(item => optionList.some(option => option === item)).join(this.separator) } } }, @@ -297,7 +298,7 @@ export default { method = linkMultFieldValues } method({ - fieldIds: this.element.options.attrs.fieldId.split(','), + fieldIds: this.element.options.attrs.fieldId.split(this.separator), sort: this.element.options.attrs.sort }).then(res => { this.data = this.optionData(res.data) @@ -321,7 +322,7 @@ export default { if (value === null) { this.element.options.value = '' } else { - this.element.options.value = Array.isArray(value) ? value.join() : value + this.element.options.value = Array.isArray(value) ? value.join(this.separator) : value } this.element.options.manualModify = false } else { @@ -364,16 +365,19 @@ export default { formatFilterValue() { if (this.value === null) return [] if (Array.isArray(this.value)) return this.value + if (!this.element.options.attrs.multiple) { + return [this.value] + } return this.value.split(',') }, fillValueDerfault() { const defaultV = this.element.options.value === null ? '' : this.element.options.value.toString() if (this.element.options.attrs.multiple) { if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '' || defaultV === '[object Object]') return [] - return defaultV.split(',') + return defaultV.split(this.separator) } else { if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '' || defaultV === '[object Object]') return null - return defaultV.split(',')[0] + return defaultV.split(this.separator)[0] } }, optionData(data) {