Commit 916310ce authored by XieZhiXiong's avatar XieZhiXiong

fix: 修复对应单据出现同一种商品下拉框id类同的问题

parent cf92bf95
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-09-16 15:16:47
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-01-06 16:18:59
* @LastEditTime: 2021-01-07 10:21:44
* @Description: 联动逻辑相关
*/
import { Modal } from 'antd';
......@@ -346,7 +346,7 @@ export const useBusinessEffects = (context, actions) => {
if (res.code === 1000) {
const goodOptions = res.data.map(item => ({
label: item.productName,
value: item.productId,
value: item.id,
}));
setFieldState('invoicesDetailsRequests.*.product', state => {
FormPath.setIn(state, 'originAsyncData', res.data);
......@@ -359,6 +359,9 @@ export const useBusinessEffects = (context, actions) => {
// 加工入库单
case DOC_TYPE_PROCESS_RECEIPT: {
// 设置配送方式相关字段数据
setFieldValue('transport', DELIVERY_TYPE[first.deliveryType]);
setFieldValue('deliveryType', first.deliveryType);
// 从加工单详情获取 商品 数据
PublicApi.getEnhanceSupplierToBeAddStorageDetails({
id: first.id,
......@@ -372,7 +375,7 @@ export const useBusinessEffects = (context, actions) => {
} = res.data;
const goodOptions = details.map(item => ({
label: `${item.productName}${item.orderNo ? '---' + item.orderNo : ''}`,
value: item.productId,
value: item.id,
}));
setFieldState('invoicesDetailsRequests.*.product', state => {
FormPath.setIn(state, 'originAsyncData', details.map(item => ({
......@@ -390,6 +393,9 @@ export const useBusinessEffects = (context, actions) => {
// 加工发货单
case DOC_TYPE_PROCESS_INVOICE: {
// 设置配送方式相关字段数据
setFieldValue('transport', DELIVERY_TYPE[first.deliveryType]);
setFieldValue('deliveryType', first.deliveryType);
// 从加工单详情获取 商品 数据
PublicApi.getEnhanceProcessToBeAddDeliveryDetails({
id: first.id,
......@@ -402,7 +408,7 @@ export const useBusinessEffects = (context, actions) => {
} = res.data;
const goodOptions = details.map(item => ({
label: `${item.productName}${item.orderNo ? '---订单号:' + item.orderNo : ''}`,
value: item.productId,
value: item.id,
}));
setFieldState('invoicesDetailsRequests.*.product', state => {
FormPath.setIn(state, 'originAsyncData', details);
......@@ -438,12 +444,13 @@ export const useBusinessEffects = (context, actions) => {
} = res.data;
const goodOptions = data.map(item => ({
label: `${item.productName}---订单号:${item.orderNo}`,
value: item.productId,
value: item.orderRecordId,
}));
setFieldState('invoicesDetailsRequests.*.product', state => {
FormPath.setIn(state, 'originAsyncData', data.map(item => ({
...item,
price: item.purchasePrice, // 与采购入库单、销售发货单统一
id: item.orderRecordId,
})));
FormPath.setIn(state, 'props.enum', goodOptions);
});
......@@ -473,12 +480,13 @@ export const useBusinessEffects = (context, actions) => {
} = res.data;
const goodOptions = data.map(item => ({
label: `${item.productName}---订单号:${item.orderNo}`,
value: item.productId,
value: item.orderRecordId,
}));
setFieldState('invoicesDetailsRequests.*.product', state => {
FormPath.setIn(state, 'originAsyncData', data.map(item => ({
...item,
price: item.purchasePrice, // 与采购入库单、销售发货单统一
id: item.orderRecordId,
})));
FormPath.setIn(state, 'props.enum', goodOptions);
});
......@@ -515,9 +523,12 @@ export const useBusinessEffects = (context, actions) => {
// 关联明细 商品下拉框 联动商品ID、单价
onFieldInputChange$('invoicesDetailsRequests.*.product').subscribe(fieldState => {
const { name, originAsyncData, value } = fieldState;
const current = originAsyncData.find(item => item.productId === value);
const current = originAsyncData.find(item => item.id === value);
const invoicesTypeIdVal = getFieldValue('invoicesTypeId');
console.log('value', value)
console.log('current', current)
// 取消选择
if (!value) {
setFieldState(
......@@ -773,7 +784,7 @@ export const useBusinessEffects = (context, actions) => {
}),
state => state.value,
);
const current = originAsyncData ? originAsyncData.find(item => item.productId === goodId) : null;
const current = originAsyncData ? originAsyncData.find(item => item.id === goodId) : null;
if (!current) {
return;
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-12-22 17:57:26
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-12-23 11:24:44
* @LastEditTime: 2021-01-07 10:15:47
* @Description: 获取 单据列表 弹窗数据接口相关
*/
import { PublicApi } from '@/services/api';
......@@ -62,6 +62,7 @@ export const getMachiningWarehousingList = async (params: any) => {
fullAddress: item.receiveAddress || '',
receiverName: item.receiveUserName || '',
phone: item.receiveUserTel || '',
orderNo: item.noticeNo,
})),
total: res.data.totalCount,
};
......@@ -85,6 +86,7 @@ export const getMachiningDeliveryList = async (params: any) => {
fullAddress: item.receiveAddress || '',
receiverName: item.receiveUserName || '',
phone: item.receiveUserTel || '',
orderNo: item.noticeNo,
})),
total: res.data.totalCount,
};
......
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