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

fix:

parent f5cf7d1a
...@@ -34,6 +34,9 @@ const AddProducts: React.FC<{}> = (props) => { ...@@ -34,6 +34,9 @@ const AddProducts: React.FC<{}> = (props) => {
const [isDisableSaveBtn, setIsDisableSaveBtn] = useState<boolean>(false) const [isDisableSaveBtn, setIsDisableSaveBtn] = useState<boolean>(false)
const [currentTemplateName, setCurrentTemplateName] = useState<string>() const [currentTemplateName, setCurrentTemplateName] = useState<string>()
let [formRefs, setFormRefs] = useState([]) //子form的ref数组 let [formRefs, setFormRefs] = useState([]) //子form的ref数组
const [forceRenderRef, setForceRenderRef] = useState<boolean>(false) // 编辑情况下 是否强制渲染后面的 tabpane
const isFirstRender = useRef<boolean>(true) // 编辑情况下 是否是初始切换品类
const { ProductStore } = store const { ProductStore } = store
const { const {
productSelectAttribute, productSelectAttribute,
...@@ -61,8 +64,17 @@ const AddProducts: React.FC<{}> = (props) => { ...@@ -61,8 +64,17 @@ const AddProducts: React.FC<{}> = (props) => {
setProductName(data?.name) setProductName(data?.name)
const attributeRes = await PublicApi.getProductCustomerGetCustomerCategoryById({ id: data?.customerCategory?.id + '' }) const attributeRes = await PublicApi.getProductCustomerGetCustomerCategoryById({ id: data?.customerCategory?.id + '' })
setAttributeLists(attributeRes.data?.customerAttributeList) setAttributeLists(attributeRes.data?.customerAttributeList)
// return productRes.code
} }
makeRequest() makeRequest()
// .then(v => {
// if(v === 1000){
// if(!isFirstRender)
// setForceRenderRef(true)
// else
// isFirstRender.current = false
// }
// })
} }
return () => { return () => {
......
...@@ -90,8 +90,7 @@ const BasicInfoForm: React.FC<Iprops> = (props) => { ...@@ -90,8 +90,7 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
let arr = [...res.data] //裁去最后一级别 let arr = [...res.data] //裁去最后一级别
for (let index in arr) { for (let index in arr) {
for (let _index in arr[index].areaResponses) { for (let _index in arr[index].areaResponses) {
let o = arr[index].areaResponses let o: any = arr[index].areaResponses
//@ts-ignore
o[_index].areaResponses = null o[_index].areaResponses = null
} }
} }
...@@ -114,11 +113,7 @@ const BasicInfoForm: React.FC<Iprops> = (props) => { ...@@ -114,11 +113,7 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
} }
}, [productInfoByEdit, getBasicFormParamsByEdit]) }, [productInfoByEdit, getBasicFormParamsByEdit])
const onFinish = (values: any) => { const handleBrandSearch = (value?: any) => {
console.log(values,'原values')
}
const handleBrandSearch = (value?: any) => { // end value
PublicApi.getProductSelectGetSelectBrand({ name: value||'' }).then(res => { PublicApi.getProductSelectGetSelectBrand({ name: value||'' }).then(res => {
if (res.code === 1000) if (res.code === 1000)
setBrandData(res.data) setBrandData(res.data)
......
...@@ -90,7 +90,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -90,7 +90,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
if(history.location.query?.id && !flagRef.current) { if(history.location.query?.id && !flagRef.current) {
flagRef.current = true flagRef.current = true
} else { } else {
setProductSelectAttribute([]) // setProductSelectAttribute([])
priceForm.resetFields() priceForm.resetFields()
priceForm.setFieldsValue({isMemberPrice: false, priceType: planPrice}) priceForm.setFieldsValue({isMemberPrice: false, priceType: planPrice})
} }
......
...@@ -34,7 +34,7 @@ const ProductImageForm: React.FC<{}> = (props) => { ...@@ -34,7 +34,7 @@ const ProductImageForm: React.FC<{}> = (props) => {
// 品类 变动清空数据 // 品类 变动清空数据
// 编辑下 flag为false 不清空;编辑下 flag为true 新建清空 // 编辑下 flag为false 不清空;编辑下 flag为true 新建清空
if(history.location.query?.id && !flagRef.current) { if(history.location.query?.id && !flagRef.current) {
flagRef.current = true flagRef.current = true
} else { } else {
onChangeSetImageType({target: { value: true }}) onChangeSetImageType({target: { value: true }})
} }
......
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