From b6163e1bed94b4d02d1b6f01fdc2eb3f15ca22e3 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期一, 07 十月 2024 15:47:46 +0800
Subject: [PATCH] 保存默认工艺路线,工单批次优化

---
 src/views/tigerprojects/system/lowcode/normal/mainTable.vue |   83 ++++++++++++++++++++++++++---------------
 1 files changed, 53 insertions(+), 30 deletions(-)

diff --git a/src/views/tigerprojects/system/lowcode/normal/mainTable.vue b/src/views/tigerprojects/system/lowcode/normal/mainTable.vue
index 7a3a19d..7ccec2c 100644
--- a/src/views/tigerprojects/system/lowcode/normal/mainTable.vue
+++ b/src/views/tigerprojects/system/lowcode/normal/mainTable.vue
@@ -2,6 +2,7 @@
   <div>
     <BasicTable @register="registerTable">
       <template #toolbar>
+        <!-- 鏍规嵁鑿滃崟璁剧疆鐨勬寜閽紝鑷姩鐢熸垚 -->
         <a-button
           type="primary"
           v-for="item in buttons.filter((m) => m['BUTTON_TYPE'] == 0)"
@@ -25,7 +26,7 @@
           preIcon="search|svg"
         />
         <GeneralModal
-          @register="registerItemAdd"
+          @register="useModalInTableForm[item]"
           @success="(d, u) => handleItemSuccess(d, u, item)"
         />
       </template>
@@ -89,8 +90,7 @@
   import { GenerateActionButton, initRoute, OpenCustModal } from '../data';
   import LogicFlow from '@logicflow/core';
   import { isFunction } from 'xe-utils';
-import { CustModalParams } from '/@/api/tigerapi/model/systemModel';
-import { values } from 'lodash-es';
+  import { CustModalParams } from '/@/api/tigerapi/model/systemModel';
 
   const { t } = useI18n();
   const { currentRoute } = useRouter();
@@ -110,9 +110,9 @@
   const entityName = ref(objParams.value['ID']);
   const go = useGo();
   const [registerDrawer, { openDrawer }] = useDrawer();
-  const [registerItemAdd, { openModal: openItemModal }] = useModal();
   const [registerRv, { openModal: openRvModal, closeModal: RvcloseModal }] = useModal();
   const [registerCust, { openModal: openCustModal }] = useModal();
