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

fix: 处理商品编辑已选择的货品回显异常

parent f7e929cd
......@@ -157,7 +157,7 @@ export default {
'classAndProperty.class.connectCategory': '关联',
'classAndProperty.class.title': '品类',
'classAndProperty.class.h3': '选择要编辑的品类',
'classAndProperty.class.h3.button': '平台品类同步',
'classAndProperty.class.h3.button': '品类同步',
'classAndProperty.class.h3.tooltip':
'同步平台维护的品类,同步时按品类结构进行同步。',
'classAndProperty.class.h3.none': '暂无菜单, 开始新增',
......
......@@ -245,9 +245,8 @@ const Attribute: React.FC<{}> = () => {
{intl.formatMessage({ id: 'classAndProperty.attribute.actions.button.1' })}
</Button>
<span>
<Button type="default" style={{ marginLeft: 16 }} onClick={syncAttribute}>{intl.formatMessage({ id: 'classAndProperty.attribute.actions.button.2' })}</Button>
<Tooltip title={intl.formatMessage({ id: 'classAndProperty.attribute.actions.tooltip' })}>
&nbsp;<QuestionCircleOutlined />
<Button type="default" style={{ marginLeft: 16 }} onClick={syncAttribute}>{intl.formatMessage({ id: 'classAndProperty.attribute.actions.button.2' })}</Button>
</Tooltip>
</span>
</Space>
......
......@@ -4,6 +4,7 @@ import { Row, Col, Tooltip, Popconfirm, Button, Card, message, Modal } from 'ant
import {
LinkOutlined,
QuestionCircleOutlined,
SyncOutlined,
} from '@ant-design/icons';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import TabTree, { useTreeActions, createTreeActions } from '@/components/TabTree';
......@@ -195,9 +196,8 @@ const ClassProperty: React.FC<{}> = () => {
<p style={{ display: 'flex', justifyContent: 'space-between' }}>
<h3 className="mb-30">{intl.formatMessage({ id: 'classAndProperty.class.h3' })}</h3>
<p>
<Button type="default" onClick={asyncClass}>{intl.formatMessage({ id: 'classAndProperty.class.h3.button' })}</Button>
<Tooltip title={intl.formatMessage({ id: 'classAndProperty.class.h3.tooltip' })}>
&nbsp;<QuestionCircleOutlined />
<Button type="default" icon={<SyncOutlined />} onClick={asyncClass}>{intl.formatMessage({ id: 'classAndProperty.class.h3.button' })}</Button>
</Tooltip>
</p>
</p>
......
......@@ -115,7 +115,6 @@ const PropertyValue: React.FC<{}> = () => {
treeActions.setExpandedKeys([evilKey])
setCustomExpandkeys([evilKey])
treeActions.setSelectKeys([evilKey])
console.log(evilKey, '展开的key')
}
}, [])
......@@ -337,9 +336,8 @@ const PropertyValue: React.FC<{}> = () => {
<p style={{ display: 'flex', justifyContent: 'space-between' }}>
<h3 className="mb-30">{intl.formatMessage({ id: 'classAndProperty.propertyValue.h3' })}</h3>
<p>
<Button type="default" onClick={asyncClass}>{intl.formatMessage({ id: 'classAndProperty.propertyValue.h3.button' })}</Button>
<Tooltip title={intl.formatMessage({ id: 'classAndProperty.propertyValue.h3.tooltip' })}>
&nbsp;<QuestionCircleOutlined />
<Button type="default" onClick={asyncClass}>{intl.formatMessage({ id: 'classAndProperty.propertyValue.h3.button' })}</Button>
</Tooltip>
</p>
</p>
......
......@@ -80,26 +80,6 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
isRecombination
} = ProductStore
// const memoizedValue = useMemo(() => {
// let len = combineAttributeArray.length
// console.log(len, combineAttributeChangeFatories)
// // 第一次构建先和编辑数据比对
// // if(updateFlag){
// // if(len === productInfoByEdit?.unitPriceAndPicList.length){
// // return false
// // } else {
// // return true
// // }
// // }
// if(len === combineAttributeChangeFatories){
// return false
// }else{
// setCombineAttributeChangeFatories(len)
// return true
// }
// } , [combineAttributeArray.length]) // 监听属性组合是否有变动(由属性组合引发数据构建清空价格)
// // *todo* 不点击本页面之前就变更了价格属性 这里的属性组合监听就失效了
useEffect(() => {
let len = combineAttributeArray?.length
if (len) {
......@@ -118,7 +98,6 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
clearPrice.current = true
}
}
// console.log(len, combineAttributeChangeFatories, `是否初次构建|${updateFlag.current}`, clearPrice.current, '监听前后属性条目的变动')
}, [combineAttributeArray?.length])
_tableDataSource = useMemo(() => tableDataSource, [tableDataSource]) // 保持最新值
......@@ -251,20 +230,17 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
dataIndex: intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.goodsName' }),
key: intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.goodsName' }),
width: 360,
render: (text: any, record: any) => <>
<Select style={{ width: '100%' }} defaultValue={text} value={text} onChange={(v) => { tableSelelctChange(v, record) }}>
{
selectedGoods.length > 0 && selectedGoods.map(_item => (
<Option key={_item.id} value={_item.id}>{_item.code}/{_item.name}/{_item.type}/¥{_item.costPrice}</Option>
))
}
</Select>
</>
render: (text, record) => <Select style={{ width: '100%' }} defaultValue={text} value={text} onChange={(v) => { tableSelelctChange(v, record) }}>
{
selectedGoods.length > 0 && selectedGoods.map(_item => (
<Option key={_item.id} value={_item.id}>{_item.code}/{_item.name}/{_item.type}/¥{_item.costPrice}</Option>
))
}
</Select>
})
}
if (_attributeNameArr?.length > 0) {
console.log(_attributeNameArr, _tableDataSource, '_attributeNameArr', _attributeValueArr)
_attributeNameArr.map((_attr, _i) => {
// 同索引下 属性值为空表示前面属性组合值为空
// _attributeValueArr[_i][0] &&
......@@ -340,6 +316,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
if (isRecombination) {
_tempObj[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.goodsName' })] = selectedGoods.length > 0 ? selectedGoods[0].id : 0
} else {
console.log(_rowArr, i, productInfoByEdit.unitPriceAndPicList, _tableDataSource, 'good_ID')
_tempObj[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.goodsName' })] = productInfoByEdit.unitPriceAndPicList[i]?.goods?.id ? productInfoByEdit.unitPriceAndPicList[i].goods.id : 0
}
// 通过 isUpdateAttribute 判断是否需要携带unitPriceAndPicList的id字段
......@@ -640,7 +617,6 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
* @param objectArray
* @param {string} property
*/
const groupBy = (objectArray, property) => {
return objectArray.reduce(function (acc, obj) {
let key = obj[property];
......
......@@ -127,7 +127,7 @@ const ReadyDelevedOrder:React.FC<ReadyDelevedOrderProps> = () => {
const renderOptionButton = (record: any) => {
const buttonGroup = {
[intl.formatMessage({id: 'purchaseOrder.operation2'})]: record.showAfterSales,
[intl.formatMessage({id: 'purchaseOrder.operation5'})]: record.showInvite,
[intl.formatMessage({id: 'purchaseOrder.operation5'})]: true,
}
const operationHandler = {
......
......@@ -160,6 +160,7 @@ class ProductStore implements IProductModule {
this.selectCategoryId = null;
this.selectBrandId = null;
this.productPriceType = null;
this.isRecombination = 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