|
@@ -1,18 +1,21 @@
|
1
|
|
-import React from 'react';
|
2
|
|
-import Page from '@/components/Page';
|
3
|
|
-import { useNavigate, useSearchParams } from 'react-router-dom';
|
|
1
|
+import React from "react";
|
|
2
|
+import Page from "@/components/Page";
|
|
3
|
+import { useNavigate, useSearchParams } from "react-router-dom";
|
4
|
4
|
import { queryTable, queryDict } from "@/utils/request";
|
5
|
5
|
import { ProTable } from "@ant-design/pro-components";
|
6
|
6
|
import { Button, notification } from "antd";
|
7
|
|
-import { getTaCheck } from '@/service/tacheck';
|
8
|
|
-import { getTaCheckAnswer, exportTaCheckAnswer } from '@/service/tacheckanswer';
|
9
|
|
-import useBool from '@/utils/hooks/useBool';
|
10
|
|
-import TargetLink from '@/components/TargetLink';
|
|
7
|
+import { getTaCheck } from "@/service/tacheck";
|
|
8
|
+import { getTaCheckAnswer, exportTaCheckAnswer } from "@/service/tacheckanswer";
|
|
9
|
+import useBool from "@/utils/hooks/useBool";
|
|
10
|
+import TargetLink from "@/components/TargetLink";
|
11
|
11
|
|
12
|
|
-const getCheck = queryDict(getTaCheck, { labelKey: 'title', valueKey: 'checkId' });
|
|
12
|
+const getCheck = queryDict(getTaCheck, {
|
|
13
|
+ labelKey: "title",
|
|
14
|
+ valueKey: "checkId",
|
|
15
|
+});
|
13
|
16
|
const getAnswer = queryTable(getTaCheckAnswer);
|
14
|
17
|
|
15
|
|
-const addOnParams = { itemType: 'survey' };
|
|
18
|
+const addOnParams = { itemType: "survey" };
|
16
|
19
|
|
17
|
20
|
export default (props) => {
|
18
|
21
|
const [loading, startLoading, stopLoading] = useBool();
|
|
@@ -20,36 +23,36 @@ export default (props) => {
|
20
|
23
|
const [notificationApi, contextHolder] = notification.useNotification();
|
21
|
24
|
const navigate = useNavigate();
|
22
|
25
|
const [searchParams] = useSearchParams();
|
23
|
|
-
|
|
26
|
+
|
24
|
27
|
const initialValues = React.useMemo(() => {
|
25
|
|
- const checkId = searchParams.get('checkId');
|
26
|
|
-
|
|
28
|
+ const checkId = searchParams.get("checkId");
|
|
29
|
+
|
27
|
30
|
return {
|
28
|
31
|
checkId,
|
29
|
|
- }
|
|
32
|
+ };
|
30
|
33
|
}, []);
|
31
|
34
|
|
32
|
35
|
const goToDetail = (row) => {
|
33
|
|
- navigate(`/checkAnswer/survey/detail?answerId=${row.answerId}&itemType=survey`)
|
34
|
|
- }
|
|
36
|
+ navigate(
|
|
37
|
+ `/checkAnswer/survey/detail?answerId=${row.answerId}&itemType=survey`
|
|
38
|
+ );
|
|
39
|
+ };
|
35
|
40
|
|
36
|
41
|
const columns = [
|
37
|
42
|
{
|
38
|
43
|
title: "模拟测评",
|
39
|
44
|
dataIndex: "checkId",
|
40
|
|
- valueType: 'select',
|
|
45
|
+ valueType: "select",
|
41
|
46
|
request: getCheck,
|
42
|
47
|
hideInTable: true,
|
43
|
48
|
formItemProps: {
|
44
|
|
- rules: [
|
45
|
|
- { required: true, message: '请选择模拟测评' }
|
46
|
|
- ]
|
47
|
|
- }
|
|
49
|
+ rules: [{ required: true, message: "请选择模拟测评" }],
|
|
50
|
+ },
|
48
|
51
|
},
|
49
|
52
|
{
|
50
|
53
|
title: "答题时间",
|
51
|
54
|
dataIndex: "createDate",
|
52
|
|
- valueType: 'date',
|
|
55
|
+ valueType: "date",
|
53
|
56
|
hideInSearch: true,
|
54
|
57
|
},
|
55
|
58
|
{
|
|
@@ -80,38 +83,45 @@ export default (props) => {
|
80
|
83
|
hideInSearch: true,
|
81
|
84
|
},
|
82
|
85
|
{
|
83
|
|
- title: '操作',
|
|
86
|
+ title: "操作",
|
84
|
87
|
hideInSearch: true,
|
85
|
|
- key: 'options',
|
|
88
|
+ key: "options",
|
86
|
89
|
render: (_, row) => {
|
87
|
90
|
return (
|
|
91
|
+ // <a target="_blank" onClick={(row, e) => jumpPage(row, e)}>
|
|
92
|
+ // 详情
|
|
93
|
+ // </a>
|
88
|
94
|
<TargetLink to={`/checkAnswer/survey/detail?answerId=${row.answerId}&itemType=survey`}>详情</TargetLink>
|
89
|
|
- )
|
90
|
|
- }
|
91
|
|
- }
|
92
|
|
- ]
|
93
|
|
-
|
|
95
|
+ );
|
|
96
|
+ },
|
|
97
|
+ },
|
|
98
|
+ ];
|
|
99
|
+ const jumpPage = (row, e) => {
|
|
100
|
+ e.target.href = `/checkAnswer/survey/detail?answerId=${row.answerId}&itemType=survey`;
|
|
101
|
+ };
|
94
|
102
|
const beforeSearchSubmit = (params) => {
|
95
|
103
|
paramsRef.current = params;
|
96
|
104
|
return params;
|
97
|
|
- }
|
|
105
|
+ };
|
98
|
106
|
|
99
|
107
|
const onExport = () => {
|
100
|
108
|
if (!paramsRef.current) {
|
101
|
|
- notificationApi.warning({ message: '请先进行条件查询' });
|
102
|
|
- return
|
|
109
|
+ notificationApi.warning({ message: "请先进行条件查询" });
|
|
110
|
+ return;
|
103
|
111
|
}
|
104
|
112
|
|
105
|
113
|
startLoading();
|
106
|
114
|
exportTaCheckAnswer({
|
107
|
115
|
...paramsRef.current,
|
108
|
116
|
...addOnParams,
|
109
|
|
- }).then(() => {
|
110
|
|
- stopLoading();
|
111
|
|
- }).catch(() => {
|
112
|
|
- stopLoading();
|
113
|
|
- });
|
114
|
|
- }
|
|
117
|
+ })
|
|
118
|
+ .then(() => {
|
|
119
|
+ stopLoading();
|
|
120
|
+ })
|
|
121
|
+ .catch(() => {
|
|
122
|
+ stopLoading();
|
|
123
|
+ });
|
|
124
|
+ };
|
115
|
125
|
|
116
|
126
|
return (
|
117
|
127
|
<Page>
|
|
@@ -125,16 +135,11 @@ export default (props) => {
|
125
|
135
|
beforeSearchSubmit={beforeSearchSubmit}
|
126
|
136
|
form={{ ignoreRules: false, initialValues }}
|
127
|
137
|
toolBarRender={() => [
|
128
|
|
- <Button
|
129
|
|
- key="1"
|
130
|
|
- type="primary"
|
131
|
|
- loading={loading}
|
132
|
|
- onClick={onExport}
|
133
|
|
- >
|
|
138
|
+ <Button key="1" type="primary" loading={loading} onClick={onExport}>
|
134
|
139
|
导出
|
135
|
140
|
</Button>,
|
136
|
141
|
]}
|
137
|
142
|
/>
|
138
|
143
|
</Page>
|
139
|
|
- )
|
140
|
|
-}
|
|
144
|
+ );
|
|
145
|
+};
|