From 29568a6b76b70b358877dfd3ffe68ccbd42e8844 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期三, 26 六月 2024 21:55:20 +0800
Subject: [PATCH] 组合页面更新

---
 src/views/tigerprojects/system/lowcode/composition/CarGridNav.vue   |   89 ++++-------------
 src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts |  101 +++++++++++++++++++
 src/views/tigerprojects/system/lowcode/composition/index.vue        |   31 +++---
 src/views/tigerprojects/system/lowcode/composition/Config.vue       |   45 +++-----
 src/views/tigerprojects/system/lowcode/composition/LeftTree.vue     |   13 +-
 src/api/tigerapi/model/basModel.ts                                  |   11 ++
 6 files changed, 168 insertions(+), 122 deletions(-)

diff --git a/src/api/tigerapi/model/basModel.ts b/src/api/tigerapi/model/basModel.ts
index c510a3a..f2b418d 100644
--- a/src/api/tigerapi/model/basModel.ts
+++ b/src/api/tigerapi/model/basModel.ts
@@ -102,6 +102,14 @@
   REMARK: string;
 }
 
+export interface NavItem {
+  title: string;
+  icon: string;
+  color: string;
+  url: string;
+  action: string;
+}
+
 export type MaterialInfoPageListGetResultModel = BasicFetchResult<MaterialInfoListItem>;
 export type SupplierInfoPageListGetResultModel = BasicFetchResult<SupplierInfoListItem>;
 export type PackageRulePageListGetResultModel = BasicFetchResult<PackageRuleListItem>;
@@ -123,4 +131,7 @@
   GetCrudColSlots: () => [];
   nodeChange: ({}) => void,
   CreateIcon: (params: Recordable<any>) => string;
+  SelectNode: (selectedNodes: Ref<any[]>) => {};
+  GetNavItems: () => NavItem[];
+  naveChangeItem: (action: any, ...args) => void;
 }
diff --git a/src/views/tigerprojects/system/lowcode/composition/CarGridNav.vue b/src/views/tigerprojects/system/lowcode/composition/CarGridNav.vue
index d59402e..78c40a5 100644
--- a/src/views/tigerprojects/system/lowcode/composition/CarGridNav.vue
+++ b/src/views/tigerprojects/system/lowcode/composition/CarGridNav.vue
@@ -4,11 +4,11 @@
  * @version: 
  * @Date: 2024-06-20 12:13:27
  * @LastEditors: Ben Lin
- * @LastEditTime: 2024-06-26 16:00:06
+ * @LastEditTime: 2024-06-26 21:46:41
 -->
 <template>
-  <Card title="娣诲姞宸ヨ壓">
-    <CardGrid v-for="item in navItems" :key="item.title" @click="changeItem(item.action)">
+  <Card :title="GetTitle()['navTitle']">
+    <CardGrid v-for="item in GetNavItems()" :key="item.title" @click="naveChangeItem(item.action, openModal)">
       <span class="flex flex-col items-center">
         <Icon :icon="item.icon" :color="item.color" size="20" />
         <span class="text-md mt-2 truncate">{{ item.title }}</span>
@@ -25,25 +25,32 @@
   import { useModal } from '/@/components/Modal';
   import { useI18n } from '/@/hooks/web/useI18n';
   import { Ref, inject, ref, watch } from 'vue';
-  import { isNullOrEmpty } from '/@/utils/is';
+  import { isNullOrEmpty, isNullOrUnDef } from '/@/utils/is';
   import { useTabs } from '/@/hooks/web/useTabs';
   import { useMessage } from '/@/hooks/web/useMessage';
+  import { EntityCustFunctionType } from '/@/api/tigerapi/model/basModel';
 
   const objParams = inject('objParams') as Ref<any>;