+  const [registerCrud, { openModal: openCrudModal }] = useModal();
   const cType = ref('');
   const formSchemas = ref({}); //寮瑰嚭妗嗗琛ㄥ崟缁撴瀯
   const routeData = ref({
@@ -157,9 +157,14 @@
   const dtlSlots = ref<any[]>([]);
   const useformdata = GetUseForm && isFunction(GetUseForm) ? GetUseForm() : {};
   const useFormData = ref<any>(useformdata);
-  /* 琛ㄥ崟涓彃妲芥覆鏌撴寜閽墦寮�妯℃�佹useModal鏂规硶 */
+  /* 鑷畾涔夋ā鎬佺獥鍙d腑琛ㄥ崟涓彃妲芥覆鏌撴寜閽墦寮�妯℃�佹useModal鏂规硶 */
   const modals = GetUseModals && isFunction(GetUseModals) ? GetUseModals() : { useModalData: {} };
   const useModalData = ref(modals['useModalData']);
+  /* 琛ㄦ牸鍐呯殑鎻掓Ы娓叉煋鐨勫脊鍑洪�夋嫨妗嗗垪琛� */
+  const useModalInTableForm = ref<any>({});
+  colSlots.value.map((x) => {
+    useModalInTableForm.value[x] = useModal();
+  });
   /* 鑾峰彇鑷畾涔夋暟鎹� */
   const custData = GetCustData && isFunction(GetCustData) ? GetCustData() : { isCustEl: {} };
   const isCustEl = ref(custData['isCustEl']);
@@ -188,7 +193,15 @@
     bordered: true,
     canResize: true,
     showIndexColumn: false,
-    actionColumn: ActionColumn, //鑷畾涔夋搷浣滃垪
+    actionColumn: ActionColumn
+      ? ActionColumn
+      : {
+          width: 120,
+          title: '鎿嶄綔',
+          dataIndex: 'action',
+          slots: { customRender: 'action' },
+          fixed: 'right',
+        }, //鑷畾涔夋搷浣滃垪
   });
 
   watch(
@@ -226,7 +239,7 @@
    * @return {*}
    */
   async function init(lf, rotId) {
-    initRoute(lf, rotId, routeData, currlf);
+    initRoute(lf, rotId, routeData, currlf, null);
   }
 
   /**
@@ -250,12 +263,15 @@
       currlf,
       selectVals,
       colSlots,
+      ifSave: true,
     };
 
+    /* 鏍规嵁鑿滃崟璁剧疆鐨勬寜閽嚜鍔ㄧ敓鎴愭搷浣滃垪涓殑鎸夐挳 */
     const actionItem = GenerateActionButton(params, buttons, openDrawer, reload);
     if (isNullOrUnDef(custImport.value['default'])) {
       return actionItem;
     }
+    /* 鏍规嵁鍔ㄦ�佸姞杞界殑瀹炰綋绫诲悕.ts涓殑ActionItem鏂规硶锛屾覆鏌撴搷浣滃垪涓殑鎸夐挳鏂规硶 */
     return nActionItem(
       params,
       actionItem,
@@ -267,6 +283,7 @@
       go,
       setProps,
       openCustModal,
+      openCrudModal,
     );
   }
 
