Commit b875ac75 authored by LeeJiancong's avatar LeeJiancong

'新增需求单回显'

parent 33df7ad3
export interface MemberType {
id: number;
typeName: string;
}
export interface BusinessType {
id: number;
typeName: string;
}
export interface UseType {
memberType: MemberType[];
businessType: BusinessType[];
}
export interface UserRegister {
useType: UseType;
}
export interface ShopInfo {
id: number;
name: string;
type: number;
environment: number;
logoUrl: string;
describe?: any;
state: number;
url: string;
}
export interface Web {
shopInfo: ShopInfo[];
}
export interface CountryList {
name: string;
key: string;
icon: string;
}
export interface Global {
siteId: number;
siteUrl: string;
logo: string;
countryList: CountryList[];
}
export interface RootObject {
userRegister: UserRegister;
web: Web;
global: Global;
}
\ No newline at end of file
......@@ -3,10 +3,10 @@
* @Date: 2020-08-28 10:07:45
* @LastEditors: LeeJiancong
* @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-08-29 10:16:45
* @LastEditTime: 2020-09-01 15:45:57
*/
import React, { Component, useState, useEffect } from 'react';
import { Modal, Button, Form, Radio, Tabs, Input, Select,Checkbox } from 'antd'
import { Modal, Button, Form, Radio, AutoComplete,Tabs, Input, Select,Checkbox } from 'antd'
import { PublicApi } from '@/services/api'
const { TabPane } = Tabs
const { Option } = Select
......@@ -68,10 +68,14 @@ const comfirmDialog: React.FC<Params> = (props) => {
const renderTabPanchildren = (item: any) => {
console.log('子项',item)
return (
<>
{
item.attributeList.map((attrItem:any) => {
const options = attrItem.attributeValueList.map((item: any) => ({
value: item.value
}))
return (
<>
{
......@@ -84,7 +88,15 @@ const comfirmDialog: React.FC<Params> = (props) => {
message: '此项为必填项'
}]}
>
<Select
<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)}
......@@ -94,7 +106,7 @@ const comfirmDialog: React.FC<Params> = (props) => {
<Option key={item.id} value={item.id}>{item.value}</Option>
))
}
</Select>
</Select> */}
</Form.Item>
}
{
......
......@@ -22,21 +22,22 @@ import { Row, Col, Card, Button, Table, Popconfirm, Radio,DatePicker,
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import moment from 'moment'
import { ColumnType } from 'antd/lib/table/interface'
import { dockingList } from './detailFormColumnType'
import { dockingColumn } from './detailFormColumnType'
import { getAuth} from '@/utils/auth'
// import {
// MegaLayout, Input, Switch, Select, FormMegaLayout, FormTab,
// Radio, ArrayTable, ArrayCards, Transfer
// } from '@formily/antd-components'
import { PublicApi } from '@/services/api'
import styles from './templateForm.less';
import ReutrnEle from '@/components/ReturnEle'
import RroductModal from '../components/productModal'
import { PATTERN_MAPS } from '@/constants/regExp'
import {PageStatus,usePageStatus} from '@/hooks/usePageStatus'
import statuStyle from '../../common/colorTag'
import {interiorState} from '../../common/tableStatusList'
import {
GetManageAreaAllResponse
} from '@/services';
import { store } from '@/store'
import colorTag from '@/pages/logistics/colorTag'
import { Effects } from 'bizcharts'
const { TabPane } = Tabs
const {TextArea} = Input
......@@ -66,11 +67,35 @@ interface AreaParams {
cityCode: any;
cityName: any;
}
const init = {
deliveryTime: ''
}
const Detail: React.FC<{}> = () => {
const headerTitle = '需求单'
const [tabForm] = Form.useForm()
const [otherList, setotherList] = useState([])
const {pageStatus, id} = usePageStatus()
const [initialValues, setinitialValues] = useState<any>({
details: '',
addresId: null,
packRequire:'',
taxes:'',
logistics:'',
offer:'',
paymentType:'',
otherRequire:'',
quotationAsTime:'',
deliveryTime:'',
voucherTime:'',
requisitionFormAddress:[]//地市
})
const [requisitionFormAddress, setrequisitionFormAddress] = useState([])//地市多项回显用
const [customerCategoryId, setcustomerCategoryId] = useState<any>([]) //品类
const [selectRow, setSelectRow] = useState([])//需求单用
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<number>>([])//需求单
const [categoryId, setcategoryId] = useState(null)//选择的分类id
const [otherList, setotherList] = useState([])//动态tab循环
const [dockingList, setdockingList] = useState([])//需求列表
const [productSource, setproductSource] = useState([])//商品列表 新增
const [shipperAddressList, setshipperAddressList] = useState([])
const [CategoryTreeOne, setCategoryTreeOne] = useState([])
......@@ -95,6 +120,60 @@ const Detail: React.FC<{}> = () => {
}
/**
* @description: 初始化需求对接表格 需求单
* @param {type}
* @return {type}
*/
const InitMemberList = () => {
let params:any = {}
params.categoryId = categoryId
let codeList = tabForm.getFieldValue('requisitionFormAddress')|| []
if(categoryId && otherList.length != 0){
console.log('codeList',codeList)
params.areaRequestList =
codeList.map((v:any)=> {
if(Array.isArray(v)){
return ({
provinceCode: v[0],
cityCode: v && v.length > 1 ? v[1] : null
})
}
})
let productList = []
productSource.forEach((v) => {
// console.log('v',v)
let item:any = {}
Object.keys(v).forEach(child => {
otherList.forEach((j:any) => {
let otherItem:any = {}
if(child === j.title){
otherItem['attributeId'] = j.key
otherItem['attributeValue'] = v[child]
productList.push(otherItem)
}
})
})
})
params.attributeList = [...productList]
params.current = 1
params.pageSize= 20
console.log('params',JSON.stringify(params))
PublicApi.postOrderSystemMatchingMemberInitializeList(
params
).then(res=> {
if(res.code === 1000){
let {data} = res.data || {}
setdockingList(data)
}
})
}
}
/**
* @description: 选择品类
* @param {type}
......@@ -103,6 +182,7 @@ const Detail: React.FC<{}> = () => {
const onCustomerCategoryChange = (value: any,options:any) => {
console.log(3112,value,options)
let seletCategoryId = value[value.length - 1 ]
setcategoryId(seletCategoryId)
setseletCategoryNameList(options)
console.log(seletCategoryId, 'seleellele')
......@@ -110,82 +190,6 @@ const Detail: React.FC<{}> = () => {
PublicApi.getProductPlatformGetCategoryById({ id: seletCategoryId }).then(res => {
if(res.code === 1000){
let data = res.data
// let data = [
// {
// id: '1',
// name: '外观尺寸',
// attributeList: [
// {
// id: '2',
// type: 1,
// name: '面料',
// attributeValueList: [
// {
// id: 1,
// value: '涤沦'
// },
// {
// id: 2,
// value: '面料'
// }
// ]
// },
// {
// id: '3',
// type: 1,
// name: '颜色',
// attributeValueList: [
// {
// id: 1,
// value: '红色'
// },
// {
// id: 2,
// value: '白色'
// }
// ]
// },
// ]
// },
// {
// id: '5',
// name: '工艺',
// attributeList: [
// {
// id: '4',
// type: 1,
// name: '化学处理',
// attributeValueList: [
// {
// id: 5,
// value: '化学1'
// },
// {
// id: 6,
// value: '化学2'
// }
// ]
// },
// {
// id: '5',
// type: 1,
// name: '表皮处理',
// attributeValueList: [
// {
// id: 1,
// value: '表皮1'
// },
// {
// id: 2,
// value: '表皮2'
// }
// ]
// },
// ]
// },
// ]
settabData([data])//转成数组
let da = []
// data.forEach((item: any) => {
......@@ -198,8 +202,9 @@ const Detail: React.FC<{}> = () => {
align: 'center',
render:(text:any) => {
const name = v.attributeValueList.filter(v=> v.id == text).map(v=> v.value)
console.log('name',name)
return (
<>{name}</>
<>{name.length > 0? name[0]: text}</>
)
}
})
......@@ -275,6 +280,8 @@ const Detail: React.FC<{}> = () => {
}
})
/**
* @description: 收货地址
......@@ -308,8 +315,52 @@ const Detail: React.FC<{}> = () => {
setAreaOption(arr)
}
})
/**
* @description: 获取详情
* @param {type}
* @return {type}
*/
if(id){
PublicApi.getOrderRequisitionFormDetails({id:id}).then(res => {
if(res.code === 1000){
let data = res.data
let areaCodeList = []
if(data.requisitionFormAddress){
data.requisitionFormAddress.forEach((v)=> {
areaCodeList.push([v.provinceCode,v.cityCode])
})
}
//品类
if(data.productCategory){
setcustomerCategoryId([data.productCategory.key])
}
//地区
setrequisitionFormAddress(areaCodeList)
setinitialValues(data)
tabForm.resetFields()
}
})
PublicApi.getOrderRequisitionFormProductDetails({id:id}).then(res => {
if(res.code === 1000){
let {data} = res
}
})
}
}, [])
/**
* @description: 交易类型
* @param {type}
......@@ -341,12 +392,25 @@ const Detail: React.FC<{}> = () => {
}
const changePlatform = (e: any) => {
setplatType(e.target.value)
if(e.target.value == 2){
//调用需求单
InitMemberList()
}
}
const handleMemberTypeChange = (e: any) => {
setmemberType(e.target.value)
}
const rowSelection = {
selectedRowKeys: selectedRowKeys,
onChange: (selectedRowKeys: any, selectedRows: any) => {
setSelectRow(selectedRows);
setSelectedRowKeys(selectedRowKeys);
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows)
}
}
/**
* @description: TabForm提交 保存
......@@ -416,7 +480,9 @@ const Detail: React.FC<{}> = () => {
console.log((JSON.stringify(values)))
PublicApi.postOrderRequisitionFormAdd(values).then(res => {
if(res.code === 1000){
history.goBack()
setTimeout(() => {
history.goBack()
},1000)
}
})
......@@ -485,6 +551,10 @@ const Detail: React.FC<{}> = () => {
labelAlign="left"
autoComplete="off"
onFinish = {onFinish}
initialValues={{
customerCategoryId: customerCategoryId,
requisitionFormAddress: requisitionFormAddress
}}
>
<Tabs defaultActiveKey='1'>
<TabPane tab="基本信息" key='1'>
......@@ -498,6 +568,7 @@ const Detail: React.FC<{}> = () => {
> */}
<Form.Item
label="报价单摘要"
initialValue={initialValues.details}
rules={[
{
required: true
......@@ -508,6 +579,9 @@ const Detail: React.FC<{}> = () => {
<Input placeholder="请输入报价单摘要" maxLength={30} />
</Form.Item>
<Form.Item
// initialValue={
// initialValues.
// }
name="customerCategoryId"
label="商品品类"
rules={[
......@@ -636,7 +710,9 @@ const Detail: React.FC<{}> = () => {
}}
</Form.List> */}
<Form.List name="requisitionFormAddress">
<Form.List name="requisitionFormAddress"
>
{(fields: any[], { add, remove }: any) => {
if (!fields.length) {
add()
......@@ -646,6 +722,7 @@ const Detail: React.FC<{}> = () => {
{fields.map((field, index) => (
<Form.Item
{...(index === 0 ? layout : layoutFormList)}
label={
field.key === 0 && <span>
归属地市&nbsp;
......@@ -659,6 +736,7 @@ const Detail: React.FC<{}> = () => {
<Form.Item
{...field}
noStyle
>
<Cascader
options={proviceOptions}
......@@ -678,12 +756,19 @@ const Detail: React.FC<{}> = () => {
)
}}
</Form.List>
{
id&&
<Form.Item
name="requisitionFormNo"
label='需求单号'
>
<>
{
initialValues.requisitionFormNo
}
</>
</Form.Item>
}
<Form.Item
// name='memberName'
label='会员名称'
......@@ -691,23 +776,38 @@ const Detail: React.FC<{}> = () => {
<>{getAuth().name || '未知用户'}</>
</Form.Item>
<Form.Item
// name='voucherTime'
name='voucherTime'
label='单据时间'
>
<div>
{
initialValues.voucherTime ? moment(initialValues.voucherTime).format("YYYY-MM-DD HH:mm:ss") :''
}
</div>
</Form.Item>
<Form.Item
label='外部状态'
// name="externalState"
>
{
initialValues.externalState == 1 ?<span style={statuStyle.default}>待提交需求单</span>:
initialValues.externalState == 2?<span style={statuStyle.warn}>审核不通过需求单</span>:''
}
</Form.Item>
{
id &&
<Form.Item
// name="interiorState"
label='内部状态'
>
>
<>
{interiorState(initialValues.interiorState)}
</>
</Form.Item>
}
{/* </Form> */}
</Col>
</Row>
......@@ -720,6 +820,7 @@ const Detail: React.FC<{}> = () => {
<Row>
<Col span={11}>
<Form.Item
initialValue={initialValues.deliveryTime ? moment(initialValues.deliveryTime):''}
label="交付日期"
rules={[
{
......@@ -732,6 +833,7 @@ const Detail: React.FC<{}> = () => {
<DatePicker style={{width:'100%'}} />
</Form.Item>
<Form.Item
initialValue={initialValues.addresId}
label="交付地址"
rules={[
{
......@@ -750,6 +852,7 @@ const Detail: React.FC<{}> = () => {
</Form.Item>
<Form.Item
label="报价截止时间"
initialValue={initialValues.quotationAsTime ? moment(initialValues.quotationAsTime):''}
rules={[
{
required: true,
......@@ -761,18 +864,21 @@ const Detail: React.FC<{}> = () => {
<DatePicker showTime format="YYYY-MM-DD HH:mm" style={{width:'100%'}}/>
</Form.Item>
<Form.Item
initialValue={initialValues.offer}
label="报价要求"
name="offer"
>
<TextArea placeholder="最长100个字符,50个汉字" maxLength={50} />
</Form.Item>
<Form.Item
initialValue={initialValues.paymentType}
label="付款方式"
name="paymentType"
>
<TextArea placeholder="最长100个字符,50个汉字" maxLength={50} />
</Form.Item>
<Form.Item
initialValue={initialValues.taxes}
label="税费要求"
name="taxes"
>
......@@ -781,18 +887,21 @@ const Detail: React.FC<{}> = () => {
</Col>
<Col span={11} push={2}>
<Form.Item
initialValue={initialValues.logistics}
label="物流要求"
name="logistics"
>
<TextArea placeholder="最长100个字符,50个汉字" maxLength={50} />
</Form.Item>
<Form.Item
initialValue={initialValues.packRequire}
label="包装要求"
name="packRequire"
>
<TextArea placeholder="最长100个字符,50个汉字" maxLength={50} />
</Form.Item>
<Form.Item
initialValue={initialValues.otherRequire}
label="其他要求"
name="otherRequire"
>
......@@ -835,7 +944,7 @@ const Detail: React.FC<{}> = () => {
}
{
platType != 1 &&
<Table dataSource={[]} columns={dockingList} pagination={pagination} />
<Table dataSource={dockingList} rowSelection={rowSelection} columns={dockingColumn} pagination={pagination} />
}
......
......@@ -3,7 +3,7 @@
* @Date: 2020-08-27 16:27:53
* @LastEditors: LeeJiancong
* @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-08-29 14:29:40
* @LastEditTime: 2020-09-01 10:08:44
*/
import { ColumnType } from 'antd/lib/table/interface'
export const equiryColumns: ColumnType<any>[] = [
......@@ -66,7 +66,7 @@ export const equiryColumns: ColumnType<any>[] = [
]
export const dockingList: ColumnType<any>[] = [
export const dockingColumn: ColumnType<any>[] = [
{
title: '序号',
dataIndex: 'id',
......
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