From 2060cb1aec383655dc0e8ee7ecf31e044b4e52a3 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期日, 09 六月 2024 01:19:48 +0800
Subject: [PATCH] 工单管理更新

---
 src/views/tigerprojects/mes/prod/biz_mes_wo/index.vue |  171 ++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 157 insertions(+), 14 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 2b7bc31..56fe9bd 100644
--- a/src/views/tigerprojects/mes/prod/biz_mes_wo/index.vue
+++ b/src/views/tigerprojects/mes/prod/biz_mes_wo/index.vue
@@ -60,17 +60,46 @@
       </template>
     </BasicTable>
     <Loading :loading="compState.loading" :tip="compState.tip" />
-    <!-- <WmsItemDrawer @register="registerDrawer" @success="handleSuccess" /> -->
     <WoDrawer @register="registerDrawer" @success="handleSuccess" />
-    <WoModal @register="registerWo" @success="handleSuccess" />
+    <WoModal @register="registerWo" @success="handleSuccess" :title="title" :mtitle="mtitle" />
+    <!-- 鑷畾涔夋ā鎬佹锛屽彲浠ヨ嚜瀹氫箟澶氳〃鍗� -->
+    <CustModal
+      @register="registerCust"
+      @success="custSuccess"
+      :type="cType"
+      :detailSlots="dtlSlots"
+    >
+      <!-- 鐢ㄦ彃妲借嚜瀹氫箟澶氳〃鍗� -->
+      <template #[item.name] v-for="item in dtlSlots" :key="item.name">
+        <BasicForm @register="useFormData[item.name][0]">
+          <!-- 鐢ㄦ彃妲借嚜瀹氫箟寮瑰嚭閫夋嫨妗� -->
+          <template #[name]="{ field }" v-for="name in item.slots" :key="name">
+            <a-button
+              class="mt-1 ml-1"
+              size="small"
+              @click="handleCustClick(field)"
+              :preIcon="item.preIcons[name]"
+            />
+            <NormalModal
+              @register="useModalData[name][0]"
+              @success="(d, u) => handleEntSuccess(d, u, item.name)"
+            />
+          </template>
+        </BasicForm>
+      </template>
+    </CustModal>
+    <RouteViewModal @register="registerRv" @success="RvItemSuccess" />
   </div>
 </template>
 <script lang="ts" setup>
-  import { reactive, unref, h, onMounted } from 'vue';
+  import { reactive, unref, h, onMounted, ref, nextTick } from 'vue';
   import { BasicTable, useTable, TableAction } from '/@/components/Table';
+  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';
+  import RouteViewModal from '/@/views/components/RouteViewModal.vue';
+  import CustModal from '/@/views/components/CustModal.vue';
   import { useDrawer } from '/@/components/Drawer';
   import { columns, searchFormSchema } from './biz_mes_wo.data';
   import { DeleteMesWo } from '/@/api/tigerapi/mes/wo';
@@ -79,8 +108,14 @@
   import { useI18n } from '/@/hooks/web/useI18n';
   import { useModal } from '/@/components/Modal';
   import { getListByPage } from '/@/api/tigerapi/system';
+  import { GetSelectSuccess, OpenSelectItem, getFormSchema } from '/@/views/components/data';
 
   const { t } = useI18n();
+  const cType = ref('');
+  const title = ref('宸ュ崟瀵煎叆');
+  const mtitle = ref('宸ュ崟鍒楄〃');
+  const dtlSlots = ref([] as any[]);
+  const selectVals = ref({});
   const { createMessage } = useMessage();
   const [registerDrawer, { openDrawer }] = useDrawer();
   const compState = reactive({
@@ -88,8 +123,10 @@
     loading: false,
     tip: '鍔犺浇涓�...',
   });
+  const [registerRv, { openModal: openRvModal }] = useModal();
   const [registerWo, { openModal: openWoModal }] = useModal();
   const [registerItemAdd, { openModal: openItemModal }] = useModal();
