From 50111114eb8254fe4d6fc15e9781f2c47e3db74a Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期三, 24 七月 2024 00:12:52 +0800
Subject: [PATCH] 删除工艺路线绑定

---
 src/views/tigerprojects/system/lowcode/composition/Config.vue |   50 +++++++++++++++++++++++++++++++++++---------------
 1 files changed, 35 insertions(+), 15 deletions(-)

diff --git a/src/views/tigerprojects/system/lowcode/composition/Config.vue b/src/views/tigerprojects/system/lowcode/composition/Config.vue
index 91284d8..b517eca 100644
--- a/src/views/tigerprojects/system/lowcode/composition/Config.vue
+++ b/src/views/tigerprojects/system/lowcode/composition/Config.vue
@@ -4,10 +4,10 @@
  * @version: 
  * @Date: 2024-06-24 23:44:31
  * @LastEditors: Ben Lin
- * @LastEditTime: 2024-06-27 16:28:34
+ * @LastEditTime: 2024-07-23 20:48:29
 -->
 <template>
-  <Card :title="GetTitle()['configTitle']">
+  <Card :title="GetTitle(props.configType)['configTitle']">
     <BasicForm @register="registerForm">
       <template #[item]="{ field }" v-for="item in GetCrudColSlots()" :key="item">
         <a-button
@@ -27,7 +27,7 @@
 </template>
 <script lang="ts" setup>
   import { Ref, inject, nextTick, onMounted, ref, unref, watch } from 'vue';
-  import { BasicForm, useForm } from '/@/components/Form/index';
+  import { BasicForm, FormSchema, useForm } from '/@/components/Form/index';
   import { Card } from 'ant-design-vue';
   import { useModal } from '/@/components/Modal';
   import GeneralModal from '/@/views/components/GeneralModal.vue';
@@ -37,37 +37,50 @@
 
   const { t } = useI18n();
   const emit = defineEmits(['success', 'register']);
+  const props = defineProps({
+    configType: { type: String },
+  });
   const [registerItemAdd, { openModal: openItemModal }] = useModal();
   const objParams = inject('objParams') as Ref<any>;
   const custImport = ref<any[]>([]);
   const EntityCustFunction = ref([
     {
-      GetCrudForm() {},
+      GetCrudForm(type: string | undefined) {},
       GetCrudColSlots(val, id) {},
       OpenSelectItem(openItemModal: Fn, ...args) {},
       GetSelectSuccess(d, u, ...args) {},
-      GetTitle() {},
+      GetTitle(type: string | undefined) {},
       nodeChange(params: {
         resetFields: any;
         setFieldsValue: any;
         objParams: Ref<any>;
         selectedNodes: Ref<any[]>;
       }) {},
-      SubmitFunc(values: Recordable<any>, emit) {},
+      SubmitFunc(values: Recordable<any>, type: string, emit) {},
     } as EntityCustFunctionType,
   ]);
   /* 鍔ㄦ�乮mport瀹炰綋鍚�.ts鐨勮嚜瀹氫箟鏂规硶 */
   try {
     custImport.value = await import(`../entityts/${objParams.value['Name']}.ts`);
   } catch (e) {}
-  const [{ GetCrudForm, GetCrudColSlots, nodeChange, OpenSelectItem, GetSelectSuccess, GetTitle, SubmitFunc }] =
-    isNullOrUnDef(custImport.value['default'])
-      ? EntityCustFunction.value
-      : custImport.value['default']();
+  const [
+    {
+      GetCrudForm,
+      GetCrudColSlots,
+      nodeChange,
+      OpenSelectItem,
+      GetSelectSuccess,
+      GetTitle,
+      SubmitFunc,
+    },
+  ] = isNullOrUnDef(custImport.value['default'])
+    ? EntityCustFunction.value
+    : custImport.value['default']();
 
-  const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({
+  let formSchema: FormSchema[] = GetCrudForm(props.configType);
+  const [registerForm, { resetFields, setFieldsValue, validate, setProps }] = useForm({
     labelWidth: 120,
-    schemas: GetCrudForm(),
+    schemas: formSchema,
     actionColOptions: {
       offset: 8,
       span: 24,
@@ -77,7 +90,7 @@
     },
     showActionButtonGroup: true,
     submitButtonOptions: {
-      text: '鎻愪氦',
+      text: '淇濆瓨',
     },
     submitFunc: customSubmitFunc,
   });
@@ -90,6 +103,13 @@
       nextTick(() => {
         /* 鑺傜偣鍒囨崲浜嬩欢 */
         nodeChange({ resetFields, setFieldsValue, objParams, selectedNodes });
+        formSchema = GetCrudForm(selectedNodes.value[0].type);
+        setProps({
+          schemas: []
+        });
+        setProps({
+          schemas: formSchema
+        });
       });
     },
     { deep: true, immediate: true },
@@ -103,7 +123,7 @@
   async function customSubmitFunc() {
     try {
       const values = await validate();
-      SubmitFunc(values, emit);
+      SubmitFunc(values,props.configType, emit);
       // values.AUTH_PROD = useUserStore().getUserInfo.prodCode;
       // values.FACTORY = useUserStore().getUserInfo.prodCode;
       // const apiAction = SaveEntity(values, true, 'MES_PROD_ACTION');
@@ -112,7 +132,7 @@
       //     emit('success');
       //   }
       // });
-    }catch(e) {}
+    } catch (e) {}
   }
 
   /**

--
Gitblit v1.9.3