浏览代码

记录审批人

Renxy 2 年之前
父节点
当前提交
abb04d0263

文件差异内容过多而无法显示
+ 0 - 0
public/Luckysheet/luckysheet.umd.js


文件差异内容过多而无法显示
+ 0 - 0
public/Luckysheet/luckysheet.umd.js.map


+ 18 - 16
src/pages/Detail/ApprovalProcess.tsx

@@ -1,4 +1,4 @@
-import React, { useState } from 'react';
+import React, { useMemo, useState } from 'react';
 
 import { queryUserListByRoleID } from '@/services/boom';
 import { connect } from 'dva';
@@ -18,21 +18,23 @@ const ApprovalProcess = props => {
   const [curNodeIdx, setCurNodeIdx] = useState(-1);
   const [loading, setLoading] = useState(false);
 
-  const list = approvalProcess[id];
-  list?.forEach(item => {
-    if (item.length > 1 && item[0].type == TYPR.USER) {
-      item.forEach(curUser => {
-        curUser.name = userList.find(user => user.ID == curUser.value)?.CName || '-';
-      });
-    } else if (item.length == 1 && item[0].type == TYPR.USER) {
-      item[0].name = userList.find(user => user.ID == item[0].value)?.CName || '-';
-    } else if (item.length == 1 && item[0].nowType == TYPR.USER) {
-      item[0].name = userList.find(user => user.ID == item[0].nowValue)?.CName || '-';
-    } else {
-      item[0].name = null;
-    }
-  });
-  console.log(list);
+  const list = useMemo(() => {
+    const newList = approvalProcess[id];
+    newList?.forEach(item => {
+      if (item.length > 1 && item[0].type == TYPR.USER) {
+        item.forEach(curUser => {
+          curUser.name = userList.find(user => user.ID == curUser.value)?.CName || '-';
+        });
+      } else if (item.length == 1 && item[0].type == TYPR.USER) {
+        item[0].name = userList.find(user => user.ID == item[0].value)?.CName || '-';
+      } else if (item.length == 1 && item[0].nowType == TYPR.USER) {
+        item[0].name = userList.find(user => user.ID == item[0].nowValue)?.CName || '-';
+      } else {
+        item[0].name = null;
+      }
+    });
+    return newList;
+  }, [approvalProcess]);
 
   const onStepsChange = async (current, list) => {
     setLoading(true);

+ 42 - 4
src/pages/Detail/CommitAuditModal.js

@@ -22,7 +22,12 @@ import { useForm } from 'rc-field-form';
 import { async } from '@antv/x6/lib/registry/marker/async';
 import AuditDetailed from './AuditDetailed';
 import AuditFlow from './AuditFlow';
-import { queryDingSchema, queryProcessFlows } from '@/services/boom';
+import {
+  queryDingSchema,
+  queryGetBomForm,
+  queryProcessFlows,
+  querySaveBomForm,
+} from '@/services/boom';
 import { Form as Form3x } from '@ant-design/compatible';
 import { getCurrentUser } from '@/utils/authority';
 import DDCode from '@/components/DDComponents/DDCode';
@@ -63,6 +68,7 @@ function CommitAuditModal(props) {
   useEffect(() => {
     if (!visible) return;
     const { edges, nodes } = flowDetail;
+    initFormList();
     let Id = version.template_node_id;
     const currentId = flowDetail.nodes.find?.(item => item.Id == Id)?.node_id;
     const data = treeData(currentId);
@@ -93,6 +99,34 @@ function CommitAuditModal(props) {
     setAuditList([]);
   }, [visible]);
 
+  const initFormList = async () => {
+    const res = await queryGetBomForm({
+      project_id: version.project_id,
+      node_id: version.template_node_id,
+    });
+    if (res.data) {
+      const formList = JSON.parse(res.data.json);
+
+      const defaultApproval = {};
+      formList.forEach(item => {
+        const curItem = JSON.parse(item);
+        const audit_list = curItem.audit_list.map(audit => {
+          return [{ type: 'user', value: audit, name: null }];
+        });
+        defaultApproval[curItem.template_node_id] = audit_list;
+      });
+      // const defaultFormData = {};
+      // formList.forEach(item => {
+      //   const curItem = JSON.parse(item);
+      //   defaultFormData[curItem.template_node_id] = curItem.formComponentValues;
+      // });
+      // console.log('========defaultApproval==============', defaultApproval);
+      // console.log('========defaultFormData==============', defaultFormData);
+      setApprovalProcess(defaultApproval);
+      // setFormComponentValues(defaultFormData);
+    }
+  };
+
   const treeData = currentId => {
     const list = getNextNodes(currentId, 'custom-circle');
     const fun = nodes => {
@@ -283,14 +317,13 @@ function CommitAuditModal(props) {
             })
             .filter(item => item);
           if (getReComputeAudit(items, changedValues)) advanceSubmit();
-          // console.log('==================================', { ...formComponentValues });
           setFormComponentValues({ ...formComponentValues });
         },
       })(AuditDetailed);
       item.FormComponents = <Components items={item.items} />;
     });
     setAuditList(addAuditList);
