Commit be9630d30f53c73f79fe4ed1ffcdae9551eef6e6
1 parent
b966b1f3
feat: update 课题组模块开发
Showing
4 changed files
with
417 additions
and
261 deletions
src/pages/ResearchGroup/components/ResearchGroupAddModal.tsx
| ... | ... | @@ -3,6 +3,7 @@ import { |
| 3 | 3 | postCanrdApiUserAddressList, |
| 4 | 4 | postCanrdApiUserList, |
| 5 | 5 | postResearchGroupsAdd, |
| 6 | + postResearchGroupsDetail, | |
| 6 | 7 | } from '@/services'; |
| 7 | 8 | import { getDefaultString, isEmpty } from '@/utils/StringUtil'; |
| 8 | 9 | import { getRandomNumber } from '@/utils/numberUtil'; |
| ... | ... | @@ -15,16 +16,34 @@ import { |
| 15 | 16 | ProFormSelect, |
| 16 | 17 | ProFormText, |
| 17 | 18 | } from '@ant-design/pro-components'; |
| 18 | -import { Button, Form, message } from 'antd'; | |
| 19 | +import { Button, Form, Spin, message } from 'antd'; | |
| 19 | 20 | import { useEffect, useState } from 'react'; |
| 20 | 21 | import '../index.less'; |
| 21 | 22 | |
| 22 | 23 | // import { cloneDeep } from 'lodash'; |
| 23 | -export default ({ setVisible, onClose }) => { | |
| 24 | +export default ({ setVisible, researchGroupId, onClose }) => { | |
| 24 | 25 | const [form] = Form.useForm(); |
| 25 | 26 | const [salesCodeOptions, setSalesCodeOptions] = useState([]); |
| 26 | 27 | const [memberOptions, setMemberOptions] = useState<any[]>([]); |
| 27 | 28 | const [accountOptions, setAccountOptions] = useState<any[]>([]); |
| 29 | + const [researchGroupInfo, setResearchGroupInfo] = useState<any>(null); | |
| 30 | + const [modalLoading, setModalLoading] = useState(false); | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * 获取课题组信息 | |
| 34 | + * @returns | |
| 35 | + */ | |
| 36 | + const loadResearchGroupInfo = async () => { | |
| 37 | + if (researchGroupId === null) { | |
| 38 | + return; | |
| 39 | + } | |
| 40 | + setModalLoading(true); | |
| 41 | + let res = await postResearchGroupsDetail({ data: { id: researchGroupId } }); | |
| 42 | + if (res && res.result === RESPONSE_CODE.SUCCESS) { | |
| 43 | + setResearchGroupInfo(res.data); | |
| 44 | + } | |
| 45 | + setModalLoading(false); | |
| 46 | + }; | |
| 28 | 47 | |
| 29 | 48 | /** |
| 30 | 49 | * 获取销售代码枚举,在复制和编辑的时候判断是否为旧的代码 |
| ... | ... | @@ -185,9 +204,62 @@ export default ({ setVisible, onClose }) => { |
| 185 | 204 | return values; |
| 186 | 205 | } |
| 187 | 206 | |
| 207 | + /** | |
| 208 | + * 设置表单默认信息 | |
| 209 | + * @returns | |
| 210 | + */ | |
| 211 | + const loadFormDefaultValue = async () => { | |
| 212 | + if (!researchGroupInfo) { | |
| 213 | + return; | |
| 214 | + } | |
| 215 | + | |
| 216 | + let members = researchGroupInfo.members; | |
| 217 | + if (members !== null) { | |
| 218 | + let newMemberOptions = []; | |
| 219 | + for (let member of members) { | |
| 220 | + let name = member.memberName; | |
| 221 | + let phone = member.memberPhone; | |
| 222 | + let id = member.id; | |
| 223 | + newMemberOptions.push({ realName: name, phone: phone, value: id }); | |
| 224 | + } | |
| 225 | + setMemberOptions(newMemberOptions); | |
| 226 | + form.setFieldValue( | |
| 227 | + 'members', | |
| 228 | + members?.map((item: any) => { | |
| 229 | + return item.id; | |
| 230 | + }), | |
| 231 | + ); | |
| 232 | + } | |
| 233 | + | |
| 234 | + let accounts = researchGroupInfo.accounts; | |
| 235 | + if (accounts !== null) { | |
| 236 | + let accountIds = accounts.map((item: any) => { | |
| 237 | + return item.id; | |
| 238 | + }); | |
| 239 | + let res = await postCanrdApiUserList({ data: { uids: accountIds } }); | |
| 240 | + if (res && res.result === RESPONSE_CODE.SUCCESS && res.data) { | |
| 241 | + let newAccountOptions = res?.data?.map((item) => { | |
| 242 | + item.value = item.id; | |
| 243 | + return item; | |
| 244 | + }); | |
| 245 | + setAccountOptions(newAccountOptions); | |
| 246 | + form.setFieldValue('accounts', accountIds); | |
| 247 | + } | |
| 248 | + } | |
| 249 | + | |
| 250 | + form.setFieldValue('group', researchGroupInfo.groupName); | |
| 251 | + form.setFieldValue('leader', researchGroupInfo.leaderName); | |
| 252 | + }; | |
| 253 | + | |
| 188 | 254 | useEffect(() => { |
| 189 | 255 | loadSalesCodeOptions(); |
| 256 | + loadResearchGroupInfo(); | |
| 190 | 257 | }, []); |
| 258 | + | |
| 259 | + useEffect(() => { | |
| 260 | + loadFormDefaultValue(); | |
| 261 | + }, [researchGroupInfo]); | |
| 262 | + | |
| 191 | 263 | return ( |
| 192 | 264 | <div className="research-group-index"> |
| 193 | 265 | <ModalForm |
| ... | ... | @@ -218,209 +290,215 @@ export default ({ setVisible, onClose }) => { |
| 218 | 290 | }} |
| 219 | 291 | onOpenChange={setVisible} |
| 220 | 292 | > |
| 221 | - <ProForm.Group> | |
| 222 | - <ProFormText | |
| 223 | - name="group" | |
| 224 | - label="课题组名称" | |
| 225 | - placeholder="请输入课题组名称" | |
| 226 | - rules={[{ required: true, message: '请输入课题组名称' }]} | |
| 293 | + <Spin spinning={modalLoading} tip="加载中..."> | |
| 294 | + <ProForm.Group> | |
| 295 | + <ProFormText | |
| 296 | + name="group" | |
| 297 | + label="课题组名称" | |
| 298 | + placeholder="请输入课题组名称" | |
| 299 | + rules={[{ required: true, message: '请输入课题组名称' }]} | |
| 300 | + /> | |
| 301 | + <ProFormSelect | |
| 302 | + name="leader" | |
| 303 | + key="leader" | |
| 304 | + width="lg" | |
| 305 | + showSearch | |
| 306 | + label="负责人" | |
| 307 | + placeholder="请输入课题组负责人" | |
| 308 | + rules={[{ required: true, message: '请输入课题组负责人' }]} | |
| 309 | + options={salesCodeOptions} | |
| 310 | + /> | |
| 311 | + </ProForm.Group> | |
| 312 | + | |
| 313 | + <ProFormSelect | |
| 314 | + name="accounts" | |
| 315 | + key="accounts" | |
| 316 | + width="lg" | |
| 317 | + showSearch | |
| 318 | + label="绑定预存账号(可多选)" | |
| 319 | + placeholder="请选择预存账号" | |
| 320 | + onChange={(_, option) => { | |
| 321 | + autoAccountSelectOptions(option); | |
| 322 | + }} | |
| 323 | + rules={[{ required: true, message: '请至少选择绑定一个预存账号' }]} | |
| 324 | + fieldProps={{ | |
| 325 | + mode: 'multiple', | |
| 326 | + filterOption() { | |
| 327 | + return true; | |
| 328 | + }, | |
| 329 | + optionItemRender(item: any) { | |
| 330 | + let name = | |
| 331 | + item.label + | |
| 332 | + ' | ' + | |
| 333 | + item.institution + | |
| 334 | + ' | ' + | |
| 335 | + item.nowMoney + | |
| 336 | + '¥' + | |
| 337 | + ' | ' + | |
| 338 | + item.phone; | |
| 339 | + return ( | |
| 340 | + <div title={name}> | |
| 341 | + <span style={{ color: '#333333' }}>{name}</span> | |
| 342 | + </div> | |
| 343 | + ); | |
| 344 | + }, | |
| 345 | + }} | |
| 346 | + debounceTime={1000} | |
| 347 | + request={async (value, {}) => { | |
| 348 | + const keywords = value.keyWords; | |
| 349 | + const res = await postCanrdApiUserList({ | |
| 350 | + data: { keywords: keywords, pageSize: 20 }, | |
| 351 | + }); | |
| 352 | + let options = res?.data?.data?.map((c: any) => { | |
| 353 | + return { | |
| 354 | + ...c, | |
| 355 | + label: c.realName, | |
| 356 | + value: c.uid, | |
| 357 | + key: c.uid, | |
| 358 | + }; | |
| 359 | + }); | |
| 360 | + return options; | |
| 361 | + }} | |
| 227 | 362 | /> |
| 363 | + | |
| 228 | 364 | <ProFormSelect |
| 229 | - name="leader" | |
| 230 | - key="leader" | |
| 365 | + name="members" | |
| 366 | + key="members" | |
| 231 | 367 | width="lg" |
| 232 | 368 | showSearch |
| 233 | - label="负责人" | |
| 234 | - placeholder="请输入课题组负责人" | |
| 235 | - rules={[{ required: true, message: '请输入课题组负责人' }]} | |
| 236 | - options={salesCodeOptions} | |
| 369 | + label="课题组成员" | |
| 370 | + placeholder="请添加课题组成员" | |
| 371 | + fieldProps={{ | |
| 372 | + mode: 'multiple', | |
| 373 | + filterOption() { | |
| 374 | + return true; | |
| 375 | + }, | |
| 376 | + optionItemRender(item: any) { | |
| 377 | + let name = item.realName + ' | ' + item.phone; | |
| 378 | + return ( | |
| 379 | + <div title={name}> | |
| 380 | + <span style={{ color: '#333333' }}>{name}</span> | |
| 381 | + </div> | |
| 382 | + ); | |
| 383 | + }, | |
| 384 | + }} | |
| 385 | + options={memberOptions} | |
| 237 | 386 | /> |
| 238 | - </ProForm.Group> | |
| 239 | 387 | |
| 240 | - <ProFormSelect | |
| 241 | - name="accounts" | |
| 242 | - key="accounts" | |
| 243 | - width="lg" | |
| 244 | - showSearch | |
| 245 | - label="绑定预存账号(可多选)" | |
| 246 | - placeholder="请选择预存账号" | |
| 247 | - onChange={(_, option) => { | |
| 248 | - autoAccountSelectOptions(option); | |
| 249 | - }} | |
| 250 | - rules={[{ required: true, message: '请至少选择绑定一个预存账号' }]} | |
| 251 | - fieldProps={{ | |
| 252 | - mode: 'multiple', | |
| 253 | - filterOption() { | |
| 254 | - return true; | |
| 255 | - }, | |
| 256 | - optionItemRender(item: any) { | |
| 257 | - let name = | |
| 258 | - item.label + | |
| 259 | - ' | ' + | |
| 260 | - item.institution + | |
| 261 | - ' | ' + | |
| 262 | - item.nowMoney + | |
| 263 | - '¥' + | |
| 264 | - ' | ' + | |
| 265 | - item.phone; | |
| 266 | - return ( | |
| 267 | - <div title={name}> | |
| 268 | - <span style={{ color: '#333333' }}>{name}</span> | |
| 269 | - </div> | |
| 270 | - ); | |
| 271 | - }, | |
| 272 | - }} | |
| 273 | - debounceTime={1000} | |
| 274 | - request={async (value, {}) => { | |
| 275 | - const keywords = value.keyWords; | |
| 276 | - const res = await postCanrdApiUserList({ | |
| 277 | - data: { keywords: keywords, pageSize: 20 }, | |
| 278 | - }); | |
| 279 | - let options = res?.data?.data?.map((c: any) => { | |
| 280 | - return { | |
| 281 | - ...c, | |
| 282 | - label: c.realName, | |
| 283 | - value: c.uid, | |
| 284 | - key: c.uid, | |
| 285 | - }; | |
| 286 | - }); | |
| 287 | - return options; | |
| 288 | - }} | |
| 289 | - /> | |
| 388 | + <ProCard | |
| 389 | + title="选择或自定义课题组成员信息" | |
| 390 | + bordered | |
| 391 | + tooltip="从【客户信息】选择框中可以直接搜索客户,选中后自动添加到【课题组成员】中。也可以自定义输入【客户名称】和【手机号】,点击添加按钮手动添加到【课题组成员】中。" | |
| 392 | + > | |
| 393 | + <ProForm.Group> | |
| 394 | + <ProFormSelect | |
| 395 | + key="customerName" | |
| 396 | + label="客户信息(选择)" | |
| 397 | + width="lg" | |
| 398 | + showSearch | |
| 399 | + name="customerName" | |
| 400 | + placeholder="请选择客户信息" | |
| 401 | + onChange={(_, option) => { | |
| 402 | + autoFillCustomerInfo(option); | |
| 403 | + }} | |
| 404 | + fieldProps={{ | |
| 405 | + filterOption() { | |
| 406 | + return true; | |
| 407 | + }, | |
| 408 | + optionItemRender(item: any) { | |
| 409 | + if (item.type === 'add') { | |
| 410 | + return ( | |
| 411 | + <div title={item.name + '(新增客户)'}> | |
| 412 | + <span style={{ color: '#333333' }}>{item.name}</span> | |
| 413 | + {' | '} | |
| 414 | + <span style={{ color: 'orange' }}>自定义</span> | |
| 415 | + </div> | |
| 416 | + ); | |
| 417 | + } | |
| 290 | 418 | |
| 291 | - <ProFormSelect | |
| 292 | - name="members" | |
| 293 | - key="members" | |
| 294 | - width="lg" | |
| 295 | - showSearch | |
| 296 | - label="课题组成员" | |
| 297 | - placeholder="请添加课题组成员" | |
| 298 | - fieldProps={{ | |
| 299 | - mode: 'multiple', | |
| 300 | - filterOption() { | |
| 301 | - return true; | |
| 302 | - }, | |
| 303 | - optionItemRender(item: any) { | |
| 304 | - let name = item.realName + ' | ' + item.phone; | |
| 305 | - return ( | |
| 306 | - <div title={name}> | |
| 307 | - <span style={{ color: '#333333' }}>{name}</span> | |
| 308 | - </div> | |
| 309 | - ); | |
| 310 | - }, | |
| 311 | - }} | |
| 312 | - options={memberOptions} | |
| 313 | - /> | |
| 419 | + let title = ''; | |
| 420 | + let spanText = ''; | |
| 421 | + let realName = item.realName; | |
| 422 | + let phone = item.phone; | |
| 314 | 423 | |
| 315 | - <ProCard | |
| 316 | - title="选择或自定义课题组成员信息" | |
| 317 | - bordered | |
| 318 | - tooltip="从【客户信息】选择框中可以直接搜索客户,选中后自动添加到【课题组成员】中。也可以自定义输入【客户名称】和【手机号】,点击添加按钮手动添加到【课题组成员】中。" | |
| 319 | - > | |
| 320 | - <ProForm.Group> | |
| 321 | - <ProFormSelect | |
| 322 | - key="customerName" | |
| 323 | - label="客户信息(选择)" | |
| 324 | - width="lg" | |
| 325 | - showSearch | |
| 326 | - name="customerName" | |
| 327 | - placeholder="请选择客户信息" | |
| 328 | - onChange={(_, option) => { | |
| 329 | - autoFillCustomerInfo(option); | |
| 330 | - }} | |
| 331 | - fieldProps={{ | |
| 332 | - filterOption() { | |
| 333 | - return true; | |
| 334 | - }, | |
| 335 | - optionItemRender(item: any) { | |
| 336 | - if (item.type === 'add') { | |
| 424 | + title = | |
| 425 | + getDefaultString(realName) + | |
| 426 | + '|' + | |
| 427 | + getDefaultString(phone); | |
| 428 | + | |
| 429 | + spanText = | |
| 430 | + getDefaultString(realName) + | |
| 431 | + '|' + | |
| 432 | + getDefaultString(phone); | |
| 337 | 433 | return ( |
| 338 | - <div title={item.name + '(新增客户)'}> | |
| 339 | - <span style={{ color: '#333333' }}>{item.name}</span> | |
| 340 | - {' | '} | |
| 341 | - <span style={{ color: 'orange' }}>自定义</span> | |
| 434 | + <div title={title}> | |
| 435 | + <span style={{ color: '#333333' }}>{spanText}</span> | |
| 342 | 436 | </div> |
| 343 | 437 | ); |
| 438 | + }, | |
| 439 | + }} | |
| 440 | + debounceTime={1000} | |
| 441 | + request={async (value, {}) => { | |
| 442 | + const keywords = value.keyWords; | |
| 443 | + if (keywords === '') { | |
| 444 | + return []; | |
| 344 | 445 | } |
| 446 | + const res = await postCanrdApiUserAddressList({ | |
| 447 | + data: { keywords: keywords }, | |
| 448 | + }); | |
| 449 | + let options = res?.data?.map((c: any) => { | |
| 450 | + return { | |
| 451 | + ...c, | |
| 452 | + label: c.name, | |
| 453 | + value: c.id, | |
| 454 | + key: c.id, | |
| 455 | + }; | |
| 456 | + }); | |
| 345 | 457 | |
| 346 | - let title = ''; | |
| 347 | - let spanText = ''; | |
| 348 | - let realName = item.realName; | |
| 349 | - let phone = item.phone; | |
| 350 | - | |
| 351 | - title = | |
| 352 | - getDefaultString(realName) + '|' + getDefaultString(phone); | |
| 458 | + //对options去重,realName和phone唯一 | |
| 459 | + options = deduplicateOptions(options); | |
| 353 | 460 | |
| 354 | - spanText = | |
| 355 | - getDefaultString(realName) + '|' + getDefaultString(phone); | |
| 356 | - return ( | |
| 357 | - <div title={title}> | |
| 358 | - <span style={{ color: '#333333' }}>{spanText}</span> | |
| 359 | - </div> | |
| 360 | - ); | |
| 361 | - }, | |
| 362 | - }} | |
| 363 | - debounceTime={1000} | |
| 364 | - request={async (value, {}) => { | |
| 365 | - const keywords = value.keyWords; | |
| 366 | - if (keywords === '') { | |
| 367 | - return []; | |
| 368 | - } | |
| 369 | - const res = await postCanrdApiUserAddressList({ | |
| 370 | - data: { keywords: keywords }, | |
| 371 | - }); | |
| 372 | - let options = res?.data?.map((c: any) => { | |
| 373 | - return { | |
| 374 | - ...c, | |
| 375 | - label: c.name, | |
| 376 | - value: c.id, | |
| 377 | - key: c.id, | |
| 378 | - }; | |
| 379 | - }); | |
| 461 | + //第一个商品默认为要新增客户 | |
| 462 | + if (keywords.trim() !== '') { | |
| 463 | + options.unshift({ | |
| 464 | + name: keywords, | |
| 465 | + type: 'add', | |
| 466 | + label: keywords, | |
| 467 | + value: 3.1415926, | |
| 468 | + key: keywords, | |
| 469 | + }); | |
| 470 | + } | |
| 380 | 471 | |
| 381 | - //对options去重,realName和phone唯一 | |
| 382 | - options = deduplicateOptions(options); | |
| 472 | + return options; | |
| 473 | + }} | |
| 474 | + /> | |
| 475 | + </ProForm.Group> | |
| 383 | 476 | |
| 384 | - //第一个商品默认为要新增客户 | |
| 385 | - if (keywords.trim() !== '') { | |
| 386 | - options.unshift({ | |
| 387 | - name: keywords, | |
| 388 | - type: 'add', | |
| 389 | - label: keywords, | |
| 390 | - value: 3.1415926, | |
| 391 | - key: keywords, | |
| 392 | - }); | |
| 393 | - } | |
| 394 | - | |
| 395 | - return options; | |
| 477 | + <ProForm.Group> | |
| 478 | + <ProFormText | |
| 479 | + name="realName" | |
| 480 | + label="客户名称(自定义)" | |
| 481 | + placeholder="请输入客户名称" | |
| 482 | + rules={[{ required: false, message: '请输入客户名称' }]} | |
| 483 | + /> | |
| 484 | + <ProFormText | |
| 485 | + name="phone" | |
| 486 | + label="手机号(自定义)" | |
| 487 | + width="md" | |
| 488 | + placeholder="请输入手机号" | |
| 489 | + rules={[{ required: false, message: '请输入手机号' }]} | |
| 490 | + /> | |
| 491 | + </ProForm.Group> | |
| 492 | + <Button | |
| 493 | + type="primary" | |
| 494 | + onClick={() => { | |
| 495 | + addCustomMember(); | |
| 396 | 496 | }} |
| 397 | - /> | |
| 398 | - </ProForm.Group> | |
| 399 | - | |
| 400 | - <ProForm.Group> | |
| 401 | - <ProFormText | |
| 402 | - name="realName" | |
| 403 | - label="客户名称(自定义)" | |
| 404 | - placeholder="请输入客户名称" | |
| 405 | - rules={[{ required: false, message: '请输入客户名称' }]} | |
| 406 | - /> | |
| 407 | - <ProFormText | |
| 408 | - name="phone" | |
| 409 | - label="手机号(自定义)" | |
| 410 | - width="md" | |
| 411 | - placeholder="请输入手机号" | |
| 412 | - rules={[{ required: false, message: '请输入手机号' }]} | |
| 413 | - /> | |
| 414 | - </ProForm.Group> | |
| 415 | - <Button | |
| 416 | - type="primary" | |
| 417 | - onClick={() => { | |
| 418 | - addCustomMember(); | |
| 419 | - }} | |
| 420 | - > | |
| 421 | - 添加 | |
| 422 | - </Button> | |
| 423 | - </ProCard> | |
| 497 | + > | |
| 498 | + 添加 | |
| 499 | + </Button> | |
| 500 | + </ProCard> | |
| 501 | + </Spin> | |
| 424 | 502 | </ModalForm> |
| 425 | 503 | </div> |
| 426 | 504 | ); | ... | ... |
src/pages/ResearchGroup/index.tsx
| ... | ... | @@ -4,7 +4,7 @@ import { RESPONSE_CODE } from '@/constants/enum'; |
| 4 | 4 | import {} from '@/pages/Invoice/constant'; |
| 5 | 5 | import { |
| 6 | 6 | postCanrdApiUserDetail, |
| 7 | - postPrepaidDelete, | |
| 7 | + postResearchGroupsDelete, | |
| 8 | 8 | postResearchGroupsList, |
| 9 | 9 | } from '@/services'; |
| 10 | 10 | import { formatDateTime } from '@/utils'; |
| ... | ... | @@ -31,7 +31,7 @@ const PrepaidPage = () => { |
| 31 | 31 | const accountActionRef = useRef<ActionType>(); |
| 32 | 32 | const [researchGroupAddModalVisible, setResearchGroupAddModalVisible] = |
| 33 | 33 | useState(false); |
| 34 | - // const [checkVisible, setCheckVisible] = useState(false);; | |
| 34 | + // const [checkVisible, setCheckVisible] = useState(false); | |
| 35 | 35 | const [accountInfo, setAccountInfo] = useState({ |
| 36 | 36 | realName: '', |
| 37 | 37 | phone: '', |
| ... | ... | @@ -39,6 +39,8 @@ const PrepaidPage = () => { |
| 39 | 39 | uid: '', |
| 40 | 40 | }); |
| 41 | 41 | const [accountInfoLoading, setAccountInfoLoading] = useState(false); |
| 42 | + const [perms, setPerms] = useState<string[]>([]); | |
| 43 | + const [optRecordId, setOptRecordId] = useState<any>(null); | |
| 42 | 44 | |
| 43 | 45 | const reloadResearchGroupTable = () => { |
| 44 | 46 | researchGroupActionRef.current?.reload(); |
| ... | ... | @@ -256,16 +258,15 @@ const PrepaidPage = () => { |
| 256 | 258 | width: 120, |
| 257 | 259 | render: (text, record) => { |
| 258 | 260 | let btns = []; |
| 259 | - let opts = record.operations; | |
| 260 | - if (opts?.includes('modify')) { | |
| 261 | + if (perms?.includes('modify')) { | |
| 261 | 262 | btns.push( |
| 262 | 263 | <Button |
| 263 | 264 | className="p-0" |
| 264 | 265 | key="modify" |
| 265 | 266 | type="link" |
| 266 | 267 | onClick={() => { |
| 267 | - // setRechargePrepaymentModalVisible(true); | |
| 268 | - // setCurrentOptPrepaymentObj(cloneDeep(record)); | |
| 268 | + setResearchGroupAddModalVisible(true); | |
| 269 | + setOptRecordId(record?.id); | |
| 269 | 270 | }} |
| 270 | 271 | > |
| 271 | 272 | 编辑 |
| ... | ... | @@ -273,31 +274,15 @@ const PrepaidPage = () => { |
| 273 | 274 | ); |
| 274 | 275 | } |
| 275 | 276 | |
| 276 | - if (opts?.includes('audit')) { | |
| 277 | - btns.push( | |
| 278 | - <Button | |
| 279 | - className="p-0" | |
| 280 | - key="view" | |
| 281 | - type="link" | |
| 282 | - onClick={() => { | |
| 283 | - // setCurrentOptPrepaymentObj(record); | |
| 284 | - // setCheckVisible(true); | |
| 285 | - }} | |
| 286 | - > | |
| 287 | - 审核 | |
| 288 | - </Button>, | |
| 289 | - ); | |
| 290 | - } | |
| 291 | - | |
| 292 | - if (opts?.includes('delete')) { | |
| 277 | + if (perms?.includes('delete')) { | |
| 293 | 278 | btns.push( |
| 294 | 279 | <ButtonConfirm |
| 295 | 280 | key="delete" |
| 296 | 281 | className="p-0" |
| 297 | - title={'确认删除这条预存记录吗?'} | |
| 282 | + title={'确认删除这个课题组吗?'} | |
| 298 | 283 | text="删除" |
| 299 | 284 | onConfirm={async () => { |
| 300 | - let res = await postPrepaidDelete({ | |
| 285 | + let res = await postResearchGroupsDelete({ | |
| 301 | 286 | data: { ids: [record.id] }, |
| 302 | 287 | }); |
| 303 | 288 | if (res && res.result === RESPONSE_CODE.SUCCESS) { |
| ... | ... | @@ -331,6 +316,7 @@ const PrepaidPage = () => { |
| 331 | 316 | const res = await postResearchGroupsList({ |
| 332 | 317 | data: { ...params }, |
| 333 | 318 | }); |
| 319 | + setPerms(res.data.specialPath); | |
| 334 | 320 | return { |
| 335 | 321 | data: res?.data?.data || [], |
| 336 | 322 | total: res?.data?.total || 0, |
| ... | ... | @@ -359,19 +345,25 @@ const PrepaidPage = () => { |
| 359 | 345 | dateFormatter="string" |
| 360 | 346 | headerTitle="课题组列表" |
| 361 | 347 | scroll={{ x: 1400 }} |
| 362 | - toolBarRender={() => [ | |
| 363 | - <Button | |
| 364 | - key="button" | |
| 365 | - icon={<PlusOutlined />} | |
| 366 | - onClick={() => { | |
| 367 | - setCurrentOptPrepaymentObj(null); | |
| 368 | - setResearchGroupAddModalVisible(true); | |
| 369 | - }} | |
| 370 | - type="primary" | |
| 371 | - > | |
| 372 | - 新建 | |
| 373 | - </Button>, | |
| 374 | - ]} | |
| 348 | + toolBarRender={() => { | |
| 349 | + let btns = []; | |
| 350 | + if (perms.includes('add')) { | |
| 351 | + btns.push( | |
| 352 | + <Button | |
| 353 | + key="button" | |
| 354 | + icon={<PlusOutlined />} | |
| 355 | + onClick={() => { | |
| 356 | + setResearchGroupAddModalVisible(true); | |
| 357 | + }} | |
| 358 | + type="primary" | |
| 359 | + > | |
| 360 | + 新建 | |
| 361 | + </Button>, | |
| 362 | + ); | |
| 363 | + } | |
| 364 | + | |
| 365 | + return btns; | |
| 366 | + }} | |
| 375 | 367 | /> |
| 376 | 368 | ), |
| 377 | 369 | }, |
| ... | ... | @@ -394,9 +386,12 @@ const PrepaidPage = () => { |
| 394 | 386 | <ResearchGroupAddModal |
| 395 | 387 | setVisible={(val: boolean) => { |
| 396 | 388 | setResearchGroupAddModalVisible(val); |
| 389 | + setOptRecordId(null); | |
| 397 | 390 | }} |
| 391 | + researchGroupId={optRecordId} | |
| 398 | 392 | onClose={() => { |
| 399 | 393 | setResearchGroupAddModalVisible(false); |
| 394 | + setOptRecordId(null); | |
| 400 | 395 | }} |
| 401 | 396 | /> |
| 402 | 397 | )} | ... | ... |
src/services/definition.ts
| ... | ... | @@ -1677,6 +1677,11 @@ export interface ResearchGroupAccountAddRequest { |
| 1677 | 1677 | accountId?: number; |
| 1678 | 1678 | /** |
| 1679 | 1679 | * @description |
| 1680 | + * 关联的账号名称 | |
| 1681 | + */ | |
| 1682 | + accountName?: string; | |
| 1683 | + /** | |
| 1684 | + * @description | |
| 1680 | 1685 | * 关联的账号手机号 |
| 1681 | 1686 | */ |
| 1682 | 1687 | accountPhone?: string; |
| ... | ... | @@ -1697,6 +1702,11 @@ export interface ResearchGroupAccountEditRequest { |
| 1697 | 1702 | accountId?: number; |
| 1698 | 1703 | /** |
| 1699 | 1704 | * @description |
| 1705 | + * 关联的账号名称 | |
| 1706 | + */ | |
| 1707 | + accountName?: string; | |
| 1708 | + /** | |
| 1709 | + * @description | |
| 1700 | 1710 | * 关联的账号手机号 |
| 1701 | 1711 | */ |
| 1702 | 1712 | accountPhone?: string; |
| ... | ... | @@ -1737,6 +1747,15 @@ export interface ResearchGroupDeleteRequest { |
| 1737 | 1747 | ids?: Array<number>; |
| 1738 | 1748 | } |
| 1739 | 1749 | |
| 1750 | +export interface ResearchGroupDetailRequest { | |
| 1751 | + /** | |
| 1752 | + * @description | |
| 1753 | + * 主键id | |
| 1754 | + * @format int64 | |
| 1755 | + */ | |
| 1756 | + id?: number; | |
| 1757 | +} | |
| 1758 | + | |
| 1740 | 1759 | export interface ResearchGroupEditRequest { |
| 1741 | 1760 | /** |
| 1742 | 1761 | * @description |
| ... | ... | @@ -1767,6 +1786,11 @@ export interface ResearchGroupEditRequest { |
| 1767 | 1786 | } |
| 1768 | 1787 | |
| 1769 | 1788 | export interface ResearchGroupListRequest { |
| 1789 | + /** | |
| 1790 | + * @description | |
| 1791 | + * 预存账号手机号 | |
| 1792 | + */ | |
| 1793 | + accountPhone?: string; | |
| 1770 | 1794 | /** @format int32 */ |
| 1771 | 1795 | current?: number; |
| 1772 | 1796 | /** | ... | ... |
src/services/request.ts
| ... | ... | @@ -53,6 +53,7 @@ import type { |
| 53 | 53 | MaterialUnitListRes, |
| 54 | 54 | MeasureUnitListRes, |
| 55 | 55 | MessageQueryDTO, |
| 56 | + ModelAndView, | |
| 56 | 57 | OrderAddVO, |
| 57 | 58 | OrderAuditLogQueryVO, |
| 58 | 59 | OrderBaseInfoQueryVO, |
| ... | ... | @@ -76,6 +77,7 @@ import type { |
| 76 | 77 | ReissueInvoiceDto, |
| 77 | 78 | ResearchGroupAddRequest, |
| 78 | 79 | ResearchGroupDeleteRequest, |
| 80 | + ResearchGroupDetailRequest, | |
| 79 | 81 | ResearchGroupEditRequest, |
| 80 | 82 | ResearchGroupListRequest, |
| 81 | 83 | ResetPwdVO, |
| ... | ... | @@ -1614,9 +1616,7 @@ export interface GetErrorResponse { |
| 1614 | 1616 | * @description |
| 1615 | 1617 | * OK |
| 1616 | 1618 | */ |
| 1617 | - 200: { | |
| 1618 | - [propertyName: string]: any; | |
| 1619 | - }; | |
| 1619 | + 200: ModelAndView; | |
| 1620 | 1620 | /** |
| 1621 | 1621 | * @description |
| 1622 | 1622 | * Unauthorized |
| ... | ... | @@ -1637,9 +1637,9 @@ export interface GetErrorResponse { |
| 1637 | 1637 | export type GetErrorResponseSuccess = GetErrorResponse[200]; |
| 1638 | 1638 | /** |
| 1639 | 1639 | * @description |
| 1640 | - * error | |
| 1640 | + * errorHtml | |
| 1641 | 1641 | * @tags basic-error-controller |
| 1642 | - * @produces * | |
| 1642 | + * @produces text/html | |
| 1643 | 1643 | */ |
| 1644 | 1644 | export const getError = /* #__PURE__ */ (() => { |
| 1645 | 1645 | const method = 'get'; |
| ... | ... | @@ -1663,9 +1663,7 @@ export interface PutErrorResponse { |
| 1663 | 1663 | * @description |
| 1664 | 1664 | * OK |
| 1665 | 1665 | */ |
| 1666 | - 200: { | |
| 1667 | - [propertyName: string]: any; | |
| 1668 | - }; | |
| 1666 | + 200: ModelAndView; | |
| 1669 | 1667 | /** |
| 1670 | 1668 | * @description |
| 1671 | 1669 | * Created |
| ... | ... | @@ -1691,9 +1689,9 @@ export interface PutErrorResponse { |
| 1691 | 1689 | export type PutErrorResponseSuccess = PutErrorResponse[200]; |
| 1692 | 1690 | /** |
| 1693 | 1691 | * @description |
| 1694 | - * error | |
| 1692 | + * errorHtml | |
| 1695 | 1693 | * @tags basic-error-controller |
| 1696 | - * @produces * | |
| 1694 | + * @produces text/html | |
| 1697 | 1695 | * @consumes application/json |
| 1698 | 1696 | */ |
| 1699 | 1697 | export const putError = /* #__PURE__ */ (() => { |
| ... | ... | @@ -1718,9 +1716,7 @@ export interface PostErrorResponse { |
| 1718 | 1716 | * @description |
| 1719 | 1717 | * OK |
| 1720 | 1718 | */ |
| 1721 | - 200: { | |
| 1722 | - [propertyName: string]: any; | |
| 1723 | - }; | |
| 1719 | + 200: ModelAndView; | |
| 1724 | 1720 | /** |
| 1725 | 1721 | * @description |
| 1726 | 1722 | * Created |
| ... | ... | @@ -1746,9 +1742,9 @@ export interface PostErrorResponse { |
| 1746 | 1742 | export type PostErrorResponseSuccess = PostErrorResponse[200]; |
| 1747 | 1743 | /** |
| 1748 | 1744 | * @description |
| 1749 | - * error | |
| 1745 | + * errorHtml | |
| 1750 | 1746 | * @tags basic-error-controller |
| 1751 | - * @produces * | |
| 1747 | + * @produces text/html | |
| 1752 | 1748 | * @consumes application/json |
| 1753 | 1749 | */ |
| 1754 | 1750 | export const postError = /* #__PURE__ */ (() => { |
| ... | ... | @@ -1773,9 +1769,7 @@ export interface DeleteErrorResponse { |
| 1773 | 1769 | * @description |
| 1774 | 1770 | * OK |
| 1775 | 1771 | */ |
| 1776 | - 200: { | |
| 1777 | - [propertyName: string]: any; | |
| 1778 | - }; | |
| 1772 | + 200: ModelAndView; | |
| 1779 | 1773 | /** |
| 1780 | 1774 | * @description |
| 1781 | 1775 | * No Content |
| ... | ... | @@ -1796,9 +1790,9 @@ export interface DeleteErrorResponse { |
| 1796 | 1790 | export type DeleteErrorResponseSuccess = DeleteErrorResponse[200]; |
| 1797 | 1791 | /** |
| 1798 | 1792 | * @description |
| 1799 | - * error | |
| 1793 | + * errorHtml | |
| 1800 | 1794 | * @tags basic-error-controller |
| 1801 | - * @produces * | |
| 1795 | + * @produces text/html | |
| 1802 | 1796 | */ |
| 1803 | 1797 | export const deleteError = /* #__PURE__ */ (() => { |
| 1804 | 1798 | const method = 'delete'; |
| ... | ... | @@ -1822,9 +1816,7 @@ export interface OptionsErrorResponse { |
| 1822 | 1816 | * @description |
| 1823 | 1817 | * OK |
| 1824 | 1818 | */ |
| 1825 | - 200: { | |
| 1826 | - [propertyName: string]: any; | |
| 1827 | - }; | |
| 1819 | + 200: ModelAndView; | |
| 1828 | 1820 | /** |
| 1829 | 1821 | * @description |
| 1830 | 1822 | * No Content |
| ... | ... | @@ -1845,9 +1837,9 @@ export interface OptionsErrorResponse { |
| 1845 | 1837 | export type OptionsErrorResponseSuccess = OptionsErrorResponse[200]; |
| 1846 | 1838 | /** |
| 1847 | 1839 | * @description |
| 1848 | - * error | |
| 1840 | + * errorHtml | |
| 1849 | 1841 | * @tags basic-error-controller |
| 1850 | - * @produces * | |
| 1842 | + * @produces text/html | |
| 1851 | 1843 | * @consumes application/json |
| 1852 | 1844 | */ |
| 1853 | 1845 | export const optionsError = /* #__PURE__ */ (() => { |
| ... | ... | @@ -1872,9 +1864,7 @@ export interface HeadErrorResponse { |
| 1872 | 1864 | * @description |
| 1873 | 1865 | * OK |
| 1874 | 1866 | */ |
| 1875 | - 200: { | |
| 1876 | - [propertyName: string]: any; | |
| 1877 | - }; | |
| 1867 | + 200: ModelAndView; | |
| 1878 | 1868 | /** |
| 1879 | 1869 | * @description |
| 1880 | 1870 | * No Content |
| ... | ... | @@ -1895,9 +1885,9 @@ export interface HeadErrorResponse { |
| 1895 | 1885 | export type HeadErrorResponseSuccess = HeadErrorResponse[200]; |
| 1896 | 1886 | /** |
| 1897 | 1887 | * @description |
| 1898 | - * error | |
| 1888 | + * errorHtml | |
| 1899 | 1889 | * @tags basic-error-controller |
| 1900 | - * @produces * | |
| 1890 | + * @produces text/html | |
| 1901 | 1891 | * @consumes application/json |
| 1902 | 1892 | */ |
| 1903 | 1893 | export const headError = /* #__PURE__ */ (() => { |
| ... | ... | @@ -1922,9 +1912,7 @@ export interface PatchErrorResponse { |
| 1922 | 1912 | * @description |
| 1923 | 1913 | * OK |
| 1924 | 1914 | */ |
| 1925 | - 200: { | |
| 1926 | - [propertyName: string]: any; | |
| 1927 | - }; | |
| 1915 | + 200: ModelAndView; | |
| 1928 | 1916 | /** |
| 1929 | 1917 | * @description |
| 1930 | 1918 | * No Content |
| ... | ... | @@ -1945,9 +1933,9 @@ export interface PatchErrorResponse { |
| 1945 | 1933 | export type PatchErrorResponseSuccess = PatchErrorResponse[200]; |
| 1946 | 1934 | /** |
| 1947 | 1935 | * @description |
| 1948 | - * error | |
| 1936 | + * errorHtml | |
| 1949 | 1937 | * @tags basic-error-controller |
| 1950 | - * @produces * | |
| 1938 | + * @produces text/html | |
| 1951 | 1939 | * @consumes application/json |
| 1952 | 1940 | */ |
| 1953 | 1941 | export const patchError = /* #__PURE__ */ (() => { |
| ... | ... | @@ -7770,6 +7758,77 @@ export const postResearchGroupsDelete = /* #__PURE__ */ (() => { |
| 7770 | 7758 | return request; |
| 7771 | 7759 | })(); |
| 7772 | 7760 | |
| 7761 | +/** @description request parameter type for postResearchGroupsDetail */ | |
| 7762 | +export interface PostResearchGroupsDetailOption { | |
| 7763 | + /** | |
| 7764 | + * @description | |
| 7765 | + * request | |
| 7766 | + */ | |
| 7767 | + body: { | |
| 7768 | + /** | |
| 7769 | + @description | |
| 7770 | + request */ | |
| 7771 | + request: ResearchGroupDetailRequest; | |
| 7772 | + }; | |
| 7773 | +} | |
| 7774 | + | |
| 7775 | +/** @description response type for postResearchGroupsDetail */ | |
| 7776 | +export interface PostResearchGroupsDetailResponse { | |
| 7777 | + /** | |
| 7778 | + * @description | |
| 7779 | + * OK | |
| 7780 | + */ | |
| 7781 | + 200: ServerResult; | |
| 7782 | + /** | |
| 7783 | + * @description | |
| 7784 | + * Created | |
| 7785 | + */ | |
| 7786 | + 201: any; | |
| 7787 | + /** | |
| 7788 | + * @description | |
| 7789 | + * Unauthorized | |
| 7790 | + */ | |
| 7791 | + 401: any; | |
| 7792 | + /** | |
| 7793 | + * @description | |
| 7794 | + * Forbidden | |
| 7795 | + */ | |
| 7796 | + 403: any; | |
| 7797 | + /** | |
| 7798 | + * @description | |
| 7799 | + * Not Found | |
| 7800 | + */ | |
| 7801 | + 404: any; | |
| 7802 | +} | |
| 7803 | + | |
| 7804 | +export type PostResearchGroupsDetailResponseSuccess = | |
| 7805 | + PostResearchGroupsDetailResponse[200]; | |
| 7806 | +/** | |
| 7807 | + * @description | |
| 7808 | + * 查询课题组信息 | |
| 7809 | + * @tags research-groups-controller | |
| 7810 | + * @produces * | |
| 7811 | + * @consumes application/json | |
| 7812 | + */ | |
| 7813 | +export const postResearchGroupsDetail = /* #__PURE__ */ (() => { | |
| 7814 | + const method = 'post'; | |
| 7815 | + const url = '/research/groups/detail'; | |
| 7816 | + function request( | |
| 7817 | + option: PostResearchGroupsDetailOption, | |
| 7818 | + ): Promise<PostResearchGroupsDetailResponseSuccess> { | |
| 7819 | + return requester(request.url, { | |
| 7820 | + method: request.method, | |
| 7821 | + ...option, | |
| 7822 | + }) as unknown as Promise<PostResearchGroupsDetailResponseSuccess>; | |
| 7823 | + } | |
| 7824 | + | |
| 7825 | + /** http method */ | |
| 7826 | + request.method = method; | |
| 7827 | + /** request url */ | |
| 7828 | + request.url = url; | |
| 7829 | + return request; | |
| 7830 | +})(); | |
| 7831 | + | |
| 7773 | 7832 | /** @description request parameter type for postResearchGroupsEdit */ |
| 7774 | 7833 | export interface PostResearchGroupsEditOption { |
| 7775 | 7834 | /** | ... | ... |