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

fix:渠道商品批量上下架

parent 052b717c
......@@ -128,9 +128,10 @@ const SearchSelect = (props: ISchemaFieldComponentProps) => {
filterOption={false}
loading={loading}
options={dataSource}
getPopupContainer={triggerNode => {
return triggerNode
}}
// getPopupContainer={triggerNode => {
// return triggerNode
// }}
getPopupContainer={() => document.getElementById('root')} /* 处理option被遮挡 */
value={props.value}
dropdownRender={originNode => <SelectContent confirm={confirm} resetField={resetField} parentRef={ref} handleChange={handleChange} multiple={multiple} value={props.value}>{originNode}</SelectContent>}
{...multipleProps}
......
......@@ -307,27 +307,76 @@ const DirectChannel: React.FC<{}> = () => {
const handleUpDown = () => {
setIsDisabledOKbtn(true)
let params: any = {
idList: isBatchOption ? selectRow.map(item => item.id) : [currentOptionId],
shopList: checkedValues
let params: any = {}
if(isBatchOption){
params = {
idList: selectRow.map(item => item.id),
shopList: checkedValues
}
}else{
params = {
id: currentOptionId,
shopList: checkedValues
}
}
if(isUp)
if(checkedValues.length > 0){
PublicApi.postProductChannelCommodityPublishCommodity(params).then(res => {
if(isBatchOption){ // 批量操作区分上下架
if(isUp){
if(checkedValues.length > 0){
PublicApi.postProductChannelCommodityBatchPublishCommodity(params).then(res => {
setUpDownModal(false)
ref.current.reload()
setIsDisabledOKbtn(false)
})
}else{
setIsDisabledOKbtn(false)
message.error('请选择需要上架的渠道商城')
}
}else{
PublicApi.postProductChannelCommodityBatchOffPublishCommodity(params).then(res => {
setUpDownModal(false)
ref.current.reload()
setIsDisabledOKbtn(false)
})
}
}else{
if(isUp){
if(checkedValues.length > 0){
PublicApi.postProductChannelCommodityPublishCommodity(params).then(res => {
setUpDownModal(false)
ref.current.reload()
setIsDisabledOKbtn(false)
})
}else{
setIsDisabledOKbtn(false)
message.error('请选择需要上架的渠道商城')
}
}else{
setIsDisabledOKbtn(false)
message.error('请选择需要上架的渠道商城')
PublicApi.postProductChannelCommodityPublishCommodity(params).then(res => {
setUpDownModal(false)
ref.current.reload()
setIsDisabledOKbtn(false)
})
}
else
PublicApi.postProductChannelCommodityOffPublishCommodity(params).then(res => {
setUpDownModal(false)
ref.current.reload()
setIsDisabledOKbtn(false)
})
}
// if(isUp)
// if(checkedValues.length > 0){
// PublicApi.postProductChannelCommodityPublishCommodity(params).then(res => {
// setUpDownModal(false)
// ref.current.reload()
// setIsDisabledOKbtn(false)
// })
// }else{
// setIsDisabledOKbtn(false)
// message.error('请选择需要上架的渠道商城')
// }
// else
// PublicApi.postProductChannelCommodityOffPublishCommodity(params).then(res => {
// setUpDownModal(false)
// ref.current.reload()
// setIsDisabledOKbtn(false)
// })
}
......
......@@ -208,150 +208,64 @@ export const channelSchema: ISchema = {
// 添加渠道商品模态框高级筛选
export const addChannelSchema: ISchema = {
type: 'object',
properties: {
name: {
type: 'string',
'x-component': 'ModalSearch',
'x-component-props': {
placeholder: '商品名称',
align: 'flex-left',
properties: {
name: {
type: 'string',
'x-component': 'ModalSearch',
'x-component-props': {
placeholder: '商品名称',
align: 'flex-left',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
flexWrap: 'nowrap',
style: {
marginRight: 0
}
},
colStyle: {
marginTop: 20,
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
flexWrap: 'nowrap',
style: {
marginRight: 0
}
},
colStyle: {
marginTop: 20,
},
properties: {
categoryId: {
type: 'string',
"x-component": 'SearchSelect',
"x-component-props": {
placeholder: '请选择品类',
className: 'fixed-ant-selected-down',
fetchSearch: PublicApi.getProductSelectGetSelectCategory,
}
},
properties: {
categoryId: {
type: 'string',
"x-component": 'SearchSelect',
"x-component-props": {
placeholder: '请选择品类',
className: 'fixed-ant-selected-down', // 该类强制将显示的下拉框出现在select下, 只有这里出现问题, ??
fetchSearch: PublicApi.getProductSelectGetSelectCategory,
}
},
brandId: {
type: 'string',
"x-component": 'SearchSelect',
"x-component-props": {
placeholder: '请选择品牌',
fetchSearch: PublicApi.getProductSelectGetSelectBrand,
}
brandId: {
type: 'string',
"x-component": 'SearchSelect',
"x-component-props": {
placeholder: '请选择品牌',
fetchSearch: PublicApi.getProductSelectGetSelectBrand,
}
},
parentMemberId: {
type: 'string',
enum: [],
'x-component-props': {
placeholder: '上级渠道',
},
parentMemberId: {
type: 'string',
enum: [],
'x-component-props': {
placeholder: '上级渠道',
},
},
submit: {
"x-component": 'Submit',
"x-mega-props": {
span: 1
},
submit: {
"x-component": 'Submit',
"x-mega-props": {
span: 1
},
"x-component-props": {
children: '查询'
}
"x-component-props": {
children: '查询'
}
}
}
}
// type: 'object',
// properties: {
// mageLayout: {
// type: 'object',
// 'x-component': 'mega-layout',
// properties: {
// topLayout: {
// type: 'object',
// 'x-component': 'mega-layout',
// 'x-component-props': {
// grid: true,
// },
// properties: {
// name: {
// type: 'string',
// 'x-component': 'Search',
// 'x-component-props': {
// placeholder: '商品名称',
// },
// },
// },
// },
// [FORM_FILTER_PATH]: {
// type: 'object',
// 'x-component': 'flex-layout',
// 'x-component-props': {
// rowStyle: {
// flexWrap: 'nowrap',
// justifyContent: 'flex-start'
// },
// colStyle: {
// marginLeft: 20,
// },
// },
// properties: {
// brandId: {
// type: 'string',
// 'x-component': 'CustomInputSearch',
// 'x-component-props': {
// placeholder: '商品品牌',
// showSearch: true,
// showArrow: true,
// defaultActiveFirstOption: false,
// filterOption: false,
// notFoundContent: null,
// searchValue: null,
// dataoption: [],
// },
// },
// customerCategoryId: {
// type: 'string',
// 'x-component': 'CustomInputSearch',
// 'x-component-props': {
// placeholder: '商品品类',
// showSearch: true,
// showArrow: true,
// defaultActiveFirstOption: false,
// filterOption: false,
// notFoundContent: null,
// searchValue: null,
// dataoption: [],
// },
// },
// parentMemberId: {
// type: 'string',
// enum: [],
// 'x-component-props': {
// placeholder: '上级渠道',
// },
// },
// submit: {
// 'x-component': 'Submit',
// 'x-mega-props': {
// span: 1,
// },
// 'x-component-props': {
// children: '查询',
// },
// },
// },
// },
// },
// },
// },
}
}
\ No newline at end of file
......@@ -4,26 +4,11 @@ import { PublicApi } from '@/services/api';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
const { onFieldValueChange$ } = FormEffectHooks
export const useWarehouseSelect = (context: ISchemaFormActions) => {
onFieldValueChange$('warehouseId').subscribe(state => {
// 货品ID
const goodsId = context.getFieldValue('productId')
const warehouseId = state.value
PublicApi.getWarehouseInventoryByItemNo({
warehouseId,
itemId: goodsId
}).then(res => {
const { data } = res
context.setFieldValue('NO_SUBMIT3', data.inventory)
})
})
}
export const createAddRepositoryEffect = (context: ISchemaFormActions) => {
const fetchWarehouseAll = async () => {
const { data } = await PublicApi.getWarehouseWarehouseAll()
context.setFieldState('warehouseId', state => {
state.warehouseLists = data
export const createAddContractTemplateEffect = (context: ISchemaFormActions) => {
const fetchListContractTemplateAll = async () => {
const { data } = await PublicApi.getOrderSelectListContractTemplate()
context.setFieldState('contractTemplateId', state => {
state.contractTemplateLists = data
})
return data.map(v => ({
value: v.id,
......@@ -31,8 +16,7 @@ export const createAddRepositoryEffect = (context: ISchemaFormActions) => {
}))
}
useAsyncSelect('warehouseId', fetchWarehouseAll)
useWarehouseSelect(context)
useAsyncSelect('contractTemplateId', fetchListContractTemplateAll)
}
export const useUnitPreview = (initValue, context) => {
......
......@@ -13,43 +13,3 @@
cursor: pointer;
}
}
// 添加仓位
.storeItemRadio{
display: flex;
flex-wrap: wrap;
// width: 320px;
margin: 0 auto;
& label{
width: 320px !important;
height: 48px !important;
line-height: 48px !important;
margin: 8px 0;
margin-right: 24px;
}
}
//仓位调拨
.circleAmount{
width: 160px;
height: 160px;
border: 4px solid #edeef2;
background-color: #fafbfc;
border-radius: 50%;
& p{
height: 160px;
line-height: 160px;
text-align: center;
font-size: 20px;
font-weight: bold;
}
}
//查看仓位
.amount{
font-size:24px;
font-weight:bold;
color:rgba(23,43,77,1);
}
\ No newline at end of file
......@@ -165,10 +165,15 @@ export function omit(obj: any, arr: string[]) {
return tempObj
}
export const findItemAndDelete = (arr: any[], target) => {
/**
* @param { Object[] } arr 源数据
* @param { any } target 目标值 通常是id等主键
* @param { string } customKey 可选 自定义主键 默认'id'
*/
export const findItemAndDelete = (arr: any[], target: any, customKey?: string) => {
const newArr = [...arr]
if (newArr.length > 0 && isObject(newArr[0])) {
return newArr.filter(v => v.id !== target)
return newArr.filter(v => v[customKey||'id'] !== target)
}
const targetIndex = arr.indexOf(target)
if (targetIndex === -1) {
......
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