Browse Source

Merge branch 'dev1.0' of http://git.ycjcjy.com/civilized_city/pc-admin into dev1.0

Yansen 2 years ago
parent
commit
592a59b085

+ 18
- 15
src/pages/check/components/CheckForm.jsx View File

4
 import { Card, Tabs, Button, Form, Input, DatePicker } from 'antd';
4
 import { Card, Tabs, Button, Form, Input, DatePicker } from 'antd';
5
 import { ModalForm } from '@ant-design/pro-components';
5
 import { ModalForm } from '@ant-design/pro-components';
6
 import { postTaCheck, putTaCheck } from '@/service/tacheck';
6
 import { postTaCheck, putTaCheck } from '@/service/tacheck';
7
+import { useNavigate } from "react-router-dom";
7
 
8
 
8
 export default (props) => {
9
 export default (props) => {
10
+  const navigate = useNavigate();
9
   const { checkInfo, onChange, onTabChange } = props;
11
   const { checkInfo, onChange, onTabChange } = props;
10
 
12
 
11
   const [open, setOpen] = React.useState(false);
13
   const [open, setOpen] = React.useState(false);
47
   }, [checkInfo]);
49
   }, [checkInfo]);
48
 
50
 
49
   return (
51
   return (
50
-    <Card bodyStyle={{padding: 0}}>
51
-      <div style={{display: 'flex', padding: '1em', alignItems: 'center'}}>
52
-        <div style={{flex: 'none'}}><Button type="link" onClick={onEdit} icon={<EditOutlined />} /></div>
53
-        <div style={{flex: 'none', margin: '0 1em'}}>{dateStr}</div>
54
-        <div style={{flex: '1', fontSize: '1.6em'}}>{title}</div>
52
+    <Card bodyStyle={{ padding: 0 }}>
53
+      <div style={{ display: 'flex', padding: '1em', alignItems: 'center' }}>
54
+        <div style={{ flex: 'none' }}><Button type="link" onClick={onEdit} icon={<EditOutlined />} /></div>
55
+        <div style={{ flex: 'none', margin: '0 1em' }}>{dateStr}</div>
56
+        <div style={{ flex: '1', fontSize: '1.6em' }}>{title}</div>
57
+        <div style={{ flex: 'none', fontSize: '1.6em' }}><Button type="primary" onClick={() => navigate(-1)}>返回</Button></div>
55
       </div>
58
       </div>
56
       <Tabs
59
       <Tabs
57
         defaultActiveKey='1'
60
         defaultActiveKey='1'
58
         onChange={onTabChange}
61
         onChange={onTabChange}
59
-        tabBarStyle={{margin: '0 2em'}}
62
+        tabBarStyle={{ margin: '0 2em' }}
60
         items={[
63
         items={[
61
           {
64
           {
62
             label: '实地测评',
65
             label: '实地测评',
69
         ]}
72
         ]}
70
       />
73
       />
71
       <ModalForm title="测评维护" open={open} width={480} form={form} onFinish={onFinish} onOpenChange={setOpen}>
74
       <ModalForm title="测评维护" open={open} width={480} form={form} onFinish={onFinish} onOpenChange={setOpen}>
72
-          <Form.Item name="title" label="测评名称" required>
73
-            <Input placeholder="请输入测评名称" />
74
-          </Form.Item>
75
-          <Form.Item name="startDate" label="开始时间" required>
76
-            <DatePicker placeholder="请选择" style={{ width: '100%' }} />
77
-          </Form.Item>
78
-          <Form.Item name="endDate" label="结束时间" required>
79
-            <DatePicker placeholder="请选择" style={{ width: '100%' }} />
80
-          </Form.Item>
75
+        <Form.Item name="title" label="测评名称" required>
76
+          <Input placeholder="请输入测评名称" />
77
+        </Form.Item>
78
+        <Form.Item name="startDate" label="开始时间" required>
79
+          <DatePicker placeholder="请选择" style={{ width: '100%' }} />
80
+        </Form.Item>
81
+        <Form.Item name="endDate" label="结束时间" required>
82
+          <DatePicker placeholder="请选择" style={{ width: '100%' }} />
83
+        </Form.Item>
81
       </ModalForm>
84
       </ModalForm>
82
     </Card>
85
     </Card>
83
   )
86
   )

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

31
       render: (_, row) => row.fullScore ? Number(row.fullScore / (row.num || 1)).toFixed(2) : '-',
31
       render: (_, row) => row.fullScore ? Number(row.fullScore / (row.num || 1)).toFixed(2) : '-',
32
     },
32
     },
33
     {
33
     {
34
-      title: '数',
34
+      title: '已收/计划数',
35
       dataIndex: 'num',
35
       dataIndex: 'num',
36
       key: 'num',
36
       key: 'num',
37
     },
37
     },
74
   React.useEffect(() => {
74
   React.useEffect(() => {
75
     if (checkId) {
75
     if (checkId) {
76
       startLoading();
76
       startLoading();
77
-      getTaCheckItem({pageSize: 500, checkId, itemType: "loc"}).then(res => {
77
+      getTaCheckItem({ pageSize: 500, checkId, itemType: "loc" }).then(res => {
78
         setList(res.records || []);
78
         setList(res.records || []);
79
         stopLoading();
79
         stopLoading();
80
       }).catch(() => {
80
       }).catch(() => {
82
       });
82
       });
83
     }
83
     }
84
   }, [checkId]);
84
   }, [checkId]);
85
-  
85
+
86
   return (
86
   return (
87
     <Row gutter={24}>
87
     <Row gutter={24}>
88
       <Col span={12}>
88
       <Col span={12}>

+ 76
- 54
src/pages/check/components/QuForm.jsx View File

16
 const queryQu = transformQuery(getTdQuestion, { searchKey: 'title', labelKey: 'title', valueKey: 'quId' });
16
 const queryQu = transformQuery(getTdQuestion, { searchKey: 'title', labelKey: 'title', valueKey: 'quId' });
17
 
17
 
18
 export default (props) => {
18
 export default (props) => {
19
-  const {open, onOpenChange, quInfo, itemId, itemType, onChange} = props;
19
+  const { open, onOpenChange, quInfo, itemId, itemType, onChange } = props;
20
   const [form] = Form.useForm();
20
   const [form] = Form.useForm();
21
+  const [value, setValue] = React.useState();
21
 
22
 
22
   const onFinish = async (values) => {
23
   const onFinish = async (values) => {
23
     const data = {
24
     const data = {
54
     }
55
     }
55
   }, [quInfo]);
56
   }, [quInfo]);
56
 
57
 
58
+  // console.log('value', value);
57
   return (
59
   return (
58
     <DrawerForm
60
     <DrawerForm
59
       title="问题维护"
61
       title="问题维护"
66
         destroyOnClose: true,
68
         destroyOnClose: true,
67
         extra: (
69
         extra: (
68
           <>
70
           <>
69
-          {
70
-            itemType == 'survey' && (
71
-              <SearchSelect
72
-                placeholder="请输入题干搜索题库"
73
-                style={{width: '300px'}}
74
-                request={queryQu}
75
-                onChange={onTplChange}
76
-              />
77
-            )
78
-          }
71
+            {
72
+              itemType == 'survey' && (
73
+                <SearchSelect
74
+                  placeholder="请输入题干搜索题库"
75
+                  style={{ width: '300px' }}
76
+                  request={queryQu}
77
+                  onChange={onTplChange}
78
+                />
79
+              )
80
+            }
79
           </>
81
           </>
80
         )
82
         )
81
       }}
83
       }}
166
         <Col span={12}>
168
         <Col span={12}>
167
           <ProFormDependency name={['quType']}>
169
           <ProFormDependency name={['quType']}>
