Jelajahi Sumber

修改【BOM】审批列表中,已审批列表加载后有的能直接看到审批信息,有的不能

Renxy 2 tahun lalu
induk
melakukan
a4562413c0
3 mengubah file dengan 31 tambahan dan 12 penghapusan
  1. 3 2
      src/models/authList.js
  2. 22 9
      src/pages/Auth/Auth.js
  3. 6 1
      src/pages/Auth/models/auth.js

+ 3 - 2
src/models/authList.js

@@ -3,7 +3,7 @@ export default {
   namespace: 'authList',
   state: {
     authList: [],
-    checkedList: { list: [], pagination: {} },
+    authVersionList: [],
   },
   effects: {
     *queryAuthList({ payload }, { call, put }) {
@@ -32,11 +32,12 @@ export default {
             classify_id: e.classify_id,
             version_id: e.version_id,
             id: e.id,
+            type: 'auth',
           });
         });
         yield put({
           type: 'save',
-          payload: { authList: ret },
+          payload: { authList: ret, authVersionList: data },
         });
       }
     },

+ 22 - 9
src/pages/Auth/Auth.js

@@ -9,7 +9,9 @@ function Auth(props) {
   const {
     dispatch,
     authList,
+    authVersionList,
     checkedList,
+    checkedVersionList,
     checkedPagination,
     typeOptions,
     currentUser,
@@ -51,16 +53,25 @@ function Auth(props) {
   ];
 
   const loadNode = item => {
+    //直接从未处理的列表获取version,下面注释的请求得到的不全。大部分没有;
+    let version = {};
+    if (item.type == 'checked') {
+      version = checkedVersionList.find(v => v.id == item.id);
+    } else {
+      version = authVersionList.find(v => v.id == item.id);
+    }
+    localStorage.excelItem = JSON.stringify(version);
+    router.push(`/home/detail/${item.project_id}/${item.template_id}`);
     //调用接口获取version信息
-    dispatch({
-      type: 'auth/queryVersionByNode',
-      payload: { template_node_id: item.node_id },
-      callback: versionList => {
-        let version = versionList.find(v => v.id == item.id) || {};
-        localStorage.excelItem = JSON.stringify(version);
-        router.push(`/home/detail/${item.project_id}/${item.template_id}`);
-      },
-    });
+    // dispatch({
+    //   type: 'auth/queryVersionByNode',
+    //   payload: { template_node_id: item.node_id },
+    //   callback: checkedVersionList => {
+    //     let version = checkedVersionList.find(v => v.id == item.id) || {};
+    //     localStorage.excelItem = JSON.stringify(version);
+    //     router.push(`/home/detail/${item.project_id}/${item.template_id}`);
+    //   },
+    // });
   };
 
   const renderUnauth = data => (
@@ -99,6 +110,8 @@ function Auth(props) {
 
 export default connect(({ auth, authList, loading, user }) => ({
   authList: authList.authList,
+  authVersionList: authList.authVersionList,
+  checkedVersionList: auth.checkedVersionList,
   checkedList: auth.checkedList.list,
   checkedPagination: auth.checkedList.pagination,
   typeOptions: auth.typeOptions,

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

@@ -4,6 +4,7 @@ export default {
   namespace: 'auth',
   state: {
     checkedList: { list: [], pagination: {} },
+    checkedVersionList: [],
   },
   effects: {
     *queryCheckedList({ payload }, { call, put }) {
@@ -31,11 +32,15 @@ export default {
             author: e.AuthorInfo?.CName,
             classify_id: e.classify_id,
             id: e.id,
+            type: 'checked',
           });
         });
         yield put({
           type: 'save',
-          payload: { checkedList: { list: ret, pagination: responce.data.pagination } },
+          payload: {
+            checkedList: { list: ret, pagination: responce.data.pagination },
+            checkedVersionList: data,
+          },
         });
       }
     },