Commit 8951415b authored by Bill's avatar Bill

fix: 内容管理添加标签名

parent ed6485b7
......@@ -41,6 +41,7 @@ export interface ShopInfo {
describe: string;
state: number;
url: string;
isDefault?: any;
}
export interface OrderMode {
......
......@@ -100,6 +100,7 @@ const InfomationInfo = () => {
}
setFormStatus('layout.contentLayout.content', 'readOnly', isView);
if(category) {
actions.setFieldValue('layout.categoryLayout.firstCategoryName', data.firstCategoryName);
const secondCategory = category.filter((_row) => _row.id === data.firstCategoryId)[0]?.list || [];
const options = secondCategory.map((_row: any) => ({label: _row.name, value: _row.id, children: _row.list }))
setFormStatus('layout.categoryLayout.secondCategoryId', 'options', options);
......@@ -118,9 +119,7 @@ const InfomationInfo = () => {
})
setType(targetColumn?.type)
}
}
setFormStatus('layout.imageUpload', 'imgUrl', data.imageUrl)
setIsTop(data.top);
setLabelIds(data.labelIds)
......@@ -133,7 +132,7 @@ const InfomationInfo = () => {
...value,
top: isTop,
type: type,
labelIds: labelIds,
labelIds: labelIds || [],
content: content,
}
const serviceActions = isAdd
......@@ -141,7 +140,6 @@ const InfomationInfo = () => {
: PublicApi.postManageContentInformationUpdate
const postData = isAdd ? tempPostData : {...tempPostData, id: id};
console.log("postData", postData);
setSubmitLoading(true)
setUnsaved(false)
serviceActions(postData).then((data) => {
......@@ -184,10 +182,18 @@ const InfomationInfo = () => {
setType(currentType ? currentType.type : 0)
})
})
onFieldValueChange$('layout.categoryLayout.*(firstCategoryId,secondCategoryId)').subscribe(({ value, props, name }) => {
onFieldValueChange$('layout.categoryLayout.*(firstCategoryId,secondCategoryId, thirdlyCategoryId)').subscribe(({ value, props, name }) => {
const matchName = name.match(/(.*?)Id/)
if(matchName?.length !== 2) {
return
}
const target = props["x-component-props"]!.options.filter((_row) => _row.value === value)[0];
actions.setFieldValue(`layout.categoryLayout.${matchName[1]}Name`, target?.label)
if(name === 'thirdlyCategoryId') {
return;
}
const childrenName = name === 'firstCategoryId' ? 'secondCategoryId' : 'thirdlyCategoryId';
const optionChildren = props["x-component-props"]!.options.filter((_row) => _row.value === value)[0]?.children || [];
console.log(optionChildren)
const optionChildren = target?.children || [];
const list = optionChildren?.map((_item) => ({ label: _item.name, value: _item.id, children: _item.list }) );
actions.setFieldState(`layout.categoryLayout.${childrenName}`, state => {
state.value = "",
......
......@@ -163,6 +163,10 @@ const schema = {
},
]
},
firstCategoryName: {
type: 'string',
display: false,
},
secondCategoryId: {
type: 'string',
'x-component': "Select",
......@@ -177,12 +181,20 @@ const schema = {
},
]
},
secondCategoryName: {
type: 'string',
display: false,
},
thirdlyCategoryId: {
type: 'string',
'x-component': "Select",
'x-component-props': {
options: [],
},
},
thirdlyCategoryName: {
type: 'string',
display: false
}
}
},
......
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