Commit 3a94c508 authored by XieZhiXiong's avatar XieZhiXiong

完善售后维修相关

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