Commit bf85dc0e authored by 前端-许冠华's avatar 前端-许冠华

Merge branch 'v2-220518' into 'v2-220518'

feat: 修改请款单保存修改调错接口和适用会员checkbox勾选的问题 See merge request linkseeks-design/pro-admin!52
parents d63d04a8 28c95204
......@@ -7,7 +7,7 @@ import ProcessEngLayout from './components/processEng';
import ProcessSelectLayout from './components/processSelect';
import InvoiceTypeLayout from './components/invoiceType';
import useFields from './useFields';
import { getSettleAccountsBusinessApplyAmountProcessGet, postSettleAccountsBusinessApplyAmountProcessSave, postSettleAccountsBusinessApplyAmountProcessStatusUpdate } from '@/services/SettleV2Api';
import { getSettleAccountsBusinessApplyAmountProcessGet, postSettleAccountsBusinessApplyAmountProcessSave, postSettleAccountsBusinessApplyAmountProcessUpdate } from '@/services/SettleV2Api';
export const layout: any = {
colon: false,
......@@ -58,19 +58,20 @@ const AddInvoiceProcessEng: React.FC<{}> = () => {
const handleSubmit = () => {
let fetchApi = (path === 'edit' ? postSettleAccountsBusinessApplyAmountProcessStatusUpdate : postSettleAccountsBusinessApplyAmountProcessSave)
let fetchApi = (path === 'edit' ? postSettleAccountsBusinessApplyAmountProcessUpdate : postSettleAccountsBusinessApplyAmountProcessSave)
form.validateFields().then(values => {
setLoading(true)
const params = {
...values,
allMembers: values.allMembers === 1 ? true : false,
members: values.members.map(_item => {
members: values?.members?.map(_item => {
return {
memberId: _item.memberId,
roleId: _item.roleId,
}
})
}
values.allMembers === 1 && delete params.members;
delete values.allMembers;
delete values.members;
path === 'edit' && (params.processId = processId)
......@@ -80,6 +81,8 @@ const AddInvoiceProcessEng: React.FC<{}> = () => {
return
}
history.goBack()
}).catch(() => {
setLoading(false)
})
})
}
......
......@@ -64,7 +64,16 @@ const InvoiceTypeLayout: React.FC<InvoiceTypeProps> = (props: any) => {
if (res.code !== 1000) {
return
}
resolve(res.data)
let data = {
data: res.data.data.map(_item => {
return {
..._item,
mrId: `${_item.memberId}_${_item.roleId}`
}
}),
totalCount: res.data.totalCount
}
resolve(data)
}).catch(error => {
console.warn(error)
})
......@@ -97,8 +106,14 @@ const InvoiceTypeLayout: React.FC<InvoiceTypeProps> = (props: any) => {
message.error(res.message);
return
}
setMember(res.data);
form.setFieldsValue({ 'members': res.data })
let _members = res.data.map(_item => {
return {
..._item,
mrId: `${_item.memberId}_${_item.roleId}`
}
})
setMember(_members);
form.setFieldsValue({ 'members': _members })
onFieldsChange(form)
})
}
......@@ -168,9 +183,9 @@ const InvoiceTypeLayout: React.FC<InvoiceTypeProps> = (props: any) => {
title='选择适用会员'
mode='checkbox'
tableProps={{
rowKey: 'id',
rowKey: 'mrId',
}}
customKey='id'
customKey='mrId'
fetchData={handleFetchData}
onClose={() => toggle(false)}
onOk={handleConfirm}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment