fangmingyue 2 年之前
父節點
當前提交
bf6b5dd5b8

+ 20
- 18
src/pages/checkAnswer/loc/index.jsx 查看文件

6
 import Page from '@/components/Page';
6
 import Page from '@/components/Page';
7
 import { getTaCheck } from '@/service/tacheck';
7
 import { getTaCheck } from '@/service/tacheck';
8
 import { getTdLocType } from '@/service/tdloctype';
8
 import { getTdLocType } from '@/service/tdloctype';
9
-import { getTaCheckAnswer } from '@/service/tacheckanswer';
9
+import { getTaCheckAnswer, exportTaCheckAnswer } from '@/service/tacheckanswer';
10
 import useBool from '@/utils/hooks/useBool';
10
 import useBool from '@/utils/hooks/useBool';
11
 
11
 
12
 const getCheck = queryDict(getTaCheck, { labelKey: 'title', valueKey: 'checkId' });
12
 const getCheck = queryDict(getTaCheck, { labelKey: 'title', valueKey: 'checkId' });
21
   const paramsRef = React.useRef();
21
   const paramsRef = React.useRef();
22
   const [notificationApi, contextHolder] = notification.useNotification();
22
   const [notificationApi, contextHolder] = notification.useNotification();
23
   const navigate = useNavigate();
23
   const navigate = useNavigate();
24
+  const [params, setParams] = React.useState({});
24
 
25
 
25
   const goToDetail = (row) => {
26
   const goToDetail = (row) => {
26
     navigate(`/checkAnswer/loc/detail?answerId=${row.answerId}&itemType=loc`)
27
     navigate(`/checkAnswer/loc/detail?answerId=${row.answerId}&itemType=loc`)
79
 
80
 
80
   const beforeSearchSubmit = (params) => {
81
   const beforeSearchSubmit = (params) => {
81
     paramsRef.current = params;
82
     paramsRef.current = params;
83
+    setParams(params);
82
     return params;
84
     return params;
83
   }
85
   }
84
-
85
   const onExport = () => {
86
   const onExport = () => {
86
     // if (!paramsRef.current) {
87
     // if (!paramsRef.current) {
87
     //   notificationApi.warning({ message: '请先进行条件查询' });
88
     //   notificationApi.warning({ message: '请先进行条件查询' });
88
     //   return
89
     //   return
89
     // }
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
   return (
101
   return (
107
         params={addOnParams}
109
         params={addOnParams}
108
         beforeSearchSubmit={beforeSearchSubmit}
110
         beforeSearchSubmit={beforeSearchSubmit}
109
         form={{ ignoreRules: false }}
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
     </Page>
123
     </Page>
122
   )
124
   )

+ 20
- 20
src/pages/checkAnswer/survey/index.jsx 查看文件

5
 import { ProTable } from "@ant-design/pro-components";
5
 import { ProTable } from "@ant-design/pro-components";
6
 import { Button, notification } from "antd";
6
 import { Button, notification } from "antd";
7
 import { getTaCheck } from '@/service/tacheck';
7
 import { getTaCheck } from '@/service/tacheck';
8
-import { getTaCheckAnswer } from '@/service/tacheckanswer';
8
+import { getTaCheckAnswer, exportTaCheckAnswer } from '@/service/tacheckanswer';
9
 import useBool from '@/utils/hooks/useBool';
9
 import useBool from '@/utils/hooks/useBool';
10
 
10
 
11
 const getCheck = queryDict(getTaCheck, { labelKey: 'title', valueKey: 'checkId' });
11
 const getCheck = queryDict(getTaCheck, { labelKey: 'title', valueKey: 'checkId' });
92
     //   return
92
     //   return
93
     // }
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
   return (
106
   return (
114
         params={addOnParams}
114
         params={addOnParams}
115
         beforeSearchSubmit={beforeSearchSubmit}
115
         beforeSearchSubmit={beforeSearchSubmit}
116
         form={{ ignoreRules: false }}
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
     </Page>
128
     </Page>
129
   )
129
   )

+ 31
- 0
src/pages/issue/index.jsx 查看文件

7
 import { getSysOrg } from '@/service/sysorg';
7
 import { getSysOrg } from '@/service/sysorg';
8
 import { queryDict } from '@/utils/request';
8
 import { queryDict } from '@/utils/request';
9
 import { processEnum, processStatus } from '@/utils/biz';
9
 import { processEnum, processStatus } from '@/utils/biz';
10
+import { exportTaIssue } from '@/service/taissue';
11
+import useBool from '@/utils/hooks/useBool';
10
 
12
 
11
 const queryOrg = queryDict(getSysOrg, { labelKey: 'name', valueKey: 'orgId' });
13
 const queryOrg = queryDict(getSysOrg, { labelKey: 'name', valueKey: 'orgId' });
12
 const queryLocType = queryDict(getTdLocType, { labelKey: 'name', valueKey: 'typeId' });
14
 const queryLocType = queryDict(getTdLocType, { labelKey: 'name', valueKey: 'typeId' });
15
 
17
 
16
 export default (props) => {
18
 export default (props) => {
17
 
19
 
20
+  const [loading, startLoading, stopLoading] = useBool();
18
   const navigate = useNavigate();
21
   const navigate = useNavigate();
22
+  const paramsRef = React.useRef();
19
 
23
 
20
   const columns = [
24
   const columns = [
21
     {
25
     {
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
   return (
89
   return (
72
     <List
90
     <List
73
       rowKey="issueId"
91
       rowKey="issueId"
74
       request={getTaIssue}
92
       request={getTaIssue}
75
       columns={columns}
93
       columns={columns}
94
+      beforeSearchSubmit={beforeSearchSubmit}
76
       optionRender={(_, row) => [
95
       optionRender={(_, row) => [
77
         <Button key="detail" type="link" onClick={() => navigate(`/issue/detail?id=${row.issueId}`)}>详情</Button>
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 查看文件

31
  * 分页查询
31
  * 分页查询
32
  */
32
  */
33
 export const exportTaCheckAnswerDetail = (params) => request(`/api/taCheckAnswer/${params.answerId}/detail/export`, { params, download: true });
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 查看文件

29
  * 通过主键删除数据
29
  * 通过主键删除数据
30
  */
30
  */
31
 export const deleteTaIssue = (id) => request(`/api/taIssue/${id}`, { method: 'delete' });
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 });