Ver código fonte

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

Yansen 2 anos atrás
pai
commit
e244a0a2e3

+ 24
- 22
src/pages/checkAnswer/loc/index.jsx Ver arquivo

@@ -6,7 +6,7 @@ import { queryTable, queryDict } from "@/utils/request";
6 6
 import Page from '@/components/Page';
7 7
 import { getTaCheck } from '@/service/tacheck';
8 8
 import { getTdLocType } from '@/service/tdloctype';
9
-import { getTaCheckAnswer } from '@/service/tacheckanswer';
9
+import { getTaCheckAnswer, exportTaCheckAnswer } from '@/service/tacheckanswer';
10 10
 import useBool from '@/utils/hooks/useBool';
11 11
 
12 12
 const getCheck = queryDict(getTaCheck, { labelKey: 'title', valueKey: 'checkId' });
@@ -21,6 +21,7 @@ export default (props) => {
21 21
   const paramsRef = React.useRef();
22 22
   const [notificationApi, contextHolder] = notification.useNotification();
23 23
   const navigate = useNavigate();
24
+  const [params, setParams] = React.useState({});
24 25
 
25 26
   const goToDetail = (row) => {
26 27
     navigate(`/checkAnswer/loc/detail?answerId=${row.answerId}&itemType=loc`)
@@ -79,21 +80,22 @@ export default (props) => {
79 80
 
80 81
   const beforeSearchSubmit = (params) => {
81 82
     paramsRef.current = params;
83
+    setParams(params);
82 84
     return params;
83 85
   }
84
-
85 86
   const onExport = () => {
86
-    // if (!paramsRef.current) {
87
-    //   notificationApi.warning({ message: '请先进行条件查询' });
88
-    //   return
89
-    // }
87
+    if (!paramsRef.current) {
88
+      notificationApi.warning({ message: '请先进行条件查询' });
89
+      return
90
+    }
90 91
 
91
-    // startLoading();
92
-    // exportTaCheckAnswer(paramsRef.current).then(() => {
93
-    //   stopLoading();
94
-    // }).catch(() => {
95
-    //   stopLoading();
96
-    // });
92
+    startLoading();
93
+    exportTaCheckAnswer({ ...addOnParams, ...params }).then(() => {
94
+      // console.log('params', params);
95
+      stopLoading();
96
+    }).catch(() => {
97
+      stopLoading();
98
+    });
97 99
   }
98 100
 
99 101
   return (
@@ -107,16 +109,16 @@ export default (props) => {
107 109
         params={addOnParams}
108 110
         beforeSearchSubmit={beforeSearchSubmit}
109 111
         form={{ ignoreRules: false }}
110
-        // toolBarRender={() => [
111
-        //   <Button
112
-        //     key="1"
113
-        //     type="primary"
114
-        //     loading={loading}
115
-        //     onClick={onExport}
116
-        //   >
117
-        //     导出
118
-        //   </Button>,
119
-        // ]}
112
+        toolBarRender={() => [
113
+          <Button
114
+            key="1"
115
+            type="primary"
116
+            loading={loading}
117
+            onClick={onExport}
118
+          >
119
+            导出
120
+          </Button>,
121
+        ]}
120 122
       />
121 123
     </Page>
122 124
   )

+ 24
- 24
src/pages/checkAnswer/survey/index.jsx Ver arquivo

@@ -5,7 +5,7 @@ import { queryTable, queryDict } from "@/utils/request";
5 5
 import { ProTable } from "@ant-design/pro-components";
6 6
 import { Button, notification } from "antd";
7 7
 import { getTaCheck } from '@/service/tacheck';
8
-import { getTaCheckAnswer } from '@/service/tacheckanswer';
8
+import { getTaCheckAnswer, exportTaCheckAnswer } from '@/service/tacheckanswer';
9 9
 import useBool from '@/utils/hooks/useBool';
10 10
 
11 11
 const getCheck = queryDict(getTaCheck, { labelKey: 'title', valueKey: 'checkId' });
@@ -87,20 +87,20 @@ export default (props) => {
87 87
   }
88 88
 
89 89
   const onExport = () => {
90
-    // if (!paramsRef.current) {
91
-    //   notificationApi.warning({ message: '请先进行条件查询' });
92
-    //   return
93
-    // }
90
+    if (!paramsRef.current) {
91
+      notificationApi.warning({ message: '请先进行条件查询' });
92
+      return
93
+    }
94 94
 
95
-    // startLoading();
96
-    // exportTaCheckAnswer({
97
-    //   ...paramsRef.current,
98
-    //   ...addOnParams,
99
-    // }).then(() => {
100
-    //   stopLoading();
101
-    // }).catch(() => {
102
-    //   stopLoading();
103
-    // });
95
+    startLoading();
96
+    exportTaCheckAnswer({
97
+      ...paramsRef.current,
98
+      ...addOnParams,
99
+    }).then(() => {
100
+      stopLoading();
101
+    }).catch(() => {
102
+      stopLoading();
103
+    });
104 104
   }
105 105
 
106 106
   return (
@@ -114,16 +114,16 @@ export default (props) => {
114 114
         params={addOnParams}
115 115
         beforeSearchSubmit={beforeSearchSubmit}
116 116
         form={{ ignoreRules: false }}
117
-        // toolBarRender={() => [
118
-        //   <Button
119
-        //     key="1"
120
-        //     type="primary"
121
-        //     loading={loading}
122
-        //     onClick={onExport}
123
-        //   >
124
-        //     导出
125
-        //   </Button>,
126
-        // ]}
117
+        toolBarRender={() => [
118
+          <Button
119
+            key="1"
120
+            type="primary"
121
+            loading={loading}
122
+            onClick={onExport}
123
+          >
124
+            导出
125
+          </Button>,
126
+        ]}
127 127
       />
128 128
     </Page>
129 129
   )

+ 31
- 0
src/pages/issue/index.jsx Ver arquivo

@@ -7,6 +7,8 @@ import { getTdLocType } from '@/service/tdloctype';
7 7
 import { getSysOrg } from '@/service/sysorg';
8 8
 import { queryDict } from '@/utils/request';
9 9
 import { processEnum, processStatus } from '@/utils/biz';
10
+import { exportTaIssue } from '@/service/taissue';
11
+import useBool from '@/utils/hooks/useBool';
10 12
 
11 13
 const queryOrg = queryDict(getSysOrg, { labelKey: 'name', valueKey: 'orgId' });
12 14
 const queryLocType = queryDict(getTdLocType, { labelKey: 'name', valueKey: 'typeId' });
@@ -15,7 +17,9 @@ const today = (new Date()).toJSON().substring(0, 10);
15 17
 
16 18
 export default (props) => {
17 19
 
20
+  const [loading, startLoading, stopLoading] = useBool();
18 21
   const navigate = useNavigate();
22
+  const paramsRef = React.useRef();
19 23
 
20 24
   const columns = [
21 25
     {
@@ -68,14 +72,41 @@ export default (props) => {
68 72
     }
69 73
   ];
70 74
 
75
+  const onExport = () => {
76
+    startLoading();
77
+    exportTaIssue(paramsRef.current).then(() => {
78
+      stopLoading();
79
+    }).catch(() => {
80
+      stopLoading();
81
+    });
82
+  }
83
+
84
+  const beforeSearchSubmit = (params) => {
85
+    paramsRef.current = params;
86
+    return params;
87
+  }
88
+
71 89
   return (
72 90
     <List
73 91
       rowKey="issueId"
74 92
       request={getTaIssue}
75 93
       columns={columns}
94
+      beforeSearchSubmit={beforeSearchSubmit}
76 95
       optionRender={(_, row) => [
77 96
         <Button key="detail" type="link" onClick={() => navigate(`/issue/detail?id=${row.issueId}`)}>详情</Button>
78 97
       ]}
98
+      toolBarRender={() => [
99
+        (
100
+          <Button
101
+            key="1"
102
+            type="primary"
103
+            loading={loading}
104
+            onClick={onExport}
105
+          >
106
+            导出
107
+          </Button>
108
+        )
109
+      ]}
79 110
     />
80 111
   )
81 112
 }

+ 5
- 0
src/service/tacheckanswer.js Ver arquivo

@@ -31,3 +31,8 @@ export const deleteTaCheckAnswer = (id) => request(`/api/taCheckAnswer/${id}`, {
31 31
  * 分页查询
32 32
  */
33 33
 export const exportTaCheckAnswerDetail = (params) => request(`/api/taCheckAnswer/${params.answerId}/detail/export`, { params, download: true });
34
+
35
+/*
36
+ * 导出
37
+ */
38
+export const exportTaCheckAnswer = (params) => request(`/api/taCheckAnswer/export`, { params, method: 'post', download: true });

+ 5
- 0
src/service/taissue.js Ver arquivo

@@ -29,3 +29,8 @@ export const putTaIssue = (id, data) => request(`/api/taIssue/${id}`, { data, me
29 29
  * 通过主键删除数据
30 30
  */
31 31
 export const deleteTaIssue = (id) => request(`/api/taIssue/${id}`, { method: 'delete' });
32
+
33
+/*
34
+ * 导出
35
+ */
36
+export const exportTaIssue = (params) => request(`/api/taIssue/export`, { params, method: 'post', download: true });