Commit 66e38ec1a43cd69ca675872f0ba947d8fd0b1229
Merge branch 'feature-addautoresearchgroup' into dev
Showing
3 changed files
with
268 additions
and
41 deletions
src/pages/Order/OrderList/OrderDrawer.tsx
... | ... | @@ -11,6 +11,7 @@ import { |
11 | 11 | postKingdeeRepMaterialUnit, |
12 | 12 | postKingdeeRepMeasureUnit, |
13 | 13 | postPrepaidPhoneAvailableList, |
14 | + postResearchGroupsMemberExists, | |
14 | 15 | postResearchGroupsNameSet, |
15 | 16 | postServiceConstCompanyType, |
16 | 17 | postServiceConstOrderSource, |
... | ... | @@ -1242,49 +1243,132 @@ export default ({ onClose, data, subOrders, orderOptType }) => { |
1242 | 1243 | <ProFormDependency name={['companyType']}> |
1243 | 1244 | {({ companyType }) => { |
1244 | 1245 | const renderInstitutionContactName = () => ( |
1245 | - <Group> | |
1246 | - <ProFormSelect | |
1247 | - key="institutionContactName" | |
1248 | - width="xl" | |
1249 | - showSearch | |
1250 | - name="institutionContactName" | |
1251 | - rules={[{ required: true, message: '请输入课题组名称!' }]} | |
1252 | - request={async (value) => { | |
1253 | - const keywords = value?.keyWords || ''; | |
1254 | - const res = await postResearchGroupsNameSet({ | |
1255 | - data: { status: 'ADD_AUDIT_PASS', groupName: keywords }, | |
1256 | - }); | |
1257 | - return Object.entries(res?.data || {}).map( | |
1258 | - ([researchGroupsId, researchGroupsName]) => ({ | |
1259 | - label: researchGroupsName, | |
1260 | - value: researchGroupsName, // 使用 researchGroupsId 作为 value | |
1261 | - key: researchGroupsId, | |
1262 | - id: researchGroupsId, | |
1263 | - }), | |
1264 | - ); | |
1265 | - }} | |
1266 | - fieldProps={{ | |
1267 | - filterOption: () => true, | |
1268 | - onChange: (_, option) => { | |
1269 | - form.setFieldsValue({ | |
1270 | - researchGroupId: option?.id || '', | |
1246 | + <> | |
1247 | + <Group> | |
1248 | + <ProFormSelect | |
1249 | + key="institutionContactName" | |
1250 | + width="xl" | |
1251 | + showSearch | |
1252 | + name="institutionContactName" | |
1253 | + rules={[{ required: true, message: '请输入课题组名称!' }]} | |
1254 | + request={async (value) => { | |
1255 | + const keywords = value?.keyWords || ''; | |
1256 | + const res = await postResearchGroupsNameSet({ | |
1257 | + data: { | |
1258 | + status: 'ADD_AUDIT_PASS', | |
1259 | + groupName: keywords, | |
1260 | + }, | |
1271 | 1261 | }); |
1272 | - }, | |
1262 | + return Object.entries(res?.data || {}).map( | |
1263 | + ([researchGroupsId, researchGroupsName]) => ({ | |
1264 | + label: researchGroupsName, | |
1265 | + value: researchGroupsName, // 使用 researchGroupsId 作为 value | |
1266 | + key: researchGroupsId, | |
1267 | + id: researchGroupsId, | |
1268 | + }), | |
1269 | + ); | |
1270 | + }} | |
1271 | + fieldProps={{ | |
1272 | + filterOption: () => true, | |
1273 | + onChange: async (_, option) => { | |
1274 | + const researchGroupId = option?.id || ''; | |
1275 | + form.setFieldsValue({ | |
1276 | + researchGroupId: researchGroupId, | |
1277 | + }); | |
1278 | + | |
1279 | + // 检查用户是否已经是该课题组成员 | |
1280 | + if (researchGroupId) { | |
1281 | + const customerContact = form.getFieldValue( | |
1282 | + 'customerContactNumber', | |
1283 | + ); | |
1284 | + if (customerContact) { | |
1285 | + try { | |
1286 | + const res = | |
1287 | + await postResearchGroupsMemberExists({ | |
1288 | + query: { | |
1289 | + customerContact, | |
1290 | + researchGroupId: Number(researchGroupId), | |
1291 | + }, | |
1292 | + }); | |
1293 | + | |
1294 | + // 响应码200表示请求成功,值为false表示用户不是课题组成员 | |
1295 | + // 必须先检查res是否存在并且是否有200属性 | |
1296 | + console.log(res, '5656res'); | |
1297 | + const isMember = res; | |
1298 | + | |
1299 | + if (!isMember) { | |
1300 | + // 显示用户将被添加到课题组的信息 | |
1301 | + form.setFields([ | |
1302 | + { | |
1303 | + name: 'researchGroupWarning', | |
1304 | + value: true, | |
1305 | + }, | |
1306 | + ]); | |
1307 | + } else { | |
1308 | + form.setFields([ | |
1309 | + { | |
1310 | + name: 'researchGroupWarning', | |
1311 | + value: false, | |
1312 | + }, | |
1313 | + ]); | |
1314 | + } | |
1315 | + } catch (error) { | |
1316 | + console.error('检查课题组成员失败:', error); | |
1317 | + } | |
1318 | + } | |
1319 | + } | |
1320 | + }, | |
1321 | + }} | |
1322 | + debounceTime={1000} | |
1323 | + label="课题组名称" | |
1324 | + placeholder="请输入名称" | |
1325 | + /> | |
1326 | + <ProFormDigit | |
1327 | + readonly | |
1328 | + key="researchGroupId" | |
1329 | + width="md" | |
1330 | + name="researchGroupId" | |
1331 | + label="课题组Id" | |
1332 | + fieldProps={{ precision: 0 }} // 只允许整数 | |
1333 | + rules={[{ required: true, message: '请重新选择课题组!' }]} | |
1334 | + /> | |
1335 | + </Group> | |
1336 | + <ProFormDependency | |
1337 | + name={[ | |
1338 | + 'researchGroupWarning', | |
1339 | + 'institutionContactName', | |
1340 | + 'researchGroupId', | |
1341 | + ]} | |
1342 | + > | |
1343 | + {({ | |
1344 | + researchGroupWarning, | |
1345 | + institutionContactName, | |
1346 | + researchGroupId, | |
1347 | + }) => { | |
1348 | + if ( | |
1349 | + researchGroupWarning && | |
1350 | + institutionContactName && | |
1351 | + researchGroupId | |
1352 | + ) { | |
1353 | + const customerNameString = | |
1354 | + form.getFieldValue('customerNameString') || '客户'; | |
1355 | + return ( | |
1356 | + <div | |
1357 | + style={{ | |
1358 | + color: 'red', | |
1359 | + marginBottom: '15px', | |
1360 | + marginTop: '0px', | |
1361 | + }} | |
1362 | + > | |
1363 | + 订单提交后{customerNameString}将默认加入 | |
1364 | + {institutionContactName}课题组 | |
1365 | + </div> | |
1366 | + ); | |
1367 | + } | |
1368 | + return null; | |
1273 | 1369 | }} |
1274 | - debounceTime={1000} | |
1275 | - label="课题组名称" | |
1276 | - placeholder="请输入名称" | |
1277 | - /> | |
1278 | - <ProFormDigit | |
1279 | - readonly | |
1280 | - key="researchGroupId" | |
1281 | - width="md" | |
1282 | - name="researchGroupId" | |
1283 | - label="课题组Id" | |
1284 | - fieldProps={{ precision: 0 }} // 只允许整数 | |
1285 | - rules={[{ required: true, message: '请重新选择课题组!' }]} | |
1286 | - /> | |
1287 | - </Group> | |
1370 | + </ProFormDependency> | |
1371 | + </> | |
1288 | 1372 | ); |
1289 | 1373 | const renderPlatformType = (fieldKey) => ( |
1290 | 1374 | <ProFormSelect | ... | ... |
src/services/definition.ts
... | ... | @@ -3838,6 +3838,12 @@ export interface ResearchGroupListRequest { |
3838 | 3838 | end?: number; |
3839 | 3839 | /** |
3840 | 3840 | * @description |
3841 | + * 课题组ID | |
3842 | + * @format int64 | |
3843 | + */ | |
3844 | + groupId?: number; | |
3845 | + /** | |
3846 | + * @description | |
3841 | 3847 | * 课题组名称 |
3842 | 3848 | */ |
3843 | 3849 | groupName?: string; |
... | ... | @@ -4134,6 +4140,12 @@ export interface ResearchGroupsAccessDTO { |
4134 | 4140 | deleteFlag?: number; |
4135 | 4141 | /** |
4136 | 4142 | * @description |
4143 | + * 课题组id | |
4144 | + * @format int64 | |
4145 | + */ | |
4146 | + groupId?: number; | |
4147 | + /** | |
4148 | + * @description | |
4137 | 4149 | * 课题组名称 |
4138 | 4150 | */ |
4139 | 4151 | groupName?: string; | ... | ... |
src/services/request.ts
... | ... | @@ -15311,6 +15311,82 @@ export const postResearchGroupsList = /* #__PURE__ */ (() => { |
15311 | 15311 | return request; |
15312 | 15312 | })(); |
15313 | 15313 | |
15314 | +/** @description request parameter type for postResearchGroupsMemberExists */ | |
15315 | +export interface PostResearchGroupsMemberExistsOption { | |
15316 | + /** | |
15317 | + * @description | |
15318 | + * customerContact | |
15319 | + */ | |
15320 | + query?: { | |
15321 | + /** | |
15322 | + @description | |
15323 | + customerContact */ | |
15324 | + customerContact?: string; | |
15325 | + /** | |
15326 | + @description | |
15327 | + researchGroupId | |
15328 | + @format int64 */ | |
15329 | + researchGroupId?: number; | |
15330 | + }; | |
15331 | +} | |
15332 | + | |
15333 | +/** @description response type for postResearchGroupsMemberExists */ | |
15334 | +export interface PostResearchGroupsMemberExistsResponse { | |
15335 | + /** | |
15336 | + * @description | |
15337 | + * OK | |
15338 | + */ | |
15339 | + 200: boolean; | |
15340 | + /** | |
15341 | + * @description | |
15342 | + * Created | |
15343 | + */ | |
15344 | + 201: any; | |
15345 | + /** | |
15346 | + * @description | |
15347 | + * Unauthorized | |
15348 | + */ | |
15349 | + 401: any; | |
15350 | + /** | |
15351 | + * @description | |
15352 | + * Forbidden | |
15353 | + */ | |
15354 | + 403: any; | |
15355 | + /** | |
15356 | + * @description | |
15357 | + * Not Found | |
15358 | + */ | |
15359 | + 404: any; | |
15360 | +} | |
15361 | + | |
15362 | +export type PostResearchGroupsMemberExistsResponseSuccess = | |
15363 | + PostResearchGroupsMemberExistsResponse[200]; | |
15364 | +/** | |
15365 | + * @description | |
15366 | + * 查询课题组成员 | |
15367 | + * @tags research-groups-controller | |
15368 | + * @produces * | |
15369 | + * @consumes application/json | |
15370 | + */ | |
15371 | +export const postResearchGroupsMemberExists = /* #__PURE__ */ (() => { | |
15372 | + const method = 'post'; | |
15373 | + const url = '/research/groups/memberExists'; | |
15374 | + function request( | |
15375 | + option?: PostResearchGroupsMemberExistsOption, | |
15376 | + ): Promise<PostResearchGroupsMemberExistsResponseSuccess> { | |
15377 | + return requester(request.url, { | |
15378 | + method: request.method, | |
15379 | + ...option, | |
15380 | + }) as unknown as Promise<PostResearchGroupsMemberExistsResponseSuccess>; | |
15381 | + } | |
15382 | + | |
15383 | + /** http method */ | |
15384 | + request.method = method; | |
15385 | + /** request url */ | |
15386 | + request.url = url; | |
15387 | + return request; | |
15388 | +})(); | |
15389 | + | |
15314 | 15390 | /** @description request parameter type for postResearchGroupsNameSet */ |
15315 | 15391 | export interface PostResearchGroupsNameSetOption { |
15316 | 15392 | /** |
... | ... | @@ -21089,6 +21165,61 @@ export const postServiceOrderAuditPaymentReceipt = /* #__PURE__ */ (() => { |
21089 | 21165 | return request; |
21090 | 21166 | })(); |
21091 | 21167 | |
21168 | +/** @description response type for postServiceOrderBatchCaculateAndSetIntegral */ | |
21169 | +export interface PostServiceOrderBatchCaculateAndSetIntegralResponse { | |
21170 | + /** | |
21171 | + * @description | |
21172 | + * OK | |
21173 | + */ | |
21174 | + 200: ServerResult; | |
21175 | + /** | |
21176 | + * @description | |
21177 | + * Created | |
21178 | + */ | |
21179 | + 201: any; | |
21180 | + /** | |
21181 | + * @description | |
21182 | + * Unauthorized | |
21183 | + */ | |
21184 | + 401: any; | |
21185 | + /** | |
21186 | + * @description | |
21187 | + * Forbidden | |
21188 | + */ | |
21189 | + 403: any; | |
21190 | + /** | |
21191 | + * @description | |
21192 | + * Not Found | |
21193 | + */ | |
21194 | + 404: any; | |
21195 | +} | |
21196 | + | |
21197 | +export type PostServiceOrderBatchCaculateAndSetIntegralResponseSuccess = | |
21198 | + PostServiceOrderBatchCaculateAndSetIntegralResponse[200]; | |
21199 | +/** | |
21200 | + * @description | |
21201 | + * 计算积分 | |
21202 | + * @tags 内部订单 | |
21203 | + * @produces * | |
21204 | + * @consumes application/json | |
21205 | + */ | |
21206 | +export const postServiceOrderBatchCaculateAndSetIntegral = | |
21207 | + /* #__PURE__ */ (() => { | |
21208 | + const method = 'post'; | |
21209 | + const url = '/service/order/batchCaculateAndSetIntegral'; | |
21210 | + function request(): Promise<PostServiceOrderBatchCaculateAndSetIntegralResponseSuccess> { | |
21211 | + return requester(request.url, { | |
21212 | + method: request.method, | |
21213 | + }) as unknown as Promise<PostServiceOrderBatchCaculateAndSetIntegralResponseSuccess>; | |
21214 | + } | |
21215 | + | |
21216 | + /** http method */ | |
21217 | + request.method = method; | |
21218 | + /** request url */ | |
21219 | + request.url = url; | |
21220 | + return request; | |
21221 | + })(); | |
21222 | + | |
21092 | 21223 | /** @description request parameter type for postServiceOrderCancelSend */ |
21093 | 21224 | export interface PostServiceOrderCancelSendOption { |
21094 | 21225 | /** | ... | ... |