From 22b0871446fbdb5734522e686bcf9eab254eec74 Mon Sep 17 00:00:00 2001 From: yaojn Date: Tue, 7 Nov 2023 14:43:32 +0800 Subject: [PATCH] =?UTF-8?q?-=20[=E4=BF=AE=E5=A4=8D]form=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=98=A0=E5=B0=84=EF=BC=8C=E9=9D=99=E6=80=81?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=BA=90=E6=97=B6=E5=8E=BB=E6=8E=89=E5=80=BC?= =?UTF-8?q?=E5=BF=85=E9=A1=BB=E6=98=AF=E8=8B=B1=E6=96=87=E7=9A=84=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=20-=20[=E4=BF=AE=E5=A4=8D]=E5=AF=BC=E5=85=A5=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=97=B6=EF=BC=8C=E4=BB=8E=E5=A4=96=E9=83=A8=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E4=BC=A0=E9=80=92=E8=BF=9B=E6=9D=A5=E7=9A=84dataList?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=9B=9E=E6=98=BE=E6=9C=89=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20-=20[=E4=BF=AE=E5=A4=8D]=E5=AF=BC=E5=85=A5=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E5=92=8C=E5=AF=BC=E5=87=BA=E8=A1=A8=E6=A0=BC=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=E8=A1=A8=E6=A0=BC=E8=BE=93=E5=85=A5=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=E5=AF=BC=E5=85=A5=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugins/TsForm/TsFormCheckbox.vue | 22 +++++++++------- src/resources/plugins/TsForm/TsFormRadio.vue | 18 +++++++------ src/resources/plugins/TsForm/TsFormSelect.vue | 26 ++++++++++--------- .../form/component/formtableinputer/index.vue | 23 +++++++++++----- .../form/config/common/static-data-editor.vue | 2 +- 5 files changed, 54 insertions(+), 37 deletions(-) diff --git a/src/resources/plugins/TsForm/TsFormCheckbox.vue b/src/resources/plugins/TsForm/TsFormCheckbox.vue index 674f592e..f74a3d08 100755 --- a/src/resources/plugins/TsForm/TsFormCheckbox.vue +++ b/src/resources/plugins/TsForm/TsFormCheckbox.vue @@ -170,16 +170,18 @@ export default { }, handleEchoFailedDefaultValue() { // 处理回显失败默认值,回显失败清空默认值 - let selectedList = []; - let valueList = this.currentValue instanceof Array ? this.currentValue : [this.currentValue]; - valueList.forEach((item, index) => { - if (item && !this.nodeList.find((n) => n[this.valueName] == item)) { - selectedList.push(item[this.valueName]); - this.currentValue.splice(index, 1); + if (this.isClearEchoFailedDefaultValue && !this.$utils.isEmpty(this.nodeList)) { + let selectedList = []; + let valueList = this.currentValue instanceof Array ? this.currentValue : [this.currentValue]; + valueList.forEach((item, index) => { + if (item && !this.nodeList.find((n) => n[this.valueName] == item)) { + selectedList.push(item[this.valueName]); + this.currentValue.splice(index, 1); + } + }); + if (!this.$utils.isEmpty(selectedList)) { + this.onChangeValue(); } - }); - if (!this.$utils.isEmpty(selectedList) && this.isClearEchoFailedDefaultValue) { - this.onChangeValue(); } }, onChangeValue(val, item) { @@ -235,9 +237,9 @@ export default { } else { _this.$emit('change-label', []); } + _this.handleEchoFailedDefaultValue(); }, 100); } - this.handleEchoFailedDefaultValue(); } }, computed: { diff --git a/src/resources/plugins/TsForm/TsFormRadio.vue b/src/resources/plugins/TsForm/TsFormRadio.vue index 4584d58c..da570a86 100755 --- a/src/resources/plugins/TsForm/TsFormRadio.vue +++ b/src/resources/plugins/TsForm/TsFormRadio.vue @@ -175,15 +175,17 @@ export default { }, handleEchoFailedDefaultValue() { // 处理回显失败默认值,回显失败清空默认值 - let selectedList = []; - if (this.currentValue) { - let selectedItem = this.nodeList.find((item) => item[this.valueName] == this.currentValue); - if (!selectedItem) { - this.currentValue = null; + if (this.isClearEchoFailedDefaultValue && !this.$utils.isEmpty(this.nodeList)) { + let selectedList = []; + if (this.currentValue) { + let selectedItem = this.nodeList.find((item) => item[this.valueName] == this.currentValue); + if (!selectedItem) { + this.currentValue = null; + } + } + if (!this.$utils.isEmpty(selectedList)) { + this.onChangeValue(); } - } - if (!this.$utils.isEmpty(selectedList) && this.isClearEchoFailedDefaultValue) { - this.onChangeValue(); } }, onChangeValue() { diff --git a/src/resources/plugins/TsForm/TsFormSelect.vue b/src/resources/plugins/TsForm/TsFormSelect.vue index 5e6222ab..c39c00d2 100755 --- a/src/resources/plugins/TsForm/TsFormSelect.vue +++ b/src/resources/plugins/TsForm/TsFormSelect.vue @@ -919,20 +919,22 @@ export default { }, handleEchoFailedDefaultValue() { // 处理回显失败默认值,回显失败清空默认值 - let selectedList = []; - let valueList = this.multiple ? this.currentValue : this.currentValue instanceof Array ? this.currentValue : [this.currentValue]; - valueList.forEach((item, index) => { - if (item && !this.selectedList.find((n) => n[this.valueName] == item)) { - selectedList.push(item[this.valueName]); - if (this.currentValue instanceof Array) { - this.currentValue.splice(index, 1); - } else if (this.currentValue) { - this.currentValue = null; + if (this.isClearEchoFailedDefaultValue && !this.$utils.isEmpty(this.selectedList)) { + let selectedList = []; + let valueList = this.multiple ? this.currentValue : this.currentValue instanceof Array ? this.currentValue : [this.currentValue]; + valueList.forEach((item, index) => { + if (item && !this.selectedList.find((n) => n[this.valueName] == item)) { + selectedList.push(item[this.valueName]); + if (this.currentValue instanceof Array) { + this.currentValue.splice(index, 1); + } else if (this.currentValue) { + this.currentValue = null; + } } + }); + if (!this.$utils.isEmpty(selectedList)) { + this.onChangeValue(); } - }); - if (!this.$utils.isEmpty(selectedList) && this.isClearEchoFailedDefaultValue) { - this.onChangeValue(); } }, dynamicSearch(query, isFirst) { diff --git a/src/resources/plugins/TsSheet/form/component/formtableinputer/index.vue b/src/resources/plugins/TsSheet/form/component/formtableinputer/index.vue index ab02664e..0b9cd2b4 100644 --- a/src/resources/plugins/TsSheet/form/component/formtableinputer/index.vue +++ b/src/resources/plugins/TsSheet/form/component/formtableinputer/index.vue @@ -4,7 +4,7 @@
-
+
{{ $t('term.pbc.exporttemplate') }} @@ -292,7 +292,7 @@ export default { let theadUuidList = []; this.tableData.theadList.forEach((item) => { if (item?.key && item?.title) { - if (item.key != 'number') { + if (item.key != 'number' && !this.handleExcludeTable(item.key)) { // 序号是否需要显示 theadList.push({ header: item.title, @@ -364,7 +364,7 @@ export default { let theadUuidList = []; // 获取所有表头的uuid列表 this.tableData.theadList.forEach((item) => { if (item?.key && item?.title) { - if (item.key != 'number') { + if (item.key != 'number' && !this.handleExcludeTable(item.key)) { columnsList.push({ header: item.title, key: item.key, @@ -399,12 +399,15 @@ export default { let selectedItem = this.extraList.find((extraItem) => extraItem.uuid == key); let {config = {}, handler = ''} = selectedItem || {}; let {dataSource = '', isMultiple = false} = config; - if (dataSource == 'matrix' && isMultiple) { + console.log('handler', handler); + if (handler == 'formtable') { + this.$set(item, [key], null); + } else if (dataSource == 'matrix' && (isMultiple || handler == 'formradio')) { // 矩阵数据源并且是多选,需要处理值去掉&=& this.$set(item, [key], this.handleSpecialValue(item[key])); } else if (dataSource == 'static' && (isMultiple || handler == 'formcheckbox')) { // 静态数据源并且是多选 - this.$set(item, [key], item[key].join(',')); + this.$set(item, [key], item[key]?.join(',')); } } } @@ -458,6 +461,14 @@ export default { const formatObj = foundItem ? { numFmt: '@' } : {}; return formatObj; }, + handleExcludeTable(uuid) { + // 处理排除表格输入组件 + let componentsList = ['formtable']; + const foundItem = this.extraList.find((item) => { + return item.uuid && item.uuid === uuid && componentsList.includes(item.handler); + }); + return foundItem; + }, convertToExcelColumn(number) { // 将数字转化成A-Z的值 let result = ''; @@ -548,7 +559,7 @@ export default { let {config = {}, handler = ''} = selectedItem || {}; if (value) { let {dataSource = '', isMultiple = false} = config || {}; - if (dataSource === 'matrix' && isMultiple) { + if (dataSource === 'matrix' && (isMultiple || handler == 'formradio')) { // 矩阵 resultValue = []; let valueList = []; diff --git a/src/resources/plugins/TsSheet/form/config/common/static-data-editor.vue b/src/resources/plugins/TsSheet/form/config/common/static-data-editor.vue index 9fb5fc0a..a5bb0b7d 100644 --- a/src/resources/plugins/TsSheet/form/config/common/static-data-editor.vue +++ b/src/resources/plugins/TsSheet/form/config/common/static-data-editor.vue @@ -19,7 +19,7 @@