Yansen 2 years ago
parent
commit
298950a396

+ 6
- 4
src/components/Page/index.jsx View File

1
 import React from 'react';
1
 import React from 'react';
2
 import { Typography } from 'antd';
2
 import { Typography } from 'antd';
3
-import { useNavigate } from 'react-router-dom';
3
+import { useNavigate, useSearchParams } from 'react-router-dom';
4
 import useRoute from '@/utils/hooks/useRoute';
4
 import useRoute from '@/utils/hooks/useRoute';
5
 import { ArrowLeftOutlined } from '@ant-design/icons';
5
 import { ArrowLeftOutlined } from '@ant-design/icons';
6
 
6
 
49
 
49
 
50
 export default (props) => {
50
 export default (props) => {
51
   const { extra, back } = props;
51
   const { extra, back } = props;
52
-
52
+  
53
+  const [searchParams] = useSearchParams();
53
   const { meta = {} } = useRoute() || {};
54
   const { meta = {} } = useRoute() || {};
54
   const style = meta.noLayout ? { height: '100%' } : pageStyle;
55
   const style = meta.noLayout ? { height: '100%' } : pageStyle;
55
   const title = props.title || meta.title;
56
   const title = props.title || meta.title;
56
 
57
 
57
-  console.log('back', back);
58
+  const backParam = searchParams.get('back')
59
+  const isBack = back || new Boolean(backParam === 'false' ? 0 : backParam);
58
 
60
 
59
   return (
61
   return (
60
     <div style={style}>
62
     <div style={style}>
61
-      {title && !meta.noLayout && <Title extra={extra} back={back}>{title}</Title>}
63
+      {title && !meta.noLayout && <Title extra={extra} back={isBack}>{title}</Title>}
62
       {props.children}
64
       {props.children}
63
     </div>
65
     </div>
64
   )
66
   )

+ 12
- 0
src/pages/check/components/LocTable.jsx View File

1
 import React from 'react';
1
 import React from 'react';
2
+import { Link } from 'react-router-dom';
2
 import useBool from '@/utils/hooks/useBool';
3
 import useBool from '@/utils/hooks/useBool';
3
 import { Table, Space, Button, Row, Col, Card } from 'antd';
4
 import { Table, Space, Button, Row, Col, Card } from 'antd';
4
 import { getTaCheckItem } from '@/service/tacheckitem';
5
 import { getTaCheckItem } from '@/service/tacheckitem';
34
       title: '已收/计划数',
35
       title: '已收/计划数',
35
       dataIndex: 'num',
36
       dataIndex: 'num',
36
       key: 'num',
37
       key: 'num',
38
+      render: (_, row) => {
39
+        return (
40
+          <Space>
41
+            <span>
42
+              <Link to={`/checkAnswer/loc?checkId=${row.checkId}&typeId=${row.typeId}&back=true`}>{row.answerNum || 0}</Link>
43
+            </span>
44
+            <span>/</span>
45
+            <span>{row.num || 0}</span>
46
+          </Space>
47
+        )
48
+      }
37
     },
49
     },