-  const custImport = ref<any[]>(await import(`../entityts/${objParams.value['Name']}.ts`));
-  const [{ EditeOperation, GetBaseColumns, GetSearchForm, GetCrudForm, OthersValues }] =
-    custImport.value['default']();
+  const custImport = ref<any[]>([]);
+  const EntityCustFunction = ref([
+    {
+      GetTitle() {},
+      GetNavItems() {},
+      naveChangeItem(action: any, ...args) {},
+    } as EntityCustFunctionType,
+  ]);
+  /* 鍔ㄦ�乮mport瀹炰綋鍚�.ts鐨勮嚜瀹氫箟鏂规硶 */
+  try {
+    custImport.value = await import(`../entityts/${objParams.value['Name']}.ts`);
+  } catch (e) {}
+  const [{ GetTitle, GetNavItems, naveChangeItem }] =
+    isNullOrUnDef(custImport.value['default'])
+      ? EntityCustFunction.value
+      : custImport.value['default']();
   const { refreshPage } = useTabs();
   const { createErrorModal } = useMessage();
   const { t } = useI18n();
   const [register, { openModal }] = useModal();
-  interface NavItem {
-    title: string;
-    icon: string;
-    color: string;
-    url: string;
-    action: string;
-  }
 
   // watch(
   //   () => Prod_Code,
@@ -54,60 +61,6 @@
   //   },
   //   { deep: true },
   // );
-
-  // 蹇嵎瀵艰埅
-  const navItems: NavItem[] = [
-    {
-      title: '娣诲姞浜у搧宸ヨ壓璺嚎',
-      icon: 'add_green|svg',
-      color: '#1fdaca',
-      url: '/addRoute',
-      action: 'addRoute',
-    },
-    {
-      title: '娣诲姞瀹㈡埛宸ヨ壓璺嚎',
-      icon: 'add_customer|svg',
-      color: '#bf0c2c',
-      url: '/addCustomer',
-      action: 'addCustomer',
-    },
-  ];
-  function changeItem(action) {
-    openModal(true, {
-      title: '宸ヨ壓璺嚎鍒楄〃',
-      schemas: [
-        {
-          field: 'ROT_CODE',
-          component: 'Input',
-          label: '宸ヨ壓璺嚎缂栫爜',
-          colProps: {
-            span: 12,
-          },
-        },
-      ],
-      ItemColumns: [
-        {
-          title: t('宸ヨ壓璺嚎缂栫爜'),
-          dataIndex: 'ROT_CODE',
-          resizable: true,
-          sorter: true,
-          width: 200,
-        },
-        {
-          title: t('宸ヨ壓璺嚎鍚嶇О'),
-          dataIndex: 'ROT_NAME',
-          resizable: true,
-          sorter: true,
-          width: 180,
-        },
-      ],
-      tableName: 'MES_ROUTE',
-      rowKey: 'ROT_CODE',
-      returnFieldName: 'ROUTE_CODE', //杩斿洖鍊艰璧嬪�肩殑瀛楁鍚嶇О
-      searchInfo: { TABLE_NAME: 'MES_ROUTE' },
-      which: action,
-    });
-  }
 
   /**
    * @description: 閫夋嫨宸ヨ壓璺嚎鎴愬姛杩斿洖鏂规硶
diff --git a/src/views/tigerprojects/system/lowcode/composition/Config.vue b/src/views/tigerprojects/system/lowcode/composition/Config.vue
index 6bab5db..dd0d949 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-06-26 21:47:45
 -->
 <template>
-  <Card title="琛屼负閰嶇疆">
+  <Card :title="GetTitle()['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"
@@ -42,14 +42,11 @@
   const custImport = ref<any[]>([]);
   const EntityCustFunction = ref([
     {
-      ActionItem(params, data, ...args) {},
-      EditOperation(data, d, u) {},
-      GetBaseColumns() {},
-      GetSearchForm() {},
       GetCrudForm() {},
       GetCrudColSlots(val, id) {},
       OpenSelectItem(openItemModal: Fn, ...args) {},
       GetSelectSuccess(d, u, ...args) {},
+      GetTitle() {},
       nodeChange(params: {
         resetFields: any;
         setFieldsValue: any;
@@ -62,11 +59,10 @@
   try {
     custImport.value = await import(`../entityts/${objParams.value['Name']}.ts`);
   } catch (e) {}
-  const [{ GetCrudForm, GetCrudColSlots, nodeChange, OpenSelectItem, GetSelectSuccess }] =
+  const [{ GetCrudForm, GetCrudColSlots, nodeChange, OpenSelectItem, GetSelectSuccess, GetTitle }] =
     isNullOrUnDef(custImport.value['default'])
       ? EntityCustFunction.value
       : custImport.value['default']();
-  const crudColSlots = ref<any>(GetCrudColSlots());
 
   const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({
     labelWidth: 120,
@@ -104,26 +100,17 @@
   });
 
   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();
+      // 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) {}
   }
 
   /**
diff --git a/src/views/tigerprojects/system/lowcode/composition/LeftTree.vue b/src/views/tigerprojects/system/lowcode/composition/LeftTree.vue
index 33c6f61..6c0249c 100644
--- a/src/views/tigerprojects/system/lowcode/composition/LeftTree.vue
+++ b/src/views/tigerprojects/system/lowcode/composition/LeftTree.vue
@@ -4,7 +4,7 @@
  * @version: 
  * @Date: 2024-06-26 15:31:43
  * @LastEditors: Ben Lin
- * @LastEditTime: 2024-06-26 18:48:09
+ * @LastEditTime: 2024-06-26 21:41:54
 -->
 <template>
   <GeneralTree
@@ -25,6 +25,7 @@
   import { TreeItem } from '/@/components/TigerTree';
   import { EntityCustFunctionType } from '/@/api/tigerapi/model/basModel';
 
+  const emit = defineEmits(['select']);
   const objParams = inject('objParams') as Ref<any>;
   const nodeType = inject('nodeType') as Ref<any>;
   const selectedNodes = inject('selectedNodes') as Ref<any>;
@@ -32,13 +33,14 @@
   const EntityCustFunction = ref([
     {
       CreateIcon(params: Recordable<any>) {},
+      SelectNode(selectedNodes: Ref<any[]>) {},
     } as EntityCustFunctionType,
   ]);
   /* 鍔ㄦ�乮mport瀹炰綋鍚�.ts鐨勮嚜瀹氫箟鏂规硶 */
   try {
     custImport.value = await import(`../entityts/${objParams.value['Name']}.ts`);
   } catch (e) {}
