Commit 9ce79b83 authored by LeeJiancong's avatar LeeJiancong

'需求发布列表和保存校验等前期处理'

parent c548386d
/*
* @Author: LeeJiancong
* @Date: 2020-08-28 10:07:45
* @LastEditors: LeeJiancong
* @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-08-29 10:16:45
*/
import React, { Component, useState, useEffect } from 'react';
import { Modal, Button, Form, Radio, Tabs, Input, Select,Checkbox } from 'antd'
import { PublicApi } from '@/services/api'
const { TabPane } = Tabs
const { Option } = Select
const {TextArea} = Input
export interface Params {
sourceData: Array<any>[],
id?: any,
mode: number,
type?: number | string,
dialogVisible: boolean;
onCancel: Function;
onOK?: Function;
initialValues?: any;
dontReceive?: boolean; //默认展示
}
const layout = {
labelCol: {
span: 4
},
wrapperCol: {
span: 20
}
}
/**
* @description: 保存 提交表单
* @param {type}
* @return {type}
*/
const comfirmDialog: React.FC<Params> = (props) => {
console.log('数据',props.sourceData)
const [form] = Form.useForm()
const [placeOfOriginList, setplaceOfOriginList] = useState([])//产地
const handleCancel = () => {
}
const handletOk = () => {
form.validateFields().then(v => {
console.log('表单', v)
props.onOK(v)
})
// if(props.type){
// value.type = props.type
// }
// console.log('列表',value)
}
useEffect(() => {
return () => {
}
}, [])
const onChange = (value, attrItem) => {
}
const renderTabPanchildren = (item: any) => {
console.log('子项',item)
return (
<>
{
item.attributeList.map((attrItem:any) => {
return (
<>
{
attrItem.type === 1 &&
<Form.Item
name={attrItem.name}
label={attrItem.name}
rules={attrItem.isEmpty && [{
required: true,
message: '此项为必填项'
}]}
>
<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>
}
</>
)
})
}
</>
)
}
return (
<>
<Modal
title={props.mode === 0 ? '新增商品' : '查看商品'}
width={800}
visible={props.dialogVisible}
onOk={() => handletOk()}
onCancel={() => props.onCancel()}
destroyOnClose
afterClose={() => { }}
okText={`确定`}
cancelText='取消'
>
<Form
{...layout}
colon={false}
labelAlign="left"
form={form}
autoComplete="off"
>
<Tabs defaultActiveKey='tab1'
tabPosition="left"
>
<Tabs.TabPane tab='基本信息' key="tab-1">
<Form.Item
label='规格型号'
name='model'
required
>
<Input placeholder='' />
</Form.Item>
<Form.Item
label='商品品牌'
name='brand'
required
>
<Input placeholder='' />
</Form.Item>
</Tabs.TabPane>
{
/**
* @description: 动态循环
* @param {type}
* @return {type}
*/
}
{
props.sourceData.length > 0 && props.sourceData.map((attributeItem:any) => <>
<TabPane tab={attributeItem.name} key={attributeItem.id}>
{
renderTabPanchildren(attributeItem)
}
</TabPane>
</>
)
}
<Tabs.TabPane tab='采购数量' key="tab-7">
<Form.Item
label='单位'
name='purchaseNuit'
required
>
<Input placeholder='' />
</Form.Item>
<Form.Item
label='采购数量'
name='purchaseQuantity'
required
>
<Input placeholder='' />
</Form.Item>
</Tabs.TabPane>
</Tabs>
</Form>
</Modal>
</>
)
}
comfirmDialog.defaultProps = {
dontReceive: true,
type: 1 //1.支付宝 2.支付宝转账到银行卡参数配置 3.微信
}
export default comfirmDialog
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Date: 2020-08-27 16:27:53 * @Date: 2020-08-27 16:27:53
* @LastEditors: LeeJiancong * @LastEditors: LeeJiancong
* @Copyright: 1549414730@qq.com * @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-08-27 16:34:59 * @LastEditTime: 2020-08-29 14:29:40
*/ */
import { ColumnType } from 'antd/lib/table/interface' import { ColumnType } from 'antd/lib/table/interface'
export const equiryColumns: ColumnType<any>[] = [ export const equiryColumns: ColumnType<any>[] = [
...@@ -69,52 +69,49 @@ export const equiryColumns: ColumnType<any>[] = [ ...@@ -69,52 +69,49 @@ export const equiryColumns: ColumnType<any>[] = [
export const dockingList: ColumnType<any>[] = [ export const dockingList: ColumnType<any>[] = [
{ {
title: '序号', title: '序号',
dataIndex: 'memberId', dataIndex: 'id',
align: 'center', align: 'center',
key: 'memberId', key: 'id',
}, },
{ {
title: '公司名称', title: '会员名称',
dataIndex: 'name', dataIndex: 'memberName',
key: 'name', key: 'memberName',
align: 'left' align: 'left'
}, },
{ {
title: '公司地址', title: '会员类型',
dataIndex: 'roleName', dataIndex: 'memberTypeName',
key: 'roleName', key: 'memberTypeName',
align: 'center'
},
{
title: '成立日期',
dataIndex: 'roleName',
key: 'roleName',
align: 'center' align: 'center'
}, },
{ {
title: '公司规模', title: '会员角色',
dataIndex: 'roleName', dataIndex: 'roleName',
key: 'roleName', key: 'roleName',
align: 'center' align: 'center'
}, },
{ {
title: '诚信度', title: '会员等级',
dataIndex: 'roleName', dataIndex: 'levelTag',
key: 'roleName', key: 'levelTag',
align: 'center' align: 'center'
}, },
{ {
title: '是否归属会员', title: '是否归属会员',
dataIndex: 'roleName', dataIndex: 'membershipOrNot',
key: 'roleName', key: 'membershipOrNot',
align: 'center' align: 'center',
render:(text:any) => (
text == 0 ?'否':'是'
)
}, },
{ {
title: '状态', title: '状态',
dataIndex: 'levelTag', dataIndex: 'state',
key: 'levelTag', key: 'state',
align: 'center' align: 'center'
}, },
{ {
......
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