Commit 2c1db914 authored by Bill's avatar Bill

fix: 修改加工bug

parent e14aecbc
......@@ -88,12 +88,30 @@ const schema: ISchema = {
processNum: {
type: 'string',
title: '加工数量',
required: true
'x-rules': [
{
required: true,
message: '请填写加工数量'
},
{
pattern: /^[1-9][0-9]*(\.[0-9]{1,3})?$/,
message: '请填写整数或保留三位小数'
}
]
},
processUnitPrice: {
title: "单价",
type: 'string',
required: true
'x-rules': [
{
required: true,
message: '请填写加工单价'
},
{
pattern: /^[1-9][0-9]*(\.[0-9]{1,3})?$/,
message: '请填写整数或保留三位小数'
}
]
},
isHasTax: {
title: "是否含税",
......@@ -107,11 +125,43 @@ const schema: ISchema = {
label: '否',
value: 0,
}
],
required: true,
"x-linkages": [
{
type: 'value:schema',
target: 'taxRate',
condition: `{{ $value === 1 }}`,
schema: {
"x-rules": [
{
required: true,
}
]
},
otherwise: {
"x-rules": [
{
required: false,
}
]
}
}
]
},
taxRate: {
title: '税率',
type: 'string'
type: 'string',
"x-component-props": {
addonAfter: "%"
},
'x-rules': [
{
pattern: /^[1-9][0-9]*(\.[0-9]{1,2})?$/,
message: '请填写整数或保留两位小数'
}
],
},
},
},
......
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import { Button, Cascader, message, Space, Table } from 'antd';
import { Button, Cascader, message, Space, Table, Modal } from 'antd';
import { LinkOutlined, PlusOutlined, SaveOutlined } from '@ant-design/icons';
import NiceForm from '@/components/NiceForm';
import creataSchema from './schema';
......@@ -33,6 +33,8 @@ import { history } from 'umi';
import moment from 'moment';
import useFormatData from './common/hooks/useFormatData';
const { confirm } = Modal;
const formActions = createFormActions();
const { onFieldInit$, onFieldValueChange$ } = FormEffectHooks
......@@ -449,11 +451,13 @@ const Create = () => {
const productList = isOrderSource ? formActions.getFieldValue('detail.layout1.orderList') : formActions.getFieldValue('detail.layout1.productList');
// const productList = formActions.getFieldValue('detail.layout1.productList');
const { isHasTax, taxRate, processNum, processUnitPrice, enclosure, productProps } = values;
let shouldShowConfirmMsg = false;
const newData = productList.map((_item) => {
/** 加工商品的时候用sku, 如果是加工订单商品的话用orderid */
if ((!isOrderSource && _item.skuid === values.skuid) || (isOrderSource && _item.id === values.id)) {
const other = isOrderSource ? { surplusAndProcessNum: `${_item.surplusProcessNum}/${processNum}` } : {}
const other = isOrderSource ? { surplusAndProcessNum: `${_item.surplusProcessNum}/${processNum}` } : {};
shouldShowConfirmMsg = _item.surplusProcessNum < processNum;
return {
..._item,
...other,
......@@ -473,8 +477,20 @@ const Create = () => {
}
return _item;
})
if (shouldShowConfirmMsg) {
confirm({
title: '加工商品大于剩余加工商品',
content: '加工商品大于剩余加工商品, 是否确认提交?',
onOk() {
formActions.setFieldValue(source === ORDER_SOURCE ? 'detail.layout1.orderList' : 'detail.layout1.productList', newData);
productDrawerToggle(false);
},
});
return;
}
formActions.setFieldValue(source === ORDER_SOURCE ? 'detail.layout1.orderList' : 'detail.layout1.productList', newData);
productDrawerToggle(false);
}
/** -------------- 加工商品相关结束 --------------- */
......
......@@ -44,15 +44,25 @@ const AllQuery = () => {
title: '操作',
render: (text, record) => {
const loading = submitLoadingID.includes(record.id);
const IS_TO_BE_SUBMIT_EXAM = record.supplierInnerStatus === 1
return (
<Space>
{
IS_TO_BE_SUBMIT_EXAM && (
<Spin spinning={loading}>
<a onClick={() => handleSingleReviewOrDelete("exam", {id: record.id})}>提交</a>
</Spin>
) || null
}
<Link to={`/memberCenter/handling/assign/tobeAddQuery/edit?id=${record.id}`}>编辑</Link>
{
IS_TO_BE_SUBMIT_EXAM && (
<Popconfirm title="确定删除吗?" onConfirm={() => handleSingleReviewOrDelete("delete", {id: record.id})}>
<Button type="link" loading={loading} >删除</Button>
</Popconfirm>
) || null
}
</Space>
)
}
......
......@@ -12,8 +12,12 @@ import { useCallback, useState } from "react";
prev.push(params.id);
return prev;
})
const res = await api(params)
let res;
try {
res = await api(params)
} finally {
setSubmitLoadingID((prev: number[]) => prev.filter((_item) => _item !== params.id))
}
return res
}
return { submitLoadingID, onSingleAction }
......
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