Browse Source

Merge branch 'develop' into temp

xujunjie 1 year ago
parent
commit
fe8562052e

+ 2 - 2
src/components/DDComponents/DDMultiSelectField/index.js

@@ -4,13 +4,13 @@ import { Select } from 'antd';
 const { Option } = Select;
 
 function DDMultiSelectField(props) {
-  const { options, disabled, onChange } = props;
-
+  const { options, disabled, onChange, value } = props;
   return (
     <Select
       mode="multiple"
       allowClear
       style={{ width: '100%' }}
+      defaultValue={value}
       disabled={disabled}
       onChange={value => {
         onChange(value);

+ 3 - 26
src/components/DDComponents/DepartmentField/index.js

@@ -4,9 +4,7 @@ import { queryDDdepList } from '@/services/boom';
 import { connect } from 'dva';
 
 function DepartmentField(props) {
-  const { value, onChange, depUserTree } = props;
-
-  // const [value, setValue] = useState();
+  const { value = [], onChange, depUserTree } = props;
   const [treeData, setTreeData] = useState([]);
 
   const genTreeNode = dep => {
@@ -30,36 +28,15 @@ function DepartmentField(props) {
   };
 
   const onChangeValue = newValue => {
-    console.log(newValue);
-    let dep = depUserTree.find(dep => dep.id == newValue);
-    onChange(String(dep?.ID));
-    // onChange({ value: dep?.title, id: dep?.ID });
+    onChange(newValue);
   };
 
-  // useEffect(() => {
-  //   onLoadData({});
-  // }, []);
-
   return (
-    // <TreeSelect
-    //   treeDataSimpleMode
-    //   style={{
-    //     width: '100%',
-    //   }}
-    //   // value={value}
-    //   dropdownStyle={{
-    //     maxHeight: 400,
-    //     overflow: 'auto',
-    //   }}
-    //   placeholder="请选择部门"
-    //   onChange={onChangeValue}
-    //   loadData={onLoadData}
-    //   treeData={treeData}
-    // />
     <TreeSelect
       showSearch
       multiple
       allowClear
+      defaultValue={value}
       dropdownStyle={{
         maxHeight: 400,
         overflow: 'auto',

+ 3 - 3
src/pages/Auth/Auth.js

@@ -58,16 +58,16 @@ function Auth(props) {
     if (item.type == 'checked') {
       version = checkedVersionList.find(v => v.id == item.id);
       localStorage.excelItem = JSON.stringify(version);
-      router.push(`/home/detail/${item.project_id}/${item.template_id}?version_id=${version.version_id}`);
+      router.push(`/home/detail/${item.project_id}/${item.template_id}?excel_id=${version.id}`);
     } else {
-      //调用接口获取version信息
+      // 调用接口获取version信息
       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}?version_id=${version.version_id}`);
+          router.push(`/home/detail/${item.project_id}/${item.template_id}?excel_id=${version.id}`);
         },
       });
     }

+ 22 - 10
src/pages/Detail/CommitAuditModal.js

@@ -261,11 +261,19 @@ function CommitAuditModal(props) {
     // 加载之前提交的form数据
     const resFormData = await initFormList();
     const resData = resFormData?.formList;
-    const prevFormData = resData && resData.length ? JSON.parse(resData[0]) : null;
+    const prevFormData = resData && resData.length ? resData.map(resItem => JSON.parse(resItem)) : null;
+    if (prevFormData && prevFormData.length) {
+      const formValues = {}
+      prevFormData.forEach(pItem => {
+        formValues[pItem.template_node_id] = [...pItem.formComponentValues]
+      })
+      setFormComponentValues(formValues)
+    }
+
     if (value) {
       changeAudit(value[value.length - 1]);
-      if (prevFormData !== null && prevFormData?.formComponentValues?.length && value[0] === prevFormData?.template_node_id) {
-        setAuditListFun(approvalProcess, prevFormData.formComponentValues);
+      if (prevFormData !== null) {
+        setAuditListFun(approvalProcess, prevFormData);
       } else {
         setAuditListFun(approvalProcess);
       }
@@ -325,7 +333,7 @@ function CommitAuditModal(props) {
   };
 
   //处理tabs页
-  const setAuditListFun = async (approvalProcess = {},prevFormData = []) => {
+  const setAuditListFun = async (approvalProcess = {}, prevFormData = []) => {
     var fieldsValue = await form.validateFields();
     let addAuditList = [];
     let result = Object.values(fieldsValue)
@@ -347,7 +355,7 @@ function CommitAuditModal(props) {
         let newItem = {
           name: curData?.name,
           nodeId: node.Id,
-          items: JSON.parse(curData.form_json || '[]'),
+          items: JSON.parse(curData?.form_json || '[]'),
         };
 
         return newItem;
@@ -357,9 +365,11 @@ function CommitAuditModal(props) {
     addAuditList.forEach((item, index) => {
       // 回填历史数据
       if (prevFormData.length) {
-        item.items.forEach(DDComponent => {
-          const prevValue = prevFormData.find(pItem => pItem.id === DDComponent.props.id)
-          DDComponent.props.defaultValue = prevValue.value
+        const currentForm = prevFormData.find(pItem => pItem.template_node_id === item.nodeId);
+        item.items.forEach((DDComponent) => {
+          const prevValue = currentForm?.formComponentValues?.find(cItem => cItem.id === DDComponent.props.id)
+          DDComponent.props.defaultValue = prevValue?.value || prevValue?.defaultValue
+
         })
       }
       let Components = Form3x.create({
@@ -387,6 +397,7 @@ function CommitAuditModal(props) {
             })
             .filter(item => item);
           if (getReComputeAudit(items, changedValues)) advanceSubmit();
+          console.log(formComponentValues)
           setFormComponentValues({...formComponentValues});
         },
       })(AuditDetailed);
@@ -415,7 +426,8 @@ function CommitAuditModal(props) {
     firstList.forEach(id => {
       let approvalNode = flowDetail.nodes.find?.(item => item.Id == id);
       if (!approvalNode) return;
-      let values = data[approvalNode.Id] || [];
+      const prevValues = data.length ? data.find((item) => item.template_node_id === approvalNode.Id).formComponentValues : []
+      let values = data[approvalNode.Id] || prevValues || [];
       let audit_list = [],
         cc_list = [];
       approvalProcess[approvalNode.Id]?.forEach(item => {
@@ -570,7 +582,7 @@ function CommitAuditModal(props) {
       await querySaveBomForm({
         project_id: version.project_id,
         node_id: version.template_node_id,
-        json: JSON.stringify({approvalProcess}),
+        json: JSON.stringify({approvalProcess, formList}),
       });
       params.audit_series = uuidv4();
       params.files = uploadList.current.join(',');

+ 386 - 278
src/pages/Detail/FlowModal.js

@@ -1,4 +1,4 @@
-import React, {useEffect, useState, useRef, useMemo, memo} from 'react';
+import React, { useEffect, useState, useRef, useMemo, memo } from 'react';
 import {
   Modal,
   Input,
@@ -18,21 +18,25 @@ import {
   Tooltip,
 } from 'antd';
 import Flow from '@/components/Flow/index';
-import {connect} from 'dva';
-import {GetTokenFromUrl, getToken} from '@/utils/utils';
-import {MODELS, useXFlowApp, useModelAsync} from '@antv/xflow';
-import {CheckOutlined} from '@ant-design/icons';
+import { connect } from 'dva';
+import { GetTokenFromUrl, getToken } from '@/utils/utils';
+import { MODELS, useXFlowApp, useModelAsync } from '@antv/xflow';
+import { CheckOutlined } from '@ant-design/icons';
 import {
-  queryDelPurchaseExcel, queryDingInstanceDetail, queryRecordSheet, queryTrySeal, queryVserionByNode,
+  queryDelPurchaseExcel,
+  queryDingInstanceDetail,
+  queryRecordSheet,
+  queryTrySeal,
+  queryVserionByNode,
 } from '@/services/boom';
-import {async} from '@antv/x6/lib/registry/marker/async';
+import { async } from '@antv/x6/lib/registry/marker/async';
 import VersionModal from './VersionModal';
-import styles from './Index.less'
+import styles from './Index.less';
 
-const {Option} = Select;
-const {Step} = Steps;
+const { Option } = Select;
+const { Step } = Steps;
 
-const {TextArea} = Input;
+const { TextArea } = Input;
 const localData = JSON.parse(localStorage.ggDetaiData || '{}');
 const PAGE_SIZE = 8;
 let controller = new AbortController();
@@ -41,7 +45,10 @@ let controller = new AbortController();
 function FlowModal(props) {
   let token = getToken();
   const SELECT_TYPE = {
-    NAME: '0', TYPE: '1', CREATOR: '2', STATE: '3',
+    NAME: '0',
+    TYPE: '1',
+    CREATOR: '2',
+    STATE: '3',
   };
   const {
     visible,
@@ -69,7 +76,7 @@ function FlowModal(props) {
   const [versionVisible, setVersionVisible] = useState(false);
   const [selectType, setSelectType] = useState(SELECT_TYPE.NAME);
   const [inputValue, setInputValue] = useState();
-  const [expandedRowKey, setExpandedRowKey] = useState([])
+  const [expandedRowKey, setExpandedRowKey] = useState([]);
 
   const [sealLoading, setSealLoading] = useState(false);
   // const [currentTempNodeId, setCurrentTempNodeId] = useState();
@@ -78,10 +85,12 @@ function FlowModal(props) {
   const graphData = useMemo(() => {
     if (!flowDetail) return;
     let nodes = flowDetail.nodes?.map(item => ({
-      ...item, isCheck: item.Id == version.template_node_id,
+      ...item,
+      isCheck: item.Id == version.template_node_id,
     }));
     return {
-      nodes, edges: flowDetail.edges,
+      nodes,
+      edges: flowDetail.edges,
     };
   }, [flowDetail, version.template_node_id]);
 
@@ -108,12 +117,17 @@ function FlowModal(props) {
 
   const onDelVersion = data => {
     Modal.confirm({
-      title: '提示', content: `是否确认删除清单?`, okText: '确定', cancelText: '取消', onOk: async () => {
+      title: '提示',
+      content: `是否确认删除清单?`,
+      okText: '确定',
+      cancelText: '取消',
+      onOk: async () => {
         const res = await queryDelPurchaseExcel(data);
         if (res.code == 200) {
           message.success('删除成功');
           dispatch({
-            type: 'xflow/queryBoomFlowDetail', payload: {
+            type: 'xflow/queryBoomFlowDetail',
+            payload: {
               id: templateId,
             },
           });
@@ -130,15 +144,18 @@ function FlowModal(props) {
       }
       setNodeLoading(true);
       controller = new AbortController();
-      const res = await queryVserionByNode({
-        template_node_id: template_node_id,
-      }, controller.signal);
+      const res = await queryVserionByNode(
+        {
+          template_node_id: template_node_id,
+        },
+        controller.signal
+      );
       controller = null;
       let data = [];
       if (!res.data.excel_version_tree) setData([]);
       res.data.excel_version_tree?.map(arr => {
         if (res.data.flow_id) {
-          data = [...data, {...arr, flow_id: res.data.flow_id}];
+          data = [...data, { ...arr, flow_id: res.data.flow_id }];
         } else {
           data = [...data, arr];
         }
@@ -177,9 +194,14 @@ function FlowModal(props) {
         if (item.audit_status == 2) status = 'error';
       });
       let curNode = flowDetail.nodes.find(item => item.Id == itemDataList[0].template_node_id);
-      const seqList = itemDataList[0].FlowInfo.FlowNodes.filter(item => item.template_node_id == template_node_id).sort((a, b) => a.seq - b.seq);
+      const seqList = itemDataList[0].FlowInfo.FlowNodes.filter(
+        item => item.template_node_id == template_node_id
+      ).sort((a, b) => a.seq - b.seq);
       let obj = {
-        status, current: curid, list: seqList, name: curNode?.label || itemDataList[0].FlowInfo.name,
+        status,
+        current: curid,
+        list: seqList,
+        name: curNode?.label || itemDataList[0].FlowInfo.name,
       };
       return obj;
     });
@@ -191,116 +213,163 @@ function FlowModal(props) {
     let type = item.flow_id ? '/queryAuditRecord' : '/queryAuditExcel';
     // console.log(`${file}${type}`, item);
     dispatch({
-      type: `${file}${type}`, payload: {
-        excel_id: item.id, pageSize: 100,
-      }, callback: res => {
+      type: `${file}${type}`,
+      payload: {
+        excel_id: item.id,
+        pageSize: 100,
+      },
+      callback: res => {
         updateSteps(res, item.template_node_id);
       },
     });
   };
 
   const columns = useMemo(() => {
-    return [{
-      title: '名称', width: '20%', render: item => {
-        return (<>
-              <span style={{color: item.audit_status != 0 ? '#9b9b9b' : ''}}>
-                {(item.id == version.id && !item.isParent) && (<CheckOutlined style={{marginRight: 10}}/>)}
-                {item.version_no && !item.children?.length ? `${item.version_name}.${item.version_no}` : `${item.version_name}`}
+    return [
+      {
+        title: '名称',
+        width: '20%',
+        render: item => {
+          return (
+            <>
+              <span style={{ color: item.audit_status != 0 ? '#9b9b9b' : '' }}>
+                {item.id == version.id && !item.isParent && (
+                  <CheckOutlined style={{ marginRight: 10 }} />
+                )}
+                {item.version_no && !item.children?.length
+                  ? `${item.version_name}.${item.version_no}`
+                  : `${item.version_name}`}
               </span>
-        </>)
+            </>
+          );
+        },
       },
-    }, {
-      title: '创建人', width: '15%', render: item => {
-        return (item.isParent && (<span>{userList.find(cur => cur.ID == item.author)?.CName || '-'}</span>));
+      {
+        title: '创建人',
+        width: '15%',
+        render: item => {
+          return (
+            item.isParent && (
+              <span>{userList.find(cur => cur.ID == item.author)?.CName || '-'}</span>
+            )
+          );
+        },
       },
-    }, {
-      title: '分类', width: '15%', render: item => {
-        return (item.isParent && (<span>{typeOptions.find(cur => cur.id == item.classify_id)?.name}</span>));
+      {
+        title: '分类',
+        width: '15%',
+        render: item => {
+          return (
+            item.isParent && (
+              <span>{typeOptions.find(cur => cur.id == item.classify_id)?.name}</span>
+            )
+          );
+        },
       },
-    }, {
-      title: '状态', width: '15%', render: item => {
-        if (!item.flow_id && item.isParent) return;
-        let style = {color: getColor(item)};
-        let txt = '';
-        let dom = '';
-        switch (item.audit_status) {
-          case 0:
-            txt = '未提交';
-            break;
-          case 1:
-            txt = '待审批';
-            break;
-          case 2:
-            txt = '已拒绝';
-            break;
-          case 3:
-            txt = '已通过';
-            break;
-          case 4:
-            txt = '已提交';
-            break;
-        }
-        if (item.status == 1) txt = '已失效';
+      {
+        title: '状态',
+        width: '15%',
+        render: item => {
+          if (!item.flow_id && item.isParent) return;
+          let style = { color: getColor(item) };
+          let txt = '';
+          let dom = '';
+          switch (item.audit_status) {
+            case 0:
+              txt = '未提交';
+              break;
+            case 1:
+              txt = '待审批';
+              break;
+            case 2:
+              txt = '已拒绝';
+              break;
+            case 3:
+              txt = '已通过';
+              break;
+            case 4:
+              txt = '已提交';
+              break;
+          }
+          if (item.status == 1) txt = '已失效';
 
-        // 显示拒绝原因
-        // if (item.audit_comment) {
-        //   dom = (
-        //     <Popover content={item.audit_comment} title="原因">
-        //       {txt}
-        //     </Popover>
-        //   );
-        // } else {
-        dom = txt;
-        // }
-        return item.audit_status != 0 ? (<Button onClick={() => handleChangeClick(item)}>{dom}</Button>) : (
-          <span style={style}>{dom}</span>);
+          // 显示拒绝原因
+          // if (item.audit_comment) {
+          //   dom = (
+          //     <Popover content={item.audit_comment} title="原因">
+          //       {txt}
+          //     </Popover>
+          //   );
+          // } else {
+          dom = txt;
+          // }
+          return item.audit_status != 0 ? (
+            <Button onClick={() => handleChangeClick(item)}>{dom}</Button>
+          ) : (
+            <span style={style}>{dom}</span>
+          );
+        },
       },
-    }, {
-      title: '印章申请', width: '15%', render: item => {
-        if (!item.flow_id && item.isParent) return;
-        let txt = '';
-        //申请印章成功 1  默认0 失败2
-        switch (item.is_seal_succeed) {
-          case 0:
-            txt = '-';
-            break;
-          case 1:
-            txt = '成功';
-            break;
-          case 2:
-            txt = '失败';
-            break;
-        }
-        return (<Space>
-          <span>{txt}</span>
-          {item.is_seal_succeed == 2 && <a onClick={() => handleRetryClick(item.id)}>重试</a>}
-        </Space>);
+      {
+        title: '印章申请',
+        width: '15%',
+        render: item => {
+          if (!item.flow_id && item.isParent) return;
+          let txt = '';
+          //申请印章成功 1  默认0 失败2
+          switch (item.is_seal_succeed) {
+            case 0:
+              txt = '-';
+              break;
+            case 1:
+              txt = '成功';
+              break;
+            case 2:
+              txt = '失败';
+              break;
+          }
+          return (
+            <Space>
+              <span>{txt}</span>
+              {item.is_seal_succeed == 2 && <a onClick={() => handleRetryClick(item.id)}>重试</a>}
+            </Space>
+          );
+        },
+      },
+      {
+        title: '操作',
+        width: '20%',
+        render: item =>
+          (item.flow_id || !item.isParent) &&
+          item.id != version.id && (
+            <Space>
+              <a
+                onClick={() => {
+                  onChangeVersion(item);
+                  onClose();
+                }}
+              >
+                加载
+              </a>
+              {item.audit_status == 0 &&
+              item.author == currentUser.ID && ( //自己创建的&&未提交的清单自己可以删除
+                  <a
+                    onClick={() => {
+                      onDelVersion({ excel_id: item.id });
+                    }}
+                  >
+                    删除
+                  </a>
+                )}
+            </Space>
+          ),
       },
-    }, {
-      title: '操作', width: '20%', render: item => (item.flow_id || !item.isParent) && item.id != version.id && (<Space>
-        <a
-          onClick={() => {
-            onChangeVersion(item);
-            onClose();
-          }}
-        >
-          加载
-        </a>
-        {item.audit_status == 0 && item.author == currentUser.ID && ( //自己创建的&&未提交的清单自己可以删除
-          <a
-            onClick={() => {
-              onDelVersion({excel_id: item.id});
-            }}
-          >
-            删除
-          </a>)}
-      </Space>),
-    },];
+    ];
   }, [version]);
 
   const handleRetryClick = async id => {
     setNodeLoading(true);
-    const res = await queryTrySeal({excel_id: id});
+    const res = await queryTrySeal({ excel_id: id });
     setNodeLoading(false);
     if (res.data?.errcode != 0) {
       message.error(res.data?.errmsg);
@@ -319,25 +388,43 @@ function FlowModal(props) {
     setInputValue(null);
   };
 
-  const getDescription = node => {
+  // function calculateHoursDifference(date1, date2) {
+  //   const timestamp1 = date1.getTime(); // 获取第一个Date对象的时间戳(以毫秒为单位)
+  //   const timestamp2 = date2.getTime(); // 获取第二个Date对象的时间戳(以毫秒为单位)
+  //
+  //   const timeDifferenceInMillis = Math.abs(timestamp2 - timestamp1); // 计算时间戳之间的差值(毫秒数)
+  //   const hoursDifference = timeDifferenceInMillis / (1000 * 60 * 60); // 将差值转换为小时数
+  //
+  //   return hoursDifference.toFixed(2);
+  // }
+
+  const getDescription = (node, prevNode) => {
     let str = `审批人:${node.AuditorUser?.CName || '-'}`;
-    const date = new Date(node.audit_time)
-    const auditTime = date.toLocaleDateString('zh-CN', {
-      format: 'YYYY-MM-DD hh:mm:ss'
-    })
-    return (<div>
-      审批人:{node.AuditorUser?.CName || '-'}
+    const date = new Date(node.audit_time);
+    const auditTime =
+      node.audit_time === '0001-01-01T00:00:00Z'
+        ? '-'
+        : date.toLocaleDateString('zh-CN', {
+            format: 'YYYY-MM-DD hh:mm:ss',
+          });
+    // const residenceTime =
+    //   auditTime === '-' ? '-' : calculateHoursDifference(date, new Date(prevNode.audit_time));
+    return (
       <div>
-        <span style={{color: '#1A73E8', textDecoration: 'undeline'}}>
+        审批人:{node.AuditorUser?.CName || '-'}
+        <div>
+          <span style={{ color: '#1A73E8', textDecoration: 'unerline' }}>
             审批意见:{node.desc || '-'}
-        </span>
+          </span>
+        </div>
+        <div>
+          <span>审批时间:{auditTime || '-'}</span>
+        </div>
+        {/* <div> */}
+        {/*   <span>滞留时间:{`${residenceTime}小时`}</span> */}
+        {/* </div> */}
       </div>
-      <div>
-        <span>
-          审批时间:{auditTime || '-'}
-        </span>
-      </div>
-    </div>);
+    );
   };
 
   const filterState = () => {
@@ -374,18 +461,18 @@ function FlowModal(props) {
     setShowData(resultData);
   }, [inputValue, data]);
 
-  const setRowClassName = (row) => {
-    const rowId = localStorage.excelId
+  const setRowClassName = row => {
+    const rowId = localStorage.excelId;
 
     if (row.id.toString() === rowId) {
       return styles.selectedROW;
     }
-    return ''
-  }
+    return '';
+  };
 
-  const handleExpandedRowChange = (expandedRows) => {
-    setExpandedRowKey(expandedRows)
-  }
+  const handleExpandedRowChange = expandedRows => {
+    setExpandedRowKey(expandedRows);
+  };
 
   //列表筛选状态
   const STATE = {
@@ -396,146 +483,165 @@ function FlowModal(props) {
     SUBMIT: 4, //已提交
     FAILURE: 5, //已失效
   };
-  return (<>
-    <Modal
-      // confirmLoading={loading}
-      destroyOnClose
-      title="流程图"
-      visible={visible}
-      onCancel={() => {
-        setSelectType(SELECT_TYPE.NAME);
-        setInputValue('');
-        onClose();
-      }}
-      footer={false}
-      width="98%"
-      // bodyStyle={{ maxHeight: '660px', overflow: 'auto' }}
-    >
-      <Row gutter={8}>
-        <Col span={14}>
-          <Flow meta={{type: 'view'}} flowDetail={graphData} onSelectNode={handleSelectNode}/>
-        </Col>
-        <Col span={10}>
-          <div style={{fontSize: '16px', marginBottom: '10px'}}>清单列表</div>
-          <div style={{display: 'flex', justifyContent: 'space-between'}}>
-            <div style={{width: '60%'}}>
-              <Select
-                value={selectType}
-                style={{width: '30%'}}
-                onChange={value => {
-                  setSelectType(value);
-                  setInputValue('');
-                }}
-              >
-                <Option value={SELECT_TYPE.NAME}>名称:</Option>
-                <Option value={SELECT_TYPE.TYPE}>分类:</Option>
-                <Option value={SELECT_TYPE.CREATOR}>创建人:</Option>
-                <Option value={SELECT_TYPE.STATE}>状态:</Option>
-              </Select>
-              {(selectType == SELECT_TYPE.NAME || selectType == SELECT_TYPE.CREATOR) && (<Input
-                style={{width: '70%'}}
-                placeholder="请输入"
-                value={inputValue}
-                onChange={e => setInputValue(e.target.value)}
-              />)}
-              {selectType == SELECT_TYPE.TYPE && (<Select
-                showSearch
-                allowClear
-                style={{width: '70%'}}
-                placeholder="请选择分类"
-                options={typeOptions}
-                onChange={id => setInputValue(id)}
-                filterOption={(input, option) => (option?.label ?? '').toLowerCase().includes(input.toLowerCase())}
-              />)}
-              {selectType == SELECT_TYPE.STATE && (<Select
-                showSearch
-                allowClear
-                style={{width: '70%'}}
-                placeholder="请选择状态"
-                // options={typeOptions}
-                onChange={id => setInputValue(id)}
-              >
-                <Option value={STATE.NOSUBMIT}>未提交</Option>
-                <Option value={STATE.NOAPPROVE}>待审批</Option>
-                <Option value={STATE.REJECT}>已拒绝</Option>
-                <Option value={STATE.PASS}>已通过</Option>
-                <Option value={STATE.SUBMIT}>已提交</Option>
-                <Option value={STATE.FAILURE}>已失效</Option>
-              </Select>)}
+  return (
+    <>
+      <Modal
+        // confirmLoading={loading}
+        destroyOnClose
+        title="流程图"
+        visible={visible}
+        onCancel={() => {
+          setSelectType(SELECT_TYPE.NAME);
+          setInputValue('');
+          onClose();
+        }}
+        footer={false}
+        width="98%"
+        // bodyStyle={{ maxHeight: '660px', overflow: 'auto' }}
+      >
+        <Row gutter={8}>
+          <Col span={14}>
+            <Flow meta={{ type: 'view' }} flowDetail={graphData} onSelectNode={handleSelectNode} />
+          </Col>
+          <Col span={10}>
+            <div style={{ fontSize: '16px', marginBottom: '10px' }}>清单列表</div>
+            <div style={{ display: 'flex', justifyContent: 'space-between' }}>
+              <div style={{ width: '60%' }}>
+                <Select
+                  value={selectType}
+                  style={{ width: '30%' }}
+                  onChange={value => {
+                    setSelectType(value);
+                    setInputValue('');
+                  }}
+                >
+                  <Option value={SELECT_TYPE.NAME}>名称:</Option>
+                  <Option value={SELECT_TYPE.TYPE}>分类:</Option>
+                  <Option value={SELECT_TYPE.CREATOR}>创建人:</Option>
+                  <Option value={SELECT_TYPE.STATE}>状态:</Option>
+                </Select>
+                {(selectType == SELECT_TYPE.NAME || selectType == SELECT_TYPE.CREATOR) && (
+                  <Input
+                    style={{ width: '70%' }}
+                    placeholder="请输入"
+                    value={inputValue}
+                    onChange={e => setInputValue(e.target.value)}
+                  />
+                )}
+                {selectType == SELECT_TYPE.TYPE && (
+                  <Select
+                    showSearch
+                    allowClear
+                    style={{ width: '70%' }}
+                    placeholder="请选择分类"
+                    options={typeOptions}
+                    onChange={id => setInputValue(id)}
+                    filterOption={(input, option) =>
+                      (option?.label ?? '').toLowerCase().includes(input.toLowerCase())
+                    }
+                  />
+                )}
+                {selectType == SELECT_TYPE.STATE && (
+                  <Select
+                    showSearch
+                    allowClear
+                    style={{ width: '70%' }}
+                    placeholder="请选择状态"
+                    // options={typeOptions}
+                    onChange={id => setInputValue(id)}
+                  >
+                    <Option value={STATE.NOSUBMIT}>未提交</Option>
+                    <Option value={STATE.NOAPPROVE}>待审批</Option>
+                    <Option value={STATE.REJECT}>已拒绝</Option>
+                    <Option value={STATE.PASS}>已通过</Option>
+                    <Option value={STATE.SUBMIT}>已提交</Option>
+                    <Option value={STATE.FAILURE}>已失效</Option>
+                  </Select>
+                )}
+              </div>
+              {isOut && (
+                <Button type="primary" onClick={() => setVersionVisible(true)}>
+                  新建清单
+                </Button>
+              )}
             </div>
-            {isOut && (<Button type="primary" onClick={() => setVersionVisible(true)}>
-              新建清单
-            </Button>)}
-          </div>
 
-          <div style={{width: '100%', marginTop: '10px'}}>
-            <Table
-              columns={columns}
-              dataSource={showData}
-              loading={nodeLoading}
-              bordered={false}
-              rowKey='id'
-              pagination={{position: ['none', 'none'], pageSize: 999, onChange}}
-              scroll={{y: '460px'}}
-              rowClassName={setRowClassName}
-              onExpandedRowsChange={handleExpandedRowChange}
-              expandedRowKeys={expandedRowKey}
-              defaultExpandedRowKeys={expandedRowKey}
-              // childrenColumnName="none"
-              // expandable={{
-              //   expandedRowRender: record => (
-              //     <Table
-              //       columns={columns}
-              //       dataSource={record.children}
-              //       pagination={{ position: ['none', 'none'] }}
-              //     />
-              //   ),
-              //   rowExpandable: record => record.children?.length > 0,
-              // }}
-            />
-          </div>
-          {/* <Spin spinning={loading.global}> */}
-          <div
-            style={{
-              display: 'flex', justifyContent: 'space-around', maxHeight: '300px', overflow: 'auto',
-            }}
-          >
-            {stepsData.map((item, idx) => (
-              <div key={`${item.name}_${idx}`} style={{marginTop: '20px', display: 'inline'}}>
-                <div style={{marginBottom: '4px'}}>{item.name}</div>
-                <Steps
-                  direction="vertical"
-                  size="small"
-                  current={item.current}
-                  status={item.status}
-                >
-                  {item.list.map(node => (<Step
-                    key={`${node.id}_${node.node}`}
-                    title={node.node}
-                    description={getDescription(node)}
-                  />))}
-                </Steps>
-              </div>))}
-          </div>
-          {/* </Spin> */}
-        </Col>
-      </Row>
-    </Modal>
-    <VersionModal
-      typeOptions={typeOptions}
-      visible={versionVisible}
-      version={version}
-      versionList={versionList}
-      flowDetail={flowDetail}
-      onClose={() => setVersionVisible(false)}
-      onOk={values => {
-        onCommit?.(values, () => {
-          setVersionVisible(false);
-        });
-      }}
-      loading={commitLoading}
-    />
-  </>);
+            <div style={{ width: '100%', marginTop: '10px' }}>
+              <Table
+                columns={columns}
+                dataSource={showData}
+                loading={nodeLoading}
+                bordered={false}
+                rowKey="id"
+                pagination={{ position: ['none', 'none'], pageSize: 999, onChange }}
+                scroll={{ y: '460px' }}
+                rowClassName={setRowClassName}
+                onExpandedRowsChange={handleExpandedRowChange}
+                expandedRowKeys={expandedRowKey}
+                defaultExpandedRowKeys={expandedRowKey}
+                // childrenColumnName="none"
+                // expandable={{
+                //   expandedRowRender: record => (
+                //     <Table
+                //       columns={columns}
+                //       dataSource={record.children}
+                //       pagination={{ position: ['none', 'none'] }}
+                //     />
+                //   ),
+                //   rowExpandable: record => record.children?.length > 0,
+                // }}
+              />
+            </div>
+            {/* <Spin spinning={loading.global}> */}
+            <div
+              style={{
+                display: 'flex',
+                justifyContent: 'space-around',
+                maxHeight: '300px',
+                overflow: 'auto',
+              }}
+            >
+              {stepsData.length > 0 &&
+                stepsData.map((item, idx) => (
+                  <div key={`${item.name}_${idx}`} style={{ marginTop: '20px', display: 'inline' }}>
+                    <div style={{ marginBottom: '4px' }}>{item.name}</div>
+                    <Steps
+                      direction="vertical"
+                      size="small"
+                      current={item.current}
+                      status={item.status}
+                    >
+                      {item.list.map(( node) => (
+                        <Step
+                          key={`${node.id}_${node.node}`}
+                          title={node.node}
+                          description={getDescription(node)}
+                        />
+                      ))}
+                    </Steps>
+                  </div>
+                ))}
+            </div>
+            {/* </Spin> */}
+          </Col>
+        </Row>
+      </Modal>
+      <VersionModal
+        typeOptions={typeOptions}
+        visible={versionVisible}
+        version={version}
+        versionList={versionList}
+        flowDetail={flowDetail}
+        onClose={() => setVersionVisible(false)}
+        onOk={values => {
+          onCommit?.(values, () => {
+            setVersionVisible(false);
+          });
+        }}
+        loading={commitLoading}
+      />
+    </>
+  );
 }
 
 const getColor = item => {
@@ -560,7 +666,9 @@ const getColor = item => {
   return color;
 };
 
-export default connect(({loading, user}) => ({
-  loading, currentUser: user.currentUser, userList: user.list,
+export default connect(({ loading, user }) => ({
+  loading,
+  currentUser: user.currentUser,
+  userList: user.list,
 }))(FlowModal);
 // export default FlowModal;

+ 33 - 28
src/pages/Detail/Index.js

@@ -1,7 +1,7 @@
-import React, {useEffect, useState, useRef, useMemo} from 'react';
-import {UnorderedListOutlined, PlusOutlined, InfoOutlined} from '@ant-design/icons';
-import {Button, Modal, message, Alert, Avatar} from 'antd';
-import {connect} from 'dva';
+import React, { useEffect, useState, useRef, useMemo } from 'react';
+import { UnorderedListOutlined, PlusOutlined, InfoOutlined } from '@ant-design/icons';
+import { Button, Modal, message, Alert, Avatar } from 'antd';
+import { connect } from 'dva';
 import styles from './Index.less';
 import LuckySheet from './LuckySheet';
 import AuditModal from './AuditModal';
@@ -15,6 +15,7 @@ import VersionModal from './VersionModal';
 import CommitAuditModal from './CommitAuditModal';
 import CommentContent from '@/components/CommentContent';
 import MergeModal from './MergeModal';
+import { GetTokenFromUrl, getToken } from '@/utils/utils';
 import {
   getAuditDetail,
   queryDelSheetRecord,
@@ -24,6 +25,10 @@ import {
 } from '@/services/boom';
 import HistoryDrawer from './HistoryDrawer';
 import AuditFlow from './AuditFlow';
+import { getCurrentUser } from '@/utils/authority';
+import { async } from '@antv/x6/es/registry/marker/async';
+import FileViewerModal from '@/components/FileViewer';
+import PreviewFile from '@/components/PreviewFile';
 import FormAndFilesNode from './FormAndFilesNode';
 import DropdownMenu from './DropdownMenu';
 import CurrentInfo from './CurrentInfo';
@@ -39,8 +44,8 @@ function Detail(props) {
     auditList,
     flowDetail,
     versionTree,
-    match: {params},
-    location: {query},
+    match: { params },
+    location: { query },
     instanceDetail,
     typeOptions,
     classifyList,
@@ -81,7 +86,8 @@ function Detail(props) {
   const cellPosition = useRef({});
 
   useEffect(() => {
-    //不请求excelFileList 时清空excelFileList,否则会出现清单切换后如果attachment_id不存在,附件信息没有更新
+    // if (!version.id) return
+    // 不请求excelFileList 时清空excelFileList,否则会出现清单切换后如果attachment_id不存在,附件信息没有更新
     if (!version.attachment_id) {
       dispatch({
         type: 'detail/save',
@@ -101,8 +107,8 @@ function Detail(props) {
 
   const projectId = parseInt(params.projectId);
   const templateId = parseInt(params.templateId);
-  const versionID = parseInt(query.version_id);
-  const TOKEN = query['JWT-TOKEN']
+  const excelID = parseInt(query.excel_id);
+  const TOKEN = query['JWT-TOKEN'];
   if (!localStorage.getItem('JWT-TOKEN')) {
     localStorage['JWT-TOKEN'] = TOKEN;
   }
@@ -262,7 +268,7 @@ function Detail(props) {
     await queryDelSheetRecord(params);
   };
 
-  const onAudit = ({audit_comment, audit_status}) => {
+  const onAudit = ({ audit_comment, audit_status }) => {
     const flowNode = flow.currentNode;
     dispatch({
       type: 'detail/approve',
@@ -298,7 +304,7 @@ function Detail(props) {
         } else {
           dispatch({
             type: 'authList/queryAuthList',
-            payloda: {user_id: currentUser.ID},
+            payloda: { user_id: currentUser.ID },
           });
           localStorage.excelId = newVersion.id;
           setVersion({
@@ -310,7 +316,7 @@ function Detail(props) {
         //更新未审批列表
         dispatch({
           type: 'authList/queryAuthList',
-          payloda: {user_id: currentUser.ID},
+          payloda: { user_id: currentUser.ID },
         });
       },
     });
@@ -395,13 +401,13 @@ function Detail(props) {
       localStorage.excelId = version.id;
       localStorage.excelItem = JSON.stringify(version);
     } else {
-      version = await getAuditDetail({userId: currentUser.ID, versionID})
+      version = await getAuditDetail({ userId: currentUser.ID, excelID });
       if (!version) {
         const excelId = localStorage.excelItem
           ? JSON.parse(localStorage.excelItem)
           : localStorage.excelId;
         if (typeof excelId === 'object') {
-          changeVersion(excelId)
+          changeVersion(excelId);
           return;
         }
       }
@@ -437,8 +443,7 @@ function Detail(props) {
         userRef.current = newUser;
         setUser(newUser);
       }
-    } catch (error) {
-    }
+    } catch (error) {}
   };
   const handleSubmitCell = (value, callback) => {
     if (!value) return;
@@ -494,7 +499,7 @@ function Detail(props) {
 
   useEffect(() => {
     if (compareList.length == 2) {
-      const callback = ({diff, add}) => {
+      const callback = ({ diff, add }) => {
         setUpdateCount(updateCount => {
           return {
             diff: diff.length,
@@ -509,9 +514,9 @@ function Detail(props) {
 
   useEffect(() => {
     // if (versionList.length == 0) return;
-    if (!currentUser.ID) return
+    if (!currentUser.ID) return;
     if (!version.id) {
-      changeVersion(versionID);
+      changeVersion(excelID);
     } else {
       changeVersion(version.id);
     }
@@ -521,7 +526,7 @@ function Detail(props) {
     <>
       <div className={styles.top}>
         <div>
-          <Button type="primary" style={{marginRight: 20}} onClick={() => setFlowVisible(true)}>
+          <Button type="primary" style={{ marginRight: 20 }} onClick={() => setFlowVisible(true)}>
             查看流程
           </Button>
 
@@ -531,10 +536,10 @@ function Detail(props) {
               新建清单
             </Button>
           )}
-          <CurrentInfo version={version} flowDetail={flowDetail}/>
+          <CurrentInfo version={version} flowDetail={flowDetail} />
         </div>
         <div className={styles.btns}>
-          {saveTime && <span style={{color: '#333', fontSize: 14}}>上次保存时间 {saveTime}</span>}
+          {saveTime && <span style={{ color: '#333', fontSize: 14 }}>上次保存时间 {saveTime}</span>}
           {version.audit_status === 0 && (
             <Button type="primary" loading={loading.effects['detail/saveSheet']} onClick={onUpdate}>
               保存
@@ -542,16 +547,16 @@ function Detail(props) {
           )}
           <Button
             type="primary"
-            style={{marginRight: 20}}
+            style={{ marginRight: 20 }}
             onClick={() => setVersionTreeVisible(true)}
           >
             历史版本
           </Button>
-          <Avatar.Group style={{marginRight: 20}}>
+          <Avatar.Group style={{ marginRight: 20 }}>
             {user.map((item, id) => (
               <Avatar
                 key={`${id}-${item.name}`}
-                style={{backgroundColor: '#008dff'}}
+                style={{ backgroundColor: '#008dff' }}
                 size="large"
               >
                 {item.Name}
@@ -575,7 +580,7 @@ function Detail(props) {
         <input
           type="file"
           ref={fileRef}
-          style={{display: 'none'}}
+          style={{ display: 'none' }}
           onChange={e => exportExcl(e.target.files)}
         />
       </div>
@@ -635,7 +640,7 @@ function Detail(props) {
             display: 'inline',
             marginLeft: '20px',
           }}
-        ></TimeNode>
+        />
       </div>
 
       <CommentContent
@@ -716,7 +721,7 @@ function Detail(props) {
   );
 }
 
-export default connect(({detail, user, xflow, loading}) => ({
+export default connect(({ detail, user, xflow, loading }) => ({
   flowDetail: xflow.flowDetail,
   auditList: detail.auditList,
   instanceDetail: detail.dingInstanceDetail,

+ 24 - 6
src/pages/Detail/TimeNode.js

@@ -25,15 +25,28 @@ function TimeNode(props) {
     currentUser,
   } = props;
   const {current, list, active} = flow;
+  console.log(list.FlowNodes)
 
-  const getDescription = node => {
+
+  function calculateHoursDifference(date1, date2) {
+    const timestamp1 = date1.getTime(); // 获取第一个Date对象的时间戳(以毫秒为单位)
+    const timestamp2 = date2.getTime(); // 获取第二个Date对象的时间戳(以毫秒为单位)
+
+    const timeDifferenceInMillis = Math.abs(timestamp2 - timestamp1); // 计算时间戳之间的差值(毫秒数)
+    const hoursDifference = timeDifferenceInMillis / (1000 * 60 * 60); // 将差值转换为小时数
+
+    return hoursDifference.toFixed(2);
+  }
+
+  const getDescription = (node, prevNode) => {
     let str = node?.AuditRoleInfo
       ? `审批人:${node?.AuditRoleInfo.Name || '-'}`
       : `审批人:${node?.AuditorUser.CName || '-'}`;
     const date = new Date(node.audit_time)
-    const auditTime = date.toLocaleDateString('zh-CN', {
+    const auditTime = node.audit_time === '0001-01-01T00:00:00Z' ? '-' : date.toLocaleDateString('zh-CN', {
       format: 'YYYY-MM-DD hh:mm:ss'
     })
+    // const residenceTime = auditTime === '-' ? '-' : calculateHoursDifference(date, new Date(prevNode.audit_time))
     return (
       <div>
         {str}
@@ -44,9 +57,14 @@ function TimeNode(props) {
         </div>
         <div>
           <span>
-            审批时间:{auditTime || '-'}
+            审批时间:{auditTime}
           </span>
         </div>
+        {/* <div> */}
+        {/*   <span> */}
+        {/*     滞留时间:{`${residenceTime}小时`} */}
+        {/*   </span> */}
+        {/* </div> */}
       </div>
     );
 
@@ -61,9 +79,9 @@ function TimeNode(props) {
           current={current}
           status={active == 0 ? 'error' : 'process'}
         >
-          {list.FlowNodes.map(item => (
-            <Step key={item.id} title={item.node} description={getDescription(item)}/>
-          ))}
+          {list.FlowNodes.map(( item) => {
+            return <Step key={item.id} title={item.node} description={getDescription(item)} />
+          })}
         </Steps>
         {isAuditor && active != 0 && (
           <div className={styles.btns} style={{margin: '40px 0'}}>

+ 6 - 5
src/pages/Flow/FlowDetail.json

@@ -165,7 +165,7 @@
       "x": -78,
       "y": -254,
       "flow_id": 0,
-      "node_type_psr": 4,
+      "node_type_psr": 3,
       "count": 0,
       "role_list": ""
     },
@@ -213,7 +213,7 @@
       "x": 616,
       "y": -556,
       "flow_id": 0,
-      "node_type_psr": 0,
+      "node_type_psr": 2,
       "count": 0,
       "role_list": ""
     },
@@ -239,6 +239,7 @@
       "flow_id": 0,
       "node_type_psr": 0,
       "count": 0,
+      "is_seal": 1,
       "role_list": ""
     },
     {
@@ -308,7 +309,7 @@
       "parentKey": "1",
       "x": -63,
       "y": -435,
-      "flow_id": 10,
+      "flow_id": 51,
       "node_type_psr": 1,
       "count": 0,
       "role_list": ""
@@ -501,7 +502,7 @@
       "x": 616,
       "y": -277,
       "flow_id": 0,
-      "node_type_psr": 3, 
+      "node_type_psr": 4,
       "count": 0,
       "role_list": ""
     },
@@ -525,7 +526,7 @@
       "x": 631,
       "y": -435,
       "zIndex": 10,
-      "flow_id": 0,
+      "flow_id": 48,
       "node_type_psr": 2,
       "count": 0
     },

+ 34 - 32
src/pages/List/List.js

@@ -1,6 +1,6 @@
-import React, {useState, useEffect, useRef} from 'react';
-import {Button, Divider, Form, Input, message, Modal, Select, Table} from 'antd';
-import {connect} from 'dva';
+import React, { useState, useEffect, useRef } from 'react';
+import { Button, Divider, Form, Input, message, Modal, Select, Table } from 'antd';
+import { connect } from 'dva';
 import router from 'umi/router';
 import FlowModal from '../Detail/FlowModal';
 import {
@@ -10,14 +10,14 @@ import {
   queryDelPurchaseExcel,
   queryRecordSheet,
 } from '@/services/boom';
-import {getToken} from '@/utils/utils';
+import { getToken } from '@/utils/utils';
 import ClassifyModal from './ClassifyModal';
 import VersionModal from './VersionModal';
 
 let token = getToken();
 
 function List(props) {
-  const {excel, loading, project, dispatch, typeOptions, userList, versionList} = props;
+  const { excel, loading, project, dispatch, typeOptions, userList, versionList } = props;
   const [flowVisible, setFlowVisible] = useState(false);
   const [version, setVersion] = useState({});
   const [versionVisible, setVersionVisible] = useState(false);
@@ -44,9 +44,12 @@ function List(props) {
     {
       title: '所属项目',
       dataIndex: 'project_id',
-      render: project_id => {
-        let p = project.list.find(p => p.id == project_id);
-        if (p) return `${p.project_name}(${p.project_full_code})`;
+      render: projectID => {
+        const p = project.list.find(pItem => pItem.id === projectID);
+        if (p) {
+          return `${p.project_name}(${p.project_full_code})`;
+        }
+        return '';
       },
     },
     {
@@ -58,12 +61,11 @@ function List(props) {
             onClick={async () => {
               try {
                 setClassifyLoading(true);
-                const data = await queryBindClassify({project_id: record.project_id}); //record.project_id
+                const data = await queryBindClassify({ project_id: record.project_id }); //record.project_id
                 setClassifyLoading(false);
-                setData({project_id: record.project_id, classify: data});
+                setData({ project_id: record.project_id, classify: data });
                 setVisible(true);
-              } catch (error) {
-              }
+              } catch (error) {}
             }}
           >
             分类权限
@@ -74,7 +76,7 @@ function List(props) {
               localStorage.excelId = record.id;
               setLoading2(true);
               try {
-                const data = await queryBoomFlowDetail({id: record.template_id});
+                const data = await queryBoomFlowDetail({ id: record.template_id });
                 setFlowDetail(data);
                 setVersion(record);
                 setFlowVisible(true);
@@ -84,8 +86,7 @@ function List(props) {
                     project_id: record.project_id,
                   },
                 });
-              } catch (error) {
-              }
+              } catch (error) {}
               setLoading2(false);
               // router.push(`/home/detail/${record.project_id}/${record.template_id}`);
             }}
@@ -105,8 +106,9 @@ function List(props) {
       ),
     },
   ];
+
   const queryList = filter => {
-    filter = {...filterRes.current, ...filter};
+    filter = { ...filterRes.current, ...filter };
     dispatch({
       type: 'list/queryProjectRecord',
       payload: {
@@ -142,20 +144,20 @@ function List(props) {
   }, []);
 
   const changeVersion = item => {
-    if (typeof item == 'object') {
+    if (typeof item === 'object') {
       localStorage.excelItem = JSON.stringify(item);
     }
-    router.push(`/home/detail/${item.project_id}/${item.template_id}?version_id=${item.version_id}`);
+    router.push(`/home/detail/${item.project_id}/${item.template_id}?excel_id=${item.id}`);
   };
 
-  const getLoading = () => {
-    let effects = loadingVersion.effects;
-    return !loadingVersion.effects['detail/queryComment'] && loadingVersion.models.detail;
-  };
+  // const getLoading = () => {
+  //   let effects = loadingVersion.effects;
+  //   return !loadingVersion.effects['detail/queryComment'] && loadingVersion.models.detail;
+  // };
 
   const onCommit = async (values, callback) => {
     setCommitLoading(true);
-    let sheets = await queryRecordSheet({gridKey: version.id, 'JWT-TOKEN': token});
+    let sheets = await queryRecordSheet({ gridKey: version.id, 'JWT-TOKEN': token });
 
     let params = {
       ...values,
@@ -166,8 +168,8 @@ function List(props) {
       payload: params,
       callback: async newVersion => {
         // 更新flow流程图
-        const data = await queryBoomFlowDetail({id: newVersion.template_id});
-        console.log(data);
+        const data = await queryBoomFlowDetail({ id: newVersion.template_id });
+        // console.log(data);
         setFlowDetail(data);
         setCommitLoading(false);
         callback && callback();
@@ -189,7 +191,7 @@ function List(props) {
         const res = await queryDelPurchaseExcel(data);
         if (res.code == 200) {
           message.success('删除成功');
-          const data = await queryBoomFlowDetail({id: version.template_id});
+          const data = await queryBoomFlowDetail({ id: version.template_id });
           console.log(data);
           setFlowDetail(data);
         }
@@ -202,18 +204,18 @@ function List(props) {
       <Form
         form={form}
         layout="inline"
-        style={{marginBottom: 20}}
-        onFinish={filter => queryList({...filter, currentPage: 1})}
+        style={{ marginBottom: 20 }}
+        onFinish={filter => queryList({ ...filter, currentPage: 1 })}
       >
         <Form.Item label="流程名称" name="name">
-          <Input/>
+          <Input />
         </Form.Item>
         <Form.Item label="项目编号" name="project_full_code">
-          <Input/>
+          <Input />
         </Form.Item>
         <Form.Item label="所属项目" name="project_id">
           <Select
-            style={{width: 200}}
+            style={{ width: 200 }}
             showSearch
             allowClear
             options={project.list.map(item => ({
@@ -288,7 +290,7 @@ function List(props) {
   );
 }
 
-export default connect(({list, loading, user}) => ({
+export default connect(({ list, loading, user }) => ({
   excel: list.excel,
   versionList: list.versionList,
   project: list.project,

+ 18 - 16
src/services/boom.js

@@ -1,7 +1,7 @@
-import {message} from 'antd';
+import { message } from 'antd';
 import request from '@/utils/request';
-import {async} from '@antv/x6/lib/registry/marker/async';
-import {stringify} from 'qs';
+import { async } from '@antv/x6/lib/registry/marker/async';
+import { stringify } from 'qs';
 
 /**
  project_id
@@ -186,10 +186,10 @@ export async function queryVersionsList(params) {
 }
 
 export async function queryBoomFlowDetail(params) {
-  let {data} = await request(`/purchase/bom/flow/info?${stringify(params)}`);
+  let { data } = await request(`/purchase/bom/flow/info?${stringify(params)}`);
   const groups = {
     top: {
-      position: {name: 'top'},
+      position: { name: 'top' },
       attrs: {
         circle: {
           r: 4,
@@ -197,13 +197,13 @@ export async function queryBoomFlowDetail(params) {
           stroke: '#31d0c6',
           strokeWidth: 2,
           fill: '#fff',
-          style: {visibility: 'hidden'},
+          style: { visibility: 'hidden' },
         },
       },
       zIndex: 10,
     },
     right: {
-      position: {name: 'right'},
+      position: { name: 'right' },
       attrs: {
         circle: {
           r: 4,
@@ -211,13 +211,13 @@ export async function queryBoomFlowDetail(params) {
           stroke: '#31d0c6',
           strokeWidth: 2,
           fill: '#fff',
-          style: {visibility: 'hidden'},
+          style: { visibility: 'hidden' },
         },
       },
       zIndex: 10,
     },
     bottom: {
-      position: {name: 'bottom'},
+      position: { name: 'bottom' },
       attrs: {
         circle: {
           r: 4,
@@ -225,13 +225,13 @@ export async function queryBoomFlowDetail(params) {
           stroke: '#31d0c6',
           strokeWidth: 2,
           fill: '#fff',
-          style: {visibility: 'hidden'},
+          style: { visibility: 'hidden' },
         },
       },
       zIndex: 10,
     },
     left: {
-      position: {name: 'left'},
+      position: { name: 'left' },
       attrs: {
         circle: {
           r: 4,
@@ -239,7 +239,7 @@ export async function queryBoomFlowDetail(params) {
           stroke: '#31d0c6',
           strokeWidth: 2,
           fill: '#fff',
-          style: {visibility: 'hidden'},
+          style: { visibility: 'hidden' },
         },
       },
       zIndex: 10,
@@ -248,7 +248,7 @@ export async function queryBoomFlowDetail(params) {
   const attrs = {
     line: {
       stroke: '#A2B1C3',
-      targetMarker: {name: 'block', width: 12, height: 8},
+      targetMarker: { name: 'block', width: 12, height: 8 },
       strokeDasharray: '5 5',
       strokeWidth: 1,
     },
@@ -278,7 +278,7 @@ export async function queryBoomFlowDetail(params) {
         cell: item.target_cell,
         port: item.target_port,
       },
-      zIndex: 0
+      zIndex: 0,
     };
     try {
       edge.attrs = item.attr ? JSON.parse(item.attr) : attrs;
@@ -500,6 +500,8 @@ export async function setLastVersion(excelId) {
 }
 
 export async function getAuditDetail(params) {
-  const res = await request(`/purchase/bom/get-audit-detail/${params.userId}?version_id=${params.versionID}`)
-  return res.data
+  const res = await request(
+    `/purchase/bom/get-audit-detail/${params.userId}?excel_id=${params.excelID}`
+  );
+  return res.data;
 }