Commit 6ed948d7 authored by Bill's avatar Bill

Merge branch 'fix418' into 'v2-220418'

处理组件TableOperation按钮权限没传入、CircleCheckbox换行优化问题、商品新增编辑批量设置价格无效的问题 See merge request linkseeks-design/pro-platform!90
parents c97d3974 bf7e0392
......@@ -38,7 +38,7 @@ const TableOperation: React.FC<TableOperationProps> = (props) => {
Object.values(buttonTextFieldMap).filter(Boolean).length > 2
?
<>
<AuthButton btnCode={buttonPermissionsMap[keyNames[0]]}>
<AuthButton btnCode={(buttonPermissionsMap && buttonPermissionsMap[keyNames[0]]) || 'DevTest'}>
<Button type='link' onClick={operationHandler[keyNames[0]]}>{keyNames[0]}</Button>
</AuthButton>
......@@ -49,7 +49,7 @@ const TableOperation: React.FC<TableOperationProps> = (props) => {
keyNames.slice(1, keyNames.length).map((item, i) => buttonTextFieldMap[item] ? (
<Menu.Item key={`menuItem${i}`}>
<AuthButton btnCode={buttonPermissionsMap[item]}>
<AuthButton btnCode={(buttonPermissionsMap && buttonPermissionsMap[item]) || 'DevTest'}>
<Button type='link' onClick={operationHandler[item]}>{item}</Button>
</AuthButton>
</Menu.Item>
......@@ -65,7 +65,7 @@ const TableOperation: React.FC<TableOperationProps> = (props) => {
:
keyNames.map((item, i) => (buttonTextFieldMap[item] ?
<AuthButton btnCode={buttonPermissionsMap[item]} key={`btnItem${i}`}>
<AuthButton btnCode={(buttonPermissionsMap && buttonPermissionsMap[item]) || 'DevTest'} key={`btnItem${i}`}>
<Button type='link' onClick={operationHandler[item]}>{item}</Button>
</AuthButton>
: null))
......
......@@ -105,7 +105,9 @@ const AddProducts: React.FC<{}> = (props) => {
item[next?.id] = next;
return item
}, {})) : []
setSelectedGoods(selectGoods)
// 过滤掉草稿里面id为0的货品项
setSelectedGoods(selectGoods.filter(item => item['id'] !== 0))
}
}
makeDraftRequest()
......
......@@ -225,6 +225,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
let { _attributeNameArr, _attributeValueArr, _temp_attributeObjArr, _temp_attributeValObjArr } = needObject
console.log(selectedGoods, 'selectedGoods')
if (selectedGoods.length > 0) { // 编辑情况下 select货品列表可能会采用接口数据
_col.push({
title: intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.goodsName' }),
......@@ -270,6 +271,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
key: intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.unitPrice' }),
width: 200,
render: (text, record) => {
console.log(record, 'record')
let _priceRange = _tableDataSource[record[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.index' })]][intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.unitPrice' })]
if (!_priceRange || JSON.stringify(_priceRange) === '{}') return null
return Object.keys(_priceRange).map((v, i) => {
......@@ -569,19 +571,28 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.planPrice' })]: ladderPrice ? [...assistantUniqueLadderPrice] : assistantUniquePrice,
[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.assistantUniquePriceRate' })]: assistantUniquePriceRate
}
let newTabeData = [..._tableDataSource]
let newTabeData = []
if (isBatchSetting) { // 判断是否批量设置价格
// _tableDataSource.map(_item => _item[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.unitPrice' })] = _priceRange)
_tableDataSource.forEach(_item => {
_item[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.unitPrice' })] = _priceRange
_item[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.planPrice' })] = ladderPrice ? [...assistantUniqueLadderPrice] : assistantUniquePrice
_item[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.assistantUniquePriceRate' })] = assistantUniquePriceRate
let __item = {..._item}
__item[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.unitPrice' })] = _priceRange
__item[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.planPrice' })] = ladderPrice ? [...assistantUniqueLadderPrice] : assistantUniquePrice
__item[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.assistantUniquePriceRate' })] = assistantUniquePriceRate
newTabeData.push(__item)
})
} else {
newTabeData[curretSetPriceRow[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.index' })]] = _row
_tableDataSource.forEach(_item => {
if(_item[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.index' })] === curretSetPriceRow[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.index' })]) {
newTabeData.push(_row)
} else {
newTabeData.push({..._item})
}
})
// newTabeData[curretSetPriceRow[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.index' })]] = _row
}
_tableDataSource = newTabeData
setTableDataSource(_tableDataSource)
_tableDataSource = [...newTabeData]
console.log(_tableDataSource,'_tableDataSource', newTabeData)
setTableDataSource([..._tableDataSource])
})
}
......
......@@ -309,7 +309,7 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
<CircleCheckbox
onChange={(v) => onChange(v, attrItem)}
options={attrItem.customerAttributeValueList}
expandOperation={<Button style={{marginLeft: 8}} type="dashed" icon={<PlusOutlined />} onClick={() => addAtttributeValue(attrItem)}>{intl.formatMessage({ id: 'commodity.products.addProductsItem.productAttributeForm.circleCheckbox.addButton' })}</Button>}
expandOperation={<Button style={{marginLeft: 8, marginTop: 8}} type="dashed" icon={<PlusOutlined />} onClick={() => addAtttributeValue(attrItem)}>{intl.formatMessage({ id: 'commodity.products.addProductsItem.productAttributeForm.circleCheckbox.addButton' })}</Button>}
/>
</Form.Item>
)
......@@ -353,7 +353,7 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
<Tabs defaultActiveKey="1" tabPosition="left">
{
dataSource?.length > 0 && dataSource.map(attributeItem =>
!productInfoByEdit?.isUpdateAttribute && (attributeItem?.createTime > productInfoByEdit?.createTime) ? null : <TabPane tab={attributeItem.name} key={attributeItem.id}>
!productInfoByEdit?.isUpdateAttribute && (attributeItem?.createTime > productInfoByEdit?.createTime) ? null : <TabPane tab={attributeItem.name} key={attributeItem.id} forceRender={true}>
{
renderTabPanchildren(attributeItem)
}
......
......@@ -42,12 +42,12 @@ const SelectGoodsForm: React.FC<{}> = (props) => {
item[next.id] = next;
return item
}, {}))
if (goodsArr?.length > 0) {
const filterGoods = goodsArr.filter(item => item['id'] !== 0)
if (filterGoods?.length > 0) {
setIsChecked(true)
setIsSelectGoods(true)
//@ts-ignore
setSelectedGoodsRowKeys(goodsArr.map(__ => __.id))
ProductStore.setSelectedGoods(goodsArr)
setSelectedGoodsRowKeys(filterGoods.map(__ => __.id))
ProductStore.setSelectedGoods(filterGoods)
}
}
}, [productInfoByEdit])
......
......@@ -4,13 +4,14 @@
.circleCheckboxUl {
list-style: none;
display: flex;
flex-wrap: wrap;
.circleCheckboxUlLi {
// height: 32px;
line-height: 32px;
background: #F5F6F7;
text-align: center;
border-radius: 4px;
margin: 0 8px;
margin: 8px 8px;
padding: 0px 16px;
cursor: pointer;
span {
......
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