Przeglądaj źródła

OA审批流程修复

XuZinan 2 lat temu
rodzic
commit
14aca2a9cf

+ 3 - 1
src/components/DDComponents/DepartmentField/index.js

@@ -3,7 +3,7 @@ import { TreeSelect } from 'antd';
 import { useEffect } from 'react';
 
 function DepartmentField(props) {
-  const { value, onChange } = props;
+  const { value, onChange, disabled = false } = props;
   const { depList, run, loading } = useModel('depList');
 
   const onChangeValue = (newValue) => {
@@ -18,6 +18,7 @@ function DepartmentField(props) {
       showSearch
       // multiple
       allowClear
+      defaultValue={value ? Number(value) : undefined}
       dropdownStyle={{
         maxHeight: 400,
         overflow: 'auto',
@@ -27,6 +28,7 @@ function DepartmentField(props) {
       placeholder="请选择部门"
       treeData={depList}
       onChange={onChangeValue}
+      disabled={disabled}
     />
   );
 }

+ 3 - 1
src/components/DDComponents/InnerContactField/index.js

@@ -5,7 +5,7 @@ import { useEffect } from 'react';
 const { Option } = Select;
 
 function InnerContactField(props) {
-  const { value, onChange } = props;
+  const { value, onChange, disabled = false } = props;
   const { userList, run, loading } = useModel('userList');
   useEffect(() => {
     run();
@@ -13,6 +13,7 @@ function InnerContactField(props) {
   return (
     <Select
       showSearch
+      defaultValue={value ? Number(value) : undefined}
       onChange={(value) => {
         onChange(String(value));
         // onChange(JSON.stringify([value]));
@@ -21,6 +22,7 @@ function InnerContactField(props) {
       filterOption={(input, option) =>
         option.children.toLowerCase().includes(input.toLowerCase())
       }
+      disabled={disabled}
     >
       {(userList || []).map((item) => (
         <Option key={item.ID} value={item.ID}>

+ 6 - 4
src/pages/Flow/OaAuditDetail.js

@@ -1,8 +1,7 @@
 // 审批详情
 import React, { useEffect, useState, useRef, useMemo } from 'react';
 import { Steps, Button, Tooltip } from 'antd';
-import { useParams, useRequest, useNavigate } from 'umi';
-import { useModel } from 'umi';
+import { useParams, useRequest, useNavigate, useModel } from 'umi';
 import AuditModal from './components/AuditModal';
 import FormAndFilesNode from './components/FormAndFilesNode';
 import { queryAuditDetail, audit } from '@/services/boom';
@@ -23,7 +22,10 @@ function OaAuditDetail(props) {
     audit_status,
     AuditorInfo,
   } = data || {};
-  const { initialState: { user }  } = useModel('@@initialState');
+  const {
+    initialState: { user },
+  } = useModel('@@initialState');
+
   const getDescription = (node) => {
     let str = node?.AuditRoleInfo
       ? `审批人:${node?.AuditRoleInfo.Name || '-'}`
@@ -73,7 +75,7 @@ function OaAuditDetail(props) {
     <PageContent extra={btns} loading={loading}>
       <Steps
         style={{ marginBottom: 20 }}
-        current={current_seq - 1}
+        current={audit_status == 3 ? OaAuditList.length : current_seq - 1}
         status={audit_status == 2 ? 'error' : 'process'}
         items={OaAuditList?.map((item) => ({
           title: item.seq_name,

+ 55 - 37
src/pages/Flow/components/FormAndFilesNode.js

@@ -1,13 +1,67 @@
 import { Card, Col, Row, Empty } from 'antd';
 import { Form } from 'antd';
 import { useMemo, useState } from 'react';
+import { useModel } from 'umi';
 import AttachmentTable from '@/components/AttachmentTable';
+import InnerContactField from '@/components/DDComponents/InnerContactField';
+import DepartmentField from '@/components/DDComponents/DepartmentField';
 
 const FormAndFilesNode = (props) => {
   const { formData, fileList } = props;
 
+  const renderFormItem = (type, value) => {
+    switch (type) {
+      case 'InnerContactField':
+        return <InnerContactField value={value} disabled={true} />;
+      case 'DepartmentField':
+        return <DepartmentField value={value} disabled={true} />;
+      default:
+        return (
+          <div
+            style={{
+              width: '100%',
+              padding: '4px 12px',
+              backgroundColor: 'rgb(0,0,0,0.04)',
+              border: '1px solid #D9D9D9',
+              borderRadius: '6px',
+              color: 'rgb(0,0,0,0.25) ',
+            }}
+          >
+            {value}
+          </div>
+        );
+    }
+  };
+
+  const renderForm = (data) => {
+    if (!data) return <Empty description="没有表单信息" />;
+    try {
+      const formData = JSON.parse(data);
+      if (formData.length == 0) return <Empty description="没有表单信息" />;
+      return (
+        <>
+          {formData.map((item, idx) => {
+            const value = item.value.join(',');
+            return (
+              <Form.Item
+                key={`FormAndFilesNode_${idx}`}
+                labelCol={{ span: 4 }}
+                wrapperCol={{ span: 14 }}
+                label={item.name}
+              >
+                {renderFormItem(item.type, value)}
+              </Form.Item>
+            );
+          })}
+        </>
+      );
+    } catch {
+      return <Empty description="没有表单信息" />;
+    }
+  };
+
   const FormContent = useMemo(() => {
-    return renderFrom(formData);
+    return renderForm(formData);
   }, [formData]);
 
   return (
@@ -23,40 +77,4 @@ const FormAndFilesNode = (props) => {
   );
 };
 
-const renderFrom = (data) => {
-  if (!data) return <Empty description="没有表单信息" />;
-  try {
-    const formData = JSON.parse(data);
-    if (formData.length == 0) return <Empty description="没有表单信息" />;
-    return (
-      <>
-        {formData.map((item, idx) => {
-          const value = item.value.join(',');
-          return (
-            <Form.Item
-              key={`FormAndFilesNode_${idx}`}
-              labelCol={{ span: 4 }}
-              wrapperCol={{ span: 14 }}
-              label={item.name}
-            >
-              <div
-                style={{
-                  width: '100%',
-                  padding: '4px 12px',
-                  backgroundColor: '#ececef',
-                  border: '1px solid #bcb9b9',
-                  borderRadius: '4px',
-                }}
-              >
-                {value}
-              </div>
-            </Form.Item>
-          );
-        })}
-      </>
-    );
-  } catch {
-    return <Empty description="没有表单信息" />;
-  }
-};
 export default FormAndFilesNode;

+ 1 - 1
src/pages/Profile/apply.js

@@ -177,7 +177,7 @@ function Apply(props) {
                 navigate(`/profile/${record.id}`);
               }}
             >
-              申请
+              详情
             </a>
           </>
         </Fragment>

+ 1 - 1
src/pages/Profile/approve.js

@@ -214,7 +214,7 @@ function Approve(props) {
                 navigate(`/profile/${record.id}`);
               }}
             >
-              申请
+              详情
             </a>
           </>
         </Fragment>

+ 4 - 3
src/pages/Profile/index.js

@@ -28,7 +28,9 @@ import PageContent from '@/components/PageContent';
 
 function profile(props) {
   const { submitting, params, dispatch } = props;
-  const { initialState: { user }  } = useModel('@@initialState');
+  const {
+    initialState: { user },
+  } = useModel('@@initialState');
   const [tabActive, setTabActive] = useState('1');
   const approveFormRef = useRef();
   const applyFormRef = useRef();
@@ -264,7 +266,7 @@ function profile(props) {
                 navigate(`/profile/${record.id}`);
               }}
             >
-              申请
+              详情
             </a>
           </>
         </Fragment>
@@ -441,7 +443,6 @@ function profile(props) {
   };
   return (
     <PageContent
-    
       tabList={[
         {
           tab: '我的申请',