Your Name пре 2 година
родитељ
комит
4c2c77dc80

+ 198
- 0
src/pages/check/components/QuForm.jsx Прегледај датотеку

@@ -0,0 +1,198 @@
1
+import React from 'react';
2
+import {
3
+  DrawerForm,
4
+  ProFormText,
5
+  ProFormSelect,
6
+  ProFormDigit,
7
+  ProFormList
8
+} from '@ant-design/pro-components';
9
+import { Form, Row, Col } from 'antd';
10
+import WangEditor from '@/components/Wangeditor';
11
+import { postTaCheckItemQu } from '@/service/tdlocquestion';
12
+
13
+export default (props) => {
14
+  const {open, onOpenChange, quInfo, itemId, onChange} = props;
15
+  const [form] = Form.useForm();
16
+  
17
+  const onFinish = async (values) => {
18
+    const data = {
19
+      ...(quInfo || {}),
20
+      ...values,
21
+      itemId,
22
+    }
23
+
24
+    const res = await postTaCheckItemQu(data).then(x => x);
25
+
26
+    onChange(res);
27
+    return true;
28
+  }
29
+
30
+  React.useEffect(() => {
31
+    if (quInfo) {
32
+      form.setFieldsValue(quInfo);
33
+    } else {
34
+      form.resetFields();
35
+    }
36
+  }, [quInfo]);
37
+
38
+  return (
39
+    <DrawerForm
40
+      title="问题维护"
41
+      open={open}
42
+      width={800}
43
+      form={form}
44
+      destroyOnClose
45
+      onFinish={onFinish}
46
+      onOpenChange={onOpenChange}
47
+    >
48
+      <Row gutter={24}>
49
+        <Col span={6}>
50
+          <ProFormText
51
+            name="sortNo"
52
+            label="序号"
53
+            placeholder="请填写"
54
+            rules={[
55
+              {
56
+                required: true,
57
+                message: '请填写序号',
58
+              },
59
+            ]}
60
+          />
61
+        </Col>
62
+        <Col span={18}>
63
+          <ProFormText
64
+            name="title"
65
+            label="题干描述"
66
+            placeholder="请填写"
67
+            rules={[
68
+              {
69
+                required: true,
70
+                message: '请填写题干',
71
+              },
72
+            ]}
73
+          />
74
+        </Col>
75
+      </Row>
76
+      <Row gutter={24}>
77
+        <Col span={12}>
78
+          <ProFormSelect
79
+            name="quType"
80
+            label="问题类型"
81
+            fieldProps={{
82
+              style: { width: '100%' }
83
+            }}
84
+            valueEnum={{
85
+              radio: '单选',
86
+              fill: '填空'
87
+            }}
88
+            rules={[
89
+              {
90
+                required: true,
91
+                message: '请选择问题类型',
92
+              },
93
+            ]}
94
+          />
95
+        </Col>
96
+        <Col span={12}>
97
+          <ProFormSelect
98
+            name="computeType"
99
+            label="计分方式"
100
+            fieldProps={{
101
+              style: { width: '100%' }
102
+            }}
103
+            valueEnum={{
104
+              '+': '得分',
105
+              '-': '扣分'
106
+            }}
107
+            rules={[
108
+              {
109
+                required: true,
110
+                message: '请选择计分方式',
111
+              },
112
+            ]}
113
+          />
114
+        </Col>
115
+      </Row>
116
+      <Row gutter={24}>
117
+        <Col span={12}>
118
+          <ProFormDigit
119
+            name="maxScore"
120
+            label="最 高 分"
121
+            min={0}
122
+            fieldProps={{ precision: 2 }}
123
+            rules={[
124
+              {
125
+                required: true,
126
+                message: '请设置最高分',
127
+              },
128
+            ]}
129
+          />
130
+        </Col>
131
+        <Col span={12}>
132
+          <ProFormDigit
133
+            name="anScore"
134
+            label="单项计分"
135
+            min={0}
136
+            fieldProps={{ precision: 2 }}
137
+            rules={[
138
+              {
139
+                required: true,
140
+                message: '请设置单项计分',
141
+              },
142
+            ]}
143
+          />
144
+        </Col>
145
+      </Row>
146
+      <Form.Item name="stand" label="评分标准">
147
+        <WangEditor
148
+          height="200px"
149
+          toolbarConfig={{
150
+            toolbarKeys: [
151
+              'headerSelect',
152
+              'blockquote',
153
+              '|',
154
+              'bold',
155
+              'underline',
156
+              'italic',
157
+              'color',
158
+              'fontSize',
159
+              '|',
160
+              'bulletedList',
161
+              'numberedList',
162
+            ]
163
+          }}
164
+        />
165
+      </Form.Item>
166
+      <ProFormList
167
+        name="answerList"
168
+        label="选项列表"
169
+        copyIconProps={false}
170
+      >
171
+        <Row gutter={24} style={{width: '730px'}}>
172
+          <Col span={6}>
173
+            <ProFormText
174
+              name="answerCode"
175
+              label="选项"
176
+              help="类似 A, B, C, D"
177
+            />
178
+          </Col>
179
+          <Col span={6}>
180
+            <ProFormDigit
181
+              name="score"
182
+              label="计分"
183
+              min={0}
184
+              fieldProps={{ precision: 2 }}
185
+            />
186
+          </Col>
187
+          <Col span={12}>
188
+            <ProFormText
189
+              name="answer"
190
+              label="答案"
191
+              placeholder="具体选项内容"
192
+            />
193
+          </Col>
194
+        </Row>
195
+      </ProFormList>
196
+    </DrawerForm>
197
+  )
198
+}

