Browse Source

Merge branch 'develop' of http://120.55.44.4:10080/xujunjie/WorkloadWeb into develop

xujunjie 2 years ago
parent
commit
9cd95d1818

+ 4 - 1
src/pages/PurchaseAdmin/PurchaseList/Detail/AuditFlow.js

@@ -117,6 +117,9 @@ function AuditFlow(props) {
       case 3:
         item = <Alert message="审批通过" type="success" />;
         break;
+      case -1:
+        item = <Alert message="已失效" type="error" />;
+        break;
     }
 
     return <div style={{ margin: '20px auto' }}>{item}</div>;
@@ -190,7 +193,7 @@ function AuditFlow(props) {
           ))}
           {/* <Step key={item.activityId} title={item?.activityName} description={renderDesc(item)} /> */}
         </Steps>
-        {showAduit && (
+        {showAduit && status != -1 && (
           <div className={styles.btns} style={{ marginLeft: 80 }}>
             <Button type="primary" onClick={() => onApprove(true, tasks[current].taskid)}>
               审批通过

+ 9 - 7
src/pages/PurchaseAdmin/PurchaseList/Detail/CommitAuditModal.js

@@ -346,13 +346,15 @@ function CommitAuditModal(props) {
     let data;
     try {
       data = JSON.parse(res.dentry);
-      return [{
-        spaceId: String(data.spaceId),
-        fileName: data.name,
-        fileSize: String(data.spaceId),
-        fileType: data.extension,
-        fileId: data.id,
-      }];
+      return [
+        {
+          spaceId: String(data.spaceId),
+          fileName: data.name,
+          fileSize: String(data.spaceId),
+          fileType: data.extension,
+          fileId: data.id,
+        },
+      ];
     } catch (error) {
       message.error('附件上传失败');
     }

+ 38 - 83
src/pages/PurchaseAdmin/PurchaseList/Detail/Index.js

@@ -104,6 +104,7 @@ function Detail(props) {
       data.tasks = tasks || [];
       data.cc_userids = cc_userids;
       data.formComponentValues = form_component_values?.filter(item => item.name);
+      if (version.status == 1) data.status = -1;
     }
     return data;
   }, [instanceDetail, version]);
@@ -351,8 +352,42 @@ function Detail(props) {
   };
 
   const onApprove = (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();
+      }
+    };
+
     if (!flag) {
-      setAuditVisible(true);
+      // setAuditVisible(true);
+      request();
       return;
     }
 
@@ -392,75 +427,6 @@ function Detail(props) {
         );
       }
     }
-    /*Modal.confirm({
-      title: '提示',
-      content: 
-      isSingle
-        ? `节点【${serviceNode.label}】只能拥有一个清单,是否覆盖?`
-        : `是否通过审批。`,
-      okText: '确定',
-      cancelText: '取消',
-      onOk: () => {
-        dispatch({
-          type: 'detail/approve',
-          payload: {
-            id: flow.active_id,
-            project_id: projectId,
-            audit_status: 3,
-            flow_id: flowNode.flow_id,
-            node_id: flowNode.seq,
-          },
-          callback: newVersion => {
-            // 更新flow流程图
-            dispatch({
-              type: 'xflow/queryBoomFlowDetail',
-              payload: {
-                id: templateId,
-              },
-            });
-
-            // 更新审批流
-            dispatch({
-              type: 'detail/queryAuditList',
-              payload: {
-                template_id: version.template_id,
-                template_node_id: version.template_node_id,
-                flow_id: version.flow_id,
-                version_id: version.version_id,
-              },
-            });
-            if (flow.current == flow.list.FlowNodes.length - 1) {
-              // 最后一个审核节点通过后  需要更新version id 不更不更,留在原地
-              // localStorage.excelId = newVersion.id;
-              // setVersion({
-              //   ...version,
-              //   flow_id: newVersion.flow_id,
-              //   id: newVersion.id,
-              // });
-            }
-          },
-        });
-      },
-    });*/
-
-    const callback = () => {
-      // 更新flow流程图
-      dispatch({
-        type: 'xflow/queryBoomFlowDetail',
-        payload: {
-          id: templateId,
-        },
-      });
-
-      // 更新审批流
-      dispatch({
-        type: 'detail/queryDingInstanceDetail',
-        payload: {
-          process_instance_id: version.ding_instance_id, //创建表单成功返回的id
-        },
-      });
-    };
-
     Modal.confirm({
       title: '提示',
       content: isSingle
@@ -468,19 +434,8 @@ function Detail(props) {
         : `是否通过审批。`,
       okText: '确定',
       cancelText: '取消',
-      onOk: 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();
-        }
+      onOk: () => {
+        request();
       },
     });
   };