From 97414dc37a8bab7b119895ea380bcc072697e228 Mon Sep 17 00:00:00 2001 From: yaojn Date: Wed, 29 Oct 2025 15:25:02 +0800 Subject: [PATCH] =?UTF-8?q?-=20[=E5=8A=9F=E8=83=BD]=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E4=B8=8B=E6=8B=89=E7=BB=84=E4=BB=B6=E5=9B=9E=E8=BD=A6=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=80=BC=EF=BC=8C=E6=9C=AA=E8=BF=94=E5=9B=9E=E5=90=8E?= =?UTF-8?q?=E7=AB=AF=E7=9A=84=E5=80=BC=E4=B9=9F=E5=8F=AF=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E5=9B=9E=E6=98=BE=20=20=20=20-=20[=E5=85=B3=E8=81=94]#[1542683?= =?UTF-8?q?292565504]=E8=A1=A8=E5=8D=95=E4=B8=8B=E6=8B=89=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=9B=9E=E8=BD=A6=E6=96=B0=E5=A2=9E=E5=80=BC=EF=BC=8C?= =?UTF-8?q?=E6=9C=AA=E8=BF=94=E5=9B=9E=E5=90=8E=E7=AB=AF=E7=9A=84=E5=80=BC?= =?UTF-8?q?=E4=B9=9F=E5=8F=AF=E5=89=8D=E7=AB=AF=E5=9B=9E=E6=98=BE=20http:/?= =?UTF-8?q?/192.168.0.96:8090/demo/rdm.html#/story-detail/939050947543040/?= =?UTF-8?q?939050947543042/1542683292565504?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/resources/plugins/TsForm/TsFormSelect.vue | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/resources/plugins/TsForm/TsFormSelect.vue b/src/resources/plugins/TsForm/TsFormSelect.vue index c5fb7183..f31f86da 100755 --- a/src/resources/plugins/TsForm/TsFormSelect.vue +++ b/src/resources/plugins/TsForm/TsFormSelect.vue @@ -913,12 +913,27 @@ export default { let findSelect = selectedList.find(sel => sel[this.valueName] == item); findSelect && list.push(findSelect); }); + const tempList = this.handleEnterDisplayValue(); + if (tempList.length > 0) { + list.unshift(...tempList); + list = this.$utils.uniqueByField(list, this.valueName); + } + } else { + const tempList = this.handleEnterDisplayValue(); + if (tempList.length > 0) { + selectedList.unshift(...tempList); + selectedList = this.$utils.uniqueByField(selectedList, this.valueName); + } } this.selectedList = selectedList.length > 1 && !this.$utils.isEmpty(list) ? list : selectedList; this.handleEchoFailedDefaultValue(); } else { this.selectedList = []; this.handleEchoFailedDefaultValue(); + const tempList = this.handleEnterDisplayValue(); + if (tempList.length > 0) { + this.selectedList = this.$utils.uniqueByField(tempList, this.valueName); + } } if (!this.multiple) { @@ -932,6 +947,29 @@ export default { } }); }, + handleEnterDisplayValue() { + // 处理回车创建值回显问题 + let tempList = []; + if (this.allowCreate && !this.$utils.isEmpty(this.currentValue)) { + if (Array.isArray(this.currentValue)) { + this.currentValue.forEach(item => { + const findItem = this.selectedList.find(v => v[this.valueName] == item); + if (!findItem && !this.$utils.isEmpty(item)) { + tempList.unshift({ + [this.valueName]: item, + [this.textName]: item + }); + } + }); + } else { + tempList.unshift({ + [this.valueName]: this.currentValue, + [this.textName]: this.currentValue + }); + } + } + return tempList; + }, handleObjectValue(valueName) { if (!this.isCustomValue) { return this.currentValue == valueName; -- Gitee