From ad08c3da573c4d0aa54b234b431eb35f86db358e Mon Sep 17 00:00:00 2001 From: wangxiang <1827945911@qq.com> Date: Tue, 1 Aug 2023 23:24:41 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=BE=AE=E5=BA=94=E7=94=A8=E6=89=A9?= =?UTF-8?q?=E5=B1=95=E5=A4=9A=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/enums/microAppEnum.ts | 15 +- src/store/modules/microApp.ts | 20 +- .../form/helper/WorkflowFormDesign.vue | 4 +- .../extension/formJson/FormJsonModal.vue | 64 +++++++ .../extension/formJson/formJson.data.ts | 177 +++++------------- .../workflow/extension/formJson/index.vue | 24 +-- 6 files changed, 147 insertions(+), 157 deletions(-) create mode 100644 src/views/workflow/extension/formJson/FormJsonModal.vue diff --git a/src/enums/microAppEnum.ts b/src/enums/microAppEnum.ts index d39279a..8d936e5 100644 --- a/src/enums/microAppEnum.ts +++ b/src/enums/microAppEnum.ts @@ -7,10 +7,17 @@ export enum GlStateEnum { // 表单设计器 - FORM_DESIGN_PROPS_KEY = 'MICRO_APP_FORM_DESIGN_PROPS_KEY', - FORM_DESIGN_EMIT_KEY = 'MICRO_APP_FORM_DESIGN_EMIT_KEY', + FORM_DESIGN_PROPS_KEY = 'MICRO_FORM_DESIGN_PROPS_KEY', + FORM_DESIGN_EMIT_KEY = 'MICRO_FORM_DESIGN_EMIT_KEY', // 工作流设计器 - WORKFLOW_DESIGN_PROPS_KEY = 'MICRO_APP_WORKFLOW_DESIGN_PROPS_KEY', - WORKFLOW_DESIGN_EMIT_KEY = 'MICRO_APP_WORKFLOW_DESIGN_EMIT_KEY', + WORKFLOW_DESIGN_PROPS_KEY = 'MICRO_WORKFLOW_DESIGN_PROPS_KEY', + WORKFLOW_DESIGN_EMIT_KEY = 'MICRO_WORKFLOW_DESIGN_EMIT_KEY', } +export enum FORM_DESIGN_COMPONENTS { + DESIGN = 'MicroDesign', + PREVIEW = 'MicroPreview' +} +export enum WORKFLOW_DESIGN_COMPONENTS { + +} diff --git a/src/store/modules/microApp.ts b/src/store/modules/microApp.ts index 40b68d1..3dfee5e 100644 --- a/src/store/modules/microApp.ts +++ b/src/store/modules/microApp.ts @@ -6,6 +6,8 @@ */ import { defineStore } from 'pinia'; import { store } from '/@/store'; +import { merge } from 'lodash-es'; +import { FORM_DESIGN_COMPONENTS, WORKFLOW_DESIGN_COMPONENTS } from '/@/enums/microAppEnum'; interface MicroAppState { formDesignApp: Recordable; @@ -19,20 +21,24 @@ export const useMicroAppStore = defineStore({ workflowDesignApp: {} }), getters: { - getFormDesignApp(): Recordable { - return this.formDesignApp; + getFormDesignApp(): Function { + return (component: FORM_DESIGN_COMPONENTS) => this.formDesignApp[component] || {}; }, - getWorkflowDesignApp(): Recordable { - return this.workflowDesignApp; + getWorkflowDesignApp(): Function { + return (component: WORKFLOW_DESIGN_COMPONENTS) => this.workflowDesignApp[component] || {}; } }, actions: { setFormDesignApp(data: Recordable): void { - this.formDesignApp = { ...this.formDesignApp, ...data }; + this.formDesignApp = merge(this.formDesignApp, data); }, setWorkflowDesignApp(data: Recordable): void { - this.workflowDesignApp = { ...this.workflowDesignApp, ...data }; - } + this.workflowDesignApp = merge(this.workflowDesignApp, data); + }, + resetState(): void { + this.formDesignApp = {}; + this.workflowDesignApp = {}; + }, } }); diff --git a/src/views/workflow/extension/form/helper/WorkflowFormDesign.vue b/src/views/workflow/extension/form/helper/WorkflowFormDesign.vue index 1beac96..99333a1 100644 --- a/src/views/workflow/extension/form/helper/WorkflowFormDesign.vue +++ b/src/views/workflow/extension/form/helper/WorkflowFormDesign.vue @@ -25,6 +25,7 @@ import { apps } from '/@/qiankun/apps'; import { addFormDefinitionJson, editFormDefinitionJson, getFormDefinitionJson } from '/@/api/platform/workflow/extension/controller/formDefinitionJson'; import { FormDefinitionJson } from '/@/api/platform/workflow/extension/entity/formDefinitionJson'; + import { FORM_DESIGN_COMPONENTS } from '/@/enums/microAppEnum'; interface TableState { tag: string; @@ -90,7 +91,8 @@ /** 处理弹出框提交 */ async function handleSubmitForm(status: string) { try { - const formRef = microAppStore.getFormDesignApp.getFormDesignRef(); + const formDesignApp: Recordable = microAppStore.getFormDesignApp(FORM_DESIGN_COMPONENTS.DESIGN), + formRef: Recordable = formDesignApp.getFormDesignRef(); state.form.json = formRef.getWidgetFormJson(); state.form.status = status; state.form.isPrimary = '1'; diff --git a/src/views/workflow/extension/formJson/FormJsonModal.vue b/src/views/workflow/extension/formJson/FormJsonModal.vue new file mode 100644 index 0000000..aa50ec6 --- /dev/null +++ b/src/views/workflow/extension/formJson/FormJsonModal.vue @@ -0,0 +1,64 @@ + + diff --git a/src/views/workflow/extension/formJson/formJson.data.ts b/src/views/workflow/extension/formJson/formJson.data.ts index 0c7bd3a..208f658 100644 --- a/src/views/workflow/extension/formJson/formJson.data.ts +++ b/src/views/workflow/extension/formJson/formJson.data.ts @@ -1,164 +1,79 @@ -/** - * @program: kicc-ui - * @description: 授权客户端模块动态渲染配置 - * @author: entfrm开发团队-王翔 - * @create: 2022/4/21 - */ - import { BasicColumn } from '/@/components/Table'; import { FormSchema } from '/@/components/Table'; +import { h } from 'vue'; +import { Tag } from 'ant-design-vue'; -/** 表格列配置 */ export const columns: BasicColumn[] = [ { - title: '客户端Id', - dataIndex: 'clientId', - width: 100 - }, - { - title: '客户端密钥', - dataIndex: 'clientSecret', - width: 100 + title: '流程定义ID', + dataIndex: 'formDefinitionId', + width: 120 }, { - title: '授权类型', - dataIndex: 'authorizedGrantTypes', - width: 130 + title: '流程表单结构体', + dataIndex: 'json', + width: 220, + ellipsis: true }, { - title: '授权范围', - dataIndex: 'scope', - width: 90 + title: '版本号', + dataIndex: 'version', + width: 80 }, { - title: '令牌过期秒数', - dataIndex: 'accessTokenValidity', - width: 130 - }, - { - title: '令牌过期秒数', - dataIndex: 'refreshTokenValidity', - width: 130 + title: '状态', + dataIndex: 'status', + width: 90, + customRender: ({ record }) => { + return record.formDefinitionJson?.status == '1' ? + h(Tag, { color: 'success' }, () => '已发布'): + h(Tag, { color: 'red' }, () => '未发布'); + } }, { - title: '创建时间', - dataIndex: 'createTime', - width: 100 + title: '是否主版本', + dataIndex: 'isPrimary', + width: 90, + customRender: ({ record }) => { + return record.formDefinitionJson?.status == '1' ? + h(Tag, { color: 'success' }, () => '主版本'): + h(Tag, { color: 'red' }, () => '非主版本'); + } } ]; -/** 搜索表单配置 */ export const searchFormSchema: FormSchema[] = [ { - field: 'clientId', - label: '客户端编码', + field: 'version', + label: '版本号', component: 'Input', componentProps: { - placeholder: '请输入客户端编码', + placeholder: '请输入版本号', }, colProps: { span: 8 }, }, { - field: 'dateRange', - label: '创建时间', - component: 'RangePicker', + field: 'status', + label: '状态', + component: 'Select', componentProps: { - style: { width:'100%' }, - valueFormat: 'YYYY-MM-DD', - placeholder: ['开始日期','结束日期'] + options: [ + { label: '未发布', value: '0' }, + { label: '已发布', value: '1' } + ] }, colProps: { span: 8 } - } -]; - -/** 表单配置 */ -export const formSchema: FormSchema[] = [ - { - field: 'id', - label: 'ID', - component: 'Input', - show: false }, { - field: 'clientId', - label: '客户端Id', - component: 'Input', - required: true, - colProps: { - span: 12 - } - }, - { - field: 'clientSecret', - label: '客户端密钥', - component: 'Input', - required: true, - colProps: { - span: 12 - } - }, - { - field: 'authorizedGrantTypes', - label: '授权类型', - component: 'InputTextArea', - required:true, + field: 'isPrimary', + label: '是否主版本', + component: 'Select', componentProps: { - rows: 3 + options: [ + { label: '非主版本', value: '0' }, + { label: '主版本', value: '1' } + ] }, - colProps: { - span: 24 - } - }, - { - field: 'scope', - label: '授权范围', - component: 'Input', - required:true, - colProps: { - span: 12 - } - }, - { - field: 'accessTokenValidity', - label: '过期秒数', - component: 'InputNumber', - componentProps: { - style: { width:'100%' }, - min: 0 - }, - colProps: { - span: 12 - } - }, - { - field: 'refreshTokenValidity', - label: '刷新秒数', - component: 'InputNumber', - componentProps: { - style: { width:'100%' }, - min: 0 - }, - colProps: { - span: 12 - } - }, - { - field: 'webServerRedirectUri', - label: '回调地址', - component: 'Input', - colProps: { - span: 12 - } - }, - { - field: 'additionalInformation', - label: '附加说明', - component: 'InputTextArea', - componentProps: { - rows: 6 - }, - colProps: { - span: 24 - } + colProps: { span: 8 } } ]; diff --git a/src/views/workflow/extension/formJson/index.vue b/src/views/workflow/extension/formJson/index.vue index 5b52da7..6ecd6f3 100644 --- a/src/views/workflow/extension/formJson/index.vue +++ b/src/views/workflow/extension/formJson/index.vue @@ -5,34 +5,30 @@ @selection-change="handleSelectionChange" >