Quellcode durchsuchen

1. 流程图增加一条【采购执行】节点转向【采购清单】节点的流程线
2. 【采购清单】节点提交流转时可以上传附件
3. 增加【设置为最终版】功能,设置后清单无法再修改。只能提交审核,提交审核时传递的附件只能新增无法删除

xjj vor 2 Jahren
Ursprung
Commit
5aaabccd96

+ 100 - 0
src/components/AttachmentTable/index.js

@@ -0,0 +1,100 @@
+import { connect } from 'dva';
+import { Divider, Table, Modal } from 'antd';
+import PreviewFile from '@/components/PreviewFile';
+import FileViewerModal from '@/components/FileViewer';
+import React, { useState, useMemo } from 'react';
+
+function AttachmentTable(props) {
+  const [excelFileVisible, setExcelFileVisible] = useState(false);
+  const [exportData, setExportData] = useState({});
+  const { loading, excelFileList, canDelete = true, dispatch, version } = props;
+  const columns = [
+    {
+      title: '文件名',
+      dataIndex: 'name',
+    },
+    {
+      title: '操作',
+      render: record => {
+        return (
+          <>
+            {canDelete && (
+              <a
+                onClick={() => {
+                  deleteFile(record.id);
+                }}
+                style={{ marginRight: 10 }}
+              >
+                删除
+              </a>
+            )}
+
+            <a
+              onClick={() => {
+                setExcelFileVisible(true);
+                setExportData(record);
+              }}
+            >
+              预览
+            </a>
+          </>
+        );
+      },
+    },
+  ];
+  const downloadFile = record => {
+    window.location.href = `${record.url}`;
+  };
+  const deleteFile = id => {
+    Modal.confirm({
+      title: '提醒',
+      content: '确认删除该文件,删除后无法复原',
+      okText: '确认',
+      cancelText: '取消',
+      onOk() {
+        dispatch({
+          type: 'detail/deleteFiles',
+          id: id,
+          callback: () => {
+            dispatch({
+              type: 'detail/QueryExcelFiles',
+              payload: {
+                excel_id: version.attachment_id,
+              },
+            });
+          },
+        });
+      },
+    });
+  };
+  const excelFileData = useMemo(() => {
+    return excelFileList?.map(item => {
+      const list = item.url.split('/');
+      const name = list[list.length - 1];
+      return { name, url: item.url, id: item.id };
+    });
+  }, [excelFileList]);
+  return (
+    <>
+      <Table rowKey="id" loading={loading} columns={columns} dataSource={excelFileData} />
+      <FileViewerModal
+        data={exportData}
+        visible={excelFileVisible}
+        downloadFile={downloadFile}
+        onCancel={() => {
+          setExcelFileVisible(false);
+        }}
+      />
+    </>
+  );
+}
+
+const isImg = fileNmae => {
+  const imgReg = /\.(png|jpg|gif|jpeg|webp)$/;
+  return imgReg.test(fileNmae);
+};
+
+export default connect(({ detail, loading }) => ({
+  excelFileList: detail.excelFileList,
+  loading: loading.effects['detail/QueryExcelFiles'],
+}))(AttachmentTable);

+ 1 - 1
src/components/FileViewer/index.js

