From cca7adfe0b76ed7c2fbdbc9978533de147695184 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期六, 08 六月 2024 23:02:07 +0800
Subject: [PATCH] 工单管理更新

---
 src/views/tigerprojects/mes/prod/biz_mes_wo/index.vue |   99 +++++++++++++++++++++++++++++++------------------
 1 files changed, 63 insertions(+), 36 deletions(-)

diff --git a/src/views/tigerprojects/mes/prod/biz_mes_wo/index.vue b/src/views/tigerprojects/mes/prod/biz_mes_wo/index.vue
index 3da904a..55c2500 100644
--- a/src/views/tigerprojects/mes/prod/biz_mes_wo/index.vue
+++ b/src/views/tigerprojects/mes/prod/biz_mes_wo/index.vue
@@ -64,17 +64,12 @@
     <WoModal @register="registerWo" @success="handleSuccess" :title="title" :mtitle="mtitle" />
     <CustModal
       @register="registerCust"
-      @success="handleSuccess"
+      @success="custSuccess"
       :type="cType"
       :detailSlots="dtlSlots"
     >
       <template #[item.name] v-for="item in dtlSlots" :key="item.name">
-        <BasicForm
-          :schemas="formSchema"
-          :ref="item.name"
-          :labelWidth="100"
-          :showActionButtonGroup="false"
-        >
+        <BasicForm @register="useFormData[item.name][0]">
           <template #[sitem]="{ field }" v-for="sitem in item.slots" :key="sitem">
             <a-button
               class="mt-1 ml-1"
@@ -96,7 +91,7 @@
 <script lang="ts" setup>
   import { reactive, unref, h, onMounted, ref, nextTick } from 'vue';
   import { BasicTable, useTable, TableAction } from '/@/components/Table';
-  import { BasicForm, FormSchema, FormActionType, FormProps } from '/@/components/Form/index';
+  import { BasicForm, FormSchema, FormActionType, useForm } from '/@/components/Form/index';
   import WoDrawer from './WoDrawer.vue';
   import WoModal from './WoModal.vue';
   import NormalModal from '/@/views/components/NormalModal.vue';
@@ -115,7 +110,6 @@
   const { t } = useI18n();
   const cType = ref('');
   const title = ref('宸ュ崟瀵煎叆');
-  const ctitle = ref('宸ュ崟涓嬪彂閰嶇疆');
   const mtitle = ref('宸ュ崟鍒楄〃');
   const dtlSlots = ref([] as any[]);
   const selectVals = ref({});
@@ -153,9 +147,43 @@
     showIndexColumn: false,
   });
   const formSchema = ref([] as FormSchema[]);
-  const woinfo = ref<Nullable<FormActionType>>(null);
-  const forminfo = ref<Nullable<FormActionType>>(null);
-  const prodinfo = ref<Nullable<FormActionType>>(null);
+  const woSchema = ref([] as FormSchema[]);
+  const prodSchema = ref([] as FormSchema[]);
+  const xxSchema = ref([] as FormSchema[]);
+  const useFormData = ref({
+    forminfo: useForm({
+      labelWidth: 120,
+      schemas: formSchema,
+      actionColOptions: {
+        span: 24,
+      },
+      showActionButtonGroup: false,
+    }),
+    woinfo: useForm({
+      labelWidth: 120,
+      schemas: woSchema,
+      actionColOptions: {
+        span: 24,
+      },
+      showActionButtonGroup: false,
+    }),
+    prodinfo: useForm({
+      labelWidth: 120,
+      schemas: prodSchema,
+      actionColOptions: {
+        span: 24,
+      },
+      showActionButtonGroup: false,
+    }),
+    xxinfo: useForm({
+      labelWidth: 120,
+      schemas: xxSchema,
+      actionColOptions: {
+        span: 24,
+      },
+      showActionButtonGroup: false,
+    }),
+  });
 
   onMounted(() => {});
 
@@ -188,17 +216,19 @@
     dtlSlots.value = [
       { name: 'woinfo', slots: [], preIcons: {}, title: '宸ュ崟淇℃伅' },
       { name: 'prodinfo', slots: [], preIcons: {}, title: '浜у搧淇℃伅' },
+      { name: 'xxinfo', slots: ['add'], preIcons: { add: 'search|svg' }, title: 'XXX' },
     ];
