From a4c6427d70afcf1b69a13e5a9557090b9d8742cc Mon Sep 17 00:00:00 2001 From: dengbf Date: Wed, 6 Mar 2024 15:05:46 +0800 Subject: [PATCH 1/7] =?UTF-8?q?-=20[=E5=8A=9F=E8=83=BD]=20=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E8=AE=BE=E7=BD=AE-=E8=A1=A8=E5=8D=95-=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E8=BE=93=E5=85=A5=E7=BB=84=E4=BB=B6-=E4=B8=8B?= =?UTF-8?q?=E6=8B=89=E6=A1=86=E7=B1=BB=E5=9E=8B=E7=9A=84=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=EF=BC=8C=E6=94=AF=E6=8C=81=E5=BC=95=E7=94=A8=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E8=A1=A8=E6=A0=BC=E8=BE=93=E5=85=A5=E7=BB=84=E4=BB=B6=E7=9A=84?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=20=20=20=20-=20[=E5=85=B3=E8=81=94]=20#[1105?= =?UTF-8?q?654155018240]=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE-=E8=A1=A8?= =?UTF-8?q?=E5=8D=95-=E8=A1=A8=E6=A0=BC=E8=BE=93=E5=85=A5=E7=BB=84?= =?UTF-8?q?=E4=BB=B6-=E4=B8=8B=E6=8B=89=E6=A1=86=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E7=9A=84=E5=B1=9E=E6=80=A7=EF=BC=8C=E6=94=AF=E6=8C=81=E5=BC=95?= =?UTF-8?q?=E7=94=A8=E5=85=B6=E4=BB=96=E8=A1=A8=E6=A0=BC=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E7=9A=84=E5=B1=9E=E6=80=A7=20http://192.168.?= =?UTF-8?q?0.96:8090/demo/rdm.html#/story-detail/939050947543040/939050947?= =?UTF-8?q?543042/1105654155018240?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/resources/plugins/TsSheet/form-item.vue | 6 +- .../TsSheet/form/component/formselect.vue | 20 +++ .../form/component/formtableinputer/index.vue | 8 ++ .../formtableinput-data-source.vue | 127 ++++++++++++++++++ .../formtableinputer-attr-config-dialog.vue | 31 ++++- .../config/formtableinputer-conf/index.vue | 1 + 6 files changed, 187 insertions(+), 6 deletions(-) create mode 100644 src/resources/plugins/TsSheet/form/config/formtableinputer-conf/formtableinput-data-source.vue diff --git a/src/resources/plugins/TsSheet/form-item.vue b/src/resources/plugins/TsSheet/form-item.vue index 9a2824ba..89af8ea3 100644 --- a/src/resources/plugins/TsSheet/form-item.vue +++ b/src/resources/plugins/TsSheet/form-item.vue @@ -285,7 +285,11 @@ export default { const formItemAttrUuid = uuidList[1] || 'value'; let dynamicVal = this.$utils.deepClone(this.formData[formItemUuid]); if (!Array.isArray(dynamicVal)) { - value = dynamicVal[formItemAttrUuid]; + if (!this.$utils.isEmpty(dynamicVal)) { + value = dynamicVal[formItemAttrUuid]; + } else { + value = null; + } } else { let list = []; dynamicVal.forEach(v => { diff --git a/src/resources/plugins/TsSheet/form/component/formselect.vue b/src/resources/plugins/TsSheet/form/component/formselect.vue index 91e12881..f6f8eb71 100644 --- a/src/resources/plugins/TsSheet/form/component/formselect.vue +++ b/src/resources/plugins/TsSheet/form/component/formselect.vue @@ -136,6 +136,26 @@ export default { params.hiddenFieldList = this.$utils.mapArray(this.config.hiddenFieldList, 'value'); } setting.params = params; + } else if (this.config.dataSource === 'formtableinputer') { + setting.dataList = []; + let list = []; + if (this.config.formtableinputerUuid && !this.$utils.isEmpty(this.formData) && !this.$utils.isEmpty(this.formData[this.config.formtableinputerUuid])) { + list = this.$utils.deepClone(this.formData[this.config.formtableinputerUuid]); + if (!this.$utils.isEmpty(list)) { + list.forEach(item => { + if (this.config.mapping && !this.$utils.isEmpty(item) && item[this.config.mapping.value]) { + let findValue = setting.dataList.find(d => d.value === item[this.config.mapping.value]); + if (!findValue) { + let obj = { + value: item[this.config.mapping.value], + text: item[this.config.mapping.text] + }; + setting.dataList.push(this.$utils.deepClone(obj)); + } + } + }); + } + } } else { setting.showName = 'text'; setting.dataList = this.validatedDataList; diff --git a/src/resources/plugins/TsSheet/form/component/formtableinputer/index.vue b/src/resources/plugins/TsSheet/form/component/formtableinputer/index.vue index 1a31c7f4..76caad00 100644 --- a/src/resources/plugins/TsSheet/form/component/formtableinputer/index.vue +++ b/src/resources/plugins/TsSheet/form/component/formtableinputer/index.vue @@ -254,6 +254,14 @@ export default { if (!config.mapping.text) { errorList.push({ field: 'dataConfig', error: this.$t('form.placeholder.pleaseselect', {'target': this.$t('term.framework.showtextfieldmapping')}) }); } + } else if (config.dataSource === 'formtableinputer') { + //选择表单输入组件 + let findItem = this.formItemList.find(item => item.uuid === config.formtableinputerUuid); + if (!findItem) { + this.$set(config, 'formtableinputerUuid', null); + this.$set(config, 'mapping', {}); + errorList.push({ field: 'dataConfig', error: '【' + element.label + '】' + this.$t('message.framework.datasourceselectmessage') }); + } } } else if (['formdate', 'formtime'].includes(element.handler)) { if (!config.format) { diff --git a/src/resources/plugins/TsSheet/form/config/formtableinputer-conf/formtableinput-data-source.vue b/src/resources/plugins/TsSheet/form/config/formtableinputer-conf/formtableinput-data-source.vue new file mode 100644 index 00000000..aadad386 --- /dev/null +++ b/src/resources/plugins/TsSheet/form/config/formtableinputer-conf/formtableinput-data-source.vue @@ -0,0 +1,127 @@ + + + diff --git a/src/resources/plugins/TsSheet/form/config/formtableinputer-conf/formtableinputer-attr-config-dialog.vue b/src/resources/plugins/TsSheet/form/config/formtableinputer-conf/formtableinputer-attr-config-dialog.vue index 2d18e04b..598465e3 100644 --- a/src/resources/plugins/TsSheet/form/config/formtableinputer-conf/formtableinputer-attr-config-dialog.vue +++ b/src/resources/plugins/TsSheet/form/config/formtableinputer-conf/formtableinputer-attr-config-dialog.vue @@ -35,7 +35,7 @@ ref="formitem_datasource" v-model="propertyLocal.config.dataSource" :validateList="validateList" - :dataList="dataSourceList" + :dataList="getDataSourceList(propertyLocal.handler)" transfer border="border" @on-change="(val)=>{ @@ -140,6 +140,14 @@ + @@ -308,7 +316,8 @@ export default { ConditionGroup: resolve => require(['@/resources/plugins/TsSheet/form/config/common/condition-group.vue'], resolve), TableConfig: resolve => require(['./formtableinputer-table-config.vue'], resolve), FormItem: resolve => require(['@/resources/plugins/TsSheet/form-item.vue'], resolve), - ReactionFilter: resolve => require(['@/resources/plugins/TsSheet/form/config/common/reaction-filter.vue'], resolve) + ReactionFilter: resolve => require(['@/resources/plugins/TsSheet/form/config/common/reaction-filter.vue'], resolve), + FormtableinputDataSource: resolve => require(['./formtableinput-data-source.vue'], resolve) }, props: { formItemConfig: { type: Object }, //表单组件配置 @@ -324,10 +333,10 @@ export default { formItemList: { //表格外部的组件 type: Array, default: () => [] - } + }, + formItemUuid: String }, data() { - const _this = this; return { propertyLocal: null, reactionName: { @@ -351,7 +360,8 @@ export default { }, dataSourceList: [ { value: 'static', text: this.$t('page.staticdatasource') }, - { value: 'matrix', text: this.$t('page.matrix') } + { value: 'matrix', text: this.$t('page.matrix') }, + { value: 'formtableinputer', text: this.$t('term.framework.formtableinputercomponent') } ], formConfig: [ { @@ -593,6 +603,8 @@ export default { }, changeDataSource() { this.$set(this.propertyLocal.config, 'matrixUuid', null); + this.$set(this.propertyLocal.config, 'formtableinputerUuid', null); + this.$set(this.propertyLocal.config, 'mapping', {}); this.$delete(this.propertyLocal.reaction, 'filter'); } }, @@ -687,6 +699,15 @@ export default { } }); return newList; + }, + getDataSourceList() { + return (handler) => { + let list = this.$utils.deepClone(this.dataSourceList); + if (handler && handler != 'formselect') { + list = list.filter(item => item.value != 'formtableinputer'); + } + return list; + }; } }, watch: { diff --git a/src/resources/plugins/TsSheet/form/config/formtableinputer-conf/index.vue b/src/resources/plugins/TsSheet/form/config/formtableinputer-conf/index.vue index 3c987e5d..a18484c6 100644 --- a/src/resources/plugins/TsSheet/form/config/formtableinputer-conf/index.vue +++ b/src/resources/plugins/TsSheet/form/config/formtableinputer-conf/index.vue @@ -107,6 +107,7 @@ :formItemConfig="config" :property="currentProperty" :formItemList="formItemList" + :formItemUuid="formItem.uuid" @close="closeAttrConfigDialog" > -- Gitee From e69b0b43cdf58fbea49eacbf9b5de68e5169015b Mon Sep 17 00:00:00 2001 From: dengbf Date: Wed, 6 Mar 2024 15:06:36 +0800 Subject: [PATCH 2/7] =?UTF-8?q?-=20[=E4=BF=AE=E5=A4=8D]=20=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/resources/plugins/TsForm/TsFormSelect.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resources/plugins/TsForm/TsFormSelect.vue b/src/resources/plugins/TsForm/TsFormSelect.vue index 0e61a934..f8bc5094 100755 --- a/src/resources/plugins/TsForm/TsFormSelect.vue +++ b/src/resources/plugins/TsForm/TsFormSelect.vue @@ -1515,7 +1515,7 @@ export default { if (this.multiple == true && typeof this.currentValue == 'string') { this.currentValue = [this.currentValue]; } else if (this.multiple == false && typeof this.currentValue == 'object') { - this.currentValue = this.currentValue[0] || null; + this.currentValue = this.currentValue && this.currentValue[0] || null; } this.searchKeyWord = ''; }, -- Gitee From 0d1e2e9df8e2d6a227a41dc9cdc60924bf99d82f Mon Sep 17 00:00:00 2001 From: dengbf Date: Wed, 6 Mar 2024 15:14:09 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/resources/assets/languages/message/en.json | 3 ++- src/resources/assets/languages/message/zh.json | 3 ++- src/resources/assets/languages/term/en.json | 4 +++- src/resources/assets/languages/term/zh.json | 4 +++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/resources/assets/languages/message/en.json b/src/resources/assets/languages/message/en.json index c45742c6..c2531397 100644 --- a/src/resources/assets/languages/message/en.json +++ b/src/resources/assets/languages/message/en.json @@ -215,7 +215,8 @@ "regularexpression": "regular expression", "regexvalidtip": "After the input verification fails, the user can re-enter according to this verification prompt", "regexvalidplaceholder": "The specific meaning of regular expressions, such as containing only numbers", - "validtip": "Verification prompt" + "validtip": "Verification prompt", + "datasourceselectmessage": "The data source has been deleted, please reconfigure the attribute data source" }, "dashboard": { "templatehelp": "The template needs to comply with the vue template syntax specification, and must specify a root tag, typically a div, that supports all iView components. The data source results are returned in the form of an array, and the root attribute is: dataList. When accessing data, please directly iterate over the dataList to obtain the required data.", diff --git a/src/resources/assets/languages/message/zh.json b/src/resources/assets/languages/message/zh.json index 24d18382..aa9f35f2 100644 --- a/src/resources/assets/languages/message/zh.json +++ b/src/resources/assets/languages/message/zh.json @@ -215,7 +215,8 @@ "regularexpression": "正则表达式", "regexvalidtip": "输入校验失败后,用户可根据此校验提示重新输入", "regexvalidplaceholder": "正则表达式具体含义,如:仅包含数字", - "validtip": "校验提示" + "validtip": "校验提示", + "datasourceselectmessage": "数据源已被删除,请重新配置属性数据源" }, "dashboard": { "templatehelp": "模板需要符合vue模板语法规范,必须指定一个根标签,一般是div,支持所有iView组件。数据源结果以数组的形式返回,根属性为:dataList,访问数据时请直接迭代dataList获取需要的数据。", diff --git a/src/resources/assets/languages/term/en.json b/src/resources/assets/languages/term/en.json index 0c4825cf..ba4767fe 100644 --- a/src/resources/assets/languages/term/en.json +++ b/src/resources/assets/languages/term/en.json @@ -1229,7 +1229,9 @@ "globalreadonly": "Global read-only", "globalreadonlytip": "The global read-only priority is higher than the internal read and write settings of the component. After turning on the global read-only switch, all components in the scene are in a read-only state", "iscannotdeletenode": "There are child nodes that cannot be deleted", - "requiredselectedtips": "If the current component is set as mandatory and only one option remains after filtering, the system will automatically select that option" + "requiredselectedtips": "If the current component is set as mandatory and only one option remains after filtering, the system will automatically select that option", + "formtableinputercomponent": "Table Input Component", + "tablecomponent": "Table component" }, "knowledge": { "document": "Document", diff --git a/src/resources/assets/languages/term/zh.json b/src/resources/assets/languages/term/zh.json index 1d1b9160..b68a7203 100644 --- a/src/resources/assets/languages/term/zh.json +++ b/src/resources/assets/languages/term/zh.json @@ -1228,7 +1228,9 @@ "globalreadonly": "全局只读", "globalreadonlytip": "全局只读优先级高于组件内部的读写设置,打开全局只读开关后,场景内所有组件均为只读状态", "iscannotdeletenode": "存在子节点不可删除", - "requiredselectedtips": "若当前组件设置为必填,且过滤后仅剩余一个选项,系统会自动选中该选项" + "requiredselectedtips": "若当前组件设置为必填,且过滤后仅剩余一个选项,系统会自动选中该选项", + "formtableinputercomponent": "表格输入组件", + "tablecomponent": "表格组件" }, "knowledge": { "document": "文档", -- Gitee From 667403d4c0df965571e06c7373af823666bd6675 Mon Sep 17 00:00:00 2001 From: dengbf Date: Wed, 6 Mar 2024 17:29:30 +0800 Subject: [PATCH 4/7] =?UTF-8?q?-=20[=E5=85=B3=E8=81=94]=20#[11063535719874?= =?UTF-8?q?56]ITSM=E6=95=B0=E6=8D=AE=E8=BD=AC=E6=8D=A2=E8=8A=82=E7=82=B9?= =?UTF-8?q?=EF=BC=8C=E6=96=B0=E5=A2=9E=E6=8B=BC=E6=8E=A5=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=20http://192.168.0.96:8090/demo/rdm.html#/story-detail/9390509?= =?UTF-8?q?47543040/939050947543042/1106353571987456?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../assets/languages/message/en.json | 2 +- .../assets/languages/message/zh.json | 2 +- .../TsSheet/form/component/formselect.vue | 19 +++++++++++++++++++ .../form/component/formtableinputer/index.vue | 17 ++++++++++++++++- .../formtableinputer-attr-config-dialog.vue | 2 +- 5 files changed, 38 insertions(+), 4 deletions(-) diff --git a/src/resources/assets/languages/message/en.json b/src/resources/assets/languages/message/en.json index c2531397..1c85ebba 100644 --- a/src/resources/assets/languages/message/en.json +++ b/src/resources/assets/languages/message/en.json @@ -216,7 +216,7 @@ "regexvalidtip": "After the input verification fails, the user can re-enter according to this verification prompt", "regexvalidplaceholder": "The specific meaning of regular expressions, such as containing only numbers", "validtip": "Verification prompt", - "datasourceselectmessage": "The data source has been deleted, please reconfigure the attribute data source" + "datasourceselectmessage": "The referenced table input component has been deleted. Please reconfigure the attribute data source" }, "dashboard": { "templatehelp": "The template needs to comply with the vue template syntax specification, and must specify a root tag, typically a div, that supports all iView components. The data source results are returned in the form of an array, and the root attribute is: dataList. When accessing data, please directly iterate over the dataList to obtain the required data.", diff --git a/src/resources/assets/languages/message/zh.json b/src/resources/assets/languages/message/zh.json index aa9f35f2..b1065476 100644 --- a/src/resources/assets/languages/message/zh.json +++ b/src/resources/assets/languages/message/zh.json @@ -216,7 +216,7 @@ "regexvalidtip": "输入校验失败后,用户可根据此校验提示重新输入", "regexvalidplaceholder": "正则表达式具体含义,如:仅包含数字", "validtip": "校验提示", - "datasourceselectmessage": "数据源已被删除,请重新配置属性数据源" + "datasourceselectmessage": "引用的表格输入组件已被删除,请重新配置属性数据源" }, "dashboard": { "templatehelp": "模板需要符合vue模板语法规范,必须指定一个根标签,一般是div,支持所有iView组件。数据源结果以数组的形式返回,根属性为:dataList,访问数据时请直接迭代dataList获取需要的数据。", diff --git a/src/resources/plugins/TsSheet/form/component/formselect.vue b/src/resources/plugins/TsSheet/form/component/formselect.vue index f6f8eb71..52fb1b02 100644 --- a/src/resources/plugins/TsSheet/form/component/formselect.vue +++ b/src/resources/plugins/TsSheet/form/component/formselect.vue @@ -156,6 +156,25 @@ export default { }); } } + if (!this.$utils.isEmpty(this.value)) { + if (this.$utils.isEmpty(setting.dataList)) { + this.setValue(null); + } else { + let newValue = null; + if (Array.isArray(this.value)) { + newValue = this.value.filter(v => { + return setting.dataList.find(d => d.value === v.value); + }); + if (!this.$utils.isSame(this.value, newValue)) { + this.setValue(newValue); + } + } else { + if (!setting.dataList.find(d => d.value === this.value.value)) { + this.setValue(null); + } + } + } + } } else { setting.showName = 'text'; setting.dataList = this.validatedDataList; diff --git a/src/resources/plugins/TsSheet/form/component/formtableinputer/index.vue b/src/resources/plugins/TsSheet/form/component/formtableinputer/index.vue index 76caad00..e8cdf722 100644 --- a/src/resources/plugins/TsSheet/form/component/formtableinputer/index.vue +++ b/src/resources/plugins/TsSheet/form/component/formtableinputer/index.vue @@ -260,7 +260,22 @@ export default { if (!findItem) { this.$set(config, 'formtableinputerUuid', null); this.$set(config, 'mapping', {}); - errorList.push({ field: 'dataConfig', error: '【' + element.label + '】' + this.$t('message.framework.datasourceselectmessage') }); + errorList.push({ field: 'dataConfig', error: '【' + element.label + '】' + this.$t('message.framework.datasourceselectmessage')}); + } else { + if (findItem.config && findItem.config.dataConfig) { + let isValidMapping = true; + if (!findItem.config.dataConfig.find(d => d.uuid === config.mapping.value)) { + this.$set(config.mapping, 'value', null); + isValidMapping = false; + } + if (!findItem.config.dataConfig.find(d => d.uuid === config.mapping.text)) { + this.$set(config.mapping, 'text', null); + isValidMapping = false; + } + if (!isValidMapping) { + errorList.push({ field: 'dataConfig', error: '【' + element.label + '】' + this.$t('form.placeholder.pleaseselect', {'target': this.$t('page.fieldmapping')}) }); + } + } } } } else if (['formdate', 'formtime'].includes(element.handler)) { diff --git a/src/resources/plugins/TsSheet/form/config/formtableinputer-conf/formtableinputer-attr-config-dialog.vue b/src/resources/plugins/TsSheet/form/config/formtableinputer-conf/formtableinputer-attr-config-dialog.vue index 598465e3..5797e8d2 100644 --- a/src/resources/plugins/TsSheet/form/config/formtableinputer-conf/formtableinputer-attr-config-dialog.vue +++ b/src/resources/plugins/TsSheet/form/config/formtableinputer-conf/formtableinputer-attr-config-dialog.vue @@ -726,7 +726,7 @@ export default { }, 'propertyLocal.config.dataSource': { handler: function(val) { - if (val === 'matrix') { + if (val === 'matrix' || val === 'formtableinputer') { if (!this.propertyLocal.config.mapping) { this.$set(this.propertyLocal.config, 'mapping', {}); } -- Gitee From 8d128841241fa9bcb53cf7d9a3dccd1cd0e66f59 Mon Sep 17 00:00:00 2001 From: dengbf Date: Thu, 7 Mar 2024 12:06:55 +0800 Subject: [PATCH 5/7] =?UTF-8?q?-=20[=E4=BF=AE=E5=A4=8D]=20=E7=9F=A9?= =?UTF-8?q?=E9=98=B5=E4=B8=8B=E6=8B=89=E6=A1=86=E6=94=B9=E5=8F=98=E6=97=B6?= =?UTF-8?q?=E6=B8=85=E7=A9=BA=E4=B9=8B=E5=89=8D=E7=9A=84=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugins/TsSheet/form/config/formselect-conf.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/resources/plugins/TsSheet/form/config/formselect-conf.vue b/src/resources/plugins/TsSheet/form/config/formselect-conf.vue index 2b188445..5cd106ad 100644 --- a/src/resources/plugins/TsSheet/form/config/formselect-conf.vue +++ b/src/resources/plugins/TsSheet/form/config/formselect-conf.vue @@ -56,7 +56,7 @@ -