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

fix:商品货品区块更改为NiceForm筛选

parent 6331efc7
import React, { useEffect } from 'react'
import { ISchemaFormActions, FormEffectHooks, IFormActions } from '@formily/antd';
import { PublicApi } from '@/services/api';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
const { onFieldValueChange$ } = FormEffectHooks
// 高级筛选schema中用于输入搜索品牌的Effect
export const searchBrandOptionEffect = (context: any, fieldName: string) => {
context.getFieldState(fieldName, state => {
// console.log(state.props['x-component-props'].searchValue, 'pagesearchvalue') // 此处可以实时获取到输入并暂存在schema props的值
PublicApi.getProductSelectGetSelectBrand({ name: state.props['x-component-props'].searchValue }).then(res => {
context.setFieldState(fieldName, state => {
state.props['x-component-props'].dataoption = res.data
})
})
})
}
// 高级筛选schema中用于输入搜索商品品类的Effect
export const searchCustomerCategoryOptionEffect = (context: any, fieldName: string) => {
context.getFieldState(fieldName, state => {
PublicApi.getProductSelectGetSelectCustomerCategory({ name: state.props['x-component-props'].searchValue }).then(res => {
context.setFieldState(fieldName, state => {
state.props['x-component-props'].dataoption = res.data
})
})
})
}
\ No newline at end of file
This diff is collapsed.
...@@ -53,15 +53,30 @@ export const goodsSchema: ISchema = { ...@@ -53,15 +53,30 @@ export const goodsSchema: ISchema = {
type: 'string', type: 'string',
'x-component': 'CustomInputSearch', 'x-component': 'CustomInputSearch',
'x-component-props': { 'x-component-props': {
placeholder: '品牌', placeholder: '商品品牌',
showSearch: true,
showArrow: true,
defaultActiveFirstOption: false,
filterOption: false,
notFoundContent: null,
style: { width: '174px' },
searchValue: null,
dataoption: [],
}, },
}, },
customerCategoryId: { customerCategoryId: {
type: 'string', type: 'string',
enum: [], 'x-component': 'CustomInputSearch',
'x-component-props': { 'x-component-props': {
placeholder: '品类', placeholder: '商品品类',
style: { width: '100%' } showSearch: true,
showArrow: true,
defaultActiveFirstOption: false,
filterOption: false,
notFoundContent: null,
style: { width: '174px' },
searchValue: null,
dataoption: []
}, },
}, },
batch: { batch: {
......
...@@ -179,6 +179,7 @@ const AddProducts: React.FC<{}> = (props) => { ...@@ -179,6 +179,7 @@ const AddProducts: React.FC<{}> = (props) => {
commodityAttributeList: productSelectAttribute, commodityAttributeList: productSelectAttribute,
commodityRemark: _productDescription, commodityRemark: _productDescription,
isAllAttributePic: isAllAttributePic, isAllAttributePic: isAllAttributePic,
isUpdateAttribute: true,
} }
// 处理地址 // 处理地址
let _commodityAreaList: any = [] let _commodityAreaList: any = []
......
...@@ -349,8 +349,8 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -349,8 +349,8 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
let _tempObj: any = { 索引: 0 ,商品名称: productName } let _tempObj: any = { 索引: 0 ,商品名称: productName }
_tempObj['对应货品'] = selectedGoods.length > 0 ? selectedGoods[0].id : 0 // 编辑情况下 对应货品id和单价 特殊处理 _tempObj['对应货品'] = selectedGoods.length > 0 ? selectedGoods[0].id : 0 // 编辑情况下 对应货品id和单价 特殊处理
// 携带unitPriceAndPicList的id字段 // 携带unitPriceAndPicList的id字段
if(!productInfoByEdit.isUpdateAttribute){ if(!productInfoByEdit?.isUpdateAttribute){
_tempObj['规格ID'] = productInfoByEdit.unitPriceAndPicList[0]?.id _tempObj['规格ID'] = productInfoByEdit?.unitPriceAndPicList[0]?.id
} }
if(updateFlag.current){ if(updateFlag.current){
_tempObj['单价'] = productInfoByEdit?.unitPriceAndPicList[0]?.unitPrice || {} _tempObj['单价'] = productInfoByEdit?.unitPriceAndPicList[0]?.unitPrice || {}
......
This diff is collapsed.
import { ISchema } from '@formily/antd'; import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const'; import { FORM_FILTER_PATH } from '@/formSchema/const';
import { PublicApi } from '@/services/api';
// 渠道商品列表高级搜索 // 渠道商品列表高级搜索
export const channelSchema: ISchema = { export const channelSchema: ISchema = {
......
This diff is collapsed.
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