xujunjie %!s(int64=2) %!d(string=hai) anos
pai
achega
0d54b36e86

+ 4 - 0
config/router.config.js

@@ -56,6 +56,10 @@ export default [
             path: '/home/audit',
             component: './PurchaseAdmin/PurchaseList/Flow/Audit',
           },
+          {
+            path: '/home/audit-list',
+            component: './PurchaseAdmin/PurchaseList/Flow/AuditList',
+          },
           {
             path: '/home/flow-list',
             component: './PurchaseAdmin/PurchaseList/Flow/List',

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
public/Luckysheet/luckysheet.umd.js


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
public/Luckysheet/luckysheet.umd.js.map


+ 1 - 0
src/components/Flow/node/rect/mapServe.tsx

@@ -163,6 +163,7 @@ const Component = (props: any) => {
               onChange={url => onNodeConfigChange('bom_template', url)}
               beforeUpload={beforeUpload}
             />
+            <div>{nodeConfig.excel_info?.file_name}</div>
           </>
         )}
       </div>

+ 29 - 25
src/pages/PurchaseAdmin/PurchaseList/Detail/Index.js

@@ -27,7 +27,6 @@ const { Option } = Select;
 
 function Detail(props) {
   const {
-    // flow,
     dispatch,
     comment,
     history,
@@ -152,20 +151,16 @@ function Detail(props) {
   const onCompare = async checkSheets => {
     if (checkSheets) {
       const [sheet1, sheet2] = checkSheets;
-      if (!sheet1.data) {
-        sheet1.data = (
-          await queryDetail({
-            excel_id: sheet1.id,
-          })
-        ).data;
-      }
-      if (!sheet2.data) {
-        sheet2.data = (
-          await queryDetail({
-            excel_id: sheet2.id,
-          })
-        ).data;
-      }
+      sheet1.data = (
+        await queryDetail({
+          excel_id: sheet1.id,
+        })
+      ).data;
+      sheet2.data = (
+        await queryDetail({
+          excel_id: sheet2.id,
+        })
+      ).data;
 
       setCompareList(checkSheets);
       statusRef.current.compare = true;
@@ -206,10 +201,7 @@ function Detail(props) {
   const renderSheetDom = (item, index) => {
     return (
       <div key={item?.id || 'temp'} className={styles.sheetItem}>
-        <h3>
-          {item?.name}
-          {item.version_name && `(${item.version_name})`}
-        </h3>
+        <h3>{item.version_name || item?.name}</h3>
         <LuckySheet
           className={styles.sheet}
           ref={!index ? sheetRef3 : sheetRef2}
@@ -276,11 +268,19 @@ function Detail(props) {
         // setSheet(sheets);
 
         // localStorage.luckysheet = JSON.stringify(sheets);
+        // 更新flow流程图
+        dispatch({
+          type: 'xflow/queryBoomFlowDetail',
+          payload: {
+            id: templateId,
+          },
+        });
       },
     });
   };
 
   const onUpdate = () => {
+    if (flow.active != 0) return;
     let currentData = sheetRef.current.getSheetJson().data;
     let sheets = JSON.parse(JSON.stringify(currentData));
     sheets.forEach(item => {
@@ -411,6 +411,7 @@ function Detail(props) {
               localStorage.excelId = newVersion.id;
               setVersion({
                 ...version,
+                flow_id: newVersion.flow_id,
                 id: newVersion.id,
               });
             }
@@ -845,6 +846,13 @@ function Detail(props) {
       payload: values,
       callback: () => {
         setCommitAuditVisible(false);
+        // 更新flow流程图
+        dispatch({
+          type: 'xflow/queryBoomFlowDetail',
+          payload: {
+            id: templateId,
+          },
+        });
       },
     });
   };
@@ -886,7 +894,7 @@ function Detail(props) {
       },
     });
     dispatch({
-      type: 'user/fetchUserList',
+      type: 'user/fetch',
     });
     // 审批流程
     // dispatch({
@@ -989,10 +997,7 @@ function Detail(props) {
         <div className={styles.btns}>
           <Avatar.Group style={{ marginRight: 20 }}>
             {user.map(item => (
-              <Avatar
-                // style={{ backgroundColor: item.id == currentUser.ID ? '#008dff' : '' }}
-                size="large"
-              >
+              <Avatar style={{ backgroundColor: '#008dff' }} size="large">
                 {item.Name}
               </Avatar>
             ))}
@@ -1119,7 +1124,6 @@ function Detail(props) {
 }
 
 export default connect(({ detail, user, xflow, loading }) => ({
-  flow: detail.flow,
   flowDetail: xflow.flowDetail,
   auditList: detail.auditList,
   fileList: detail.fileList,

+ 8 - 5
src/pages/PurchaseAdmin/PurchaseList/Detail/LuckySheet.js

@@ -24,8 +24,10 @@ class LuckySheet extends React.Component {
     this.luckysheet?.destroy();
   }
   componentDidUpdate(prveProps) {
-    if (prveProps.version?.id != this.props.version?.id) {
-      console.log(prveProps.version);
+    const prevVersion = prveProps.version || {};
+    const curVersion = this.props.version || {};
+    if (prevVersion?.id != curVersion?.id || prevVersion?.flow_id != curVersion.flow_id) {
+      console.log(prevVersion, curVersion);
       this.renderSheet();
     }
   }
@@ -98,6 +100,7 @@ class LuckySheet extends React.Component {
         allowUpdate: true,
         gridKey: version.id,
         templateId: templateId,
+        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}`,
@@ -154,7 +157,7 @@ class LuckySheet extends React.Component {
     this.luckysheet = contentWindow.luckysheet;
     // this.luckysheet = this.luckysheet;
     // version存在  则需调用render
-    if(version) {
+    if (version) {
       this.renderSheet();
     }
     // onLoad && onLoad();
@@ -309,8 +312,8 @@ class LuckySheet extends React.Component {
       }
     });
     currentData.forEach(sheet => {
-      delete sheet.data
-    })
+      delete sheet.data;
+    });
     this.renderSheet(currentData);
     // currentData.data.forEach((sheet, index) => {
     //   if (!mergeData[index]) return;

+ 5 - 4
src/pages/PurchaseAdmin/PurchaseList/Detail/RightDrawer.js

@@ -47,12 +47,12 @@ function RightDrawer(props) {
   };
 
   useEffect(() => {
-    if (!version.id) return;
+    if (!version.id || !visible) return;
     dispatch({
       type: 'detail/queryBomComment',
       payload: { excel_id: version.id },
     });
-  }, [version.id]);
+  }, [version.id,visible]);
 
   return (
     <Drawer
@@ -78,12 +78,13 @@ function RightDrawer(props) {
 }
 function BomContetn(props) {
   const { version, userList } = props;
+  console.log(userList)
   return (
     <Card title="版本详情" type="inner">
       <Descriptions column={2}>
         <Descriptions.Item label="版本名称">{version.version_name}</Descriptions.Item>
         <Descriptions.Item label="创建人">
-          {userList.find(item => item.Id == version.author)?.Name}
+          {userList.find(item => item.ID == version.author)?.CName}
         </Descriptions.Item>
         <Descriptions.Item label="创建时间">
           {moment(version.c_time).format('YYYY-MM-DD')}
@@ -96,7 +97,7 @@ function BomContetn(props) {
 
 export default connect(({ detail, user, loading }) => ({
   comment: detail.comment,
-  userList: user.userList,
+  userList: user.list,
   bomComment: detail.bomComment,
   loading: loading,
 }))(RightDrawer);

+ 56 - 51
src/pages/PurchaseAdmin/PurchaseList/Flow/Audit.js

@@ -9,13 +9,12 @@ import router from 'umi/router';
 const { Option } = Select;
 
 function Audit(props) {
-  const { userList, list = [], dispatch } = props;
-  const [form] = Form.useForm();
+  const { userList, currentItem, dispatch } = props;
   const [visible, setVisible] = useState({
     audit: false,
     auditNode: false,
   });
-  const [current, setCurrent] = useState({});
+  const [current, setCurrent] = useState({ ...currentItem });
   const [currentNode, setCurrentNode] = useState({});
   const columns = [
     {
@@ -28,7 +27,8 @@ function Audit(props) {
     },
     {
       title: '审批人',
-      dataIndex: ['AuditorUser', 'CName'],
+      dataIndex: 'auditor',
+      render: auditor => userList.find(item => item.ID == auditor)?.CName,
     },
     {
       title: '审批关系',
@@ -68,16 +68,16 @@ function Audit(props) {
       ),
     },
   ];
-  const handleAuditOk = values => {
-    console.log(values);
-    dispatch({
-      type: 'flow/addAudit',
-      payload: values,
-      callback: () => {
-        changeVisible('audit', false);
-      },
-    });
-  };
+  // const handleAuditOk = values => {
+  //   console.log(values);
+  //   dispatch({
+  //     type: 'flow/addAudit',
+  //     payload: values,
+  //     callback: () => {
+  //       changeVisible('audit', false);
+  //     },
+  //   });
+  // };
   const handleAuditNodeOk = values => {
     console.log(values);
     let FlowNodes = current.FlowNodes;
@@ -87,6 +87,14 @@ function Audit(props) {
       let index = FlowNodes.findIndex(item => item.id == currentNode.id);
       let newNodes = [...FlowNodes];
       newNodes[index] = values;
+      // 将同审批级别的审批关系设置为相同
+      newNodes.forEach(item => {
+        if (item.seq == values.seq) {
+          item.seq_relate = values.seq_relate;
+        }
+      });
+      // 排序
+      newNodes.sort((a, b) => a.seq - b.seq);
       setCurrent({
         ...current,
         FlowNodes: newNodes,
@@ -106,10 +114,10 @@ function Audit(props) {
       FlowNodes: newNodes,
     });
   };
-  const onCancel = () => {
-    form.resetFields();
-    setCurrent({});
-  };
+  // const onCancel = () => {
+  //   form.resetFields();
+  //   setCurrent({});
+  // };
   const onSave = () => {
     const nodes = current.FlowNodes.map(item => ({
       flow_id: current.id,
@@ -126,15 +134,18 @@ function Audit(props) {
         flowId: current.id,
         nodes: nodes,
       },
+      callback: () => {
+        router.go(-1);
+      },
     });
   };
-  const handleSelect = id => {
-    const item = list.find(item => item.list?.id == id);
-    console.log(item);
-    setCurrent({
-      ...item.list,
-    });
-  };
+  // const handleSelect = id => {
+  //   const item = list.find(item => item.list?.id == id);
+  //   console.log(item);
+  //   setCurrent({
+  //     ...item.list,
+  //   });
+  // };
   const changeVisible = (type, visible) => {
     setVisible({
       ...visible,
@@ -157,7 +168,7 @@ function Audit(props) {
         <span>审批详情</span>
         {current?.id && (
           <div className={styles.btns}>
-            <Button onClick={onCancel}>取消</Button>
+            {/* <Button onClick={onCancel}>取消</Button> */}
             <Button onClick={onSave} type="primary">
               保存
             </Button>
@@ -175,38 +186,32 @@ function Audit(props) {
       </div>
     );
   };
-
+  console.log(current);
   return (
     <div>
-      <div className={styles.box}>
+      <div className={styles.btns}>
         <Button onClick={() => router.go(-1)}>返回</Button>
-        <Form layout="inline" name="basic" autoComplete="off" form={form}>
-          <Form.Item label="审批流程" name="flowId">
-            <Select onChange={handleSelect} style={{ minWidth: 180 }}>
-              {list.map(item => (
-                <Option key={item.list.id}>{item.list.name || item.list.id}</Option>
-              ))}
-            </Select>
-          </Form.Item>
-          <Form.Item>
-            <Button onClick={() => changeVisible('audit', true)} type="primary">
-              新建流程
-            </Button>
-          </Form.Item>
-        </Form>
+        {/* <Button onClick={onCancel}>取消</Button> */}
+        <Button onClick={onSave} type="primary">
+          保存
+        </Button>
+        <Button
+          onClick={() => {
+            setCurrentNode({});
+            changeVisible('auditNode', true);
+          }}
+          type="primary"
+        >
+          添加节点
+        </Button>
       </div>
 
-      <Table
-        rowKey="id"
-        title={renderTitle}
-        dataSource={current?.FlowNodes || []}
-        columns={columns}
-      />
-      <AuditModal
+      <Table rowKey="id" dataSource={current?.FlowNodes || []} columns={columns} />
+      {/* <AuditModal
         visible={visible.audit}
         onOk={handleAuditOk}
         onCancel={() => changeVisible('audit', false)}
-      />
+      /> */}
       <AuditNodeModal
         userList={userList}
         data={currentNode}
@@ -219,6 +224,6 @@ function Audit(props) {
 }
 export default connect(({ user, flow, loading }) => ({
   userList: user.list,
-  list: flow.auditList,
+  currentItem: flow.current,
   loading: loading.models.purchaseList2,
 }))(Audit);

+ 3 - 2
src/pages/PurchaseAdmin/PurchaseList/Flow/Audit.less

@@ -1,5 +1,5 @@
 .box {
-  margin-bottom: 20;
+  margin-bottom: 20px;
   display: flex;
   justify-content: space-between;
   align-items: center;
@@ -7,9 +7,10 @@
 .btns {
   display: flex;
   align-items: center;
+  margin-bottom: 20px;
   :global {
     .ant-btn {
-      margin-left: 20px;
+      margin-right: 20px;
     }
   }
 }

+ 100 - 0
src/pages/PurchaseAdmin/PurchaseList/Flow/AuditList.js

@@ -0,0 +1,100 @@
+import React, { useState, useEffect } from 'react';
+import { Form, Select, Button, Table, Input, Checkbox, Divider } from 'antd';
+import { connect } from 'dva';
+import AuditNodeModal from './AuditNodeModal';
+import AuditModal from './AuditModal';
+import styles from './Audit.less';
+import router from 'umi/router';
+
+const { Option } = Select;
+
+function Audit(props) {
+  const { userList, list = [], dispatch } = props;
+  const [form] = Form.useForm();
+  const [visible, setVisible] = useState({
+    audit: false,
+    auditNode: false,
+  });
+  const columns = [
+    {
+      title: '审批流名称',
+      dataIndex: ['list','name'],
+    },
+    {
+      title: '操作',
+      render: (item, index) => (
+        <>
+          <a
+            onClick={() => {
+              setCurrentNode(item);
+            }}
+          >
+            编辑
+          </a>
+        </>
+      ),
+    },
+  ];
+  const handleAuditOk = values => {
+    console.log(values);
+    dispatch({
+      type: 'flow/addAudit',
+      payload: values,
+      callback: () => {
+        changeVisible('audit', false);
+      },
+    });
+  };
+  const changeVisible = (type, visible) => {
+    setVisible({
+      ...visible,
+      [type]: visible,
+    });
+  };
+  const setCurrentNode = (item) => {
+    dispatch({
+      type: 'flow/save',
+      payload: {
+        current: item.list,
+      }
+    })
+    router.push("/home/audit")
+  }
+
+  useEffect(() => {
+    dispatch({
+      type: 'flow/queryAuditList',
+    });
+  }, []);
+
+  return (
+    <div>
+      <div className={styles.box}>
+        <Button onClick={() => router.go(-1)}>返回</Button>
+        <Form layout="inline" name="basic" autoComplete="off" form={form}>
+          <Form.Item>
+            <Button onClick={() => changeVisible('audit', true)} type="primary">
+              新建流程
+            </Button>
+          </Form.Item>
+        </Form>
+      </div>
+
+      <Table
+        rowKey="id"
+        dataSource={list}
+        columns={columns}
+      />
+      <AuditModal
+        visible={visible.audit}
+        onOk={handleAuditOk}
+        onCancel={() => changeVisible('audit', false)}
+      />
+    </div>
+  );
+}
+export default connect(({ user, flow, loading }) => ({
+  userList: user.list,
+  list: flow.auditList,
+  loading: loading.models.purchaseList2,
+}))(Audit);

+ 3 - 14
src/pages/PurchaseAdmin/PurchaseList/Flow/AuditNodeModal.js

@@ -1,5 +1,5 @@
 import React, { useEffect } from 'react';
-import { Modal, Input, Table, Select, Form, Radio } from 'antd';
+import { InputNumber, Modal, Input, Table, Select, Form, Radio } from 'antd';
 const { Option } = Select;
 
 // 审批意见
@@ -10,11 +10,6 @@ function AuditModal(props) {
 
   const handleOk = async () => {
     let fieldsValue = await form.validateFields();
-    const { label, value } = fieldsValue.auditUser;
-    fieldsValue.AuditorUser = {
-      CName: label,
-    };
-    fieldsValue.auditor = value;
     // 如果id不存在则使用时间戳作为id
     fieldsValue.id = data?.id || new Date() * 1;
     onOk(fieldsValue);
@@ -37,17 +32,11 @@ function AuditModal(props) {
           <Input />
         </Form.Item>
         <Form.Item label="审批级别" name="seq">
-          <Select style={{ width: '100%' }}>
-            <Option value={1}>一级</Option>
-            <Option value={2}>二级</Option>
-            <Option value={3}>三级</Option>
-            {/* <Option value={1}>流程1</Option> */}
-          </Select>
+          <InputNumber style={{ width: '100%' }} step={1} min={1} />
         </Form.Item>
-        <Form.Item label="审批人" initialValue={data?.auditor} name="auditUser">
+        <Form.Item label="审批人" name="auditor">
           <Select
             showSearch
-            labelInValue
             style={{ width: '100%' }}
             filterOption={(input, option) => option.props.children.indexOf(input) >= 0}
           >

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

@@ -52,7 +52,7 @@ function List(props) {
   return (
     <div>
       <div style={{ marginBottom: 20 }}>
-        <Link to="/home/audit" style={{ marginRight: 20 }}>
+        <Link to="/home/audit-list" style={{ marginRight: 20 }}>
           <Button>审批流管理</Button>
         </Link>
         <Button type="primary" onClick={() => setVisible(true)}>

+ 2 - 5
src/pages/PurchaseAdmin/PurchaseList/Flow/models/flow.js

@@ -17,6 +17,7 @@ export default {
     auditList: [],
     flowList: [],
     projectList: [],
+    current: {}
   },
 
   effects: {
@@ -84,12 +85,8 @@ export default {
     *addAuditNode({ payload, callback }, { call, put }) {
       const response = yield call(addAuditNode, payload);
       if (response) {
-        message.success('新增成功');
+        message.success('操作成功');
         callback && callback();
-        yield put({
-          type: 'queryAuditList',
-          payload: {},
-        });
       }
     },
   },

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio