fangmingyue 2 лет назад
Родитель
Сommit
bfd5ad0614
2 измененных файлов: 79 добавлений и 57 удалений
  1. 3
    3
      src/pages/check/components/LocTable.jsx
  2. 76
    54
      src/pages/check/components/QuForm.jsx

+ 3
- 3
src/pages/check/components/LocTable.jsx Просмотреть файл

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 Просмотреть файл

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
           )