-    formSchema.value = getFormSchema(cType.value);
+    woSchema.value = getFormSchema('woinfo');
+    prodSchema.value = getFormSchema('prodinfo');
+    xxSchema.value = getFormSchema('xxinfo');
     openCustModal(true, {
       isUpdate: true,
       ctype: cType,
       title: '宸ヨ壓閰嶇疆',
       width: '1000px',
+      formEl: useFormData.value, //濡傛灉鏄涓〃鍗曪紝澧炲姞澶氫釜鎻掓Ы
+      formElName: ['woinfo', 'prodinfo', 'xxinfo'],
       RowKey: '',
-      formEl: { woinfo: woinfo.value, prodinfo: prodinfo.value }, //濡傛灉鏄涓〃鍗曪紝澧炲姞澶氫釜鎻掓Ы
-      // preIcons: { add: 'search|svg', set: 'config|svg' },
-      // slots: ['add', 'set'], //缁欏脊鍑烘澧炲姞鎻掓Ы鏍囩鏁扮粍
       ...record,
     });
   }
@@ -209,27 +239,24 @@
       {
         name: 'forminfo',
         slots: ['add', 'set'],
-        preIcons: { add: 'search|svg', set: 'config|svg' },
+        preIcons: { add: 'search|svg', set: 'config|svg' }, //濡傛灉鏄涓〃鍗曪紝澧炲姞澶氫釜鎻掓Ы銆俿lots鏄脊鍑烘鎸夐挳鐨勬彃妲斤紝preIcons鏄彃妲藉搴旂殑鎸夐挳鍥炬爣
         title: '涓嬪彂閰嶇疆',
       },
-    ]; //濡傛灉鏄涓〃鍗曪紝澧炲姞澶氫釜鎻掓Ы銆俿lots鏄脊鍑烘鎸夐挳鐨勬彃妲斤紝preIcons鏄彃妲藉搴旂殑鎸夐挳鍥炬爣
+    ];
     formSchema.value = getFormSchema(cType.value);
-    nextTick(() => {
-      setTimeout(() => {
-        openCustModal(true, {
-          isUpdate: true, //鏄惁鏇存柊鎿嶄綔
-          ctype: cType, //鏄摢涓〉闈�
-          title: '宸ュ崟涓嬪彂', //鏍囬
-          width: '900px', //寮瑰嚭妗嗗搴�
-          formEl: { forminfo: forminfo.value },
-          formElName: 'forminfo',
-          RowKeys: { add: 'ROUTE_CODE', set: 'ROUTE_CODE' }, //鎻掓Ы鐨勫脊鍑烘閫夋嫨鐨刢ode
-          ...record,
-        });
-      }, 100);
-      closeModal();
-      openCustModal(true, {});
+    openCustModal(true, {
+      isUpdate: true, //鏄惁鏇存柊鎿嶄綔
+      ctype: cType, //鏄摢涓〉闈�
+      title: '宸ュ崟涓嬪彂', //鏍囬
+      width: '900px', //寮瑰嚭妗嗗搴�
+      formEl: useFormData.value,
+      formElName: ['forminfo'],
+      RowKeys: { add: 'ROUTE_CODE', set: 'ROUTE_CODE' }, //鎻掓Ы鐨勫脊鍑烘閫夋嫨鐨刢ode
+      ...record,
     });
+  }
+  function custSuccess(d) {
+    reload();
   }
   //鍙栨秷涓嬪彂
   function handleUnRelease(record: Recordable) {}
@@ -294,13 +321,13 @@
     let _val = {};
     _val[d.returnFieldName] = values[d.returnFieldName];
     if (item == 'forminfo') {
-      forminfo.value.setFieldsValue(_val);
+      useFormData.value['forminfo'][1].setFieldsValue(_val);
     }
     if (item == 'prodinfo') {
-      prodinfo.value.setFieldsValue(_val);
+      useFormData.value['prodinfo'][1].setFieldsValue(_val);
     }
     if (item == 'woinfo') {
-      woinfo.value.setFieldsValue(_val);
+      useFormData.value['woinfo'][1].setFieldsValue(_val);
     }
   }
 

--
Gitblit v1.9.3