Commit 7f5c7d16 authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

移除老的需求发布

parent f2582339
/**
* @description: 确认需求报价
* @param {type}: preview-查看 detail-操作
* @return {type}
* @return {type}
*/
export default [
{
......@@ -25,7 +25,7 @@ export default [
{
path: '/memberCenter/tranactionAbility/enquiryOfferConfirm/enquiryOfferSearch/inquiry/preview',
name: 'enquiryOfferSearchInquiryPreview',
component: '@/pages/transaction/enquirySubmit/components/detail',
component: '@/pages/transaction/demandPosts/demandInquiry/detail',
hideInMenu: true,
},
// 待提交审核报价单 - 列表
......@@ -45,7 +45,7 @@ export default [
{
path: '/memberCenter/tranactionAbility/enquiryOfferConfirm/toSubmit/inquiry/preview',
name: 'toSubmitInquiryPreview',
component: '@/pages/transaction/enquirySubmit/components/detail',
component: '@/pages/transaction/demandPosts/demandInquiry/detail',
hideInMenu: true,
},
// 待提交审核报价单 - 查看详情
......@@ -72,7 +72,7 @@ export default [
{
path: '/memberCenter/tranactionAbility/enquiryOfferConfirm/enquiryOne/inquiry/preview',
name: 'enquiryOneInquiryPreview',
component: '@/pages/transaction/enquirySubmit/components/detail',
component: '@/pages/transaction/demandPosts/demandInquiry/detail',
hideInMenu: true,
},
// 待审核报价单(一级) - 详情
......@@ -99,7 +99,7 @@ export default [
{
path: '/memberCenter/tranactionAbility/enquiryOfferConfirm/enquiryTwo/inquiry/preview',
name: 'enquiryTwoInquiryPreview',
component: '@/pages/transaction/enquirySubmit/components/detail',
component: '@/pages/transaction/demandPosts/demandInquiry/detail',
hideInMenu: true,
},
// 待审核报价单(二级) - 详情
......@@ -126,7 +126,7 @@ export default [
{
path: '/memberCenter/tranactionAbility/enquiryOfferConfirm/enquiryOfferComfirmSearch/inquiry/preview',
name: 'enquiryOfferComfirmSearchInquiryPreview',
component: '@/pages/transaction/enquirySubmit/components/detail',
component: '@/pages/transaction/demandPosts/demandInquiry/detail',
hideInMenu: true,
},
// 待确认报价单 - 详情
......@@ -138,4 +138,4 @@ export default [
},
]
}
]
\ No newline at end of file
]
import React, { useState, useRef, useEffect } from 'react';
import { history } from 'umi';
import ReutrnEle from '@/components/ReturnEle'
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { Button, Card, Tabs } from 'antd';
import BasicInfo from './components/basicInfo';
import TradingConditions from './components/tradingConditions'
import FlowRecord from './components/flowRecord';
import AddGoods from './components/addGoods';
import DemandDbutted from './components/demandDbutted';
import { PublicApi } from '@/services/api';
const { TabPane } = Tabs;
const AddDemandOrder: React.FC<{}> = () => {
const { id } = history.location.query;
const [fetchdata, setfetchdata] = useState<any>({});
const basic = useRef<any>();
const goods = useRef<any>();
const trading = useRef<any>();
/**get子组件的数据 */
/**提交数据 */
const onSubmit = async () => {
const basicRef = await basic.current.get();
const goodsRef = await goods.current.get();
const tradingRef = await trading.current.get();
if (basicRef.state && tradingRef.state && goodsRef.state) {
const data = {
...basicRef.data,
...tradingRef.data,
...goodsRef.data,
type: 1,
shopIds: [1]
}
if (basicRef.data.requisitionFormAddress.length > 0) {
data.defaultAddres = 0
} else {
data.defaultAddres = 1
}
if(id) {
data.id = fetchdata.id;
PublicApi.postOrderRequisitionFormUpdate(data).then(res => {
if (res.code === 1000) {
history.goBack()
}
})
} else {
PublicApi.postOrderRequisitionFormAdd(data).then(res => {
if (res.code === 1000) {
history.goBack()
}
})
}
}
}
useEffect(() => {
if (id) {
new Promise(resolve => {
PublicApi.getOrderRequisitionFormDetails({ id, current: '1', pageSize: '10' }).then(res => {
if (res.code === 1000) {
resolve(res.data)
}
})
}).then((res:any) => {
setfetchdata(res)
})
}
}, [id])
/**获取添加的商品品类id */
const getCategoryIds = (ids:any) => {
const categoryIds: any = [];
const attributeList: any = [];
ids.forEach( v => {
let id = v.ids[v.ids.length - 1];
categoryIds.push([...categoryIds, ...id])
let productAttributeJson = JSON.parse(v.productAttributeJson);
productAttributeJson.forEach(vs => {
console.log(vs)
attributeList.push({
attributeValue: vs
})
})
console.log(categoryIds, attributeList)
})
console.log(ids)
}
return (
<PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回" />}
extra={
<Button type="primary" onClick={onSubmit}> 保存</Button>
}
>
<Card>
<Tabs type='card'>
<TabPane forceRender tab='基本信息' key='1'>
<BasicInfo
set={fetchdata}
currentRef={basic}
/>
</TabPane>
<TabPane forceRender tab='添加商品' key='2'>
<AddGoods
set={fetchdata}
onGet={getCategoryIds}
currentRef={goods}
/>
</TabPane>
<TabPane forceRender tab='交易条件' key='3'>
<TradingConditions
set={fetchdata}
currentRef={trading}
/>
</TabPane>
<TabPane forceRender tab='需求对接' key='4'>
<DemandDbutted
set={fetchdata}
/>
</TabPane>
<TabPane forceRender tab='流转记录' key='5'>
<FlowRecord
set={fetchdata}
/>
</TabPane>
</Tabs>
</Card>
</PageHeaderWrapper>
)
}
export default AddDemandOrder;
\ No newline at end of file
import React, { useState, useEffect } from 'react';
import { UPLOAD_TYPE } from '@/constants'
import { Modal, Anchor, Layout, Menu, Form, Divider, Input, Button, Upload, Select, AutoComplete, Cascader, Spin, InputNumber } from 'antd';
import style from '../index.less';
import { LinkOutlined, DeleteOutlined, UploadOutlined } from '@ant-design/icons';
import { PublicApi } from '@/services/api';
const layout: any = {
colon: false,
labelCol: { style: { width: '110px' } },
labelAlign: "left"
};
const { Sider, Content } = Layout;
const { Link } = Anchor;
interface anchorParams {
visible?: boolean,
onOk?: Function,
onCancel?: Function,
fetchdata?: any,
isEdit?: boolean
}
const { Option } = Select;
const ModalAnchor: React.FC<anchorParams> = (props) => {
const { visible, onOk, onCancel, fetchdata, isEdit } = props;
const [form] = Form.useForm();
const [loading, setloading] = useState(false);
const [files, setFiles] = useState([]);
const [categoryById, setCategoryById] = useState<any>({});
const [selected, setselected] = useState<string>('')
const [category, setcategory] = useState<Array<any>>([]);
/**查询品类树 */
const searchCategoryTree = (id: any) => {
return new Promise(resolve => {
PublicApi.getProductPlatformGetCategoryTree({ rootNodeId: id }).then(res => {
if (res.code === 1000) {
resolve(res.data)
}
})
}).then((data: any) => {
setcategory(data)
})
}
/**查询品类信息--包括品类、属性、属性值 */
const getCategoryById = (val:any, selectedOptions?:any) => {
const id = val[val.length -1];
if(!isEdit && selectedOptions.length > 0) {
const name = selectedOptions[selectedOptions.length -1];
setselected(name.title)
}
PublicApi.getProductPlatformGetCategoryById({id}).then(res => {
if(res.code === 1000) {
setCategoryById(res.data)
}
})
}
useEffect(() => {
form.resetFields();
searchCategoryTree('0')
if(Object.keys(fetchdata).length > 0 && isEdit) {
getCategoryById(fetchdata.ids)
const productAttributeJson = JSON.parse(fetchdata.productAttributeJson);
let obj:any = {}
let newObj: any = {}
productAttributeJson.forEach((item:any) => {
obj = {...obj, ...item}
for(let key in obj) {
newObj = {...newObj, ...{
[`${key}__`]: obj[key].join(',')
}}
}
})
form.setFieldsValue({
model: fetchdata.model,
brand: fetchdata.brand,
unit: fetchdata.unit,
purchaseCount: fetchdata.purchaseCount,
name: fetchdata.name,
category: fetchdata.ids,
goodsNo: fetchdata.goodsNo,
specialExplain: fetchdata.specialExplain,
...newObj
})
}
}, [visible])
const onSubmit = (value:any) => {
form.validateFields().then(res => {
const productAttributeJson : Array<any> = [];
for(let key in res) {
if(key.split('__').length > 1) {
const name = key.replace(/__/g, '')
productAttributeJson.push({
[name]: [res[key]]
})
}
}
const data = {
model: res.model,
brand: res.brand,
productAttributeJson: JSON.stringify(productAttributeJson),
unit: res.unit,
purchaseCount: res.purchaseCount,
name: res.name,
category: selected,
goodsNo: res.goodsNo,
ids: res.category,
urls: files,
specialExplain: res.specialExplain,
}
onOk(data)
form.resetFields();
setCategoryById([])
}).catch(error => {
console.log(error)
})
}
return (
<Modal
title='通过平台属性添加'
width='800px'
maskClosable={false}
destroyOnClose
wrapClassName={style.modal_wrap_className}
bodyStyle={{ padding: '0px' }}
visible={visible}
onCancel={() => onCancel()}
onOk={onSubmit}
>
<Layout>
<Sider width={159} className={style.site_layout_background}>
<Anchor
bounds={0}
targetOffset={120}
affix={false}
>
<Menu
mode='inline'
defaultSelectedKeys={['1']}
>
<Menu.Item key="1"><Link href='#basic_info' title='基本信息' /></Menu.Item>
{
Object.keys(categoryById).length > 0 &&
<Menu.Item key="2"><Link href='#category' title={categoryById.name} /></Menu.Item>
}
<Menu.Item key="3"><Link href='#other_demand' title='其他要求' /></Menu.Item>
<Menu.Item key="4"><Link href='#procured_amount' title='采购数量' /></Menu.Item>
</Menu>
</Anchor>
</Sider>
<Content className={style.site_content_style}>
<Form
form={form}
{...layout}
>
<div id='basic_info'>
<div className={style.affix_title}><Divider type="vertical" className={style.divider_style} />基本信息</div>
<Form.Item label='商品品类' name='category' rules={[{ required: true, message: '请选择商品品类' }]}>
<Cascader
options={category}
fieldNames={{ label: 'title', value: 'id', children: 'children' }}
placeholder="请选择品类"
notFoundContent={<Spin size="small" />}
onChange={getCategoryById}
/>
</Form.Item>
<Form.Item label='商品编号' name='goodsNo' rules={[{ required: true, message: '请输入商品编号' }]}><Input /></Form.Item>
<Form.Item label='商品名称' name='name' rules={[{ required: true, message: '请输入商品名称' }]}><Input /></Form.Item>
<Form.Item label='规格型号' name='model' rules={[{ required: true, message: '请输入规格型号' }]}><Input /></Form.Item>
<Form.Item label='规格品牌' name='brand'><Input /></Form.Item>
</div>
{
Object.keys(categoryById).length > 0 &&
<div id='category'>
<div className={style.affix_title}><Divider type="vertical" className={style.divider_style} />{categoryById.name}</div>
{
categoryById.attributeList.length > 0 &&
categoryById.attributeList.map((item:any, index:number) => (
<Form.Item
label={item.groupName}
name={`${item.groupName}__`}
key={item.groupId}
rules={[{ required: item.isEmpty, message: `请选择${item.groupName}` }]}
>
<AutoComplete>
{
item.attributeValueList.map((items:any) => (
<AutoComplete.Option value={items.value} key={items.id}>{items.value}</AutoComplete.Option>
))
}
</AutoComplete>
</Form.Item>
))
}
</div>
}
<div id='other_demand'>
<div className={style.affix_title}><Divider type="vertical" className={style.divider_style} />其他要求</div>
<Form.Item label='特殊说明' name='specialExplain'><Input.TextArea rows={4} /></Form.Item>
<Form.Item label='附件' name='upload'>
<div className={style.upload_data}>
{files.length > 0 && files.map((v, index) => (
<div key={index} className={style.upload_item}>
<div className={style.upload_left}>
<LinkOutlined />
<span>{v.name}</span>
</div>
<div className={style.upload_right}>
<DeleteOutlined />
</div>
</div>
))}
</div>
<Upload
action="/api/file/file/upload"
data={{ fileType: UPLOAD_TYPE }}
showUploadList={false}
accept='.doc,.docx,.pdf,.ppt,.pptx,.xls,.xlsx'
>
<Button loading={loading} icon={<UploadOutlined />}>上传文件</Button>
<div style={{ marginTop: '8px' }}>一次上传一个文件,每个附件大小不能超过 20M</div>
</Upload>
</Form.Item>
</div>
<div id='procured_amount'>
<div className={style.affix_title}><Divider type="vertical" className={style.divider_style} />采购数量</div>
<Form.Item label='单位' name='unit' rules={[{ required: true, message: '请选择单位' }]}><Input /></Form.Item>
<Form.Item label='采购数量' name='purchaseCount' rules={[{ required: true, message: '请输入采购数量' }]}><InputNumber min={1} style={{width: '100%'}} /></Form.Item>
</div>
</Form>
</Content>
</Layout>
</Modal>
)
}
export default ModalAnchor;
\ No newline at end of file
import React, { useState, useEffect } from 'react';
import { UPLOAD_TYPE } from '@/constants'
import { Modal, Anchor, Layout, Menu, Form, Divider, Input, Button, Upload, Cascader, Spin, InputNumber } from 'antd';
import style from '../index.less';
import { LinkOutlined, DeleteOutlined, UploadOutlined } from '@ant-design/icons';
import { PublicApi } from '@/services/api';
import ModalTable from '@/components/ModalTable';
import { ColumnType } from 'antd/lib/table/interface';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
const layout: any = {
colon: false,
labelCol: { style: { width: '110px' } },
labelAlign: "left"
};
const { Sider, Content } = Layout;
const { Link } = Anchor;
interface goodsParams {
visible?: boolean,
onOk?: Function,
onCancel?: Function,
fetchdata?: any,
isEdit?: boolean
}
const ModalGoods: React.FC<goodsParams> = (props) => {
const [form] = Form.useForm();
const { visible, onOk, onCancel, fetchdata, isEdit } = props;
const [loading, setloading] = useState(false);
const [files, setFiles] = useState([]);
const [category, setcategory] = useState<Array<any>>([]);
const [rowSelection, RowCtl] = useRowSelectionTable({ customKey: 'id', type: 'radio' });
const [visibleChannelGoods, setvisibleChannelGoods] = useState<boolean>(false);
const [goods, setGoods] = useState<any>({})
/**查询品类树 */
const searchCategoryTree = (id: any) => {
return new Promise(resolve => {
PublicApi.getProductPlatformGetCategoryTree({ rootNodeId: id }).then(res => {
if (res.code === 1000) {
resolve(res.data)
}
})
}).then((data: any) => {
setcategory(data)
})
}
useEffect(() => {
form.resetFields();
RowCtl.setSelectRow([])
RowCtl.setSelectedRowKeys([])
searchCategoryTree('0');
if (Object.keys(fetchdata).length > 0 && isEdit) {
const params: any = {
current: '1',
pageSize: '10',
code: fetchdata.goodsNo
}
PublicApi.getProductGoodsGetGoodsList({ ...params }).then(res => {
const { data } = res
RowCtl.setSelectRow(data.data)
RowCtl.setSelectedRowKeys([data.data[0].id])
})
form.setFieldsValue({
model: fetchdata.model,
brand: fetchdata.brand,
unit: fetchdata.unit,
purchaseCount: fetchdata.purchaseCount,
name: fetchdata.name,
category: fetchdata.category,
goodsNo: fetchdata.goodsNo,
})
}
}, [visible])
/**提交表单 */
const onSubmit = (value: any) => {
form.validateFields().then(res => {
console.log(rowSelection, RowCtl, 10086)
const data = {
...res,
goodsId: goods.id,
goodsName: goods.name
}
onOk(res, goods)
}).catch(error => {
console.log(error)
})
}
/**货品表头 */
const columns: ColumnType<any>[] = [
{
title: '货号',
key: 'code',
dataIndex: 'code'
},
{
title: '货品名称',
key: 'name',
dataIndex: 'name'
},
{
title: '规格型号',
key: 'type',
dataIndex: 'type'
},
{
title: '品类',
key: 'customerCategory',
dataIndex: 'customerCategory',
render: (text: any) => <span>{text.name}</span>
},
{
title: '品牌',
key: 'brand',
dataIndex: 'brand',
render: (text: any) => <span>{text.name}</span>
},
{
title: '单位',
key: 'unitName',
dataIndex: 'unitName'
},
]
/** 获取货品 */
const fetchGoodsData = (params: any) => {
return new Promise(resolve => {
PublicApi.getProductGoodsGetGoodsList(params).then(res => {
const { data } = res
resolve(data)
})
})
}
/** 选择货品 */
const handleConfirm = () => {
setvisibleChannelGoods(false)
const data = RowCtl.selectRow[0]
const fullId = data.customerCategory.fullId
const ids = fullId.replace(/\b(0+)/gi, '').split('.');
setGoods(data)
form.setFieldsValue({
goodsNo: data.code,
name: data.name,
model: data.type,
category: ids.join(',').split(','),
brand: data.brand.name,
unit: data.unitName,
})
}
return (
<>
<Modal
title='通过平台属性添加'
width='800px'
wrapClassName={style.modal_wrap_className}
bodyStyle={{ padding: '0px' }}
visible={visible}
onCancel={() => onCancel()}
onOk={onSubmit}
>
<Layout>
<Sider width={159} className={style.site_layout_background}>
<Anchor
bounds={0}
targetOffset={120}
affix={false}
>
<Menu
mode='inline'
defaultSelectedKeys={['1']}
>
<Menu.Item key="1"><Link href='#basic_info' title='基本信息' /></Menu.Item>
<Menu.Item key="2"><Link href='#procured_amount' title='采购数量' /></Menu.Item>
<Menu.Item key="3"><Link href='#other_demand' title='附件' /></Menu.Item>
</Menu>
</Anchor>
</Sider>
<Content className={style.site_content_style}>
<Form
form={form}
{...layout}
>
<div id='basic_info'>
<div className={style.affix_title}><Divider type="vertical" className={style.divider_style} />基本信息</div>
<Form.Item label='货号' name='goodsNo' rules={[{ required: true, message: '请输入商品编号' }]}><Input.Search enterButton={<><LinkOutlined /> 选择</>} onSearch={() => setvisibleChannelGoods(true)} /></Form.Item>
<Form.Item label='货品名称' name='name' rules={[{ required: true, message: '请输入货品名称' }]}><Input /></Form.Item>
<Form.Item label='规格型号' name='model' rules={[{ required: true, message: '请输入规格型号' }]}><Input /></Form.Item>
<Form.Item label='商品品类' name='category' rules={[{ required: true, message: '请选择商品品类' }]}>
<Cascader
options={category}
fieldNames={{ label: 'title', value: 'id', children: 'children' }}
placeholder="请选择品类"
notFoundContent={<Spin size="small" />}
/>
</Form.Item>
<Form.Item label='货品品牌' name='brand'><Input /></Form.Item>
</div>
<div id='procured_amount'>
<div className={style.affix_title}><Divider type="vertical" className={style.divider_style} />采购数量</div>
<Form.Item label='单位' name='unit' rules={[{ required: true, message: '请选择单位' }]}><Input /></Form.Item>
<Form.Item label='采购数量' name='purchaseCount' rules={[{ required: true, message: '请输入采购数量' }]}><InputNumber min={1} style={{ width: '100%' }} /></Form.Item>
</div>
<div id='other_demand'>
<div className={style.affix_title}><Divider type="vertical" className={style.divider_style} />其他要求</div>
<Form.Item label='附件' name='upload'>
<div className={style.upload_data}>
{files.length > 0 && files.map((v, index) => (
<div key={index} className={style.upload_item}>
<div className={style.upload_left}>
<LinkOutlined />
<span>{v.name}</span>
</div>
<div className={style.upload_right}>
<DeleteOutlined />
</div>
</div>
))}
</div>
<Upload
action="/api/file/file/upload"
data={{ fileType: UPLOAD_TYPE }}
showUploadList={false}
accept='.doc,.docx,.pdf,.ppt,.pptx,.xls,.xlsx'
>
<Button loading={loading} icon={<UploadOutlined />}>上传文件</Button>
<div style={{ marginTop: '8px' }}>一次上传一个文件,每个附件大小不能超过 20M</div>
</Upload>
</Form.Item>
</div>
</Form>
</Content>
</Layout>
</Modal>
<ModalTable
width={810}
modalTitle='选择货品'
columns={columns}
rowSelection={rowSelection}
visible={visibleChannelGoods}
confirm={handleConfirm}
cancel={() => setvisibleChannelGoods(false)}
fetchTableData={params => fetchGoodsData(params)}
forceRender={true}
modalType='goodsModalSchema'
tableProps={{
rowKey: 'id',
}}
resetModal={{
destroyOnClose: true
}}
/>
</>
)
}
export default ModalGoods;
\ No newline at end of file
import React, { useState, ReactNode, useEffect } from 'react';
import { Form, Radio, Button, Table } from 'antd';
import { ColumnType } from 'antd/lib/table/interface';
import ModalAnchor from './Modal/modalAnchor';
import ModalGoods from './Modal/modalGoods';
import { PlusOutlined } from '@ant-design/icons';
import { PublicApi } from '@/services/api';
const layout: any = {
colon: false,
labelCol: { style: { width: '174px' } },
wrapperCol: { span: 9 },
labelAlign: "left"
};
export interface faceSetData {
set?: any,
onGet?: Function,
currentRef: any
}
const AddGoods: React.FC<faceSetData> = (props) => {
const { set, currentRef, onGet } = props
const [form] = Form.useForm();
const [type, setType] = useState<number>(0);
const btnname: Array<string> = ['添加商品', '选择货品', '导入货品']
const [visible, setvisible] = useState<Array<boolean>>([false, false, false, false]);
const [tabledata, settabledata] = useState<any>([])
/**存放编辑的商品数据 */
const [editdata, seteditdata] = useState<any>({});
/**是否编辑 */
const [isEdit, setisEdit] = useState<boolean>(false);
/**编辑的下标 */
const [idx, setidx] = useState<number>(-1);
/** 平台属性添加表头 */
const columns: ColumnType<Object>[] = [
{
title: '商品编号',
key: 'goodsNo',
dataIndex: 'goodsNo',
},
{
title: '商品名称',
key: 'name',
dataIndex: 'name',
},
{
title: '规格型号',
key: 'model',
dataIndex: 'model',
},
{
title: '品类',
key: 'category',
dataIndex: 'category',
},
{
title: '品牌',
key: 'brand',
dataIndex: 'brand',
},
{
title: '采购数量',
key: 'purchaseCount',
dataIndex: 'purchaseCount',
},
{
title: '操作',
key: 'options',
dataIndex: 'options',
render: (text: any, record: any, index: number) =>
<>
<Button type='link' onClick={() => handleEdit(record, index)}>编辑</Button>
<Button type='link'>删除</Button>
</>
}
]
/** 切换添加方式 */
const changeRadio = (e: any) => {
const { value } = e.target;
setType(value);
settabledata([]);
}
/** 按钮的文字 */
const handleText = (num: any) => {
let text: ReactNode = null;
text = btnname[num - 1];
return text
}
/**
* @name: 操作弹窗
* @arg: 1.通过平台属性添加 2.选择货品添加 3.导入货品生成
* */
const handleModal = (arg: number) => {
visible[arg] = !visible[arg]
setvisible([...visible])
}
/** 商品添加确定 */
const handleSubmit = (data: any, record?: any) => {
if (idx === -1) {
settabledata([...tabledata, data])
} else {
const newdata = [...tabledata]
newdata[idx] = data
settabledata([...newdata]);
setidx(-1);
}
onGet([...tabledata, data])
handleModal(type);
}
/** 编辑商品 */
const handleEdit = (record: any, index: number) => {
setidx(index);
seteditdata(record)
setisEdit(true)
handleModal(type)
}
useEffect(() => {
currentRef.current = {
get: () => new Promise((resolve: any) => {
form.validateFields().then(res => {
resolve({
state: true,
name: 'addGoods',
data: {
type,
requisitionFormProducts: tabledata,
}
})
}).catch(error => {
console.log(error)
})
})
}
}, [tabledata])
useEffect(() => {
/**编辑回显数据 */
if (Object.keys(set).length > 0) {
form.setFieldsValue({
type: set.type
})
setType(set.type)
settabledata(set.requisitionFormProducts)
}
}, [set])
return (
<Form
{...layout}
form={form}
>
<Form.Item label='添加方式' name='type' rules={[{ required: true, message: '请选择添加方式' }]}>
<Radio.Group onChange={changeRadio}>
<Radio value={1}>通过平台属性添加</Radio>
<Radio value={2}>选择货品添加</Radio>
<Radio value={3}>导入货品生成</Radio>
</Radio.Group>
</Form.Item>
{type > 0 &&
<Form.Item noStyle>
<Button onClick={() => { handleModal(type); setisEdit(false) }} type='dashed' block style={{ marginBottom: '24px' }}><PlusOutlined />{handleText(type)}</Button>
<Table columns={columns} dataSource={tabledata} rowKey={(record, index) => index} />
</Form.Item>
}
<ModalAnchor
fetchdata={editdata}
isEdit={isEdit}
visible={visible[1]}
onOk={handleSubmit}
onCancel={() => handleModal(type)}
/>
<ModalGoods
fetchdata={editdata}
isEdit={isEdit}
visible={visible[2]}
onOk={handleSubmit}
onCancel={() => handleModal(type)}
/>
</Form>
)
}
export default AddGoods;
\ No newline at end of file
import React, { useState, useEffect } from 'react';
import { Form, Input, Tooltip, Button, Select, Row, Col, message } from 'antd';
import { QuestionCircleOutlined } from '@ant-design/icons';
import { PublicApi } from '@/services/api';
import style from './index.less';
const layout: any = {
colon: false,
labelCol: { style: { width: '174px' } },
wrapperCol: { span: 9 },
labelAlign: "left"
};
export interface faceSetData {
set?: any,
get?: Function,
currentRef?: any
}
const { Option } = Select;
const BasicInfo: React.FC<faceSetData> = (props) => {
const [form] = Form.useForm();
const { set, get, currentRef } = props
const [province, setprovince] = useState<any>([]);// 省列表
const [city, setcity] = useState<any>([]);// 市列表
const [requisitionFormAddress, setrequisitionFormAddress] = useState<any>([{
provinceCode: '',
province: '',
cityCode: '',
city: ''
}]);
const [code, setcode] = useState<any>([]);
//获取所有得地区
const manageProvince = () => {
return new Promise(resolve => {
PublicApi.getManageAreaAll().then(res => {
if (res.code === 1000) {
resolve(res.data);
}
})
})
}
// 选择下拉得内容
const handProvince = async (val: any, idx: number, num: number) => {
const result = [...requisitionFormAddress];
const cityCode: Array<any> = []
result.forEach((item: any) => {
if (item.cityCode) {
cityCode.push(item.cityCode)
}
})
setcode([...cityCode]);
if (num === 1) {
await province.forEach(item => {
if (item.code === val) {
PublicApi.getManageAreaByPcodeAll({ pcode: val }).then((res: any) => {
if (res.code === 1000) {
result[idx].provinceCode = val;
result[idx].province = item.name;
city[idx] = { citydata: res.data }
setcity([...city])
}
})
}
})
} else {
city.forEach(item => {
item.citydata.forEach(items => {
if (items.code === val) {
const cityCode = code.find(it => items.code);
if (cityCode !== items.code) {
items.disabled = false
}
result[idx].cityCode = val;
result[idx].city = items.name;
}
})
})
setcity([...city])
}
setrequisitionFormAddress(result);
}
// 选择城市的时候下拉就调用方
const onDropdownVisibleChange = () => {
return new Promise(reslove => reslove(code)).then((res: any) => {
city.forEach((item: any) => {
item.citydata.filter(it => {
res.map(items => {
if (items === it.code) {
it.disabled = true
}
})
})
})
setcity([...city])
})
}
// 添加一条地址
const addFormAddress = (idx: number) => {
const address: any = {
provinceCode: '',
province: '',
cityCode: '',
city: ''
}
if (requisitionFormAddress[idx].provinceCode && requisitionFormAddress[idx].cityCode) {
setrequisitionFormAddress([...requisitionFormAddress, address])
} else {
message.error('请完善适用城市信息')
}
}
// 删除一条地址
const removeFormAddress = (idx: any) => {
if (requisitionFormAddress.length > 1) {
const requisitionFormAddressFilter = requisitionFormAddress.filter((item: any, index: number) => index !== idx);
const cityFilter = city.filter((item: any, index: number) => index !== idx);
form.resetFields();
requisitionFormAddressFilter.forEach((item: any, index: number) => {
const cityCode = code.find(it => item.cityCode);
if (cityCode !== item.cityCode) {
item.disabled = false
}
form.setFieldsValue({
['province_' + index]: item.provinceCode,
['city_' + index]: item.cityCode
});
})
setcity(cityFilter);
setrequisitionFormAddress(requisitionFormAddressFilter);
}
}
useEffect(() => {
manageProvince().then(data => {
setprovince(data)
})
}, [])
useEffect(() => {
/**编辑回显数据 */
if (Object.keys(set).length > 0) {
setrequisitionFormAddress([...set.requisitionFormAddress])
set.requisitionFormAddress.forEach((item: any, index: number) => {
PublicApi.getManageAreaByPcodeAll({ pcode: item.provinceCode }).then((res: any) => {
if (res.code === 1000) {
city[index] = { citydata: res.data }
Promise.resolve().then(() => {
setTimeout(() => {
setcity([...city])
setcode([...code, item.cityCode])
form.setFieldsValue({
details: set.details,
['province_' + index]: item.provinceCode,
['city_' + index]: item.cityCode,
});
}, 350);
});
}
})
})
}
}, [set])
useEffect(() => {
currentRef.current = {
get: () => new Promise((resolve: any) => {
form.validateFields().then(res => {
resolve({
state: true,
name: 'basicInfo',
data: {
details: res.details,
requisitionFormAddress,
}
})
}).catch(error => {
console.log(error)
})
})
}
}, [requisitionFormAddress])
return (
<Form
{...layout}
form={form}
>
<Form.Item
label='需求单摘要'
name='details'
rules={[{ required: true, message: '请输入需求单摘要' }]}
>
<Input />
</Form.Item>
<Form.Item
label={<Tooltip placement="right" title='设置了归属地市后,此商品可根据地市进行筛选,未设置时默认为所有地市'>适用地市<QuestionCircleOutlined style={{ marginLeft: '5px' }} /></Tooltip>}
style={{ marginBottom: '0' }}
>
{requisitionFormAddress.map((item: any, idx: number) => {
return (
<Row gutter={10} key={`requisitionFormAddress_${idx}_`} className={style.formwrap}>
<Col span={12}>
<Form.Item name={`province_${idx}`}>
<Select
onDropdownVisibleChange={onDropdownVisibleChange}
onChange={(value) => {
handProvince(value, idx, 1)
}}
>
{province.map(items => {
return (
<Option key={`${items.id}_${idx}_province`} value={items.code}>{items.name}</Option>
)
})}
</Select>
</Form.Item>
</Col>
<Col span={12}>
<Form.Item
name={`city_${idx}`}
>
<Select
onDropdownVisibleChange={onDropdownVisibleChange}
onChange={(value) => {
handProvince(value, idx, 2)
}}
>
{(item.provinceCode && city.length > 0 && city[idx]) && city[idx].citydata.map(items => {
return (
<Option disabled={items.disabled} key={`${items.id}_${idx}_city`} value={items.code}>{items.name}</Option>
)
})}
</Select>
</Form.Item>
</Col>
<div className={style.formbutton}>
{
(idx === requisitionFormAddress.length - 1) &&
<Form.Item>
<Button type='primary' onClick={() => addFormAddress(idx)}>+</Button>
</Form.Item>
}
{
requisitionFormAddress.length > 1 &&
<Form.Item>
<Button onClick={() => removeFormAddress(idx)}>-</Button>
</Form.Item>
}
</div>
</Row>
)
})}
</Form.Item>
<Form.Item
label='需求单号'
>
<span>{set.requisitionFormNo && set.requisitionFormNo}</span>
</Form.Item>
<Form.Item
label='会员名称'
>
<span>{set.memberName && set.memberName}</span>
</Form.Item>
<Form.Item
label='单据时间'
>
<span>{set.voucherTime && set.voucherTime}</span>
</Form.Item>
<Form.Item
label='外部状态'
>
<span>{set.externalState && set.externalState}</span>
</Form.Item>
<Form.Item
label='内部状态'
>
<span>{set.interiorState && set.interiorState}</span>
</Form.Item>
</Form>
)
}
export default BasicInfo;
\ No newline at end of file
import React, { useRef, useState } from 'react';
import { Form, Radio, Tooltip, Row, Col, Checkbox, Avatar, Space, Button, Input } from 'antd';
import { QuestionCircleOutlined, PlusOutlined } from '@ant-design/icons';
import style from './index.less';
import { StandardTable } from 'god';
import { ColumnType } from 'antd/lib/table/interface';
import { GlobalConfig } from '@/global/config'
import { PublicApi } from '@/services/api';
const layout: any = {
colon: false,
labelCol: { style: { width: '174px' } },
wrapperCol: { span: 9 },
labelAlign: "left"
};
export interface faceSetData {
set?: any,
get?: Function
}
const DemandDbutted: React.FC<faceSetData> = (props) => {
const { set, get } = props
const [shopId, setShopId] = useState<Number>(0);
const ref = useRef<any>({});
const [filterParams, setFilterParams] = useState<any>({});
const [goodAllIds, setgoodAllIds] = useState<Array<any>>([]);
// 搜索
const handleSearch = (val: string) => {
let obj = { ...filterParams, name: val }
setFilterParams(obj)
ref.current.reload(obj)
}
// 重置
const handleReset = () => {
setFilterParams({})
setTimeout(() => {
ref.current.reload()
}, 500)
}
// 系统匹配表头
const columns: ColumnType<any>[] = [
{
title: '序号',
key: 'id',
dataIndex: 'id',
},
{
title: '会员名称',
key: 'memberName',
dataIndex: 'memberName',
},
{
title: '会员类型',
key: 'memberTypeName',
dataIndex: 'memberTypeName',
},
{
title: '会员角色',
key: 'roleName',
dataIndex: 'roleName',
},
{
title: '会员等级',
key: 'levelTag',
dataIndex: 'levelTag',
},
{
title: '是否归属会员',
key: 'membershipOrNot',
dataIndex: 'membershipOrNot',
},
{
title: '状态',
key: 'state',
dataIndex: 'state',
},
{
title: '操作',
key: 'options',
dataIndex: 'options',
},
]
// 指定会员表头
const memberColumns: ColumnType<any>[] = [
{
title: '序号',
key: 'memberId',
dataIndex: 'memberId',
},
{
title: '会员名称',
key: 'name',
dataIndex: 'name',
},
{
title: '会员类型',
key: 'memberTypeName',
dataIndex: 'memberTypeName',
},
{
title: '会员角色',
key: 'roleName',
dataIndex: 'roleName',
},
{
title: '会员等级',
key: 'levelTag',
dataIndex: 'levelTag',
}
]
// 选择系统匹配的列表数据
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<any>>([]);
const rowSelection = {
selectedRowKeys,
onChange: setSelectedRowKeys
};
// 切换添加方式
const changeRadio = (e: any) => {
const { value } = e.target;
if(value === 1) {
let shopList = GlobalConfig.web.shopInfo.filter(v => v.type == 1).map(
v => v
)
setgoodAllIds(shopList)
} else {
}
setShopId(value)
}
// 请求系统匹配列表数据
const fetchSystemMateData = (params: any, index: number) => {
if (index === 1) {
console.log(params, index)
} else if (index === 2) {
} else {
return new Promise(resolve => {
PublicApi.getMemberManageUpperProviderPage({ ...filterParams, ...params }).then(res => {
if (res.code === 1000) {
resolve(res.data)
}
})
})
}
}
return (
<Form
{...layout}
>
<Form.Item label='添加方式' required>
<Radio.Group onChange={changeRadio}>
<Radio value={1}><Tooltip placement="topLeft" title={<>需求发布至企业商城求购频道</>}>发布类型<QuestionCircleOutlined style={{ marginLeft: '5px' }} /></Tooltip></Radio>
<Radio value={2}><Tooltip placement="topLeft" title={<>系统通过需求单品类、商品属性、适用地市与平台会员发布的商品品类、商品属性、归属地区进行匹配,推荐满足条件的平台会员</>}>系统匹配<QuestionCircleOutlined style={{ marginLeft: '5px' }} /></Tooltip></Radio>
<Radio value={3}><Tooltip placement="topLeft" title={<>选择与当前会员有归属关系的会员且角色类型为服务提供的会员(供应商),需求只发送给指定会员</>}>指定会员<QuestionCircleOutlined style={{ marginLeft: '5px' }} /></Tooltip></Radio>
</Radio.Group>
</Form.Item>
{shopId === 1 &&
// 发布至平台
<Form.Item label='发布至平台' name='shopId' wrapperCol={{ span: 24 }}>
<Checkbox.Group className={style.checkbox_wrap_style} onChange={(e) => fetchSystemMateData(e, 1)}>
<Row>
{
goodAllIds.map((v: any, i: number) => {
console.log(v, 1002)
return (
<Col span={6} key={`col_${i}`}>
<Checkbox value={v.id}>
<Space>
<Avatar src={v.logoUrl}>LOGO</Avatar>
<span>{v.name}</span>
</Space>
</Checkbox>
</Col>
)
})
}
</Row>
</Checkbox.Group>
</Form.Item>
}
{
shopId === 2 &&
// 系统匹配
<Form.Item noStyle>
<StandardTable
rowSelection={rowSelection}
columns={columns}
// fetchTableData={(params) => fetchSystemMateData(params)}
/>
</Form.Item>
}
{
shopId === 3 &&
// 指定会员
<Form.Item noStyle>
{/* <Button type='dashed' block style={{ marginBottom: '24px' }}><PlusOutlined />选择会员</Button> */}
<StandardTable
tableProps={{
rowKey: 'id',
}}
currentRef={ref}
rowSelection={rowSelection}
columns={memberColumns}
fetchTableData={(params) => fetchSystemMateData(params, 3)}
controlRender={
<Row>
<Col span={12}>
<Input.Search
style={{ width: '256px', marginRight: '24px', marginBottom: '24px' }}
placeholder='搜索'
value={filterParams.name}
onChange={(e) => setFilterParams({ ...filterParams, name: e.target.value })}
onSearch={(val) => handleSearch(val)}
/>
<Button onClick={handleReset}>重置</Button>
</Col>
</Row>
}
/>
</Form.Item>
}
</Form>
)
}
export default DemandDbutted;
\ No newline at end of file
import React, { useState, useEffect } from 'react';
import styles from './index.less';
import { Radio } from 'antd';
import PolymericTable from '@/components/PolymericTable';
import { EditableColumns } from '@/components/PolymericTable/interface';
import moment from 'moment';
export interface faceSetData {
set?: any,
get?: Function
}
const FlowRecord: React.FC<faceSetData> = (props) => {
const { set, get } = props
const [radio, setRadio] = useState<string>('outer'); //切换单据
const format = (text) => {
return <>{moment(text).format("YYYY-MM-DD HH:mm:ss")}</>
}
const outerColumns: EditableColumns[] = [{
title: '序号',
dataIndex: 'inquiryListId',
render: (texr: any, record: any, index: number) => <span>{index + 1}</span>
}, {
title: '操作角色',
dataIndex: 'roleName',
}, {
title: '状态',
dataIndex: 'state',
}, {
title: '操作',
dataIndex: 'operationalProcess',
}, {
title: '操作时间',
dataIndex: 'operationTime',
render: (text: any, record: any) => format(text)
}, {
title: '审核意见',
dataIndex: 'auditOpinion',
}]
const insideColumns: EditableColumns[] = [{
title: '序号',
dataIndex: 'inquiryListId',
render: (texr: any, record: any, index: number) => <span>{index + 1}</span>
}, {
title: '操作人',
dataIndex: 'roleName',
}, {
title: '部门',
dataIndex: 'department',
}, {
title: '职位',
dataIndex: 'position',
}, {
title: '状态',
dataIndex: 'state',
}, {
title: '操作',
dataIndex: 'operationalProcess',
}, {
title: '操作时间',
dataIndex: 'operationTime',
render: (text: any, record: any) => format(text)
}, {
title: '审核意见',
dataIndex: 'auditOpinion',
}]
const onChange = (e: any) => {
setRadio(e.target.value)
}
return (
<div>
<Radio.Group defaultValue="outer" buttonStyle="solid" onChange={onChange}>
<Radio.Button value="outer">外部单据</Radio.Button>
<Radio.Button value="inside">内部单据</Radio.Button>
</Radio.Group>
{radio === 'outer' ?
<PolymericTable
columns={outerColumns}
loading={false}
pagination={null}
dataSource={Object.keys(set).length > 0 && set.externalRequisitionFormStateResponses}
/>
:
<PolymericTable
columns={insideColumns}
loading={false}
pagination={null}
dataSource={Object.keys(set).length > 0 && set.interiorRequisitionFormStateResponses}
/>
}
</div>
)
}
export default FlowRecord
\ No newline at end of file
.formwrap {
position: relative;
.formbutton {
position: absolute;
right: -95px;
display: flex;
width: 90px;
:global {
.ant-form-item {
width: 32px;
margin-right: 10px;
.ant-btn {
width: 32px;
padding: 0;
margin-right: 10px;
}
}
}
}
}
.modal_wrap_className {
.site_layout_background {
background-color: #fff;
border-right: 1px solid #EEF0F3;
}
.site_content_style {
background-color: #fff;
padding: 24px;
height: 600px;
overflow-y: scroll;
.affix_title {
font-size: 14px;
margin-bottom: 24px;
.divider_style {
width: 2px;
height: 16px;
margin: 0px 5px 0px 0px ;
background-color: #00B37A;
}
}
.upload_item {
padding: 5px 8px;
margin-bottom: 16px;
display: flex;
align-items: center;
justify-content: space-between;
background-color: #FAFBFC;
.upload_left {
display: flex;
align-items: center;
color: #303133;
:global {
.anticon-file-word {
color: #4279df;
font-size: 20px;
margin-right: 8px;
}
}
}
.upload_right {
color: #00B37A;
cursor: pointer;
:global {
.anticon-delete {
margin-left: 19px;
color: #C0C4CC;
}
}
}
}
}
:global {
.ant-anchor-wrapper {
margin-left: 0 !important;
padding-left: 0 !important;
}
.ant-menu-item {
margin-top: 0 !important;
margin-bottom: 0 !important;
&:after {
left: 0;
border-right: none;
border-left: 2px solid #00B37A;
height: 80%;
margin: auto;
}
.ant-anchor-link {
padding: 0px !important;
line-height: 40px !important;
}
}
.ant-menu-item-selected {
color: #303133;
font-weight: 600;
background-color: transparent !important;
}
}
}
.checkbox_wrap_style {
width: 100%;
:global {
.ant-checkbox-wrapper {
width: 100%;
border: 1px solid #ccc;
padding: 8px 18px;
.ant-checkbox {
display: none;
}
> span {
display: flex;
align-items: center;
padding: 0px 0px;
.checkbox_avatar {
width: 32px;
height: 32px;
margin-right: 8px;
}
}
}
.ant-checkbox-wrapper-checked {
border-color: #00b37a!important;
color: #00b37a;
position: relative;
&:after {
content: "";
position: absolute;
width: 12px;
height: 11px;
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAALCAYAAABLcGxfAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAADKADAAQAAAABAAAACwAAAAChLCZNAAAA6klEQVQoFWNgIAVsruliJkr9/1XMDCZqcxkY/mczEtSwv4GD4euvlQz/GfxAavFr2N3Bz/Dz8yaG///tYAbj1rC1QYLh/+8dQMX6MMW4bdjSoMTA8Gs30BlAGhUwoXKBvM21QBN/H0VWbMovzXDSOgOsFFXD1mo7Bsa/B5U5BSVgBoEUrzaOZMi5shkshAjWLTWgUNgINJlnh1k8AysTEzhEQIpDzy5nOP3xKVgDxNNbqxIY/jHMAYqADRBi5WTYY5HEIMbGzRB4ZilcMUgHI8PWqlKg4i6wdiRCgIWDQYSNi+HOt3dIogwMANgLQif9hMeFAAAAAElFTkSuQmCC);
right: 0;
bottom: 0;
}
}
}
}
\ No newline at end of file
import React, { useState, useEffect } from 'react';
import moment from 'moment';
import { Form, Input, Select, Row, Col, DatePicker, message } from 'antd';
import { PublicApi } from '@/services/api';
const layout: any = {
colon: false,
labelCol: { style: { width: '174px' } },
wrapperCol: { span: 24 },
labelAlign: "left"
};
export interface faceSetData {
set?: any,
get?: Function,
currentRef?: any
}
const TradingConditions: React.FC<faceSetData> = (props) => {
const { set, get, currentRef } = props
const [TradingConditionsForm] = Form.useForm();
const [address, setAddress] = useState([]);
const [selectAddress, setselectAddress] = useState<any>({});
useEffect(() => {
// 获取交付地址
PublicApi.getLogisticsSelectListReceiverAddress().then(res => {
setAddress(res.data)
})
}, [])
useEffect(() => {
currentRef.current = {
get: () => new Promise((resolve: any) => {
TradingConditionsForm.validateFields().then(res => {
console.log(res, selectAddress)
resolve({
state: true,
name: 'tradingConditions',
data: {
deliveryTime: moment(res.deliveryTime).format('x'),
quotationAsTime: moment(res.quotationAsTime).format('x'),
addresId: res.addresId,
addres: selectAddress.children,
logistics: res.logistics,
offer: res.offer,
otherRequire: res.otherRequire,
packRequire: res.packRequire,
paymentType: res.paymentType,
taxes: res.taxes,
}
})
}).catch(error => {
console.log(error)
})
})
}
}, [selectAddress])
const disabledDate = (current) => {
return current && current < moment().endOf('day');
}
const onSelect = (val: any, option: any) => {
console.log(option)
setselectAddress(option)
}
useEffect(() => {
if(Object.keys(set).length > 0) {
TradingConditionsForm.setFieldsValue({
deliveryTime: moment(set.deliveryTime),
addresId: set.addresId,
quotationAsTime: moment(set.quotationAsTime),
offer: set.offer,
paymentType: set.paymentType,
taxes: set.taxes,
logistics: set.logistics,
packRequire: set.packRequire,
otherRequire: set.otherRequire
})
setselectAddress({children: set.addres});
}
}, [set])
return (
<Form
{...layout}
form={TradingConditionsForm}
>
<Row gutter={70}>
<Col span={12}>
<Form.Item label='交付日期' name='deliveryTime' rules={[{ required: true, message: '请选择交付日期' }]}>
<DatePicker
style={{ width: '100%' }}
disabledDate={disabledDate}
format="YYYY-MM-DD HH:mm:ss"
/>
</Form.Item>
<Form.Item label='交付地址' name='addresId' rules={[{ required: true, message: '请选择交付地址' }]}>
<Select onSelect={onSelect}>
{address.map(v => (
<Select.Option key={v.id} value={v.id}>{v.fullAddress}</Select.Option>
))}
</Select>
</Form.Item>
<Form.Item label='报价截止时间' name='quotationAsTime' rules={[{ required: true, message: '请选择报价截止时间' }]}>
<DatePicker
style={{ width: '100%' }}
format="YYYY-MM-DD HH:mm:ss"
disabledDate={disabledDate}
/>
</Form.Item>
<Form.Item label='报价要求' name='offer'>
<Input.TextArea placeholder='最长100个字符,50个汉字' />
</Form.Item>
<Form.Item label='付款方式' name='paymentType'>
<Input.TextArea placeholder='最长100个字符,50个汉字' />
</Form.Item>
<Form.Item label='税费要求' name='taxes'>
<Input.TextArea placeholder='最长100个字符,50个汉字' />
</Form.Item>
<Form.Item label='物流要求' name='logistics'>
<Input.TextArea placeholder='最长100个字符,50个汉字' />
</Form.Item>
</Col>
<Col span={12}>
<Form.Item label='包装要求' name='packRequire'>
<Input.TextArea placeholder='最长100个字符,50个汉字' />
</Form.Item>
<Form.Item label='其他要求' name='otherRequire'>
<Input.TextArea placeholder='最长100个字符,50个汉字' />
</Form.Item>
</Col>
</Row>
</Form>
)
}
export default TradingConditions
\ No newline at end of file
import React, { useState, useEffect, useRef } from 'react';
import { history } from 'umi';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { Card, Row, Col, Space, Button, Dropdown, Menu, message, Popconfirm } from 'antd';
import { StandardTable } from 'god';
import { ColumnType } from 'antd/lib/table/interface';
import moment from 'moment';
import { PublicApi } from '@/services/api';
import NiceForm from '@/components/NiceForm';
import { createFormActions } from '@formily/antd';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import GeneralExternalState from '@/pages/transaction/common/externalState';
import GeneralInteriorState from '@/pages/transaction/common/interiorState';
import { enquierySchema } from '../schema';
import { timeRange } from '@/utils/index'
import { DeleteOutlined, DownOutlined, PlusOutlined } from '@ant-design/icons';
const formActions = createFormActions();
const AddDemandOrder = () => {
const ref = useRef<any>({});
const [selectRow, setSelectRow] = useState([])
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<number>>([])
const format = (text) => {
return <>{moment(text).format("YYYY-MM-DD HH:mm:ss")}</>
}
const columns: ColumnType<any>[] = [
{
title: '需求单号',
key: 'requisitionFormNo',
dataIndex: 'requisitionFormNo'
},
{
title: '需求摘要',
key: 'details',
dataIndex: 'details'
},
{
title: '交付日期',
key: 'deliveryTime',
dataIndex: 'deliveryTime',
render: (text: any) => format(text)
},
{
title: '报价截止时间',
key: 'quotationAsTime',
dataIndex: 'quotationAsTime',
render: (text: any) => format(text)
},
{
title: '单据时间',
key: 'voucherTime',
dataIndex: 'voucherTime',
render: (text: any) => format(text)
},
{
title: '外部状态',
key: 'externalState',
dataIndex: 'externalState',
render: text => <GeneralExternalState colorType={1} state={text} data={externalState} />
},
{
title: '内部状态',
key: 'interiorState',
dataIndex: 'interiorState',
render: (text: any) => <GeneralInteriorState colorType={1} state={text} data={interiorState} />
},
{
title: '操作',
key: 'options',
dataIndex: 'options',
render: (_: any, record: any) => {
return (
<>
{
(record.interiorState !== 3 &&
<Button type="link" onClick={() => history.push(`/memberCenter/tranactionAbility/enquirySubmit/addDemandOrder/edit?id=${record.id}`)}>编辑</Button>
)
}
{
(record.externalState === 1 && record.interiorState === 1) &&
<>
<Popconfirm title="确定要删除吗?" okText="是" cancelText="否" onConfirm={() => handleDelete([record.id])}>
<Button type='link'>
删除
</Button>
</Popconfirm>
<Popconfirm title="确定要提交吗?" okText="是" cancelText="否" onConfirm={() => PublicApi.postOrderNewRequisitionFormAudit({ id: record.id }).then(res => {
ref.current.reload()
})}>
<Button type='link'>提交</Button>
</Popconfirm>
</>
}
</>
)
}
},
]
const rowSelection = {
selectedRowKeys: selectedRowKeys,
onChange: (selectedRowKeys: any, selectedRows: any) => {
setSelectRow(selectedRows);
setSelectedRowKeys(selectedRowKeys);
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows)
},
}
const fetchData = async (params: any) => {
const res = await PublicApi.getOrderRequisitionFormAwaitList(params);
return res.data
}
const [externalState, setExternalState] = useState<any>([]);
const [interiorState, setInteriorState] = useState<any>([]);
useEffect(() => {
const external = new Promise(resolve => {
//查询需求单外部状态枚举列表
PublicApi.getOrderRequisitionFormExternalStateEnum().then((res: any) => {
if (res.code === 1000) {
resolve(res.data)
}
})
})
const interior = new Promise(resolve => {
// 查询需求单内部状态枚举列表
PublicApi.getOrderRequisitionFormInteriorStateEnum().then((res: any) => {
if (res.code === 1000) {
resolve(res.data)
}
})
})
Promise.all([external, interior]).then(res => {
setExternalState(res[0])
setInteriorState(res[1])
})
}, [])
const menu = (
<Menu onClick={() => handleDelete(selectedRowKeys)}>
<Menu.Item key='1' icon={<DeleteOutlined />}>
批量删除
</Menu.Item>
</Menu>
)
const controllerBtns = <Row>
<Col span={24}>
<Space direction="horizontal" size={16}>
<Button type="primary" onClick={() => history.push('/memberCenter/tranactionAbility/enquirySubmit/addDemandOrder/add')} icon={<PlusOutlined />}>新建</Button>
<Button onClick={() => handleSubmitAll(selectedRowKeys)}>批量提交审核</Button>
<Dropdown.Button
overlay={menu}
trigger={['click']}
icon={<DownOutlined />}
>
更多
</Dropdown.Button>
</Space>
</Col>
</Row>
const handleSubmitAll = (ids) => {
if (ids.length > 0) {
PublicApi.postOrderNewRequisitionFormAuditAll({ ids: ids }).then(res => {
ref.current.reload()
})
} else {
message.error('请选择要操作的需求单');
}
}
const handleDelete = (arr: number[]) => {
if (arr.length > 0) {
PublicApi.postOrderRequisitionFormDeleteAll({ ids: arr }).then(res => {
ref.current.reload()
})
} else {
message.error('请选择要操作的需求单');
}
}
const handleSumbit = (values: any) => {
if (values.voucherTime) {
values.startVoucherTime = timeRange(values.voucherTime).st
values.endVoucherTime = timeRange(values.voucherTime).et
delete values.voucherTime
}
ref.current.reload(values)
}
return (
<PageHeaderWrapper>
<Card>
<StandardTable
currentRef={ref}
columns={columns}
tableProps={{ rowKew: 'id' }}
fetchTableData={(params: any) => fetchData(params)}
rowSelection={rowSelection}
controlRender={
<NiceForm
actions={formActions}
onSubmit={values => handleSumbit(values)}
effects={($, actions) => {
useStateFilterSearchLinkageEffect($, actions, 'requisitionFormNo', FORM_FILTER_PATH)
}}
expressionScope={{
controllerBtns
}}
schema={enquierySchema}
>
</NiceForm>
}
/>
</Card>
</PageHeaderWrapper>
);
}
export default AddDemandOrder;
\ No newline at end of file
import React, { Component, useState, useEffect } from 'react';
import { Modal, Button, Form } from 'antd'
import {
SchemaForm, SchemaMarkupField as Field,
createFormActions,
FormEffectHooks
} from '@formily/antd'
import { Input, Radio, FormMegaLayout } from '@formily/antd-components'
import { PublicApi } from '@/services/api'
import {PATTERN_MAPS} from '@/constants/regExp'
export interface Params {
id: number | string;
type: number|string;//1是一级 2是二级
dialogVisible: boolean;
onCancel: Function;
onOK?: Function;
dontReceive?: boolean; //默认展示
}
const actions = createFormActions()
const { onFieldChange$ } = FormEffectHooks
const comfirmDialog: React.FC<Params> = (props) => {
console.log(props.dialogVisible)
const handleCancel = () => {
}
const handletOk = (values: any) => {
let value = { ...values }
value.id = props.id
console.log('value',value)
if(props.type == 1){
PublicApi.postOrderRequisitionFormAudit(value).then(res => {
if (res.code === 1000) {
console.log(123123)
props.onOK()
}
})
}else if(props.type == 2){
PublicApi.postOrderRequisitionFormAuditTwo(value).then(res => {
if (res.code === 1000) {
console.log(123123)
props.onOK()
}
})
}
}
useEffect(() => {
return () => {
}
}, [])
const useFormEffects = () => {
const { setFieldState } = createFormActions()
onFieldChange$('state').subscribe(({ value }) => {
setFieldState('cause', state => {
if (value == 1) {
state.visible = false
} else {
state.visible = true
}
})
})
}
return (
<>
<Modal
title='审核确认'
width={800}
visible={props.dialogVisible}
onOk={() => actions.submit()}
onCancel={() => props.onCancel()}
destroyOnClose
afterClose={() => actions.reset()}
okText='确定'
cancelText={`取消`}
>
<SchemaForm
labelCol={4}
layout="vertical"
components={{
Input, Radio: Radio.Group, TextArea: Input.TextArea
}}
actions={actions}
effects={() => useFormEffects()}
onSubmit={(values) => handletOk(values)}
initialValues={{
state: 1
}}
>
<Field
enum={
[
{ label: '审核通过', value: 1 },
{ label: '审核不通过', value: 0 }
]}
name='state'
required
x-component="Radio"
x-component-props={{
}}
/>
{props.dontReceive &&
<>
{/* <FormMegaLayout name='remarkOption' label='不接受原因' full required labelCol={2} labelAlign="top"> */}
<Field
title='审核不通过原因'
name="cause"
x-component="TextArea"
required
x-component-props={{
placeholder: '在此输入你的内容,最多60个汉字'
}}
x-rules ={{
max:60,
// maximum:10,//最大数值
message:'原因最多60个汉字'
}}
/>
</>
}
</SchemaForm>
</Modal>
</>
)
}
comfirmDialog.defaultProps = {
dontReceive: true
}
export default comfirmDialog
\ No newline at end of file
import React from 'react';
import style from './index.less';
import { Button } from 'antd';
import { CheckSquareOutlined } from '@ant-design/icons';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { history } from 'umi';
const detailInfo: React.FC<{}> = () => {
return (
<PageHeaderWrapper
onBack={() => history.goback()}
title={
<div className={style['headerTop']}>
<div className={style['headerTop-prefix']}></div>
<div className={style['headerTop-name']}>
需求单号:123456789
</div>
<div className={style[`levelIcon${'1'}`]}></div>
</div>
}
extra={
<Button className={style['saveBtn']}><CheckSquareOutlined />审核</Button>
}
content={
<div className={style['headerMain']} >
<div className={style['headerMain-left']}>
<div className={style['headerMain-left-option']}>
<div>单据摘要:</div>
<div>sssssssss</div>
</div>
<div className={style['headerMain-left-option']}>
<div>会员名称:</div>
<div>
sssssssssss
</div>
</div>
<div className={style['headerMain-left-option']}>
<div>单据时间:</div>
<div>
11111111111
</div>
</div>
<div className={style['headerMain-left-option']}>
<div>外部状态:</div>
<div>
111111111
</div>
</div>
<div className={style['headerMain-left-option']}>
<div>内部状态:</div>
<div>
1111111111
</div>
</div>
</div>
</div >
}
>
</PageHeaderWrapper>
)
}
export default detailInfo;
\ No newline at end of file
/*
* @Author: LeeJiancong
* @Date: 2020-08-24 11:39:11
* @LastEditors: LeeJiancong
* @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-09-02 15:26:14
*/
import React, { ReactNode, useRef, useState,useEffect } from 'react';
import { history } from 'umi';
import {
Button,
Card,
Space,
Row,
Col,
Dropdown,
Menu,
Popconfirm
} from 'antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import {
PlusOutlined,DownOutlined,DeleteOutlined
} from '@ant-design/icons';
import { StandardTable } from 'god';
import { ColumnType } from 'antd/lib/table/interface';
import {
IFormFilter,
IButtonFilter,
} from 'god/dist/src/standard-table/TableController';
import EyePreview from '@/components/EyePreview';
import StatusSwitch from '@/components/StatusSwitch';
import {interiorState} from '../../common/tableStatusList'
import statuStyle from '../../common/colorTag'
import NiceForm from '@/components/NiceForm';
import {timeRange} from '@/utils/index'
import moment from 'moment'
import { createFormActions, FormEffectHooks } from '@formily/antd';
import {PageStatus} from '@/hooks/usePageStatus'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { enquierySchema } from '../schema';
import { PublicApi } from '@/services/api';
import { values, action } from 'mobx';
export interface listParams{
type: number,
des?: string
}
const formActions = createFormActions();
const fetchData = async (params: any) => {
const res = await PublicApi.getOrderRequisitionFormAwaitList(params);
return res.data
}
const List:React.FC<listParams> = (props) => {
const ref = useRef<any>({})
const [more, setmore] = useState(false)
const [selectRow, setSelectRow] = useState([])
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<number>>([])
const format = (text) => {
return <>{moment(text).format("YYYY-MM-DD HH:mm:ss")}</>
}
const columns : ColumnType<any>[] = [
{
title:'需求单号',
key:'requisitionFormNo',
dataIndex:'requisitionFormNo',
align:'center'
},
{
title:'需求摘要',
key:'details',
dataIndex:'details',
align:'left'
},
{
title:'品类',
key:'category',
dataIndex:'category',
align:'left'
},
{
title:'交付日期',
key:'deliveryTime',
dataIndex:'deliveryTime',
align:'center',
render:(text:any)=> format(text)
},
{
title:'报价截至时间',
key:'quotationAsTime',
dataIndex:'quotationAsTime',
align:'center',
render:(text:any)=> format(text)
},
{
title:'单据时间',
key:'voucherTime',
dataIndex:'voucherTime',
align:'center',
render:(text:any)=> format(text)
},
{
title:'外部状态',
key:'externalState',
dataIndex:'externalState',
align:'center',
render: (text: any, reconds) => {
let component: ReactNode = null
if (text == 3) {
component = <><span style={statuStyle.warn}>审核不通过需求单</span></>
}else if (text == 1) {
component = <><span style={statuStyle.default}>待提交需求单</span></>
}
return component
}
},
{
title:'内部状态',
key:'interiorState',
dataIndex:'interiorState',
align:'center',
render:(text:any) => interiorState(text)
},
{
title:'操作',
key:'options',
dataIndex:'options',
align:'center',
render: (_: any, record: any) => {
return (
<>
<Popconfirm title="确定要审核吗?" okText="是" cancelText="否" onConfirm={() => handleSubmit(record.id)}>
<Button type='link'>审核</Button>
</Popconfirm>
</>
)
}
},
]
useEffect(()=> {
},[])
/**
* @description: 删除
* @param {type}
* @return {type}
*/
const handleDelete = (arr:number[]| string[]) => {
PublicApi.postOrderRequisitionFormDeleteAll({ ids: arr }).then(res => {
ref.current.reload()
})
}
//批量提交
const handleSubmitAll = (ids: number[]) => {
PublicApi.postOrderSubmitRequisitionFormAll({ ids: ids }).then(res => {
ref.current.reload()
})
}
//提交审核
const handleSubmit = (id) => {
PublicApi.postOrderNewRequisitionFormAudit({ id: id }).then(res => {
ref.current.reload()
})
}
const handleSumbit = (values:any) => {
if(values.voucherTime){
values.startVoucherTime = timeRange(values.voucherTime).st
values.endVoucherTime = timeRange(values.voucherTime).et
delete values.voucherTime
}
console.log('values',values)
ref.current.reload(values)
}
const menu = (
<Menu onClick={() => handleDelete(selectedRowKeys)}>
<Menu.Item key='1' icon={<DeleteOutlined/>}>
批量删除
</Menu.Item>
</Menu>
)
const handleBatchDel = (e:any) => {
}
const rowSelection = {
selectedRowKeys: selectedRowKeys,
onChange: (selectedRowKeys: any, selectedRows: any) => {
setSelectRow(selectedRows);
setSelectedRowKeys(selectedRowKeys);
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows)
},
}
const controllerBtns = <Row>
<Col span={24}>
<Space direction="horizontal" size={16}>
<Button onClick={() => handleSubmitAll(selectedRowKeys)}>批量审核通过</Button>
</Space>
</Col>
</Row>
return (
<PageHeaderWrapper>
<Card>
<StandardTable
currentRef={ref}
columns={columns}
tableProps={{rowKew:'id'}}
fetchTableData={(params: any) => fetchData(params)}
rowSelection={rowSelection}
controlRender={
<NiceForm
actions={formActions}
onSubmit={values => handleSumbit(values)}
effects={($,actions) => {
useStateFilterSearchLinkageEffect($,actions,'requisitionFormNo',FORM_FILTER_PATH)
}}
expressionScope={{
controllerBtns
}}
schema={enquierySchema}
>
</NiceForm>
}
/>
</Card>
</PageHeaderWrapper>
)
}
export default List
\ No newline at end of file
.count {
font-size: 24px;
color: #303133;
font-weight: 500;
}
.add-btn {
margin-bottom: 24px;
padding: 6px 0;
text-align: center;
background: #FAFBFC;
}
.alignCenter {
text-align: center;
}
.alignLeft {
text-align: left;
}
.hidden {
display: none;
}
.block {
display: block;
}
.selectBtn {
margin: 0 16px;
}
.filter-btn {
width: 112px;
margin: 0 0 0 16px;
}
.select {
width: 160px;
}
.select:nth-last-of-type(1) {
margin-right: 0;
}
.mainCol {
background-color: #fff;
margin-bottom: 24px;
padding: 0 24px;
box-sizing: border-box;
}
.mainCol-title {
font-size: 14px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #303133;
padding: 20px 0;
}
.mainCol:nth-last-of-type(1) {
margin: 0;
}
.mainCol-row {
display: flex;
flex-wrap: wrap;
padding-bottom: 16px;
}
.mainCol-row-col {
display: flex;
width: calc(100% / 3);
padding: 16px 0;
}
.mainCol-row-col-option {
flex: 1;
font-size: 12px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #909399;
}
.mainCol-row-col-option:nth-last-of-type(1) {
flex: 3;
padding-right: 20px;
box-sizing: border-box;
color: #303133;
}
.mainCol-rows {
display: flex;
padding-bottom: 16px;
}
.mainCol-rows-cols {
flex: 1;
}
.mainCol-rows-cols .cols-main {
display: flex;
padding: 16px 0;
}
.mainCol-rows-cols .cols-main:nth-last-of-type(1) {
padding-bottom: 0;
}
.mainCol-rows-cols .cols-main-options {
flex: 1;
font-size: 12px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #909399;
}
.mainCol-rows-cols .cols-main-options:nth-last-of-type(1) {
flex: 3;
padding-right: 20px;
box-sizing: border-box;
color: #303133;
}
@import "../../../member/components/index.less";
.count{
font-size: 24px;
color: #303133;
font-weight: 500;
}
.add-btn{
margin-bottom: 24px;
padding: 6px 0;
text-align: center;
background: #FAFBFC;
}
.alignCenter{
text-align: center;
}
.alignLeft{
text-align: left;
}
.hidden{
display: none;
}
.block{
display: block;
}
.selectBtn {
margin: 0 16px;
}
.filter-btn{
width : 112px;
margin: 0 0 0 16px;
}
.select {
width : 160px;
&:nth-last-of-type(1) {
margin-right: 0;
}
}
.mainCol {
background-color: #fff;
margin-bottom : 24px;
padding : 0 24px;
box-sizing : border-box;
&-title {
font-size : 16px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color : #303133;
padding : 20px 0;
}
&:nth-last-of-type(1) {
margin: 0;
}
&-row {
display : flex;
flex-wrap : wrap;
padding-bottom: 16px;
&-col {
display: flex;
width : calc(100% / 3);
padding: 16px 0;
&-option {
flex : 1;
font-size : 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color : #909399;
&:nth-last-of-type(1) {
flex : 3;
padding-right: 20px;
box-sizing : border-box;
color : #303133;
}
}
}
}
&-rows {
display : flex;
padding-bottom: 16px;
&-cols {
flex: 1;
.cols-main {
display: flex;
padding: 16px 0;
&:nth-last-of-type(1) {
padding-bottom: 0;
}
&-options {
flex : 1;
font-size : 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color : #909399;
&:nth-last-of-type(1) {
flex : 3;
padding-right: 20px;
box-sizing : border-box;
color : #303133;
}
}
}
}
}
}
\ No newline at end of file
/*
* @Author: LeeJiancong
* @Date: 2020-08-28 10:07:45
* @LastEditors: LeeJiancong
* @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-09-11 16:51:28
*/
import React, { Component, useState, useEffect, Fragment, ReactNode } from 'react';
import { Modal, Button, Form, Radio, AutoComplete, Tabs, Input, Select, Checkbox, message, Tooltip } from 'antd'
import { PublicApi } from '@/services/api'
import { QuestionCircleOutlined } from '@ant-design/icons';
const { TabPane } = Tabs
const { Option } = Select
const { TextArea } = Input
export interface Params {
sourceData: any,
id?: any,
mode: number,
type?: number | string,
dialogVisible: boolean;
onCancel: Function;
onOK?: Function;
initialValues?: any;
dontReceive?: boolean; //默认展示
check?: any, // 查看详情
view?: boolean
}
const layout = {
layout: 'vertical',
labelCol: {
span: 4
},
wrapperCol: {
span: 24
}
}
/**
* @description: 保存 提交表单
* @param {type}
* @return {type}
*/
const comfirmDialog: React.FC<Params> = (props) => {
const [form] = Form.useForm()
const [placeOfOriginList, setplaceOfOriginList] = useState([])//产地
const handleCancel = () => {
}
const handletOk = async () => {
try {
const value = await form.validateFields();
const judgment = props.sourceData[0].attributeList;
if(judgment.length > 0) {
if(props.view) {
props.onCancel()
} else {
props.onOK(value)
}
} else {
message.error('商品不在上述所列商品品类之内,请您联系客服!')
}
} catch(err) {
message.error('有必填项没填写请检查!')
}
}
useEffect(() => {
return () => {
}
}, [])
const onChange = (e, attrItem) => {
console.log(e.join('/'),attrItem, 10086)
}
const renderTabPanchildren = (item: any) => {
return (
<>
{
item.attributeList.map((attrItem: any) => {
const options = attrItem.attributeValueList.map((item: any) => ({
value: item.value
}))
return (
<Fragment key={attrItem.id}>
{
attrItem.type === 1 &&
<Form.Item
name={attrItem.name}
label={attrItem.name}
rules={attrItem.isEmpty && [{
required: true,
message: '此项为必填项'
}]}
>
<AutoComplete
style={{ width: 200 }}
options={options}
placeholder="选择或输入"
disabled={props.view}
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.name}
rules={attrItem.isEmpty && [{
required: true,
message: '此项为必填项'
}]}
>
<Checkbox.Group onChange={(v) => onChange(v, attrItem)} >
{
attrItem.attributeValueList.length && attrItem.attributeValueList.map((item: any, index: string) => (
<Checkbox disabled={props.view} key={item.id} value={item.value}>{item.value}</Checkbox>
))
}
</Checkbox.Group>
</Form.Item>
}
{
attrItem.type === 3 &&
<Form.Item
name={attrItem.name}
label={attrItem.name}
rules={attrItem.isEmpty && [{
required: true,
message: '此项为必填项'
}]}
>
<TextArea onBlur={(v) => onChange(v, attrItem)} maxLength={100} placeholder="最多输入100个字符" rows={4} />
</Form.Item>
}
</Fragment>
)
})
}
</>
)
}
// 查看详情渲染
useEffect(() => {
if(Object.keys(props.check).length > 0) {
form.setFieldsValue(props.check);
}
}, [props.view])
const handleTabClick = (key:any) => {
console.log(key.split('-'), '点击的key')
}
const TabPaneTitle = (item:any) => {
let component: ReactNode = null;
if(item.attributeList.length === 0) {
component = <Tooltip trigger='click' placement='right' title="如果您需要的商品不在上述所列商品品类之内,请您联系客服!">
<span style={{marginRight: '5px'}}>{item.name}</span><QuestionCircleOutlined />
</Tooltip>
}else {
component = <span>{item.name}</span>
}
return component;
}
return (
<>
<Modal
title={props.mode === 0 ? '新增商品' : '查看商品'}
width={800}
visible={props.dialogVisible}
onOk={() => handletOk()}
onCancel={() => props.onCancel()}
destroyOnClose
afterClose={() => form.resetFields()}
okText={`确定`}
cancelText='取消'
>
<Form
{...layout}
colon={false}
labelAlign="left"
form={form}
autoComplete="off"
>
<Tabs defaultActiveKey='tab1'
tabPosition="left"
onTabClick={handleTabClick}
>
<Tabs.TabPane tab='基本信息' key="tab-1">
<Form.Item
label='规格型号'
name='model'
rules={[{
required: true,
message: '此项为必填项'
}]}
>
<Input disabled={props.view} placeholder='' />
</Form.Item>
<Form.Item
label='商品品牌'
name='brand'
rules={[{
required: true,
message: '此项为必填项'
}]}
>
<Input disabled={props.view} placeholder='' />
</Form.Item>
</Tabs.TabPane>
{
/**
* @description: 动态循环
* @param {type}
* @return {type}
*/
}
{
props.sourceData.length > 0 && props.sourceData.map((attributeItem: any) => {
return (
<TabPane tab={TabPaneTitle(attributeItem)} key={attributeItem.id}>
{
renderTabPanchildren(attributeItem)
}
</TabPane>
)
})
}
<Tabs.TabPane tab='采购数量' key="tab-7">
<Form.Item
label='单位'
name='purchaseNuit'
rules={[{
required: true,
message: '此项为必填项'
}]}
>
<Input disabled={props.view} placeholder='' />
</Form.Item>
<Form.Item
label='采购数量'
name='purchaseQuantity'
rules={[{
required: true,
message: '此项为必填项'
}]}
>
<Input disabled={props.view} type='number' 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
import React from 'react';
import AuditComponents from '../../components/detail'
const EnquiryOneDetail: React.FC<{}> = () => {
return (
<AuditComponents
pagetype={1}
operation={1}
/>
);
};
export default EnquiryOneDetail;
\ No newline at end of file
import React, { Component } from 'react'
import OrderList from "../components/index"
const List = () => {
return (
<OrderList des='待审核需求单(一级)' type={1}/>
)
}
export default List
\ No newline at end of file
/*
* @Author: LeeJiancong
* @Date: 2020-08-24 11:39:11
* @LastEditors: XieZhiXiong
* @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-10-13 14:45:01
*/
/**
* @description: 组件描述: 一级 二级 待提交需求单
* @param {type}
* @return {type}
*/
import React, { ReactNode, useRef, useState, useEffect } from 'react';
import { history } from 'umi';
import {
Button,
Card,
Space,
Row,
Col,
Dropdown,
Menu,
Popconfirm
} from 'antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import {
PlusOutlined, DownOutlined, DeleteOutlined
} from '@ant-design/icons';
import { StandardTable } from 'god';
import { ColumnType } from 'antd/lib/table/interface';
import {
IFormFilter,
IButtonFilter,
} from 'god/dist/src/standard-table/TableController';
import EyePreview from '@/components/EyePreview';
import StatusSwitch from '@/components/StatusSwitch';
import { demandQuoteExternalState, demandQuoteInteriorState } from '../../common/tableStatusList'
import statuStyle from '../../common/colorTag'
import NiceForm from '@/components/NiceForm';
import { timeRange } from '@/utils/index'
import { filterInteriorStateList, filterExternalStateList } from './../../common/statusList'
import moment from 'moment'
import { createFormActions, FormEffectHooks } from '@formily/antd';
import { PageStatus } from '@/hooks/usePageStatus'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { searchSelectGetSelectCategoryOptionEffect } from '../../effect/index'
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { enquierySchema, enquierySearchSchema } from '../schema';
import { PublicApi } from '@/services/api';
import { values, action } from 'mobx';
import GeneralExternalState from '@/pages/transaction/common/externalState';
import GeneralInteriorState from '@/pages/transaction/common/interiorState';
export interface listParams {
type: number;
des?: string;
}
const formActions = createFormActions();
const List: React.FC<{ listParams }> = (props) => {
const ref = useRef<any>({})
const [more, setmore] = useState(false)
const [selectRow, setSelectRow] = useState([])
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<number>>([])
const format = (text) => {
return <>{moment(text).format("YYYY-MM-DD HH:mm:ss")}</>
}
const fetchData = (params: any) => {
return new Promise((resolve, reject) => {
PublicApi.getOrderRequisitionFormList({ ...params }).then(res => {
if (res.code === 1000) {
resolve(res.data)
}
})
})
}
/**
* @description:
* @param {type} 可以根据props.type处理
* @return {type}
*/
const handleToDetail = (id) => {
history.push(`/memberCenter/tranactionAbility/enquirySubmit/enquirySearch/preview?id=${id}`)
}
const columns: ColumnType<any>[] = [
{
title: '需求单号',
key: 'requisitionFormNo',
dataIndex: 'requisitionFormNo',
align: 'center',
render: (text: any, records: any) => <EyePreview type="button" handleClick={() => {
handleToDetail(records.id)
}}>{text}</EyePreview>
},
{
title: '需求摘要',
key: 'details',
dataIndex: 'details',
align: 'left'
},
{
title: '品类',
key: 'category',
dataIndex: 'category',
align: 'left'
},
{
title: '交付日期',
key: 'deliveryTime',
dataIndex: 'deliveryTime',
align: 'center',
render: (text: any) => format(text)
},
{
title: '报价截至时间',
key: 'quotationAsTime',
dataIndex: 'quotationAsTime',
align: 'center',
render: (text: any) => format(text)
},
{
title: '单据时间',
key: 'voucherTime',
dataIndex: 'voucherTime',
align: 'center',
render: (text: any) => format(text)
},
{
title: '外部状态',
key: 'externalState',
dataIndex: 'externalState',
render: text => <GeneralExternalState colorType={1} state={text} data={externalState} />
},
{
title: '内部状态',
key: 'interiorState',
dataIndex: 'interiorState',
render: (text: any) => <GeneralInteriorState colorType={1} state={text} data={interiorState} />
}
]
useEffect(() => {
}, [])
/**
* @description: 删除
* @param {type}
* @return {type}
*/
const handleDelete = (arr: number[] | string[]) => {
PublicApi.postOrderRequisitionFormDeleteAll({ ids: arr }).then(res => {
ref.current.reload()
})
}
//提交审核
const handleSubmit = (id) => {
PublicApi.postOrderNewRequisitionFormAudit({ id: id }).then(res => {
ref.current.reload()
})
}
const handleSumbit = (values: any) => {
if (values.voucherTime) {
values.startVoucherTime = timeRange(values.voucherTime).st
values.endVoucherTime = timeRange(values.voucherTime).et
delete values.voucherTime
}
console.log('values', values)
ref.current.reload(values)
}
const handleBatchDel = (e: any) => {
}
const rowSelection = {
selectedRowKeys: selectedRowKeys,
onChange: (selectedRowKeys: any, selectedRows: any) => {
setSelectRow(selectedRows);
setSelectedRowKeys(selectedRowKeys);
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows)
},
}
const controllerBtns = <Row>
<Col span={24}>
</Col>
</Row>
const [externalState, setExternalState] = useState<any>([]);
const [interiorState, setInteriorState] = useState<any>([]);
useEffect(() => {
const external = new Promise(resolve => {
//查询需求单外部状态枚举列表
PublicApi.getOrderRequisitionFormExternalStateEnum().then((res: any) => {
if (res.code === 1000) {
resolve(res.data)
}
})
})
const interior = new Promise(resolve => {
// 查询需求单内部状态枚举列表
PublicApi.getOrderRequisitionFormInteriorStateEnum().then((res: any) => {
if (res.code === 1000) {
resolve(res.data)
}
})
})
Promise.all([external, interior]).then(res => {
setExternalState(res[0])
setInteriorState(res[1])
})
}, [])
return (
<PageHeaderWrapper>
<Card>
<StandardTable
currentRef={ref}
columns={columns}
tableProps={{ rowKew: 'id' }}
fetchTableData={(params: any) => fetchData(params)}
// rowSelection={rowSelection}
controlRender={
<NiceForm
actions={formActions}
onSubmit={values => handleSumbit(values)}
effects={($, actions) => {
useStateFilterSearchLinkageEffect($, actions, 'requisitionFormNo', FORM_FILTER_PATH)
FormEffectHooks.onFieldChange$('category').subscribe(state => {
searchSelectGetSelectCategoryOptionEffect(actions, 'category')
})
}}
schema={enquierySearchSchema}
>
</NiceForm>
}
/>
</Card>
</PageHeaderWrapper>
)
}
export default List
\ No newline at end of file
import React from 'react';
import AuditComponents from '../../components/detail';
const EnquiryTwoDetail: React.FC<{}> = () => {
return (
<AuditComponents
pagetype={2}
operation={1}
/>
);
};
export default EnquiryTwoDetail;
\ No newline at end of file
import React, { Component } from 'react'
import OrderList from "../components/index"
const List = () => {
return (
<OrderList des='待审核需求单(二级)' type={2}/>
)
}
export default List
\ No newline at end of file
import { ISchema } from '@formily/antd'
import { FORM_FILTER_PATH } from '@/formSchema/const'
import { TimeList } from '../../common/statusList'
import TranactionRoute from 'config/routes/tranactionRoute'
import { PublicApi } from '@/services/api'
/**
* @description: 公用
* @param {type}
* @return {type}
*/
export const enquierySchema: ISchema = {
type: 'object',
properties: {
megalayout: {
type: 'object',
"x-component": 'mega-layout',
"x-component-props": {
grid: true
},
properties: {
ctl: {
type: 'object',
"x-component": "Children",
"x-component-props": {
children: "{{controllerBtns}}"
}
},
requisitionFormNo: {
type: 'string',
"x-component": "Search",
"x-mega-props": {
},
"x-component-props": {
placeholder: '搜索'
}
}
}
},
[FORM_FILTER_PATH]: {
type: 'object',
"x-component": "flex-layout",
"x-component-props": {
rowStyle: {
flexWrap: 'nowrap'
},
colStyle: {
marginLeft: 20
}
},
properties: {
PRO_LAYOUT: {
type: 'object',
"x-component": 'mega-layout',
"x-mega-props": {
span: 5
},
"x-component-props": {
inline: true
},
properties: {
details: {
type: 'string',
"x-component-props": {
placeholder: '需求摘要'
}
},
category: {
type: 'string',
"x-component": 'SearchSelect',
"x-component-props": {
placeholder: '请选择品类',
className: 'fixed-ant-selected-down', // 该类强制将显示的下拉框出现在select下, 只有这里出现问题, ??
fetchSearch: PublicApi.getProductSelectGetSelectCustomerCategory,
style: {
width: 160
}
}
},
voucherTime: {
type: 'string',
default: 0,
"x-component-props": {
placeholder: '请选择单据时间'
},
enum: TimeList
},
}
},
sumbit: {
"x-component": 'Submit',
"x-mega-props": {
span: 1
},
"x-component-props": {
children: '查询'
}
}
}
}
}
}
/**
* @description: 需求发布查询
* @param {type}
* @return {type}
*/
export const enquierySearchSchema: ISchema = {
type: 'object',
properties: {
megalayout: {
type: 'object',
"x-component": 'mega-layout',
properties: {
requisitionFormNo: {
type: 'string',
"x-component": "Search",
"x-mega-props": {
},
"x-component-props": {
placeholder: '搜索',
align: 'flex-left',
}
}
}
},
[FORM_FILTER_PATH]: {
type: 'object',
"x-component": "flex-layout",
"x-component-props": {
rowStyle: {
justifyContent: 'flex-start',
flexWrap: 'nowrap'
},
colStyle: {//改变间隔
marginRight: 20
}
},
properties: {
PRO_LAYOUT: {
type: 'object',
"x-component": 'mega-layout',
"x-mega-props": {
span: 5
},
"x-component-props": {
inline: true
},
properties: {
category: {
type: 'string',
'x-component': 'CustomInputSearch',
'x-component-props': {
placeholder: '商品品类',
showSearch: true,
showArrow: true,
defaultActiveFirstOption: false,
filterOption: false,
notFoundContent: null,
style: { width: '174px', lineHeight: '32px' },
searchValue: null,
dataoption: []
}
// "x-component-props":{
// placeholder:'请选择品类'
// },
// enum:[]
},
voucherTime: {
type: 'string',
// default: 0,
"x-component-props": {
placeholder: '请选择单据时间'
},
enum: TimeList
},
externalState:{
type:'string',
"x-component": 'Select',
"x-component-props":{
placeholder:'外部状态',
className: 'fixed-ant-selected-down', // 该类强制将显示的下拉框出现在select下, 只有这里出现问题, ??
fetchSearch: PublicApi.getOrderRequisitionFormExternalStateEnum,
style: {
width: 160
}
},
},
interiorState :{
type:'string',
"x-component": 'Select',
"x-component-props":{
placeholder:'内部状态',
className: 'fixed-ant-selected-down', // 该类强制将显示的下拉框出现在select下, 只有这里出现问题, ??
fetchSearch: PublicApi.getOrderRequisitionFormInteriorStateEnum,
style: {
width: 160
}
},
},
}
},
sumbit: {
"x-component": 'Submit',
"x-mega-props": {
span: 1
},
"x-component-props": {
children: '查询'
}
}
}
}
}
}
import React from 'react';
import AuditComponents from '../../components/detail';
const ToSubmitDetail: React.FC = () => {
return (
<AuditComponents
pagetype={3}
operation={1}
/>
);
};
export default ToSubmitDetail;
\ No newline at end of file
import React, { Component } from 'react'
import OrderList from "../components/index"
const List = () => {
return (
<OrderList des='待提交需求单' type={3}/>
)
}
export default List
\ No newline at end of file
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