Commit 9b4456f6 authored by XieZhiXiong's avatar XieZhiXiong

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

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