-    advanceSubmit();
+    if (Object.keys(approvalProcess).length == 0) advanceSubmit();
   };
 
   const getFromData = async idList => {
@@ -450,6 +483,11 @@ function CommitAuditModal(props) {
       message.error('当前存在审批节点未绑定审批流程!请联系管理员。');
       return;
     }
+    await querySaveBomForm({
+      project_id: version.project_id,
+      node_id: version.template_node_id,
+      json: JSON.stringify(formList),
+    });
     onOk(params);
   };
   const CascaderNode = index => {
@@ -511,7 +549,7 @@ function CommitAuditModal(props) {
           // rules={[{ required: true, message: '请选择业务节点' }]}
         >
           <Select style={{ width: '100%' }}>
-            {getNextNodes(data.length < 0 ? currentNodeId : auditId, 'custom-rect').map(item => (
+            {getNextNodes(auditId || currentNodeId, 'custom-rect').map(item => (
               <Option key={item.value}>{item.label}</Option>
             ))}
           </Select>

+ 3 - 3
src/pages/Detail/Index.js

@@ -1011,9 +1011,9 @@ function Detail(props) {
     dispatch({
       type: 'user/getRoleList',
     });
-    // dispatch({
-    //   type: 'user/fetch',
-    // });
+    dispatch({
+      type: 'user/fetch',
+    });
     dispatch({
       type: 'user/fetchDepV2',
     });

+ 5 - 5
src/pages/Detail/LuckySheet.js

@@ -94,13 +94,13 @@ class LuckySheet extends React.Component {
         },
         updated(operate) {
           if (operate.type == 'datachange') {
-            if(_this.currentSheetIndex != operate.sheetIndex) {
-              _this.currentSheetIndex = operate.sheetIndex
+            if (_this.currentSheetIndex != operate.sheetIndex) {
+              _this.currentSheetIndex = operate.sheetIndex;
               return;
             }
             clearTimeout(_this.updateTimer);
             _this.updateTimer = setTimeout(() => {
-              onUpdate.bind(_this)
+              onUpdate.bind(_this);
               onUpdate();
             }, 1000);
           }
@@ -130,8 +130,8 @@ 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: `ws://120.55.44.4:8896/api/v1/ws?id=${version.id}&sid=${templateId}&JWT-TOKEN=${token}`,
+        // updateUrl: `ws://${location.host}/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}`,
         getUser,
         // workbookCreateBefore(luckysheet) {

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

@@ -72,11 +72,11 @@ function List(props) {
         <Button type="primary" style={{ marginRight: 20 }} onClick={() => setVisible(true)}>
           新增工作流
         </Button>
-        {(permission['func-01-point-bom-flow'] || currentUser.IsSuper) && (
-          <Link to="/home/audit-list">
-            <Button type="primary">审批流管理</Button>
-          </Link>
-        )}
+        {/* {(permission['func-01-point-bom-flow'] || currentUser.IsSuper) && ( */}
+        <Link to="/home/audit-list">
+          <Button type="primary">审批流管理</Button>
+        </Link>
+        {/* )} */}
       </div>
 
       <Table rowKey="Id" dataSource={list} columns={columns} />

+ 14 - 1
src/services/boom.js

@@ -17,7 +17,7 @@ export async function queryRecord(params) {
 export async function queryDelSheetRecord(params) {
   const response = await request(`/purchase/bom/del-purchase-excel-sheet?${stringify(params)}`);
   if (response.code == 200) {
-    message.success('删除成功');
+    // message.success('删除成功');
   }
 }
 
@@ -441,3 +441,16 @@ export async function queryDelPurchaseExcel(params) {
   });
   return res;
 }
+//提交流转存储表单审批人历史记录
+export async function querySaveBomForm(data) {
+  return request(`/purchase/bom/save-bom-form`, {
+    method: 'POST',
+    body: data,
+  });
+}
+export async function queryGetBomForm(params) {
+  let res = await request(`/purchase/bom/get-bom-form?${stringify(params)}`, {
+    method: 'GET',
+  });
+  return res;
+}

部分文件因为文件数量过多而无法显示