Browse Source

0706改动

xujunjie 2 years ago
parent
commit
97b3f28d2b

File diff suppressed because it is too large
+ 0 - 0
public/Luckysheet/luckysheet.umd.js


File diff suppressed because it is too large
+ 0 - 0
public/Luckysheet/luckysheet.umd.js.map


+ 2 - 1
src/models/xflow.js

@@ -19,9 +19,10 @@ export default {
         });
       }
     },
-    *queryBoomFlowDetail({ payload }, { call, put }) {
+    *queryBoomFlowDetail({ payload, callback }, { call, put }) {
       const data = yield call(queryBoomFlowDetail, payload);
       console.log(data);
+      callback && callback(data);
       yield put({
         type: 'save',
         payload: { flowDetail: data },

+ 29 - 10
src/pages/PurchaseAdmin/PurchaseList/Detail/CommitAuditModal.js

@@ -9,34 +9,52 @@ const { Option } = Select;
 
 // 提交
 function CommitAuditModal(props) {
-  const { visible, onClose, onOk, form, loading, version, flowDetail } = props;
+  const { visible, onClose, onOk, form, loading, version, versionList, flowDetail } = props;
   const [auditId, setAuditId] = useState();
   const handleOk = () => {
     form.validateFields((err, fieldsValue) => {
       if (err) return;
-      let nextNode = flowDetail.nodes.find?.(item => item.Id == fieldsValue.node_id);
+      let approvalNode = flowDetail.nodes.find?.(item => item.Id == fieldsValue.node_id);
+      let serviceNode = flowDetail.nodes.find?.(
+        item => item.Id == fieldsValue.next_template_node_id
+      );
       let params = {
         desc: fieldsValue.desc,
         // 审核流程id
-        flow_id: nextNode?.flow_id || 0,
-        node_level_id: nextNode?.flow_id ? 1 : 0,
+        flow_id: approvalNode?.flow_id || 0,
+        node_level_id: approvalNode?.flow_id ? 1 : 0,
 
         id: version.id,
         project_id: version.project_id,
-        template_node_id: nextNode?.Id, // 将要流转的节点
         cur_template_node_id: version.template_node_id * 1, // 当前节点
-        next_template_node_id: fieldsValue.next_template_node_id * 1, // 审核完成后的业务节点
+        template_node_id: approvalNode?.Id, // 将要流转的节点
+        next_template_node_id: serviceNode.Id * 1, // 审核完成后的业务节点
 
         // 模板id.一致就行
         template_id: version.template_id,
         cur_template_id: version.template_id,
         next_template_id: version.template_id,
       };
-      if (nextNode?.Id && !nextNode?.flow_id) {
-        message.error('审批节点未绑定审批流程!请联系管理员。');
-        return;
+      if (approvalNode?.Id) {
+        if (!approvalNode?.flow_id) {
+          message.error('审批节点未绑定审批流程!请联系管理员。');
+          return;
+        }
       }
-      console.log(params);
+
+      // // 判断业务节点是否允许多版本
+      // if (!serviceNode.muti_version) {
+      //   //audit_status=4 表示为版本推进后留存的副本.不计入多版本计算
+      //   let serviceVersion = versionList.find(
+      //     item => item.audit_status != 4 && item.template_node_id == serviceNode.Id
+      //   );
+      //   if (serviceVersion) {
+      //     message.error(
+      //       `流转失败!业务节点【${serviceNode.label}】为单版本节点。已存在版本【${serviceVersion.version_name}】。`
+      //     );
+      //     return;
+      //   }
+      // }
       setAuditId();
       onOk(params);
     });
@@ -110,4 +128,5 @@ function CommitAuditModal(props) {
 
 export default connect(({ xflow, detail }) => ({
   flowDetail: xflow.flowDetail,
+  versionList: detail.versionList,
 }))(Form.create()(CommitAuditModal));

+ 9 - 4
src/pages/PurchaseAdmin/PurchaseList/Detail/CompareModal.js

@@ -60,6 +60,7 @@ function CompareModal(props) {
       visible={visible}
       onCancel={onClose}
       onOk={handleOk}
+      width={600}
       bodyStyle={{ paddingTop: 0 }}
     >
       <Checkbox.Group value={checkValue} style={{ width: '100%' }} onChange={onChange}>
@@ -73,13 +74,17 @@ function CompareModal(props) {
         <Tabs>
           {tabList.map(tab => (
             <TabPane tab={tab.name} key={tab.id}>
-              <Row>
+              {/* <Row gutter={24}>
                 {tab.list.map(version => (
-                  <Col span={8} key={version.id}>
-                    <Checkbox value={version.id}>{version.version_name}</Checkbox>
+                  <Col span={24} key={version.id}>
                   </Col>
                 ))}
-              </Row>
+              </Row> */}
+              {tab.list.map(version => (
+                <div style={{ marginBottom: 16 }} key={version.id}>
+                  <Checkbox value={version.id}>{version.version_name}</Checkbox>
+                </div>
+              ))}
             </TabPane>
           ))}
         </Tabs>

+ 44 - 15
src/pages/PurchaseAdmin/PurchaseList/Detail/FlowModal.js

@@ -4,7 +4,7 @@ import Flow from '@/components/Flow/index';
 import { connect } from 'dva';
 import { GetTokenFromUrl, getToken } from '@/utils/utils';
 import { MODELS, useXFlowApp, useModelAsync } from '@antv/xflow';
-import { StarOutlined } from '@ant-design/icons';
+import { CheckOutlined } from '@ant-design/icons';
 import { queryVserionByNode } from '@/services/boom';
 import { async } from '@antv/x6/lib/registry/marker/async';
 
@@ -15,6 +15,7 @@ const localData = JSON.parse(localStorage.ggDetaiData || '{}');
 function FlowModal(props) {
   const { visible, version, onClose, onChangeVersion, form, loading, flowDetail } = props;
   const [data, setData] = useState([]);
+  const [nodeLoading, setNodeLoading] = useState(false);
   // const app = useXFlowApp();
   // const appRef = userRef()
 
@@ -30,22 +31,27 @@ function FlowModal(props) {
   }, [flowDetail, version.template_node_id]);
 
   const handleSelectNode = async args => {
+    let res;
     const id = args.nodeId || args.nodeIds[0];
     if (!id) return;
     let node = graphData.nodes.find(item => item.id == id);
     // setData(node.version);
-    let res = await queryVserionByNode({ template_node_id: node.Id });
-    console.log(res);
-    let data = [];
-    Object.values(res.data.excel_version).map(arr => {
-      if (res.data.flow_id) {
-        data = [...data, arr[arr.length - 1]];
-      } else {
-        data = [...data, ...arr];
-      }
-    });
-    console.log(data);
-    setData(data);
+    setNodeLoading(true);
+    try {
+      res = await queryVserionByNode({ template_node_id: node.Id });
+      let data = [];
+      Object.values(res.data.excel_version).map(arr => {
+        if (res.data.flow_id) {
+          data = [...data, arr[arr.length - 1]];
+        } else {
+          data = [...data, ...arr];
+        }
+      });
+      setData(data);
+    } catch (error) {
+      console.log(error);
+    }
+    setNodeLoading(false);
   };
 
   return (
@@ -68,6 +74,7 @@ function FlowModal(props) {
             header={<div>版本列表</div>}
             bordered
             dataSource={data}
+            loading={nodeLoading}
             renderItem={item => {
               const isCurrent = item.id == version.id;
               return (
@@ -87,8 +94,8 @@ function FlowModal(props) {
                         ]
                   }
                 >
-                  <div style={{ color: isCurrent ? '#1890ff' : '' }}>
-                    {isCurrent && <StarOutlined />}
+                  <div style={{ color: getColor(item) }}>
+                    {isCurrent && <CheckOutlined style={{marginRight: 10}}/>}
                     {item.version_name}
                   </div>
                 </List.Item>
@@ -101,6 +108,28 @@ function FlowModal(props) {
   );
 }
 
+const getColor = item => {
+  let color = '';
+  switch (item.audit_status) {
+    case 2:
+      // 审批拒绝
+      color = '#f5222d';
+      break;
+    case 3:
+      // 审批成功
+      color = '#7cb305';
+      break;
+    case 4:
+      // 历史版本
+      color = '#9b9b9b';
+      break;
+
+    default:
+      break;
+  }
+  return color;
+};
+
 export default connect(({ xflow, detail }) => ({
   flowDetail: xflow.flowDetail,
 }))(FlowModal);

+ 52 - 252
src/pages/PurchaseAdmin/PurchaseList/Detail/Index.js

@@ -40,7 +40,6 @@ function Detail(props) {
     flowDetail,
     match: { params },
   } = props;
-  // const audit_status = 0
   const [commentVisible, setCommentVisible] = useState(false);
   const [mergeVisible, setMergeVisible] = useState(false);
   const [compareVisible, setCompareVisible] = useState(false);
@@ -62,8 +61,6 @@ function Detail(props) {
   });
   const [fileVisible, setFileVisible] = useState(false);
   const [exportDate, setExportData] = useState([]);
-  // const [dataSource, setDataSource] = useState(DataSource);
-  // const [lastCommit, setLastCommit] = useState({ data: [] });
   const sheetRef = useRef();
   const sheetRef2 = useRef();
   const sheetRef3 = useRef();
@@ -74,8 +71,6 @@ function Detail(props) {
   });
   const cellPosition = useRef({});
 
-  // const [excelId, setExcelId] = useState(parseInt(params.excelId));
-  // const excelId = parseInt(params.excelId);
   const projectId = parseInt(params.projectId);
   const templateId = parseInt(params.templateId);
 
@@ -92,13 +87,6 @@ function Detail(props) {
     if (version?.flow_id && auditList?.length > 0) {
       let item = auditList.find(item => item.list.id == version.flow_id);
       if (!item) return data;
-      // // 合并同审批级别项
-      // let nodes = {};
-      // item.list.FlowNodes.map(item => {
-      //   if (!nodes[item.seq]) nodes[item.seq] = { ...item, user: [] };
-      //   nodes[item.seq].user.push(item.AuditorUser);
-      // });
-      // item.list.FlowNodes = Object.values(nodes);
       // 查询当前节点
       let current = item.list.FlowNodes.findIndex(node => node.seq == item.active);
       item.current = current == -1 ? 0 : current;
@@ -109,19 +97,17 @@ function Detail(props) {
 
     return data;
   }, [auditList, version]);
-  const audit_status = flow.active_audit;
+  const active_audit = flow.active_audit;
 
   const isAuditor = useMemo(() => {
     const getUserRole = () => {
       let roleID = flow.currentNode?.AuditRoleInfo?.ID;
       let item = currentUser.Permissions.find(role => role.RoleId == roleID);
-      //.find?.(item => item.ID == currentUser.ID);
       if (item) return true;
       return false;
     };
-    return audit_status == 1 && getUserRole();
-  }, [audit_status, flow, currentUser]);
-  // const audit_status = 1;
+    return active_audit == 1 && getUserRole();
+  }, [active_audit, flow, currentUser]);
 
   const onSave = () => {
     let sheet1 = compareList[0];
@@ -189,17 +175,6 @@ function Detail(props) {
     setCommentVisible(false);
   };
 
-  // const exportSheet = async item => {
-  //   console.log(item);
-  //   var sheets = await queryHistoryDetail(item);
-  //   sheets.id = sheets.sheet_id;
-  //   setSheet({
-  //     ...item,
-  //     name: item.version_name,
-  //     data: sheets,
-  //   });
-  // };
-
   const renderSheetDom = (item, index) => {
     return (
       <div key={item?.id || 'temp'} className={styles.sheetItem}>
@@ -240,8 +215,22 @@ function Detail(props) {
   };
 
   const onCommit = (values, id) => {
+    let currentNode = flowDetail.nodes.find?.(item => item.Id == version.template_node_id);
     let currentData = sheetRef.current.getSheetJson().data;
     let sheets = JSON.parse(JSON.stringify(currentData));
+    if (!currentNode.muti_version) {
+      // audit_status=4 表示为版本推进后留存的副本.不计入多版本计算
+      let serviceVersion = versionList.find(
+        item => item.audit_status != 4 && item.template_node_id == currentNode.Id
+      );
+      if (serviceVersion) {
+        message.error(
+          `新建版本失败!业务节点【${currentNode.label}】为单版本节点。已存在版本【${serviceVersion.version_name}】。`
+        );
+        return;
+      }
+    }
+
     sheets.forEach(item => {
       delete item.data;
     });
@@ -252,24 +241,23 @@ function Detail(props) {
       project_id: version.project_id,
       name: version.name,
       guid: version.guid,
-      audit_status: version.audit_status,
       template_id: version.template_id,
       template_node_id: version.template_node_id,
       flow_id: version.flow_id,
       node_id: version.node_id,
       new_version: '0',
+      audit_status: 0,
       data: JSON.stringify(sheets),
     };
     dispatch({
       type: 'detail/commitSheet',
       payload: params,
-      callback: sheets => {
+      callback: newVersion => {
         onCompare(false);
         setCommitVisible(false);
         setVersionVisible(false);
-        // setSheet(sheets);
+        changeVersion(newVersion);
 
-        // localStorage.luckysheet = JSON.stringify(sheets);
         // 更新flow流程图
         dispatch({
           type: 'xflow/queryBoomFlowDetail',
@@ -299,47 +287,6 @@ function Detail(props) {
     });
   };
 
-  // const onCommit = values => {
-  //   var flowNode = flow.currentNode;
-
-  //   // 获取最新sheet页信息
-  //   dispatch({
-  //     type: 'detail/querySheet',
-  //     payload: {
-  //       project_id: projectId,
-  //       flow_id: flowNode.flow_id,
-  //       node_id: flowNode.id,
-  //     },
-  //     callback: sheets => {
-  //       let currentData = sheetRef.current.getSheetJson().data;
-  //       currentData.forEach((item, index) => {
-  //         // 使用最新的sheetId  防止多次创建sheet
-  //         item.id = sheets.data[index]?.id;
-  //         console.log(item.data.celldata);
-  //       });
-  //       let newSheet = {
-  //         ...values,
-  //         data: JSON.stringify(currentData),
-  //         id: excelId,
-  //         flow_id: flowNode.flow_id,
-  //         node_id: flowNode.id,
-  //         project_id: projectId,
-  //       };
-  //       dispatch({
-  //         type: 'detail/commitSheet',
-  //         payload: newSheet,
-  //         callback: sheets => {
-  //           onCompare(false);
-  //           setCommitVisible(false);
-  //           setSheet(sheets);
-
-  //           localStorage.luckysheet = JSON.stringify(sheets);
-  //         },
-  //       });
-  //     },
-  //   });
-  // };
-
   const onAudit = ({ audit_comment }) => {
     var flowNode = flow.currentNode;
     dispatch({
@@ -352,8 +299,22 @@ function Detail(props) {
         node_id: flowNode.seq,
         audit_comment,
       },
-      callback: () => {
+      callback: newVersion => {
         setAuditVisible(false);
+        // 更新flow流程图
+        dispatch({
+          type: 'xflow/queryBoomFlowDetail',
+          payload: {
+            id: templateId,
+          },
+        });
+        // 最后一个审核节点通过后  需要更新version id
+        localStorage.excelId = newVersion.id;
+        setVersion({
+          ...version,
+          flow_id: newVersion.flow_id,
+          id: newVersion.id,
+        });
       },
     });
   };
@@ -467,57 +428,6 @@ function Detail(props) {
     //   sheetRef3.current.mergeExcl(sheet.data);
     // }, 400);
   };
-  // const handleClickCommit = async () => {
-  //   const { list } = await queryHistory();
-  //   let lastCommit = list[0];
-  //   // 判断当前版本是否为最新版本
-  //   if (lastCommit && sheet.guid != lastCommit.guid) {
-  //     Modal.confirm({
-  //       title: '提示',
-  //       content: '当前版本与最新版本不匹配,将进入比对模式确认版本差异。',
-  //       okText: '比对',
-  //       cancelText: '返回',
-  //       onOk() {
-  //         dispatch({
-  //           type: 'detail/queryHistoryDetail',
-  //           payload: {
-  //             excel_id: lastCommit.excel_id,
-  //             history_id: lastCommit.id,
-  //           },
-  //           callback: sheets => {
-  //             setIsMerge(true);
-  //             let currentSheet = {
-  //               ...sheet,
-  //               name: '当前版本',
-  //             };
-  //             let lastSheet = {
-  //               ...lastCommit,
-  //               name: `线上最新版本(${lastCommit.version_name})`,
-  //               data: sheets,
-  //             };
-  //             onCompare([currentSheet, lastSheet]);
-  //           },
-  //         });
-  //       },
-  //     });
-  //   } else {
-  //     setCommitVisible(true);
-  //   }
-
-  //   setCommentVisible(false);
-  // };
-
-  // const handleEdit = status => {
-  //   if (!status) {
-  //     // 还原数据
-  //     sheetRef.current.renderSheet(sheet.data);
-  //   }
-  //   setCommentVisible(false);
-  //   setEdit(status);
-  //   statusRef.current.edit = status;
-  //   sheetRef.current.toggleEdit(status);
-  // };
-
   const handleClickFile = () => {
     fileRef.current.click();
   };
@@ -593,16 +503,6 @@ function Detail(props) {
   };
 
   const renderBtns = () => {
-    // if (edit) {
-    //   return (
-    //     <>
-    //       <Button type="primary" onClick={onSave}>
-    //         保存
-    //       </Button>
-    //       <Button onClick={() => handleEdit(false)}>取消</Button>
-    //     </>
-    //   );
-    // }
     // 判断是否为比对模式
     if (compareList.length == 2) {
       // 判断是否为同步最新版本的比对
@@ -613,7 +513,6 @@ function Detail(props) {
               保存
             </Button>
             <Button onClick={() => onMerge()}>同步新增内容</Button>
-            {/* <Button onClick={() => setCommitVisible(true)}>确认提交</Button> */}
             <Button onClick={() => onCompare(false)}>取消同步</Button>
           </>
         );
@@ -626,29 +525,25 @@ function Detail(props) {
       <Menu.Item key="back">返回</Menu.Item>,
       <Menu.Item key="bomDetail">详情</Menu.Item>,
       <Menu.Item key="export">导出</Menu.Item>,
-      version.flow_id ? null : <Menu.Item key="commitAudit">提交流转</Menu.Item>,
-      // <Menu.Item key="flow">查看流程</Menu.Item>,
       <Menu.Item key="compare">比对</Menu.Item>,
       <Menu.Item key="attachment">附件</Menu.Item>,
     ];
-    // if (audit_status != 1) {
-    //   menuList.push(<Menu.Item key="version">历史提交</Menu.Item>);
-    //   // menuList.push(<Menu.Item key="template">模板</Menu.Item>);
-    // }
-    if (!isAuditor && canEdit() && !version.flow_id) {
-      // menuList.push(<Menu.Item key="edit">编辑</Menu.Item>);
-      menuList.push(<Menu.Item key="merge">同步</Menu.Item>);
-      // menuList.push(<Menu.Item key="commit">提交</Menu.Item>);
-      // if (history.list.length > 0) {
-      //   menuList.push(<Menu.Item key="approval">申请审批</Menu.Item>);
-      // }
+    // version.audit_status:4 为副本。不可操作
+    if (version.audit_status != 4) {
+      menuList.push(<Menu.Item key="commitAudit">提交流转</Menu.Item>);
+
+      if (!isAuditor && canEdit() && !version.flow_id) {
+        // menuList.push(<Menu.Item key="edit">编辑</Menu.Item>);
+        menuList.push(<Menu.Item key="merge">同步</Menu.Item>);
+        // menuList.push(<Menu.Item key="commit">提交</Menu.Item>);
+        // if (history.list.length > 0) {
+        //   menuList.push(<Menu.Item key="approval">申请审批</Menu.Item>);
+        // }
+      }
     }
     return (
       <>
         <Dropdown overlay={<Menu onClick={handleMenuClick}>{menuList}</Menu>}>
-          {/* <Button type="primary">
-            其他操作 <DownOutlined />
-          </Button> */}
           <UnorderedListOutlined style={{ fontSize: 30, cursor: 'pointer' }} />
         </Dropdown>
       </>
@@ -656,14 +551,14 @@ function Detail(props) {
   };
 
   const canEdit = () => {
-    if (flow.list.FlowNodes.length - 1 == flow.current && audit_status == 3) return false;
-    return audit_status != 1;
+    if (flow.list.FlowNodes.length - 1 == flow.current && active_audit == 3) return false;
+    return active_audit != 1;
   };
 
   const renderAlert = () => {
     const audit_comment = history.list[0]?.audit_comment;
     let item = '';
-    switch (audit_status) {
+    switch (active_audit) {
       case 0:
         return;
       case 1:
@@ -736,6 +631,7 @@ function Detail(props) {
       },
     });
   };
+  
   const getUploadProps = () => {
     const token = getToken() || GetTokenFromUrl();
     const uploadProps = {
@@ -811,29 +707,6 @@ function Detail(props) {
     }
     setVersion(version);
 
-    // 查询excel内容
-    // dispatch({
-    //   type: 'detail/queryRecord',
-    //   payload: {
-    //     project_id: projectId,
-    //     template_id: version.template_id,
-    //     template_node_id: version.template_node_id,
-    //     version_id: version.id,
-    //   },
-    //   callback: sheets => {
-    //     console.log(sheets);
-    //     setSheet(sheets);
-    //     // sheetRef.current.renderSheet(sheets.data);
-    //   },
-    // });
-
-    // // 查询历史修改
-    // dispatch({
-    //   type: 'detail/queryHistoryList',
-    //   payload: {
-    //     version_id: version.id,
-    //   },
-    // });
     // 判断是否审批节点
     if (version.flow_id) {
       dispatch({
@@ -911,46 +784,6 @@ function Detail(props) {
     dispatch({
       type: 'user/fetch',
     });
-    // 审批流程
-    // dispatch({
-    //   type: 'detail/queryAuditList',
-    // });
-    // 查询节点
-    // dispatch({
-    //   type: 'detail/queryFlowInfo',
-    //   payload: {
-    //     projectId,
-    //   },
-    //   callback: async ({ currentNode }, sheets) => {
-    //     if (sheets.id != excelId) {
-    //       // 更新excel id
-    //       router.push(`/home/detail/${sheets.id}/${projectId}`);
-    //     }
-    //     let { list } = await queryHistory(sheets.id);
-    //     let sheet = JSON.parse(LocalData || '{}');
-    //     if (
-    //       LocalData &&
-    //       sheet.excel_id == sheets.id &&
-    //       currentNode.id == sheet.node_id &&
-    //       list[0]?.audit_status != 1
-    //     ) {
-    //       // 显示缓存数据
-    //       setSheet(sheet);
-    //     } else {
-    //       sheets.excel_id = sheets.id;
-    //       sheets.name = sheets.version_name;
-    //       delete sheets.id;
-    //       setSheet(sheets);
-    //     }
-    //     sheetRef.current.renderSheet(sheets.data);
-    //   },
-    // });
-    // dispatch({
-    //   type: 'detail/getRoleList',
-    //   payload: {
-    //     ID: projectId,
-    //   },
-    // });
   }, []);
 
   useEffect(() => {
@@ -976,30 +809,12 @@ function Detail(props) {
     } else {
       changeVersion(version.id);
     }
-    // else if (version.id != params.excelId) {
-    //   changeVersion(version.id);
-    // }
   }, [versionList]);
 
   return (
     <Spin spinning={false}>
-      {/* <Spin spinning={getLoading()}> */}
       <div className={styles.top}>
         <div>
-          {/* 当前节点: {version.template_node_id}
-          <br />
-          当前状态:{version.audit_status} */}
-          {/* <Select
-            style={{ width: 140, marginLeft: 10 }}
-            value={version.id}
-            onChange={changeVersion}
-          >
-            {versionList.map(item => (
-              <Option value={item.id} key={item.id}>
-                {item.version_name}
-              </Option>
-            ))}
-          </Select> */}
           <Button type="primary" style={{ marginRight: 20 }} onClick={() => setFlowVisible(true)}>
             查看流程
           </Button>
@@ -1007,7 +822,7 @@ function Detail(props) {
           {/* 非审批节点可以创建版本 */}
           {flow?.active == 0 && (
             <Button type="primary" onClick={() => setVersionVisible(true)}>
-              新建流程
+              新建版本
             </Button>
           )}
           <span style={{ marginLeft: 20 }}>{renderNode()}</span>
@@ -1070,13 +885,6 @@ function Detail(props) {
         visible={commentVisible}
         onClose={() => setCommentVisible(false)}
       />
-      {/* <HistoryModal
-        visible={historyVisible}
-        version={version}
-        // onChange={queryHistory}
-        onClose={() => setHistoryVisible(false)}
-        onSelect={item => exportSheet(item)}
-      /> */}
       <CompareModal
         visible={compareVisible}
         version={version}
@@ -1095,18 +903,10 @@ function Detail(props) {
         onClose={() => setExportVisible(false)}
         onOk={downloadExcel}
       />
-      {/* <CommitModal
-        loading={getLoading()}
-        visible={commitVisible}
-        version={version}
-        onClose={() => setCommitVisible(false)}
-        onOk={values => onCommit(values, version.id)}
-      /> */}
       <FlowModal
         visible={flowVisible}
         onClose={() => setFlowVisible(false)}
         version={version}
-        // onOk={onCommit}
         onChangeVersion={version => changeVersion(version)}
       />
       <AuditModal

+ 8 - 3
src/pages/PurchaseAdmin/PurchaseList/Detail/MergeModal.js

@@ -49,6 +49,7 @@ function MergeModal(props) {
       visible={visible}
       onCancel={onClose}
       onOk={handleOk}
+      width={600}
       bodyStyle={{ paddingTop: 0 }}
     >
       <Radio.Group value={checkValue} style={{ width: '100%' }} onChange={onChange}>
@@ -65,14 +66,18 @@ function MergeModal(props) {
         <Tabs>
           {tabList.map(tab => (
             <TabPane tab={tab.name} key={tab.id}>
-              <Row>
+              {/* <Row>
                 {tab.list.map(version => (
                   <Col span={8} key={version.id}>
-                    {/* <Checkbox value={version.id}>{version.version_name}</Checkbox> */}
                     <Radio value={version.id}>{version.version_name}</Radio>
                   </Col>
                 ))}
-              </Row>
+              </Row> */}
+              {tab.list.map(version => (
+                <div style={{ marginBottom: 16 }} key={version.id}>
+                  <Radio value={version.id}>{version.version_name}</Radio>
+                </div>
+              ))}
             </TabPane>
           ))}
         </Tabs>

+ 1 - 1
src/pages/PurchaseAdmin/PurchaseList/Detail/VersionModal.js

@@ -20,7 +20,7 @@ function VersionModal(props) {
     <Modal
       confirmLoading={loading}
       destroyOnClose
-      title="新建流程"
+      title="新建版本"
       visible={visible}
       onCancel={onClose}
       onOk={handleOk}

+ 12 - 8
src/pages/PurchaseAdmin/PurchaseList/Detail/models/detail.js

@@ -67,7 +67,7 @@ export default {
     bomComment: { list: [] },
     fileList: [],
     roleList: [],
-    authority: []
+    authority: [],
   },
 
   effects: {
@@ -78,7 +78,6 @@ export default {
           type: 'save',
           payload: { authority: response.data },
         });
-       
       }
     },
     *queryProjectRecord({ payload, callback }, { call, put }) {
@@ -111,7 +110,7 @@ export default {
     *queryVersionsList({ payload, callback }, { call, put }) {
       const response = yield call(queryVersionsList, payload);
       if (response) {
-        callback && callback();
+        callback && callback(response.data);
         yield put({
           type: 'save',
           payload: {
@@ -155,7 +154,6 @@ export default {
     *commitSheet({ payload, callback }, { call, put }) {
       let response = yield call(commitSheet, payload);
       if (response) {
-        callback && callback();
         message.success('提交成功');
         yield put({
           type: 'queryVersionsList',
@@ -164,7 +162,10 @@ export default {
             // template_id: payload.template_id,
             // template_node_id: payload.template_node_id,
           },
-          callback,
+          callback: (versionList) => {
+            let newVersion = versionList.find(item => item.id == response.data.id)
+            callback && callback(newVersion);
+          },
         });
       }
     },
@@ -207,8 +208,8 @@ export default {
           payload: {
             project_id: payload.project_id,
           },
-          callback:() => {
-            callback(response.data)
+          callback: () => {
+            callback(response.data);
           },
         });
       }
@@ -240,12 +241,15 @@ export default {
         const response = yield call(approve, payload);
         if (response) {
           message.success('操作成功');
-          callback(response.data);
+
           yield put({
             type: 'queryVersionsList',
             payload: {
               project_id: payload.project_id,
             },
+            callback: () => {
+              callback(response.data);
+            },
           });
         }
       } catch (error) {

Some files were not shown because too many files changed in this diff