From ba52359ef846dab3d4757d7ca96614c13b5d73a9 Mon Sep 17 00:00:00 2001 From: ShiaoYoung <15552151+shiaoyoung@user.noreply.gitee.com> Date: Tue, 1 Jul 2025 11:51:05 +0800 Subject: [PATCH 1/5] =?UTF-8?q?feature:=20mobile-canvas=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E9=80=82=E9=85=8D=E4=B8=BB=E6=B5=81=E6=95=B0=E6=8D=AE=E5=B1=8F?= =?UTF-8?q?=E5=B9=95=E5=B0=BA=E5=AF=B8=E6=AF=94=E4=BE=8B=EF=BC=8Cmobile-ca?= =?UTF-8?q?nvas=E6=94=BE=E5=9C=A8Mobile=20Designer=E4=B8=AD=EF=BC=8C?= =?UTF-8?q?=E5=B7=A6=E5=8F=B3=E7=95=99=E7=99=BD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../public/designer-canvas/empty1.json | 2326 ++++++++++++----- packages/designer/src/app-providers.ts | 3 + .../form-designer/form-designer.component.tsx | 5 + .../designer-context/use-designer-context.ts | 2 +- .../src/composition/class/designer-canvas.css | 70 +- 5 files changed, 1665 insertions(+), 741 deletions(-) diff --git a/packages/designer/public/designer-canvas/empty1.json b/packages/designer/public/designer-canvas/empty1.json index c2572802392..0e3b45d3c14 100644 --- a/packages/designer/public/designer-canvas/empty1.json +++ b/packages/designer/public/designer-canvas/empty1.json @@ -1,734 +1,1636 @@ { - "header" : { - "Code" : "CommonDictionary", - "Type" : "Form", - "NameSpace" : "Inspur.GS.SagiDemo.SagiDemeModule.CommonDictionaries.CommonDictionaries.Front", - "CertId" : null, - "Name" : "通用字典", - "FileName" : "CommonDictionary.frm", - "BizobjectID" : "d8b09de6-5e7c-bfdf-d308-468827ba0d6b", - "Language" : null, - "Extendable" : false, - "NameLanguage" : { - "zh-CHS" : "通用字典", - "en" : "Common Dictionary", - "zh-CHT" : "" + "Header": { + "Code": "MobileVueTest", + "Type": "MobileForm", + "NameSpace": "Inspur.GS.MyDev.FarrisVueTest.VueFormTest.VueFormTest.Front", + "CertId": null, + "Name": "移动Vue测试", + "FileName": "MobileVueTest.mfrm", + "BizobjectID": "e34f063d-9c31-1e20-4ad7-c6b4f57ddfc9", + "Language": null, + "Extendable": false, + "NameLanguage": { + "zh-CHS": "移动Vue测试", + "en": "", + "zh-CHT": "" }, - "ID" : "35dd45be-60c7-4ae8-a827-533424031b76", - "IsTranslating" : false + "ID": "af47af33-345b-471e-9a00-49db59c222a1", + "IsTranslating": false }, - "refs" : [ { - "DependentMetadata" : { - "ID" : "4fdfc52d-8ac3-4f56-b431-d371c1fcf3ec", - "CertId" : null, - "NameSpace" : "Inspur.GS.SagiDemo.SagiDemeModule.CommonDictionaries.CommonDictionaries.Front", - "Code" : "CommonDictionary.frm", - "Name" : "CommonDictionary.frm", - "Type" : "ResourceMetadata", - "BizobjectID" : "d8b09de6-5e7c-bfdf-d308-468827ba0d6b" + "Refs": [ + { + "DependentMetadata": { + "ID": "1cfb0d2a-7300-4fc7-8d01-cd09a5df9198", + "CertId": null, + "NameSpace": "Inspur.GS.MyDev.FarrisVueTest.VueFormTest.VueFormTest.Front", + "Code": "MobileVueTest.mfrm", + "Name": "MobileVueTest.mfrm", + "Type": "ResourceMetadata", + "BizobjectID": "e34f063d-9c31-1e20-4ad7-c6b4f57ddfc9" + } } - } ], - "Content" : { - "code" : null, - "name" : null, - "Contents" : { - "module" : { - "id" : "35dd45be-60c7-4ae8-a827-533424031b76", - "code" : "CommonDictionary", - "name" : "通用字典", - "type" : "Module", - "creator" : "Sagi", - "creationDate" : "2025-02-07T07:43:41.186Z", - "templateId" : "list-card-template", - "templateRule" : "list-card-template", - "entity" : [ { - "eapiId" : "626b3ac9-e713-4cf2-95bd-9d01e401b51e", - "eapiCode" : "CommonDictionary_frm", - "eapiName" : "通用字典_frm", - "eapiNameSpace" : "Inspur.GS.SagiDemo.SagiDemeModule.CommonDictionaries.CommonDictionaries.Front", - "voPath" : "SagiDemo/SagiDemeModule/CommonDictionaries/bo-commondictionaries-front/metadata/components", - "voNameSpace" : "Inspur.GS.SagiDemo.SagiDemeModule.CommonDictionaries.CommonDictionaries.Front", - "name" : "通用字典_frm", - "id" : "52c7e73a-4797-4547-a772-fd50edf39f63", - "entities" : [ { - "label" : "commonDictionarys", - "name" : "通用字典", - "id" : "57a6ad1b-0dc2-4617-b820-a973da18887c", - "type" : { - "$type" : "EntityType", - "fields" : [ { - "$type" : "SimpleField", - "defaultValue" : "", - "editor" : { - "$type" : "TextBox" - }, - "require" : true, - "multiLanguage" : false, - "readonly" : false, - "label" : "id", - "name" : "主键", - "id" : "740c1cff-164d-4f47-96d9-cf7c8075cddb", - "type" : { - "$type" : "StringType", - "displayName" : "字符串", - "length" : 36, - "name" : "String" - }, - "path" : "ID", - "code" : "ID", - "originalId" : "740c1cff-164d-4f47-96d9-cf7c8075cddb", - "bindingField" : "id", - "bindingPath" : "id" - }, { - "$type" : "SimpleField", - "defaultValue" : "", - "editor" : { - "$type" : "DateBox", - "format" : "'yyyy-MM-dd'" - }, - "require" : false, - "multiLanguage" : false, - "readonly" : false, - "label" : "version", - "name" : "版本", - "id" : "43a7c79e-56e0-442e-b39d-8f9f45e8b0c8", - "type" : { - "$type" : "DateTimeType", - "displayName" : "日期时间", - "name" : "DateTime" - }, - "path" : "Version", - "code" : "Version", - "originalId" : "43a7c79e-56e0-442e-b39d-8f9f45e8b0c8", - "bindingField" : "version", - "bindingPath" : "version" - }, { - "$type" : "SimpleField", - "defaultValue" : "", - "editor" : { - "$type" : "TextBox" - }, - "require" : false, - "multiLanguage" : false, - "readonly" : false, - "label" : "code", - "name" : "编号", - "id" : "ddfc72d4-0c9b-49bf-8f41-8047264f6edc", - "type" : { - "$type" : "StringType", - "displayName" : "字符串", - "length" : 36, - "name" : "String" - }, - "path" : "Code", - "code" : "Code", - "originalId" : "ddfc72d4-0c9b-49bf-8f41-8047264f6edc", - "bindingField" : "code", - "bindingPath" : "code" - }, { - "$type" : "SimpleField", - "defaultValue" : "", - "editor" : { - "$type" : "TextBox" - }, - "require" : false, - "multiLanguage" : false, - "readonly" : false, - "label" : "name", - "name" : "名称", - "id" : "1ecd5759-6df4-41c8-9526-0108a5e2d9b6", - "type" : { - "$type" : "StringType", - "displayName" : "字符串", - "length" : 36, - "name" : "String" - }, - "path" : "Name", - "code" : "Name", - "originalId" : "1ecd5759-6df4-41c8-9526-0108a5e2d9b6", - "bindingField" : "name", - "bindingPath" : "name" - }, { - "$type" : "SimpleField", - "defaultValue" : "", - "editor" : { - "$type" : "TextBox" - }, - "require" : false, - "multiLanguage" : false, - "readonly" : false, - "label" : "category", - "name" : "分类", - "id" : "8e00ef40-17ba-4cbb-8a3c-709cf40b7939", - "type" : { - "$type" : "StringType", - "displayName" : "字符串", - "length" : 36, - "name" : "String" - }, - "path" : "Category", - "code" : "Category", - "originalId" : "8e00ef40-17ba-4cbb-8a3c-709cf40b7939", - "bindingField" : "category", - "bindingPath" : "category" - }, { - "$type" : "SimpleField", - "defaultValue" : "", - "editor" : { - "$type" : "EnumField" - }, - "require" : false, - "multiLanguage" : false, - "readonly" : false, - "label" : "enableStatus", - "name" : "启用状态", - "id" : "df3b84c2-dc6b-419c-85e3-0006b0535e61", - "type" : { - "$type" : "EnumType", - "displayName" : "枚举", - "name" : "Enum", - "enumValues" : [ { - "disabled" : false, - "name" : "未启用", - "value" : "0" - }, { - "disabled" : false, - "name" : "已启用", - "value" : "1" - } ], - "valueType" : { - "$type" : "StringType", - "displayName" : "字符串", - "length" : 36, - "name" : "String" - } - }, - "path" : "EnableStatus", - "code" : "EnableStatus", - "originalId" : "df3b84c2-dc6b-419c-85e3-0006b0535e61", - "bindingField" : "enableStatus", - "bindingPath" : "enableStatus" - } ], - "entities" : [ ], - "primary" : "id", - "displayName" : "通用字典", - "name" : "CommonDictionary" + ], + "Content": { + "code": null, + "name": null, + "Id": "af47af33-345b-471e-9a00-49db59c222a1", + "Contents": { + "module": { + "id": "af47af33-345b-471e-9a00-49db59c222a1", + "code": "MobileVueTest", + "name": "移动Vue测试", + "type": "Module", + "creator": "lijiangkun", + "creationDate": "2025-04-17T03:50:32.907Z", + "templateId": "list-card-template", + "templateRule": "list-card-template", + "entity": [ + { + "eapiId": "29245968-6379-4c6c-a812-72e3411917c0", + "eapiCode": null, + "eapiName": null, + "eapiNameSpace": null, + "voPath": null, + "voNameSpace": null, + "name": "移动Vue测试_mfrm", + "id": "0d20adf7-9ed1-44cf-a8f5-e9714353c174", + "extendProperties": { + "enableStdTimeFormat": true }, - "code" : "CommonDictionary" - } ], - "sourceUri" : "api/sagidemo/sagidememodule/v1.0/CommonDictionary_frm", - "code" : "CommonDictionary_frm", - "variables" : [ ], - "sourceType" : "vo", - "extendProperties" : { - "enableStdTimeFormat" : true + "sourceType": "vo", + "variables": [], + "code": "MobileVueTest_mfrm", + "entities": [ + { + "name": "Vue测试", + "id": "fa4b4e84-11b2-40ce-b071-7b2cd5b93eed", + "type": { + "$type": "EntityType", + "fields": [ + { + "$type": "SimpleField", + "defaultValue": "", + "editor": { + "$type": "TextBox" + }, + "readonly": false, + "multiLanguage": false, + "require": true, + "name": "主键", + "id": "389ab039-9b60-4dd0-8cdc-a23c0feccf31", + "type": { + "$type": "StringType", + "length": 36, + "name": "String", + "displayName": "字符串" + }, + "path": "ID", + "originalId": "389ab039-9b60-4dd0-8cdc-a23c0feccf31", + "code": "ID", + "label": "id", + "bindingField": "id", + "bindingPath": "id" + }, + { + "$type": "SimpleField", + "defaultValue": "", + "editor": { + "$type": "DateBox", + "format": "'yyyy-MM-dd'" + }, + "readonly": false, + "multiLanguage": false, + "require": false, + "name": "版本", + "id": "e3ca9955-1155-4a4b-a164-e48c31928c24", + "type": { + "$type": "DateTimeType", + "name": "DateTime", + "displayName": "日期时间" + }, + "path": "Version", + "originalId": "e3ca9955-1155-4a4b-a164-e48c31928c24", + "code": "Version", + "label": "version", + "bindingField": "version", + "bindingPath": "version" + }, + { + "$type": "ComplexField", + "name": "状态", + "id": "9fefd0ed-7594-43f7-a6f2-10828a4d00ae", + "type": { + "$type": "ObjectType", + "name": "BillState9fef", + "fields": [ + { + "$type": "SimpleField", + "defaultValue": "", + "editor": { + "$type": "EnumField" + }, + "readonly": false, + "multiLanguage": false, + "require": false, + "name": "状态", + "id": "9fefd0ed-0101-468f-ae3f-40c76c0f06b0", + "type": { + "$type": "EnumType", + "name": "Enum", + "displayName": "枚举", + "enumValues": [ + { + "disabled": false, + "name": "制单", + "value": "Billing" + }, + { + "disabled": false, + "name": "提交审批", + "value": "SubmitApproval" + }, + { + "disabled": false, + "name": "审批通过", + "value": "Approved" + }, + { + "disabled": false, + "name": "审批不通过", + "value": "ApprovalNotPassed" + } + ], + "valueType": { + "$type": "StringType", + "length": 36, + "name": "String", + "displayName": "字符串" + } + }, + "path": "BillStatus.BillState", + "originalId": "a0b19650-0101-468f-ae3f-40c76c0f06b0", + "code": "BillState", + "label": "billState", + "bindingField": "billStatus_BillState", + "bindingPath": "billStatus.billState" + } + ], + "displayName": "状态" + }, + "path": "BillStatus", + "originalId": "9fefd0ed-7594-43f7-a6f2-10828a4d00ae", + "code": "BillStatus", + "label": "billStatus", + "bindingField": "billStatus", + "bindingPath": "billStatus" + }, + { + "$type": "ComplexField", + "name": "流程实例", + "id": "12ef9c5c-4ba3-4df4-bd0f-5672c3e0ecff", + "type": { + "$type": "ObjectType", + "name": "ProcessInstance12ef", + "fields": [ + { + "$type": "SimpleField", + "defaultValue": "", + "editor": { + "$type": "TextBox" + }, + "readonly": false, + "multiLanguage": false, + "require": false, + "name": "流程实例", + "id": "12ef9c5c-ad8f-4da3-a430-c8a7f2162135", + "type": { + "$type": "StringType", + "length": 36, + "name": "String", + "displayName": "字符串" + }, + "path": "ProcessInstance.ProcessInstance", + "originalId": "2e1beb7d-ad8f-4da3-a430-c8a7f2162135", + "code": "ProcessInstance", + "label": "processInstance", + "bindingField": "processInstance_ProcessInstance", + "bindingPath": "processInstance.processInstance" + } + ], + "displayName": "流程实例" + }, + "path": "ProcessInstance", + "originalId": "12ef9c5c-4ba3-4df4-bd0f-5672c3e0ecff", + "code": "ProcessInstance", + "label": "processInstance", + "bindingField": "processInstance", + "bindingPath": "processInstance" + }, + { + "$type": "SimpleField", + "defaultValue": "", + "editor": { + "$type": "TextBox" + }, + "readonly": false, + "multiLanguage": false, + "require": false, + "name": "编号", + "id": "8537ca17-502f-4b90-ac87-ae1dde9a7f03", + "type": { + "$type": "StringType", + "length": 36, + "name": "String", + "displayName": "字符串" + }, + "path": "code", + "originalId": "8537ca17-502f-4b90-ac87-ae1dde9a7f03", + "code": "code", + "label": "code", + "bindingField": "code", + "bindingPath": "code" + }, + { + "$type": "SimpleField", + "defaultValue": "", + "editor": { + "$type": "TextBox" + }, + "readonly": false, + "multiLanguage": false, + "require": false, + "name": "名称", + "id": "6a051d6e-f870-4a9f-84df-043cfbc26cf2", + "type": { + "$type": "StringType", + "length": 36, + "name": "String", + "displayName": "字符串" + }, + "path": "name", + "originalId": "6a051d6e-f870-4a9f-84df-043cfbc26cf2", + "code": "name", + "label": "name", + "bindingField": "name", + "bindingPath": "name" + }, + { + "$type": "SimpleField", + "defaultValue": "", + "editor": { + "$type": "SwitchField" + }, + "readonly": false, + "multiLanguage": false, + "require": false, + "name": "布尔字段", + "id": "f51c1e5d-fe58-4591-8cd1-25a119c9f4c1", + "type": { + "$type": "BooleanType", + "name": "Boolean", + "displayName": "布尔" + }, + "path": "booleanField", + "originalId": "f51c1e5d-fe58-4591-8cd1-25a119c9f4c1", + "code": "booleanField", + "label": "booleanField", + "bindingField": "booleanField", + "bindingPath": "booleanField" + }, + { + "$type": "SimpleField", + "defaultValue": "", + "editor": { + "$type": "NumericBox" + }, + "readonly": false, + "multiLanguage": false, + "require": false, + "name": "数值字段", + "id": "1f816b38-2a72-4252-8eb6-760b8f97fcea", + "type": { + "$type": "NumericType", + "length": 0, + "name": "Number", + "displayName": "数字", + "precision": 0 + }, + "path": "numberField", + "originalId": "1f816b38-2a72-4252-8eb6-760b8f97fcea", + "code": "numberField", + "label": "numberField", + "bindingField": "numberField", + "bindingPath": "numberField" + }, + { + "$type": "SimpleField", + "defaultValue": "", + "editor": { + "$type": "DateBox", + "format": "'yyyy-MM-dd'" + }, + "readonly": false, + "multiLanguage": false, + "require": false, + "name": "日期字段", + "id": "4911913b-1868-4b34-b4e0-84939b14ab6e", + "type": { + "$type": "DateType", + "name": "Date", + "displayName": "日期" + }, + "path": "dateField", + "originalId": "4911913b-1868-4b34-b4e0-84939b14ab6e", + "code": "dateField", + "label": "dateField", + "bindingField": "dateField", + "bindingPath": "dateField" + } + ], + "primary": "id", + "entities": [ + { + "name": "子表1", + "id": "97347b0b-1c54-432f-891a-4d7b139d6dbc", + "type": { + "$type": "EntityType", + "fields": [ + { + "$type": "SimpleField", + "defaultValue": "", + "editor": { + "$type": "TextBox" + }, + "readonly": false, + "multiLanguage": false, + "require": true, + "name": "主键", + "id": "7d1363dc-bbb0-41ac-b52d-5cc12832bf58", + "type": { + "$type": "StringType", + "length": 36, + "name": "String", + "displayName": "字符串" + }, + "path": "ID", + "originalId": "7d1363dc-bbb0-41ac-b52d-5cc12832bf58", + "code": "ID", + "label": "id", + "bindingField": "id", + "bindingPath": "id" + }, + { + "$type": "SimpleField", + "defaultValue": "", + "editor": { + "$type": "TextBox" + }, + "readonly": false, + "multiLanguage": false, + "require": true, + "name": "上级对象主键", + "id": "750cc77b-6562-4c83-9e5b-80ad5abb7bb8", + "type": { + "$type": "StringType", + "length": 36, + "name": "String", + "displayName": "字符串" + }, + "path": "ParentID", + "originalId": "750cc77b-6562-4c83-9e5b-80ad5abb7bb8", + "code": "ParentID", + "label": "parentID", + "bindingField": "parentID", + "bindingPath": "parentID" + }, + { + "$type": "SimpleField", + "defaultValue": "", + "editor": { + "$type": "TextBox" + }, + "readonly": false, + "multiLanguage": false, + "require": false, + "name": "编号", + "id": "3c2b560e-5b8d-4781-b31f-719f83443df1", + "type": { + "$type": "StringType", + "length": 36, + "name": "String", + "displayName": "字符串" + }, + "path": "code", + "originalId": "3c2b560e-5b8d-4781-b31f-719f83443df1", + "code": "code", + "label": "code", + "bindingField": "code", + "bindingPath": "code" + }, + { + "$type": "SimpleField", + "defaultValue": "", + "editor": { + "$type": "TextBox" + }, + "readonly": false, + "multiLanguage": false, + "require": false, + "name": "名称", + "id": "f89eb4ab-8d41-4fb5-a99d-013bd9242150", + "type": { + "$type": "StringType", + "length": 36, + "name": "String", + "displayName": "字符串" + }, + "path": "name", + "originalId": "f89eb4ab-8d41-4fb5-a99d-013bd9242150", + "code": "name", + "label": "name", + "bindingField": "name", + "bindingPath": "name" + } + ], + "primary": "id", + "entities": [], + "name": "Child1", + "displayName": "子表1" + }, + "code": "Child1", + "label": "child1s" + }, + { + "name": "子表2", + "id": "e1c8145b-15d6-4a54-9d79-9149af8d6dc4", + "type": { + "$type": "EntityType", + "fields": [ + { + "$type": "SimpleField", + "defaultValue": "", + "editor": { + "$type": "TextBox" + }, + "readonly": false, + "multiLanguage": false, + "require": true, + "name": "主键", + "id": "3a1e8cf0-9ad2-4eeb-b16b-e898a8b24be4", + "type": { + "$type": "StringType", + "length": 36, + "name": "String", + "displayName": "字符串" + }, + "path": "ID", + "originalId": "3a1e8cf0-9ad2-4eeb-b16b-e898a8b24be4", + "code": "ID", + "label": "id", + "bindingField": "id", + "bindingPath": "id" + }, + { + "$type": "SimpleField", + "defaultValue": "", + "editor": { + "$type": "TextBox" + }, + "readonly": false, + "multiLanguage": false, + "require": true, + "name": "上级对象主键", + "id": "22649c9f-2483-4907-8a67-9fd70ce9b5e7", + "type": { + "$type": "StringType", + "length": 36, + "name": "String", + "displayName": "字符串" + }, + "path": "ParentID", + "originalId": "22649c9f-2483-4907-8a67-9fd70ce9b5e7", + "code": "ParentID", + "label": "parentID", + "bindingField": "parentID", + "bindingPath": "parentID" + }, + { + "$type": "SimpleField", + "defaultValue": "", + "editor": { + "$type": "TextBox" + }, + "readonly": false, + "multiLanguage": false, + "require": false, + "name": "编号", + "id": "bdc235f6-eded-443a-b95d-cf07fb4a741a", + "type": { + "$type": "StringType", + "length": 36, + "name": "String", + "displayName": "字符串" + }, + "path": "code", + "originalId": "bdc235f6-eded-443a-b95d-cf07fb4a741a", + "code": "code", + "label": "code", + "bindingField": "code", + "bindingPath": "code" + }, + { + "$type": "SimpleField", + "defaultValue": "", + "editor": { + "$type": "TextBox" + }, + "readonly": false, + "multiLanguage": false, + "require": false, + "name": "名称", + "id": "b5c97bc2-94e3-483c-8002-1352e103e9f6", + "type": { + "$type": "StringType", + "length": 36, + "name": "String", + "displayName": "字符串" + }, + "path": "name", + "originalId": "b5c97bc2-94e3-483c-8002-1352e103e9f6", + "code": "name", + "label": "name", + "bindingField": "name", + "bindingPath": "name" + } + ], + "primary": "id", + "entities": [], + "name": "Child2", + "displayName": "子表2" + }, + "code": "Child2", + "label": "child2s" + } + ], + "name": "VueTest", + "displayName": "Vue测试" + }, + "code": "VueTest", + "label": "vueTests" + } + ], + "sourceUri": "api/mydev/farrisvuetest/v1.0/MobileVueTest_mfrm" } - } ], - "states" : [ ], - "stateMachines" : [ { - "id" : "CommonDictionary_state_machine", - "name" : "通用字典", - "uri" : "cde50e74-98bb-484d-8c21-247c84e615e0", - "code" : "CommonDictionary_frm", - "nameSpace" : "Inspur.GS.SagiDemo.SagiDemeModule.CommonDictionaries.CommonDictionaries.Front" - } ], - "viewmodels" : [ { - "id" : "root-viewmodel", - "code" : "root-viewmodel", - "name" : "通用字典", - "fields" : [ ], - "stateMachine" : "CommonDictionary_state_machine", - "serviceRefs" : [ ], - "commands" : [ ], - "states" : [ ], - "bindTo" : "/", - "enableValidation" : false, - "enableUnifiedSession" : false - }, { - "id" : "data-grid-component-viewmodel", - "code" : "data-grid-component-viewmodel", - "name" : "通用字典", - "fields" : [ { - "type" : "Form", - "id" : "ddfc72d4-0c9b-49bf-8f41-8047264f6edc", - "fieldName" : "code", - "groupId" : null, - "groupName" : null, - "updateOn" : "blur" - }, { - "type" : "Form", - "id" : "1ecd5759-6df4-41c8-9526-0108a5e2d9b6", - "fieldName" : "name", - "groupId" : null, - "groupName" : null, - "updateOn" : "blur" - }, { - "type" : "Form", - "id" : "df3b84c2-dc6b-419c-85e3-0006b0535e61", - "fieldName" : "enableStatus", - "groupId" : null, - "groupName" : null, - "updateOn" : "change" - } ], - "commands" : [ { - "id" : "fda876c8-7230-46e7-af3d-d38233642275", - "code" : "loadList1", - "name" : "加载列表数据", - "params" : [ ], - "handlerName" : "loadList", - "cmpId" : "7c48ef46-339c-42d4-8365-a21236c63044", - "extensions" : [ ], - "isInvalid" : false - }, { - "id" : "22576fc1-08fb-49a9-b132-295c7392b481", - "code" : "remove1", - "name" : "删除当前数据", - "params" : [ { - "name" : "id", - "shownName" : "待删除数据的标识", - "value" : "{DATA~/id}" - } ], - "handlerName" : "remove", - "cmpId" : "7c48ef46-339c-42d4-8365-a21236c63044", - "extensions" : [ ], - "isInvalid" : false - }, { - "id" : "8788c27e-722a-4b98-9d57-98eafb526fe5", - "code" : "loadCard1", - "name" : "加载卡片数据", - "params" : [ ], - "handlerName" : "loadCard", - "cmpId" : "7c48ef46-339c-42d4-8365-a21236c63044", - "extensions" : [ ], - "isInvalid" : false - }, { - "id" : "ef281c13-4480-4256-901e-4bef5f92bd9e", - "code" : "add1", - "name" : "新增一条数据", - "params" : [ ], - "handlerName" : "add", - "cmpId" : "7c48ef46-339c-42d4-8365-a21236c63044", - "extensions" : [ ], - "isInvalid" : false - }, { - "id" : "e7cf83c2-e52d-4dce-aded-047a819c8068", - "code" : "changePage1", - "name" : "切换页码", - "params" : [ { - "name" : "loadCommandName", - "shownName" : "切换页面后回调方法", - "value" : "loadList1" - }, { - "name" : "loadCommandFrameId", - "shownName" : "目标组件", - "value" : "data-grid-component" - } ], - "handlerName" : "changePage", - "cmpId" : "7c48ef46-339c-42d4-8365-a21236c63044", - "extensions" : [ ], - "isInvalid" : false - } ], - "serviceRefs" : [ ], - "states" : [ ], - "bindTo" : "/", - "parent" : "root-viewmodel", - "enableValidation" : false - }, { - "id" : "detail-form-component-viewmodel", - "code" : "detail-form-component-viewmodel", - "name" : "通用字典", - "fields" : [ { - "type" : "Form", - "id" : "ddfc72d4-0c9b-49bf-8f41-8047264f6edc", - "fieldName" : "code", - "groupId" : null, - "groupName" : null, - "updateOn" : "blur" - }, { - "type" : "Form", - "id" : "1ecd5759-6df4-41c8-9526-0108a5e2d9b6", - "fieldName" : "name", - "groupId" : null, - "groupName" : null, - "updateOn" : "blur" - }, { - "type" : "Form", - "id" : "8e00ef40-17ba-4cbb-8a3c-709cf40b7939", - "fieldName" : "category", - "groupId" : null, - "groupName" : null, - "updateOn" : "blur" - } ], - "commands" : [ { - "id" : "d12acc4e-6274-44dc-95e6-cedeb5e66707", - "code" : "edit1", - "name" : "编辑数据", - "params" : [ { - "name" : "id", - "shownName" : "待编辑数据的标识", - "value" : "{DATA~/id}" - }, { - "name" : "transitionAction", - "shownName" : "状态机动作", - "value" : "Edit" - } ], - "handlerName" : "edit", - "cmpId" : "7c48ef46-339c-42d4-8365-a21236c63044", - "extensions" : [ ], - "isInvalid" : false - }, { - "id" : "5707d460-c441-45c4-8fe1-f77abd9f75b1", - "code" : "save1", - "name" : "保存变更", - "params" : [ ], - "handlerName" : "save", - "cmpId" : "7c48ef46-339c-42d4-8365-a21236c63044", - "extensions" : [ ], - "isInvalid" : false - }, { - "id" : "b3897b4b-a37f-48e3-afb3-8489cec02806", - "code" : "cancel1", - "name" : "取消变更", - "params" : [ ], - "handlerName" : "cancel", - "cmpId" : "7c48ef46-339c-42d4-8365-a21236c63044", - "extensions" : [ ], - "isInvalid" : false - } ], - "serviceRefs" : [ ], - "states" : [ ], - "bindTo" : "/", - "parent" : "root-viewmodel", - "enableValidation" : true - } ], - "components" : [ { - "id" : "root-component", - "type" : "component", - "componentType" : "frame", - "viewModel" : "root-viewmodel", - "contents" : [ { - "id" : "root-layout", - "type" : "content-container", - "appearance" : { - "class" : "f-page f-page-navigate f-page-is-grid-card" - }, - "contents" : [ { - "id" : "page-header", - "type" : "page-header", - "appearance" : { - "class" : "f-page-header" + ], + "states": [], + "stateMachines": [ + { + "id": "MobileVueTest_list-page-component_state_machine", + "name": "移动Vue测试_list-page-component状态机", + "uri": "74843186-76b9-4ab3-8fad-c8ba64390c3c" + }, + { + "id": "MobileVueTest_card-page-component_state_machine", + "name": "移动Vue测试_card-page-component状态机", + "uri": "a39bf6b2-330a-4000-9d5e-82aa1c457edf" + } + ], + "viewmodels": [ + { + "id": "list-page-viewmodel", + "code": "list-page-viewmodel", + "name": "Vue测试", + "fields": [], + "stateMachine": "MobileVueTest_list-page-component_state_machine", + "commands": [ + { + "id": "LoadPageForList", + "code": "LoadPageForList", + "name": "页面加载命令", + "params": [ + { + "name": "commandName", + "shownName": "命令名称", + "value": "LoadDataForList" + }, + { + "name": "viewModelId", + "shownName": "视图模型id", + "value": "" + } + ], + "handlerName": "LoadPageForList", + "cmpId": "cf5e568a-5243-4539-94ea-e195eb4d6736", + "extensions": [], + "isInvalid": false + }, + { + "id": "LoadDataForList", + "code": "LoadDataForList", + "name": "列表取数命令", + "params": [ + { + "name": "filters", + "shownName": "过滤条件", + "value": "[]" + }, + { + "name": "sorts", + "shownName": "排序条件", + "value": "[]" + }, + { + "name": "autoMerge", + "shownName": "是否合并过滤条件", + "value": true + } + ], + "handlerName": "LoadForList", + "cmpId": "0a68799b-48c6-4c9f-b0d7-140683c62b58", + "extensions": [], + "isInvalid": false + }, + { + "id": "OpenCardAndAdd", + "code": "OpenCardAndAdd", + "name": "打开卡片并新增命令", + "params": [ + { + "name": "path", + "shownName": "路由地址", + "value": "/MobileVueTest/card-page-component" + }, + { + "name": "queryParams", + "shownName": "携带参数", + "value": "{ \"action\": \"LoadAndAddForCard\" }" + } + ], + "handlerName": "Navigate", + "cmpId": "910661bd-963a-4287-aa32-441c95b8720f", + "extensions": [], + "isInvalid": false }, - "iconClass" : "f-title-icon f-text-orna-dict", - "icon" : "f-icon f-icon-page-title-dictionary", - "title" : "通用字典", - "toolbar" : { - "type" : "response-toolbar", - "buttons" : [ { - "id" : "button-add", - "type" : "response-toolbar-item", - "appearance" : { - "class" : "btn-primary" + { + "id": "OpenCardAndEdit", + "code": "OpenCardAndEdit", + "name": "打开卡片并编辑命令", + "params": [ + { + "name": "path", + "shownName": "路由地址", + "value": "/MobileVueTest/card-page-component" }, - "disabled" : "!viewModel.stateMachine['canAdd']", - "onClick" : "root-viewmodel.data-grid-component-viewmodel.add1", - "text" : "新增" - }, { - "id" : "button-edit", - "type" : "response-toolbar-item", - "text" : "编辑", - "disabled" : "!viewModel.stateMachine['canEdit']", - "onClick" : "root-viewmodel.detail-form-component-viewmodel.edit1" - }, { - "id" : "button-save", - "type" : "response-toolbar-item", - "text" : "保存", - "disabled" : "!viewModel.stateMachine['canSave']", - "onClick" : "root-viewmodel.detail-form-component-viewmodel.save1" - }, { - "id" : "button-cancel", - "type" : "response-toolbar-item", - "text" : "取消", - "disabled" : "!viewModel.stateMachine['canCancel']", - "onClick" : "root-viewmodel.detail-form-component-viewmodel.cancel1" - }, { - "id" : "button-delete", - "type" : "response-toolbar-item", - "text" : "删除", - "disabled" : "!viewModel.stateMachine['canRemove']", - "onClick" : "root-viewmodel.data-grid-component-viewmodel.remove1" - } ] + { + "name": "queryParams", + "shownName": "携带参数", + "value": "{ \"action\": \"LoadAndEditForCard\", \"id\":\"{DATA~/id}\"}" + } + ], + "handlerName": "Navigate", + "cmpId": "910661bd-963a-4287-aa32-441c95b8720f", + "extensions": [], + "isInvalid": false + }, + { + "id": "OpenCardAndView", + "code": "OpenCardAndView", + "name": "打开卡片并查看命令", + "params": [ + { + "name": "path", + "shownName": "路由地址", + "value": "/MobileVueTest/card-page-component" + }, + { + "name": "queryParams", + "shownName": "携带参数", + "value": "{ \"action\": \"LoadAndViewForCard\", \"id\":\"{DATA~/id}\"}" + } + ], + "handlerName": "Navigate", + "cmpId": "910661bd-963a-4287-aa32-441c95b8720f", + "extensions": [], + "isInvalid": false + }, + { + "id": "RemoveById", + "code": "RemoveById", + "name": "删除命令", + "params": [ + { + "name": "id", + "shownName": "数据id", + "value": "{DATA~/id}" + } + ], + "handlerName": "RemoveById", + "cmpId": "dab6b7f1-f56f-490a-879c-3d74232cd3ba", + "extensions": [], + "isInvalid": false + }, + { + "id": "RemoveByIds", + "code": "RemoveByIds", + "name": "批量删除命令", + "params": [ + { + "name": "ids", + "shownName": "数据id的数组", + "value": "" + } + ], + "handlerName": "RemoveByIds", + "cmpId": "dab6b7f1-f56f-490a-879c-3d74232cd3ba", + "extensions": [], + "isInvalid": false + }, + { + "id": "GoBack", + "code": "GoBack", + "name": "返回命令", + "params": [ + { + "name": "params", + "shownName": "携带参数", + "value": "{}" + } + ], + "handlerName": "GoBack", + "cmpId": "910661bd-963a-4287-aa32-441c95b8720f", + "extensions": [], + "isInvalid": false + }, + { + "id": "77a277bf-6db3-4f7c-9418-1c12212ccab0", + "code": "componentOnBeforeInit", + "name": "列表页面初始化前事件", + "params": [], + "handlerName": "componentOnBeforeInit", + "cmpId": "791cc5d9-65f9-40d0-b40c-444c7bc1afa3", + "shortcut": {}, + "extensions": [], + "isInvalid": false } - }, { - "id" : "main-container", - "type" : "content-container", - "appearance" : { - "class" : "f-page-main" + ], + "states": [], + "bindTo": "/", + "parent": null, + "enableValidation": false + }, + { + "id": "card-page-viewmodel", + "code": "card-page-viewmodel", + "name": "卡片页面视图模型", + "fields": [ + { + "type": "Form", + "id": "389ab039-9b60-4dd0-8cdc-a23c0feccf31", + "fieldName": "id", + "groupId": null, + "groupName": null, + "updateOn": "blur" }, - "contents" : [ { - "id" : "content-splitter", - "type" : "splitter", - "appearance" : { - "class" : "f-page-content" - }, - "contents" : [ { - "id" : "content-list", - "type" : "splitter-pane", - "appearance" : { - "class" : "f-col-w6 f-page-content-nav" + { + "type": "Form", + "id": "e3ca9955-1155-4a4b-a164-e48c31928c24", + "fieldName": "version", + "groupId": null, + "groupName": null, + "updateOn": "blur" + }, + { + "type": "Form", + "id": "9fefd0ed-0101-468f-ae3f-40c76c0f06b0", + "fieldName": "billStatus_BillState", + "groupId": null, + "groupName": null, + "updateOn": "change" + }, + { + "type": "Form", + "id": "12ef9c5c-ad8f-4da3-a430-c8a7f2162135", + "fieldName": "processInstance_ProcessInstance", + "groupId": null, + "groupName": null, + "updateOn": "blur" + }, + { + "type": "Form", + "id": "8537ca17-502f-4b90-ac87-ae1dde9a7f03", + "fieldName": "code", + "groupId": null, + "groupName": null, + "updateOn": "blur" + }, + { + "type": "Form", + "id": "6a051d6e-f870-4a9f-84df-043cfbc26cf2", + "fieldName": "name", + "groupId": null, + "groupName": null, + "updateOn": "blur" + }, + { + "type": "Form", + "id": "f51c1e5d-fe58-4591-8cd1-25a119c9f4c1", + "fieldName": "booleanField", + "groupId": null, + "groupName": null, + "updateOn": "blur" + }, + { + "type": "Form", + "id": "1f816b38-2a72-4252-8eb6-760b8f97fcea", + "fieldName": "numberField", + "groupId": null, + "groupName": null, + "updateOn": "blur" + }, + { + "type": "Form", + "id": "4911913b-1868-4b34-b4e0-84939b14ab6e", + "fieldName": "dateField", + "groupId": null, + "groupName": null, + "updateOn": "blur" + } + ], + "stateMachine": "MobileVueTest_card-page-component_state_machine", + "commands": [ + { + "id": "LoadPageForCard", + "code": "LoadPageForCard", + "name": "卡片页面加载命令", + "params": [ + { + "name": "commandName", + "shownName": "命令名称", + "value": "{UISTATE~/#{card-page-component}/routerState/queryParams/action}" }, - "resizable" : true, - "contents" : [ { - "id" : "data-grid-component-ref", - "type" : "component-ref", - "component" : "data-grid-component" - } ] - }, { - "id" : "content-main", - "type" : "splitter-pane", - "appearance" : { - "class" : "f-page-content-main" + { + "name": "viewModelId", + "shownName": "视图模型id", + "value": "" + } + ], + "handlerName": "LoadPageForCard", + "cmpId": "cf5e568a-5243-4539-94ea-e195eb4d6736", + "extensions": [], + "isInvalid": false + }, + { + "id": "LoadAndAddForCard", + "code": "LoadAndAddForCard", + "name": "卡片加载并新增命令", + "params": [ + { + "name": "action", + "shownName": "状态迁移动作", + "value": "editAction" + } + ], + "handlerName": "LoadAndAddForCard", + "cmpId": "0a68799b-48c6-4c9f-b0d7-140683c62b58", + "extensions": [], + "isInvalid": false + }, + { + "id": "LoadAndEditForCard", + "code": "LoadAndEditForCard", + "name": "卡片加载并编辑命令", + "params": [ + { + "name": "id", + "shownName": "数据id", + "value": "{UISTATE~/#{card-page-component}/routerState/queryParams/id}" }, - "contents" : [ { - "id" : "detail-component-ref", - "type" : "component-ref", - "component" : "detail-form-component" - } ] - } ] - } ] - } ] - } ] - }, { - "id" : "data-grid-component", - "type" : "component", - "componentType" : "data-grid", - "viewModel" : "data-grid-component-viewmodel", - "appearance" : { - "class" : "f-struct-wrapper f-utils-fill-flex-column" + { + "name": "action", + "shownName": "状态迁移动作", + "value": "editAction" + } + ], + "handlerName": "LoadAndEditForCard", + "cmpId": "0a68799b-48c6-4c9f-b0d7-140683c62b58", + "extensions": [], + "isInvalid": false + }, + { + "id": "LoadAndViewForCard", + "code": "LoadAndViewForCard", + "name": "卡片加载并查看命令", + "params": [ + { + "name": "id", + "shownName": "数据id", + "value": "{UISTATE~/#{card-page-component}/routerState/queryParams/id}" + }, + { + "name": "action", + "shownName": "状态迁移动作", + "value": "viewAction" + } + ], + "handlerName": "LoadAndViewForCard", + "cmpId": "0a68799b-48c6-4c9f-b0d7-140683c62b58", + "extensions": [], + "isInvalid": false + }, + { + "id": "Save", + "code": "Save", + "name": "保存命令", + "params": [ + { + "name": "action", + "shownName": "状态迁移动作", + "value": null + } + ], + "handlerName": "Save", + "cmpId": "f863c66a-bf93-4d1f-9f99-bcd76009609d", + "extensions": [], + "isInvalid": false + }, + { + "id": "Cancel", + "code": "Cancel", + "name": "取消命令", + "params": [ + { + "name": "id", + "shownName": "数据id", + "value": "{DATA~/id}" + }, + { + "name": "action", + "shownName": "迁移动作", + "value": null + } + ], + "handlerName": "Cancel", + "cmpId": "05592163-fd45-474e-b0ab-61d7dc02e5c0", + "extensions": [], + "isInvalid": false + }, + { + "id": "GoBackAndCheck", + "code": "GoBackAndCheck", + "name": "返回并检查", + "params": [ + { + "name": "params", + "shownName": "返回携带参数", + "value": "{}" + } + ], + "handlerName": "GoBackAndCheck", + "cmpId": "910661bd-963a-4287-aa32-441c95b8720f", + "extensions": [], + "isInvalid": false + } + ], + "states": [], + "bindTo": "/", + "parent": null, + "enableValidation": false + } + ], + "components": [ + { + "id": "list-page-component", + "type": "component", + "title": "列表页面", + "componentType": "page", + "pageType": "List", + "viewModel": "list-page-viewmodel", + "appearance": null, + "visible": true, + "onBeforeInit": "componentOnBeforeInit", + "onInit": "LoadPageForList", + "onLoadData": "LoadDataForList", + "goBack": "GoBack", + "contents": [ + { + "id": "list-page-container", + "type": "page-container", + "title": "页面根容器", + "appearance": null, + "visible": true, + "contents": [ + { + "id": "list-page-header-container", + "type": "page-header-container", + "title": "页头容器", + "appearance": null, + "visible": true, + "contents": [ + { + "id": "list-page-navigation-bar", + "type": "navbar", + "appearance": null, + "title": "列表页面", + "text": "导航栏", + "visible": true, + "onLeftClick": "GoBack", + "rightToolbar": { + "items": [] + } + } + ] + }, + { + "id": "list-page-body-container", + "type": "page-body-container", + "title": "主内容容器", + "appearance": null, + "visible": true, + "contents": [ + { + "id": "listView", + "type": "list-view", + "title": "列表", + "onItemClick": "OpenCardAndEdit", + "appearance": null, + "dataSource": "vueTests", + "fill": true, + "enablePullUpLoad": true, + "enablePullDownRefresh": true, + "itemTemplate": "
\r\n\t
\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t主键:{{item.id}}\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t
\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t版本:{{item.version}}\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t
\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t状态:{{$formatUtils.enum(item.billStatus.billState,{enumData:[{\"disabled\":false,\"name\":\"制单\",\"value\":\"Billing\"},{\"disabled\":false,\"name\":\"提交审批\",\"value\":\"SubmitApproval\"},{\"disabled\":false,\"name\":\"审批通过\",\"value\":\"Approved\"},{\"disabled\":false,\"name\":\"审批不通过\",\"value\":\"ApprovalNotPassed\"}]})}}\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t
\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t流程实例:{{item.processInstance.processInstance}}\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t
\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t编号:{{item.code}}\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t
\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t名称:{{item.name}}\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t
\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t布尔字段:{{$formatUtils.bool(item.booleanField)}}\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t
\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t数值字段:{{item.numberField}}\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t
\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t日期字段:{{$formatUtils.date(item.dateField,'yyyy-MM-dd')}}\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t
\r\n\t
\r\n
", + "visible": true, + "swipeToolbar": { + "id": "listView-swipe-toolbar", + "title": "列表滑动工具栏", + "type": "tool-bar", + "items": [ + { + "id": "listView-del-toobaritem", + "type": "tool-bar-item", + "visible": true, + "text": "删除", + "onClick": "RemoveById" + } + ] + }, + "toolbar": { + "items": [] + } + } + ] + }, + { + "id": "list-page-float-container", + "type": "float-container", + "title": "浮动容器", + "appearance": null, + "position": { + "right": 30, + "bottom": 60 + }, + "visible": true, + "contents": [ + { + "id": "list-page-add-button", + "appearance": {}, + "type": "button", + "title": "新增", + "displayType": "primary", + "onClick": "OpenCardAndAdd", + "disabled": false, + "round": true, + "block": true, + "buttonSize": "normal", + "icon": "s-plus", + "text": "", + "size": { + "width": 44, + "height": 44 + }, + "visible": true + } + ] + } + ] + } + ], + "route": { + "id": "list-page-component", + "uri": "list-page-component", + "name": "list-page-component", + "params": [] + } }, - "onInit" : "loadList1", - "contents" : [ { - "id" : "data-grid-section", - "type" : "section", - "appearance" : { - "class" : "f-section-grid f-section-in-nav" - }, - "fill" : true, - "showHeader" : false, - "contents" : [ { - "id" : "dataGrid", - "type" : "data-grid", - "appearance" : { - "class" : "f-component-grid" + { + "id": "card-page-component", + "type": "component", + "title": "卡片页面", + "componentType": "page", + "pageType": "Card", + "viewModel": "card-page-viewmodel", + "appearance": null, + "visible": true, + "onBeforeInit": null, + "onInit": "LoadPageForCard", + "onLoadData": null, + "goBack": "GoBackAndCheck", + "contents": [ + { + "id": "card-page-container", + "type": "page-container", + "title": "页面根容器", + "appearance": null, + "visible": true, + "contents": [ + { + "id": "card-page-header-container", + "type": "page-header-container", + "title": "页头容器", + "appearance": null, + "visible": true, + "contents": [ + { + "id": "card-page-navigation-bar", + "type": "navbar", + "appearance": null, + "title": "卡片页面", + "text": "导航栏", + "visible": true, + "onLeftClick": "GoBackAndCheck", + "rightToolbar": { + "items": [ + { + "id": "add-btn", + "type": "tool-bar-item", + "appearance": null, + "iconType": "", + "disabled": false, + "text": "新增", + "visible": true, + "onClick": "LoadAndAddForCard" + }, + { + "id": "cancel-btn", + "type": "tool-bar-item", + "appearance": null, + "iconType": "", + "disabled": false, + "text": "取消", + "visible": true, + "onClick": "Cancel" + } + ] + } + } + ] + }, + { + "id": "card-page-body-container", + "type": "page-body-container", + "title": "主内容容器", + "appearance": null, + "visible": true, + "contents": [ + { + "id": "card-page-form-container", + "type": "form", + "title": "Form组件容器", + "appearance": null, + "contents": [ + { + "id": "form_id", + "type": "form-group", + "appearance": null, + "label": "主键", + "binding": { + "type": "Form", + "path": "id", + "field": "389ab039-9b60-4dd0-8cdc-a23c0feccf31", + "fullPath": "ID" + }, + "editor": { + "type": "input-group", + "required": true, + "readonly": { + "type": "StateMachine", + "field": "canEdit", + "status": false + }, + "maxLength": 36 + }, + "path": "id" + }, + { + "id": "form_version", + "type": "form-group", + "appearance": null, + "label": "版本", + "binding": { + "type": "Form", + "path": "version", + "field": "e3ca9955-1155-4a4b-a164-e48c31928c24", + "fullPath": "Version" + }, + "editor": { + "type": "datetime-picker", + "required": false, + "readonly": { + "type": "StateMachine", + "field": "canEdit", + "status": false + }, + "displayFormat": "yyyy-MM-dd HH:mm:ss" + }, + "path": "version" + }, + { + "id": "form_billStatus_BillState", + "type": "form-group", + "appearance": null, + "label": "状态", + "binding": { + "type": "Form", + "path": "billStatus_BillState", + "field": "9fefd0ed-0101-468f-ae3f-40c76c0f06b0", + "fullPath": "BillStatus.BillState" + }, + "editor": { + "type": "picker", + "data": [ + { + "disabled": false, + "name": "制单", + "value": "Billing" + }, + { + "disabled": false, + "name": "提交审批", + "value": "SubmitApproval" + }, + { + "disabled": false, + "name": "审批通过", + "value": "Approved" + }, + { + "disabled": false, + "name": "审批不通过", + "value": "ApprovalNotPassed" + } + ], + "textField": "name", + "valueField": "value", + "required": false, + "readonly": { + "type": "StateMachine", + "field": "canEdit", + "status": false + } + }, + "path": "billStatus.billState" + }, + { + "id": "form_processInstance_ProcessInstance", + "type": "form-group", + "appearance": null, + "label": "流程实例", + "binding": { + "type": "Form", + "path": "processInstance_ProcessInstance", + "field": "12ef9c5c-ad8f-4da3-a430-c8a7f2162135", + "fullPath": "ProcessInstance.ProcessInstance" + }, + "editor": { + "type": "input-group", + "required": false, + "readonly": { + "type": "StateMachine", + "field": "canEdit", + "status": false + }, + "maxLength": 36 + }, + "path": "processInstance.processInstance" + }, + { + "id": "form_code", + "type": "form-group", + "appearance": null, + "label": "编号", + "binding": { + "type": "Form", + "path": "code", + "field": "8537ca17-502f-4b90-ac87-ae1dde9a7f03", + "fullPath": "code" + }, + "editor": { + "type": "input-group", + "required": false, + "readonly": { + "type": "StateMachine", + "field": "canEdit", + "status": false + }, + "maxLength": 36 + }, + "path": "code" + }, + { + "id": "form_name", + "type": "form-group", + "appearance": null, + "label": "名称", + "binding": { + "type": "Form", + "path": "name", + "field": "6a051d6e-f870-4a9f-84df-043cfbc26cf2", + "fullPath": "name" + }, + "editor": { + "type": "input-group", + "required": false, + "readonly": { + "type": "StateMachine", + "field": "canEdit", + "status": false + }, + "maxLength": 36 + }, + "path": "name" + }, + { + "id": "form_booleanField", + "type": "form-group", + "appearance": null, + "label": "布尔字段", + "binding": { + "type": "Form", + "path": "booleanField", + "field": "f51c1e5d-fe58-4591-8cd1-25a119c9f4c1", + "fullPath": "booleanField" + }, + "editor": { + "type": "switch", + "required": false, + "readonly": { + "type": "StateMachine", + "field": "canEdit", + "status": false + } + }, + "path": "booleanField" + }, + { + "id": "form_numberField", + "type": "form-group", + "appearance": null, + "label": "数值字段", + "binding": { + "type": "Form", + "path": "numberField", + "field": "1f816b38-2a72-4252-8eb6-760b8f97fcea", + "fullPath": "numberField" + }, + "editor": { + "type": "number-input", + "precision": 0, + "required": false, + "readonly": { + "type": "StateMachine", + "field": "canEdit", + "status": false + }, + "maxLength": 0 + }, + "path": "numberField" + }, + { + "id": "form_dateField", + "type": "form-group", + "appearance": null, + "label": "日期字段", + "binding": { + "type": "Form", + "path": "dateField", + "field": "4911913b-1868-4b34-b4e0-84939b14ab6e", + "fullPath": "dateField" + }, + "editor": { + "type": "date-picker", + "required": false, + "readonly": { + "type": "StateMachine", + "field": "canEdit", + "status": false + }, + "displayFormat": "yyyy-MM-dd" + }, + "path": "dateField" + } + ] + } + ] + }, + { + "id": "card-page-footer-container", + "type": "page-footer-container", + "title": "页尾容器", + "appearance": null, + "size": null, + "position": null, + "visible": true, + "contents": [ + { + "id": "card-page-buttongroup-container", + "type": "content-container", + "appearance": null, + "size": null, + "padding": { + "left": 16, + "right": 16, + "top": 8, + "bottom": 8 + }, + "display": "flex", + "flexBox": { + "direction": "row" + }, + "visible": true, + "title": "按钮组容器", + "contents": [ + { + "id": "card-page-save-button", + "type": "button", + "title": "保存按钮", + "visible": true, + "round": true, + "disabled": false, + "text": "按钮", + "icon": "图标", + "block": true, + "displayType": "primary", + "onClick": "Save" + } + ] + } + ] + } + ] + } + ], + "route": { + "id": "card-page-component", + "uri": "card-page-component", + "name": "card-page-component", + "params": [] + } + } + ], + "webcmds": [ + { + "id": "cf5e568a-5243-4539-94ea-e195eb4d6736", + "path": "Gsp/Mobile/MobileCmp/bo-mobilecmp/metadata/webcmd", + "name": "LoadPageCommands.webcmd", + "refedHandlers": [ + { + "host": "LoadPageForList", + "handler": "LoadPageForList" }, - "dataSource" : "commonDictionarys", - "columns" : [ { - "id" : "code_ddfc72d4_hxcr", - "type" : "data-grid-column", - "title" : "编号", - "field" : "code", - "dataType" : "string", - "binding" : { - "type" : "Form", - "path" : "code", - "field" : "ddfc72d4-0c9b-49bf-8f41-8047264f6edc", - "fullPath" : "Code" - }, - "width" : 120, - "visible" : true, - "filter" : "", - "showSetting" : false, - "actualWidth" : 120 - }, { - "id" : "name_1ecd5759_yj0s", - "type" : "data-grid-column", - "title" : "名称", - "field" : "name", - "dataType" : "string", - "binding" : { - "type" : "Form", - "path" : "name", - "field" : "1ecd5759-6df4-41c8-9526-0108a5e2d9b6", - "fullPath" : "Name" - }, - "width" : 120, - "visible" : true, - "filter" : "", - "showSetting" : false, - "actualWidth" : 120 - }, { - "id" : "enableStatus_df3b84c2_jhvi", - "type" : "data-grid-column", - "title" : "启用状态", - "field" : "enableStatus", - "dataType" : "enum", - "binding" : { - "type" : "Form", - "path" : "enableStatus", - "field" : "df3b84c2-dc6b-419c-85e3-0006b0535e61", - "fullPath" : "EnableStatus" - }, - "width" : 120, - "formatter" : { - "type" : "enum", - "data" : [ { - "disabled" : false, - "name" : "未启用", - "value" : "0" - }, { - "disabled" : false, - "name" : "已启用", - "value" : "1" - } ] - }, - "visible" : true, - "filter" : "", - "showSetting" : true, - "actualWidth" : 120 - } ], - "fieldEditable" : false, - "onClickRow" : "loadCard1", - "onPageIndexChanged" : "changePage1", - "onPageSizeChanged" : "changePage1", - "pagination" : { - "enable" : true, - "mode" : "server" + { + "host": "LoadPageForCard", + "handler": "LoadPageForCard" + } + ], + "code": "LoadPageCommands", + "nameSpace": "Inspur.GS.Gsp.Mobile.MobileCmp" + }, + { + "id": "0a68799b-48c6-4c9f-b0d7-140683c62b58", + "path": "Gsp/Mobile/MobileCmp/bo-mobilecmp/metadata/webcmd", + "name": "LoadCommands.webcmd", + "refedHandlers": [ + { + "host": "LoadDataForList", + "handler": "LoadForList" }, - "disabled" : "viewModel.stateMachine['editable']" - } ] - } ] - }, { - "id" : "detail-form-component", - "type" : "component", - "componentType" : "form", - "formColumns" : 1, - "viewModel" : "detail-form-component-viewmodel", - "appearance" : { - "class" : "f-struct-wrapper" + { + "host": "LoadAndAddForCard", + "handler": "LoadAndAddForCard" + }, + { + "host": "LoadAndEditForCard", + "handler": "LoadAndEditForCard" + }, + { + "host": "LoadAndViewForCard", + "handler": "LoadAndViewForCard" + } + ], + "code": "LoadCommands", + "nameSpace": "Inspur.GS.Gsp.Mobile.MobileCmp" }, - "contents" : [ { - "id" : "detail-form-section", - "type" : "section", - "appearance" : { - "class" : "f-section-form f-section-in-main" - }, - "mainTitle" : "基本信息", - "contents" : [ { - "id" : "detail-form-layout", - "type" : "response-form", - "appearance" : { - "class" : "f-form-layout farris-form farris-form-controls-inline" + { + "id": "910661bd-963a-4287-aa32-441c95b8720f", + "path": "Gsp/Mobile/MobileCmp/bo-mobilecmp/metadata/webcmd", + "name": "NavigateCommands.webcmd", + "refedHandlers": [ + { + "host": "OpenCardAndAdd", + "handler": "Navigate" }, - "contents" : [ { - "id" : "code_ddfc72d4_njzh", - "type" : "form-group", - "appearance" : { - "class" : "col-12" - }, - "label" : "编号", - "binding" : { - "type" : "Form", - "path" : "code", - "field" : "ddfc72d4-0c9b-49bf-8f41-8047264f6edc", - "fullPath" : "Code" - }, - "editor" : { - "type" : "input-group", - "readonly" : "!viewModel.stateMachine['editable']", - "maxLength" : 36 - }, - "path" : "code" - }, { - "id" : "name_1ecd5759_onbj", - "type" : "form-group", - "appearance" : { - "class" : "col-12" - }, - "label" : "名称", - "binding" : { - "type" : "Form", - "path" : "name", - "field" : "1ecd5759-6df4-41c8-9526-0108a5e2d9b6", - "fullPath" : "Name" - }, - "editor" : { - "type" : "input-group", - "readonly" : "!viewModel.stateMachine['editable']", - "maxLength" : 36 - }, - "path" : "name" - }, { - "id" : "category_8e00ef40_wdtg", - "type" : "form-group", - "appearance" : { - "class" : "col-12" - }, - "label" : "分类", - "binding" : { - "type" : "Form", - "path" : "category", - "field" : "8e00ef40-17ba-4cbb-8a3c-709cf40b7939", - "fullPath" : "Category" - }, - "editor" : { - "type" : "input-group", - "readonly" : "!viewModel.stateMachine['editable']", - "maxLength" : 36 - }, - "path" : "category" - } ], - "controlsInline" : true, - "formAutoIntl" : true - } ] - } ] - } ], - "webcmds" : [ { - "id" : "7c48ef46-339c-42d4-8365-a21236c63044", - "path" : "/projects/packages/Inspur.GS.Gsp.Web.WebCmp/webcmd", - "name" : "ListCardController.webcmd", - "refedHandlers" : [ { - "host" : "fda876c8-7230-46e7-af3d-d38233642275", - "handler" : "loadList" - }, { - "host" : "8788c27e-722a-4b98-9d57-98eafb526fe5", - "handler" : "loadCard" - }, { - "host" : "ef281c13-4480-4256-901e-4bef5f92bd9e", - "handler" : "add" - }, { - "host" : "d12acc4e-6274-44dc-95e6-cedeb5e66707", - "handler" : "edit" - }, { - "host" : "5707d460-c441-45c4-8fe1-f77abd9f75b1", - "handler" : "save" - }, { - "host" : "b3897b4b-a37f-48e3-afb3-8489cec02806", - "handler" : "cancel" - }, { - "host" : "22576fc1-08fb-49a9-b132-295c7392b481", - "handler" : "remove" - }, { - "host" : "e7cf83c2-e52d-4dce-aded-047a819c8068", - "handler" : "changePage" - } ], - "code" : "ListCardController", - "nameSpace" : "Inspur.GS.Gsp.Web.WebCmp" - } ], - "projectName" : "bo-commondictionaries-front", - "actions" : [ ] + { + "host": "OpenCardAndEdit", + "handler": "Navigate" + }, + { + "host": "OpenCardAndView", + "handler": "Navigate" + }, + { + "host": "GoBack", + "handler": "GoBack" + }, + { + "host": "GoBackAndCheck", + "handler": "GoBackAndCheck" + } + ], + "code": "NavigateCommands", + "nameSpace": "Inspur.GS.Gsp.Mobile.MobileCmp" + }, + { + "id": "dab6b7f1-f56f-490a-879c-3d74232cd3ba", + "path": "Gsp/Mobile/MobileCmp/bo-mobilecmp/metadata/webcmd", + "name": "RemoveCommands.webcmd", + "refedHandlers": [ + { + "host": "RemoveById", + "handler": "RemoveById" + }, + { + "host": "RemoveByIds", + "handler": "RemoveByIds" + } + ], + "code": "RemoveCommands", + "nameSpace": "Inspur.GS.Gsp.Mobile.MobileCmp" + }, + { + "id": "f863c66a-bf93-4d1f-9f99-bcd76009609d", + "path": "Gsp/Mobile/MobileCmp/bo-mobilecmp/metadata/webcmd", + "name": "SaveCommands.webcmd", + "refedHandlers": [ + { + "host": "Save", + "handler": "Save" + } + ], + "code": "SaveCommands", + "nameSpace": "Inspur.GS.Gsp.Mobile.MobileCmp" + }, + { + "id": "05592163-fd45-474e-b0ab-61d7dc02e5c0", + "path": "Gsp/Mobile/MobileCmp/bo-mobilecmp/metadata/webcmd", + "name": "CancelCommands.webcmd", + "refedHandlers": [ + { + "host": "Cancel", + "handler": "Cancel" + } + ], + "code": "CancelCommands", + "nameSpace": "Inspur.GS.Gsp.Mobile.MobileCmp" + }, + { + "id": "791cc5d9-65f9-40d0-b40c-444c7bc1afa3", + "path": "MyDev/FarrisVueTest/VueFormTest/bo-vueformtest-front/metadata/components", + "name": "MobileVueTest_frm_Controller.webcmd", + "refedHandlers": [ + { + "host": "77a277bf-6db3-4f7c-9418-1c12212ccab0", + "handler": "componentOnBeforeInit" + } + ], + "code": "MobileVueTest_frm_Controller", + "nameSpace": "Inspur.GS.MyDev.FarrisVueTest.VueFormTest.VueFormTest.Front" + } + ], + "projectName": "bo-vueformtest-front", + "customClass": {}, + "actions": [] } }, - "Id" : "35dd45be-60c7-4ae8-a827-533424031b76", - "CreationDate" : null + "CreationDate": null }, - "extendRule" : null, - "relativePath" : "SagiDemo/SagiDemeModule/CommonDictionaries/bo-commondictionaries-front/metadata/components", - "extendProperty" : "", - "extended" : false, - "previousVersion" : null, - "version" : null, - "properties" : { - "SchemaVersion" : null, - "CacheVersion" : null, - "Framework" : "Vue" + "ExtendRule": null, + "RelativePath": "MyDev/FarrisVueTest/VueFormTest/bo-vueformtest-front/metadata/components", + "ExtendProperty": "", + "Extended": false, + "PreviousVersion": null, + "Version": null, + "Properties": { + "SchemaVersion": null, + "CacheVersion": null, + "Framework": "Vue" } } \ No newline at end of file diff --git a/packages/designer/src/app-providers.ts b/packages/designer/src/app-providers.ts index c621b690c56..6f5fec6b630 100644 --- a/packages/designer/src/app-providers.ts +++ b/packages/designer/src/app-providers.ts @@ -1,11 +1,14 @@ import { FLoadingService, FTooltipDirective, FMessageBoxService, F_MODAL_SERVICE_TOKEN, FModalService, LookupSchemaRepositoryToken, FieldSelectorRepositoryToken, F_NOTIFY_SERVICE_TOKEN, FNotifyService, ControllerSchemaRepositorySymbol, FormSchemaRepositorySymbol } from "@farris/ui-vue/components"; import { App } from "vue"; +import { useDesignerContext } from "./components/composition/designer-context/use-designer-context"; +const designerContext = useDesignerContext(); export default { install(app: App): void { app.provide(F_MODAL_SERVICE_TOKEN, new FModalService(app)); app.provide('FLoadingService', FLoadingService); + app.provide('designerContext', designerContext); // const metadataPath = metadataService.getMetadataPath(); // app.provide(MetadataPathToken, metadataPath); diff --git a/packages/designer/src/components/components/form-designer/form-designer.component.tsx b/packages/designer/src/components/components/form-designer/form-designer.component.tsx index ba93c316964..5f88f2dbced 100644 --- a/packages/designer/src/components/components/form-designer/form-designer.component.tsx +++ b/packages/designer/src/components/components/form-designer/form-designer.component.tsx @@ -7,6 +7,7 @@ import MonacoEditor from '../monaco-editor/monaco-editor.component'; import FEntityTreeView from '../entity-tree-view/components/entity-tree-view.component'; import FCustomClassEditor from './components/custom-class-editor/custom-class-editor.component'; import modulePropertyConfig from '../../types/form-property-config.json'; +import { UseDesignerContext } from "./../../../components/types/designer-context"; export default defineComponent({ name: 'FFormDesigner', @@ -25,6 +26,9 @@ export default defineComponent({ const customClassEditorRef = ref(); const designerHostService = inject('designer-host-service') as DesignerHost; + const designerContext = inject('designerContext') as UseDesignerContext; + const { toolboxItems, componentsToRegister, designerMode } = designerContext; + function onCanvasInitialized(dragula: any) { dragulaCompostion.value = dragula; @@ -209,6 +213,7 @@ export default defineComponent({ onCanvasChanged={onCanvasChanged} componentId={componentId.value} onDragEnd={onCanvasDragEnd} + components={componentsToRegister} > div { +.component-btn-group > div { position: fixed; } @@ -20,9 +20,18 @@ /* border: dotted 2px transparent; */ } -.farris-component.farris-nested { +/* .farris-component.farris-nested { padding: 10px !important; border: dotted 2px #e8e8e8; +} */ +.farris-component.farris-nested { + padding-top: 10px !important; + padding-bottom: 10px !important; + border: dotted 2px #e8e8e8; +} +.farris-component.farris-nested:not(.px-0) { + padding-left: 10px !important; + padding-right: 10px !important; } .farris-component.farris-nested.dgComponentFocused { @@ -34,7 +43,7 @@ padding: 2px; } -.farris-component.dgComponentSelected>.component-btn-group { +.farris-component.dgComponentSelected > .component-btn-group { display: flex; } @@ -43,7 +52,7 @@ cursor: pointer; float: right; margin-left: 4px; - padding: 0!important; + padding: 0 !important; font-size: 10px; line-height: 1.2em; border-radius: 2px 2px 0px 0px; @@ -52,11 +61,11 @@ color: #fff !important; background: #388fff !important; } -.component-btn-group .component-settings-button +.component-settings-button{ - margin-left: 4px!important; +.component-btn-group .component-settings-button + .component-settings-button { + margin-left: 4px !important; } -.component-btn-group .component-settings-button:last-child{ - margin-left:0!important; +.component-btn-group .component-settings-button:last-child { + margin-left: 0 !important; } .component-btn-group .component-settings-button .f-icon { font-size: 18px; @@ -126,17 +135,17 @@ } /** 拖拽区域内的元素不显示按钮区域 */ -.gu-unselectable .farris-component.dgComponentSelected>.component-btn-group { +.gu-unselectable .farris-component.dgComponentSelected > .component-btn-group { display: none; } /** 拖拽区域内的镜像元素显示按钮区域 */ -.gu-unselectable .gu-mirror.farris-component.dgComponentSelected>.component-btn-group { +.gu-unselectable .gu-mirror.farris-component.dgComponentSelected > .component-btn-group { display: flex; } /** 拖拽过程中的源元素不显示按钮区域 */ -.gu-transit.farris-component.dgComponentSelected>.component-btn-group { +.gu-transit.farris-component.dgComponentSelected > .component-btn-group { display: none; } @@ -146,14 +155,14 @@ } /* 镜像元素的按钮区域定位 */ -.gu-mirror.farris-component.dgComponentSelected>.component-btn-group>div { +.gu-mirror.farris-component.dgComponentSelected > .component-btn-group > div { position: relative; top: 0 !important; left: 0 !important; } /** 镜像元素的按钮区域设置宽度。是为了适配控件本身宽度比较小,但是操作按钮比较多时,按钮被换行的问题 */ -.gu-mirror.farris-component.dgComponentSelected>.component-btn-group { +.gu-mirror.farris-component.dgComponentSelected > .component-btn-group { width: max-content; } @@ -210,7 +219,7 @@ margin-bottom: 15px; } -.f-struct-wrapper+.f-struct-wrapper { +.f-struct-wrapper + .f-struct-wrapper { position: relative; display: inherit; margin-bottom: 15px; @@ -226,7 +235,7 @@ } /** 解决带导航的列表和带导航的卡片模板中,右侧区域滚动条位置问题 */ -.editorDiv .f-page-navigate .f-page.f-page-card .f-page-main>.drag-container { +.editorDiv .f-page-navigate .f-page.f-page-card .f-page-main > .drag-container { display: block; overflow: unset; } @@ -241,7 +250,6 @@ margin-top: 0; } - /** 解决拟物风下从从表区域的下拉箭头错位的问题 */ .f-struct-subsub-wrapper { padding-top: 0 !important; @@ -282,7 +290,7 @@ } .editorPanel .f-page.f-page-has-scheme .f-page-header { - margin: 0 .5rem; + margin: 0 0.5rem; } /************************子列表填充布局 start ******************/ @@ -294,14 +302,14 @@ /** 设计器section的适配样式 **/ .f-page-child-fill .f-struct-wrapper.f-struct-wrapper-child .f-section-in-mainsubcard { - height: 100% + height: 100%; } .f-page-child-fill .f-struct-wrapper.f-struct-wrapper-child .f-section-in-main { - height: 100% + height: 100%; } -.f-page-child-fill .f-struct-wrapper.f-struct-wrapper-child .f-section.f-section-fill>.f-section-content { +.f-page-child-fill .f-struct-wrapper.f-struct-wrapper-child .f-section.f-section-fill > .f-section-content { flex-basis: 0%; } @@ -311,21 +319,27 @@ } /** 标签页下直接放组件节点(附件组件、卡片组件)的场景要设置组件填充,否则组件无法显示 **/ -.f-page-child-fill .f-struct-wrapper.f-struct-wrapper-child .f-section .f-component-tabs .f-tabs-content-fill .farris-tabs-body>.farris-component-component { +.f-page-child-fill + .f-struct-wrapper.f-struct-wrapper-child + .f-section + .f-component-tabs + .f-tabs-content-fill + .farris-tabs-body + > .farris-component-component { flex: 1; } /************************子列表填充布局 end ******************/ /*图标样式*/ -.component-btn-group .settings-button-extend{ - padding:0 0 0 2px!important; - width:auto!important; - display:flex; +.component-btn-group .settings-button-extend { + padding: 0 0 0 2px !important; + width: auto !important; + display: flex; align-items: center; } -.settings-button-extend .icon-text{ - margin:0 4px 0 4px; - font-size:13px; +.settings-button-extend .icon-text { + margin: 0 4px 0 4px; + font-size: 13px; line-height: unset; } -- Gitee From 112aed069cc00e2b0a53c9b527bf63397b480e94 Mon Sep 17 00:00:00 2001 From: ShiaoYoung <15552151+shiaoyoung@user.noreply.gitee.com> Date: Tue, 1 Jul 2025 11:55:58 +0800 Subject: [PATCH 2/5] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E7=94=BB=E5=B8=83?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E7=9A=84=E8=AF=86=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/form-designer/form-designer.component.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/designer/src/components/components/form-designer/form-designer.component.tsx b/packages/designer/src/components/components/form-designer/form-designer.component.tsx index 5f88f2dbced..a1669a012e5 100644 --- a/packages/designer/src/components/components/form-designer/form-designer.component.tsx +++ b/packages/designer/src/components/components/form-designer/form-designer.component.tsx @@ -214,6 +214,7 @@ export default defineComponent({ componentId={componentId.value} onDragEnd={onCanvasDragEnd} components={componentsToRegister} + canvasMode={designerMode} > Date: Wed, 2 Jul 2025 14:22:04 +0800 Subject: [PATCH 3/5] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E4=BA=86=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E8=AF=86=E5=88=AB=E8=AE=BE=E8=AE=A1=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E7=9A=84=E7=B1=BB=E5=9E=8B=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=88?= =?UTF-8?q?PC=20or=20Mobile=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/designer/src/app-providers.ts | 4 +--- .../form-designer/form-designer.component.tsx | 4 ++-- .../designer-context/use-designer-context.ts | 6 ++++-- .../components/composition/use-page-metadata.ts | 14 +++++++++++++- .../designer/src/components/designer.component.tsx | 8 ++++++-- packages/designer/src/components/types/metadata.ts | 2 ++ 6 files changed, 28 insertions(+), 10 deletions(-) diff --git a/packages/designer/src/app-providers.ts b/packages/designer/src/app-providers.ts index 6f5fec6b630..95ca72ad60a 100644 --- a/packages/designer/src/app-providers.ts +++ b/packages/designer/src/app-providers.ts @@ -1,14 +1,12 @@ import { FLoadingService, FTooltipDirective, FMessageBoxService, F_MODAL_SERVICE_TOKEN, FModalService, LookupSchemaRepositoryToken, FieldSelectorRepositoryToken, F_NOTIFY_SERVICE_TOKEN, FNotifyService, ControllerSchemaRepositorySymbol, FormSchemaRepositorySymbol } from "@farris/ui-vue/components"; import { App } from "vue"; -import { useDesignerContext } from "./components/composition/designer-context/use-designer-context"; -const designerContext = useDesignerContext(); + export default { install(app: App): void { app.provide(F_MODAL_SERVICE_TOKEN, new FModalService(app)); app.provide('FLoadingService', FLoadingService); - app.provide('designerContext', designerContext); // const metadataPath = metadataService.getMetadataPath(); // app.provide(MetadataPathToken, metadataPath); diff --git a/packages/designer/src/components/components/form-designer/form-designer.component.tsx b/packages/designer/src/components/components/form-designer/form-designer.component.tsx index a1669a012e5..7dd233200ff 100644 --- a/packages/designer/src/components/components/form-designer/form-designer.component.tsx +++ b/packages/designer/src/components/components/form-designer/form-designer.component.tsx @@ -7,7 +7,7 @@ import MonacoEditor from '../monaco-editor/monaco-editor.component'; import FEntityTreeView from '../entity-tree-view/components/entity-tree-view.component'; import FCustomClassEditor from './components/custom-class-editor/custom-class-editor.component'; import modulePropertyConfig from '../../types/form-property-config.json'; -import { UseDesignerContext } from "./../../../components/types/designer-context"; +import { useDesignerContext } from "../../composition/designer-context/use-designer-context"; export default defineComponent({ name: 'FFormDesigner', @@ -26,7 +26,7 @@ export default defineComponent({ const customClassEditorRef = ref(); const designerHostService = inject('designer-host-service') as DesignerHost; - const designerContext = inject('designerContext') as UseDesignerContext; + const designerContext = useDesignerContext(); const { toolboxItems, componentsToRegister, designerMode } = designerContext; diff --git a/packages/designer/src/components/composition/designer-context/use-designer-context.ts b/packages/designer/src/components/composition/designer-context/use-designer-context.ts index 6493b8fd32c..5d6e49069ab 100644 --- a/packages/designer/src/components/composition/designer-context/use-designer-context.ts +++ b/packages/designer/src/components/composition/designer-context/use-designer-context.ts @@ -1,3 +1,4 @@ +import { Ref, inject } from "vue"; import { DesignerMode, UseDesignerContext } from "../../types/designer-context"; import { MetadataService } from "../metadata.service"; import { useMobileDesignerContext } from "./use-mobile-designer-context"; @@ -11,10 +12,11 @@ export function useDesignerContext(): UseDesignerContext { function getDesignerMode(): DesignerMode { const metadataService = new MetadataService(); const metadataPath = metadataService.getMetadataPath(); - if (metadataPath && metadataPath.includes('.mfrm')) { + const formSchemaType = inject("formSchemaType") as Ref; + if (formSchemaType.value === "MobileForm") { return DesignerMode.Mobile; } - return DesignerMode.Mobile; + return DesignerMode.PC; } const designerMode = getDesignerMode(); diff --git a/packages/designer/src/components/composition/use-page-metadata.ts b/packages/designer/src/components/composition/use-page-metadata.ts index 14fee36c0be..cec225c2846 100644 --- a/packages/designer/src/components/composition/use-page-metadata.ts +++ b/packages/designer/src/components/composition/use-page-metadata.ts @@ -65,7 +65,19 @@ export function usePageMetadata( resolve(pageSchema); }); }); + } + /** 获取表类型 */ + function queryType(): Promise { + return new Promise((resolve, reject) => { + const pathInHash = window.location.hash; + // const loacalSchemaUrl = pathInHash ? `/${pathInHash.slice(1)}.json` : `/designer-canvas/empty1.json`; + const loacalSchemaUrl = pathInHash ? `/${pathInHash.slice(1)}.json` : localMetadataUri; + axios.get(loacalSchemaUrl).then((response) => { + const formSchemaType: string = response.data.Header.Type; + resolve(formSchemaType); + }); + }); } function save() { const formMetadataBasicInfo = usePageSchemaComposition.getMetadata(); @@ -205,6 +217,6 @@ export function usePageMetadata( }; return axios.post(api, sendData, { headers: requestHeader }); } - return { query, save, getTemplateRule, publish, deploy }; + return { query, save, getTemplateRule, publish, deploy, queryType }; } diff --git a/packages/designer/src/components/designer.component.tsx b/packages/designer/src/components/designer.component.tsx index 60241424a32..0275c84106f 100644 --- a/packages/designer/src/components/designer.component.tsx +++ b/packages/designer/src/components/designer.component.tsx @@ -23,7 +23,7 @@ import FFlowDesigner from '../components/components/flow-designer/flow-designer. import FViewModelDesigner from '../components/components/view-model-designer/view-model-designer.component'; import FPreview from './preview.component'; import './designer.scss'; -import { DesignerMode } from "./types/designer-context"; +import { useDesignerContext } from "../components/composition/designer-context/use-designer-context"; export default defineComponent({ @@ -91,6 +91,8 @@ export default defineComponent({ designerHostService.usePageMetadataComposition = usePageMetadataComposition; } + const asyncFormSchemaType = ref(''); + provide("formSchemaType", asyncFormSchemaType); configInitialized.then((options: ConfigOptions) => { @@ -108,8 +110,10 @@ export default defineComponent({ designerHostService.stateMachine.queryStateMachineMetadata(); }); }); + designerHostService.usePageMetadataComposition.queryType().then((formSchemaType: string) => { + asyncFormSchemaType.value = formSchemaType; + }); }); - const metadataPath: string = inject(MetadataPathToken, ''); // const { eventBetweenDesignerAndCodeView } = commandBuilderService; diff --git a/packages/designer/src/components/types/metadata.ts b/packages/designer/src/components/types/metadata.ts index 036f17d1112..9746df70641 100644 --- a/packages/designer/src/components/types/metadata.ts +++ b/packages/designer/src/components/types/metadata.ts @@ -130,6 +130,8 @@ export interface MetadataDto { export interface UsePageMetadata { /** 查询表单元数据 */ query: () => Promise; + /** 查询表类型 */ + queryType: () => Promise; /** 保存表单元数据 */ save: () => Promise; /** 查询表单模板的拖拽控制规则 */ -- Gitee From d54f7ca1a016b1b0da574ae864cbdc7eef56ee31 Mon Sep 17 00:00:00 2001 From: ShiaoYoung <15552151+shiaoyoung@user.noreply.gitee.com> Date: Wed, 2 Jul 2025 16:00:15 +0800 Subject: [PATCH 4/5] =?UTF-8?q?feature:=20=E5=AE=8C=E5=96=84=E4=BA=86?= =?UTF-8?q?=E5=BC=80=E5=8F=91=E8=80=85=E6=8B=96=E6=8B=BD=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E6=9D=A1=E4=B8=8A=E7=9A=84=E7=A7=BB=E5=8A=A8=E5=85=83=E7=B4=A0?= =?UTF-8?q?=E3=80=81=E8=B0=83=E6=95=B4=E5=85=83=E7=B4=A0=E5=9C=A8=E7=94=BB?= =?UTF-8?q?=E5=B8=83=E4=B8=AD=E7=9A=84=E4=BD=8D=E7=BD=AE=E3=80=81=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E5=88=A0=E9=99=A4=E5=9B=BE=E6=A0=87=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E5=85=83=E7=B4=A0=E7=9A=84=E5=8A=9F=E8=83=BD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../public/designer-canvas/empty1.json | 123 ------------------ .../form-designer/form-designer.component.tsx | 2 +- 2 files changed, 1 insertion(+), 124 deletions(-) diff --git a/packages/designer/public/designer-canvas/empty1.json b/packages/designer/public/designer-canvas/empty1.json index 0e3b45d3c14..257d9663944 100644 --- a/packages/designer/public/designer-canvas/empty1.json +++ b/packages/designer/public/designer-canvas/empty1.json @@ -998,129 +998,6 @@ } ], "components": [ - { - "id": "list-page-component", - "type": "component", - "title": "列表页面", - "componentType": "page", - "pageType": "List", - "viewModel": "list-page-viewmodel", - "appearance": null, - "visible": true, - "onBeforeInit": "componentOnBeforeInit", - "onInit": "LoadPageForList", - "onLoadData": "LoadDataForList", - "goBack": "GoBack", - "contents": [ - { - "id": "list-page-container", - "type": "page-container", - "title": "页面根容器", - "appearance": null, - "visible": true, - "contents": [ - { - "id": "list-page-header-container", - "type": "page-header-container", - "title": "页头容器", - "appearance": null, - "visible": true, - "contents": [ - { - "id": "list-page-navigation-bar", - "type": "navbar", - "appearance": null, - "title": "列表页面", - "text": "导航栏", - "visible": true, - "onLeftClick": "GoBack", - "rightToolbar": { - "items": [] - } - } - ] - }, - { - "id": "list-page-body-container", - "type": "page-body-container", - "title": "主内容容器", - "appearance": null, - "visible": true, - "contents": [ - { - "id": "listView", - "type": "list-view", - "title": "列表", - "onItemClick": "OpenCardAndEdit", - "appearance": null, - "dataSource": "vueTests", - "fill": true, - "enablePullUpLoad": true, - "enablePullDownRefresh": true, - "itemTemplate": "
\r\n\t
\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t主键:{{item.id}}\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t
\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t版本:{{item.version}}\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t
\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t状态:{{$formatUtils.enum(item.billStatus.billState,{enumData:[{\"disabled\":false,\"name\":\"制单\",\"value\":\"Billing\"},{\"disabled\":false,\"name\":\"提交审批\",\"value\":\"SubmitApproval\"},{\"disabled\":false,\"name\":\"审批通过\",\"value\":\"Approved\"},{\"disabled\":false,\"name\":\"审批不通过\",\"value\":\"ApprovalNotPassed\"}]})}}\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t
\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t流程实例:{{item.processInstance.processInstance}}\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t
\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t编号:{{item.code}}\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t
\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t名称:{{item.name}}\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t
\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t布尔字段:{{$formatUtils.bool(item.booleanField)}}\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t
\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t数值字段:{{item.numberField}}\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t
\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t\t\t
\r\n\t\t\t\t\t\t日期字段:{{$formatUtils.date(item.dateField,'yyyy-MM-dd')}}\r\n\t\t\t\t\t
\r\n\t\t\t\t
\r\n\t\t\t
\r\n\t\t
\r\n\t
\r\n
", - "visible": true, - "swipeToolbar": { - "id": "listView-swipe-toolbar", - "title": "列表滑动工具栏", - "type": "tool-bar", - "items": [ - { - "id": "listView-del-toobaritem", - "type": "tool-bar-item", - "visible": true, - "text": "删除", - "onClick": "RemoveById" - } - ] - }, - "toolbar": { - "items": [] - } - } - ] - }, - { - "id": "list-page-float-container", - "type": "float-container", - "title": "浮动容器", - "appearance": null, - "position": { - "right": 30, - "bottom": 60 - }, - "visible": true, - "contents": [ - { - "id": "list-page-add-button", - "appearance": {}, - "type": "button", - "title": "新增", - "displayType": "primary", - "onClick": "OpenCardAndAdd", - "disabled": false, - "round": true, - "block": true, - "buttonSize": "normal", - "icon": "s-plus", - "text": "", - "size": { - "width": 44, - "height": 44 - }, - "visible": true - } - ] - } - ] - } - ], - "route": { - "id": "list-page-component", - "uri": "list-page-component", - "name": "list-page-component", - "params": [] - } - }, { "id": "card-page-component", "type": "component", diff --git a/packages/designer/src/components/components/form-designer/form-designer.component.tsx b/packages/designer/src/components/components/form-designer/form-designer.component.tsx index 7dd233200ff..bb9dc3f3a70 100644 --- a/packages/designer/src/components/components/form-designer/form-designer.component.tsx +++ b/packages/designer/src/components/components/form-designer/form-designer.component.tsx @@ -194,7 +194,7 @@ export default defineComponent({ - + -- Gitee From 9189821707ec47c3a0caef48e093ac2bd49dc14f Mon Sep 17 00:00:00 2001 From: ShiaoYoung <15552151+shiaoyoung@user.noreply.gitee.com> Date: Thu, 3 Jul 2025 11:01:48 +0800 Subject: [PATCH 5/5] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E4=BA=86designer?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E4=B8=AD=E6=8E=A7=E4=BB=B6=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E4=B8=8E=E8=AE=BE=E8=AE=A1=E5=99=A8=E4=B8=8A?= =?UTF-8?q?=E4=B8=8B=E6=96=87=E5=88=9D=E5=A7=8B=E5=8C=96=E5=85=88=E5=90=8E?= =?UTF-8?q?=E9=A1=BA=E5=BA=8F=E7=9A=84=E5=86=B2=E7=AA=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form-designer/form-designer.component.tsx | 7 +++--- .../designer-context/use-designer-context.ts | 5 +---- .../composition/use-page-metadata.ts | 22 +++++-------------- .../src/components/designer.component.tsx | 21 ++++++++++-------- .../designer/src/components/types/metadata.ts | 5 ++++- 5 files changed, 26 insertions(+), 34 deletions(-) diff --git a/packages/designer/src/components/components/form-designer/form-designer.component.tsx b/packages/designer/src/components/components/form-designer/form-designer.component.tsx index bb9dc3f3a70..d5a8988609a 100644 --- a/packages/designer/src/components/components/form-designer/form-designer.component.tsx +++ b/packages/designer/src/components/components/form-designer/form-designer.component.tsx @@ -1,4 +1,4 @@ -import { computed, defineComponent, inject, provide, ref, nextTick } from "vue"; +import { computed, defineComponent, inject, provide, ref, nextTick, Ref } from "vue"; import { ComponentSchema, DesignerComponentInstance, FDesignerCanvas, FTabs, FTabPage, propertyConfigSchemaMap, FSplitter, FSplitterPane, FDesignerToolbox, FPropertyPanel, FDesignerOutline, DesignerHost } from "@farris/ui-vue/components"; import { FormDesignerProps, formDesignerProps } from "./form-designer.props"; import { useComponentSchemaService } from '../../composition/component-schema.service'; @@ -7,7 +7,7 @@ import MonacoEditor from '../monaco-editor/monaco-editor.component'; import FEntityTreeView from '../entity-tree-view/components/entity-tree-view.component'; import FCustomClassEditor from './components/custom-class-editor/custom-class-editor.component'; import modulePropertyConfig from '../../types/form-property-config.json'; -import { useDesignerContext } from "../../composition/designer-context/use-designer-context"; +import { UseDesignerContext } from "src/components/types/designer-context"; export default defineComponent({ name: 'FFormDesigner', @@ -26,7 +26,8 @@ export default defineComponent({ const customClassEditorRef = ref(); const designerHostService = inject('designer-host-service') as DesignerHost; - const designerContext = useDesignerContext(); + const designerContextRef = inject("designerContext") as Ref; + const designerContext = designerContextRef.value as UseDesignerContext; const { toolboxItems, componentsToRegister, designerMode } = designerContext; diff --git a/packages/designer/src/components/composition/designer-context/use-designer-context.ts b/packages/designer/src/components/composition/designer-context/use-designer-context.ts index 5d6e49069ab..879aa385f0e 100644 --- a/packages/designer/src/components/composition/designer-context/use-designer-context.ts +++ b/packages/designer/src/components/composition/designer-context/use-designer-context.ts @@ -8,11 +8,8 @@ import { usePCDesignerContext } from "./use-pc-designer-context"; * 设计器上下文 * @returns */ -export function useDesignerContext(): UseDesignerContext { +export function useDesignerContext(formSchemaType: Ref): UseDesignerContext { function getDesignerMode(): DesignerMode { - const metadataService = new MetadataService(); - const metadataPath = metadataService.getMetadataPath(); - const formSchemaType = inject("formSchemaType") as Ref; if (formSchemaType.value === "MobileForm") { return DesignerMode.Mobile; } diff --git a/packages/designer/src/components/composition/use-page-metadata.ts b/packages/designer/src/components/composition/use-page-metadata.ts index cec225c2846..d18d8abfe57 100644 --- a/packages/designer/src/components/composition/use-page-metadata.ts +++ b/packages/designer/src/components/composition/use-page-metadata.ts @@ -2,7 +2,7 @@ import axios from 'axios'; import { mergeWith, omit } from 'lodash-es'; import { DesignerProps } from '../designer.props'; import { MetadataDto, MetadataPathToken, UsePageSchema, UsePageMetadata, PageMetadataContent, PageModule } from '../types'; -import { inject } from 'vue'; +import { inject, ref } from 'vue'; import { FNotifyService } from '@farris/ui-vue/components'; import { PageMetadataConverter } from './page-metadata-converter'; import { ConfigOptions, UseMetadata, UseResolveMetadataUrl } from './types'; @@ -17,7 +17,7 @@ export function usePageMetadata( const { localMetadataUri, templateRulesOfCommon, templateRulesBaseUri, publishStatusSocketUri, publishApplicationUri, deployApplicationUri } = options; const { saveMetadata } = useMetadataComposition; const { resolveUrlOfLoadMetadataByPath } = useResolveMetadataUrlComposition; - + const formSchemaType = ref(''); function fetchLocalSchema(): Promise { return new Promise((resolve, reject) => { const pathInHash = window.location.hash; @@ -29,10 +29,9 @@ export function usePageMetadata( axios.get(loacalSchemaUrl).then((response) => { const formSchema = response.data.Content.Contents; const formMetadataBasicInfo = omit(response.data, 'content') as MetadataDto; - usePageSchemaComposition.setMetadata(formMetadataBasicInfo); usePageSchemaComposition.setPageSchema(formSchema); - + formSchemaType.value = response.data.Header.Type as string; resolve(formSchema); }); } @@ -61,24 +60,13 @@ export function usePageMetadata( usePageSchemaComposition.setMetadata(formMetadataBasicInfo); usePageSchemaComposition.setPageSchema(pageSchema); + formSchemaType.value = response.data.Header.Type as string; resolve(pageSchema); }); }); } - /** 获取表类型 */ - function queryType(): Promise { - return new Promise((resolve, reject) => { - const pathInHash = window.location.hash; - // const loacalSchemaUrl = pathInHash ? `/${pathInHash.slice(1)}.json` : `/designer-canvas/empty1.json`; - const loacalSchemaUrl = pathInHash ? `/${pathInHash.slice(1)}.json` : localMetadataUri; - axios.get(loacalSchemaUrl).then((response) => { - const formSchemaType: string = response.data.Header.Type; - resolve(formSchemaType); - }); - }); - } function save() { const formMetadataBasicInfo = usePageSchemaComposition.getMetadata(); const formSchema = usePageSchemaComposition.getPageSchema(); @@ -217,6 +205,6 @@ export function usePageMetadata( }; return axios.post(api, sendData, { headers: requestHeader }); } - return { query, save, getTemplateRule, publish, deploy, queryType }; + return { query, save, getTemplateRule, publish, deploy, formSchemaType }; } diff --git a/packages/designer/src/components/designer.component.tsx b/packages/designer/src/components/designer.component.tsx index 703a995c981..5a054d6393a 100644 --- a/packages/designer/src/components/designer.component.tsx +++ b/packages/designer/src/components/designer.component.tsx @@ -1,4 +1,4 @@ -import { defineComponent, inject, ref, computed, provide, watch, onBeforeMount } from "vue"; +import { defineComponent, inject, ref, computed, provide, watch, onBeforeMount, Ref } from "vue"; import { DesignerProps, designerProps } from "./designer.props"; import { usePageSchema } from "./composition/use-page-schema"; import { usePageMetadata } from "./composition/use-page-metadata"; @@ -24,6 +24,7 @@ import FViewModelDesigner from '../components/components/view-model-designer/vie import FPreview from './preview.component'; import './designer.scss'; import { DesignerMode, UseDesignerContext } from "./types/designer-context"; +import { useDesignerContext } from "./composition/designer-context/use-designer-context"; export default defineComponent({ @@ -69,9 +70,7 @@ export default defineComponent({ // 实体服务 const useEntitySchemaComposition = useEntitySchema(options, useMetadataComposition, usePageSchemaComposition); designerHostService.entitySchema = useEntitySchemaComposition; - // 控件创建服务 - const controlCreatorService = designerContext.useControlCreator(); - designerHostService.controlCreator = controlCreatorService; + // 操作表单设计时ViewModel的工具类 const useDesignViewModelComposition = useDesignViewModel(usePageSchemaComposition, useEntitySchemaComposition); designerHostService.designViewModel = useDesignViewModelComposition; @@ -95,8 +94,8 @@ export default defineComponent({ designerHostService.messagerService = messagerService; } - const asyncFormSchemaType = ref(''); - provide("formSchemaType", asyncFormSchemaType); + const designerContextRef = ref(); + provide("designerContext", designerContextRef); configInitialized.then((options: ConfigOptions) => { @@ -105,6 +104,13 @@ export default defineComponent({ designerHostService.usePageMetadataComposition.query().then((formSchema: PageMetadataContent) => { schema.value = formSchema; designerHostService.usePageMetadataComposition.getTemplateRule(formSchema?.module).then(() => { + // 初始化设计器上下文 + const formSchemaType = designerHostService.usePageMetadataComposition.formSchemaType as Ref; + designerContextRef.value = useDesignerContext(formSchemaType); + // 控件创建服务 + const controlCreatorService = designerContextRef.value.useControlCreator(); + designerHostService.controlCreator = controlCreatorService; + metadataLoaded.value = true; // 加载命令->虽然是异步,但是此处不需要异步串联 designerHostService.commands.checkCommands(); @@ -114,9 +120,6 @@ export default defineComponent({ designerHostService.stateMachine.queryStateMachineMetadata(); }); }); - designerHostService.usePageMetadataComposition.queryType().then((formSchemaType: string) => { - asyncFormSchemaType.value = formSchemaType; - }); }); const metadataPath: string = inject(MetadataPathToken, ''); diff --git a/packages/designer/src/components/types/metadata.ts b/packages/designer/src/components/types/metadata.ts index 9746df70641..9531771777b 100644 --- a/packages/designer/src/components/types/metadata.ts +++ b/packages/designer/src/components/types/metadata.ts @@ -1,3 +1,4 @@ +import { Ref } from "vue"; import { PageComponent, Expression, StateMachine, Command } from "./basic"; import { DesignViewModel } from "./design-viewmodel"; import { EntitySchema, EntityObject, EntityObjectField } from "./entity-schema"; @@ -139,7 +140,9 @@ export interface UsePageMetadata { /** 发布表单 */ publish: () => Promise<{ result: boolean, error?: string }>; /** 部署表单 */ - deploy: (metadataId: string, path: string) => Promise + deploy: (metadataId: string, path: string) => Promise; + /** 表单类型 */ + formSchemaType: Ref; } export interface UsePageSchema { -- Gitee