Commit 3013c3bf authored by XieZhiXiong's avatar XieZhiXiong

fix: 添加内部单据处理逻辑

parent 72e12dba
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-09-16 15:16:47
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-01-04 11:22:36
* @LastEditTime: 2021-01-06 16:18:59
* @Description: 联动逻辑相关
*/
import { Modal } from 'antd';
......@@ -257,6 +257,7 @@ export const useBusinessEffects = (context, actions) => {
break;
}
// 其他的走内部单据
default: {
freeEnumItem(newEnum, 'value', DEPENDENT_DOC_INTERNAL);
break;
......@@ -285,6 +286,7 @@ export const useBusinessEffects = (context, actions) => {
if (current) {
linkage.value('invoicesTypeCode', current.number);
linkage.value('direction', current.direction);
}
linkage.componentProps('orderNo', params);
});
......@@ -515,7 +517,6 @@ export const useBusinessEffects = (context, actions) => {
const { name, originAsyncData, value } = fieldState;
const current = originAsyncData.find(item => item.productId === value);
const invoicesTypeIdVal = getFieldValue('invoicesTypeId');
const relevanceInvoicesVal = getFieldValue('relevanceInvoices');
// 取消选择
if (!value) {
......@@ -760,7 +761,6 @@ export const useBusinessEffects = (context, actions) => {
onFieldInputChange$('invoicesDetailsRequests.*.productCount').subscribe(fieldState => {
const { name, value } = fieldState;
const invoicesTypeIdVal = getFieldValue('invoicesTypeId');
const relevanceInvoicesVal = getFieldValue('relevanceInvoices');
const originAsyncData = getFieldState(
FormPath.transform(name, /\d/, $1 => {
return `invoicesDetailsRequests.${$1}.product`
......@@ -876,4 +876,20 @@ export const useBusinessEffects = (context, actions) => {
}
);
});
// 对应单据改变
onFieldValueChange$('relevanceInvoices').subscribe(fieldState => {
const { value } = fieldState;
// 对应单据等于内部单据
// formily 的 bug,设置了 display 为 false,该列还是会展示在页面中
// 所以把title设置
if (value === DEPENDENT_DOC_INTERNAL) {
linkage.display('*(orderNo,memberName,address,transport)', false);
linkage.display('invoicesDetailsRequests.*.*(product,productId,price,amount)', false);
} else {
linkage.display('*(orderNo,memberName,address,transport)');
linkage.display('invoicesDetailsRequests.*.*(product,productId,price,amount)');
}
});
}
\ No newline at end of file
......@@ -379,12 +379,17 @@ export const addBillSchema: ISchema = {
},
// 会员id,可以是采购会员id、销售会员id
membersId: {
type: 'boolean',
type: 'string',
display: false,
},
// 会员角色id,可以是采购会员角色id、销售会员角色id
membersRoleId: {
type: 'boolean',
type: 'string',
display: false,
},
// 单据类型方向
direction: {
type: 'string',
display: false,
},
},
......@@ -481,16 +486,19 @@ export const addBillSchema: ISchema = {
message: '请选择商品',
},
],
display: true,
},
productId: {
type: 'string',
title: '商品ID',
'x-component': 'Text',
display: true,
},
price: {
type: 'string',
title: '单价',
'x-component': 'Text',
display: true,
},
productCount: {
type: 'string',
......@@ -513,6 +521,7 @@ export const addBillSchema: ISchema = {
type: 'string',
title: '金额',
'x-component': 'Text',
display: true,
},
// 额外的数据,用于收集不需要展示的数据
extraData: {
......
......@@ -19,6 +19,7 @@ export const useLinkageUtils = () => {
loading: linkage('loading', true),
loaded: linkage('loading', false),
value: linkage('value'),
componentProps: linkage('props.x-component-props', {})
componentProps: linkage('props.x-component-props', {}),
display: linkage('display', true),
}
}
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