From 2abb91c893f2eed3761bd09aabe12400460d2863 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期五, 21 六月 2024 00:16:35 +0800
Subject: [PATCH] 产品工艺路线更新

---
 src/views/tigerprojects/bas/MaterialInfo/index.vue                 |   14 ++
 src/views/tigerprojects/system/lowcode/composition/RouteAction.vue |  142 ++++++++++++++++++++++++++++
 src/views/tigerprojects/system/lowcode/composition/index.vue       |   58 ++++++++---
 src/views/tigerprojects/system/lowcode/data.ts                     |    5 
 src/views/tigerprojects/system/role/RoleDrawer.vue                 |   21 +++
 src/components/Tree/src/types/tree.ts                              |    5 +
 src/api/tigerapi/system.ts                                         |    2 
 7 files changed, 225 insertions(+), 22 deletions(-)

diff --git a/src/api/tigerapi/system.ts b/src/api/tigerapi/system.ts
index 986e464..ae1367b 100644
--- a/src/api/tigerapi/system.ts
+++ b/src/api/tigerapi/system.ts
@@ -745,7 +745,7 @@
 }
 async function getListByPageAsync(params: any) {
   const data = await defHttp.post(
-    { url: Api.QueryUrl, params },
+    { url: Api.QueryUrl, params,timeout:30000 },
     {
       isTransformResponse: false,
     },
diff --git a/src/components/Tree/src/types/tree.ts b/src/components/Tree/src/types/tree.ts
index a082f05..aab8adf 100644
--- a/src/components/Tree/src/types/tree.ts
+++ b/src/components/Tree/src/types/tree.ts
@@ -106,6 +106,11 @@
     default: () => [],
   },
 
+  halfCheckedKeys: {
+    type: [Array, Object] as PropType<KeyType[]>,
+    default: () => [],
+  },
+
   beforeRightClick: {
     type: Function as PropType<(...arg: any) => Promise<ContextMenuItem[] | ContextMenuOptions>>,
     default: undefined,
diff --git a/src/views/tigerprojects/bas/MaterialInfo/index.vue b/src/views/tigerprojects/bas/MaterialInfo/index.vue
index c71f91d..8a3b573 100644
--- a/src/views/tigerprojects/bas/MaterialInfo/index.vue
+++ b/src/views/tigerprojects/bas/MaterialInfo/index.vue
@@ -43,6 +43,7 @@
   import { columns, searchFormSchema } from './Material.data';
   import { DeleteMaterial, getMaterialListByPage } from '../../../../api/tigerapi/bas/MaterialInfo';
   import { useModal } from '/@/components/Modal';
+  import { getListByPage } from '/@/api/tigerapi/system';
   import { useGo } from '/@/hooks/web/usePage';
 
   const go = useGo();
@@ -50,7 +51,8 @@
   const [registerModal, { openModal: openMaterialModal }] = useModal();
   const [registerTable, { reload }] = useTable({
     title: '鐗╂枡鍒楄〃',
-    api: getMaterialListByPage,
+    api: getListByPage,
+    searchInfo: { TABLE_NAME: 'BAS_ITEM' },
     columns,
     formConfig: {
       labelWidth: 120,
@@ -103,7 +105,7 @@
    * @description: 璺宠浆浜у搧宸ヨ壓缁戝畾椤甸潰
    * @param {*} record
    * @return {*}
-   */  
+   */
   function handleBinding(record: Recordable) {
     const id = {
       ID: record.ID,
@@ -112,7 +114,15 @@
       Title: `浜у搧[${record.ITEM_CODE}]宸ヨ壓缁戝畾`,
       colSlots: [],
       crudColSlots: [],
+      dense: true,
+      pageTitle: `浜у搧宸ヨ壓缁戝畾`,
+      pageContent: `杩欓噷鏄鐞嗕骇鍝佺殑宸ヨ壓缁戝畾锛屼竴涓骇鍝佸彲浠ョ粦瀹氬涓伐鑹鸿矾绾縛,
     };
     go(`/ProdRouteBinding/CP/${encodeURI(JSON.stringify(id))}`);
+    // let obj = JSON.stringify(id);
+    // push({
+    //   path: '/ProdRouteBinding',
+    //   state: {obj}, //HTML5 History API 鐨勪紶鍙傦紝鍙傛暟闅愯棌涓嶅湪鍦板潃鏍忔樉绀猴紙history锛�
+    // })
   }
 </script>
diff --git a/src/views/tigerprojects/system/lowcode/composition/RouteAction.vue b/src/views/tigerprojects/system/lowcode/composition/RouteAction.vue
new file mode 100644
index 0000000..5df9cec
--- /dev/null
+++ b/src/views/tigerprojects/system/lowcode/composition/RouteAction.vue
@@ -0,0 +1,142 @@
+<!--
+ * @Description: 宸ヨ壓璺嚎娣诲姞椤甸潰
+ * @Author: Ben Lin
+ * @version: 
+ * @Date: 2024-06-20 12:13:27
+ * @LastEditors: Ben Lin
+ * @LastEditTime: 2024-06-21 00:11:00
+-->
+<template>
+  <Card title="鎿嶄綔">
+    <CardGrid v-for="item in navItems" :key="item.title" @click="changeItem(item.action)">
+      <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>
+      </span>
+    </CardGrid>
+  </Card>
+  <GeneralModal @register="register" @success="handleSuccess"></GeneralModal>
+</template>
+<script lang="ts" setup>
+  import { Card, CardGrid } from 'ant-design-vue';
+  import Icon from '@/components/Icon/Icon.vue';
+  import { RouteToProd } from '/@/api/tigerapi/mes/router';
+  import GeneralModal from '/@/views/components/GeneralModal.vue';
+  import { useModal } from '/@/components/Modal';
+  import { useI18n } from '/@/hooks/web/useI18n';
+
+  const { t } = useI18n();
+  const [register, { openModal }] = useModal();
+  interface NavItem {
+    title: string;
+    icon: string;
+    color: string;
+    url: string;
+    action: string;
+  }
+  // 蹇嵎瀵艰埅
+  const navItems: NavItem[] = [
+    {
+      title: '娣诲姞宸ヨ壓璺嚎',
+      icon: 'ion:home-outline',
+      color: '#1fdaca',
+      url: '/workbench',
+      action: 'addRoute',
+    },
+    {
+      title: '娣诲姞瀹㈡埛',
+      icon: 'materialreq|svg',
+      color: '#bf0c2c',
+      url: '/materialreq',
+      action: 'addCustomer',
+    },
+    // {
+    //   title: '閿�鍞嚭搴撳崟',
+    //   icon: 'Out|svg',
+    //   color: '#e18525',
+    //   url: '/saleoutorder',
+    // },
+    // {
+    //   title: '瀹屽伐鍏ュ簱鍗�',
+    //   icon: 'In|svg',
+    //   color: '#3fb27f',
+    //   url: '/finishedwarehouse',
+    // },
+    // {
+    //   title: '鐢熶骇閫�鏂欏崟',
+    //   icon: 'materialret|svg',
+    //   color: '#4daf1bc9',
+    //   url: '/materialret',
+    // },
+    // {
+    //   title: '鐩樼偣鍗�',
+    //   icon: 'inventory|svg',
+    //   color: '#00d8ff',
+    //   url: '/inventory',
+    // },
+    // {
+    //   title: '璋冩嫧鍗�',
+    //   icon: 'transfer|svg',
+    //   color: '#00d8ff',
+    //   url: '/transfer',
+    // },
+    // {
+    //   title: '瀹炴椂搴撳瓨',
+    //   icon: 'WmsItem|svg',
+    //   color: '#00d8ff',
+    //   url: '/WmsItem',
+    // },
+  ];
+  function changeItem(action) {
+    if (action == 'addRoute') {
+      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' },
+      });
+    }
+  }
+
+  /**
+   * @description: 閫夋嫨宸ヨ壓璺嚎鎴愬姛杩斿洖鏂规硶
+   * @param {*} d
+   * @param {*} u
+   * @return {*}
+   */
+  function handleSuccess(d, u) {
+    let codes = d.values.id.split(',');
+    let eintity: any[] = [];
+    var i;
+    for (i = 0; i < codes.length; i++) {
+      RouteToProd({ rotId: codes[i], prodCode: 'K5811AA015007' }).then(() => {});
+    }
+  }
+</script>
diff --git a/src/views/tigerprojects/system/lowcode/composition/index.vue b/src/views/tigerprojects/system/lowcode/composition/index.vue
index 6657b6b..c0b4c7e 100644
--- a/src/views/tigerprojects/system/lowcode/composition/index.vue
+++ b/src/views/tigerprojects/system/lowcode/composition/index.vue
@@ -1,5 +1,13 @@
 <template>
-  <PageWrapper dense contentFullHeight fixedHeight contentClass="flex">
+  <PageWrapper
+    :dense="dense"
+    contentFullHeight
+    fixedHeight
+    contentClass="flex"
+    :title="pageTitle"
+    :content="pageContent"
+    @back="goBack"
+  >
     <GeneralTree
       class="w-1/4 xl:w-1/5"
       @select="handleSelect"
@@ -10,7 +18,9 @@
     /><!--
       add
       @handle-add="handleAdd" -->
-    <div class="w-3/4 xl:w-4/5"></div>
+    <div class="w-3/4 xl:w-4/5 p-5">
+      <RouteAction v-if="entityName == 'ProdRouteBinding'" />
+    </div>
     <!-- <BasicTable class="w-3/4 xl:w-4/5" @register="registerTable">
       <template #toolbar>
         <a-button type="primary" @click="handleCreate" preIcon="add_02|svg"> 鏂板 </a-button>
@@ -21,7 +31,7 @@
         </template>
       </template>
     </BasicTable> -->
-    <normalDrawer @register="registerDrawer" @success="handleSuccess" />
+    <!-- <normalDrawer @register="registerDrawer" @success="handleSuccess" /> -->
     <CustModal
       @register="registerCust"
       @success="custSuccess"
@@ -56,6 +66,7 @@
   import { useModal } from '@/components/Modal';
   import normalDrawer from '../normalDrawer.vue';
   import GeneralModal from '/@/views/components/GeneralModal.vue';
+  import RouteAction from './RouteAction.vue';
   import CustModal from '/@/views/components/CustModal.vue';
   import {
     GetActionsData,
@@ -63,6 +74,7 @@
     OpenCustModal,
     fetchTreeData,
     getFormSchema,
+    getHomeUrl,
     getOthersValues,
   } from '../data';
   import { onMounted, reactive, ref } from 'vue';
@@ -72,13 +84,16 @@
   import { TreeItem } from '/@/components/TigerTree';
   import { createIconByType } from '../data';
   import { RouteToProd } from '/@/api/tigerapi/mes/router';
-import { useTabs } from '/@/hooks/web/useTabs';
+  import { useTabs } from '/@/hooks/web/useTabs';
+  import { isNullOrUnDef } from '/@/utils/is';
+  import { useGo } from '/@/hooks/web/usePage';
 
   defineOptions({ name: 'DeptManagement' });
 
+  const go = useGo();
   const route = useRoute();
   const { setTitle } = useTabs();
-  const objParams = ref(JSON.parse(decodeURI(route.params?.id as string)));
+  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鏂规硶
@@ -94,6 +109,9 @@
   const treeData = ref<TreeItem[]>([]);
   const title = ref('');
   const fieldNames = ref({});
+  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 others = ref(getOthersValues(entityName.value, objParams.value.CODE, objParams.value.ID));
   const [registerCust, { openModal: openCustomModal, closeModal }] = useModal();
   const [registerItemAdd, { openModal: openItemModal }] = useModal();
@@ -127,13 +145,21 @@
    * @description: 鑾峰彇鏍戝舰鏁版嵁
    * @param {*} type
    * @return {*}
-   */ 
+   */
   async function fetch(type: string) {
     //鏍规嵁type鑾峰彇鏍戝舰鏁版嵁
     const data = await fetchTreeData(type, objParams.value.CODE);
     title.value = data.title;
     treeData.value = data.treeData;
     fieldNames.value = data.fieldNames;
+  }
+
+  /**
+   * @description: 椤甸潰宸︿晶鐐瑰嚮杩斿洖閾炬帴鏃剁殑鎿嶄綔
+   * @return {*}
+   */  
+  function goBack() {
+    go(getHomeUrl(entityName.value));
   }
 
   // function handleAdd(){
@@ -145,7 +171,7 @@
    * @param {*} params
    * @param {*} type
    * @return {*}
-   */  
+   */
   function createIcon(params: Recordable<any>) {
     return createIconByType(params, entityName.value);
   }
@@ -213,9 +239,9 @@
     //     others: others.value,
     //   });
     // });
-    RouteToProd({rotId: 'e4712192f75b465585107fdcd13d8003', prodCode: 'K5019AA013517'}).then(() => {
-
-    });
+    RouteToProd({ rotId: 'e4712192f75b465585107fdcd13d8003', prodCode: 'K5019AA013517' }).then(
+      () => {},
+    );
   }
 
   // function handleEdit(record: Recordable) {
@@ -229,14 +255,14 @@
   //   console.log(record);
   // }
 
-  function handleSelect(deptId = '') {
+  function handleSelect(deptId = '', info) {
     searchInfo.deptId = deptId;
-    reload();
+    // reload();
   }
 
-  function handleSuccess() {
-    reload();
-  }
+  // function handleSuccess() {
+  //   reload();
+  // }
 
   /**
    * @description: 寮瑰嚭妗嗙‘瀹氳繑鍥�
@@ -244,7 +270,7 @@
    * @return {*}
    */
   function custSuccess(d) {
-    reload();
+    // reload();
   }
 
   /**
diff --git a/src/views/tigerprojects/system/lowcode/data.ts b/src/views/tigerprojects/system/lowcode/data.ts
index da78127..ca94f66 100644
--- a/src/views/tigerprojects/system/lowcode/data.ts
+++ b/src/views/tigerprojects/system/lowcode/data.ts
@@ -626,6 +626,9 @@
     case 'BAS_LABEL_VAR':
       url = `/BAS_LABEL_TEMP/LC/${encodeURI(JSON.stringify({ ID: 'BAS_LABEL_TEMP', colSlots: [], crudColSlots: [] }))}`;
       break;
+    case 'ProdRouteBinding':
+      url = `/MaterialInfo`;
+      break;
     default:
       break;
   }
@@ -703,7 +706,7 @@
       let prodTreeData = await GetRoutePTree(itemCode);
       data.treeData = convertToTree(prodTreeData, 'pid', 'id', 'root');
       data.title = '宸ヨ壓璺嚎';
-      data.fieldNames = { key: 'id', title: 'name' }
+      data.fieldNames = { key: 'id', title: 'name' };
       break;
     case 'BAS_PKG_DTL':
       break;
diff --git a/src/views/tigerprojects/system/role/RoleDrawer.vue b/src/views/tigerprojects/system/role/RoleDrawer.vue
index b4a1ec9..42a3007 100644
--- a/src/views/tigerprojects/system/role/RoleDrawer.vue
+++ b/src/views/tigerprojects/system/role/RoleDrawer.vue
@@ -156,6 +156,7 @@
       }
       //console.log(list,11);
       data.record.menu = list2;
+      halfCheckedKeys.value = list;
       expandedKeys.value = list;
       await getRuleOrg(data);
       await getRuleWh(data);
@@ -166,7 +167,11 @@
     }
   });
 
-  //鑾峰彇瑙掕壊瀵瑰簲鐨勭粍缁�
+  /**
+   * @description: 鑾峰彇瑙掕壊瀵瑰簲鐨勭粍缁�
+   * @param {*} data
+   * @return {*}
+   */  
   async function getRuleOrg(data) {
     const orgList = await getROList(data.record.ID);
     var hfList = [];
@@ -181,10 +186,15 @@
       }
     }
     data.record.org = hfList;
+    halfCheckedKeysOrg.value = list;
     expandedKeysOrg.value = list;
   }
 
-  //鑾峰彇瑙掕壊瀵瑰簲鐨勪粨搴�
+  /**
+   * @description: 鑾峰彇瑙掕壊瀵瑰簲鐨勪粨搴�
+   * @param {*} data
+   * @return {*}
+   */  
   async function getRuleWh(data) {
     const whList = await getWhList(data.record.ID);
     var hfList = [];
@@ -199,9 +209,15 @@
       }
     }
     data.record.wh = hfList;
+    halfCheckedKeysWh.value = list;
     expandedKeysWh.value = list;
   }
 
+  /**
+   * @description: 鑾峰彇瑙掕壊瀵瑰簲鐨勭敓浜�
+   * @param {*} data
+   * @return {*}
+   */  
   async function getRuleProd(data) {
     const prodList = await getProdList(data.record.ID);
     var hfList = [];
@@ -216,6 +232,7 @@
       }
     }
     data.record.fty = hfList;
+    halfCheckedKeysFty.value = list;
     expandedKeysFty.value = list;
   }
 

--
Gitblit v1.9.3