@@ -11,8 +11,8 @@ const FileViewerModal = ({ data, visible, onCancel, downloadFile }) => {
       title="预览"
       visible={visible}
       width={1000}
+      footer={null}
       onCancel={onCancel}
-      onOk={onCancel}
       bodyStyle={{ height: '680px', overflowY: 'hidden' }}
     >
       {data?.url && (

+ 1 - 0
src/components/OssUpload/AliyunOssUploader.js

@@ -69,6 +69,7 @@ class AliyunOSSUpload extends React.Component {
   beforeUpload = async file => {
     const { OSSData } = this.state;
     const expire = OSSData.expire * 1000;
+    file.url = OSSData.dir + '/' + file.name;
     console.log(file);
 
     if (expire < Date.now()) {

+ 9 - 1
src/pages/Detail/CommitAuditModal.js

@@ -17,6 +17,7 @@ import {
   Upload,
   Table,
   Divider,
+  Collapse,
 } from 'antd';
 import { PlusOutlined, UploadOutlined } from '@ant-design/icons';
 import { connect } from 'dva';
@@ -38,6 +39,7 @@ import { uploadFile, queryUserListByRoleID } from '@/services/boom';
 import ApprovalProcess from './ApprovalProcess';
 import { uuidv4 } from '@antv/xflow';
 import AliyunOSSUpload from '@/components/OssUpload/AliyunOssUploader';
+import AttachmentTable from '@/components/AttachmentTable';
 
 const { TextArea } = Input;
 const { Option } = Select;
@@ -247,6 +249,7 @@ function CommitAuditModal(props) {
     } else {
       changeAudit('');
       setAuditList([]);
+      setApprovalProcess({});
     }
     form.setFieldValue('next_template_node_id', '');
   };
@@ -608,9 +611,14 @@ function CommitAuditModal(props) {
           <Input.TextArea />
         </Form.Item>
         <Form.Item labelCol={{ span: 7 }} wrapperCol={{ span: 15 }} label="附件">
-          <AliyunOSSUpload {...uploadProps} directory={false} label="上传文件" />
+          {OSSData.host && <AliyunOSSUpload {...uploadProps} directory={false} label="上传文件" />}
         </Form.Item>
       </Form>
+      <Collapse style={{ marginTop: 20 }}>
+        <Collapse.Panel header="已上传附件" key="1">
+          <AttachmentTable version={version} canDelete={version.last_version == 0} />
+        </Collapse.Panel>
+      </Collapse>
       <Tabs defaultActiveKey="1">
         {auditList.map((item, idx) => (
           <TabPane tab={item.name} key={`${idx}_${item.title}`}>

+ 18 - 0
src/pages/Detail/CurrentInfo.js

@@ -0,0 +1,18 @@
+import React from 'react';
+import styles from "./Index.less"
+
+function CurrentInfo(props) {
+  const { version, flowDetail } = props;
+  const nodeId = version.template_node_id;
+  if (!flowDetail?.nodes || !nodeId) return null;
+  const node = flowDetail.nodes.find(item => item.Id == nodeId);
+
+  return (
+    <span className={styles.curTitle}>
+      当前清单: <span>{version.version_name || '-'}</span>当前节点:{' '}
+      <span>{node?.label || '-'}</span>
+    </span>
+  );
+}
+
+export default CurrentInfo;

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

@@ -0,0 +1,162 @@
+import React, { useMemo } from 'react';
+import { Button, Menu, Dropdown, Modal } from 'antd';
+import { UnorderedListOutlined } from '@ant-design/icons';
+import router from 'umi/router';
+import { setLastVersion } from '@/services/boom';
+
+function DropdownMenu(props) {
+  const {
+    compareList,
+    isMerge,
+    version,
+    onClick,
+    flowDetail,
+    classifyList,
+    currentUser,
+    isAuditor,
+    flow,
+    sheetRef3,
+    sheetRef2,
+    setVersion,
+  } = props;
+
+  const active_audit = flow.active_audit;
+  const isLastVersion = useMemo(() => {
+    return version.last_version == 1;
+  }, [version]);
+
+  const canEdit = () => {
+    if (flow.list.FlowNodes.length - 1 == flow.current && active_audit == 3) return false;
+    return active_audit != 1;
+  };
+
+  const onSave = () => {
+    const sheet1 = compareList[0];
+    Modal.confirm({
+      title: '提示',
+      content: `是否确认保存【${sheet1.version_name || sheet1.name}】`,
+      okText: '确定',
+      cancelText: '取消',
+      onOk() {
+        let sheetData = sheetRef3.current.getSheetJson().data;
+        sheetData.forEach(sheet => {
+          delete sheet.data;
+        });
+        let params = {
+          ...sheet1,
+          data: JSON.stringify(sheetData),
+        };
+        dispatch({
+          type: 'detail/commitSheet',
+          payload: params,
+          callback: () => {
+            onCompare(false);
+          },
+        });
+      },
+    });
+  };
+
+  const onMerge = () => {
+    const [sheet1, sheet2] = compareList;
+    Modal.confirm({
+      title: '提示',
+      content: `是否确认将【${sheet2.version_name}】改动的内容同步至【${sheet1.version_name ||
+        sheet1.name}】`,
+      okText: '确定',
+      cancelText: '取消',
+      onOk() {
+        sheetRef3.current.mergeExcl(sheetRef2.current.updateCell);
+      },
+    });
+  };
+  const handleMenuClick = e => {
+    switch (e.key) {
+      case 'back':
+        // 返回
+        router.push(`/bom`);
+        break;
+      case 'lastVersion':
+        Modal.confirm({
+          title: '提示',
+          content: `设置成功后将无法编辑,是否设置为最终版本?`,
+          okText: '确定',
+          cancelText: '取消',
+          onOk: async () => {
+            await setLastVersion(version.id);
+            version.last_version = 1
+            setVersion(version)
+            localStorage.excelItem = JSON.stringify(version);
+          },
+        });
+        break;
+      default:
+        onClick(e);
+        break;
+    }
+  };
+
+  // 判断是否为比对模式
+  if (compareList.length == 2) {
+    // 判断是否为同步最新清单的比对
+    if (isMerge) {
+      return (
+        <>
+          <Button type="primary" onClick={onSave}>
+            保存
+          </Button>
+          <Button onClick={onMerge}>同步新增内容</Button>
+          <Button onClick={() => onClick({ key: 'compare', data: false })}>取消同步</Button>
+        </>
+      );
+    } else {
+      return <Button onClick={() => onClick({ key: 'compare', data: true })}>取消比对</Button>;
+    }
+  }
+
+  const menuList = [
+    <Menu.Item key="back">返回</Menu.Item>,
+    <Menu.Item key="bomDetail">详情</Menu.Item>,
+    <Menu.Item key="export">导出</Menu.Item>,
+    <Menu.Item key="compare">比对</Menu.Item>,
+  ];
+  // version.audit_status:4 为副本。不可操作
+  if (version.audit_status != 4) {
+    //判断权限配置,如果配置了,就指定权限的人可提交,没配置就全部人都可提交
+    //判断分类,这个清单所属分类的操作人可以提交
+    const getIsSubmit = () => {
+      let bool = true;
+      const nodeId = version.template_node_id;
+      if (!flowDetail?.nodes || !nodeId) return;
+      const node = flowDetail.nodes.find(item => item.Id == nodeId);
+      if (!node || node.name == 'custom-circle') return;
+      if (node?.role_list) {
+        bool = node.role_list
+          .split(',')
+          .some(id => currentUser.roleList?.find(role => role.ID == id));
+      }
+      const uidsStr = classifyList.find(item => item.classify_id == version.classify_id)?.uid;
+      if (uidsStr && uidsStr.split(',')?.findIndex(item => item == currentUser.ID) < 0) {
+        bool = false;
+      }
+      return bool;
+    };
+    if (getIsSubmit() && version.audit_status != 3)
+      menuList.push(<Menu.Item key="commitAudit">提交流转</Menu.Item>);
+
+    if (!isAuditor && canEdit() && !version.flow_id) {
+      menuList.push(<Menu.Item key="merge">同步</Menu.Item>);
+     
+    }
+  }
+  if (!isLastVersion) menuList.push(<Menu.Item key="lastVersion">设为最终版本</Menu.Item>);
+  return (
+    <>
+      <Dropdown overlay={<Menu onClick={handleMenuClick}>{menuList}</Menu>}>
+        <UnorderedListOutlined style={{ fontSize: 30, cursor: 'pointer' }} />
+      </Dropdown>
+    </>
+  );
+}
+
+export default DropdownMenu;

+ 24 - 3
src/pages/Detail/FlowModal.js

@@ -30,7 +30,6 @@ import {
 } from '@/services/boom';
 import { async } from '@antv/x6/lib/registry/marker/async';
 import VersionModal from './VersionModal';
-import AuditFlow from './AuditFlow';
 
 const { Option } = Select;
 const { Step } = Steps;
@@ -52,7 +51,6 @@ function FlowModal(props) {
     version,
     onClose,
     onChangeVersion,
-    onDelVersion,
     form,
     loading,
     flowDetail,
@@ -63,6 +61,7 @@ function FlowModal(props) {
     currentUser,
     typeOptions,
     userList,
+    templateId,
   } = props;
   const [data, setData] = useState([]);
   const [showData, setShowData] = useState([]);
@@ -108,6 +107,27 @@ function FlowModal(props) {
     initData(node.Id);
   };
 
+  const onDelVersion = data => {
+    Modal.confirm({
+      title: '提示',
+      content: `是否确认删除清单?`,
+      okText: '确定',
+      cancelText: '取消',
+      onOk: async () => {
+        const res = await queryDelPurchaseExcel(data);
+        if (res.code == 200) {
+          message.success('删除成功');
+          dispatch({
+            type: 'xflow/queryBoomFlowDetail',
+            payload: {
+              id: templateId,
+            },
+          });
+        }
+      },
+    });
+  };
+
   const initData = async template_node_id => {
     setNodeLoading(true);
     try {
@@ -467,9 +487,10 @@ function FlowModal(props) {
       <VersionModal
         typeOptions={typeOptions}
         visible={versionVisible}
+        version={version}
         onClose={() => setVersionVisible(false)}
         onOk={values => {
-          onCommit?.(values, null, () => {
+          onCommit?.(values, () => {
             setVersionVisible(false);
           });
         }}

+ 58 - 65
src/pages/Detail/FormAndFilesNode.js

@@ -1,16 +1,62 @@
-import { Card, Col, Input, Row, Table } from 'antd';
+import { Card, Col, Input, Row, Modal, Empty, Collapse } from 'antd';
 import { Form } from '@ant-design/compatible';
 import { useForm } from 'antd/lib/form/Form';
-import PreviewFile from '@/components/PreviewFile';
-import FileViewerModal from '@/components/FileViewer';
 import { useMemo, useState } from 'react';
-import FileViewer from 'react-file-viewer';
+import CommentContent from '@/components/CommentContent';
+import { connect } from 'dva';
+import AttachmentTable from '@/components/AttachmentTable';
+
+const { confirm } = Modal;
+const { Panel } = Collapse;
+
+const FormAndFilesNode = props => {
+  const { formData, excelFileList, comment, version, loading } = props;
+
+  const handleSubmitCell = (value, callback) => {
+    if (!value) return;
+    dispatch({
+      type: 'detail/addComment',
+      payload: {
+        ...cellPosition.current,
+        comment: value,
+      },
+      callback,
+    });
+  };
+
+  const FormContent = useMemo(() => {
+    return renderFrom(formData);
+  }, [formData]);
+
+  return (
+    <Collapse style={{ marginTop: 20 }}>
+      <Panel header="附件" key="2">
+        <AttachmentTable version={version} canDelete={version.last_version == 0} />
+      </Panel>
+      {FormContent && (
+        <Panel header="表单信息" key="1">
+          {FormContent}
+        </Panel>
+      )}
+
+      <Panel header="评论" key="3">
+        <CommentContent
+          title="单元格沟通记录"
+          comment={comment}
+          onSubmit={handleSubmitCell}
+          loading={loading.effects['detail/queryComment'] || loading.effects['detail/addComment']}
+        />
+      </Panel>
+    </Collapse>
+  );
+};
 
 const renderFrom = data => {
-  if (!data) return;
+  if (!data) return null;
   try {
     const ding_schema = JSON.parse(data)[0];
     const formData = JSON.parse(ding_schema)?.formComponentValues;
+    if (formData.length == 0) return null;
     return (
       <>
         {formData.map((item, idx) => {
@@ -18,8 +64,8 @@ const renderFrom = data => {
           return (
             <Form.Item
               key={`FormAndFilesNode_${idx}`}
-              labelCol={{ span: 6 }}
-              wrapperCol={{ span: 18 }}
+              labelCol={{ span: 4 }}
+              wrapperCol={{ span: 14 }}
               label={item.name}
             >
               <div
@@ -39,63 +85,10 @@ const renderFrom = data => {
       </>
     );
   } catch {
-    return;
+    return null;
   }
 };
-
-const FormAndFilesNode = ({ title, formData, excelFileData, loading, downloadFile }) => {
-  const [exportData, setExportData] = useState({});
-  const [excelFileVisible, setExcelFileVisible] = useState(false);
-  const columns = [
-    {
-      title: '附件',
-      dataIndex: 'name',
-      render: (text, item) => {
-        return <div>{item.name}</div>;
-      },
-    },
-    {
-      title: '预览',
-      render: (record, item) => {
-        let reg = /\.(png|jpg|gif|jpeg|webp)$/;
-        return reg.test(item.name) ? (
-          <PreviewFile name={item.name} src={item.url} />
-        ) : (
-          <a
-            style={{ marginLeft: 10 }}
-            onClick={() => {
-              setExcelFileVisible(true);
-              setExportData(record);
-            }}
-          >
-            预览
-          </a>
-        );
-      },
-    },
-  ];
-  return (
-    <>
-      {excelFileData && formData && (
-        <Card title={title} type="inner" style={{ marginTop: 20 }} loading={loading}>
-          <Row style={{ marginTop: '20px' }}>
-            <Col span={12}>{renderFrom(formData)}</Col>
-            <Col span={11} offset={1}>
-              <Table rowKey="id" columns={columns} dataSource={excelFileData} />
-            </Col>
-          </Row>
-        </Card>
-      )}
-      <FileViewerModal
-        data={exportData}
-        visible={excelFileVisible}
-        downloadFile={downloadFile}
-        onCancel={() => {
-          setExcelFileVisible(false);
-        }}
-      />
-    </>
-  );
-};
-
-export default FormAndFilesNode;
+export default connect(({ detail, loading }) => ({
+  comment: detail.comment,
+  loading,
+}))(FormAndFilesNode);

+ 0 - 1
src/pages/Detail/HistoryDrawer.js

@@ -5,7 +5,6 @@ import '@ant-design/compatible/assets/index.css';
 import { Drawer, Descriptions, Card, Table, Timeline, Button, Space } from 'antd';
 import moment from 'moment';
 import { connect } from 'dva';
-import CommentContent from '@/components/CommentContent';
 import TimelineItem from 'antd/lib/timeline/TimelineItem';
 
 // 评论

+ 43 - 447
src/pages/Detail/Index.js

@@ -1,24 +1,9 @@
 import React, { useEffect, useState, useRef, useMemo } from 'react';
 import { UnorderedListOutlined, PlusOutlined } from '@ant-design/icons';
-import {
-  Button,
-  Modal,
-  message,
-  Alert,
-  Avatar,
-  Spin,
-  Select,
-  Menu,
-  Dropdown,
-  Row,
-  Col,
-  Table,
-  Card,
-} from 'antd';
+import { Button, Modal, message, Alert, Avatar } from 'antd';
 import { connect } from 'dva';
 import styles from './Index.less';
 import LuckySheet from './LuckySheet';
-import router from 'umi/router';
 import AuditModal from './AuditModal';
 // import CommentDrawer from './CommentDrawer';
 import RightDrawer from './RightDrawer';
@@ -31,14 +16,14 @@ import TimeNode from './TimeNode';
 import FilesModal from './FilesModal';
 import VersionModal from './VersionModal';
 import CommitAuditModal from './CommitAuditModal';
-import CommentContent from '@/components/CommentContent';
+// import CommentContent from '@/components/CommentContent';
 import MergeModal from './MergeModal';
 import { GetTokenFromUrl, getToken } from '@/utils/utils';
 import {
-  queryDelPurchaseExcel,
   queryDelSheetRecord,
   queryDetail,
   queryDingInstanceExecute,
+  setLastVersion,
 } from '@/services/boom';
 import HistoryDrawer from './HistoryDrawer';
 import AuditFlow from './AuditFlow';
@@ -47,20 +32,15 @@ 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';
 const LocalData = localStorage.luckysheet;
 
-const { Option } = Select;
-
 function Detail(props) {
   const {
     dispatch,
-    comment,
-    history,
     loading,
     currentUser,
-    fileList,
-    roleList,
-    template,
     versionList,
     auditList,
     flowDetail,
@@ -69,7 +49,6 @@ function Detail(props) {
     instanceDetail,
     typeOptions,
     classifyList,
-    OSSData,
     excelFileList,
   } = props;
   const [versionTreeVisible, setVersionTreeVisible] = useState(false);
@@ -84,7 +63,6 @@ function Detail(props) {
   const [commitAuditVisible, setCommitAuditVisible] = useState(false);
   const [sheet, setSheet] = useState({});
   const [compareList, setCompareList] = useState([]);
-  const [edit, setEdit] = useState(false);
   const [isMerge, setIsMerge] = useState(false);
   const [version, setVersion] = useState({});
   const [user, setUser] = useState([]);
@@ -92,7 +70,7 @@ function Detail(props) {
     diff: 0,
     add: 0,
   });
-  const [fileVisible, setFileVisible] = useState(false);
+  // const [fileVisible, setFileVisible] = useState(false);
   const [exportDate, setExportData] = useState([]);
   const sheetRef = useRef();
   const sheetRef2 = useRef();
@@ -103,18 +81,16 @@ function Detail(props) {
     edit: false,
     compare: false,
   });
-  const cellPosition = useRef({});
 
   useEffect(() => {
     if (!version.attachment_id) return;
     dispatch({
       type: 'detail/QueryExcelFiles',
       payload: {
-        // file_type: 1,
         excel_id: version.attachment_id,
       },
     });
-  }, [version.attachment_id]);
+  }, [version.id]);
 
   const projectId = parseInt(params.projectId);
   const templateId = parseInt(params.templateId);
@@ -171,41 +147,10 @@ function Detail(props) {
   const isAuditor = useMemo(() => {
     const getUserRole = () => {
       return flow.currentNode?.auditor == currentUser.ID;
-      // let roleID = flow.currentNode?.AuditRoleInfo?.ID;
-      // let item = currentUser.roleList.find(role => role.ID == roleID);
-      // if (item) return true;
-      // return false;
     };
     return active_audit == 1 && getUserRole();
   }, [active_audit, flow, currentUser]);
 
-  const onSave = () => {
-    let sheet1 = compareList[0];
-    Modal.confirm({
-      title: '提示',
-      content: `是否确认保存【${sheet1.version_name || sheet1.name}】`,
-      okText: '确定',
-      cancelText: '取消',
-      onOk() {
-        let sheetData = sheetRef3.current.getSheetJson().data;
-        sheetData.forEach(sheet => {
-          delete sheet.data;
-        });
-        let params = {
-          ...sheet1,
-          data: JSON.stringify(sheetData),
-        };
-        dispatch({
-          type: 'detail/commitSheet',
-          payload: params,
-          callback: () => {
-            onCompare(false);
-          },
-        });
-      },
-    });
-  };
-
   const onCompare = async checkSheets => {
     if (checkSheets) {
       const [sheet1, sheet2] = checkSheets;
@@ -265,15 +210,13 @@ function Detail(props) {
         sheet_id: s.order || '0',
         excel_id: version.id,
         cid: cell.cid,
+        sheet_index: String(s.seq || 0),
       };
       dispatch({
         type: 'detail/queryComment',
         payload,
       });
-      cellPosition.current = {
-        ...payload,
-        sheet_index: (s.seq || 0) + '',
-      };
+
       // setCommentVisible(true);
     }
     // 比对模式下双excl同步选中
@@ -283,7 +226,7 @@ function Detail(props) {
     // }
   };
 
-  const onCommit = (values, id) => {
+  const onCommit = params => {
     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));
@@ -301,24 +244,12 @@ function Detail(props) {
     sheets.forEach(item => {
       delete item.data;
     });
-    let params = {
-      ...values,
-      id: id,
-      project_id: version.project_id,
-      name: version.name,
-      guid: version.guid,
-      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),
-      base_id: version.id,
-    };
     dispatch({
       type: 'detail/commitSheet',
-      payload: params,
+      payload: {
+        ...params,
+        data: JSON.stringify(sheets),
+      },
       callback: newVersion => {
         onCompare(false);
         setCommitVisible(false);
@@ -486,115 +417,6 @@ function Detail(props) {
     });
   };
 
-  const onApprove1 = (flag, taskId) => {
-    const callback = () => {
-      // 更新flow流程图
-      dispatch({
-        type: 'xflow/queryBoomFlowDetail',
-        payload: {
-          id: templateId,
-        },
-      });
-
-      // 更新审批流
-      dispatch({
-        type: 'detail/queryDingInstanceDetail',
-        payload: {
-          process_instance_id: version.ding_instance_id, //创建表单成功返回的id
-        },
-      });
-    };
-
-    const request = async () => {
-      let param = {
-        request: {
-          process_instance_id: version.ding_instance_id,
-          result: flag ? 'agree' : 'refuse',
-          actioner_userid: currentUser.DingUserId || getCurrentUser()?.DingUserId,
-          task_id: taskId,
-        },
-      };
-      let res = await queryDingInstanceExecute(param);
-      if (res?.data?.result) {
-        callback();
-      }
-    };
-
-    let tipText = '是否通过审批。';
-    if (!flag) {
-      tipText = '是否拒绝审批。';
-      // request();
-      // return;
-    }
-
-    let isSingle = false;
-    let serviceNode;
-    const flowNode = flow.currentNode;
-    const getLastTemplateNodeId = data => {
-      let result;
-      const getFun = item => {
-        if (item.flow_path?.length > 0) {
-          getFun(item.flow_path[0]);
-        } else {
-          result = item.template_node_id;
-        }
-      };
-      if (!data) return version.template_node_id;
-      getFun(data[0]);
-      return result;
-    };
-    let lastTemplateNodeId = version.template_node_id;
-    if (version.flow_path) {
-      //如果多节点审批  获取当前是否审批流程的最后一个审批节点
-      let flowPathList = JSON.parse(version.flow_path);
-      lastTemplateNodeId = getLastTemplateNodeId(flowPathList);
-    }
-
-    // 判断是否为最后一个审批节点
-    if (
-      lastTemplateNodeId == version.template_node_id &&
-      flow.current == flow.list.FlowNodes.length - 1
-    ) {
-      serviceNode = flowDetail.nodes.find?.(item => item.Id == version.next_template_node_id);
-      if (!serviceNode.muti_version) {
-        //audit_status=4 表示为清单推进后留存的副本.不计入多清单计算
-        isSingle = versionList.find(
-          item => item.audit_status != 4 && item.template_node_id == serviceNode.Id
-        );
-        if (isSingle) tipText = `节点【${serviceNode.label}】只能拥有一个清单,是否覆盖?`;
-      }
-    }
-    Modal.confirm({
-      title: '提示',
-      content: tipText,
-      okText: '确定',
-      cancelText: '取消',
-      onOk: () => {
-        request();
-      },
-    });
-  };
-
-  const onMerge = () => {
-    const [sheet1, sheet2] = compareList;
-    Modal.confirm({
-      title: '提示',
-      content: `是否确认将【${sheet2.version_name}】改动的内容同步至【${sheet1.version_name ||
-        sheet1.name}】`,
-      okText: '确定',
-      cancelText: '取消',
-      onOk() {
-        // let sheet2Data = sheetRef2.current.getSheetJson()
-        sheetRef3.current.mergeExcl(sheetRef2.current.updateCell);
-        // setCompareList([...compareList]);
-        // let currentData = sheetRef3.current.getSheetJson()
-        // // 更新后重新比对
-        // sheetRef2.current.toggleCompare(false);
-        // sheetRef2.current.toggleCompare(true, currentData);
-      },
-    });
-  };
-
   const onMergeVersion = async sheet2 => {
     // const [sheet1, sheet2] = checkSheets;
     const sheet1 = version;
@@ -620,22 +442,8 @@ function Detail(props) {
     // }, 400);
   };
 
-  const handleClickFile = () => {
-    fileRef.current.click();
-  };
-
   const handleMenuClick = e => {
     switch (e.key) {
-      case 'back':
-        // 返回
-        router.push(`/bom`);
-        break;
-      // case 'version':
-      //   // 清单
-      //   queryHistory();
-      //   setCommentVisible(false);
-      //   setHistoryVisible(true);
-      //   break;
       case 'bomDetail':
         // 清单
         setCommentVisible(true);
@@ -648,147 +456,19 @@ function Detail(props) {
         // 提交流转
         setCommitAuditVisible(true);
         break;
-      case 'flow':
-        // 查看流程
-        setFlowVisible(true);
-        break;
       case 'compare':
         // 比对
         setCompareVisible(true);
         break;
-      case 'template':
-        // 模板
-        handleClickFile();
-        break;
-      // case 'auditSuccess':
-      //   // 审核通过
-      //   onApprove(true);
-      //   break;
-      // case 'auditFailed':
-      //   // 审核拒绝
-      //   onApprove(false);
-      //   break;
-      // case 'edit':
-      //   // 编辑
-      //   handleEdit(true);
       case 'merge':
         // 同步清单
         setMergeVisible(true);
         break;
-      case 'commit':
-        // 提交
-        // handleClickCommit();
-        setCommitVisible(true);
-        setCommentVisible(false);
-        break;
-      case 'attachment':
-        // 附件
-        setFileVisible(true);
-        queryFiles();
-        break;
-    }
-  };
-
-  const renderBtns = () => {
-    // 判断是否为比对模式
-    if (compareList.length == 2) {
-      // 判断是否为同步最新清单的比对
-      if (isMerge) {
-        return (
-          <>
-            <Button type="primary" onClick={() => onSave()}>
-              保存
-            </Button>
-            <Button onClick={() => onMerge()}>同步新增内容</Button>
-            <Button onClick={() => onCompare(false)}>取消同步</Button>
-          </>
-        );
-      } else {
-        return <Button onClick={() => onCompare(false)}>取消比对</Button>;
-      }
-    }
-
-    const menuList = [
-      <Menu.Item key="back">返回</Menu.Item>,
-      <Menu.Item key="bomDetail">详情</Menu.Item>,
-      <Menu.Item key="export">导出</Menu.Item>,
-      <Menu.Item key="compare">比对</Menu.Item>,
-      // <Menu.Item key="attachment">附件</Menu.Item>,
-    ];
-    // version.audit_status:4 为副本。不可操作
-    if (version.audit_status != 4) {
-      //判断权限配置,如果配置了,就指定权限的人可提交,没配置就全部人都可提交
-      //判断分类,这个清单所属分类的操作人可以提交
-      const getIsSubmit = () => {
-        let bool = true;
-        const nodeId = version.template_node_id;
-        if (!flowDetail?.nodes || !nodeId) return;
-        const node = flowDetail.nodes.find(item => item.Id == nodeId);
-        if (!node || node.name == 'custom-circle') return;
-        if (node?.role_list) {
-          bool = node.role_list
-            .split(',')
-            .some(id => currentUser.roleList?.find(role => role.ID == id));
-        }
-        const uidsStr = classifyList.find(item => item.classify_id == version.classify_id)?.uid;
-        if (uidsStr && uidsStr.split(',')?.findIndex(item => item == currentUser.ID) < 0) {
-          bool = false;
-        }
-        return bool;
-      };
-      if (getIsSubmit() && version.audit_status != 3)
-        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>}>
-          <UnorderedListOutlined style={{ fontSize: 30, cursor: 'pointer' }} />
-        </Dropdown>
-      </>
-    );
-  };
-
-  const canEdit = () => {
-    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 (active_audit) {
-      case 0:
-        if (!flow.list || flow.list.FlowNodes?.length == 0) return;
-        item = <Alert message="审批拒绝" type="error" />;
-        break;
-      case 1:
-        item = <Alert message="等待审核中" type="info" />;
-        break;
-      case 2:
-        item = (
-          <Alert
-            message={`审批被拒绝${
-              audit_comment ? `,拒绝原因:${audit_comment}` : ''
-            }。请修改后重新提交`}
-            type="error"
-          />
-        );
-        break;
-      case 3:
-        item = <Alert message="审批通过" type="success" />;
+      case 'compare':
+        // 同步
+        onCompare(e.data);
         break;
     }
-
-    return <div style={{ marginTop: 20 }}>{item}</div>;
   };
 
   const exportExcl = files => {
@@ -830,16 +510,6 @@ function Detail(props) {
     });
   };
 
-  const queryFiles = () => {
-    dispatch({
-      type: 'detail/queryFiles',
-      payload: {
-        // excel_id: id || excelId,
-        excel_id: projectId,
-      },
-    });
-  };
-
   const getUploadProps = () => {
     const token = getToken() || GetTokenFromUrl();
     const uploadProps = {
@@ -868,16 +538,7 @@ function Detail(props) {
     return uploadProps;
   };
 
-  const deleteFile = id => {
-    dispatch({
-      type: 'detail/deleteFiles',
-      id: id,
-      callback: () => {
-        queryFiles();
-      },
-    });
-  };
-
+ 
   const queryHistoryDetail = async item => {
     return new Promise(resolve => {
       dispatch({
@@ -903,10 +564,6 @@ function Detail(props) {
     return loading.effects['detail/queryFiles'];
   };
 
-  const downloadFile = record => {
-    window.location.href = `${record.url}`;
-  };
-
   const changeVersion = id => {
     let version;
     if (typeof id == 'object') {
@@ -947,13 +604,6 @@ function Detail(props) {
       payload: values,
       callback: newVersion => {
         setCommitAuditVisible(false);
-        // 更新version
-        // localStorage.excelId = newVersion.id;
-        // changeVersion({
-        //   ...version,
-        //   ...newVersion,
-        //   version_id: version.id
-        // });
         // 更新flow流程图
         dispatch({
           type: 'xflow/queryBoomFlowDetail',
@@ -974,52 +624,6 @@ function Detail(props) {
     } catch (error) {}
   };
 
-  const renderNode = () => {
-    const nodeId = version.template_node_id;
-    if (!flowDetail?.nodes || !nodeId) return;
-    const node = flowDetail.nodes.find(item => item.Id == nodeId);
-    // return `当前清单:${version.version_name || '-'};    当前节点:${node?.label || '-'}`;
-    return (
-      <span className={styles.curTitle}>
-        当前清单: <span>{version.version_name || '-'}</span>当前节点:{' '}
-        <span>{node?.label || '-'}</span>
-      </span>
-    );
-  };
-
-  const handleSubmitCell = (value, callback) => {
-    if (!value) return;
-    dispatch({
-      type: 'detail/addComment',
-      payload: {
-        ...cellPosition.current,
-        comment: value,
-      },
-      callback,
-    });
-  };
-
-  const onDelVersion = data => {
-    Modal.confirm({
-      title: '提示',
-      content: `是否确认删除清单?`,
-      okText: '确定',
-      cancelText: '取消',
-      onOk: async () => {
-        const res = await queryDelPurchaseExcel(data);
-        if (res.code == 200) {
-          message.success('删除成功');
-          dispatch({
-            type: 'xflow/queryBoomFlowDetail',
-            payload: {
-              id: templateId,
-            },
-          });
-        }
-      },
-    });
-  };
-
   useEffect(() => {
     dispatch({
       type: 'detail/queryProjectRecord',
@@ -1088,16 +692,8 @@ function Detail(props) {
     }
   }, [versionList]);
 
-  const excelFileData = useMemo(() => {
-    return excelFileList?.map(item => {
-      const list = item.url.split('/');
-      const name = list[list.length - 1];
-      return { name, url: item.url };
-    });
-  }, [excelFileList]);
-
   return (
-    <Spin spinning={false}>
+    <div>
       <div className={styles.top}>
         <div>
           <Button type="primary" style={{ marginRight: 20 }} onClick={() => setFlowVisible(true)}>
@@ -1110,7 +706,7 @@ function Detail(props) {
               新建清单
             </Button>
           )}
-          {renderNode()}
+          <CurrentInfo version={version} flowDetail={flowDetail} />
         </div>
         <div className={styles.btns}>
           <Button
@@ -1131,7 +727,19 @@ function Detail(props) {
               </Avatar>
             ))}
           </Avatar.Group>
-          {renderBtns()}
+          <DropdownMenu
+            compareList={compareList}
+            isMerge={isMerge}
+            version={version}
+            flowDetail={flowDetail}
+            classifyList={classifyList}
+            currentUser={currentUser}
+            isAuditor={isAuditor}
+            flow={flow}
+            sheetRef3={sheetRef3}
+            onClick={handleMenuClick}
+            setVersion={setVersion}
+          />
         </div>
         <input
           type="file"
@@ -1141,11 +749,7 @@ function Detail(props) {
         />
       </div>
       <TimeNode flow={flow} isAuditor={isAuditor} onApprove={onApprove}></TimeNode>
-      {/* {version.flow_id ? (
-        <AuditFlow {...auditDetail} canShowAudit={true} onApprove={onApprove} />
-      ) : null} */}
 
-      {/* {renderAlert()} */}
       {/* 判断是否为比对模式 */}
       {compareList.length == 2 ? (
         <>
@@ -1181,18 +785,11 @@ function Detail(props) {
       />
 
       <FormAndFilesNode
-        title="表单信息及附件"
         formData={version?.ding_schema}
-        excelFileData={excelFileData}
-        loading={loading.effects['detail/QueryExcelFiles']}
-        downloadFile={downloadFile}
-      />
-      <CommentContent
-        title="单元格沟通记录"
-        comment={comment}
-        onSubmit={handleSubmitCell}
-        loading={loading.effects['detail/queryComment'] || loading.effects['detail/addComment']}
+        excelFileList={excelFileList}
+        version={version}
       />
+      {/* <CommentContent title="单元格沟通记录" /> */}
 
       <RightDrawer
         version={version}
@@ -1221,10 +818,10 @@ function Detail(props) {
         typeOptions={typeOptions}
         flowDetail={flowDetail}
         visible={flowVisible}
+        templateId={templateId}
         onClose={() => setFlowVisible(false)}
         version={version}
         onChangeVersion={version => changeVersion(version)}
-        onDelVersion={onDelVersion}
       />
       <AuditModal
         loading={getLoading()}
@@ -1246,10 +843,14 @@ function Detail(props) {
       /> */}
       <VersionModal
         typeOptions={typeOptions}
-        loading={getLoading()}
         visible={versionVisible}
+        flowDetail={flowDetail}
+        sheetRef={sheetRef}
+        versionList={versionList}
+        version={version}
         onClose={() => setVersionVisible(false)}
         onOk={values => onCommit(values)}
+        loading={getLoading()}
       />
       <CommitAuditModal
         uploadProps={getUploadProps()}
@@ -1260,24 +861,19 @@ function Detail(props) {
         onOk={onSubmitNextNode}
         luckysheet={sheetRef}
       />
-    </Spin>
+    </div>
   );
 }
 
 export default connect(({ detail, user, xflow, loading }) => ({
   flowDetail: xflow.flowDetail,
   auditList: detail.auditList,
-  fileList: detail.fileList,
-  history: detail.history,
-  comment: detail.comment,
   instanceDetail: detail.dingInstanceDetail,
   currentUser: user.currentUser,
-  roleList: detail.roleList,
   versionList: detail.versionList,
   versionTree: detail.versionTree,
   typeOptions: detail.typeOptions,
   classifyList: detail.classifyList,
-  OSSData: detail.OSSData,
   excelFileList: detail.excelFileList,
   loading,
 }))(Detail);

+ 11 - 2
src/pages/Detail/LuckySheet.js

@@ -102,7 +102,7 @@ class LuckySheet extends React.Component {
             _this.updateTimer = setTimeout(() => {
               onUpdate.bind(_this);
               onUpdate();
-            }, 1000);
+            }, 3000);
           }
         },
         sheetActivate: sheet => {
@@ -123,6 +123,10 @@ class LuckySheet extends React.Component {
       },
     };
     if (version) {
+      const wsUrl =
+        process.env.NODE_ENV == 'development'
+          ? 'ws://47.96.12.136:8896/'
+          : `ws://${location.host}/`;
       option = {
         ...option,
         allowUpdate: true,
@@ -130,7 +134,7 @@ class LuckySheet extends React.Component {
         templateId: templateId,
         // flowId: version.flow_id,
         loadUrl: `/api/v1/purchase/record/sheet?gridKey=${version.id}&JWT-TOKEN=${token}`,
-        updateUrl: `ws://${location.host}/api/v1/ws?id=${version.id}&sid=${templateId}&JWT-TOKEN=${token}`,
+        updateUrl: wsUrl + `api/v1/ws?id=${version.id}&sid=${templateId}&JWT-TOKEN=${token}`,
         // updateUrl: `ws://47.96.12.136:8896/api/v1/ws?id=${version.id}&sid=${templateId}&JWT-TOKEN=${token}`,
         // updateUrl: `ws://120.55.44.4:8896/api/v1/ws?id=${version.id}&sid=${templateId}&JWT-TOKEN=${token}`,
         authorityUrl: `/api/v1/purchase/bom/user/excel/col?depId=${localStorage.depId}&JWT-TOKEN=${token}`,
@@ -152,6 +156,11 @@ class LuckySheet extends React.Component {
           sheet: true,
           hintText: '当前处于审批节点,禁止编辑!',
         };
+      } else if (version.last_version) {
+        option.authority = {
+          sheet: true,
+          hintText: '该清单已设置为最终版本,禁止编辑!',
+        };
       } else if (version.audit_status != 0 || version.status == 1) {
         option.authority = {
           sheet: true,

+ 31 - 7
src/pages/Detail/VersionModal.js

@@ -3,15 +3,43 @@ import { Modal, Input, Form, Select } from 'antd';
 
 // 新建流程
 function VersionModal(props) {
-  const { visible, onClose, onOk, userList = [], data = {}, loading ,typeOptions} = props;
+  const {
+    visible,
+    onClose,
+    onOk,
+    userList = [],
+    data = {},
+    loading,
+    typeOptions,
+    // flowDetail,
+    // sheetRef,
+    // versionList,
+    version,
+  } = props;
   const [form] = Form.useForm();
   const formLayout = { labelCol: { span: 4 }, wrapperCol: { span: 14 } };
+  // console.log(flowDetail)
 
   const handleOk = async () => {
     let fieldsValue = await form.validateFields();
     if (!fieldsValue.classify_id) fieldsValue.classify_id = 1;
     fieldsValue.new_version = 0;
-    onOk(fieldsValue);
+
+    let params = {
+      ...fieldsValue,
+      // id: id,
+      project_id: version.project_id,
+      name: version.name,
+      guid: version.guid,
+      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,
+      base_id: version.id,
+    };
+    onOk(params);
   };
   useEffect(() => {
     if (visible) form.resetFields();
@@ -30,11 +58,7 @@ function VersionModal(props) {
           <Input />
         </Form.Item>
         <Form.Item label="分类" name="classify_id">
-          <Select
-            defaultValue={typeOptions[0]?.value || 1}
-            options={typeOptions}
-          >
-          </Select>
+          <Select defaultValue={typeOptions[0]?.value || 1} options={typeOptions}></Select>
         </Form.Item>
         <Form.Item label="详情" name="description">
           <Input.TextArea />

+ 9 - 4
src/pages/Detail/models/detail.js

@@ -74,6 +74,7 @@ export default {
       pagination: false,
     },
     comment: { list: [] },
+    commentFilter: {},
     bomComment: { list: [] },
     fileList: [],
     roleList: [],
@@ -415,16 +416,20 @@ export default {
       if (response) {
         yield put({
           type: 'save',
-          payload: { comment: response.data },
+          payload: { comment: response.data, commentFilter: payload },
         });
       }
     },
-    *addComment({ payload, callback }, { call, put }) {
-      const response = yield call(addComment, payload);
+    *addComment({ payload, callback }, { call, put, select }) {
+      const { commentFilter } = yield select(s => s.detail);
+      const response = yield call(addComment, {
+        ...commentFilter,
+        ...payload,
+      });
       if (response) {
         yield put({
           type: 'queryComment',
-          payload,
+          payload: commentFilter,
         });
         message.success('评论成功');
         callback && callback();

+ 20 - 0
src/pages/Flow/FlowDetail.json

@@ -21,6 +21,7 @@
       "x": -580,
       "y": -150,
       "zIndex": 0,
+      "muti_version": 1,
       "flow_id": 0,
       "node_type": 0,
       "count": 0,
@@ -46,6 +47,7 @@
       "x": -290,
       "y": -170,
       "zIndex": 0,
+      "muti_version": 1,
       "flow_id": 5,
       "node_type": 1,
       "count": 0,
@@ -71,6 +73,7 @@
       "x": -138,
       "y": -150,
       "zIndex": 0,
+      "muti_version": 1,
       "flow_id": 0,
       "node_type": 0,
       "count": 0,
@@ -96,6 +99,7 @@
       "x": -335,
       "y": 6,
       "zIndex": 0,
+      "muti_version": 1,
       "flow_id": 9,
       "node_type": 1,
       "count": 0,
@@ -108,6 +112,7 @@
       "label": "采购执行",
       "width": 120,
       "height": 50,
+      "is_seal": 1,
       "ports": {
         "items": [
           { "group": "top", "id": "f71ce55b" },
@@ -121,6 +126,7 @@
       "x": -138,
       "y": 26,
       "zIndex": 0,
+      "muti_version": 1,
       "flow_id": 0,
       "node_type": 0,
       "count": 0,
@@ -146,6 +152,7 @@
       "x": -580,
       "y": 26,
       "zIndex": 0,
+      "muti_version": 1,
       "flow_id": 0,
       "node_type": 0,
       "count": 0,
@@ -171,6 +178,7 @@
       "x": -305,
       "y": -304,
       "zIndex": 0,
+      "muti_version": 1,
       "flow_id": 0,
       "node_type": 0,
       "count": 0,
@@ -196,6 +204,7 @@
       "x": -138,
       "y": -304,
       "zIndex": 0,
+      "muti_version": 1,
       "flow_id": 0,
       "node_type": 0,
       "count": 0,
@@ -221,6 +230,7 @@
       "x": 356,
       "y": -324,
       "zIndex": 0,
+      "muti_version": 1,
       "flow_id": 2,
       "node_type": 1,
       "count": 0,
@@ -246,6 +256,7 @@
       "x": 446,
       "y": -150,
       "zIndex": 0,
+      "muti_version": 0,
       "flow_id": 0,
       "node_type": 0,
       "count": 0,
@@ -271,6 +282,7 @@
       "x": 621,
       "y": -150,
       "zIndex": 0,
+      "muti_version": 1,
       "flow_id": 0,
       "node_type": 0,
       "count": 0,
@@ -296,6 +308,7 @@
       "x": 446,
       "y": 26,
       "zIndex": 0,
+      "muti_version": 1,
       "flow_id": 0,
       "node_type": 0,
       "count": 0,
@@ -321,6 +334,7 @@
       "x": 308,
       "y": -170,
       "zIndex": 0,
+      "muti_version": 1,
       "flow_id": 7,
       "node_type": 1,
       "count": 0,
@@ -346,6 +360,7 @@
       "x": 173,
       "y": 6,
       "zIndex": 0,
+      "muti_version": 1,
       "flow_id": 17,
       "node_type": 1,
       "count": 0,
@@ -371,6 +386,7 @@
       "x": -425,
       "y": -224,
       "zIndex": 0,
+      "muti_version": 1,
       "flow_id": 3,
       "node_type": 1,
       "count": 0,
@@ -396,6 +412,7 @@
       "x": -425,
       "y": -115,
       "zIndex": 0,
+      "muti_version": 1,
       "flow_id": 4,
       "node_type": 1,
       "count": 0,
@@ -421,6 +438,7 @@
       "x": 27,
       "y": -224,
       "zIndex": 0,
+      "muti_version": 1,
       "flow_id": 3,
       "node_type": 1,
       "count": 0,
@@ -446,6 +464,7 @@
       "x": 27,
       "y": -115,
       "zIndex": 0,
+      "muti_version": 1,
       "flow_id": 4,
       "node_type": 1,
       "count": 0,
@@ -471,6 +490,7 @@
       "x": 173,
       "y": -170,
       "zIndex": 0,
+      "muti_version": 1,
       "flow_id": 5,
       "node_type": 1,
       "count": 0,

+ 2 - 23
src/pages/List/List.js

@@ -140,34 +140,13 @@ function List(props) {
     return !loadingVersion.effects['detail/queryComment'] && loadingVersion.models.detail;
   };
 
-  const onCommit = async (values, id, callback) => {
-    let currentNode = flowDetail.nodes.find?.(item => item.Id == version.template_node_id);
+  const onCommit = async (values,  callback) => {
     setCommitLoading(true);
     let sheets = await queryRecordSheet({ gridKey: version.id, 'JWT-TOKEN': token });
-    // 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}】只能有一个清单!`);
-    //     return;
-    //   }
-    // }
+  
     let params = {
       ...values,
-      id: id,
-      project_id: version.project_id,
-      name: version.name,
-      guid: version.guid,
-      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: sheets,
-      base_id: version.id,
     };
     dispatch({
       type: 'list/commitSheet',

+ 4 - 0
src/services/boom.js

@@ -466,3 +466,7 @@ export async function queryTrySeal(params) {
 export async function ChartTempOSSData(params) {
   return request(`/purchase/bom/contract-file/${params.projectId}`);
 }
+// 设置最终版本
+export async function setLastVersion(excelId) {
+  return request(`/purchase/bom/set-last-version/${excelId}`);
+}