+ 44
- 164
src/pages/check/components/QuManage.jsx Прегледај датотеку

@@ -1,24 +1,31 @@
1 1
 import React from 'react';
2
-import { Button, Form, Row, Col, Card, Input, Modal, List } from 'antd';
3
-import {
4
-  DrawerForm,
5
-  ProFormGroup,
6
-  ProFormText,
7
-  ProFormSelect,
8
-  ProFormDigit,
9
-  ProFormList
10
-} from '@ant-design/pro-components';
11
-import WangEditor from '@/components/Wangeditor';
2
+import { Button, Form, Row, Col, Card, List, Popconfirm } from 'antd';
3
+import QuForm from './QuForm';
12 4
 import { postTaCheckItemQu, getTaCheckItemQu } from '@/service/tdlocquestion';
13
-import { getTaCheckItemAn } from '@/service/tacheckiteman';
5
+import { deleteTaCheckItemQu } from '@/service/tacheckitemqu';
6
+import { message } from 'antd';
14 7
 
15 8
 const QuItem = (props) => {
16
-   const { qu, onEdit } = props;
9
+  const { qu, onEdit, onDelete } = props;
17 10
 
18
-   const quTitle = `${qu?.sortNo}. [${qu?.quType == 'fill' ? '填空' : '选择'}] ${qu?.title} (分值: ${qu?.computeType} ${qu?.anScore}/${qu?.maxScore})`
11
+  const quTitle = `${qu?.sortNo}. [${qu?.quType == 'fill' ? '填空' : '选择'}] ${qu?.title} (分值: ${qu?.computeType} ${qu?.anScore}/${qu?.maxScore})`
19 12
 
20 13
   return (
21
-    <Card title={quTitle} extra={<Button type='link' onClick={onEdit}>修改</Button>} style={{marginTop: '24px'}}>
14
+    <Card
15
+      title={quTitle} 
16
+      style={{marginTop: '24px'}}
17
+      extra={(
18
+        <>
19
+          <Button type='link' onClick={onEdit}>修改</Button>
20
+          <Popconfirm
21
+            title="确认进行删除操作?"
22
+            onConfirm={onDelete}
23
+          >
24
+            <Button type='link' danger >删除</Button>
25
+          </Popconfirm>
26
+        </>
27
+      )} 
28
+    >
22 29
       <Card.Meta
23 30
         title={
24 31
           qu?.quType != 'fill' ?
@@ -56,13 +63,8 @@ export default React.forwardRef((props, ref) => {
56 63
   const [open, setOpen] = React.useState(false);
57 64
   const [quInfo, setQuInfo] = React.useState(false);
58 65
   const [list, setList] = React.useState([]);
59
-  // const [anList, setAnList] = React.useState([]);
60
-  const [form] = Form.useForm();
61
-
62
-  const onFinish = async (values) => {
63
-    const data = { ...(quInfo || {}), ...values, itemId }
64
-    const res = await postTaCheckItemQu(data);
65 66
 
67
+  const onFinish = (res) => {
66 68
     let found = false;
67 69
     const newList = list.map(item => {
68 70
       if (item.quId === res.quId) {
@@ -78,9 +80,6 @@ export default React.forwardRef((props, ref) => {
78 80
     }
79 81
 
80 82
     setList(list);
81
-    onChange(res);
82
-
83
-    return true;
84 83
   }
85 84
 
86 85
   const onEditQu = (qu) => {
@@ -88,11 +87,15 @@ export default React.forwardRef((props, ref) => {
88 87
     setOpen(true);
89 88
   }
90 89
 
91
-  React.useEffect(() => {
92
-    if (quInfo) {
93
-      form.setFieldsValue(quInfo);
90
+  const onDeleteQu = (qu) => {
91
+    if (qu?.quId) {
92
+      deleteTaCheckItemQu(qu.quId).then(() => {
93
+        setList(list.filter(x => x.quId !== qu.quId));
94
+      })
95
+    } else {
96
+      setList(list.filter(x => x.quId !== qu.quId));
94 97
     }
95
-  }, [quInfo]);
98
+  }
96 99
 
97 100
   React.useEffect(() => {
98 101
     if (itemId) {
@@ -103,149 +106,26 @@ export default React.forwardRef((props, ref) => {
103 106
   }, [itemId]);
104 107
 
105 108
   React.useImperativeHandle(ref, () => ({
106
-    add: () => setOpen(true),
109
+    add: () => {
110
+      setQuInfo();
111
+      setOpen(true);
112
+    },
107 113
   }), []);
108 114
 
109 115
   return (
110
-    <div>
111
-      <DrawerForm title="问题维护" open={open} width={800} form={form} onFinish={onFinish} onOpenChange={setOpen}>
112
-        <ProFormText
113
-          name="title"
114
-          label="题干描述"
115
-          placeholder="请填写"
116
-          rules={[
117
-            {
118
-              required: true,
119
-              message: '请填写题干',
120
-            },
121
-          ]}
122
-        />
123
-        <Row gutter={24}>
124
-          <Col span={12}>
125
-            <ProFormSelect
126
-              name="quType"
127
-              label="问题类型"
128
-              fieldProps={{
129
-                style: { width: '100%' }
130
-              }}
131
-              valueEnum={{
132
-                radio: '单选',
133
-                fill: '填空'
134
-              }}
135
-              rules={[
136
-                {
137
-                  required: true,
138
-                  message: '请选择问题类型',
139
-                },
140
-              ]}
141
-            />
142
-          </Col>
143
-          <Col span={12}>
144
-            <ProFormSelect
145
-              name="computeType"
146
-              label="计分方式"
147
-              fieldProps={{
148
-                style: { width: '100%' }
149
-              }}
150
-              valueEnum={{
151
-                '+': '得分',
152
-                '-': '扣分'
153
-              }}
154
-              rules={[
155
-                {
156
-                  required: true,
157
-                  message: '请选择计分方式',
158
-                },
159
-              ]}
160
-            />
161
-          </Col>
162
-        </Row>
163
-        <Row gutter={24}>
164
-          <Col span={12}>
165
-            <ProFormDigit
166
-              name="maxScore"
167
-              label="最 高 分"
168
-              min={0}
169
-              fieldProps={{ precision: 2 }}
170
-              rules={[
171
-                {
172
-                  required: true,
173
-                  message: '请设置最高分',
174
-                },
175
-              ]}
176
-            />
177
-          </Col>
178
-          <Col span={12}>
179
-            <ProFormDigit
180
-              name="anScore"
181
-              label="单项计分"
182
-              min={0}
183
-              fieldProps={{ precision: 2 }}
184
-              rules={[
185
-                {
186
-                  required: true,
187
-                  message: '请设置单项计分',
188
-                },
189
-              ]}
190
-            />
191
-          </Col>
192
-        </Row>
193
-        <Form.Item name="stand" label="评分标准">
194
-          <WangEditor
195
-            height="200px"
196
-            toolbarConfig={{
197
-              toolbarKeys: [
198
-                'headerSelect',
199
-                'blockquote',
200
-                '|',
201
-                'bold',
202
-                'underline',
203
-                'italic',
204
-                'color',
205
-                'fontSize',
206
-                '|',
207
-                'bulletedList',
208
-                'numberedList',
209
-              ]
210
-            }}
211
-          />
212
-        </Form.Item>
213
-        <ProFormList
214
-          name="answerList"
215
-          label="选项列表"
216
-          copyIconProps={false}
217
-        >
218
-          <Row gutter={24} style={{width: '730px'}}>
219
-            <Col span={6}>
220
-              <ProFormText
221
-                name="answerCode"
222
-                label="选项"
223
-                help="类似 A, B, C, D"
224
-              />
225
-            </Col>
226
-            <Col span={6}>
227
-              <ProFormDigit
228
-                name="score"
229
-                label="计分"
230
-                min={0}
231
-                fieldProps={{ precision: 2 }}
232
-              />
233
-            </Col>
234
-            <Col span={12}>
235
-              <ProFormText
236
-                name="answer"
237
-                label="答案"
238
-                placeholder="具体选项内容"
239
-              />
240
-            </Col>
241
-          </Row>
242
-        </ProFormList>
243
-      </DrawerForm>
116
+    <>
117
+      <QuForm itemId={itemId} quInfo={quInfo} open={open} onOpenChange={setOpen} onChange={onFinish} />
244 118
       <List
245 119
         itemLayout="horizontal"
246 120
         dataSource={list}
247
-        renderItem={(item) => <QuItem qu={item} onEdit={() => onEditQu(item)}/>}
121
+        renderItem={(item) => (
122
+          <QuItem
123
+            qu={item}
124
+            onEdit={() => onEditQu(item)}
125
+            onDelete={() => onDeleteQu(item)}
126
+          />
127
+        )}
248 128
       />
249
-    </div>
129
+    </>
250 130
   )
251 131
 });

+ 0
- 2
src/pages/locType/edit/index.jsx Прегледај датотеку

@@ -46,8 +46,6 @@ export default (props) => {
46 46
     }
47 47
   }, [id]);
48 48
 
49
-  console.log('id', id);
50
-
51 49
   const onFinish = (values) => {
52 50
     startSubmit();
53 51
     console.log('locType修改id', id);

+ 0
- 18
src/pages/locType/list/index.jsx Прегледај датотеку

@@ -32,10 +32,6 @@ export default (props) => {
32 32
   };
33 33
 
34 34
   const columns = [
35
-    {
36
-      title: "分类ID",
37
-      dataIndex: "typeId",
38
-    },
39 35
     {
40 36
       title: "分类名称",
41 37
       dataIndex: "name",
@@ -44,10 +40,6 @@ export default (props) => {
44 40
       title: "分类描述",
45 41
       dataIndex: "desc",
46 42
     },
47
-    {
48
-      title: "排序",
49
-      dataIndex: "sortNo",
50
-    },
51 43
     {
52 44
       title: "状态",
53 45
       dataIndex: "status",
@@ -67,16 +59,6 @@ export default (props) => {
67 59
       valueType: "option",
68 60
       width: 200,
69 61
       render: (_, record) => [
70
-        // <Button
71
-        //   key={1}
72
-        //   style={{ padding: 0 }}
73
-        //   type="link"
74
-        //   onClick={() => {
75
-        //     updateStatus(record);
76
-        //   }}
77
-        // >
78
-        //   {record.status === 1 ? "禁用" : "启用"}
79
-        // </Button>,
80 62
         <Button
81 63
           key={2}
82 64
           style={{ padding: 0 }}

+ 0
- 17
src/pages/org/list/index.jsx Прегледај датотеку

@@ -32,14 +32,6 @@ export default (props) => {
32 32
   };
33 33
 
34 34
   const columns = [
35
-    {
36
-      title: "机构ID",
37
-      dataIndex: "orgId",
38
-    },
39
-    {
40
-      title: "机构编码",
41
-      dataIndex: "orgCode",
42
-    },
43 35
     {
44 36
       title: "机构名称",
45 37
       dataIndex: "name",
@@ -49,11 +41,6 @@ export default (props) => {
49 41
       dataIndex: "orgPId",
50 42
     },
51 43
 
52
-    {
53
-      title: "排序",
54
-      dataIndex: "sortNo",
55
-    },
56
-
57 44
     {
58 45
       title: "状态",
59 46
       dataIndex: "status",
@@ -68,10 +55,6 @@ export default (props) => {
68 55
         },
69 56
       },
70 57
     },
71
-    {
72
-      title: "创建人",
73
-      dataIndex: "createUser",
74
-    },
75 58
     {
76 59
       title: "操作",
77 60
       valueType: "option",

+ 2
- 0
src/utils/request.js Прегледај датотеку

@@ -19,6 +19,8 @@ instance.interceptors.request.use(function (config) {
19 19
     noTip = method.toLocaleLowerCase() === 'get' ? true : false;
20 20
   }
21 21
 
22
+  console.log('---------------')
23
+
22 24
   // 在发送请求之前做些什么
23 25
   return {
24 26
     ...config,

+ 1
- 1
vite.config.js Прегледај датотеку

@@ -8,7 +8,7 @@ export default defineConfig({
8 8
     port: 3000,
9 9
     proxy: {
10 10
       '/api': {
11
-        target: 'http://192.168.89.147:9087',
11
+        target: 'http://localhost:9087',
12 12
         changeOrigin: true,
13 13
       },
14 14
     }