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 |   83 +++++++++++++++++++++++------------------
 1 files changed, 46 insertions(+), 37 deletions(-)

diff --git a/src/views/tigerprojects/system/lowcode/composition/Config.vue b/src/views/tigerprojects/system/lowcode/composition/Config.vue
index 6bab5db..b517eca 100644
--- a/src/views/tigerprojects/system/lowcode/composition/Config.vue
+++ b/src/views/tigerprojects/system/lowcode/composition/Config.vue
@@ -4,12 +4,12 @@
  * @version: 
  * @Date: 2024-06-24 23:44:31
  * @LastEditors: Ben Lin
- * @LastEditTime: 2024-06-26 18:45:42
+ * @LastEditTime: 2024-07-23 20:48:29
 -->
 <template>
-  <Card title="琛屼负閰嶇疆">
+  <Card :title="GetTitle(props.configType)['configTitle']">
     <BasicForm @register="registerForm">
-      <template #[item]="{ field }" v-for="item in crudColSlots" :key="item">
+      <template #[item]="{ field }" v-for="item in GetCrudColSlots()" :key="item">
         <a-button
           v-if="field"
           class="mt-1 ml-1"
@@ -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,40 +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([
     {
-      ActionItem(params, data, ...args) {},
-      EditOperation(data, d, u) {},
-      GetBaseColumns() {},
-      GetSearchForm() {},
-      GetCrudForm() {},
+      GetCrudForm(type: string | undefined) {},
       GetCrudColSlots(val, id) {},
       OpenSelectItem(openItemModal: Fn, ...args) {},
       GetSelectSuccess(d, u, ...args) {},
+      GetTitle(type: string | undefined) {},
       nodeChange(params: {
         resetFields: any;
         setFieldsValue: any;
         objParams: Ref<any>;
         selectedNodes: Ref<any[]>;
       }) {},
+      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 }] =
-    isNullOrUnDef(custImport.value['default'])
-      ? EntityCustFunction.value
-      : custImport.value['default']();
-  const crudColSlots = ref<any>(GetCrudColSlots());
+  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,
@@ -80,7 +90,7 @@
     },
     showActionButtonGroup: true,
     submitButtonOptions: {
-      text: '鎻愪氦',
+      text: '淇濆瓨',
     },
     submitFunc: customSubmitFunc,
   });
@@ -93,6 +103,13 @@
       nextTick(() => {
         /* 鑺傜偣鍒囨崲浜嬩欢 */
         nodeChange({ resetFields, setFieldsValue, objParams, selectedNodes });
+        formSchema = GetCrudForm(selectedNodes.value[0].type);
+        setProps({
+          schemas: []
+        });
+        setProps({
+          schemas: formSchema
+        });
       });
     },
     { deep: true, immediate: true },
@@ -104,26 +121,18 @@
   });
 
   async function customSubmitFunc() {
-    // try {
-    //   const values = await validate();
-    //   setDrawerProps({ confirmLoading: true });
-    //   // TODO custom api
-    //   //淇濆瓨宸ュ崟
-    //   if (!unref(isUpdate)) {
-    //     values.STATUS = 0;
-    //   }
-    //   values.AUTH_PROD = useUserStore().getUserInfo.prodCode;
-    //   values.FACTORY = useUserStore().getUserInfo.prodCode;
-    //   const apiAction = SaveEntity(values, unref(isUpdate), 'BIZ_MES_WO');
-    //   apiAction.then((action) => {
-    //     if (action.IsSuccessed) {
-    //       closeDrawer();
-    //       emit('success');
-    //     }
-    //   });
-    // } finally {
-    //   setDrawerProps({ confirmLoading: false });
-    // }
+    try {
+      const values = await validate();
+      SubmitFunc(values,props.configType, emit);
+      // values.AUTH_PROD = useUserStore().getUserInfo.prodCode;
+      // values.FACTORY = useUserStore().getUserInfo.prodCode;
+      // const apiAction = SaveEntity(values, true, 'MES_PROD_ACTION');
+      // apiAction.then((action) => {
+      //   if (action.IsSuccessed) {
+      //     emit('success');
+      //   }
+      // });
+    } catch (e) {}
   }
 
   /**

--
Gitblit v1.9.3