|
@@ -1,11 +1,11 @@
|
1
|
|
-import React from 'react';
|
2
|
|
-import { Link } from 'react-router-dom';
|
3
|
|
-import useBool from '@/utils/hooks/useBool';
|
4
|
|
-import { Table, Space, Button, Row, Col, Card } from 'antd';
|
5
|
|
-import { getTaCheckItem, exportTaCheckItem } from '@/service/tacheckitem';
|
6
|
|
-import QuList from './QuList';
|
7
|
|
-import LocForm from './LocForm';
|
8
|
|
-import styles from './style.module.less';
|
|
1
|
+import React from "react";
|
|
2
|
+import { Link } from "react-router-dom";
|
|
3
|
+import useBool from "@/utils/hooks/useBool";
|
|
4
|
+import { Table, Space, Button, Row, Col, Card } from "antd";
|
|
5
|
+import { getTaCheckItem, exportTaCheckItem } from "@/service/tacheckitem";
|
|
6
|
+import QuList from "./QuList";
|
|
7
|
+import LocForm from "./LocForm";
|
|
8
|
+import styles from "./style.module.less";
|
9
|
9
|
|
10
|
10
|
export default (props) => {
|
11
|
11
|
const { checkId } = props;
|
|
@@ -18,54 +18,61 @@ export default (props) => {
|
18
|
18
|
|
19
|
19
|
const columns = [
|
20
|
20
|
{
|
21
|
|
- title: '点位名称',
|
22
|
|
- dataIndex: 'name',
|
23
|
|
- key: 'name',
|
|
21
|
+ title: "点位名称",
|
|
22
|
+ dataIndex: "name",
|
|
23
|
+ key: "name",
|
24
|
24
|
},
|
25
|
25
|
{
|
26
|
|
- title: '分值',
|
27
|
|
- dataIndex: 'fullScore',
|
|
26
|
+ title: "分值",
|
|
27
|
+ dataIndex: "fullScore",
|
28
|
28
|
},
|
29
|
29
|
{
|
30
|
|
- title: '已收/计划数',
|
31
|
|
- dataIndex: 'num',
|
32
|
|
- key: 'num',
|
|
30
|
+ title: "已收/计划数",
|
|
31
|
+ dataIndex: "num",
|
|
32
|
+ key: "num",
|
33
|
33
|
render: (_, row) => {
|
34
|
34
|
return (
|
35
|
35
|
<Space>
|
36
|
36
|
<span>
|
37
|
|
- <Link to={`/checkAnswer/loc?checkId=${row.checkId}&typeId=${row.typeId}&back=true`}>{row.answerNum || 0}</Link>
|
|
37
|
+ <Link
|
|
38
|
+ to={`/checkAnswer/loc?checkId=${row.checkId}&typeId=${row.typeId}&back=true`}
|
|
39
|
+ >
|
|
40
|
+ {row.answerNum || 0}
|
|
41
|
+ </Link>
|
38
|
42
|
</span>
|
39
|
43
|
<span>/</span>
|
40
|
44
|
<span>{row.num || 0}</span>
|
41
|
45
|
</Space>
|
42
|
|
- )
|
43
|
|
- }
|
|
46
|
+ );
|
|
47
|
+ },
|
44
|
48
|
},
|
45
|
49
|
{
|
46
|
|
- title: '小计',
|
47
|
|
- dataIndex: 'fullScore',
|
48
|
|
- key: 'fullScore',
|
49
|
|
- render: (_, row) => row.fullScore ? Number(row.fullScore * (row.num || 0)).toFixed(2) : '-',
|
|
50
|
+ title: "小计",
|
|
51
|
+ dataIndex: "fullScore",
|
|
52
|
+ key: "fullScore",
|
|
53
|
+ render: (_, row) =>
|
|
54
|
+ row.fullScore ? Number(row.fullScore * (row.num || 0)).toFixed(2) : "-",
|
50
|
55
|
},
|
51
|
56
|
{
|
52
|
|
- title: '测评得分',
|
53
|
|
- dataIndex: 'score',
|
54
|
|
- key: 'score',
|
|
57
|
+ title: "测评得分",
|
|
58
|
+ dataIndex: "score",
|
|
59
|
+ key: "score",
|
55
|
60
|
},
|
56
|
61
|
{
|
57
|
|
- title: '操作',
|
58
|
|
- key: 'options',
|
|
62
|
+ title: "操作",
|
|
63
|
+ key: "options",
|
59
|
64
|
width: 100,
|
60
|
65
|
render: (_, row) => {
|
61
|
66
|
return (
|
62
|
67
|
<Space>
|
63
|
|
- <Button type="link" onClick={() => onEdit(row)}>编辑</Button>
|
|
68
|
+ <Button type="link" onClick={() => onEdit(row)}>
|
|
69
|
+ 编辑
|
|
70
|
+ </Button>
|
64
|
71
|
</Space>
|
65
|
|
- )
|
66
|
|
- }
|
|
72
|
+ );
|
|
73
|
+ },
|
67
|
74
|
},
|
68
|
|
- ]
|
|
75
|
+ ];
|
69
|
76
|
|
70
|
77
|
const summary = React.useMemo(() => {
|
71
|
78
|
let fullScore = 0;
|
|
@@ -75,10 +82,10 @@ export default (props) => {
|
75
|
82
|
let subtotal = 0;
|
76
|
83
|
|
77
|
84
|
list.forEach((x) => {
|
78
|
|
- fullScore += (x.fullScore || 0);
|
79
|
|
- answerNum += (x.answerNum || 0);
|
80
|
|
- num += (x.num || 0);
|
81
|
|
- score += (x.score || 0);
|
|
85
|
+ fullScore += x.fullScore || 0;
|
|
86
|
+ answerNum += x.answerNum || 0;
|
|
87
|
+ num += x.num || 0;
|
|
88
|
+ score += x.score || 0;
|
82
|
89
|
subtotal += (x.fullScore || 0) * (x.num || 0);
|
83
|
90
|
});
|
84
|
91
|
|
|
@@ -88,69 +95,108 @@ export default (props) => {
|
88
|
95
|
num,
|
89
|
96
|
score,
|
90
|
97
|
subtotal: Number(subtotal).toFixed(2),
|
91
|
|
- }
|
|
98
|
+ };
|
92
|
99
|
}, [list]);
|
93
|
100
|
|
94
|
101
|
const queryList = React.useCallback(() => {
|
95
|
102
|
if (checkId) {
|
96
|
103
|
startLoading();
|
97
|
|
- getTaCheckItem({ pageSize: 500, checkId, itemType: "loc" }).then(res => {
|
98
|
|
- setList(res.records || []);
|
99
|
|
- stopLoading();
|
100
|
|
- }).catch(() => {
|
101
|
|
- stopLoading();
|
102
|
|
- });
|
|
104
|
+ getTaCheckItem({ pageSize: 500, checkId, itemType: "loc" })
|
|
105
|
+ .then((res) => {
|
|
106
|
+ setList(res.records || []);
|
|
107
|
+ stopLoading();
|
|
108
|
+ })
|
|
109
|
+ .catch(() => {
|
|
110
|
+ stopLoading();
|
|
111
|
+ });
|
103
|
112
|
}
|
104
|
113
|
}, [checkId]);
|
105
|
114
|
|
106
|
115
|
const onEdit = (row) => {
|
107
|
116
|
setCurItem(row);
|
108
|
117
|
setOpen(true);
|
109
|
|
- }
|
|
118
|
+ };
|
110
|
119
|
|
111
|
120
|
const onExport = () => {
|
112
|
121
|
startExpLoading();
|
113
|
|
- exportTaCheckItem(checkId).then(() => {
|
114
|
|
- stopExpLoading();
|
115
|
|
- }).catch(() => {
|
116
|
|
- stopExpLoading();
|
117
|
|
- });
|
118
|
|
- }
|
|
122
|
+ exportTaCheckItem(checkId)
|
|
123
|
+ .then(() => {
|
|
124
|
+ stopExpLoading();
|
|
125
|
+ })
|
|
126
|
+ .catch(() => {
|
|
127
|
+ stopExpLoading();
|
|
128
|
+ });
|
|
129
|
+ };
|
119
|
130
|
|
120
|
131
|
const onChange = (item) => {
|
121
|
|
- const newList = list.map(x => x.itemId === item.itemId ? item : x);
|
|
132
|
+ const newList = list.map((x) => (x.itemId === item.itemId ? item : x));
|
122
|
133
|
setList(newList);
|
123
|
|
- }
|
|
134
|
+ };
|
124
|
135
|
|
125
|
136
|
const onQuChange = () => {
|
126
|
137
|
queryList();
|
127
|
|
- }
|
|
138
|
+ };
|
128
|
139
|
|
129
|
140
|
const getRowClassName = (row) => {
|
130
|
141
|
return [
|
131
|
|
- styles['yz-table-row'],
|
132
|
|
- (row.itemId == curItem?.itemId) ? styles.active : false,
|
133
|
|
- ].filter(Boolean).join(' ');
|
134
|
|
- }
|
|
142
|
+ styles["yz-table-row"],
|
|
143
|
+ row.itemId == curItem?.itemId ? styles.active : false,
|
|
144
|
+ ]
|
|
145
|
+ .filter(Boolean)
|
|
146
|
+ .join(" ");
|
|
147
|
+ };
|
135
|
148
|
|
136
|
149
|
React.useEffect(() => {
|
137
|
150
|
queryList();
|
138
|
151
|
}, [queryList]);
|
139
|
152
|
|
|
153
|
+ const onSync = () => {
|
|
154
|
+ // getTaCheckItem({ pageSize: 500, checkId, itemType: "loc" }).then((res) => {
|
|
155
|
+ // setList(res.records || []);
|
|
156
|
+ // });
|
|
157
|
+ };
|
140
|
158
|
return (
|
141
|
159
|
<Row gutter={24}>
|
142
|
160
|
<Col span={12}>
|
143
|
|
- <Card extra={<Button loading={expLoading} type="primary" onClick={onExport}>导出</Button>}>
|
|
161
|
+ <Card
|
|
162
|
+ extra={
|
|
163
|
+ <>
|
|
164
|
+ {checkId ? (
|
|
165
|
+ <Button
|
|
166
|
+ style={{ marginRight: "20px" }}
|
|
167
|
+ type="primary"
|
|
168
|
+ onClick={onSync}
|
|
169
|
+ >
|
|
170
|
+ 同步点位
|
|
171
|
+ </Button>
|
|
172
|
+ ) : (
|
|
173
|
+ ""
|
|
174
|
+ )}
|
|
175
|
+
|
|
176
|
+ <Button loading={expLoading} type="primary" onClick={onExport}>
|
|
177
|
+ 导出
|
|
178
|
+ </Button>
|
|
179
|
+ </>
|
|
180
|
+ }
|
|
181
|
+ >
|
144
|
182
|
<Table
|
145
|
183
|
sticky
|
146
|
184
|
summary={() => (
|
147
|
185
|
<Table.Summary fixed="top">
|
148
|
|
- <Table.Summary.Row style={{ fontWeight: 'bolder' }}>
|
|
186
|
+ <Table.Summary.Row style={{ fontWeight: "bolder" }}>
|
149
|
187
|
<Table.Summary.Cell index={0}>合计</Table.Summary.Cell>
|
150
|
|
- <Table.Summary.Cell index={1}>{summary.fullScore}</Table.Summary.Cell>
|
151
|
|
- <Table.Summary.Cell index={2}>{`${summary.answerNum} / ${summary.num}`}</Table.Summary.Cell>
|
152
|
|
- <Table.Summary.Cell index={3}>{summary.subtotal}</Table.Summary.Cell>
|
153
|
|
- <Table.Summary.Cell index={4}>{summary.score}</Table.Summary.Cell>
|
|
188
|
+ <Table.Summary.Cell index={1}>
|
|
189
|
+ {summary.fullScore}
|
|
190
|
+ </Table.Summary.Cell>
|
|
191
|
+ <Table.Summary.Cell
|
|
192
|
+ index={2}
|
|
193
|
+ >{`${summary.answerNum} / ${summary.num}`}</Table.Summary.Cell>
|
|
194
|
+ <Table.Summary.Cell index={3}>
|
|
195
|
+ {summary.subtotal}
|
|
196
|
+ </Table.Summary.Cell>
|
|
197
|
+ <Table.Summary.Cell index={4}>
|
|
198
|
+ {summary.score}
|
|
199
|
+ </Table.Summary.Cell>
|
154
|
200
|
</Table.Summary.Row>
|
155
|
201
|
</Table.Summary>
|
156
|
202
|
)}
|
|
@@ -178,5 +224,5 @@ export default (props) => {
|
178
|
224
|
<QuList itemId={curItem?.itemId} onChange={onQuChange} />
|
179
|
225
|
</Col>
|
180
|
226
|
</Row>
|
181
|
|
- )
|
182
|
|
-}
|
|
227
|
+ );
|
|
228
|
+};
|