2 Commits 380b590e36 ... af97640659

Autor SHA1 Mensaje Fecha
  XuZinan af97640659 组件修复 hace 2 años
  XuZinan 0ecc6f6c2a OA审批撤回 hace 2 años

+ 2 - 2
src/components/DDComponents/InnerContactField/index.js

@@ -14,7 +14,7 @@ function InnerContactField(props) {
     run();
   }, []);
   useEffect(() => {
-    if (user && userList) onChange(String(user.ID));
+    if (user && userList) onChange?.(String(user.ID));
   }, [user, userList]);
   return (
     <Select
@@ -22,7 +22,7 @@ function InnerContactField(props) {
       value={user.ID}
       defaultValue={value ? Number(value) : undefined}
       onChange={(value) => {
-        onChange(String(value));
+        onChange?.(String(value));
         // onChange(JSON.stringify([value]));
       }}
       loading={loading}

+ 67 - 16
src/pages/Profile/apply.js

@@ -12,11 +12,13 @@ import {
   Row,
   Col,
   Select,
+  Divider,
 } from 'antd';
+import { ExclamationCircleOutlined } from '@ant-design/icons';
 import { PageContainer } from '@ant-design/pro-components';
 const { RangePicker } = DatePicker;
 import { useRequest, useModel } from '@umijs/max';
-import { queryProfileList, queryApplyList } from '@/services/boom';
+import { queryProfileList, queryApplyList, applyRepeal } from '@/services/boom';
 import dayjs from 'dayjs';
 import { queryContractCheck, queryGetContractList } from '@/services/contract';
 import ContractModal, {
@@ -39,6 +41,7 @@ function Apply(props) {
   const approveFormRef = useRef();
   const [applyFormRef] = Form.useForm();
   let navigate = useNavigate();
+
   const contractResult = (res) => {
     let data = res.data?.list?.map((item) => {
       return {
@@ -60,6 +63,7 @@ function Apply(props) {
     });
     return { data, pagination: res.data?.pagination };
   };
+
   //OA我的申请列表
   const {
     data: OAApplyData,
@@ -81,6 +85,7 @@ function Apply(props) {
       };
     },
   });
+
   //合同管理相关数据
   //请求我的申请列表
   const {
@@ -96,12 +101,25 @@ function Apply(props) {
       formatResult: contractResult,
     },
   );
+
+  //撤回申请
+  const { run: runRepeal, loading: repealLoading } = useRequest(
+    (id) => applyRepeal({ id: id }),
+    {
+      manual: true,
+      onSuccess: () => {
+        OAApplyRun();
+      },
+    },
+  );
+
   const applyData = useMemo(() => {
     let result = [];
     if (OAApplyData?.data && OAApplyData?.data.length > 0)
       result = [...OAApplyData?.data];
     return result;
   }, [OAApplyData]);
+
   const onTabChange = (activeKey) => {
     if (activeKey == '1') {
       OAApplyRun();
@@ -110,10 +128,25 @@ function Apply(props) {
     }
     setTabActive(activeKey);
   };
+
+  const onRepeal = (record) => {
+    Modal.confirm({
+      title: '撤回',
+      icon: <ExclamationCircleOutlined />,
+      content: `确定撤回申请`,
+      okText: '确认',
+      cancelText: '取消',
+      onOk: () => {
+        runRepeal(record.id);
+      },
+    });
+  };
+
   const handleApplySubmit = (values) => {
     console.log(values);
     OAApplyRun(values);
   };
+
   const handleApplyPaginationChange = (pagination) => {
     applyFormRef.validateFields().then((values) => {
       OAApplyRun({
@@ -123,11 +156,13 @@ function Apply(props) {
       });
     });
   };
+
   const handleProfilePaginationChange = (pagination) => {
     conApplyRun({
       current: pagination.current,
     });
   };
+
   const columns = [
     {
       title: '标题',
@@ -163,6 +198,7 @@ function Apply(props) {
       title: '流程状态',
       // dataIndex: 'status',
       render: (record) => {
+        if (record.is_repeal) return '已撤回';
         switch (record.audit_status) {
           case 0:
             return '审核中';
@@ -178,20 +214,35 @@ function Apply(props) {
     },
     {
       title: '操作',
-      render: (text, record) => (
-        <Fragment>
-          <>
-            <a
-              style={{ color: '#4096ff' }}
-              onClick={() => {
-                navigate(`/profile/${record.id}`);
-              }}
-            >
-              详情
-            </a>
-          </>
-        </Fragment>
-      ),
+      render: (text, record) => {
+        return (
+          !record.is_repeal && (
+            <Fragment>
+              <>
+                <a
+                  style={{ color: '#4096ff' }}
+                  onClick={() => {
+                    navigate(`/profile/${record.id}`);
+                  }}
+                >
+                  详情
+                </a>
+                {tabActive == '1' && record?.audit_status == 0 && (
+                  <>
+                    <Divider type="vertical" />
+                    <a
+                      style={{ color: '#4096ff' }}
+                      onClick={() => onRepeal(record)}
+                    >
+                      撤回
+                    </a>
+                  </>
+                )}
+              </>
+            </Fragment>
+          )
+        );
+      },
       width: '10%',
     },
   ];
@@ -250,7 +301,7 @@ function Apply(props) {
                 navigate(`/profile/${record.id}`);
               }}
             >
-              申请
+              详情
             </a>
           </>
         </Fragment>

+ 5 - 0
src/services/boom.js

@@ -230,6 +230,11 @@ export async function queryLeader() {
   return request(`/api/v1/oa/get-leader/list`);
 }
 
+//撤回申请
+export async function applyRepeal(params) {
+  return request(`/api/v1/oa/repeal/${params.id}`);
+}
+
 // /**
 //   project_id
 //   version_id	大版本id