xujunjie vor 2 Jahren
Ursprung
Commit
d16009c8db

Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
public/Luckysheet/luckysheet.umd.js


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
public/Luckysheet/luckysheet.umd.js.map


+ 4 - 4
public/luckysheet.html

@@ -7,20 +7,20 @@
     <title>Document</title>
 
    <!-- 线上发布使用路径 -->
-   <!-- <link rel="stylesheet" href="/bom/Luckysheet/plugins/css/pluginsCss.css" />
+   <link rel="stylesheet" href="/bom/Luckysheet/plugins/css/pluginsCss.css" />
    <link rel="stylesheet" href="/bom/Luckysheet/plugins/plugins.css" />
    <link rel="stylesheet" href="/bom/Luckysheet/css/luckysheet.css" />
    <link rel="stylesheet" href="/bom/Luckysheet/assets/iconfont/iconfont.css" />
    <script src="/bom/Luckysheet/plugins/js/plugin.js"></script>
-   <script src="/bom/Luckysheet/luckysheet.umd.js"></script> -->
+   <script src="/bom/Luckysheet/luckysheet.umd.js"></script>
 
    <!-- 本地开发使用路径 -->
-   <link rel='stylesheet' href='http://localhost:3000/plugins/css/pluginsCss.css' />
+   <!-- <link rel='stylesheet' href='http://localhost:3000/plugins/css/pluginsCss.css' />
    <link rel='stylesheet' href='http://localhost:3000/plugins/plugins.css' />
    <link rel='stylesheet' href='http://localhost:3000/css/luckysheet.css' />
    <link rel='stylesheet' href='http://localhost:3000/assets/iconfont/iconfont.css' />
    <script src="http://localhost:3000/plugins/js/plugin.js"></script>
-   <script src="http://localhost:3000/luckysheet.umd.js"></script>
+   <script src="http://localhost:3000/luckysheet.umd.js"></script> -->
   </head>
   <body>
     <div

+ 2 - 2
src/components/Flow/node/circle/index.tsx

@@ -18,7 +18,7 @@ export default function CustomRect(props) {
     // message.success(`${XFlowNodeCommands.SELECT_NODE.label}: 命令执行成功`);
   };
   return (
-    // <Badge count={data.versions} offset={[-10, 10]}>
+    <Badge count={data.versions} offset={[-10, 10]}>
       <div
         className="container"
         onClick={handleClick}
@@ -37,6 +37,6 @@ export default function CustomRect(props) {
       >
         <span>{label}</span>
       </div>
-    // </Badge>
+    </Badge>
   );
 }

+ 1 - 1
src/components/Flow/node/circle/mapServe.tsx

