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

Merge branch 'fix-220418' into 'v2-220418'

修改0418bug See merge request linkseeks-design/pro-platform!453
parents eb618e3d 5190c739
......@@ -105,8 +105,8 @@ const DeliveryNoticeAwaitDetails: React.FC = () => {
return (
<AnchorPage
// title={details?.noticeNo || '送货通知单管理 - 送货通知单详情'}
title='确认送货通知单'
title={details?.noticeNo || '送货通知单管理 - 送货通知单详情'}
// title='确认送货通知单'
onBack={() => history.goBack()}
anchors={getConst(details.type, deliveryLen).Anchors}
extra={
......@@ -119,7 +119,7 @@ const DeliveryNoticeAwaitDetails: React.FC = () => {
</AuthButton>
}
>
<BaseInfo className='mt-0' title='送货通知单外部流转' id={Circulation.key} cols={1}>
<BaseInfo className='mt-0' title={Circulation.name} id={Circulation.key} cols={1}>
<Steps progressDot current={details?.outerStatus - 1}>
<Steps.Step title={Supplier} description={SubmitDeliveryNotice} />
<Steps.Step title={Purchaser} description={ConfirmDeliveryNotice} />
......
......@@ -6,7 +6,7 @@ import NiceForm from '@/components/NiceForm';
import { createFormActions } from '@formily/antd';
import { PageStatus, usePageStatus } from '@/hooks/usePageStatus';
import { history, getIntl } from 'umi';
import { getMemberAbilitySalesChannel, getMemberAbilitySalesChannelPage, getMemberAbilitySalesSelect, postMemberAbilitySalesChannelBind, postMemberAbilitySalesChannelUnbind } from '@/services/MemberV2Api';
import { getMemberAbilitySalesChannel, getMemberAbilitySalesSelect, postMemberAbilitySalesChannelBind, postMemberAbilitySalesChannelPage, postMemberAbilitySalesChannelUnbind } from '@/services/MemberV2Api';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import Search from '@/components/NiceForm/components/Search';
import Submit from '@/components/NiceForm/components/Submit';
......@@ -25,7 +25,7 @@ export const Tablink = [
const formAction = createFormActions();
const fetchMemberAbilitySelect = async (params) => {
const { data } = await getMemberAbilitySalesSelect(params)
const { data } = await getMemberAbilitySalesSelect()
return data
}
......@@ -36,7 +36,12 @@ const SalesmanBindAdded = (props) => {
const [memberVisible, setMemberVisible] = useState(false)
const { pageStatus, id } = usePageStatus()
const [tableData, setTableData] = useState<any[]>([])
const [keywordName, setKeywordName] = useState<string>('')
const [keywordName, setKeywordName] = useState<string>('');
const [loading, setLoading] = useState(false)
/** 用户Id(业务员Id) */
const [userId, setUserId] = useState<number>()
/** 过滤已有的下级会员 */
const fliterTableData = useMemo(() => {
if (!keywordName) {
......@@ -60,9 +65,9 @@ const SalesmanBindAdded = (props) => {
}).then((res) => {
if (res.code === 1000) {
formAction.setFieldValue('userId', [res.data])
// 添加一个remote标识, 带有此标识的 将会调用接口解绑
console.log(res.data.data.map(v => ({ ...v, isRemote: true })))
setTableData(res.data.data.map(v => ({ ...v, isRemote: true })))
// rowCtl.setSelectRow(res.data.data)
// rowCtl.setSelectedRowKeys(res.data.data.map(_item => _item.relationId))
setTableData(res.data.data)
}
})
}
......@@ -208,21 +213,13 @@ const SalesmanBindAdded = (props) => {
]
const fetchTableData = async (params) => {
const { data } = await getMemberAbilitySalesChannelPage(params)
const { data } = await postMemberAbilitySalesChannelPage({ ...params, userId, relationIds: tableData.map(_item => _item?.relationId) }, { ctlType: 'none' })
return data
}
const handleConfirm = () => {
setMemberVisible(false)
setTableData(tableData => {
return [...tableData, ...rowCtl.selectRow.filter(v => !tableData.find(j => j.memberId === v.memberId))]
})
}
const validateMember = () => {
const userInfo = formAction.getFieldValue('userId')
return userInfo && userInfo.length > 0
setTableData(rowCtl.selectRow)
}
const unBindMember = async (options?) => {
......@@ -258,24 +255,6 @@ const SalesmanBindAdded = (props) => {
}
relationIds.push(...remoteRowKey)
}
if (validateMember()) {
const userInfo = formAction.getFieldValue('userId')
const userId = userInfo[0].userId
const { code } = await postMemberAbilitySalesChannelUnbind({
userId,
relationIds: relationIds
})
if (code === 1000) {
setTableData(d => {
clearRealRowCtl(relationIds)
return d.filter(v => !relationIds.includes(v.relationId))
})
}
} else {
message.error(intl.formatMessage({ id: 'channel.member.select' }))
}
}
const clearRealRowCtl = (ids: any[]) => {
......@@ -287,35 +266,19 @@ const SalesmanBindAdded = (props) => {
const userInfo = formAction.getFieldValue('userId')
if (userInfo && userInfo.length > 0) {
const userId = userInfo[0].userId
setLoading(true)
const result = await postMemberAbilitySalesChannelBind({
userId,
relationIds: tableData.map(v => v.relationId)
})
if (result.code === 1000) {
history.goBack()
}
}
};
const fetchMemberSaleChannel = async (params) => {
const userInfo = formAction.getFieldValue('userId')
if (userInfo && userInfo.length > 0) {
const userId = userInfo[0].userId
const { data, code } = await getMemberAbilitySalesChannel({
userId,
...params
})
if (code !== 1000) {
message.error(intl.formatMessage({ id: code }))
setTableData([])
if (result.code !== 1000) {
setLoading(false)
return
}
setTableData([...data.data.map(v => ({ ...v, isRemote: true }))])
} else {
return []
history.goBack()
}
}
};
return (
<PeripheralLayout
......@@ -326,6 +289,7 @@ const SalesmanBindAdded = (props) => {
<Button
type="primary"
disabled={pageStatus === PageStatus.PREVIEW}
loading={loading}
onClick={handleSubmit}
>
{intl.formatMessage({ id: 'common.button.save' })}
......@@ -441,6 +405,13 @@ const SalesmanBindAdded = (props) => {
},
},
}}
effects={($, ctx) => {
$('onFieldValueChange', 'userId').subscribe(async state => {
if (state?.value) {
setUserId(state?.value[0].userId);
}
})
}}
/>
</Col>
</Row>
......@@ -459,7 +430,7 @@ const SalesmanBindAdded = (props) => {
<Button type='default' style={{ marginLeft: 20 }} onClick={() => setKeywordName('')}>{intl.formatMessage({ id: 'common.button.reset' })}</Button>
</Col>
</Row>
<Button style={{ marginBottom: '16px' }} block type='dashed' onClick={() => setMemberVisible(true)} disabled={pageStatus === PageStatus.PREVIEW}>{intl.formatMessage({ id: 'channel.member.wait.bind.select' })}</Button>
<Button style={{ marginBottom: '16px' }} block type='dashed' onClick={() => setMemberVisible(true)} disabled={!!!userId}>{intl.formatMessage({ id: 'channel.member.wait.bind.select' })}</Button>
<StandardTable
columns={connectMemberColumns}
rowSelection={pageStatus !== PageStatus.PREVIEW && realRowSelection}
......
......@@ -150,7 +150,7 @@ const SalesmanBindDetail = (props) => {
<Form.Item label={intl.formatMessage({ id: 'channel.member.table.memberRoleName' })}>
<Typography.Text>{data?.memberRoleName}</Typography.Text>
</Form.Item>
<Form.Item label={intl.formatMessage({ id: 'cchannel.member.table.bindphone' })}>
<Form.Item label={intl.formatMessage({ id: 'channel.member.table.bindphone' })}>
<Typography.Text>{data?.phone}</Typography.Text>
</Form.Item>
</Form>
......
......@@ -69,6 +69,7 @@ const PeripheralLayout: React.FC<IProps> = (props: any) => {
targetOffset={targetOffset}
onChange={onChange}
onClick={onClick}
getContainer={() => document.querySelector('main.ant-pro-basicLayout-content') as HTMLElement}
>
{/* 头部信息 */}
<div style={{ flex: 1 }}>
......
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