Commit c7f7d8c8 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix:处理新增商品无属性异常,处理品类属性弹框清空筛选数据

parent 9256e33b
......@@ -23,6 +23,7 @@ import Search from '@/components/NiceForm/components/Search'
import Submit from '@/components/NiceForm/components/Submit'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import ModalTable from '@/components/ModalTable'
import { clearModalParams } from '@/utils'
// import styles from './index.less'
const formActions = createFormActions();
......@@ -220,6 +221,7 @@ const Attribute: React.FC<{}> = () => {
}
setSyncVisible(false)
setSyncLoading(false)
clearModalParams()
})
} else {
message.error('请选择需要同步的属性')
......@@ -227,6 +229,11 @@ const Attribute: React.FC<{}> = () => {
}
}
const handleAsyncCancel = () => {
setSyncVisible(false)
clearModalParams()
}
const Actions = (
<Space>
<Button type="primary" icon={<PlusOutlined />} onClick={() => { history.push('/memberCenter/commodityAbility/classAndProperty/attribute/add') }}>
......@@ -295,7 +302,7 @@ const Attribute: React.FC<{}> = () => {
<ModalTable
modalTitle='同步平台属性'
confirm={handleAsyncOk}
cancel={() => setSyncVisible(false)}
cancel={handleAsyncCancel}
visible={syncVisible}
columns={columns}
rowSelection={rowSelection}
......
......@@ -20,6 +20,7 @@ import Search from '@/components/NiceForm/components/Search'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import Submit from '@/components/NiceForm/components/Submit'
import { ISchema } from '@formily/antd';
import { clearModalParams } from '@/utils';
const treeActions = createTreeActions()
......@@ -36,7 +37,7 @@ const syncSchema: ISchema = {
type: 'string',
'x-component': 'ModalSearch',
'x-component-props': {
placeholder: '属性组名',
placeholder: '属性组名',
align: 'flex-left',
},
},
......@@ -93,7 +94,6 @@ const PropertyValue: React.FC<{}> = () => {
const [selectRow, setSelectRow] = useState<any[]>([]) // 模态框选择的行数据
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([])
const {
treeData,
resetMenu
......@@ -102,7 +102,6 @@ const PropertyValue: React.FC<{}> = () => {
fetchMenuData: fetchAttributeTreeData,
})
useEffect(() => {
let prefix = sessionStorage.getItem('beforeKeyPrefix')
let beforeKey = history.location.query.attrId
......@@ -306,6 +305,7 @@ const PropertyValue: React.FC<{}> = () => {
}
setSyncVisible(false)
setSyncLoading(false)
clearModalParams()
})
} else {
message.error('请选择需要同步的属性值')
......@@ -313,6 +313,17 @@ const PropertyValue: React.FC<{}> = () => {
}
}
const handleAsyncCancel = () => {
clearModalParams()
setSyncVisible(false)
}
// const clearModalParams = () => {
// let currentState = JSON.parse(sessionStorage.getItem("currentState"))
// let result = {...currentState, queryParams: {}, current: 1}
// sessionStorage.setItem("currentState", JSON.stringify(result))
// }
return <PageHeaderWrapper>
<Row gutter={[24, 36]}>
<Col span={8}>
......@@ -395,9 +406,9 @@ const PropertyValue: React.FC<{}> = () => {
</Row>
<ModalTable
modalTitle='同步平台属性'
modalTitle='同步平台属性'
confirm={handleAsyncOk}
cancel={() => setSyncVisible(false)}
cancel={handleAsyncCancel}
visible={syncVisible}
columns={syncColumns}
rowSelection={rowSelection}
......
......@@ -288,13 +288,13 @@ const AddProducts: React.FC<{}> = (props) => {
// 校验属性单位重量是否提供发票
try {
if(!_params.commodityAttributeList.length || !_params?.unitId || typeof(_params.isInvoice) !== 'boolean' || !_params?.logistics?.weight){
// if(!_params.commodityAttributeList.length || !_params?.unitId || typeof(_params.isInvoice) !== 'boolean' || !_params?.logistics?.weight){
if(!_params?.unitId || typeof(_params.isInvoice) !== 'boolean' || (_params.logistics.deliveryType === 1 && !_params.logistics?.weight)){
throw new Error('请完善商品其他信息!')
}
} catch (e) {
return e
}
console.log(!_params.commodityAttributeList.length && !_params?.unitId && typeof(_params.isInvoice) !== 'boolean' && !_params?.logistics?.weight,_params,'123456')
// 校验价格
try {
if(_params.unitPriceAndPicList){
......
......@@ -526,6 +526,17 @@ export const findLastIndexFlowState = (data: any[], customKey = 'isExecute'): nu
return index;
};
/**
* 清空当前存储在 sessionStorage 中的筛选参数
* 适用于重置 模态框筛选数据
*/
export const clearModalParams = () => {
let currentState = JSON.parse(sessionStorage.getItem("currentState"))
let result = {...currentState, queryParams: {}, current: 1}
sessionStorage.setItem("currentState", JSON.stringify(result))
}
export default {
isArray,
isObject,
......
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