@@ -71,7 +71,7 @@ const Component = (props: any) => {
       <div className={`${PREFIX}-panel-group`}>
         <h5>数据</h5>
         <SelectField
-          label="审流程"
+          label="审流程"
           value={nodeConfig.flow_id}
           onChange={value => {
             let audit = auditList.find(item => item.list.id == value);

+ 5 - 1
src/pages/PurchaseAdmin/PurchaseList/Detail/CommitAuditModal.js

@@ -1,7 +1,7 @@
 import React, { useEffect, useState, useRef, useMemo } from 'react';
 import { Form } from '@ant-design/compatible';
 import '@ant-design/compatible/assets/index.css';
-import { Modal, Input, Select } from 'antd';
+import { Modal, Input, Select, message } from 'antd';
 import { connect } from 'dva';
 
 const { TextArea } = Input;
@@ -32,6 +32,10 @@ function CommitAuditModal(props) {
         cur_template_id: version.template_id,
         next_template_id: version.template_id,
       };
+      if (nextNode?.Id && !nextNode?.flow_id) {
+        message.error('审批节点未绑定审批流程!请联系管理员。');
+        return;
+      }
       console.log(params);
       setAuditId();
       onOk(params);

+ 36 - 5
src/pages/PurchaseAdmin/PurchaseList/Detail/CompareModal.js

@@ -1,4 +1,4 @@
-import React, { useEffect, useState, useRef } from 'react';
+import React, { useEffect, useState, useRef, useMemo } from 'react';
 import { Form } from '@ant-design/compatible';
 import '@ant-design/compatible/assets/index.css';
 import { Modal, Checkbox, Row, Col, message, Tabs } from 'antd';
@@ -8,7 +8,7 @@ const { TabPane } = Tabs;
 
 // 选择比对版本
 function CompareModal(props) {
-  const { visible, versionList, onClose, onOk, dispatch, version } = props;
+  const { visible, versionList, onClose, onOk, dispatch, version, flowDetail } = props;
 
   const [checkValue, setCheckValue] = useState([]);
 
@@ -37,6 +37,22 @@ function CompareModal(props) {
     }
   };
 
+  const tabList = useMemo(() => {
+    let list = {};
+    versionList.forEach(version => {
+      let nodeId = version.template_node_id;
+      if (!nodeId || nodeId === '0') return;
+      if (!list[nodeId]) {
+        list[nodeId] = [];
+      }
+      list[nodeId].push(version);
+    });
+    return Object.keys(list).map(nodeId => ({
+      name: flowDetail.nodes.find(node => node.Id == nodeId)?.label,
+      id: nodeId,
+      list: list[nodeId],
+    }));
+  }, [versionList, flowDetail]);
 
   return (
     <Modal
@@ -44,20 +60,35 @@ function CompareModal(props) {
       visible={visible}
       onCancel={onClose}
       onOk={handleOk}
+      bodyStyle={{ paddingTop: 0 }}
     >
       <Checkbox.Group value={checkValue} style={{ width: '100%' }} onChange={onChange}>
-        <Row gutter={16}>
+        {/* <Row gutter={16}>
           {versionList.map(version => (
             <Col span={8} key={version.id}>
               <Checkbox value={version.id}>{version.version_name}</Checkbox>
             </Col>
           ))}
-        </Row>
+        </Row> */}
+        <Tabs>
+          {tabList.map(tab => (
+            <TabPane tab={tab.name} key={tab.id}>
+              <Row>
+                {tab.list.map(version => (
+                  <Col span={8} key={version.id}>
+                    <Checkbox value={version.id}>{version.version_name}</Checkbox>
+                  </Col>
+                ))}
+              </Row>
+            </TabPane>
+          ))}
+        </Tabs>
       </Checkbox.Group>
     </Modal>
   );
 }
 
-export default connect(({ detail }) => ({
+export default connect(({ detail, xflow }) => ({
   versionList: detail.versionList,
+  flowDetail: xflow.flowDetail,
 }))(CompareModal);

+ 47 - 37
src/pages/PurchaseAdmin/PurchaseList/Detail/FlowModal.js

@@ -1,5 +1,5 @@
 import React, { useEffect, useState, useRef, useMemo } from 'react';
-import { Modal, Input, Select, List } from 'antd';
+import { Modal, Input, Select, List, Row, Col } from 'antd';
 import Flow from '@/components/Flow/index';
 import { connect } from 'dva';
 import { GetTokenFromUrl, getToken } from '@/utils/utils';
@@ -36,7 +36,12 @@ function FlowModal(props) {
     // setData(node.version);
     let res = await queryVserionByNode({ template_node_id: node.Id });
     console.log(res);
-    setData(res.data.excel_version)
+    let data = []
+    Object.values(res.data.excel_version).map(arr => {
+      data = [...data,arr[arr.length - 1]]
+    })
+    console.log(data)
+    setData(data);
   };
 
   return (
@@ -47,42 +52,47 @@ function FlowModal(props) {
       visible={visible}
       onCancel={onClose}
       footer={false}
-      width="80%"
+      width="98%"
     >
-      <Flow meta={{ type: 'view' }} flowDetail={graphData} onSelectNode={handleSelectNode} />
-      <List
-        size="small"
-        header={<div>版本列表</div>}
-        bordered
-        dataSource={data}
-        style={{ marginTop: 20 }}
-        renderItem={item => {
-          const isCurrent = item.id == version.id;
-          return (
-            <List.Item
-              actions={
-                isCurrent
-                  ? null
-                  : [
-                      <a
-                        onClick={() => {
-                          onChangeVersion(item);
-                          onClose();
-                        }}
-                      >
-                        切换
-                      </a>,
-                    ]
-              }
-            >
-              <div style={{ color: isCurrent ? '#1890ff' : '' }}>
-                {isCurrent && <StarOutlined />}
-                {item.version_name}
-              </div>
-            </List.Item>
-          );
-        }}
-      />
+      <Row gutter={8}>
+        <Col span={18}>
+          <Flow meta={{ type: 'view' }} flowDetail={graphData} onSelectNode={handleSelectNode} />
+        </Col>
+        <Col span={6}>
+          <List
+            size="small"
+            header={<div>版本列表</div>}
+            bordered
+            dataSource={data}
+            renderItem={item => {
+              const isCurrent = item.id == version.id;
+              return (
+                <List.Item
+                  actions={
+                    isCurrent
+                      ? null
+                      : [
+                          <a
+                            onClick={() => {
+                              onChangeVersion(item);
+                              onClose();
+                            }}
+                          >
+                            切换
+                          </a>,
+                        ]
+                  }
+                >
+                  <div style={{ color: isCurrent ? '#1890ff' : '' }}>
+                    {isCurrent && <StarOutlined />}
+                    {item.version_name}
+                  </div>
+                </List.Item>
+              );
+            }}
+          />
+        </Col>
+      </Row>
     </Modal>
   );
 }

+ 28 - 18
src/pages/PurchaseAdmin/PurchaseList/Detail/Index.js

@@ -624,8 +624,8 @@ function Detail(props) {
       <Menu.Item key="back">返回</Menu.Item>,
       <Menu.Item key="bomDetail">详情</Menu.Item>,
       <Menu.Item key="export">导出</Menu.Item>,
-      <Menu.Item key="commitAudit">提交流转</Menu.Item>,
-      <Menu.Item key="flow">查看流程</Menu.Item>,
+      version.flow_id ? null : <Menu.Item key="commitAudit">提交流转</Menu.Item>,
+      // <Menu.Item key="flow">查看流程</Menu.Item>,
       <Menu.Item key="compare">比对</Menu.Item>,
       <Menu.Item key="attachment">附件</Menu.Item>,
     ];
@@ -633,7 +633,7 @@ function Detail(props) {
     //   menuList.push(<Menu.Item key="version">历史提交</Menu.Item>);
     //   // menuList.push(<Menu.Item key="template">模板</Menu.Item>);
     // }
-    if (!isAuditor && canEdit()) {
+    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>);
@@ -798,9 +798,15 @@ function Detail(props) {
   };
 
   const changeVersion = id => {
-    let version = versionList.find(item => item.id == id);
-    if (!version) return;
-    localStorage.excelId = id;
+    let version;
+    if (typeof id == 'object') {
+      version = id;
+      localStorage.excelId = version.id;
+    } else {
+      version = versionList.find(item => item.id == id);
+      if (!version) return;
+      localStorage.excelId = id;
+    }
     setVersion(version);
 
     // 查询excel内容
@@ -834,7 +840,7 @@ function Detail(props) {
           template_id: version.template_id,
           template_node_id: version.template_node_id,
           flow_id: version.flow_id,
-          version_id: version.id,
+          version_id: version.version_id,
         },
       });
     }
@@ -844,7 +850,7 @@ function Detail(props) {
     dispatch({
       type: 'detail/submitNextNode',
       payload: values,
-      callback: (newVersion) => {
+      callback: newVersion => {
         setCommitAuditVisible(false);
         // 更新version
         localStorage.excelId = newVersion.id;
@@ -981,7 +987,7 @@ function Detail(props) {
           {/* 当前节点: {version.template_node_id}
           <br />
           当前状态:{version.audit_status} */}
-          <Select
+          {/* <Select
             style={{ width: 140, marginLeft: 10 }}
             value={version.id}
             onChange={changeVersion}
@@ -991,14 +997,18 @@ function Detail(props) {
                 {item.version_name}
               </Option>
             ))}
-          </Select>
-          {flow?.active == 0 && (
-            <Button
-              type="primary"
-              icon={<PlusOutlined />}
-              onClick={() => setVersionVisible(true)}
-            ></Button>
-          )}
+          </Select> */}
+          {/* {flow?.active == 0 && ( */}
+          <Button type="primary" onClick={() => setFlowVisible(true)}>
+            查看流程
+          </Button>
+          <Button
+            type="primary"
+            icon={<PlusOutlined onClick={() => setVersionVisible(true)} />}
+            onClick={() => setVersionVisible(true)}
+          ></Button>
+
+          {/* )} */}
           <span style={{ marginLeft: 20 }}>{renderNode()}</span>
         </div>
         <div className={styles.btns}>
@@ -1096,7 +1106,7 @@ function Detail(props) {
         onClose={() => setFlowVisible(false)}
         version={version}
         // onOk={onCommit}
-        onChangeVersion={version => changeVersion(version.id)}
+        onChangeVersion={version => changeVersion(version)}
       />
       <AuditModal
         loading={getLoading()}

+ 12 - 1
src/pages/PurchaseAdmin/PurchaseList/Detail/LuckySheet.js

@@ -100,7 +100,7 @@ class LuckySheet extends React.Component {
         allowUpdate: true,
         gridKey: version.id,
         templateId: templateId,
-        flowId: version.flow_id,
+        // flowId: version.flow_id,
         loadUrl: `/api/v1/purchase/record/sheet?gridKey=${version.id}&JWT-TOKEN=${token}`,
         updateUrl: `ws://47.96.12.136: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}`,
@@ -116,6 +116,17 @@ class LuckySheet extends React.Component {
         //   }, 300);
         // },
       };
+      if(version.flow_id) {
+        option.authority = {
+          sheet: true,
+          hintText: '当前处于审批节点,禁止编辑!'
+        }
+      } else if(version.audit_status == 4) {
+        option.authority = {
+          sheet: true,
+          hintText: '当前版本为历史版本,不可编辑!'
+        }
+      }
     } else if (data && data.length > 0) {
       option.data = JSON.parse(JSON.stringify(data));
 

+ 53 - 43
src/pages/PurchaseAdmin/PurchaseList/Flow/Audit.js

@@ -9,7 +9,7 @@ import router from 'umi/router';
 const { Option } = Select;
 
 function Audit(props) {
-  const { userList, currentItem, dispatch } = props;
+  const { roleList, currentItem, dispatch } = props;
   const [visible, setVisible] = useState({
     audit: false,
     auditNode: false,
@@ -19,19 +19,23 @@ function Audit(props) {
   const columns = [
     {
       title: '节点名',
+      width: "20%",
       dataIndex: 'node',
     },
     {
       title: '审批级别',
       dataIndex: 'seq',
+      width: "20%",
     },
     {
-      title: '审批',
+      title: '审批角色',
       dataIndex: 'auditor',
-      render: auditor => userList.find(item => item.ID == auditor)?.CName,
+      width: "20%",
+      render: auditor => roleList.find(item => item.ID == auditor)?.Name,
     },
     {
       title: '审批关系',
+      width: "20%",
       dataIndex: 'seq_relate',
       render: relate => {
         switch (relate) {
@@ -46,7 +50,8 @@ function Audit(props) {
     },
     {
       title: '操作',
-      render: (item, index) => (
+      width: "20%",
+      render: item => (
         <>
           <a
             onClick={() => {
@@ -59,7 +64,7 @@ function Audit(props) {
           <Divider type="vertical" />
           <a
             onClick={() => {
-              handleDelete(index);
+              handleDelete(item);
             }}
           >
             删除
@@ -106,8 +111,9 @@ function Audit(props) {
       });
     }
   };
-  const handleDelete = index => {
+  const handleDelete = item => {
     let newNodes = [...current.FlowNodes];
+    let index = newNodes.indexOf(item);
     newNodes.splice(index, 1);
     setCurrent({
       ...current,
@@ -134,9 +140,6 @@ function Audit(props) {
         flowId: current.id,
         nodes: nodes,
       },
-      callback: () => {
-        router.go(-1);
-      },
     });
   };
   // const handleSelect = id => {
@@ -153,40 +156,47 @@ function Audit(props) {
     });
   };
 
+  // const renderTitle = () => {
+  //   return (
+  //     <div className={styles.box}>
+  //       <span>审批详情</span>
+  //       {current?.id && (
+  //         <div className={styles.btns}>
+  //           {/* <Button onClick={onCancel}>取消</Button> */}
+  //           <Button onClick={onSave} type="primary">
+  //             保存
+  //           </Button>
+  //           <Button
+  //             onClick={() => {
+  //               setCurrentNode({});
+  //               changeVisible('auditNode', true);
+  //             }}
+  //             type="primary"
+  //           >
+  //             添加节点
+  //           </Button>
+  //         </div>
+  //       )}
+  //     </div>
+  //   );
+  // };
+
   useEffect(() => {
-    dispatch({
-      type: 'user/fetch',
-    });
-    dispatch({
-      type: 'flow/queryAuditList',
-    });
+    if (!current.id) {
+      router.go(-1);
+    } else {
+      dispatch({
+        type: 'user/fetch',
+      });
+      dispatch({
+        type: 'flow/queryAuditList',
+      });
+      dispatch({
+        type: 'flow/getRoleList',
+      });
+    }
   }, []);
 
-  const renderTitle = () => {
-    return (
-      <div className={styles.box}>
-        <span>审批详情</span>
-        {current?.id && (
-          <div className={styles.btns}>
-            {/* <Button onClick={onCancel}>取消</Button> */}
-            <Button onClick={onSave} type="primary">
-              保存
-            </Button>
-            <Button
-              onClick={() => {
-                setCurrentNode({});
-                changeVisible('auditNode', true);
-              }}
-              type="primary"
-            >
-              添加节点
-            </Button>
-          </div>
-        )}
-      </div>
-    );
-  };
-  console.log(current);
   return (
     <div>
       <div className={styles.btns}>
@@ -213,7 +223,7 @@ function Audit(props) {
         onCancel={() => changeVisible('audit', false)}
       /> */}
       <AuditNodeModal
-        userList={userList}
+        roleList={roleList}
         data={currentNode}
         visible={visible.auditNode}
         onOk={handleAuditNodeOk}
@@ -222,8 +232,8 @@ function Audit(props) {
     </div>
   );
 }
-export default connect(({ user, flow, loading }) => ({
-  userList: user.list,
+export default connect(({ flow, loading }) => ({
+  roleList: flow.roleList,
   currentItem: flow.current,
   loading: loading.models.purchaseList2,
 }))(Audit);

+ 8 - 7
src/pages/PurchaseAdmin/PurchaseList/Flow/AuditNodeModal.js

@@ -4,7 +4,7 @@ const { Option } = Select;
 
 // 审批意见
 function AuditModal(props) {
-  const { visible, onCancel, onOk, userList = [], data = {}, loading } = props;
+  const { visible, onCancel, onOk, roleList = [], data = {}, loading } = props;
   const [form] = Form.useForm();
   const formLayout = { labelCol: { span: 4 }, wrapperCol: { span: 14 } };
 
@@ -34,17 +34,18 @@ function AuditModal(props) {
         <Form.Item label="审批级别" name="seq">
           <InputNumber style={{ width: '100%' }} step={1} min={1} />
         </Form.Item>
-        <Form.Item label="审批" name="auditor">
+        <Form.Item label="审批角色" name="auditor">
           <Select
             showSearch
             style={{ width: '100%' }}
             filterOption={(input, option) => option.props.children.indexOf(input) >= 0}
           >
-            {userList.map(item => (
-              <Option key={item.ID} value={item.ID}>
-                {item.CName}
-              </Option>
-            ))}
+            {roleList &&
+              roleList.map(item => (
+                <Option key={item.ID} value={item.ID + ''}>
+                  {item.Name}
+                </Option>
+              ))}
           </Select>
         </Form.Item>
         <Form.Item initialValue={data?.seq_relate || 1} label="审批关系" name="seq_relate">

+ 5 - 5
src/pages/PurchaseAdmin/PurchaseList/Flow/List.js

@@ -12,7 +12,7 @@ function List(props) {
   const [visible, setVisible] = useState(false);
   const columns = [
     {
-      title: '工作流',
+      title: '流程名称',
       dataIndex: 'Name',
     },
     {
@@ -52,12 +52,12 @@ function List(props) {
   return (
     <div>
       <div style={{ marginBottom: 20 }}>
-        <Link to="/home/audit-list" style={{ marginRight: 20 }}>
-          <Button>审批流管理</Button>
-        </Link>
-        <Button type="primary" onClick={() => setVisible(true)}>
+        <Button type="primary" style={{ marginRight: 20 }} onClick={() => setVisible(true)}>
           新增工作流
         </Button>
+        <Link to="/home/audit-list">
+          <Button type="primary">审批流管理</Button>
+        </Link>
       </div>
 
       <Table rowKey="Id" dataSource={list} columns={columns} />

+ 12 - 1
src/pages/PurchaseAdmin/PurchaseList/Flow/models/flow.js

@@ -7,6 +7,7 @@ import {
   updateNode,
   queryFlowList,
 } from '@/services/boom';
+import { queryRole } from '@/services/SysAdmin';
 import { queryProject } from '@/services/PurchaseList';
 import { message } from 'antd';
 
@@ -17,7 +18,8 @@ export default {
     auditList: [],
     flowList: [],
     projectList: [],
-    current: {}
+    current: {},
+    roleList: [],
   },
 
   effects: {
@@ -31,6 +33,15 @@ export default {
         });
       }
     },
+    *getRoleList({ payload }, { call, put }) {
+      const response = yield call(queryRole, payload);
+      if (response) {
+        yield put({
+          type: 'save',
+          payload: { roleList: response.data.list },
+        });
+      }
+    },
     *queryBoomFlowDetail({ payload }, { call, put }) {
       const data = yield call(queryBoomFlowDetail, payload);
       console.log(data);

+ 1 - 1
src/pages/PurchaseAdmin/PurchaseList/List/List.js

@@ -17,7 +17,7 @@ function List(props) {
   const [nodeVisible, setNodeVisible] = useState(false);
   const columns = [
     {
-      title: '名称',
+      title: '流程名称',
       dataIndex: 'name',
     },
     {

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.