张涛 2 years ago
parent
commit
f870e59f06

+ 2
- 1
src/pages/check/components/SurveyForm.jsx View File

@@ -2,7 +2,7 @@ import React from 'react';
2 2
 import { Link } from 'react-router-dom';
3 3
 import { Button, Tabs, Form, Space } from 'antd';
4 4
 import { EditOutlined } from '@ant-design/icons';
5
-import { ModalForm, ProFormDigit, ProFormDependency } from '@ant-design/pro-components';
5
+import { ModalForm, ProFormDigit, ProFormText } from '@ant-design/pro-components';
6 6
 import { getTaCheckItem, postTaCheckItem } from '@/service/tacheckitem';
7 7
 
8 8
 const itemType = 'survey';
@@ -86,6 +86,7 @@ const SurveyForm = (props) => {
86 86
       )}
87 87
     >
88 88
       <ProFormDigit label="预收数量" name="num" min={1} fieldProps={{precision: 0}} />
89
+      <ProFormText label="文明用语" name="cultureTerm"  fieldProps={{precision: 0}} />
89 90
     </ModalForm>
90 91
   )
91 92
 }

+ 50
- 45
src/pages/checkAnswer/survey/index.jsx View File

@@ -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
+};

+ 37
- 3
src/pages/issue/index.jsx View File

@@ -1,6 +1,6 @@
1 1
 // 此页面包含两个接口  后端需要注意
2 2
 import React from "react";
3
-import { Button, Badge } from "antd";
3
+import { Button, Badge, Popconfirm } from "antd";
4 4
 import { useNavigate } from "react-router-dom";
5 5
 import List from "@/components/Page/List";
6 6
 import {
@@ -8,6 +8,7 @@ import {
8 8
   getTaOrgIssue,
9 9
   exportTaIssue,
10 10
   exportTaOrgIssue,
11
+  deleteTaOrgIssue,
11 12
 } from "@/service/taissue";
12 13
 import { getTdIssueType } from "@/service/tdissuetype";
13 14
 
@@ -32,6 +33,8 @@ const getTdList = queryDict(getTdIssueType, {
32 33
 
33 34
 const yestoday = dayjs().subtract(1, "day").format("YYYY-MM-DD");
34 35
 export default (props) => {
36
+  const issueIdRef = React.useRef();
37
+
35 38
   const [loading, startLoading, stopLoading] = useBool();
36 39
   const [loading1, startLoading1, stopLoading1] = useBool();
37 40
   const navigate = useNavigate();
@@ -59,6 +62,16 @@ export default (props) => {
59 62
         return <span>{row.typeName}</span>;
60 63
       },
61 64
     },
65
+    {
66
+      title: "问题来源",
67
+      dataIndex: "sourceType2",
68
+      valueType: "select",
69
+      valueEnum: {
70
+        'check': "实地测评",
71
+        'feedback': "市民上报",
72
+        'inspector': "日常督查",
73
+      },
74
+    },
62 75
     {
63 76
       title: "创建时间",
64 77
       dataIndex: "createdAt",
@@ -186,16 +199,37 @@ export default (props) => {
186 199
     };
187 200
     return params;
188 201
   };
189
-
202
+  const handleDelete = (row) => {
203
+    console.log(row);
204
+    deleteTaOrgIssue(row.issueId).then(() => {
205
+      issueIdRef.current.reload();
206
+    });
207
+  };
190 208
   return (
191 209
     <List
210
+      ref={issueIdRef}
192 211
       rowKey="issueId"
193 212
       request={request}
194 213
       columns={columns}
195 214
       params={params}
196 215
       beforeSearchSubmit={beforeSearchSubmit}
197 216
       optionRender={(_, row) => [
198
-        <TargetLink key="detail" to={`/issue/detail?id=${row.issueId}`}>详情</TargetLink>,
217
+        <>
218
+          <TargetLink key="detail" to={`/issue/detail?id=${row.issueId}`}>
219
+            详情
220
+          </TargetLink>
221
+          <Popconfirm
222
+            key="delete"
223
+            title="您是否确认删除 ?"
224
+            onConfirm={() => handleDelete(row)}
225
+            okText="确定"
226
+            cancelText="取消"
227
+          >
228
+            <Button style={{ padding: 0 }} danger type="link">
229
+              删除
230
+            </Button>
231
+          </Popconfirm>
232
+        </>,
199 233
       ]}
200 234
       toolBarRender={() => [
201 235
         <Button key="1" type="primary" loading={loading} onClick={onExport}>

+ 2
- 0
src/service/taissue.js View File

@@ -34,6 +34,8 @@ export const putTaIssue = (id, data) => request(`/api/taIssue/${id}`, { data, me
34 34
  * 通过主键删除数据
35 35
  */
36 36
 export const deleteTaIssue = (id) => request(`/api/taIssue/${id}`, { method: 'delete' });
37
+export const deleteTaOrgIssue = (id) => request(`/api/taOrgIssue/${id}`, { method: 'delete' });
38
+
37 39
 
38 40
 /*
39 41
  * 导出