Commit 3a94c508 authored by XieZhiXiong's avatar XieZhiXiong

完善售后维修相关

parent d66023ca
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-04 15:09:09
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-11-16 16:22:36
* @LastEditTime: 2020-11-17 10:52:12
* @Description: 维修商品抽屉组件
*/
import React, { useState, useEffect } from 'react';
......@@ -422,7 +422,6 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
};
handleAfterVisibleChange = visible => {
console.log('visible', visible)
if (!visible) {
this.handleClose();
}
......@@ -452,7 +451,7 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
<Drawer
title="选择维修商品"
width={1200}
// onClose={this.handleClose}
onClose={this.handleClose}
afterVisibleChange={this.handleAfterVisibleChange}
visible={visible}
footer={
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-03 18:30:47
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-11-03 18:50:28
* @LastEditTime: 2020-11-17 10:32:48
* @Description: 联动逻辑相关
*/
import { Modal } from 'antd';
......@@ -38,4 +38,28 @@ export const useBusinessEffects = (context, actions) => {
} = actions;
const linkage = useLinkageUtils();
// 校验维修数量
onFieldInputChange$('repairGoodsList.*.repairCount').subscribe(fieldState => {
const { name, value } = fieldState;
// 已维修数量
const repairedCountValue = getFieldState(
FormPath.transform(name, /\d/, $1 => {
return `repairGoodsList.${$1}.repairedCount`
}),
state => state.value,
);
setFieldState(
FormPath.transform(name, /\d/, $1 => {
return `repairGoodsList.${$1}.repairCount`
}),
state => {
if (+value > repairedCountValue) {
state.errors = '填写值已超过最大可维修数量,请重新填写';
} else {
state.errors = '';
}
}
);
});
}
\ No newline at end of file
......@@ -269,7 +269,8 @@ const RepairForm: React.FC<BillsFormProps> = ({
category: item.category,
brand: item.unitName,
unit: item.costPrice,
repairCount: '',
purchaseCount: item.purchaseCount,
repairedCount: item.repairCount || item.purchaseCount || 0, // 已维修数量
repairReason: '',
};
value.push(atom);
......@@ -299,10 +300,10 @@ const RepairForm: React.FC<BillsFormProps> = ({
backIcon={<ReutrnEle description="返回" />}
title={
!id ?
'新建单据' :
'新建维修申请单' :
isEdit ?
'编辑单据' :
'查看单据'
'编辑维修申请单' :
'查看维修申请单'
}
extra={
(isEdit || !id)
......
......@@ -308,6 +308,16 @@ export const addBillSchema: ISchema = {
type: 'string',
display: false,
},
// 采购数量
purchaseCount: {
type: 'string',
visible: false,
},
// 已维修数量
repairedCount: {
type: 'string',
visible: false,
},
},
}
},
......
......@@ -505,7 +505,7 @@ export const useBusinessEffects = (context, actions) => {
return;
}
if (value > current.purchaseCount) {
if (+value > current.purchaseCount) {
Modal.confirm({
title: '提示',
content: '单据数量已超过商品数量',
......
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