168
             {
170
             {
169
-              ({quType}) => (
171
+              ({ quType }) => (
170
                 quType != 'fill' ? null : (
172
                 quType != 'fill' ? null : (
171
                   <ProFormDigit
173
                   <ProFormDigit
172
                     name="anScore"
174
                     name="anScore"
188
         <Col span={12}>
190
         <Col span={12}>
189
           <ProFormDependency name={['quType']}>
191
           <ProFormDependency name={['quType']}>
190
             {
192
             {
191
-              ({quType}) => (
193
+              ({ quType }) => (
192
                 quType != 'fill' ? null : (
194
                 quType != 'fill' ? null : (
193
                   <ProFormText
195
                   <ProFormText
194
                     name="fillUnit"
196
                     name="fillUnit"
225
           </Form.Item>
227
           </Form.Item>
226
         )
228
         )
227
       }
229
       }
228
-      
230
+
229
       <ProFormDependency name={['quType']}>
231
       <ProFormDependency name={['quType']}>
230
         {
232
         {
231
-          ({quType}) => (
233
+          ({ quType }) => (
232
             quType == 'fill' ? null : (
234
             quType == 'fill' ? null : (
233
               <ProFormList
235
               <ProFormList
234
                 name="answerList"
236
                 name="answerList"
235
                 label="选项列表"
237
                 label="选项列表"
236
                 copyIconProps={false}
238
                 copyIconProps={false}
237
-              >
238
-                <Row gutter={24} style={{ width: '730px' }}>
239
-                  <Col span={6}>
240
-                    <ProFormText
241
-                      name="answerCode"
242
-                      label="选项"
243
-                      help="类似 A, B, C, D"
244
-                    />
245
-                  </Col>
246
-                  <Col span={6}>
247
-                    <ProFormDigit
248
-                      name="score"
249
-                      label="计分"
250
-                      help="计分"
251
-                      min={0}
252
-                      fieldProps={{ precision: 2 }}
253
-                    />
254
-                  </Col>
255
-                  <Col span={6}>
256
-                    <ProFormSelect
257
-                      name="reportIssue"
258
-                      label="上报问题"
259
-                      help="上报问题"
260
-                      placeholder="是否上报问题"
261
-                      valueEnum={{
262
-                        0: '不上报',
263
-                        1: '上报',
264
-                      }}
265
-                    />
266
-                  </Col>
267
-                  <Col span={6}>
268
-                    <ProFormText
269
-                      name="answer"
270
-                      label="答案"
271
-                      help="答案"
272
-                      placeholder="具体选项内容"
273
-                    />
274
-                  </Col>
275
-                </Row>
239
+                creatorRecord={{ answerCode: value }}
240
+              >{(f, index) => {
241
+
242
+                // console.log('index', index == 0)
243
+                if (index == 0) {
244
+                  setValue('B')
245
+                } else if (index == 1) {
246
+                  setValue('C')
247
+                } else if (index == 2) {
248
+                  setValue('D')
249
+                } else if (index == 3) {
250
+                  setValue('E')
251
+                } else if (index == 4) {
252
+                  setValue('F')
253
+                }
254
+                return (
255
+                  <Row gutter={24} style={{ width: '730px' }}>
256
+                    <Col span={6}>
257
+                      <ProFormText
258
+                        name="answerCode"
259
+                        label="选项"
260
+                        help="类似 A, B, C, D"
261
+                        initialValue={'A'}
262
+                      />
263
+                    </Col>
264
+                    <Col span={6}>
265
+                      <ProFormDigit
266
+                        name="score"
267
+                        label="计分"
268
+                        help="计分"
269
+                        min={0}
270
+                        fieldProps={{ precision: 2 }}
271
+                      />
272
+                    </Col>
273
+                    <Col span={6}>
274
+                      <ProFormSelect
275
+                        name="reportIssue"
276
+                        label="上报问题"
277
+                        help="上报问题"
278
+                        placeholder="是否上报问题"
279
+                        valueEnum={{
280
+                          0: '不上报',
281
+                          1: '上报',
282
+                        }}
283
+                      />
284
+                    </Col>
285
+                    <Col span={6}>
286
+                      <ProFormText
287
+                        name="answer"
288
+                        label="答案"
289
+                        help="答案"
290
+                        placeholder="具体选项内容"
291
+                      />
292
+                    </Col>
293
+                  </Row>
294
+                )
295
+              }
296
+                }
297
+
276
               </ProFormList>
298
               </ProFormList>
277
             )
299
             )
278
           )
300
           )

+ 0
- 1
src/pages/checkAnswer/loc/index.jsx View File

54
     {
54
     {
55
       title: "答题人",
55
       title: "答题人",
56
       dataIndex: "userName",
56
       dataIndex: "userName",
57
-      hideInSearch: true,
58
     },
57
     },
59
     {
58
     {
60
       title: "得分",
59
       title: "得分",

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

53
     {
53
     {
54
       title: "答题人",
54
       title: "答题人",
55
       dataIndex: "userName",
55
       dataIndex: "userName",
56
-      hideInSearch: true,
57
     },
56
     },
58
     {
57
     {
59
       title: "受访者性别",
58
       title: "受访者性别",
81
       }
80
       }
82
     }
81
     }
83
   ]
82
   ]
84
-  
83
+
85
   const beforeSearchSubmit = (params) => {
84
   const beforeSearchSubmit = (params) => {
86
     paramsRef.current = params;
85
     paramsRef.current = params;
87
     return params;
86
     return params;