Commit 3984429a authored by wzy's avatar wzy

Merge branch 'jinfa-0518' of…

Merge branch 'jinfa-0518' of ssh://gitlab.shushangyun.com:8122/project/jinfa-platform into jinfa-0518
parents fae9e262 688020bd
......@@ -14,53 +14,80 @@ interface Props {
handleOnOk?: () => void,
checkedValue?: any
}
export default ((props: Props) => {
const { visible = false, setVisible, handleOnOk, checkedValue = [] } = props
const intl = getIntl();
export default (props: Props) => {
const { visible = false, setVisible, handleOnOk, checkedValue = [], rowSelection } = props
const intl = getIntl()
const handleFetchData = async (params) => {
const { data = {} } = await getProductGoodsGetSubGoodsList(params);
return data
const { data, code } = await getProductGoodsGetSubGoodsList(params)
if (code === 1000) {
let list = []
if (data?.data?.length > 0) {
list = data.data.map((item) => ({
name: item?.userName,
goodsNo: item?.code,
memberId: item?.memberId,
roleId: item?.memberRoleId,
userName: item?.contactMemberName,
phone: item?.contactMemberPhone,
manufacturer: item?.materialsManufacturer,
origin: item?.materialsOrigin,
departure: item?.materialsDeparture,
deliveryCycle: item?.materialsDeliverPeriod,
deliveryMethod: item?.materialsDeliveryMethod,
materialId: item?.id,
id: item?.id,
uniqueId: item?.id,
materialName: item?.name,
type: item?.type,
category: item?.customerCategory?.category?.name,
brand: item?.brand?.name,
unitName: item?.unitName,
}))
}
return { data: list, totalCount: data?.totalCount || 0 }
}
}
const columns = [
{
title: intl.formatMessage({ id: 'material.supplier.name', defaultMessage: '供应商名称' }),
dataIndex: 'userName'
dataIndex: 'name',
},
{
title: intl.formatMessage({ id: 'material.name', defaultMessage: '物料名称' }),
dataIndex: 'name'
dataIndex: 'materialName',
},
{
title: intl.formatMessage({ id: 'material.type', defaultMessage: '规格型号' }),
dataIndex: 'type'
dataIndex: 'type',
},
{
title: intl.formatMessage({ id: 'material.category', defaultMessage: '品类' }),
dataIndex: 'category',
render: (text, record) => (record?.customerCategory?.category?.name)
},
{
title: intl.formatMessage({ id: 'material.brand', defaultMessage: '品牌' }),
dataIndex: 'brand',
render: (text, record) => (record.brand?.name)
},
{
title: intl.formatMessage({ id: 'material.unit', defaultMessage: '单位' }),
dataIndex: 'unitName'
}
];
dataIndex: 'unitName',
},
]
const suppilerSchema: ISchema = {
type: 'object',
properties: {
layout: {
type: 'object',
"x-component": 'mega-layout',
'x-component': 'mega-layout',
properties: {
userName: {
type: 'string',
'x-component': 'Search',
'x-component-props': {
placeholder: intl.formatMessage({ id: 'material.supplier.name', defaultMessage: '供应商名称' }),
placeholder: intl.formatMessage({
id: 'material.supplier.name',
defaultMessage: '供应商名称',
}),
align: 'flex-left',
},
},
......@@ -69,7 +96,7 @@ export default ((props: Props) => {
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
justifyContent: "flex-start",
justifyContent: 'flex-start',
},
colStyle: {
marginRight: 20,
......@@ -79,7 +106,10 @@ export default ((props: Props) => {
name: {
type: 'string',
'x-component-props': {
placeholder: intl.formatMessage({ id: 'material.name', defaultMessage: '物料名称' }),
placeholder: intl.formatMessage({
id: 'material.name',
defaultMessage: '物料名称',
}),
allowClear: true,
},
},
......@@ -87,7 +117,10 @@ export default ((props: Props) => {
type: 'string',
'x-component': 'Cascader',
'x-component-props': {
placeholder: intl.formatMessage({ id: 'material.category', defaultMessage: '品类' }),
placeholder: intl.formatMessage({
id: 'material.category',
defaultMessage: '品类',
}),
allowClear: true,
style: { width: '150px' },
showSearch: true,
......@@ -107,9 +140,12 @@ export default ((props: Props) => {
type: {
type: 'string',
'x-component-props': {
placeholder: intl.formatMessage({ id: 'material.type', defaultMessage: '规格型号' }),
placeholder: intl.formatMessage({
id: 'material.type',
defaultMessage: '规格型号',
}),
allowClear: true,
}
},
},
submit: {
'x-component': 'Submit',
......@@ -117,7 +153,10 @@ export default ((props: Props) => {
span: 1,
},
'x-component-props': {
children: intl.formatMessage({ id: 'balance.accountsReceivable.invoice.schema.submit' }),
children: intl.formatMessage({
id: 'balance.accountsReceivable.invoice.schema.submit',
}),
},
},
},
},
......@@ -125,28 +164,28 @@ export default ((props: Props) => {
},
},
}
};
return (
<TableModal
modalType='Drawer'
rowSelection={rowSelection}
modalType="Drawer"
visible={visible}
onClose={() => setVisible(false)}
title={intl.formatMessage({ id: 'material.add.supplier.material', defaultMessage: '添加供应商物料' })}
title={intl.formatMessage({
id: 'material.add.supplier.material',
defaultMessage: '添加供应商物料',
})}
columns={columns}
schema={suppilerSchema}
onOk={handleOnOk}
fetchData={handleFetchData}
tableProps={{
rowKey: 'id',
}}
tableProps={{ rowKey: 'materialId' }}
components={{ Cascader }}
effects={($, actions) => {
useStateFilterSearchLinkageEffect($, actions, 'userName', FORM_FILTER_PATH);
useStateFilterSearchLinkageEffect($, actions, 'userName', FORM_FILTER_PATH)
useAsyncCascader('categoryId', fetchCategoryData)
useAsyncSelect('brandId', fetchBrand, ["name", "id"])
useAsyncSelect('brandId', fetchBrand, ['name', 'id'])
}}
mode={"radio"}
value={checkedValue}
mode={'checkbox'}
/>
)
})
\ No newline at end of file
}
\ No newline at end of file
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