-  const [{ CreateIcon }] = isNullOrUnDef(custImport.value['default'])
+  const [{ CreateIcon, SelectNode }] = isNullOrUnDef(custImport.value['default'])
     ? EntityCustFunction.value
     : custImport.value['default']();
   const treeData = ref<TreeItem[]>([]);
@@ -76,13 +78,9 @@
   }
 
   function handleSelect(Id = '', info) {
-    // searchInfo.Id = Id;
     nodeType.value = info.selectedNodes[0].type;
     selectedNodes.value = info.selectedNodes;
-    // prodCode.value =rotType.value=='Product'? info.selectedNodes[0].code: prodCode.value;
-    // actionCode.value = rotType.value == 'Action' ? info.selectedNodes[0].code : actionCode.value;
-    // custCode.value = rotType.value == 'Customer' ? info.selectedNodes[0].code : custCode.value;
-    // reload();
+    emit('select', SelectNode(selectedNodes));
   }
 
   /**
@@ -92,6 +90,7 @@
    */
   function UnSelect(node) {
     nodeType.value = '';
+    emit('select', SelectNode(undefined));
     // reload();
   }
 </script>
diff --git a/src/views/tigerprojects/system/lowcode/composition/index.vue b/src/views/tigerprojects/system/lowcode/composition/index.vue
index 9803491..3aa6a5a 100644
--- a/src/views/tigerprojects/system/lowcode/composition/index.vue
+++ b/src/views/tigerprojects/system/lowcode/composition/index.vue
@@ -9,12 +9,12 @@
     @back="goBack"
   >
     <Suspense class="w-1/4 xl:w-1/5">
-      <LeftTree />
+      <LeftTree @select="NodeSelect"/>
     </Suspense>
     <Suspense>
       <div class="w-3/4 xl:w-4/5 p-5">
-        <CarGridNav v-if="entityName == 'ProdRouteBinding' && nodeType == 'Product'" />
-        <Config v-if="entityName == 'ProdRouteBinding' && nodeType == 'Action'" />
+        <CarGridNav v-if="showNav" />
+        <Config v-if="showConfig" />
       </div>
     </Suspense>
     <!-- <BasicTable class="w-3/4 xl:w-4/5" @register="registerTable">
@@ -65,9 +65,8 @@
   import LeftTree from './LeftTree.vue';
   import CustModal from '/@/views/components/CustModal.vue';
   import { OpenCustModal } from '../data';
-  import { Ref, onMounted, provide, reactive, ref } from 'vue';
+  import { Ref, onMounted, provide, ref } from 'vue';
   import { useRoute } from 'vue-router';
-  import { useDrawer } from '/@/components/Drawer';
   import { BasicForm, useForm } from '/@/components/Form/index';
   import { useTabs } from '/@/hooks/web/useTabs';
   import { isNullOrUnDef } from '/@/utils/is';
@@ -80,29 +79,21 @@
   const { setTitle } = useTabs();
   const objParams = ref(JSON.parse(decodeURI(route.params?.id as string))); //ref(JSON.parse(history.state.obj))
   const entityName = ref(objParams.value.Name);
-  const formSchemas = ref({}); //寮瑰嚭妗嗘垨楂樼骇椤甸潰澶氳〃鍗曠粨鏋�
   const useModalData = ref({}); //琛ㄥ崟涓彃妲芥覆鏌撴寜閽墦寮�妯℃�佹useModal鏂规硶
   const useFormData = ref({});
-  const colSlots = ref<any>(objParams.value.colSlots); //鎸夐挳鎻掓Ы
-  const crudColSlots = ref<any>(objParams.value.crudColSlots);
   const cType = ref('');
   const dtlSlots = ref([] as any[]);
   const selectVals = ref({});
-  const baseCards = ref([] as any[]);
-  const otherCards = ref([] as any[]);
-  const searchInfo = reactive<Recordable>({});
   const dense = isNullOrUnDef(objParams.value.dense) ? ref(false) : ref(objParams.value.dense);
   const pageTitle = ref(objParams.value.pageTitle);
   const pageContent = ref(objParams.value.pageContent);
-  const actionCode = ref('');
-  const custCode = ref('');
   const nodeType = ref('');
   const selectedNodes = ref([]);
   const isMounted = ref(false);
+  const showNav = ref(false);
+  const showConfig = ref(false);
   const custImport = ref<any>(null);
   const [registerCust, { openModal: openCustomModal, closeModal }] = useModal();
-  const [registerItemAdd, { openModal: openItemModal }] = useModal();
-  const [registerDrawer, { openDrawer }] = useDrawer();
   provide<Ref<string>>('nodeType', nodeType);
   provide<Ref<any>>('objParams', objParams);
   provide<Ref<any>>('selectedNodes', selectedNodes);
@@ -134,6 +125,16 @@
   });
 
   /**
+   * @description: 閫夋嫨鑺傜偣鏃舵牴鎹繑鍥炵殑浜嬩欢鍙傛暟鏄剧ず闅愯棌鐩稿簲缁勪欢
+   * @param {*} e
+   * @return {*}
+   */  
+  function NodeSelect(e) {
+    showConfig.value = e.showConfig;
+    showNav.value = e.showNav;
+  }
+
+  /**
    * @description: 寮瑰嚭妗嗙‘瀹氳繑鍥�
    * @param {*} d
    * @return {*}
diff --git a/src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts b/src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts
index 7098435..d142b78 100644
--- a/src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts
+++ b/src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts
@@ -4,15 +4,16 @@
  * @version:
  * @Date: 2024-06-19 20:34:27
  * @LastEditors: Ben Lin
- * @LastEditTime: 2024-06-26 18:41:16
+ * @LastEditTime: 2024-06-26 21:49:44
  */
 
