diff --git a/src/resources/plugins/TsSheet/TsSheet.vue b/src/resources/plugins/TsSheet/TsSheet.vue
index 0935d65686ea805b6c20fa34a963a1162abae9fe..4068f56712f32215fa42cdf2f0ba7021cf9cee67 100644
--- a/src/resources/plugins/TsSheet/TsSheet.vue
+++ b/src/resources/plugins/TsSheet/TsSheet.vue
@@ -316,6 +316,7 @@
:formExtendData="formExtendData"
:isClearSpecifiedAttr="isClearSpecifiedAttr"
:externalData="externalData"
+ :extendConfigList="extendConfigList"
:rowUuid="rowUuid"
class="padding-xs"
@changeConfig="addHistory()"
@@ -517,7 +518,12 @@ export default {
type: Object,
default: () => {}
},
- rowUuid: String //表单子组件行uuid
+ rowUuid: String, //表单子组件行uuid
+ defaultExtendConfigList: {
+ // 扩展配置列表
+ type: Array,
+ default: () => []
+ }
},
data() {
return {
@@ -561,7 +567,8 @@ export default {
currentEventItem: null, //当前单元格获取的新组件
actionType: '', //当前操作类型,'add'新增组件,'copy'复制组件
windowKeypressHandler: null, // 用于存储事件处理函数的引用
- formStyleData: {} //表单样式设置
+ formStyleData: {}, //表单样式设置
+ extendConfigList: this.defaultExtendConfigList || [] //扩展配置列表
};
},
beforeCreate() {
@@ -702,6 +709,9 @@ export default {
//初始化表格
initSheet() {
this.hideComponentList = this.value?.hideComponentList || [];
+ if (this.value && this.value.formCustomExtendConfig && !this.$utils.isEmpty(this.value.formCustomExtendConfig.extendConfigList)) {
+ this.extendConfigList = this.value.formCustomExtendConfig.extendConfigList;
+ }
if (this.value && this.value.lefterList && this.value.headerList && this.value.tableList) {
/**
* 编辑模式下,直接将外部数据赋值给config,这样在外部对数据做了修改,也能触发表格控件发生变化。
diff --git a/src/resources/plugins/TsSheet/form-edit.vue b/src/resources/plugins/TsSheet/form-edit.vue
index 1947328399070d8707dc6a5a98f54d06716df2e5..c1df61859ade569de6286614ad00175210916281 100644
--- a/src/resources/plugins/TsSheet/form-edit.vue
+++ b/src/resources/plugins/TsSheet/form-edit.vue
@@ -148,10 +148,15 @@
-
+
-
+
@@ -259,6 +264,7 @@
ref="sheet"
v-model="formData.formConfig"
:readonly="readOnly"
+ :defaultExtendConfigList="extendConfigList"
@selectCell="selectCell"
@removeComponent="removeComponent"
@updateResize="updateResize"
@@ -269,6 +275,7 @@
:formItem="currentFormItem"
:formItemList="cellFormItemList"
:error="currentFormItemError"
+ :extendConfigList="extendConfigList"
class="form-item-config bg-grey border-base-left"
@close="currentFormItem = null"
@editSubForm="editSubForm"
@@ -413,7 +420,8 @@ export default {
readOnly: false, //设置全局只读
isShowExtendConfigDialog: false,
extendConfigList: [],
- processTaskId: null //工单id
+ processTaskId: null, //工单id
+ isSaving: false
};
},
beforeCreate() {},
@@ -639,7 +647,7 @@ export default {
extendConfigList: this.extendConfigList
});
this.$set(data, 'formConfig', formConfig);
-
+ this.isSaving = true;
await this.$api.framework.form.saveForm(data).then(res => {
if (res.Status == 'OK') {
isSuccess = true;
@@ -679,6 +687,8 @@ export default {
});
}
}
+ }).finally(() => {
+ this.isSaving = false;
});
} else if (!this.$utils.isEmpty(this.errorData)) {
this.isShowValidList = true;
@@ -687,8 +697,11 @@ export default {
},
previewForm() {
const sheet = this.$refs['sheet'];
- const data = sheet.getFormConfig();
+ let data = sheet.getFormConfig();
this.$set(data, 'readOnly', this.readOnly);
+ this.$set(data, 'formCustomExtendConfig', {
+ extendConfigList: this.extendConfigList
+ });
this.previewFormData = data;
this.isPreviewShow = true;
},
diff --git a/src/resources/plugins/TsSheet/form-item-config.vue b/src/resources/plugins/TsSheet/form-item-config.vue
index 4ca9df69bcb45156ab14eaf1fc2588692ed3c8a5..fb7ee04c03bf23b6f7f9e7ffc8ed3aebd059e5d9 100644
--- a/src/resources/plugins/TsSheet/form-item-config.vue
+++ b/src/resources/plugins/TsSheet/form-item-config.vue
@@ -30,6 +30,7 @@
:disabled="!!formItem.inherit || disabled"
:initFormItemList="initFormItemList"
:source="source"
+ :extendConfigList="extendConfigList"
class="mb-sm"
@editSubForm="editSubForm"
@setValue="(value)=> updateComponentConfig(formItem.handler, value)"
@@ -125,7 +126,11 @@ export default {
type: Array,
default: () => []
},
- source: { type: String, default: '' } //表单组件配置来源:scene(场景)
+ source: { type: String, default: '' }, //表单组件配置来源:scene(场景)
+ extendConfigList: { //扩展的表单组件列表
+ type: Array,
+ default: () => []
+ }
},
data() {
const _this = this;
diff --git a/src/resources/plugins/TsSheet/form-item.vue b/src/resources/plugins/TsSheet/form-item.vue
index a6c31869a62f94cb861139c67915dcd7912e4022..f76674e0c5644f71134a93337e2ea6983c6aa9b7 100644
--- a/src/resources/plugins/TsSheet/form-item.vue
+++ b/src/resources/plugins/TsSheet/form-item.vue
@@ -71,6 +71,7 @@
:isClearSpecifiedAttr="isClearSpecifiedAttr"
:externalData="externalData"
:rowUuid="rowUuid"
+ :extendConfigList="extendConfigList"
@setValue="setValue"
@resize="$emit('resize')"
@select="selectFormItem"
@@ -200,7 +201,11 @@ export default {
type: Object,
default: () => {}
},
- rowUuid: { type: String } //行uuid,表格组件引用时需要
+ rowUuid: { type: String }, //行uuid,表格组件引用时需要
+ extendConfigList: {
+ type: Array,
+ default: () => []
+ }
},
data() {
return {
diff --git a/src/resources/plugins/TsSheet/form/component/base.vue b/src/resources/plugins/TsSheet/form/component/base.vue
index 115ebbd6ba5731f3a017973cf62f8299c3e5362b..b203d8ddccebf53ba7affb12927db1c8731368a5 100644
--- a/src/resources/plugins/TsSheet/form/component/base.vue
+++ b/src/resources/plugins/TsSheet/form/component/base.vue
@@ -33,6 +33,11 @@ export default {
// 外部数据,非表单数据,例如工单上报人数据等
type: Object,
default: () => {}
+ },
+ extendConfigList: {
+ // 扩展配置列表
+ type: Array,
+ default: () => []
}
},
data() {
diff --git a/src/resources/plugins/TsSheet/form/component/common/validate-mixin.js b/src/resources/plugins/TsSheet/form/component/common/validate-mixin.js
index e2ffe36f323229e4ce8a7e6b3c0e7a28d7ce826d..a2590e4208014b547ddaf95317716dcaa9b39bc4 100644
--- a/src/resources/plugins/TsSheet/form/component/common/validate-mixin.js
+++ b/src/resources/plugins/TsSheet/form/component/common/validate-mixin.js
@@ -68,6 +68,16 @@ export default {
}
}
}
+ } else if (this.config.dataSource === 'tag') {
+ if (!this.config.tagKey) {
+ errorList.push({field: 'tagKey', error: $t('form.placeholder.pleaseselect', {'target': $t('page.tag')})});
+ }
+ if (!this.config.tableKey) {
+ errorList.push({field: 'tableKey', error: $t('form.placeholder.pleaseselect', {'target': $t('term.framework.tablecomponent')})});
+ }
+ if (!this.config.mapping.value || !this.config.mapping.text) {
+ errorList.push({field: 'mapping', error: $t('form.placeholder.pleaseselect', {'target': $t('page.fieldmapping')})});
+ }
}
return errorList;
}
diff --git a/src/resources/plugins/TsSheet/form/component/formselect.vue b/src/resources/plugins/TsSheet/form/component/formselect.vue
index 4483ff69513005696ac68e7d123659f4a5471e31..e65a1c6c5351f24d186e2286e5d3c7517a4262e4 100644
--- a/src/resources/plugins/TsSheet/form/component/formselect.vue
+++ b/src/resources/plugins/TsSheet/form/component/formselect.vue
@@ -102,6 +102,66 @@ export default {
} else {
return value;
}
+ },
+ getFormData(formData) {
+ const formItemList = [];
+ for (let key in formData) {
+ const formitem = this.formItemList.find(d => d.uuid === key);
+ if (formitem) {
+ formItemList.push({
+ attributeUuid: key,
+ key: formitem.key,
+ handler: formitem.handler,
+ dataList: formData[key]
+ });
+ }
+ }
+ return formItemList;
+ },
+ getFormCustomexend(formData) { // 自定义扩展
+ let list = [];
+ let currentData = this.getFormData(formData);
+ if (!this.$utils.isEmpty(this.extendConfigList)) {
+ this.extendConfigList.forEach(item => {
+ this.$ = {};
+ try {
+ if (item.extendMethods) {
+ // eslint-disable-next-line no-eval
+ const dataMethods = eval('(' + item.extendMethods + ')');
+ Object.keys(dataMethods).forEach(methodsName => {
+ if (typeof dataMethods[methodsName] === 'function' && !this.$.methodsName) {
+ this.$[methodsName] = dataMethods[methodsName].bind(this);
+ }
+ });
+ if (currentData) {
+ let outinpuData = this.$.main(item.attributeList, currentData);
+ list.push(...outinpuData);
+ }
+ }
+ } catch (e) {
+ console.error(e);
+ }
+ });
+ }
+ return list;
+ },
+ getTagDataList(formData) { //自定义标签扩展数据值
+ let list = this.getFormCustomexend(formData);
+ let dataList = [];
+ if (!this.$utils.isEmpty(list)) {
+ let findItem = list.find(item => item.tag === this.config.tagKey && item.key === this.config.tableKey);
+ if (findItem) {
+ findItem.dataList.forEach(item => {
+ if (item[this.config.mapping.value] && !dataList.find(d => d.value === item[this.config.mapping.value])) {
+ dataList.push({
+ value: item[this.config.mapping.value],
+ text: item[this.config.mapping.text]
+ });
+ }
+ });
+ }
+ }
+ return dataList;
}
},
filter: {},
@@ -231,6 +291,8 @@ export default {
}
}
}
+ } else if (this.config.dataSource === 'tag') {
+ setting.dataList = this.getTagDataList(this.formData);
} 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 6d9cc571e4990f4bcff34cb29ea989bf789adced..50bd6d0f2f69451aa330d3428f53537aed71a139 100644
--- a/src/resources/plugins/TsSheet/form/component/formtableinputer/index.vue
+++ b/src/resources/plugins/TsSheet/form/component/formtableinputer/index.vue
@@ -84,6 +84,7 @@
:isClearSpecifiedAttr="isClearSpecifiedAttr"
:externalData="externalData"
:rowUuid="row.uuid"
+ :extendConfigList="extendConfigList"
style="min-width: 130px"
@change="val => changeRow(val, extra.uuid, row)"
@updateCurrentRow="
diff --git a/src/resources/plugins/TsSheet/form/config/base-config.vue b/src/resources/plugins/TsSheet/form/config/base-config.vue
index 868e148ac450fae6f96495eefc3d6bd79ef2a487..46fb5b7e573ce55222ccaecb058ab339847c9f23 100644
--- a/src/resources/plugins/TsSheet/form/config/base-config.vue
+++ b/src/resources/plugins/TsSheet/form/config/base-config.vue
@@ -9,7 +9,11 @@ export default {
type: Array,
default: () => []
},
- source: { type: String, default: '' } //表单组件配置来源:scene(场景)
+ source: { type: String, default: '' }, //表单组件配置来源:scene(场景)
+ extendConfigList: { //扩展数据标签配置列表
+ type: Array,
+ default: () => []
+ }
},
methods: {
//设置属性值
diff --git a/src/resources/plugins/TsSheet/form/config/common/tag-source-setting.vue b/src/resources/plugins/TsSheet/form/config/common/tag-source-setting.vue
new file mode 100644
index 0000000000000000000000000000000000000000..aa8f4e114511fd8083b93f483658b776946b8f3d
--- /dev/null
+++ b/src/resources/plugins/TsSheet/form/config/common/tag-source-setting.vue
@@ -0,0 +1,189 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/resources/plugins/TsSheet/form/config/formselect-conf.vue b/src/resources/plugins/TsSheet/form/config/formselect-conf.vue
index eaac3a7132525b9ed03eb68a914de11cdb1c1897..b8a3da7e469a3baa5d7e9ecb73c5510dbcc7d340 100644
--- a/src/resources/plugins/TsSheet/form/config/formselect-conf.vue
+++ b/src/resources/plugins/TsSheet/form/config/formselect-conf.vue
@@ -161,6 +161,15 @@
>
+
+
+