Commit 9b4456f6 authored by XieZhiXiong's avatar XieZhiXiong

chore: 更改商品分类选择组件

parent afce4a6c
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-09-16 15:16:47
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-01-08 10:46:53
* @LastEditTime: 2021-01-18 14:11:18
* @Description: 联动逻辑相关
*/
import { Modal } from 'antd';
......@@ -339,9 +339,14 @@ export const useBusinessEffects = (context, actions) => {
// 采购入库单、销售发货单
case DOC_TYPE_PURCHASE_RECEIPT:
case DOC_TYPE_SALES_INVOICE: {
// 设置配送方式相关字段数据
setFieldValue('transport', DELIVERY_TYPE[first.deliveryType]);
setFieldValue('deliveryType', first.deliveryType);
// 根据选择的订单查询 订单对应的商品,并给 Table 的商品下拉框赋值
PublicApi.getOrderProcurementOrderProductList({
id: first.id,
orderNo: '',
}).then(res => {
if (res.code === 1000) {
const goodOptions = res.data.map(item => ({
......
......@@ -17,6 +17,7 @@ import ModalTable from '@/components/ModalTable';
import Search from '@/components/NiceForm/components/Search';
import Submit from '@/components/NiceForm/components/Submit';
import SearchSelect from '@/components/NiceForm/components/SearchSelect';
import CustomCategorySearch from '@/components/NiceForm/components/CustomCategorySearch';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
......@@ -156,10 +157,8 @@ const BillsForm: React.FC<BillsFormProps> = ({
}
// 获取会员品类
const fetchCustomerCategory = async (name = '') => {
const res = await PublicApi.getProductSelectGetSelectCustomerCategory({
name,
});
const fetchCustomerCategory = async () => {
const res = await PublicApi.getProductCustomerGetCustomerCategoryTree();
if (res.code === 1000) {
return res.data;
}
......@@ -173,7 +172,7 @@ const BillsForm: React.FC<BillsFormProps> = ({
}
setInfoLoading(true);
PublicApi.getWarehouseInvoicesDetails({
invoicesId: id,
invoicesId: `${id}`,
deliveryNo,
storageNo,
}).then(res => {
......@@ -1895,6 +1894,7 @@ const BillsForm: React.FC<BillsFormProps> = ({
Search,
Submit,
SearchSelect,
CustomCategorySearch,
},
effects: ($, actions) => {
const linkage = useLinkageUtils();
......@@ -1906,33 +1906,27 @@ const BillsForm: React.FC<BillsFormProps> = ({
FORM_FILTER_PATH,
);
useAsyncSelect('brandId', fetchBrand, ['name', 'id']);
useAsyncSelect('customerCategoryId', fetchCustomerCategory, ['name', 'id']);
onFormInit$().subscribe(() => {
// 初始化远程检索逻辑
linkage.componentProps('customerCategoryId', {
onSearch: async value => {
linkage.loading('customerCategoryId');
const dataSource = await fetchCustomerCategory(value);
linkage.enum('customerCategoryId', dataSource.map(item => ({
label: item.name,
value: item.id,
})));
linkage.loaded('customerCategoryId');
},
fetchCustomerCategory().then(res => {
linkage.componentProps('customerCategoryId', {
dataoption: res,
});
});
// 初始化远程检索逻辑
linkage.componentProps('brandId', {
onSearch: async value => {
linkage.loading('brandId');
const dataSource = await fetchCustomerCategory(value);
linkage.enum('brandId', dataSource.map(item => ({
label: item.name,
value: item.id,
})));
linkage.loaded('brandId');
},
});
// linkage.componentProps('brandId', {
// onSearch: async value => {
// linkage.loading('brandId');
// const dataSource = await fetchBrand(value);
// linkage.enum('brandId', dataSource.map(item => ({
// label: item.name,
// value: item.id,
// })));
// linkage.loaded('brandId');
// },
// });
});
},
inline: false,
......
......@@ -880,14 +880,14 @@ export const goodsSearchSchema: ISchema = {
},
},
customerCategoryId: {
type: 'string',
enum: [],
type: 'string',
'x-component': 'CustomCategorySearch',
'x-component-props': {
placeholder: '品类',
showSearch: true,
defaultActiveFirstOption: false,
showArrow: true,
filterOption: false,
placeholder: '品类',
showSearch: true,
notFoundContent: null,
dataoption: [],
fieldNames: { label: 'title', value: 'id', children: 'children' },
},
},
brandId: {
......@@ -895,10 +895,7 @@ export const goodsSearchSchema: ISchema = {
enum: [],
'x-component-props': {
placeholder: '品牌',
showSearch: true,
defaultActiveFirstOption: false,
showArrow: true,
filterOption: false,
allowClear: true,
},
},
submit: {
......
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