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) => {
>
<InputNumber min={1} style={{ width: '100%' }} addonAfter={addonAfter} disabled={!props.editable}/>
</Form.Item>
<MinusCircleOutlined onClick={() => remove(name)} disabled={!props.editable} />
{
props.editable&&<MinusCircleOutlined onClick={() => remove(name)} disabled={!props.editable} />
}
</div>
))}
<Form.Item>
......
......@@ -124,5 +124,20 @@ export default {
'material.costPrice.pattern': '请填写数字且最多保留四位小数',
'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,29 +141,12 @@ function useGetDetailCommon<T extends GetProductGoodsGetGoodsProcessDetailRespon
}, [initialValue])
/*动态单位换算*/
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) {
return [];
}
const unitname=initialValue?.unitConversions[0]?.unitName
const newValue={title:'最小单位',value:unitname}
if(initialValue?.unitConversions[0]?.subUnitConversionList){
const result =initialValue?.unitConversions[0]?.subUnitConversionList.map((_item) => {
return {
title: _item.unitName,
......@@ -171,6 +154,8 @@ function useGetDetailCommon<T extends GetProductGoodsGetGoodsProcessDetailRespon
}
})
return [newValue,...result]
}
else return newValue
}, [initialValue?.unitConversions])
/*联系信息*/
const contactInfoList = useMemo(() => {
......@@ -189,7 +174,7 @@ function useGetDetailCommon<T extends GetProductGoodsGetGoodsProcessDetailRespon
},
]
}, [initialValue?.unitConversions])
}, [initialValue])
/** 动态物料属性 */
const properties = useMemo(() => {
......
......@@ -183,7 +183,6 @@ const MaterialAdd = (props) => {
.filter((_item) => /customerAttribute-\d+/.test(_item));
const formatBrand = brand ? { brand: { id: brand } } : {}
/** 如果带货源清单 */
const withSourceList = query?.type === 'sourceData'
? {
......@@ -276,7 +275,7 @@ const MaterialAdd = (props) => {
...withSourceList,
...withMaterialGroup,
...withChangeData,
unitConversions: unitConversions ? [unitConversions] : []
unitConversions: unitConversions?.subUnitConversionList ? [unitConversions] : []
}
console.log("postData", postData)
......@@ -322,7 +321,7 @@ const MaterialAdd = (props) => {
},
{
key: 'contactInfo',
name: intl.formatMessage({ id: 'material.contactInfo.title', defaultMessage: '联系人与负责人' })
name: intl.formatMessage({ id: 'material.contact.title', defaultMessage: '联系信息' })
},
{
key: 'images',
......@@ -367,7 +366,8 @@ const MaterialAdd = (props) => {
schema={schema}
actions={formActions}
onSubmit={handleSubmit}
value={formatInitialValue}
// value={formatInitialValue}
initialValues={formatInitialValue}
components={{
Cascader,
FormilyUploadFiles,
......@@ -388,44 +388,31 @@ const MaterialAdd = (props) => {
useAsyncCascader('materialGroup', fetchTreeData);
useAsyncSelect('unitId', fetchUnit, ["name", "id"])
useAsyncSelect('unitConversions', fetchUnit, ["name", "id"])
useAsyncSelect('chargeName', fetchUserPage, ["name", "userId"])
useAsyncSelect('chargeUserId', fetchUserPage, ["name", "userId"])
$('onFormMount').subscribe(() => {
if (isEdit) {
formActions.setFieldState('code', (state) => {
FormPath.setIn(state, 'editable', false);
})
}
})
$('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) {
$('onFieldInputChange', 'chargeUserId').subscribe((fieldState) => {
formActions.setFieldState('contactMemberName', (state) => {
FormPath.setIn(state, 'value', fieldState.values[1]?.name);
})
formActions.setFieldState('chargeName', (state) => {
FormPath.setIn(state, 'value', fieldState.values[1]?.name);
})
formActions.setFieldState('contactMemberPhone', (state) => {
FormPath.setIn(state, 'value', fieldState.values[1]?.phone);
})
formActions.setFieldState('chargeUserId', (state) => {
FormPath.setIn(state, 'value', fieldState.values[1]?.userId);
})
formActions.setFieldState('chargeAccount', (state) => {
FormPath.setIn(state, 'value', fieldState.values[1]?.account);
})
formActions.setFieldState('chargeRoleName', (state) => {
FormPath.setIn(state, 'value', fieldState.values[1]?.roleName);
})
formActions.setFieldState('chargeName', (state) => {
FormPath.setIn(state, 'value', fieldState.values[1]?.name);
})
}
})
$('onFieldValueChange', 'category').subscribe((fieldState) => {
if (!fieldState.value || fieldState.value.length === 0) {
setSchema(
......@@ -440,7 +427,7 @@ const MaterialAdd = (props) => {
getProductCustomerGetCustomerCategoryById({ id: categoryId })
.then((data) => {
const { customerAttributeList } = data.data;
if (customerAttributeList.length === 0) {
if (customerAttributeList?.length === 0) {
setSchema(
getSchema(null)
)
......
......@@ -188,7 +188,7 @@ export const getSchema = (schema: ISchema | null): ISchema => {
},
properties: {
materialsManufacturer: {
title: intl.formatMessage({ id: 'material.materialsManufacturer;', defaultMessage: '生产厂家' }),
title: intl.formatMessage({ id: 'material.materialsManufacturer', defaultMessage: '生产厂家' }),
type: 'string',
'x-rules': [
{
......@@ -248,7 +248,7 @@ export const getSchema = (schema: ISchema | null): ISchema => {
"x-component": 'MellowCard',
"x-component-props": {
id: 'unitConversion',
title: intl.formatMessage({ id: 'material.unitConversion.123456789', defaultMessage: '单位换算' })
title: intl.formatMessage({ id: 'material.unitConversion.title', defaultMessage: '单位换算' })
},
properties: {
layout: {
......@@ -270,7 +270,7 @@ export const getSchema = (schema: ISchema | null): ISchema => {
properties: {
unitConversions: {
// type: 'object',
title: intl.formatMessage({ id: 'material.sourceList.column.123456789', defaultMessage: '最小单位' }),
title: intl.formatMessage({ id: 'material.sourceList.column', defaultMessage: '最小单位' }),
"x-component": 'MiniUnit',
// default: { minUnit: 1, unitGroup: [{ amount: 20, unitId: 1 }] }
},
......@@ -284,7 +284,7 @@ export const getSchema = (schema: ISchema | null): ISchema => {
"x-component": 'MellowCard',
"x-component-props": {
id: 'test123456789',
title: intl.formatMessage({ id: 'material.props.123456789', defaultMessage: '联系信息' })
title: intl.formatMessage({ id: 'material.contact.title', defaultMessage: '联系信息' })
},
properties: {
layout: {
......@@ -304,27 +304,28 @@ export const getSchema = (schema: ISchema | null): ISchema => {
}
},
properties: {
chargeName: {
title: intl.formatMessage({ id: 'material.sourceList.column.123456789', defaultMessage: '负责人' }),
type: "string",
chargeUserId: {
title: intl.formatMessage({ id: 'material.chargeName', defaultMessage: '负责人' }),
type: 'string',
enum: [],
'x-component-props': {
showSearch: true,
},
chargeUserId: {
title: intl.formatMessage({ id: 'material.sourceList.column.chargeUserId', defaultMessage: '负责人用户id' }),
description: `{{desc()}}`
},
chargeName: {
title: intl.formatMessage({ id: 'material.chargeUserId', defaultMessage: '负责人用户id' }),
type: "string",
enum: [],
display: false,
},
chargeAccount: {
title: intl.formatMessage({ id: 'material.sourceList.column.chargeAccount', defaultMessage: '负责人账号' }),
title: intl.formatMessage({ id: 'material.chargeAccount', defaultMessage: '负责人账号' }),
type: "string",
enum: [],
display: false,
},
chargeRoleName: {
title: intl.formatMessage({ id: 'material.sourceList.column.chargeRoleName', defaultMessage: '负责人所属角色' }),
title: intl.formatMessage({ id: 'material.chargeRoleName', defaultMessage: '负责人所属角色' }),
type: "string",
enum: [],
display: false,
},
// 占位
......@@ -333,7 +334,7 @@ export const getSchema = (schema: ISchema | null): ISchema => {
type: "object",
},
contactMemberName: {
title: intl.formatMessage({ id: 'material.123456789', defaultMessage: '联系人' }),
title: intl.formatMessage({ id: 'material.contactMemberName', defaultMessage: '联系人' }),
type: 'string',
'x-rules': [
{ limitByte: true, maxByte: 40, }
......@@ -345,7 +346,7 @@ export const getSchema = (schema: ISchema | null): ISchema => {
type: "object",
},
contactMemberPhone: {
title: intl.formatMessage({ id: 'material.123456789', defaultMessage: '联系人电话' }),
title: intl.formatMessage({ id: 'material.contactMemberPhone', defaultMessage: '联系人电话' }),
type: 'string',
'x-rules': [
{ 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