瀏覽代碼

修复特殊情况会报错

xjj 2 年之前
父節點
當前提交
34be0e261e
共有 3 個文件被更改,包括 12 次插入5 次删除
  1. 4 2
      src/pages/Auth/Submit.js
  2. 6 3
      src/pages/Detail/ApprovalProcess.tsx
  3. 2 0
      src/pages/Detail/DropdownMenu.js

+ 4 - 2
src/pages/Auth/Submit.js

@@ -46,7 +46,7 @@ function Auth(props) {
     },
     {
       title: '分类',
-      render: item => typeOptions.find(cur => cur.id == item.classify_id)?.name,
+      render: item => typeOptions?.find(cur => cur.id == item.classify_id)?.name,
     },
     {
       title: '待审批人',
@@ -96,9 +96,11 @@ function Auth(props) {
         let version;
         let parentVersion = versionList.find(v => v.id == item.version_id);
         if (parentVersion && parentVersion.children) {
+          // 业务节点
           version = parentVersion.children.find(v => v.id == item.id);
         } else {
-          version = versionList.find(v => v.id == item.id);
+          // 审批节点
+          version = versionList.find(v => v.version_id == item.version_id);
         }
         localStorage.excelItem = JSON.stringify(version);
         router.push(`/home/detail/${item.project_id}/${item.template_id}`);

+ 6 - 3
src/pages/Detail/ApprovalProcess.tsx

@@ -1,10 +1,9 @@
-import React, { useMemo, useRef, useState } from 'react';
+import React, { useMemo, useState } from 'react';
 
 import { queryUserListByRoleID } from '@/services/boom';
 import { connect } from 'dva';
 import { PlusOutlined } from '@ant-design/icons';
 import { Popover, Radio, RadioChangeEvent, Spin, Steps } from 'antd';
-import list from '../List/models/list';
 
 const { Step } = Steps;
 
@@ -65,11 +64,15 @@ const ApprovalProcess = props => {
     cur.name = name;
     onChange?.({ ...approvalProcess });
   };
+  const getSelectValue = list => {
+    let curList = list[curNodeIdx];
+    return curList ? String(curList[0].nowValue) : null;
+  };
 
   const renderContent = list => {
     return (
       <Spin spinning={loading}>
-        <Radio.Group onChange={e => selectedUserId(e, list)}>
+        <Radio.Group value={getSelectValue(list)} onChange={e => selectedUserId(e, list)}>
           {selectUserList.map(item => (
             // <Button onClick={() => selectedUserId(item.user_id)}>{item.c_name}</Button>
             <Radio.Button value={item.user_id}>{item.c_name}</Radio.Button>

+ 2 - 0
src/pages/Detail/DropdownMenu.js

@@ -135,6 +135,8 @@ function DropdownMenu(props) {
           .split(',')
           .some(id => currentUser.roleList?.find(role => role.ID == id));
       }
+      // 没有分类的不设置权限
+      if(version.classify_id === 0) return true;
       // 非全部分类判断是否含有权限
       if(version.classify_id != 1) {
         // 判断在特定分类下是否有权限