Commit 8a695f3c authored by GuanHua's avatar GuanHua
parents 4835f050 0076b854
......@@ -3,7 +3,7 @@
* @Date: 2020-08-28 10:07:45
* @LastEditors: LeeJiancong
* @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-09-15 14:32:41
* @LastEditTime: 2020-09-16 14:23:28
*/
import React, { Component, useState,useRef, useEffect,useImperativeHandle } from 'react';
import { Modal, Button,Space, Form, Radio, AutoComplete, Badge,Tabs, Input, Select, Checkbox } from 'antd'
......@@ -120,12 +120,15 @@ const columns: ColumnType<any>[] = [
const comfirmDialog: React.FC<Params> = (props,{onRef}) => {
// const {onRef} = props
// const cRef = props.currentRef
// console.log('数据',props.sourceData)
console.log('数据',props)
const [visible, setsVisible] = useState(false) //state hook写法
const [Curform] = Form.useForm()
const { pageStatus, id } = usePageStatus()
//PageStatus:{0: "ADD", 1: "EDIT", 2: "PREVIEW", ADD: 0, EDIT: 1, PREVIEW: 2}0: "ADD"1: "EDIT"2: "PREVIEW"ADD: 0EDIT: 1PREVIEW: 2} 1
let _title = pageStatus === PageStatus.PREVIEW ? '查看' : id ? '编辑' : '新建'
let _title = props.mode === 2?'查看': props.mode === 1 ?' 编辑':'新建'
const headerTitle = (`${_title}报价明细`)
const [commodityAttributedataSource, setcommodityAttributedataSource] = useState<any>({
commodityAttributeList: []
......@@ -153,28 +156,32 @@ const comfirmDialog: React.FC<Params> = (props,{onRef}) => {
const selectRow = productRowCtl.selectRow[0]
let { commodityId, id,customerCategoryName, goodsId, roleId, name, brandName } = selectRow
Curform.setFieldsValue({
name: name,//商品名称
productName: name,//商品名称
brand: brandName,
category: customerCategoryName
category: customerCategoryName,
productId: id
})
//查询属性
// PublicApi.getProductCommodityGetCommodity({ id: commodityId }).then(res => {
// if (res.code === 1000) {
// let { data } = res || {}
// setcommodityAttributedataSource(data)
// }
// })
GetCommodityAttribute(id)
setsVisible(false)
}
const handleSelectCancel = () => {
setsVisible(false)
}
/**
* @description: 获取明细动态tab展示
* @param {type}
* @return {type}
*/
const GetCommodityAttribute =(id) => {
PublicApi.getProductCommodityGetCommodityAttributeByUnitPriceAndPicId({unitPriceAndPicId: id}).then(res => {
if (res.code === 1000) {
let { data } = res || {}
setcommodityAttributedataSource(data)
console.log('data',data)
}
})
setsVisible(false)
}
const handleSelectCancel = () => {
setsVisible(false)
}
/**
......@@ -190,11 +197,31 @@ const comfirmDialog: React.FC<Params> = (props,{onRef}) => {
Curform.resetFields()
})
}
useEffect(() => {
// onRef(inRef)
if( id && props.mode == 0){//新增重置
console.log(31212)
Curform.setFieldsValue({
model:'',
productId:'',
brand:'',
productName: ''//商品名称
})
}
return () => {
}
}, [])
useEffect(() => {
console.log('重置',props.mode)
if(props.initialValues && props.initialValues.productId){
GetCommodityAttribute(props.initialValues.productId)
}
Curform.resetFields()
return () => {
}
}, [props.initialValues.productId])
const onChange = (value, attrItem) => {
}
......@@ -225,91 +252,18 @@ const comfirmDialog: React.FC<Params> = (props,{onRef}) => {
}
}
const renderTabPanchildren = (item: any) => {
return (
<>
{
item.attributeList.map((attrItem: any) => {
const options = attrItem.attributeValueList.map((item: any) => ({
value: item.value
}))
return (
<>
{
attrItem.type === 1 &&
<Form.Item
name={attrItem.name}
label={attrItem.name}
rules={attrItem.isEmpty && [{
required: true,
message: '此项为必填项'
}]}
>
<AutoComplete
style={{ width: 200 }}
options={options}
placeholder="选择或输入"
filterOption={(inputValue, option) =>
option.value.toUpperCase().indexOf(inputValue.toUpperCase()) !== -1
}
/>
{/* <Select
placeholder="请选择"
allowClear
onChange={(v)=>onChange(v, attrItem)}
>
{
attrItem.attributeValueList && attrItem.attributeValueList.map((item: any) => (
<Option key={item.id} value={item.id}>{item.value}</Option>
))
}
</Select> */}
</Form.Item>
}
{
attrItem.type === 2 &&
<Form.Item
label={attrItem.name}
name={attrItem.id}
rules={attrItem.isEmpty && [{
required: true,
message: '此项为必填项'
}]}
>
{/* <Checkbox.Group onChange={(v)=>onChange(v, attrItem)}>
{
attrItem.customerAttributeValueList.length && attrItem.customerAttributeValueList.map((item: any, index: string) => (
<Checkbox key={item.id} value={item.id}>{item.value}</Checkbox>
))
}
</Checkbox.Group> */}
</Form.Item>
}
{
attrItem.type === 3 &&
<Form.Item
name={attrItem.id}
label={attrItem.name}
rules={attrItem.isEmpty && [{
required: true,
message: '此项为必填项'
}]}
>
{/* <TextArea onChange={(v)=>onChange(v, attrItem)} maxLength={100} placeholder="最多输入100个字符" rows={4} /> */}
</Form.Item>
}
</>
)
})
}
</>
)
}
const placeholderText = '请先选择对应需求单号'
let ButtonList = [
<Button onClick={ () => props.onCancel()} >
取消
</Button>,
<Button type="primary" onClick={() => handletOk()} >
确定
</Button>
]
return (
<>
<Modal
// title={props.mode === 0 ? '新增报价明细' : '查看报价明细'}
title={headerTitle}
width={800}
visible={props.dialogVisible}
......@@ -318,6 +272,7 @@ const comfirmDialog: React.FC<Params> = (props,{onRef}) => {
destroyOnClose
afterClose={() => { }}
okText={`确定`}
footer={props.mode !== 2? ButtonList: null}
cancelText='取消'
>
<Form
......@@ -327,10 +282,6 @@ const comfirmDialog: React.FC<Params> = (props,{onRef}) => {
labelAlign="left"
form={Curform}
autoComplete="off"
initialValues={{
purchaseQuantity: props.eqInfo.purchaseQuantity,
purchaseNuit: props.eqInfo.purchaseNuit
}}
>
<Tabs defaultActiveKey='tab1'
......@@ -340,6 +291,7 @@ const comfirmDialog: React.FC<Params> = (props,{onRef}) => {
<Form.Item
label='对应需求单规格型号'
name='model'
initialValue={props.initialValues.model}
rules={[
{
......@@ -357,7 +309,8 @@ const comfirmDialog: React.FC<Params> = (props,{onRef}) => {
</Form.Item>
<Form.Item
label='报价商品名称'
name='name'
name='productName'
initialValue={props.initialValues.productName}
rules={[
{
required: true,
......@@ -370,6 +323,7 @@ const comfirmDialog: React.FC<Params> = (props,{onRef}) => {
<Form.Item
label='商品品牌'
name='brand'
initialValue={props.initialValues.brand}
rules={[
{
required: true,
......@@ -383,6 +337,15 @@ const comfirmDialog: React.FC<Params> = (props,{onRef}) => {
<Form.Item
label='品类'
name='category'
initialValue={props.initialValues.category}
hidden
>
<Input disabled placeholder='' />
</Form.Item>
<Form.Item
label='商品ID'
name='productId'
initialValue={props.initialValues.productId}
hidden
>
<Input disabled placeholder='' />
......@@ -397,16 +360,6 @@ const comfirmDialog: React.FC<Params> = (props,{onRef}) => {
*/
}
{
props.sourceData.length > 0 && props.sourceData.map((attributeItem: any) => <>
<TabPane tab={attributeItem.name} key={attributeItem.id}>
{
renderTabPanchildren(attributeItem)
}
</TabPane>
</>
)
}
{
commodityAttributedataSource.length > 0 && commodityAttributedataSource.map((item: any) => <>
......@@ -426,6 +379,7 @@ const comfirmDialog: React.FC<Params> = (props,{onRef}) => {
<Form.Item
label='单位'
name='purchaseNuit'
initialValue={props.initialValues.purchaseNuit}
rules={[
{
required: true
......@@ -438,6 +392,7 @@ const comfirmDialog: React.FC<Params> = (props,{onRef}) => {
<Form.Item
label='采购数量'
name='purchaseQuantity'
initialValue={props.initialValues.purchaseQuantity}
rules={[
{
required: true
......@@ -448,6 +403,7 @@ const comfirmDialog: React.FC<Params> = (props,{onRef}) => {
</Form.Item>
<Form.Item
label='报价单价'
initialValue={props.initialValues.price}
name='price'
rules={[
{
......@@ -488,9 +444,8 @@ const comfirmDialog: React.FC<Params> = (props,{onRef}) => {
)
}
comfirmDialog.defaultProps = {
mode:2,
eqInfo:{
// purchaseQuantity: '',//数量
// purchaseNuit:''//单位
},//规格列表
dontReceive: true,
type: 1 //1.支付宝 2.支付宝转账到银行卡参数配置 3.微信
......
......@@ -3,7 +3,7 @@
* @Date: 2020-08-24 11:39:29
* @LastEditors: LeeJiancong
* @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-09-15 17:11:17
* @LastEditTime: 2020-09-16 14:25:16
*/
import React, { Component, useState, useEffect,useRef } from 'react'
import ReactDOM from 'react-dom'
......@@ -39,6 +39,7 @@ import { GlobalConfig } from '@/global/config';
import styles from './templateForm.less';
import ReutrnEle from '@/components/ReturnEle'
import ModalTable from '@/components/ModalTable'
import EyePreview from '@/components/EyePreview'
import { PATTERN_MAPS } from '@/constants/regExp'
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable'
import { PageStatus, usePageStatus } from '@/hooks/usePageStatus'
......@@ -54,8 +55,6 @@ import {
} from '@/services';
import { store } from '@/store'
import colorTag from '@/pages/logistics/colorTag'
import { Effects } from 'bizcharts'
import { check } from 'prettier'
const { TabPane } = Tabs
const { TextArea } = Input
......@@ -248,6 +247,8 @@ const Detail: React.FC<{}> = () => {
quotationDeadline:'',//报价截至时间
requisitionFormAddress: []//地市
})
const [mode, setmode] = useState(0)
const [RroductinitialValues, setRroductinitialValues] = useState({})
const [SetForm, setSetForm] = useState<any>('')
const proRef = useRef<any>({})
const [eqInfo, seteqInfo] = useState({
......@@ -544,7 +545,13 @@ const Detail: React.FC<{}> = () => {
title: '报价商品名称',
dataIndex: 'productName',
key: 'productName',
align: 'left'
align: 'left',
render: (text: any,records: any) => <EyePreview type="button" handleClick={() => {
console.log(records)
setRroductinitialValues(records)
setdialogVisible(true)
setmode(2)
}}>{text}</EyePreview>
},
{
title: '品类',
......@@ -597,7 +604,13 @@ const Detail: React.FC<{}> = () => {
dataIndex: 'option',
key: 'option',
align: 'center',
render:(text,record,index) => <>
render:(text,records,index) => <>
<Button type="link" onClick={(index) =>{
console.log(records)
setRroductinitialValues(records)
setdialogVisible(true)
setmode(1)
}}>编辑</Button>
<Button type="link" onClick={(index) =>hanldeDeleteModel(index)}>删除</Button>
</>
},
......@@ -653,6 +666,14 @@ const Detail: React.FC<{}> = () => {
const handleOptionBtn = (type: any) => {
switch (type) {
case 1:
setmode(0)
setRroductinitialValues({
...RroductinitialValues,
model:'',
productId:'',
brand:'',
productName: ''//商品名称
})
setdialogVisible(true)
console.log(proRef,proRef.current)
// proRef.current.retSetForm()
......@@ -665,6 +686,9 @@ const Detail: React.FC<{}> = () => {
case 2:
setVisibleChannelMember(true)
break;
case 3:
break;
}
}
......@@ -683,41 +707,14 @@ const Detail: React.FC<{}> = () => {
let data = res.data
let areaCodeList = []
setdataInfo(data)//总
// setAreaParams(data.requisitionFormAddress)
// if (data.requisitionFormAddress) {
// data.requisitionFormAddress.forEach((v) => {
// areaCodeList.push([v.provinceCode, v.cityCode])
// })
// }
// //品类
// if (data.productCategory) {
// setcustomerCategoryId([data.productCategory.key])
// initCreatePro(data.productCategory.key,false)//生产弹窗
// }
//地区
setrequisitionFormAddress(areaCodeList)
setinitialValues(data)
tabForm.resetFields()
console.log('platType',platType)
//需求单对接列表
// PublicApi.getOrderRequisitionFormDemandDockingList({ id: id }).then(res => {
// if (res.code === 1000) {
// let { data } = res.data
// if(_plattype == 2){//系统匹配
// setdockingList(data)
// }else if(_plattype == 3){//会员
// setmemberList(data)
// }
// }
// })
getOrderProductAll(data.requisitionFormId) //查询规格 赋值弹窗单位和采购数量
}
})
PublicApi.getOrderQuotationParticulars({ id: id }).then(res => {
if(res.code === 1000){
let {data} = res.data
......@@ -900,14 +897,14 @@ const Detail: React.FC<{}> = () => {
item.requisitionFormId = requisitionFormId
item.category = v.category
item.price = v.price //报价单位
item.requisitionFormNo = values.requisitionFormNo
item.specifications = v.specifications
item.productName = v.productName
item.brand = v.brand
item.model = v.model
item.purchaseNuit = v.purchaseNuit
item.purchaseQuantity = v.purchaseQuantity //数量
item.productId = v.productId //商品ID 选择的
item.requisitionFormNo = values.requisitionFormNo
let _otherList = []
Object.keys(v).forEach(child => {
otherList.forEach(j => {
......@@ -1075,20 +1072,33 @@ const Detail: React.FC<{}> = () => {
})
//查询 商品规格
getOrderProductAll(id)
}
/**
* @description: 查询 商品规格 赋值单位和数量
* @param {type}
* @return {type}
*/
const getOrderProductAll = (id) => {
PublicApi.getOrderRequisitionFormProductAll({id:id}).then(res => {
if(res.code === 1000){
let {data} = res || {}
let {purchaseNuit,purchaseQuantity} = data[0]
let list = data.map(v => v.model)
seteqInfo({...eqInfo,modelList: list,
setRroductinitialValues({
...RroductinitialValues,
purchaseNuit: purchaseNuit,
purchaseQuantity: purchaseQuantity
})
seteqInfo({...eqInfo,modelList: list
})
}
})
}
return (
<PageHeaderWrapper
onBack={() => history.goBack()}
......@@ -1117,12 +1127,6 @@ const Detail: React.FC<{}> = () => {
<TabPane tab="基本信息" key='1'>
<Row>
<Col span={12}>
{/* <Form name="base-form"
{...layout}
colon={false}
labelAlign="left"
autoComplete="off"
> */}
<Form.Item
label="报价单摘要"
initialValue={initialValues.quotationSummary}
......@@ -1160,7 +1164,6 @@ const Detail: React.FC<{}> = () => {
</Form.Item>
}
<Form.Item
// name='memberName'
label='需求会员'
>
<>{getAuth().name || '未知用户'}</>
......@@ -1191,8 +1194,6 @@ const Detail: React.FC<{}> = () => {
{
initialValues.externalState == 1 ? <span style={statuStyle.default}>待提交需求单</span> :
initialValues.externalState == 2 ? <span style={statuStyle.warn}>审核不通过需求单</span> : ''
}
</Form.Item>
{
......@@ -1206,8 +1207,6 @@ const Detail: React.FC<{}> = () => {
</Form.Item>
}
{/* </Form> */}
</Col>
</Row>
</TabPane>
......@@ -1293,8 +1292,6 @@ const Detail: React.FC<{}> = () => {
<Table rowKey={'id'} dataSource={dataInfo.interiorRequisitionForms || []} columns={interiorColumn(formTime, interiorTextState)} />
</TabPane>
</Tabs>
</TabPane>
</Tabs>
......@@ -1307,7 +1304,8 @@ const Detail: React.FC<{}> = () => {
eqInfo={eqInfo}//需求单相关
onRef={proRef}
// onRef={(refs) => setSetForm(refs)}
mode={0}
mode={mode}
initialValues={RroductinitialValues}
productAttributeJson = {productAttributeJson}
onOK={(values: any,data) => handleSubmit(values,data)}
onCancel={() => setdialogVisible(false)}
......
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