-import { Ref, unref } from 'vue';
+import { Ref, ref, unref } from 'vue';
 import { GetRoutePTree } from '/@/api/tigerapi/mes/router';
 import { GetEnum, convertToTree, getEntity } from '/@/api/tigerapi/system';
 import { useLocale } from '/@/locales/useLocale';
-import { isNullOrEmpty } from '/@/utils/is';
+import { isNullOrEmpty, isNullOrUnDef } from '/@/utils/is';
 import { useI18n } from '/@/hooks/web/useI18n';
+import { NavItem } from '/@/api/tigerapi/model/basModel';
 
 const { t } = useI18n();
 const { getLocale } = useLocale();
@@ -332,6 +333,100 @@
       }
       return value;
     },
+    /**
+     * @description: 鑾峰彇鏍囬淇℃伅
+     * @param {string} type
+     * @return {*}
+     */
+    GetTitle: () => {
+      return {
+        configTitle: '琛屼负閰嶇疆',
+        navTitle: '娣诲姞宸ヨ壓璺嚎',
+      };
+    },
+    /**
+     * @description: 鏍规嵁閫変腑鐨勬爲鑺傜偣鍒ゆ柇瑕佸垏鎹㈠摢涓粍浠�
+     * @param {Ref} selectedNodes
+     * @return {*}
+     */
+    SelectNode: (selectedNodes: Ref<any[]>) => {
+      let result = { showConfig: false, showNav: false };
+      if (isNullOrUnDef(selectedNodes)) {
+        return result;
+      }
+      if (selectedNodes.value[0].type == 'Product') {
+        result.showNav = true;
+        result.showConfig = false;
+      }
+      if (selectedNodes.value[0].type == 'Action') {
+        result.showNav = false;
+        result.showConfig = true;
+      }
+      return result;
+    },
+    /**
+     * @description: 鑾峰彇瀵艰埅椤�
+     * @return {*}
+     */
+    GetNavItems: () => {
+      return [
+        {
+          title: '娣诲姞浜у搧宸ヨ壓璺嚎',
+          icon: 'add_green|svg',
+          color: '#1fdaca',
+          url: '/addRoute',
+          action: 'addRoute',
+        },
+        {
+          title: '娣诲姞瀹㈡埛宸ヨ壓璺嚎',
+          icon: 'add_customer|svg',
+          color: '#bf0c2c',
+          url: '/addCustomer',
+          action: 'addCustomer',
+        },
+      ] as NavItem[];
+    },
+    /**
+     * @description: 瀵艰埅椤甸潰鍒囨崲鎸夐挳鏃惰皟鐢ㄦ柟娉�
+     * @param {any} action
+     * @return {*}
+     */
+    naveChangeItem: (action: any, ...args) => {
+      args[0](true, {
+        title: '宸ヨ壓璺嚎鍒楄〃',
+        schemas: [
+          {
+            field: 'ROT_CODE',
+            component: 'Input',
+            label: '宸ヨ壓璺嚎缂栫爜',
+            colProps: {
+              span: 12,
+            },
+          },
+        ],
+        ItemColumns: [
+          {
+            title: t('宸ヨ壓璺嚎缂栫爜'),
+            dataIndex: 'ROT_CODE',
+            resizable: true,
+            sorter: true,
+            width: 200,
+          },
+          {
+            title: t('宸ヨ壓璺嚎鍚嶇О'),
+            dataIndex: 'ROT_NAME',
+            resizable: true,
+            sorter: true,
+            width: 180,
+          },
+        ],
+        tableName: 'MES_ROUTE',
+        rowKey: 'ROT_CODE',
+        returnFieldName: 'ROUTE_CODE', //杩斿洖鍊艰璧嬪�肩殑瀛楁鍚嶇О
+        searchInfo: { TABLE_NAME: 'MES_ROUTE' },
+        which: action,
+      });
+    },
   };
 
   const itemCodeModalCfg = {

--
Gitblit v1.9.3