Browse Source

详情页面跳转

XuZinan 2 years ago
parent
commit
aa49e8ec5b
3 changed files with 27 additions and 6 deletions
  1. 14 5
      src/pages/Auth/Auth.js
  2. 8 1
      src/pages/Auth/models/auth.js
  3. 5 0
      src/services/bomAuth.js

+ 14 - 5
src/pages/Auth/Auth.js

@@ -16,6 +16,7 @@ function Auth(props) {
     loading,
   } = props;
 
+  //监测当前用户,有值时调用列表接口
   useEffect(() => {
     if (!currentUser.ID) return;
     dispatch({
@@ -29,9 +30,8 @@ function Auth(props) {
   }, [currentUser]);
 
   useEffect(() => {
-    dispatch({
-      type: 'auth/queryClassify',
-    });
+    //分类列表
+    dispatch({ type: 'auth/queryClassify' });
   }, []);
 
   const columns = [
@@ -51,7 +51,16 @@ function Auth(props) {
   ];
 
   const loadNode = item => {
-    localStorage.excelItem = JSON.stringify({ version_id: item.version_id });
+    // localStorage.excelItem = JSON.stringify({ version_id: item.version_id });
+    //调用接口获取version信息
+    dispatch({
+      type: 'auth/queryVersionByNode',
+      callback: versionList => {
+        let version = versionList.find(v => v.id == item.version_id) || {};
+        localStorage.excelItem = JSON.stringify(version);
+      },
+    });
+
     router.push(`/home/detail/${item.project_id}/${item.template_id}`);
   };
 
@@ -60,7 +69,7 @@ function Auth(props) {
   );
 
   const renderAuth = data => (
-    <Table columns={flowColumns} dataSource={data} pagination={false} rowKey="id" />
+    <Table columns={flowColumns} dataSource={data} pagination={checkedPagination} rowKey="id" />
   );
 
   return (

+ 8 - 1
src/pages/Auth/models/auth.js

@@ -1,4 +1,4 @@
-import { queryAuthList, queryCheckedList } from '@/services/bomAuth';
+import { queryAuthList, queryCheckedList, queryVersionByNode } from '@/services/bomAuth';
 import { queryClassify } from '@/services/boom';
 export default {
   namespace: 'auth',
@@ -88,6 +88,13 @@ export default {
         });
       }
     },
+
+    *queryVersionByNode({ payload, callback }, { call, put }) {
+      const data = yield call(queryVersionByNode, payload);
+      if (data) {
+        callback && callback(data.data.excel_version_tree);
+      }
+    },
   },
   reducers: {
     save(state, action) {

+ 5 - 0
src/services/bomAuth.js

@@ -12,3 +12,8 @@ export async function queryAuthList({ user_id }) {
 export async function queryCheckedList({ user_id, params }) {
   return request(`/purchase/bom/get-checked-list/${user_id}?${stringify(params)}`);
 }
+
+// 根据节点id查询所有version
+export async function queryVersionByNode(params) {
+  return request(`/purchase/bom/flow/node?${stringify(params)}`);
+}