diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmFormServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmFormServiceImpl.java index 967ab8f49..e68a6b489 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmFormServiceImpl.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmFormServiceImpl.java @@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.bpm.service.definition; import cn.hutool.core.lang.Assert; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.json.JsonUtils; -import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils; import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.form.BpmFormCreateReqVO; import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.form.BpmFormPageReqVO; import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.form.BpmFormUpdateReqVO; @@ -107,17 +106,15 @@ public class BpmFormServiceImpl implements BpmFormService { return null; } - private void checkKeyNCName(String key) { - if (!ValidationUtils.isXmlNCName(key)) { - throw exception(MODEL_KEY_VALID); - } - } /** * 校验 Field,避免 field 重复 * * @param fields field 数组 */ private void checkFields(List fields) { + if (true) { // TODO 芋艿:兼容 Vue3 工作流:因为采用了新的表单设计器,所以暂时不校验 + return; + } Map fieldMap = new HashMap<>(); // key 是 vModel,value 是 label for (String field : fields) { BpmFormFieldRespDTO fieldDTO = JsonUtils.parseObject(field, BpmFormFieldRespDTO.class); diff --git a/yudao-ui-admin-vue3/src/api/bpm/form/index.ts b/yudao-ui-admin-vue3/src/api/bpm/form/index.ts index 15856c5a1..c745201f2 100644 --- a/yudao-ui-admin-vue3/src/api/bpm/form/index.ts +++ b/yudao-ui-admin-vue3/src/api/bpm/form/index.ts @@ -1,5 +1,14 @@ import request from '@/config/axios' -import { FormVO } from './types' + +export type FormVO = { + id: number + name: string + conf: string + fields: string[] + status: number + remark: string + createTime: string +} // 创建工作流的表单定义 export const createFormApi = async (data: FormVO) => { diff --git a/yudao-ui-admin-vue3/src/api/bpm/form/types.ts b/yudao-ui-admin-vue3/src/api/bpm/form/types.ts deleted file mode 100644 index 2bc8b6912..000000000 --- a/yudao-ui-admin-vue3/src/api/bpm/form/types.ts +++ /dev/null @@ -1,9 +0,0 @@ -export type FormVO = { - id: number - name: string - conf: string - fields: string[] - status: number - remark: string - createTime: string -} diff --git a/yudao-ui-admin-vue3/src/router/modules/remaining.ts b/yudao-ui-admin-vue3/src/router/modules/remaining.ts index 43ad50aa6..c53bcb2df 100644 --- a/yudao-ui-admin-vue3/src/router/modules/remaining.ts +++ b/yudao-ui-admin-vue3/src/router/modules/remaining.ts @@ -194,7 +194,7 @@ const remainingRouter: AppRouteRecordRaw[] = [ noCache: true, hidden: true, canTo: true, - title: '流程表单', + title: '设计流程表单', activeMenu: 'bpm/manager/form/formEditor' } }, diff --git a/yudao-ui-admin-vue3/src/utils/formCreate.ts b/yudao-ui-admin-vue3/src/utils/formCreate.ts new file mode 100644 index 000000000..e70ae39e9 --- /dev/null +++ b/yudao-ui-admin-vue3/src/utils/formCreate.ts @@ -0,0 +1,45 @@ +/** + * 针对 https://github.com/xaboy/form-create-designer 封装的工具类 + */ + +// 编码表单 Conf +export const encodeConf = (designerRef: object) => { + // @ts-ignore + return JSON.stringify(designerRef.value.getOption()) +} + +// 编码表单 Fields +export const encodeFields = (designerRef: object) => { + // @ts-ignore + const rule = designerRef.value.getRule() + const fields: string[] = [] + rule.forEach((item) => { + fields.push(JSON.stringify(item)) + }) + return fields +} + +// 解码表单 Fields +export const decodeFields = (fields: string[]) => { + const rule: object[] = [] + fields.forEach((item) => { + rule.push(JSON.parse(item)) + }) + return rule +} + +// 设置表单的 Conf 和 Fields +export const setConfAndFields = (designerRef: object, conf: string, fields: string) => { + // @ts-ignore + designerRef.value.setOption(JSON.parse(conf)) + // @ts-ignore + designerRef.value.setRule(decodeFields(fields)) +} + +// 设置表单的 Conf 和 Fields +export const setConfAndFields2 = (detailPreview: object, conf: string, fields: string) => { + // @ts-ignore + detailPreview.value.option = JSON.parse(conf) + // @ts-ignore + detailPreview.value.rule = decodeFields(fields) +} diff --git a/yudao-ui-admin-vue3/src/views/bpm/form/formEditor.vue b/yudao-ui-admin-vue3/src/views/bpm/form/formEditor.vue index 201b663f2..d53791418 100644 --- a/yudao-ui-admin-vue3/src/views/bpm/form/formEditor.vue +++ b/yudao-ui-admin-vue3/src/views/bpm/form/formEditor.vue @@ -8,7 +8,7 @@ - + @@ -43,22 +43,26 @@ diff --git a/yudao-ui-admin-vue3/src/views/bpm/form/index.vue b/yudao-ui-admin-vue3/src/views/bpm/form/index.vue index 37733533a..749c2416f 100644 --- a/yudao-ui-admin-vue3/src/views/bpm/form/index.vue +++ b/yudao-ui-admin-vue3/src/views/bpm/form/index.vue @@ -37,12 +37,9 @@ /> - - - - 表单详情 + + + @@ -50,21 +47,18 @@