@@ -289,18 +306,21 @@
    */
   function handleCreate(fnName: string) {
     if (isNullOrUnDef(custImport.value['default'])) {
+      /* 濡傛灉鍔ㄦ�佸姞杞界殑瀹炰綋绫�.ts涓嶅瓨鍦紝鍒欑洿鎺ユ墦寮�渚ц竟妗� */
       openDrawer(true, {
-        isUpdate: false,
-        entityName: entityName.value,
-        formJson: _crudFormSchema.value,
-        crudColSlots: objParams.value['crudColSlots'],
-        isExistSql: isExistSql.value,
+        isUpdate: false, //鏄柊澧炶繕鏄紪杈戯紝false-鏂板|true-缂栬緫
+        entityName: entityName.value, //瀹炰綋绫诲悕
+        formJson: _crudFormSchema.value, //鏂板缂栬緫鐨勮〃鍗曠粨鏋�
+        crudColSlots: objParams.value['crudColSlots'], //鏂板缂栬緫鐨勮〃鍗曚腑鐨勬彃妲藉垪琛�
+        isExistSql: isExistSql.value, //鏄惁瀛樺湪妫�鏌ql锛屾瘮濡�: XXX_CODE = '12345'
+        ifSave: true, //鏄惁鎻愪氦琛ㄥ崟鏃朵繚瀛樺埌鏁版嵁搴擄紝鍚�-鏆傚瓨|鏄�-淇濆瓨
       });
     } else {
+      /* 濡傛灉鍔ㄦ�佸姞杞界殑瀹炰綋绫�.ts瀛樺湪锛屾牴鎹�.ts鏂囦欢涓殑鏂规硶鏉ユ墽琛屾搷浣� */
       const [{ CreateAction }] = custImport.value['default']();
-      const result = CreateAction(fnName);
+      const result = CreateAction(entityName.value, colSlots.value);
       switch (result.action) {
-        case 'go':
+        case 'go' /* 璺宠浆椤甸潰 */:
           // 灏嗗璞¤浆鎹负JSON瀛楃涓插苟淇濆瓨鍒皊essionStorage
           sessionStorage.setItem(
             `${result.params.Name}_params`,
@@ -310,13 +330,14 @@
             `/${result.url}/${encodeURI(JSON.stringify({ sName: result.params.Name, Name: result.params.Name }))}`,
           );
           break;
-        case 'drawer':
+        case 'drawer' /* 鎵撳紑渚ц竟妗� */:
           openDrawer(true, {
-            isUpdate: false,
-            entityName: entityName.value,
-            formJson: _crudFormSchema.value,
-            crudColSlots: objParams.value['crudColSlots'],
-            isExistSql: isExistSql.value,
+            isUpdate: false, //鏄柊澧炶繕鏄紪杈戯紝false-鏂板|true-缂栬緫
+            entityName: entityName.value, //瀹炰綋绫诲悕
+            formJson: _crudFormSchema.value, //鏂板缂栬緫鐨勮〃鍗曠粨鏋�
+            crudColSlots: objParams.value['crudColSlots'], //鏂板缂栬緫鐨勮〃鍗曚腑鐨勬彃妲藉垪琛�
+            isExistSql: isExistSql.value, //鏄惁瀛樺湪妫�鏌ql锛屾瘮濡�: XXX_CODE = '12345'
+            ifSave: true, //鏄惁鎻愪氦琛ㄥ崟鏃朵繚瀛樺埌鏁版嵁搴擄紝鍚�-鏆傚瓨|鏄�-淇濆瓨
           });
           break;
       }
@@ -330,7 +351,7 @@
    * @return {*}
    */
   function handleSuccess(d, u) {
-    if(CustFunc && isFunction(CustFunc)){
+    if (CustFunc && isFunction(CustFunc)) {
       CustFunc({
         values: d,
       });
@@ -353,7 +374,7 @@
       )
         .then((m) => {
           const [{ GetSelectSuccess: GetSelectSuccess2 }] = m.default();
-          getForm().setFieldsValue(GetSelectSuccess2(d, u));
+          getForm().setFieldsValue(GetSelectSuccess2(d, u, objParams.value['ID']));
         })
         .catch(() => {
           getForm().setFieldsValue({
@@ -376,10 +397,10 @@
       )
         .then((m) => {
           const [{ OpenSelectItem }] = m.default();
-          OpenSelectItem(openItemModal);
+          OpenSelectItem(useModalInTableForm.value[item][1].openModal);
         })
         .catch(() => {
-          openItemModal(true, {
+          useModalInTableForm.value[item][1].openModal(true, {
             title: '鐗╂枡鍒楄〃',
             schemas: [
               {
@@ -419,7 +440,7 @@
    * @description: 寮瑰嚭妗嗙‘瀹氳繑鍥�
    * @param {*} d
    * @return {*}
-   */  
+   */
   function custSuccess(d) {
     reload();
   }
@@ -428,8 +449,10 @@
    * @description: 寮瑰嚭妗嗗彇娑堣繑鍥�
    * @param {*} reload
    * @return {*}
-   */  
-  function custCancel() {reload();}
+   */
+  function custCancel() {
+    reload();
+  }
 
   /**
    * @description: 鍚勮〃鍗曞唴寮瑰嚭閫夋嫨妗嗛�夋嫨鎴愬姛鍚庢柟娉�
@@ -445,11 +468,11 @@
       selectVals.value = values; //淇濆瓨寮瑰嚭妗嗛�夋嫨鐨勭粨鏋�
       let _val = {};
       d.returnFieldName.map((x) => {
-          _val[x] = values[x];
-        });
+        _val[x] = values[x];
+      });
       useFormData.value[item][1].setFieldsValue(_val);
       /* 閽堝宸ュ崟鐨勬柟娉� */
-      if (d.returnFieldName.filter((x) => x == 'ROUTE_CODE') && item == 'prodinfo' ) {
+      if (d.returnFieldName.filter((x) => x == 'ROUTE_CODE') && item == 'prodinfo') {
         routeData.value = {
           nodes: [],
           edges: [],

--
Gitblit v1.9.3