Commit 397496bc authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

修改需求报价bug

parent b11907b5
......@@ -6,7 +6,7 @@
* @LastEditTime: 2020-09-11 16:51:28
*/
import React, { Component, useState, useEffect, Fragment } from 'react';
import { Modal, Button, Form, Radio, AutoComplete, Tabs, Input, Select, Checkbox } from 'antd'
import { Modal, Button, Form, Radio, AutoComplete, Tabs, Input, Select, Checkbox, message } from 'antd'
import { PublicApi } from '@/services/api'
const { TabPane } = Tabs
const { Option } = Select
......@@ -43,11 +43,13 @@ const comfirmDialog: React.FC<Params> = (props) => {
const [placeOfOriginList, setplaceOfOriginList] = useState([])//产地
const handleCancel = () => {
}
const handletOk = () => {
form.validateFields().then(v => {
console.log(v)
const handletOk = async () => {
try {
const v = await form.validateFields();
props.onOK(v)
})
} catch(err) {
message.error('有必填项没填写请检查!')
}
// if(props.type){
// value.type = props.type
// }
......@@ -176,14 +178,20 @@ const comfirmDialog: React.FC<Params> = (props) => {
<Form.Item
label='规格型号'
name='model'
required
rules={[{
required: true,
message: '此项为必填项'
}]}
>
<Input placeholder='' />
</Form.Item>
<Form.Item
label='商品品牌'
name='brand'
required
rules={[{
required: true,
message: '此项为必填项'
}]}
>
<Input placeholder='' />
</Form.Item>
......@@ -198,8 +206,7 @@ const comfirmDialog: React.FC<Params> = (props) => {
}
{
props.sourceData.length > 0 && props.sourceData.map((attributeItem: any) => {
console.log(attributeItem, 10086)
return(
return (
<TabPane tab={attributeItem.name} key={attributeItem.id}>
{
renderTabPanchildren(attributeItem)
......@@ -212,7 +219,10 @@ const comfirmDialog: React.FC<Params> = (props) => {
<Form.Item
label='单位'
name='purchaseNuit'
required
rules={[{
required: true,
message: '此项为必填项'
}]}
>
<Input placeholder='' />
</Form.Item>
......@@ -220,7 +230,10 @@ const comfirmDialog: React.FC<Params> = (props) => {
<Form.Item
label='采购数量'
name='purchaseQuantity'
required
rules={[{
required: true,
message: '此项为必填项'
}]}
>
<Input placeholder='' />
</Form.Item>
......
......@@ -351,7 +351,7 @@ const Detail: React.FC<{}> = () => {
PublicApi.getProductPlatformGetCategoryById({ id: seletCategoryId }).then(res => {
if (res.code === 1000) {
let data = res.data
console.log(data, 10086)
console.log(data, 10086)
settabData([data])//转成数组
let da = []
// data.forEach((item: any) => {
......@@ -531,12 +531,7 @@ const Detail: React.FC<{}> = () => {
const handleOptionBtn = (type: any) => {
switch (type) {
case 1:
if(Object.keys(tabData).length > 0) {
setdialogVisible(true)
}else{
message.error('请选择商品品类!')
}
setdialogVisible(true)
break;
case 2:
setVisibleChannelMember(true)
......@@ -609,7 +604,7 @@ const Detail: React.FC<{}> = () => {
*/
if (id) {
PublicApi.getOrderRequisitionFormDetails({ id }).then(res => {
PublicApi.getOrderRequisitionFormDetails({ id: id }).then(res => {
if (res.code === 1000) {
let data = res.data
let areaCodeList = []
......@@ -639,7 +634,7 @@ const Detail: React.FC<{}> = () => {
tabForm.resetFields()
//需求单对接列表
PublicApi.getOrderRequisitionFormDemandDockingList({ id }).then(res => {
PublicApi.getOrderRequisitionFormDemandDockingList({ id:id }).then(res => {
if (res.code === 1000) {
let { data } = res.data
if (_plattype == 2) {//系统匹配
......@@ -929,23 +924,26 @@ const Detail: React.FC<{}> = () => {
*/
const handleSubmit = (values: any) => {
let item = {}
// Object.keys(values).forEach((key) => {
// item[key] = values[key]
// })
let list = []
//先循环所有 再循环有值的
otherList.forEach((vitem: any) => {
if (otherList.length > 0) {
otherList.forEach((vitem: any) => {
Object.keys(values).forEach((key) => {
if (vitem.title == key) {
item[key] = values[vitem.title]
} else {
item[key] = values[key]
}
})
})
} else {
Object.keys(values).forEach((key) => {
if (vitem.title == key) {
item[key] = values[vitem.title]
console.log(values, '详情页面1')
} else {
item[key] = values[key]
console.log(values, '详情页面2')
}
item[key] = values[key]
})
})
}
list.push(item)
setproductSource([...productSource, ...list])//新增就要合并
......
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