38
     {
50
     {
39
       title: '小计',
51
       title: '小计',

+ 12
- 2
src/pages/check/components/SurveyForm.jsx View File

1
 import React from 'react';
1
 import React from 'react';
2
-import { Button, Tabs, Form, Row, Col, InputNumber, message } from 'antd';
2
+import { Link } from 'react-router-dom';
3
+import { Button, Tabs, Form, Space } from 'antd';
3
 import { EditOutlined } from '@ant-design/icons';
4
 import { EditOutlined } from '@ant-design/icons';
4
 import { ModalForm, ProFormDigit, ProFormDependency } from '@ant-design/pro-components';
5
 import { ModalForm, ProFormDigit, ProFormDependency } from '@ant-design/pro-components';
5
 import { getTaCheckItem, postTaCheckItem } from '@/service/tacheckitem';
6
 import { getTaCheckItem, postTaCheckItem } from '@/service/tacheckitem';
68
       onOpenChange={setShow}
69
       onOpenChange={setShow}
69
       trigger={(
70
       trigger={(
70
         <>
71
         <>
71
-          <span style={{ display: 'inline-block', marginLeft: '1em' }}>{`预收 ${checkItem?.num || 0} 份`}</span>
72
+          <div style={{ display: 'inline-block', marginLeft: '1em' }}>
73
+            <Space>
74
+              <span>
75
+                <Link to={`/checkAnswer/survey?checkId=${checkId}&back=true`}>{checkItem?.answerNum || 0}</Link>
76
+              </span>
77
+              <span>/</span>
78
+              <span>{`${checkItem?.num || 0} 份`}</span>
79
+            </Space>
80
+            
81
+          </div>
72
           <Button type="link" size="middle" loading={loading} onClick={onClick}>
82
           <Button type="link" size="middle" loading={loading} onClick={onClick}>
73
             <EditOutlined />
83
             <EditOutlined />
74
           </Button>
84
           </Button>

+ 13
- 2
src/pages/checkAnswer/loc/index.jsx View File

1
 import React from 'react';
1
 import React from 'react';
2
 import { Button, notification } from "antd";
2
 import { Button, notification } from "antd";
3
 import { ProTable } from "@ant-design/pro-components";
3
 import { ProTable } from "@ant-design/pro-components";
4
-import { useNavigate } from 'react-router-dom';
4
+import { useNavigate, useSearchParams } from 'react-router-dom';
5
 import { queryTable, queryDict } from "@/utils/request";
5
 import { queryTable, queryDict } from "@/utils/request";
6
 import Page from '@/components/Page';
6
 import Page from '@/components/Page';
7
 import { getTaCheck } from '@/service/tacheck';
7
 import { getTaCheck } from '@/service/tacheck';
21
   const paramsRef = React.useRef();
21
   const paramsRef = React.useRef();
22
   const [notificationApi, contextHolder] = notification.useNotification();
22
   const [notificationApi, contextHolder] = notification.useNotification();
23
   const navigate = useNavigate();
23
   const navigate = useNavigate();
24
+  const [searchParams] = useSearchParams();
24
   const [params, setParams] = React.useState({});
25
   const [params, setParams] = React.useState({});
25
 
26
 
27
+  const initialValues = React.useMemo(() => {
28
+    const checkId = searchParams.get('checkId');
29
+    const typeId = searchParams.get('typeId');
30
+  
31
+    return {
32
+      checkId,
33
+      typeId,
34
+    }
35
+  }, []);
36
+
26
   const goToDetail = (row) => {
37
   const goToDetail = (row) => {
27
     navigate(`/checkAnswer/loc/detail?answerId=${row.answerId}&itemType=loc`)
38
     navigate(`/checkAnswer/loc/detail?answerId=${row.answerId}&itemType=loc`)
28
   }
39
   }
108
         request={getAnswer}
119
         request={getAnswer}
109
         params={addOnParams}
120
         params={addOnParams}
110
         beforeSearchSubmit={beforeSearchSubmit}
121
         beforeSearchSubmit={beforeSearchSubmit}
111
-        form={{ ignoreRules: false }}
122
+        form={{ ignoreRules: false, initialValues }}
112
         toolBarRender={() => [
123
         toolBarRender={() => [
113
           <Button
124
           <Button
114
             key="1"
125
             key="1"

+ 11
- 2
src/pages/checkAnswer/survey/index.jsx View File

1
 import React from 'react';
1
 import React from 'react';
2
 import Page from '@/components/Page';
2
 import Page from '@/components/Page';
3
-import { useNavigate } from 'react-router-dom';
3
+import { useNavigate, useSearchParams } from 'react-router-dom';
4
 import { queryTable, queryDict } from "@/utils/request";
4
 import { queryTable, queryDict } from "@/utils/request";
5
 import { ProTable } from "@ant-design/pro-components";
5
 import { ProTable } from "@ant-design/pro-components";
6
 import { Button, notification } from "antd";
6
 import { Button, notification } from "antd";
18
   const paramsRef = React.useRef();
18
   const paramsRef = React.useRef();
19
   const [notificationApi, contextHolder] = notification.useNotification();
19
   const [notificationApi, contextHolder] = notification.useNotification();
20
   const navigate = useNavigate();
20
   const navigate = useNavigate();
21
+  const [searchParams] = useSearchParams();
22
+  
23
+  const initialValues = React.useMemo(() => {
24
+    const checkId = searchParams.get('checkId');
25
+  
26
+    return {
27
+      checkId,
28
+    }
29
+  }, []);
21
 
30
 
22
   const goToDetail = (row) => {
31
   const goToDetail = (row) => {
23
     navigate(`/checkAnswer/survey/detail?answerId=${row.answerId}&itemType=survey`)
32
     navigate(`/checkAnswer/survey/detail?answerId=${row.answerId}&itemType=survey`)
113
         request={getAnswer}
122
         request={getAnswer}
114
         params={addOnParams}
123
         params={addOnParams}
115
         beforeSearchSubmit={beforeSearchSubmit}
124
         beforeSearchSubmit={beforeSearchSubmit}
116
-        form={{ ignoreRules: false }}
125
+        form={{ ignoreRules: false, initialValues }}
117
         toolBarRender={() => [
126
         toolBarRender={() => [
118
           <Button
127
           <Button
119
             key="1"
128
             key="1"