Commit c2e9d6f4 authored by 前端-彭佳文's avatar 前端-彭佳文

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

V2 220518 See merge request linkseeks-design/pro-platform!662
parents 3518b8d4 0a663306
...@@ -70,7 +70,10 @@ const MinUnit = (props) => { ...@@ -70,7 +70,10 @@ const MinUnit = (props) => {
> >
<InputNumber min={1} style={{ width: '100%' }} addonAfter={addonAfter} disabled={!props.editable}/> <InputNumber min={1} style={{ width: '100%' }} addonAfter={addonAfter} disabled={!props.editable}/>
</Form.Item> </Form.Item>
<MinusCircleOutlined onClick={() => remove(name)} disabled={!props.editable} /> {
props.editable&&<MinusCircleOutlined onClick={() => remove(name)} disabled={!props.editable} />
}
</div> </div>
))} ))}
<Form.Item> <Form.Item>
......
...@@ -124,5 +124,20 @@ export default { ...@@ -124,5 +124,20 @@ export default {
'material.costPrice.pattern': '请填写数字且最多保留四位小数', 'material.costPrice.pattern': '请填写数字且最多保留四位小数',
'material.add.supplier.material': '添加供应商物料', 'material.add.supplier.material': '添加供应商物料',
'member.modal.selectMaterial.title': '选择会员' 'member.modal.selectMaterial.title': '选择会员',
'material.output.title':'产地与配送',
'material.materialsManufacturer':'生产厂家',
'material.materialsOrigin':'厂地',
'material.materialsDeparture':'起运地',
'material.materialsDeliverPeriod':'到货周期',
'material.materialsDeliveryMethod':'交货方式',
'material.unitConversion.title':'单位换算',
'material.sourceList.column':'最小单位',
'material.contact.title':'联系信息',
'material.chargeName':'负责人',
'material.chargeUserId':'负责人用户id',
'material.chargeAccount':'负责人账号',
'material.chargeRoleName':'负责人所属角色',
'material.contactMemberName':'联系人',
'material.contactMemberPhone':'联系人电话',
} }
\ No newline at end of file
...@@ -141,36 +141,21 @@ function useGetDetailCommon<T extends GetProductGoodsGetGoodsProcessDetailRespon ...@@ -141,36 +141,21 @@ function useGetDetailCommon<T extends GetProductGoodsGetGoodsProcessDetailRespon
}, [initialValue]) }, [initialValue])
/*动态单位换算*/ /*动态单位换算*/
const unitInfoList = useMemo(() => { const unitInfoList = useMemo(() => {
// return [
// {
// title: intl.formatMessage({ id: 'material.unitName', defaultMessage: '最小单位' }),
// value: initialValue?.unitName
// },
// {
// title: intl.formatMessage({ id: 'material.unitName', defaultMessage: '包' }),
// value: initialValue?.unitName
// },
// {
// title: intl.formatMessage({ id: 'material.unitName', defaultMessage: '连' }),
// value: initialValue?.unitName
// },
// {
// title: intl.formatMessage({ id: 'material.unitName', defaultMessage: '箱' }),
// value: initialValue?.unitName
// },
// ]
if (!initialValue?.unitConversions) { if (!initialValue?.unitConversions) {
return []; return [];
} }
const unitname=initialValue?.unitConversions[0]?.unitName const unitname=initialValue?.unitConversions[0]?.unitName
const newValue={title:'最小单位',value:unitname} const newValue={title:'最小单位',value:unitname}
const result =initialValue?.unitConversions[0]?.subUnitConversionList.map((_item) => { if(initialValue?.unitConversions[0]?.subUnitConversionList){
return { const result =initialValue?.unitConversions[0]?.subUnitConversionList.map((_item) => {
title: _item.unitName, return {
value: _item.nums title: _item.unitName,
} value: _item.nums
}) }
return [newValue,...result] })
return [newValue,...result]
}
else return newValue
}, [initialValue?.unitConversions]) }, [initialValue?.unitConversions])
/*联系信息*/ /*联系信息*/
const contactInfoList = useMemo(() => { const contactInfoList = useMemo(() => {
...@@ -189,7 +174,7 @@ function useGetDetailCommon<T extends GetProductGoodsGetGoodsProcessDetailRespon ...@@ -189,7 +174,7 @@ function useGetDetailCommon<T extends GetProductGoodsGetGoodsProcessDetailRespon
}, },
] ]
}, [initialValue?.unitConversions]) }, [initialValue])
/** 动态物料属性 */ /** 动态物料属性 */
const properties = useMemo(() => { const properties = useMemo(() => {
......
...@@ -183,7 +183,6 @@ const MaterialAdd = (props) => { ...@@ -183,7 +183,6 @@ const MaterialAdd = (props) => {
.filter((_item) => /customerAttribute-\d+/.test(_item)); .filter((_item) => /customerAttribute-\d+/.test(_item));
const formatBrand = brand ? { brand: { id: brand } } : {} const formatBrand = brand ? { brand: { id: brand } } : {}
/** 如果带货源清单 */ /** 如果带货源清单 */
const withSourceList = query?.type === 'sourceData' const withSourceList = query?.type === 'sourceData'
? { ? {
...@@ -276,7 +275,7 @@ const MaterialAdd = (props) => { ...@@ -276,7 +275,7 @@ const MaterialAdd = (props) => {
...withSourceList, ...withSourceList,
...withMaterialGroup, ...withMaterialGroup,
...withChangeData, ...withChangeData,
unitConversions: unitConversions ? [unitConversions] : [] unitConversions: unitConversions?.subUnitConversionList ? [unitConversions] : []
} }
console.log("postData", postData) console.log("postData", postData)
...@@ -322,7 +321,7 @@ const MaterialAdd = (props) => { ...@@ -322,7 +321,7 @@ const MaterialAdd = (props) => {
}, },
{ {
key: 'contactInfo', key: 'contactInfo',
name: intl.formatMessage({ id: 'material.contactInfo.title', defaultMessage: '联系人与负责人' }) name: intl.formatMessage({ id: 'material.contact.title', defaultMessage: '联系信息' })
}, },
{ {
key: 'images', key: 'images',
...@@ -367,7 +366,8 @@ const MaterialAdd = (props) => { ...@@ -367,7 +366,8 @@ const MaterialAdd = (props) => {
schema={schema} schema={schema}
actions={formActions} actions={formActions}
onSubmit={handleSubmit} onSubmit={handleSubmit}
value={formatInitialValue} // value={formatInitialValue}
initialValues={formatInitialValue}
components={{ components={{
Cascader, Cascader,
FormilyUploadFiles, FormilyUploadFiles,
...@@ -388,44 +388,31 @@ const MaterialAdd = (props) => { ...@@ -388,44 +388,31 @@ const MaterialAdd = (props) => {
useAsyncCascader('materialGroup', fetchTreeData); useAsyncCascader('materialGroup', fetchTreeData);
useAsyncSelect('unitId', fetchUnit, ["name", "id"]) useAsyncSelect('unitId', fetchUnit, ["name", "id"])
useAsyncSelect('unitConversions', fetchUnit, ["name", "id"]) useAsyncSelect('unitConversions', fetchUnit, ["name", "id"])
useAsyncSelect('chargeName', fetchUserPage, ["name", "userId"]) useAsyncSelect('chargeUserId', fetchUserPage, ["name", "userId"])
$('onFormMount').subscribe(() => { $('onFormMount').subscribe(() => {
if (isEdit) { if (isEdit) {
formActions.setFieldState('code', (state) => { formActions.setFieldState('code', (state) => {
FormPath.setIn(state, 'editable', false); FormPath.setIn(state, 'editable', false);
}) })
}
} })
}) $('onFieldInputChange', 'chargeUserId').subscribe((fieldState) => {
$('onFieldMount', 'unitConversions').subscribe((fieldState) => {
console.log(fieldState.values,'0000000')
formActions.setFieldState('unitConversions', (state) => {
FormPath.setIn(state, 'value', fieldState.values);
})
})
$('onFieldValueChange', 'chargeName').subscribe((fieldState) => {
if (isAdd||isEdit) {
formActions.setFieldState('contactMemberName', (state) => { formActions.setFieldState('contactMemberName', (state) => {
FormPath.setIn(state, 'value', fieldState.values[1]?.name); FormPath.setIn(state, 'value', fieldState.values[1]?.name);
}) })
formActions.setFieldState('chargeName', (state) => {
FormPath.setIn(state, 'value', fieldState.values[1]?.name);
})
formActions.setFieldState('contactMemberPhone', (state) => { formActions.setFieldState('contactMemberPhone', (state) => {
FormPath.setIn(state, 'value', fieldState.values[1]?.phone); FormPath.setIn(state, 'value', fieldState.values[1]?.phone);
}) })
formActions.setFieldState('chargeUserId', (state) => {
FormPath.setIn(state, 'value', fieldState.values[1]?.userId);
})
formActions.setFieldState('chargeAccount', (state) => { formActions.setFieldState('chargeAccount', (state) => {
FormPath.setIn(state, 'value', fieldState.values[1]?.account); FormPath.setIn(state, 'value', fieldState.values[1]?.account);
}) })
formActions.setFieldState('chargeRoleName', (state) => { formActions.setFieldState('chargeRoleName', (state) => {
FormPath.setIn(state, 'value', fieldState.values[1]?.roleName); FormPath.setIn(state, 'value', fieldState.values[1]?.roleName);
}) })
formActions.setFieldState('chargeName', (state) => {
FormPath.setIn(state, 'value', fieldState.values[1]?.name);
})
}
}) })
$('onFieldValueChange', 'category').subscribe((fieldState) => { $('onFieldValueChange', 'category').subscribe((fieldState) => {
if (!fieldState.value || fieldState.value.length === 0) { if (!fieldState.value || fieldState.value.length === 0) {
setSchema( setSchema(
...@@ -440,7 +427,7 @@ const MaterialAdd = (props) => { ...@@ -440,7 +427,7 @@ const MaterialAdd = (props) => {
getProductCustomerGetCustomerCategoryById({ id: categoryId }) getProductCustomerGetCustomerCategoryById({ id: categoryId })
.then((data) => { .then((data) => {
const { customerAttributeList } = data.data; const { customerAttributeList } = data.data;
if (customerAttributeList.length === 0) { if (customerAttributeList?.length === 0) {
setSchema( setSchema(
getSchema(null) getSchema(null)
) )
......
...@@ -188,7 +188,7 @@ export const getSchema = (schema: ISchema | null): ISchema => { ...@@ -188,7 +188,7 @@ export const getSchema = (schema: ISchema | null): ISchema => {
}, },
properties: { properties: {
materialsManufacturer: { materialsManufacturer: {
title: intl.formatMessage({ id: 'material.materialsManufacturer;', defaultMessage: '生产厂家' }), title: intl.formatMessage({ id: 'material.materialsManufacturer', defaultMessage: '生产厂家' }),
type: 'string', type: 'string',
'x-rules': [ 'x-rules': [
{ {
...@@ -248,7 +248,7 @@ export const getSchema = (schema: ISchema | null): ISchema => { ...@@ -248,7 +248,7 @@ export const getSchema = (schema: ISchema | null): ISchema => {
"x-component": 'MellowCard', "x-component": 'MellowCard',
"x-component-props": { "x-component-props": {
id: 'unitConversion', id: 'unitConversion',
title: intl.formatMessage({ id: 'material.unitConversion.123456789', defaultMessage: '单位换算' }) title: intl.formatMessage({ id: 'material.unitConversion.title', defaultMessage: '单位换算' })
}, },
properties: { properties: {
layout: { layout: {
...@@ -270,7 +270,7 @@ export const getSchema = (schema: ISchema | null): ISchema => { ...@@ -270,7 +270,7 @@ export const getSchema = (schema: ISchema | null): ISchema => {
properties: { properties: {
unitConversions: { unitConversions: {
// type: 'object', // type: 'object',
title: intl.formatMessage({ id: 'material.sourceList.column.123456789', defaultMessage: '最小单位' }), title: intl.formatMessage({ id: 'material.sourceList.column', defaultMessage: '最小单位' }),
"x-component": 'MiniUnit', "x-component": 'MiniUnit',
// default: { minUnit: 1, unitGroup: [{ amount: 20, unitId: 1 }] } // default: { minUnit: 1, unitGroup: [{ amount: 20, unitId: 1 }] }
}, },
...@@ -284,7 +284,7 @@ export const getSchema = (schema: ISchema | null): ISchema => { ...@@ -284,7 +284,7 @@ export const getSchema = (schema: ISchema | null): ISchema => {
"x-component": 'MellowCard', "x-component": 'MellowCard',
"x-component-props": { "x-component-props": {
id: 'test123456789', id: 'test123456789',
title: intl.formatMessage({ id: 'material.props.123456789', defaultMessage: '联系信息' }) title: intl.formatMessage({ id: 'material.contact.title', defaultMessage: '联系信息' })
}, },
properties: { properties: {
layout: { layout: {
...@@ -304,27 +304,28 @@ export const getSchema = (schema: ISchema | null): ISchema => { ...@@ -304,27 +304,28 @@ export const getSchema = (schema: ISchema | null): ISchema => {
} }
}, },
properties: { properties: {
chargeName: { chargeUserId: {
title: intl.formatMessage({ id: 'material.sourceList.column.123456789', defaultMessage: '负责人' }), title: intl.formatMessage({ id: 'material.chargeName', defaultMessage: '负责人' }),
type: "string", type: 'string',
enum: [], enum: [],
'x-component-props': {
showSearch: true,
},
description: `{{desc()}}`
}, },
chargeUserId: { chargeName: {
title: intl.formatMessage({ id: 'material.sourceList.column.chargeUserId', defaultMessage: '负责人用户id' }), title: intl.formatMessage({ id: 'material.chargeUserId', defaultMessage: '负责人用户id' }),
type: "string", type: "string",
enum: [],
display: false, display: false,
}, },
chargeAccount: { chargeAccount: {
title: intl.formatMessage({ id: 'material.sourceList.column.chargeAccount', defaultMessage: '负责人账号' }), title: intl.formatMessage({ id: 'material.chargeAccount', defaultMessage: '负责人账号' }),
type: "string", type: "string",
enum: [],
display: false, display: false,
}, },
chargeRoleName: { chargeRoleName: {
title: intl.formatMessage({ id: 'material.sourceList.column.chargeRoleName', defaultMessage: '负责人所属角色' }), title: intl.formatMessage({ id: 'material.chargeRoleName', defaultMessage: '负责人所属角色' }),
type: "string", type: "string",
enum: [],
display: false, display: false,
}, },
// 占位 // 占位
...@@ -333,7 +334,7 @@ export const getSchema = (schema: ISchema | null): ISchema => { ...@@ -333,7 +334,7 @@ export const getSchema = (schema: ISchema | null): ISchema => {
type: "object", type: "object",
}, },
contactMemberName: { contactMemberName: {
title: intl.formatMessage({ id: 'material.123456789', defaultMessage: '联系人' }), title: intl.formatMessage({ id: 'material.contactMemberName', defaultMessage: '联系人' }),
type: 'string', type: 'string',
'x-rules': [ 'x-rules': [
{ limitByte: true, maxByte: 40, } { limitByte: true, maxByte: 40, }
...@@ -345,7 +346,7 @@ export const getSchema = (schema: ISchema | null): ISchema => { ...@@ -345,7 +346,7 @@ export const getSchema = (schema: ISchema | null): ISchema => {
type: "object", type: "object",
}, },
contactMemberPhone: { contactMemberPhone: {
title: intl.formatMessage({ id: 'material.123456789', defaultMessage: '联系人电话' }), title: intl.formatMessage({ id: 'material.contactMemberPhone', defaultMessage: '联系人电话' }),
type: 'string', type: 'string',
'x-rules': [ 'x-rules': [
{ limitByte: true, maxByte: 40, } { limitByte: true, maxByte: 40, }
......
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