Commit c7e2e76c74b4ece11e4b28dcc88a0cb8ca7791f5
Merge remote-tracking branch 'origin/bug_fix' into ehr
Showing
2 changed files
with
51 additions
and
57 deletions
src/pages/ehr/ProgramOfStudy/QuestionBank/api.ts
1 | -import request from "@/utils/request"; | |
2 | -import { ABILITY_HOST } from "@/utils/host"; | |
3 | -import { http } from "@/typing/http"; | |
1 | +import request from '@/utils/request'; | |
2 | +import { ABILITY_HOST } from '@/utils/host'; | |
3 | +import type { http } from '@/typing/http'; | |
4 | 4 | |
5 | 5 | /** 获取题库列表 */ |
6 | -export function getQuestionBankListApi( | |
7 | - params: QuestionBank.QueryParams | |
8 | -): http.PromisePageResp<QuestionBank.List> { | |
6 | +export function getQuestionBankListApi(params: QuestionBank.QueryParams): http.PromisePageResp<QuestionBank.List> { | |
9 | 7 | return request.get(`${ABILITY_HOST}/erp/question/factory/list`, { params }); |
10 | 8 | } |
11 | 9 | |
... | ... | @@ -22,9 +20,7 @@ export function deleteQuestionBankApi(id: number) { |
22 | 20 | } |
23 | 21 | |
24 | 22 | /** 获取题目列表 */ |
25 | -export function getQuestionListApi(params: { | |
26 | - factoryId: number; | |
27 | -}): http.PromisePageResp<QuestionBank.Question> { | |
23 | +export function getQuestionListApi(params: { factoryId: number }): http.PromisePageResp<QuestionBank.Question> { | |
28 | 24 | return request.get(`${ABILITY_HOST}/erp/question/info/list`, { params }); |
29 | 25 | } |
30 | 26 | |
... | ... | @@ -45,11 +41,7 @@ export function deleteQuestionApi(id: number) { |
45 | 41 | * @param {QuestionBank.ImportQuestionParams} params |
46 | 42 | */ |
47 | 43 | export function importQuestionApi(params: QuestionBank.ImportQuestionParams) { |
48 | - return request.post<string>( | |
49 | - `${ABILITY_HOST}/erp/question/import/excel`, | |
50 | - params, | |
51 | - { contentType: "form-data" } | |
52 | - ); | |
44 | + return request.post<string>(`${ABILITY_HOST}/erp/question/import/excel`, params, { contentType: 'form-data' }); | |
53 | 45 | } |
54 | 46 | |
55 | 47 | /** |
... | ... | @@ -57,9 +49,7 @@ export function importQuestionApi(params: QuestionBank.ImportQuestionParams) { |
57 | 49 | * @param {QuestionBank.QueryParams} params |
58 | 50 | * @return {http.PromisePageResp<QuestionBank.List>} |
59 | 51 | */ |
60 | -export function getDraftListApi( | |
61 | - params: QuestionBank.QueryParams | |
62 | -): http.PromisePageResp<QuestionBank.List> { | |
52 | +export function getDraftListApi(params: QuestionBank.QueryParams): http.PromisePageResp<QuestionBank.List> { | |
63 | 53 | return request.get(`${ABILITY_HOST}/erp/draft/page`, { params }); |
64 | 54 | } |
65 | 55 | |
... | ... | @@ -68,9 +58,7 @@ export function getDraftListApi( |
68 | 58 | * @param {QuestionBank.List} params |
69 | 59 | * @return {http.PromiseResp<string>} |
70 | 60 | */ |
71 | -export function saveDraftApi( | |
72 | - params: QuestionBank.List | |
73 | -): http.PromiseResp<string> { | |
61 | +export function saveDraftApi(params: QuestionBank.List): http.PromiseResp<string> { | |
74 | 62 | return request.post(`${ABILITY_HOST}/erp/draft/save`, params); |
75 | 63 | } |
76 | 64 | |
... | ... | @@ -79,9 +67,7 @@ export function saveDraftApi( |
79 | 67 | * @param {number} factoryId |
80 | 68 | * @return {http.PromiseResp<QuestionBank.List>} |
81 | 69 | */ |
82 | -export function getDraftByFactoryIdApi( | |
83 | - factoryId: number | |
84 | -): http.PromiseResp<QuestionBank.List> { | |
70 | +export function getDraftByFactoryIdApi(factoryId: number): http.PromiseResp<QuestionBank.List> { | |
85 | 71 | return request.get(`${ABILITY_HOST}/erp/draft/by/factory`, { |
86 | 72 | params: { factoryId }, |
87 | 73 | }); |
... | ... | @@ -103,9 +89,7 @@ export function deleteDraftApi(draftId: number): http.PromiseResp<string> { |
103 | 89 | * @param {QuestionBank.DraftQuestionParams} params |
104 | 90 | * @return {http.PromiseRespA<QuestionBank.Question>} |
105 | 91 | */ |
106 | -export function getQuestionListByDraftApi( | |
107 | - params: QuestionBank.DraftQuestionParams | |
108 | -): http.PromiseRespA<QuestionBank.Question> { | |
92 | +export function getQuestionListByDraftApi(params: QuestionBank.DraftQuestionParams): http.PromiseRespA<QuestionBank.Question> { | |
109 | 93 | return request.get(`${ABILITY_HOST}/erp/draft/question/list`, { |
110 | 94 | params, |
111 | 95 | }); |
... | ... | @@ -116,9 +100,7 @@ export function getQuestionListByDraftApi( |
116 | 100 | * @param {QuestionBank.Question} params |
117 | 101 | * @return {http.PromiseResp<number>} |
118 | 102 | */ |
119 | -export function saveDraftQuestionApi( | |
120 | - params: QuestionBank.Question | |
121 | -): http.PromiseResp<number> { | |
103 | +export function saveDraftQuestionApi(params: QuestionBank.Question): http.PromiseResp<number> { | |
122 | 104 | return request.post(`${ABILITY_HOST}/erp/draft/question/save`, params); |
123 | 105 | } |
124 | 106 | |
... | ... | @@ -127,9 +109,7 @@ export function saveDraftQuestionApi( |
127 | 109 | * @param {QuestionBank.DeleteDraftQuestionParams} params |
128 | 110 | * @return {http.PromiseResp<string>} |
129 | 111 | */ |
130 | -export function deleteDraftQuestionApi( | |
131 | - params: QuestionBank.DeleteDraftQuestionParams | |
132 | -): http.PromiseResp<string> { | |
112 | +export function deleteDraftQuestionApi(params: QuestionBank.DeleteDraftQuestionParams): http.PromiseResp<string> { | |
133 | 113 | return request.post(`${ABILITY_HOST}/erp/draft/question/remove`, params); |
134 | 114 | } |
135 | 115 | |
... | ... | @@ -138,13 +118,8 @@ export function deleteDraftQuestionApi( |
138 | 118 | * @param {QuestionBank.BatchDeleteDraftQuestionParams} params |
139 | 119 | * @return {http.PromiseResp<string>} |
140 | 120 | */ |
141 | -export function batchDeleteDraftQuestionApi( | |
142 | - params: QuestionBank.BatchDeleteDraftQuestionParams | |
143 | -): http.PromiseResp<string> { | |
144 | - return request.post( | |
145 | - `${ABILITY_HOST}/erp/draft/question/batch/remove`, | |
146 | - params | |
147 | - ); | |
121 | +export function batchDeleteDraftQuestionApi(params: QuestionBank.BatchDeleteDraftQuestionParams): http.PromiseResp<string> { | |
122 | + return request.post(`${ABILITY_HOST}/erp/draft/question/batch/remove`, params); | |
148 | 123 | } |
149 | 124 | |
150 | 125 | /** |
... | ... | @@ -152,9 +127,7 @@ export function batchDeleteDraftQuestionApi( |
152 | 127 | * @param {number} draftId |
153 | 128 | * @return {http.PromiseResp<string>} |
154 | 129 | */ |
155 | -export function deleteAllDraftQuestionApi( | |
156 | - draftId: number | |
157 | -): http.PromiseResp<string> { | |
130 | +export function deleteAllDraftQuestionApi(draftId: number): http.PromiseResp<string> { | |
158 | 131 | return request.get(`${ABILITY_HOST}/erp/draft/question/all/remove`, { |
159 | 132 | params: { draftId }, |
160 | 133 | }); |
... | ... | @@ -166,11 +139,7 @@ export function deleteAllDraftQuestionApi( |
166 | 139 | * @return {http.PromiseResp<string>} |
167 | 140 | */ |
168 | 141 | export function approvalDraftApi(draftId: number): http.PromiseResp<string> { |
169 | - return request.post( | |
170 | - `${ABILITY_HOST}/erp/draft/submit`, | |
171 | - { draftId }, | |
172 | - { contentType: "form-data" } | |
173 | - ); | |
142 | + return request.post(`${ABILITY_HOST}/erp/draft/submit`, { draftId }, { contentType: 'form-data' }); | |
174 | 143 | } |
175 | 144 | |
176 | 145 | /** |
... | ... | @@ -178,9 +147,7 @@ export function approvalDraftApi(draftId: number): http.PromiseResp<string> { |
178 | 147 | * @param {number} factoryId |
179 | 148 | * @return {*} |
180 | 149 | */ |
181 | -export function exportQuestionBankApi( | |
182 | - factoryId: number | |
183 | -): http.PromiseResp<BlobPart> { | |
150 | +export function exportQuestionBankApi(factoryId: number): http.PromiseResp<BlobPart> { | |
184 | 151 | return request.get(`${ABILITY_HOST}/erp/question/export/question`, { |
185 | 152 | params: { factoryId }, |
186 | 153 | }); |
... | ... | @@ -202,10 +169,17 @@ export function exportDraftApi(draftId: number): http.PromiseResp<BlobPart> { |
202 | 169 | * @param {QuestionBank.ImportQuestionParams} params |
203 | 170 | * @return {http.PromiseResp<string>} |
204 | 171 | */ |
205 | -export function importDraftQuestionApi( | |
206 | - params: QuestionBank.ImportQuestionParams | |
207 | -): http.PromiseResp<string> { | |
172 | +export function importDraftQuestionApi(params: QuestionBank.ImportQuestionParams): http.PromiseResp<string> { | |
208 | 173 | return request.post(`${ABILITY_HOST}/erp/draft/import/excel`, params, { |
209 | - contentType: "form-data", | |
174 | + contentType: 'form-data', | |
210 | 175 | }); |
211 | 176 | } |
177 | + | |
178 | +/** | |
179 | + * @description: 撤销草稿审批 | |
180 | + * @param {string} auditNo | |
181 | + * @return {http.PromiseResp<string>} | |
182 | + */ | |
183 | +export function cancelDraftApprovalApi(auditNo: string): http.PromiseResp<string> { | |
184 | + return request.get(`${ABILITY_HOST}/erp/draft/cancel/audit`, { params: { auditNo } }); | |
185 | +} | ... | ... |
src/pages/ehr/ProgramOfStudy/QuestionBank/components/QuestionBankList/components/DraftList/index.tsx
1 | 1 | /* |
2 | 2 | * @Date: 2021-07-26 17:19:45 |
3 | 3 | * @LastEditors: wangqiang@feewee.cn |
4 | - * @LastEditTime: 2023-09-02 15:51:55 | |
4 | + * @LastEditTime: 2024-03-29 16:46:18 | |
5 | 5 | */ |
6 | 6 | import React, { useEffect } from 'react'; |
7 | 7 | import { useStore } from '../../../../index'; |
8 | -import { deleteDraftApi, approvalDraftApi } from '../../../../api'; | |
8 | +import { deleteDraftApi, approvalDraftApi, cancelDraftApprovalApi } from '../../../../api'; | |
9 | 9 | import { Badge, Button, Divider, Input, message, Modal, Popconfirm, Row, Table } from 'antd'; |
10 | 10 | import { PlusOutlined } from '@ant-design/icons'; |
11 | 11 | import QuestionBankModal from '../../QuestionBankModal'; |
... | ... | @@ -92,6 +92,19 @@ export default function DraftList() { |
92 | 92 | message.error(error.message); |
93 | 93 | }); |
94 | 94 | }; |
95 | + const cancelApprovalDraft = (auditNo: string) => { | |
96 | + const hide = message.loading('撤销中,请稍后...', 0); | |
97 | + cancelDraftApprovalApi(auditNo) | |
98 | + .then((res) => { | |
99 | + hide(); | |
100 | + message.success(res.result); | |
101 | + setLoading(true); | |
102 | + }) | |
103 | + .catch((error) => { | |
104 | + hide(); | |
105 | + message.error(error.message); | |
106 | + }); | |
107 | + }; | |
95 | 108 | |
96 | 109 | return ( |
97 | 110 | <> |
... | ... | @@ -210,7 +223,14 @@ export default function DraftList() { |
210 | 223 | <Divider type="vertical" /> |
211 | 224 | </> |
212 | 225 | ) : null} |
213 | - {record.status === StatusText.审批中 ? null : ( | |
226 | + {record.status === StatusText.审批中 ? ( | |
227 | + <> | |
228 | + <Popconfirm title={`确定撤销【${record.name}】审批?`} onConfirm={() => cancelApprovalDraft(record.auditNo ?? '')}> | |
229 | + <a style={{ color: 'red' }}>撤销审批</a> | |
230 | + </Popconfirm> | |
231 | + <Divider type="vertical" /> | |
232 | + </> | |
233 | + ) : ( | |
214 | 234 | <> |
215 | 235 | <a |
216 | 236 | onClick={() => { | ... | ... |