Commit 575c0fa1 authored by shenshaokai's avatar shenshaokai

Merge branch 'fix-20221102' into 'jinfa-20221102'

fix: bugID=36966 框架合同变更-补充合同数量校验 See merge request project/jinfa-platform!498
parents 6f57af4f 54b8379f
......@@ -171,7 +171,7 @@ const QueryList = () => {
};
const like = (record) => {
history.push(`/memberCenter/contract/manage/QueryList/editing?contractId=${record.id}&oldContractId=1`)
history.push(`/memberCenter/contract/manage/QueryList/editing?contractId=${record.id}&oldContractId=1&contractChange=${record.sourceType}`)
};
const [form] = Form.useForm();
const [id, setId] = useState('');
......
......@@ -725,6 +725,7 @@ const Details = (props: any) => {
style={{
width: '100%',
}}
scroll={{ x: 1800 }}
pagination={{
current: current,
pageSize: 10,
......
......@@ -23,7 +23,7 @@ const { Option } = Select;
const { Text } = Typography;
const intl = getIntl();
const FormList = (props: any) => {
const { currentRef, purchaseMaterielList, sourceType, form, deliveryType, totalAmountChange } = props;
const { currentRef, purchaseMaterielList, sourceType, form, deliveryType, totalAmountChange, contractChange } = props;
const [dataList, setData] = useState([])
const [selectData, setSelectData] = useState<any>([])
const [isPurchaseModalVisible, setIsPurchaseModalVisible] = useState(false);// 显示模态框
......@@ -102,7 +102,7 @@ const FormList = (props: any) => {
placeholder=""
onChange={(e) => setInput(e, 'purchaseCount', index)}
defaultValue={record.purchaseCount}
disabled={[1,2,3].includes(sourceType)} //询价/招标/竞价不能改
disabled={[1, 2, 3].includes(sourceType)} //询价/招标/竞价不能改
/>
</Form.Item>
},
......@@ -119,7 +119,7 @@ const FormList = (props: any) => {
style={{ width: 80 }}
defaultValue={text === 0 || text === 1 ? text.toString() : ''}
onChange={(e) => setInput(e, 'isHasTax', index)}
disabled={[1,2,3].includes(sourceType)} //询价/招标/竞价不能改
disabled={[1, 2, 3].includes(sourceType)} //询价/招标/竞价不能改
>
<Option value="0" key={0}>{intl.formatMessage({ id: 'contract.fou' })}</Option>
......@@ -146,7 +146,7 @@ const FormList = (props: any) => {
defaultValue={text}
onChange={(e) => setInput(e, 'taxRate', index)}
addonAfter="%"
disabled={[1,2,3].includes(sourceType)} //询价/招标/竞价不能改
disabled={[1, 2, 3].includes(sourceType)} //询价/招标/竞价不能改
/>
</Form.Item>
......@@ -170,7 +170,7 @@ const FormList = (props: any) => {
onChange={(e) => setInput(e, 'price', index)}
// addonBefore={intl.formatMessage({id: 'common.money'})}
defaultValue={text}
disabled={[1,2,3].includes(sourceType)} //询价/招标/竞价不能改
disabled={[1, 2, 3].includes(sourceType)} //询价/招标/竞价不能改
/>
</Form.Item>
......@@ -183,7 +183,21 @@ const FormList = (props: any) => {
:
<Form.Item
name={`bidCount${record.id}${index}`}
rules={[{ required: true, message: intl.formatMessage({ id: 'contract.qingshuru' }) }]}
rules={[
{
validator(rule, value, callback) {
if (!value) {
callback(intl.formatMessage({ id: 'contract.qingshuru' }))
}
// 框架合同变更需要做一下前端校验
if (contractChange == 5 && Number(value) < (Number(record.oldBidCount) - Number(record.quantity))) {
callback(`不能小于已生成订单数量${Number(record.oldBidCount) - Number(record.quantity)}`)
return;
}
callback()
},
}
]}
initialValue={text || text == 0 ? text == 0 ? '0' : text.toString() : ''}
>
<Input
......@@ -192,7 +206,7 @@ const FormList = (props: any) => {
}}
onChange={(e) => setInput(e, 'bidCount', index)}
defaultValue={text ? text : ''}
disabled={[1,2,3].includes(sourceType)} //询价/招标/竞价不能改
disabled={[1, 2, 3].includes(sourceType)} //询价/招标/竞价不能改
/>
</Form.Item>
},
......@@ -323,6 +337,12 @@ const FormList = (props: any) => {
i.deliveryMethodName = i.deliveryTypeName
i.deliveryMethod = i.deliveryType
i.materielNo = i.productNo
// 框架合同变更需要缓存一下数量字段,方便做校验
// oldBidCount字段是为了缓存一下bidCount值定义的,假如跟后端返回的字段冲突了,可以改成其他的
if (contractChange == 5) {
i.oldBidCount = Number(i.bidCount)
i.bidCount = Number(i.bidCount) - Number(i.quantity)
}
i.requisitionList?.map(ii => {
ii.label = 'old'
......@@ -415,7 +435,7 @@ const FormList = (props: any) => {
const setInput = (e, name, idx) => {
let flag: boolean = false // 是否触发金额总值变化
let item: any = [...dataList];
item[idx][name] = e?.target?.value || e
item[idx][name] = e?.target?.value ?? e
item[idx].bidAmount = item[idx].bidCount && item[idx].price ? (Number(item[idx].bidCount) * Number(item[idx].price)).toFixed(2) : 0;
setData(item)
......@@ -548,7 +568,6 @@ const FormList = (props: any) => {
let res = newoldData.concat(handlePurchaseData(newData.filter(i => !i.existed)))
let nowList = list?.length > 0 ? res : newoldData
console.log(list,'list');
nowList.map((i, k) => {
i.newId = i.newId || i.prpId
......
......@@ -31,6 +31,7 @@ const Editing: React.FC<{}> = (props: any) => {
query: {
contractId, // 寻源类型
oldContractId,
contractChange
} } } = props;
const currentBasic = useRef<any>({});
const purchaseMate = useRef<any>([])
......@@ -287,6 +288,7 @@ const Editing: React.FC<{}> = (props: any) => {
purchaseMaterielList={purchaseMaterielList}
deliveryType={deliveryType}
totalAmountChange={(num) => setPrice(num)}
contractChange={contractChange}
/>
},
{
......
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