+  const [registerCust, { openModal: openCustModal, closeModal }] = useModal();
   const [registerTable, { getForm, reload }] = useTable({
     title: '宸ュ崟淇℃伅',
     api: getListByPage,
@@ -110,6 +147,52 @@
     showTableSetting: true,
     bordered: true,
     showIndexColumn: false,
+  });
+  const formSchema = ref([] as FormSchema[]);
+  const woSchema = ref([] as FormSchema[]);
+  const prodSchema = ref([] as FormSchema[]);
+  const xxSchema = ref([] as FormSchema[]);
+  //琛ㄥ崟涓彃妲芥覆鏌撴寜閽墦寮�妯℃�佹useModal鏂规硶
+  const useModalData = ref({
+    add: useModal(),
+    set: useModal(),
+    addRot: useModal(),
+    setRot: useModal(),
+  });
+  //鑷畾涔夊琛ㄥ崟瀹炰緥
+  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(() => {});
@@ -139,18 +222,57 @@
   }
   //閰嶇疆宸ヨ壓
   function handleConfig(record: Recordable) {
-    // const apiAction = SaveTool(record, unref(true), true);
-    // apiAction.then((action) => {
-    //   if (action.IsSuccessed) {
-    //     createMessage.success(t('宸叉姤搴�'));
-    //     reload();
-    //   } else {
-    //     createMessage.success(t('鎶ュ簾鎿嶄綔澶辫触'));
-    //   }
-    // });
+    cType.value = 'BIZ_MES_WO_Config';
+    dtlSlots.value = [
+      { name: 'woinfo', slots: [], preIcons: {}, title: '宸ュ崟淇℃伅' },
+      {
+        name: 'prodinfo',
+        slots: ['addRot', 'setRot'],
+        preIcons: { addRot: 'search|svg', setRot: 'config|svg' },
+        title: '浜у搧淇℃伅',
+      },
+      { name: 'xxinfo', slots: ['add'], preIcons: { add: 'search|svg' }, title: 'XXX' },
+    ];
+    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: '',
+      ...record,
+    });
   }
   //涓嬪彂
-  function handleRelease(record: Recordable) {}
+  function handleRelease(record: Recordable) {
+    cType.value = 'BIZ_MES_WO';
+    dtlSlots.value = [
+      {
+        name: 'forminfo',
+        slots: ['add', 'set'],
+        preIcons: { add: 'search|svg', set: 'config|svg' }, //濡傛灉鏄涓〃鍗曪紝澧炲姞澶氫釜鎻掓Ы銆俿lots鏄脊鍑烘鎸夐挳鐨勬彃妲斤紝preIcons鏄彃妲藉搴旂殑鎸夐挳鍥炬爣
+        title: '涓嬪彂閰嶇疆',
+      },
+    ];
+    formSchema.value = getFormSchema(cType.value);
+    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) {}
   //鏆傚仠
@@ -204,7 +326,28 @@
 
   function handleItemSuccess(d, u) {
     getForm().setFieldsValue({
-      ITEM_CODE: d.values.values,
+      ITEM_CODE: d.values['val'],
     });
   }
+  /* 鍚勮〃鍗曞唴寮瑰嚭閫夋嫨妗嗛�夋嫨鎴愬姛鍚庝簨浠� */
+  function handleEntSuccess(d, u, item) {
+    var values = GetSelectSuccess(d, u, cType.value);
+    selectVals.value = values; //淇濆瓨寮瑰嚭妗嗛�夋嫨鐨勭粨鏋�
+    let _val = {};
+    _val[d.returnFieldName] = values[d.returnFieldName];
+    useFormData.value[item][1].setFieldsValue(_val);
+  }
+
+  /* 寮瑰嚭閫夋嫨妗� */
+  function handleCustClick(item) {
+    //鎵撳紑鑷畾涔夋ā鎬佹
+    OpenSelectItem(
+      useModalData.value[item][1].openModal, //甯﹀叆openModal鏂规硶
+      cType.value,
+      item,
+      [openRvModal],
+      selectVals.value['ID'],
+    ); //[openRvModal], selectVals.value['ID']杩欐槸鑷畾涔夊弬鏁帮紝鎸夊疄闄呴渶姹�
+  }
+  function RvItemSuccess(d, u) {}
 </script>

--
Gitblit v1.9.3