diff --git a/io.sc.platform.core.frontend/src/platform/components/grid/Th.vue b/io.sc.platform.core.frontend/src/platform/components/grid/Th.vue
new file mode 100644
index 00000000..5d78352d
--- /dev/null
+++ b/io.sc.platform.core.frontend/src/platform/components/grid/Th.vue
@@ -0,0 +1,219 @@
+
+
+
+
+
+
+
+
diff --git a/io.sc.platform.core.frontend/src/platform/components/select/WDictionarySelect.vue b/io.sc.platform.core.frontend/src/platform/components/select/WDictionarySelect.vue
new file mode 100644
index 00000000..47e7ab5b
--- /dev/null
+++ b/io.sc.platform.core.frontend/src/platform/components/select/WDictionarySelect.vue
@@ -0,0 +1,200 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/io.sc.platform.lcdp.frontend/src/views/form/ViewDialog.vue b/io.sc.platform.lcdp.frontend/src/views/form/ViewDialog.vue
new file mode 100644
index 00000000..67c81a08
--- /dev/null
+++ b/io.sc.platform.lcdp.frontend/src/views/form/ViewDialog.vue
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
diff --git a/io.sc.platform.lcdp.frontend/src/views/form/components/GridToolbar.ts b/io.sc.platform.lcdp.frontend/src/views/form/components/GridToolbar.ts
new file mode 100644
index 00000000..d1d036aa
--- /dev/null
+++ b/io.sc.platform.lcdp.frontend/src/views/form/components/GridToolbar.ts
@@ -0,0 +1,44 @@
+export class GridToolbar {
+ static type = {
+ separator: { label: '分割符', value: 'separator' },
+ query: { label: '查询', value: 'query' },
+ reset: { label: '重置', value: 'reset' },
+ refresh: { label: '刷新', value: 'refresh' },
+ add: { label: '新增', value: 'add' },
+ edit: { label: '编辑', value: 'edit' },
+ clone: { label: '复制', value: 'clone' },
+ remove: { label: '删除', value: 'remove' },
+ view: { label: '查看', value: 'view' },
+ export: { label: '导出', value: 'export' },
+ addTop: { label: '新增顶级节点', value: 'addTop' },
+ addChild: { label: '新增子节点', value: 'addChild' },
+ expand: { label: '展开/收起所有', value: 'expand' },
+ config: { label: '表格设置', value: 'config' },
+ };
+
+ /**
+ * 所有按钮集合
+ */
+ static options: Array = Object.values(this.type);
+ /**
+ * 排除分割符后的操作型按钮集合
+ */
+ static operatorOptions: Array = Object.values(this.type).filter((item) => item.value !== this.type.separator.value);
+ /**
+ * 字段来源为数据库表的默认按钮集合
+ */
+ static tableDefaultOptions: Array = [
+ this.type.query.value,
+ this.type.reset.value,
+ this.type.separator.value,
+ this.type.add.value,
+ this.type.edit.value,
+ this.type.clone.value,
+ this.type.remove.value,
+ this.type.config.value,
+ ];
+ /**
+ * 字段来源为SQL的默认按钮集合
+ */
+ static sqlDefaultOptions: Array = [this.type.query.value, this.type.reset.value, this.type.config.value];
+}
diff --git a/io.sc.platform.lcdp.frontend/src/views/form/components/GridToolbarSelect.vue b/io.sc.platform.lcdp.frontend/src/views/form/components/GridToolbarSelect.vue
new file mode 100644
index 00000000..f91e366d
--- /dev/null
+++ b/io.sc.platform.lcdp.frontend/src/views/form/components/GridToolbarSelect.vue
@@ -0,0 +1,256 @@
+
+
+
+
+
+
+ {
+ dialogRef.show();
+ nextTick(() => {
+ if (modelValue && modelValue.length > 0) {
+ const rows = [];
+ modelValue.forEach((item) => {
+ rows.push(GridToolbar.type[item]);
+ });
+ gridRef.setLocalData(rows);
+ }
+ });
+ }
+ "
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/io.sc.platform.lcdp.frontend/src/views/form/grid/ColumnTitleConfig.vue b/io.sc.platform.lcdp.frontend/src/views/form/grid/ColumnTitleConfig.vue
new file mode 100644
index 00000000..82ab7f23
--- /dev/null
+++ b/io.sc.platform.lcdp.frontend/src/views/form/grid/ColumnTitleConfig.vue
@@ -0,0 +1,427 @@
+
+
+
+
+
+
+ {
+ const fields = getFields();
+ if (fields.length > 0) {
+ dialogRef.show();
+ nextTick(() => {
+ if (modelValue && modelValue.length > 0) {
+ const rows = [];
+ modelValue.forEach((item) => {
+ rows.push({ name: item['name'], label: item['label'], children: toRaw(item['columns']), isGroup: item['isGroup'] });
+ });
+ gridRef.setLocalData(rows);
+ }
+ });
+ } else {
+ NotifyManager.warn('字段列表为空,无法进行多表头配置');
+ }
+ }
+ "
+ >
+
+ {
+ const row = args.grid.getSelectedRow();
+ if (row && row['isGroup']) {
+ // 将表单状态改为新增子节点
+ args.grid.getEditorForm().setStatus('addChild');
+ }
+ }
+ "
+ >
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/io.sc.platform.lcdp.frontend/src/views/form/grid/Dialog.vue b/io.sc.platform.lcdp.frontend/src/views/form/grid/Dialog.vue
new file mode 100644
index 00000000..4af53a65
--- /dev/null
+++ b/io.sc.platform.lcdp.frontend/src/views/form/grid/Dialog.vue
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/io.sc.platform.lcdp.frontend/src/views/form/grid/FieldEditDialog.vue b/io.sc.platform.lcdp.frontend/src/views/form/grid/FieldEditDialog.vue
new file mode 100644
index 00000000..efee187f
--- /dev/null
+++ b/io.sc.platform.lcdp.frontend/src/views/form/grid/FieldEditDialog.vue
@@ -0,0 +1,318 @@
+
+
+
+
+
+
+
+
diff --git a/io.sc.platform.lcdp.frontend/src/views/form/grid/Form.vue b/io.sc.platform.lcdp.frontend/src/views/form/grid/Form.vue
new file mode 100644
index 00000000..c44ff6a8
--- /dev/null
+++ b/io.sc.platform.lcdp.frontend/src/views/form/grid/Form.vue
@@ -0,0 +1,508 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/io.sc.platform.lcdp.frontend/src/views/form/grid/ts/ComponentType.ts b/io.sc.platform.lcdp.frontend/src/views/form/grid/ts/ComponentType.ts
new file mode 100644
index 00000000..f5abc4dd
--- /dev/null
+++ b/io.sc.platform.lcdp.frontend/src/views/form/grid/ts/ComponentType.ts
@@ -0,0 +1,52 @@
+export class ComponentType {
+ static type = {
+ text: { label: '文本框', value: 'text', component: 'w-text' },
+ textarea: { label: '文本域', value: 'textarea', component: 'w-textarea' },
+ checkbox: { label: '复选框', value: 'checkbox', component: 'w-checkbox' },
+ codeMirror: { label: '代码编辑器', value: 'codeMirror', component: 'w-code-mirror' },
+ date: { label: '日期', value: 'date', component: 'w-date' },
+ dateRange: { label: '日期范围', value: 'dateRange', component: 'w-date-range' },
+ icon: { label: '图标选择', value: 'icon', component: 'w-icon' },
+ number: { label: '数字框', value: 'number', component: 'w-number' },
+ integer: { label: '整数框', value: 'integer', component: 'w-integer' },
+ radio: { label: '单选按钮', value: 'radio', component: 'w-radio' },
+ select: { label: '下拉框', value: 'select', component: 'w-select' },
+ multipleSelect: { label: '多选下拉框', value: 'multipleSelect', component: 'w-select' },
+ userSelect: { label: '用户选择', value: 'userSelect', component: 'w-user-select' },
+ mulitpleUserSelect: { label: '用户选择(多选)', value: 'mulitpleUserSelect', component: 'w-user-select' },
+ orgSelect: { label: '机构选择', value: 'orgSelect', component: 'w-org-select' },
+ mulitpleOrgSelect: { label: '机构选择(多选)', value: 'mulitpleOrgSelect', component: 'w-org-select' },
+ roleSelect: { label: '角色选择', value: 'roleSelect', component: 'w-role-select' },
+ mulitpleRoleSelect: { label: '角色选择(多选)', value: 'mulitpleRoleSelect', type: 'w-role-select' },
+ dbTableSelect: { label: '数据表选择', value: 'dbTableSelect', component: 'w-db-table-select' },
+ mulitpleDbTableSelect: { label: '数据表选择(多选)', value: 'mulitpleDbTableSelect', component: 'w-db-table-select' },
+ };
+
+ /**
+ * 所有组件集合
+ */
+ static options: Array = Object.values(this.type);
+
+ /**
+ * 多选类型的组件集合
+ */
+ static multipleSelectTypes: Array = [
+ this.type.multipleSelect,
+ this.type.mulitpleUserSelect,
+ this.type.mulitpleOrgSelect,
+ this.type.mulitpleRoleSelect,
+ this.type.mulitpleDbTableSelect,
+ ];
+
+ /**
+ * 所有选项类型的组件集合
+ */
+ static selectTypes: Array = [
+ this.type.select,
+ this.type.userSelect,
+ this.type.orgSelect,
+ this.type.roleSelect,
+ this.type.dbTableSelect,
+ ...this.multipleSelectTypes,
+ ];
+}
diff --git a/io.sc.platform.lcdp.frontend/src/views/form/grid/ts/ComputedManager.ts b/io.sc.platform.lcdp.frontend/src/views/form/grid/ts/ComputedManager.ts
new file mode 100644
index 00000000..3fa6a4f7
--- /dev/null
+++ b/io.sc.platform.lcdp.frontend/src/views/form/grid/ts/ComputedManager.ts
@@ -0,0 +1,21 @@
+import { computed } from 'vue';
+import { Tools } from 'platform-core';
+import { FormConfig } from './FormConfig';
+
+export class ComputedManager {
+ form: FormConfig;
+
+ constructor(form_: FormConfig) {
+ this.form = form_;
+ }
+
+ fieldComeFromValueComputed = computed(() => {
+ if (this.form.cf.getTemplateConfigFormRef) {
+ const ref = this.form.cf.getTemplateConfigFormRef();
+ if (ref && !Tools.isEmpty(ref.getFieldValue('fieldComeFrom'))) {
+ return ref.getFieldValue('fieldComeFrom');
+ }
+ }
+ return undefined;
+ });
+}
diff --git a/io.sc.platform.lcdp.frontend/src/views/form/grid/ts/DictionaryType.ts b/io.sc.platform.lcdp.frontend/src/views/form/grid/ts/DictionaryType.ts
new file mode 100644
index 00000000..e9980a58
--- /dev/null
+++ b/io.sc.platform.lcdp.frontend/src/views/form/grid/ts/DictionaryType.ts
@@ -0,0 +1,10 @@
+export class DictionaryType {
+ static type = {
+ none: { label: '无', value: 'none' },
+ dictionary: { label: '数据字典', value: 'dictionary' },
+ array: { label: '自定义数组', value: 'array' },
+ sql: { label: 'Sql', value: 'sql' },
+ };
+
+ static options: Array = Object.values(this.type);
+}
diff --git a/io.sc.platform.lcdp.frontend/src/views/form/grid/ts/FormConfig.ts b/io.sc.platform.lcdp.frontend/src/views/form/grid/ts/FormConfig.ts
new file mode 100644
index 00000000..7fb3d37c
--- /dev/null
+++ b/io.sc.platform.lcdp.frontend/src/views/form/grid/ts/FormConfig.ts
@@ -0,0 +1,51 @@
+import type { ComponentFunctionsType } from './type/ComponentFunctionsType';
+import { RequestApi } from './RequestApi';
+import { ComputedManager } from './ComputedManager';
+import { FunctionManager } from './FunctionManager';
+
+export class FormConfig {
+ /**
+ * 编辑时模板ID
+ */
+ editId: string = '';
+ /**
+ * 编辑时表格类型的表单,主表ID
+ */
+ editGridId: string = '';
+ /**
+ * 方案集合
+ */
+ schemas: Array = [];
+ /**
+ * 计算属性管理器
+ */
+ cm: ComputedManager;
+ /**
+ * 函数管理器
+ */
+ fm: FunctionManager;
+ /**
+ * 请求API管理器
+ */
+ api: RequestApi;
+ /**
+ * vue文件中定义的函数管理器
+ */
+ cf: ComponentFunctionsType = {
+ getDialogRef: () => {},
+ getFieldGridRef: () => {},
+ getTemplateConfigFormRef: () => {},
+ getMainConfigFormRef: () => {},
+ getPageSortConfigFormRef: () => {},
+ getQueryConfigFormRef: () => {},
+ getEditConfigFormRef: () => {},
+ setPrimaryKeyOptions: () => {},
+ };
+
+ constructor() {
+ this.api = new RequestApi(this);
+ this.cm = new ComputedManager(this);
+ this.fm = new FunctionManager(this);
+ this.api.getSchemas();
+ }
+}
diff --git a/io.sc.platform.lcdp.frontend/src/views/form/grid/ts/FunctionManager.ts b/io.sc.platform.lcdp.frontend/src/views/form/grid/ts/FunctionManager.ts
new file mode 100644
index 00000000..36fa42cf
--- /dev/null
+++ b/io.sc.platform.lcdp.frontend/src/views/form/grid/ts/FunctionManager.ts
@@ -0,0 +1,204 @@
+import { Tools } from 'platform-core';
+import { FormConfig } from './FormConfig';
+import { ComponentType } from './ComponentType';
+import { JavaType } from './JavaType';
+
+export class FunctionManager {
+ form: FormConfig;
+
+ constructor(form_: FormConfig) {
+ this.form = form_;
+ }
+
+ /**
+ * 设置字段列表数据
+ * @param fields 字段集合
+ */
+ setFieldGridData(fields: Array) {
+ if (this.form.cf.getFieldGridRef) {
+ if (this.form.cm.fieldComeFromValueComputed.value === 'table') {
+ const data = this.buildTableTypeFields(fields);
+ this.form.cf.getFieldGridRef().setLocalData(data);
+ } else if (this.form.cm.fieldComeFromValueComputed.value === 'sql') {
+ const data = this.buildSqlTypeFields(fields);
+ this.form.cf.getFieldGridRef().setLocalData(data);
+ }
+ }
+ }
+
+ private buildSqlTypeFields(fields: Array) {
+ const result = [];
+ fields.forEach((item: any) => {
+ const javaType = this.getFieldType(item['javaType']);
+ const autoData = this.buildAutoData(item['name']);
+ const componentType = this.getComponentType(item['javaType']);
+ const field = {
+ tableName: undefined,
+ fieldName: item['name'],
+ fieldLabel: undefined,
+ fieldType: javaType, // 字段类型
+ fieldLength: javaType === 'String' ? item['size'] : undefined, // 字段长度
+ fieldPrecision: undefined, // 字段精度
+ fieldIsSelect: false, // 字段为选项值
+ optionComeFrom: 'none', // 选项值来源
+ dictionaryOptionValue: '', // 数据字典选项值
+ otherOptionValue: '', // 其他类型选项值
+ addValueType: 'NONE', // 新增时系统自动填充类型
+ editOverride: undefined, // 修改时覆盖系统自动填充值
+ // 查询面板
+ queryShow: false, // 查询面板中显示
+ queryFormType: componentType, // 使用的表单类型
+ queryDefaultValue: '', // 默认值
+ queryIsrequiredIf: false, // 必填项
+ queryOperator: '', // 匹配模式
+ // 列表
+ tableShow: true, // 列表中显示
+ tableSort: false, // 支持排序
+ tableColumnAlign: '', // 列对齐方式
+ tableColumnWidth: undefined, // 列宽
+ // 新增页面
+ editorShow: false, // 新增编辑页面中显示
+ editorFormType: componentType, // 使用的表单类型
+ editorDefaultValue: '', // 默认值
+ editorIsRequired: false, // 必填项
+ };
+ result.push({ ...field, ...autoData });
+ });
+ return result;
+ }
+
+ private buildTableTypeFields(fields: Array) {
+ const result = [];
+ fields.forEach((item: any) => {
+ // 设置主键
+ if (item['partOfPrimaryKey'] && this.form.cf.getMainConfigFormRef) {
+ this.form.cf.getMainConfigFormRef().setFieldValue('primaryKey', item['name']);
+ }
+ const javaType = this.getFieldType(item['javaType']);
+ const autoData = this.buildAutoData(item['name']);
+ const componentType = this.getComponentType(item['javaType']);
+ const field = {
+ tableName: this.form.cf.getTemplateConfigFormRef ? this.form.cf.getTemplateConfigFormRef().getFieldValue('databaseTable') : undefined,
+ fieldName: item['name'],
+ fieldLabel: item['remarks'],
+ sqlType: item['sqlType'],
+ width: item['width'],
+ fieldType: javaType, // 字段类型
+ fieldLength: javaType === 'String' ? item['size'] : undefined, // 字段长度
+ fieldPrecision: undefined, // 字段精度
+ fieldIsSelect: false, // 字段为选项值
+ optionComeFrom: 'none', // 选项值来源
+ dictionaryOptionValue: '', // 数据字典选项值
+ otherOptionValue: '', // 其他类型选项值
+ addValueType: 'NONE', // 新增时系统自动填充类型
+ editOverride: undefined, // 修改时覆盖系统自动填充值
+ // 查询面板
+ queryShow: false, // 查询面板中显示
+ queryFormType: componentType, // 使用的表单类型
+ queryDefaultValue: '', // 默认值
+ queryIsrequiredIf: false, // 必填项
+ queryOperator: '', // 匹配模式
+ // 列表
+ tableShow: true, // 列表中显示
+ tableSort: false, // 支持排序
+ tableColumnAlign: '', // 列对齐方式
+ tableColumnWidth: undefined, // 列宽
+ // 新增页面
+ editorShow: true, // 新增编辑页面中显示
+ editorFormType: componentType, // 使用的表单类型
+ editorDefaultValue: '', // 默认值
+ editorIsRequired: false, // 必填项
+ };
+ result.push({ ...field, ...autoData });
+ });
+ return result;
+ }
+
+ private buildAutoData(name: string) {
+ if (name.toUpperCase() === 'ID' || name.toUpperCase() === 'ID_') {
+ return {
+ addValueType: 'UUID',
+ editOverride: false,
+ tableShow: false,
+ editorShow: false,
+ };
+ } else if (name.toUpperCase() === 'JPA_VERSION' || name.toUpperCase() === 'JPA_VERSION_') {
+ return {
+ editOverride: false,
+ tableShow: false,
+ editorShow: false,
+ };
+ } else if (name.toUpperCase() === 'DATA_COME_FROM' || name.toUpperCase() === 'DATA_COME_FROM_') {
+ return {
+ addValueType: 'DCF_INPUT',
+ editOverride: false,
+ tableShow: false,
+ editorShow: false,
+ };
+ } else if (name.toUpperCase() === 'CREATOR' || name.toUpperCase() === 'CREATOR_') {
+ return {
+ addValueType: 'CURR_USER',
+ editOverride: false,
+ tableShow: false,
+ editorShow: false,
+ };
+ } else if (name.toUpperCase() === 'CREATE_DATE' || name.toUpperCase() === 'CREATE_DATE_') {
+ return {
+ addValueType: 'CURR_DATE',
+ editOverride: false,
+ tableShow: false,
+ editorShow: false,
+ };
+ } else if (name.toUpperCase() === 'LAST_MODIFIER' || name.toUpperCase() === 'LAST_MODIFIER_') {
+ return {
+ addValueType: 'CURR_USER',
+ editOverride: true,
+ tableShow: false,
+ editorShow: false,
+ };
+ } else if (name.toUpperCase() === 'LAST_MODIFYDATE' || name.toUpperCase() === 'LAST_MODIFYDATE_') {
+ return {
+ addValueType: 'CURR_DATE',
+ editOverride: true,
+ tableShow: false,
+ editorShow: false,
+ };
+ } else if (name.toUpperCase() === 'CORP_CODE' || name.toUpperCase() === 'CORP_CODE_') {
+ return {
+ addValueType: 'CURR_CORP',
+ editOverride: true,
+ tableShow: false,
+ editorShow: false,
+ };
+ }
+ return {};
+ }
+
+ private getFieldType(javaType: string) {
+ if (javaType === 'java.lang.Integer' || javaType === 'java.lang.Long') {
+ return JavaType.type.Integer.value;
+ } else if (javaType === 'java.sql.Timestamp') {
+ return JavaType.type.Date.value;
+ } else if (javaType === 'java.lang.Boolean') {
+ return JavaType.type.Boolean.value;
+ } else if (javaType === 'java.math.BigDecimal') {
+ return JavaType.type.BigDecimal.value;
+ } else {
+ return JavaType.type.String.value;
+ }
+ }
+
+ private getComponentType(javaType: string) {
+ if (javaType === 'java.lang.Integer' || javaType === 'java.lang.Long') {
+ return ComponentType.type.integer.value;
+ } else if (javaType === 'java.sql.Timestamp') {
+ return ComponentType.type.date.value;
+ } else if (javaType === 'java.lang.Boolean') {
+ return ComponentType.type.select.value;
+ } else if (javaType === 'java.math.BigDecimal') {
+ return ComponentType.type.number.value;
+ } else {
+ return ComponentType.type.text.value;
+ }
+ }
+}
diff --git a/io.sc.platform.lcdp.frontend/src/views/form/grid/ts/JavaType.ts b/io.sc.platform.lcdp.frontend/src/views/form/grid/ts/JavaType.ts
new file mode 100644
index 00000000..caa745f8
--- /dev/null
+++ b/io.sc.platform.lcdp.frontend/src/views/form/grid/ts/JavaType.ts
@@ -0,0 +1,11 @@
+export class JavaType {
+ static type = {
+ String: { label: '字符串', value: 'String' },
+ Integer: { label: '整数', value: 'Integer' },
+ BigDecimal: { label: '小数', value: 'BigDecimal' },
+ Date: { label: '日期', value: 'Date' },
+ Boolean: { label: '布尔', value: 'Boolean' },
+ };
+
+ static options: Array = Object.values(this.type);
+}
diff --git a/io.sc.platform.lcdp.frontend/src/views/form/grid/ts/RequestApi.ts b/io.sc.platform.lcdp.frontend/src/views/form/grid/ts/RequestApi.ts
new file mode 100644
index 00000000..640abc67
--- /dev/null
+++ b/io.sc.platform.lcdp.frontend/src/views/form/grid/ts/RequestApi.ts
@@ -0,0 +1,170 @@
+import { toRaw } from 'vue';
+import { axios, Environment, NotifyManager } from 'platform-core';
+import { FormConfig } from './FormConfig';
+import { ComponentType } from './ComponentType';
+
+export class RequestApi {
+ form: FormConfig;
+
+ constructor(form_: FormConfig) {
+ this.form = form_;
+ }
+
+ getSchemas() {
+ axios({
+ method: 'GET',
+ url: Environment.apiContextPath('api/template/config/schemas'),
+ }).then((resp) => {
+ this.form.schemas = [];
+ resp.data.forEach((item: any) => {
+ this.form.schemas.push({ label: item.name, value: item.name });
+ });
+ });
+ }
+
+ loadFields(sql: string) {
+ const requestParams = {
+ method: 'POST',
+ headers: { 'content-type': 'text/plain;charset=utf-8;' },
+ data: sql,
+ url: Environment.apiContextPath('api/jdbc/fetchMetaDataBySql'),
+ };
+ axios(requestParams)
+ .then((resp: any) => {
+ const columns = [];
+ const gridRef = this.form.cf.getFieldGridRef();
+ const oldColumns = gridRef.getRows();
+ // if (oldColumns.length > 0) {
+ // resp.data.forEach((item) => {
+ // const column = oldColumns.find((oldColumn) => {
+ // return oldColumn.fieldName === item.columnName;
+ // });
+ // if (!Tools.isEmpty(column)) {
+ // columns.push({
+ // id: item.id,
+ // parent: item.parent,
+ // name: item.columnName,
+ // fieldName: item.columnName,
+ // queryShow: item.queryShow || false,
+ // tableShow: item.tableShow || false,
+ // ...column,
+ // });
+ // } else {
+ // columns.push({
+ // id: item.id,
+ // parent: item.parent,
+ // name: item.columnName,
+ // fieldName: item.columnName,
+ // queryShow: item.queryShow || false,
+ // tableShow: item.tableShow || false,
+ // });
+ // }
+ // });
+ // gridRef.setLocalData(columns, 'sql');
+ // } else {
+ resp.data.forEach((item) => {
+ columns.push({
+ id: item.id,
+ parent: item.parent,
+ name: item.columnName,
+ fieldName: item.columnName,
+ queryShow: item.parent === 'where_field' || false,
+ optionComeFrom: 'none', // 选项值来源
+ addValueType: 'NONE', // 新增时系统自动填充类型
+ // 查询表单
+ queryFormtype: ComponentType.type.text.value, // 使用的表单类型
+ queryDefaultValue: '', // 默认值
+ queryIsrequiredIf: false, // 必填项
+ queryOperator: '', // 匹配模式
+ // 列表
+ tableShow: true, // 列表中显示
+ tableSort: false, // 支持排序
+ tableColumnAlign: '', // 列对齐方式
+ tableColumnWidth: undefined, // 列宽
+ // 新增页面
+ editorShow: false, // 新增编辑页面中显示
+ editorFormType: ComponentType.type.text.value, // 使用的表单类型
+ editorDefaultValue: '', // 默认值
+ editorIsRequired: false, // 必填项
+ });
+ });
+ gridRef.setLocalData(columns);
+ const names = columns.map((item) => item.fieldName);
+ this.form.cf.setPrimaryKeyOptions(names);
+ // }
+ })
+ .catch((error: any) => {
+ NotifyManager.error('SQL执行报错');
+ });
+ }
+
+ async fetchFormConfigData() {
+ const resp = await axios.get(Environment.apiContextPath('api/template/config/fetch/') + this.form.editId);
+ if (resp && resp.data) {
+ return resp.data;
+ }
+ return undefined;
+ }
+
+ buildSaveData() {
+ const templateFormData = this.form.cf.getTemplateConfigFormRef().getData();
+ const mainFormData = this.form.cf.getMainConfigFormRef().getData();
+ const pageSortFormData = this.form.cf.getPageSortConfigFormRef().getData();
+ const queryFormData = this.form.cf.getQueryConfigFormRef().getData();
+ const editFormData = this.form.cf.getEditConfigFormRef().getData();
+ const rows = this.form.cf.getFieldGridRef().getRows();
+ rows.forEach((item: any, index: number) => {
+ item['sortNo'] = index + 1;
+ if (item['editorFormType'] === ComponentType.type.date.value) {
+ // 当前端组件为日期类型时,查询面板的组件替换为日期范围
+ item['queryFormType'] = ComponentType.type.dateRange.value;
+ } else {
+ // 其他组件通用
+ item['queryFormType'] = item['editorFormType'];
+ }
+ });
+ const requestData = {
+ templateConfig: { ...templateFormData, ...{ id: this.form.editId } },
+ templateGrid: { ...templateFormData, ...mainFormData, ...pageSortFormData, ...queryFormData, ...editFormData, id: this.form.editGridId },
+ templateGridFields: toRaw(rows),
+ };
+ requestData.templateGrid['columnTitles'] = JSON.stringify({ value: mainFormData['columnTitles'] });
+ return requestData;
+ }
+
+ async save() {
+ const rows = this.form.cf.getFieldGridRef().getRows();
+ if (!rows || rows.length === 0) {
+ NotifyManager.warn('字段列表为空');
+ return;
+ }
+ if (!(await this.formValidate())) {
+ return;
+ }
+ const requestData = this.buildSaveData();
+ axios({
+ method: 'POST',
+ url: Environment.apiContextPath('api/template/config') + (this.form.editId ? '/edit' : '/add'),
+ data: requestData,
+ })
+ .then((resp) => {
+ // 关闭窗口,刷新表格
+ this.form.cf.getDialogRef().hide();
+ this.form.cf.getDialogRef().emit('refresh-grid');
+ NotifyManager.info('保存成功');
+ })
+ .catch((error) => {
+ console.info('error====', error);
+ NotifyManager.error('保存失败');
+ });
+ }
+
+ private async formValidate() {
+ const templateConfigFormValidate = await this.form.cf.getTemplateConfigFormRef().validate();
+ const mainConfigFormValidate = await this.form.cf.getMainConfigFormRef().validate();
+ const pageSortFormValidate = await this.form.cf.getPageSortConfigFormRef().validate();
+ const queryFormValidate = await this.form.cf.getQueryConfigFormRef().validate();
+ const editFormValidate = await this.form.cf.getEditConfigFormRef().validate();
+ return templateConfigFormValidate && mainConfigFormValidate && pageSortFormValidate && queryFormValidate && editFormValidate;
+ }
+}
diff --git a/io.sc.platform.lcdp.frontend/src/views/form/grid/ts/type/ComponentFunctionsType.ts b/io.sc.platform.lcdp.frontend/src/views/form/grid/ts/type/ComponentFunctionsType.ts
new file mode 100644
index 00000000..4cb32668
--- /dev/null
+++ b/io.sc.platform.lcdp.frontend/src/views/form/grid/ts/type/ComponentFunctionsType.ts
@@ -0,0 +1,10 @@
+export type ComponentFunctionsType = {
+ getDialogRef: Function;
+ getFieldGridRef: Function;
+ getTemplateConfigFormRef: Function;
+ getMainConfigFormRef: Function;
+ getPageSortConfigFormRef: Function;
+ getQueryConfigFormRef: Function;
+ getEditConfigFormRef: Function;
+ setPrimaryKeyOptions: Function;
+}
\ No newline at end of file