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

修改需求发布,修改询价报价/商品询价

parent e74f8b48
......@@ -34,7 +34,7 @@ export const productModalByMemberSchema: ISchema = {
"x-component-props": {
placeholder: '请选择品类',
className: 'fixed-ant-selected-down', // 该类强制将显示的下拉框出现在select下, 只有这里出现问题, ??
fetchSearch: PublicApi.getProductSelectGetSelectCustomerCategory,
fetchSearch: PublicApi.getProductSelectGetMemberCategory,
style: {
width: 160
}
......@@ -45,7 +45,7 @@ export const productModalByMemberSchema: ISchema = {
"x-component": 'SearchSelect',
"x-component-props": {
placeholder: '请选择品牌',
fetchSearch: PublicApi.getProductSelectGetSelectBrand,
fetchSearch: PublicApi.getProductSelectGetMemberBrand,
style: {
width: 160
}
......
......@@ -146,11 +146,11 @@ const ModalTableOrder: React.FC<ModalTableProps> = (props) => {
})
break;
case 2:
PublicApi.getAsreplaceGoodspageToBeAddReturnByLogistics({...parmas}).then(res => {
if(res.code === 1000) {
resolve(res.data)
}
})
// PublicApi.getAsreplaceGoodspageToBeAddReturnByLogistics({...parmas}).then(res => {
// if(res.code === 1000) {
// resolve(res.data)
// }
// })
break;
case 3:
break;
......
......@@ -260,7 +260,7 @@ const detailInfo: React.FC<detailParams> = (props) => {
title: '商品名称',
key: 'name',
dataIndex: 'name',
render: (text: any, record: any) => <EyePreview type='button' handleClick={() => {setanchorvisible(true);seteditdata(record)}}>{text}</EyePreview>
render: (text: any, record: any) => <EyePreview type='button' handleClick={() => { setanchorvisible(true); seteditdata(record) }}>{text}</EyePreview>
},
{
title: '规格型号',
......@@ -292,29 +292,31 @@ const detailInfo: React.FC<detailParams> = (props) => {
const fetchData = (params?: any) => {
return new Promise(resolve => {
PublicApi.getOrderRequisitionFormProductList({id, ...params }).then(res => {
PublicApi.getOrderRequisitionFormProductList({ id, ...params }).then(res => {
if (res.code === 1000) {
const arr: any[] = []
res.data.data.forEach((item: any, index: number) => {
const productAttributeJson = JSON.parse(item.productAttributeJson);
let obj: any = {}
let newObj: any = {}
productAttributeJson.forEach((items: any) => {
obj = { ...obj, ...items }
for (let key in obj) {
newObj = {
...newObj, ...{
[key]: obj[key].join(',')
if (item.productAttributeJson) {
const productAttributeJson = JSON.parse(item.productAttributeJson);
let obj: any = {}
let newObj: any = {}
productAttributeJson.forEach((items: any) => {
obj = { ...obj, ...items }
for (let key in obj) {
newObj = {
...newObj, ...{
[key]: obj[key].join(',')
}
}
arr.push({
title: key,
key,
dataIndex: key
})
}
arr.push({
title: key,
key,
dataIndex: key
})
}
})
Object.assign(item, newObj)
})
Object.assign(item, newObj)
}
})
let attributeObj = {};
const attributeColumn = arr.reduce((item, next) => {
......@@ -520,7 +522,7 @@ const detailInfo: React.FC<detailParams> = (props) => {
{data.type === 1 &&
<Form.Item name='shopIds' noStyle wrapperCol={{ span: 24 }}>
<Checkbox.Group disabled className={style.checkbox_wrap_style}>
<Row gutter={[24,24]}>
<Row gutter={[24, 24]}>
{
goodAllIds.map((v: any, i: number) => {
return (
......
......@@ -2,7 +2,7 @@ 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 { Button, Card, Tabs, Badge } from 'antd';
import BasicInfo from './components/basicInfo';
import TradingConditions from './components/tradingConditions'
import FlowRecord from './components/flowRecord';
......@@ -11,6 +11,14 @@ import DemandDbutted from './components/demandDbutted';
import { PublicApi } from '@/services/api';
const { TabPane } = Tabs;
const TabFormErrors = (props) => {
return (
<Badge size="small" count={props.dot} offset={[6, -5]}>
{props.children}
</Badge>
)
}
const AddDemandOrder: React.FC<{}> = () => {
const { id } = history.location.query;
const [fetchdata, setfetchdata] = useState<any>({});
......@@ -18,6 +26,7 @@ const AddDemandOrder: React.FC<{}> = () => {
const [attribute, setattribute] = useState<Array<any>>([]);
const [externalState, setExternalState] = useState<any>([]);
const [interiorState, setInteriorState] = useState<any>([]);
const [badge, setbadge] = useState<any>([0, 0, 0, 0]);
useEffect(() => {
const external = new Promise(resolve => {
//查询需求单外部状态枚举列表
......@@ -64,7 +73,7 @@ const AddDemandOrder: React.FC<{}> = () => {
} else {
data.defaultAddres = 1
}
if(id) {
if (id) {
data.id = fetchdata.id;
PublicApi.postOrderRequisitionFormUpdate(data).then(res => {
if (res.code === 1000) {
......@@ -90,27 +99,40 @@ const AddDemandOrder: React.FC<{}> = () => {
resolve(res.data)
}
})
}).then((res:any) => {
}).then((res: any) => {
setfetchdata(res)
})
}
}, [id])
/**获取所有地址 */
const getAreaCode = (record:any) => {
setGoodsInfo({...goodsInfo,record})
const getAreaCode = (record: any) => {
setGoodsInfo({ ...goodsInfo, record })
}
/**获取添加的商品品类id */
const getCategoryIds = (data:any, record:any) => {
const categoryIds: Array<any>[] = []
data.forEach((item:any) => {
categoryIds.push(...item.ids)
})
setGoodsInfo({...goodsInfo, categoryIds})
setattribute([...attribute, ...record])
const getCategoryIds = (data: any, index: number, record?: any) => {
if (index === 1) {
const categoryIds: Array<any>[] = []
data.forEach((item: any) => {
categoryIds.push(...item.ids)
})
setGoodsInfo({ ...goodsInfo, categoryIds })
if (record) {
setattribute([...attribute, ...record])
}
} else if(index === 2) {
console.log(data, 10086)
}
}
/**必填没填写出现角标 */
const getError = (num: number, idx: number) => {
const data = [...badge];
data[idx] = num;
setbadge(data);
}
console.log(goodsInfo, 10086)
return (
<PageHeaderWrapper
onBack={() => history.goBack()}
......@@ -121,31 +143,35 @@ const AddDemandOrder: React.FC<{}> = () => {
>
<Card>
<Tabs type='card'>
<TabPane forceRender tab='基本信息' key='1'>
<TabPane forceRender tab={<TabFormErrors dot={badge[0]}>基本信息</TabFormErrors>} key='1'>
<BasicInfo
set={fetchdata}
onBadge={getError}
onGet={getAreaCode}
currentRef={basic}
externalState={externalState}
interiorState={interiorState}
/>
</TabPane>
<TabPane forceRender tab='添加商品' key='2'>
<TabPane forceRender tab={<TabFormErrors dot={badge[1]}>添加商品</TabFormErrors>} key='2'>
<AddGoods
set={fetchdata}
onBadge={getError}
onGet={getCategoryIds}
currentRef={goods}
/>
</TabPane>
<TabPane forceRender tab='交易条件' key='3'>
<TabPane forceRender tab={<TabFormErrors dot={badge[2]}>交易条件</TabFormErrors>} key='3'>
<TradingConditions
set={fetchdata}
onBadge={getError}
currentRef={trading}
/>
</TabPane>
<TabPane forceRender tab='需求对接' key='4'>
<TabPane forceRender tab={<TabFormErrors dot={badge[3]}>需求对接</TabFormErrors>} key='4'>
<DemandDbutted
set={fetchdata}
onBadge={getError}
goodsInfo={goodsInfo}
attribute={attribute}
currentRef={dbutted}
......
......@@ -151,6 +151,7 @@ const ModalAnchor: React.FC<anchorParams> = (props) => {
visible={visible}
onCancel={() => onCancel()}
onOk={onSubmit}
footer={props.disable && null}
>
<Layout>
<Sider width={159} className={style.site_layout_background}>
......
......@@ -30,6 +30,7 @@ const ModalGoods: React.FC<goodsParams> = (props) => {
const [loading, setloading] = useState(false);
const [files, setFiles] = useState([]);
const [category, setcategory] = useState<Array<any>>([]);
const [selected, setselected] = useState<string>('')
const [rowSelection, RowCtl] = useRowSelectionTable({ customKey: 'id', type: 'radio' });
const [visibleChannelGoods, setvisibleChannelGoods] = useState<boolean>(false);
const [goods, setGoods] = useState<any>({})
......@@ -42,6 +43,7 @@ const ModalGoods: React.FC<goodsParams> = (props) => {
}
})
}).then((data: any) => {
console.log(data)
setcategory(data)
})
}
......@@ -57,10 +59,12 @@ const ModalGoods: React.FC<goodsParams> = (props) => {
code: fetchdata.goodsNo
}
PublicApi.getProductGoodsGetGoodsList({ ...params }).then(res => {
const { data } = res
RowCtl.setSelectRow(data.data)
RowCtl.setSelectedRowKeys([data.data[0].id])
PublicApi.getProductGoodsGetGoodsList({ ...params }).then((res: any) => {
const { data } = res.data
if (data.length > 0) {
RowCtl.setSelectRow(data)
RowCtl.setSelectedRowKeys([data[0].id])
}
})
form.setFieldsValue({
model: fetchdata.model,
......@@ -68,7 +72,7 @@ const ModalGoods: React.FC<goodsParams> = (props) => {
unit: fetchdata.unit,
purchaseCount: fetchdata.purchaseCount,
name: fetchdata.name,
category: fetchdata.category,
category: fetchdata.ids,
goodsNo: fetchdata.goodsNo,
})
}
......@@ -76,13 +80,17 @@ const ModalGoods: React.FC<goodsParams> = (props) => {
/**提交表单 */
const onSubmit = (value: any) => {
form.validateFields().then(res => {
console.log(rowSelection, RowCtl, 10086)
const data = {
...res,
goodsId: goods.id,
goodsName: goods.name
goodsNo: goods.code,
name: goods.name,
category: selected,
ids: res.category,
brand: res.brand,
model: res.model,
purchaseCount: res.purchaseCount,
unit: res.unit
}
onOk(res, goods)
onOk(data)
}).catch(error => {
console.log(error)
})
......@@ -108,13 +116,13 @@ const ModalGoods: React.FC<goodsParams> = (props) => {
title: '品类',
key: 'customerCategory',
dataIndex: 'customerCategory',
render: (text: any) => <span>{Object.keys(text).length > 0 && text.name}</span>
render: (text: any) => <span>{(text && Object.keys(text).length > 0) && text.name}</span>
},
{
title: '品牌',
key: 'brand',
dataIndex: 'brand',
render: (text: any) => <span>{Object.keys(text).length > 0 && text.name}</span>
render: (text: any) => <span>{(text && Object.keys(text).length > 0) && text.name}</span>
},
{
title: '单位',
......@@ -145,14 +153,23 @@ const ModalGoods: React.FC<goodsParams> = (props) => {
name: data.name,
model: data.type,
category: ids.join(',').split(','),
brand: data.brand.name,
brand: data.brand && data.brand.name,
unit: data.unitName,
})
}
/**查询品类信息--包括品类、属性、属性值 */
const getCategoryById = (val: any, selectedOptions?: any) => {
if (selectedOptions.length > 0) {
const name = selectedOptions[selectedOptions.length - 1];
setselected(name.title)
}
}
return (
<>
<Modal
title='通过平台属性添加'
title='选择货品添加'
width='800px'
destroyOnClose
wrapClassName={style.modal_wrap_className}
......@@ -194,6 +211,7 @@ const ModalGoods: React.FC<goodsParams> = (props) => {
fieldNames={{ label: 'title', value: 'id', children: 'children' }}
placeholder="请选择品类"
notFoundContent={<Spin size="small" />}
onChange={getCategoryById}
/>
</Form.Item>
<Form.Item label='货品品牌' name='brand'><Input /></Form.Item>
......
......@@ -16,10 +16,11 @@ const layout: any = {
export interface faceSetData {
set?: any,
onGet?: Function,
currentRef: any
currentRef: any,
onBadge?: Function
}
const AddGoods: React.FC<faceSetData> = (props) => {
const { set, currentRef, onGet } = props
const { set, currentRef, onGet, onBadge } = props
const [form] = Form.useForm();
const [addMode, setaddMode] = useState<number>(0);
const btnname: Array<string> = ['添加商品', '选择货品', '导入货品']
......@@ -71,7 +72,7 @@ const AddGoods: React.FC<faceSetData> = (props) => {
render: (text: any, record: any, index: number) =>
<>
<Button type='link' onClick={() => handleEdit(record, index)}>编辑</Button>
<Button type='link'>删除</Button>
<Button type='link' onClick={() => handleDel(record, index)}>删除</Button>
</>
}
]
......@@ -99,13 +100,15 @@ const AddGoods: React.FC<faceSetData> = (props) => {
const handleSubmit = (data: any, record?: any) => {
if (idx === -1) {
settabledata([...tabledata, data])
onGet([...tabledata, data], 1, record)
} else {
console.log(data)
const newdata = [...tabledata]
newdata[idx] = data
settabledata([...newdata]);
setidx(-1);
onGet([...tabledata, data], 2)
}
onGet([...tabledata, data], record)
handleModal(addMode);
}
/** 编辑商品 */
......@@ -116,6 +119,13 @@ const AddGoods: React.FC<faceSetData> = (props) => {
handleModal(addMode)
}
/** 删除商品 */
const handleDel = (record: any, index: number) => {
const list = [...tabledata];
list.splice(index, 1);
settabledata(list)
}
useEffect(() => {
currentRef.current = {
get: () => new Promise((resolve: any) => {
......@@ -128,8 +138,11 @@ const AddGoods: React.FC<faceSetData> = (props) => {
requisitionFormProducts: tabledata,
}
})
onBadge(0, 1)
}).catch(error => {
console.log(error)
if (error && error.errorFields) {
onBadge(error.errorFields.length, 1)
}
})
})
}
......@@ -161,7 +174,7 @@ const AddGoods: React.FC<faceSetData> = (props) => {
{addMode > 0 &&
<Form.Item noStyle>
<Button onClick={() => { handleModal(addMode); setisEdit(false) }} type='dashed' block style={{ marginBottom: '24px' }}><PlusOutlined />{handleText(addMode)}</Button>
<Table columns={columns} dataSource={tabledata} rowKey={(record:any, index:number) => record.id ? record.id : index} />
<Table columns={columns} dataSource={tabledata} rowKey={(record: any, index: number) => record.id ? record.id : index} />
</Form.Item>
}
<ModalAnchor
......
......@@ -19,13 +19,14 @@ export interface faceSetData {
onGet?: Function,
currentRef?: any,
externalState?:any,
interiorState?: any
interiorState?: any,
onBadge?: Function
}
const { Option } = Select;
const BasicInfo: React.FC<faceSetData> = (props) => {
const [form] = Form.useForm();
const { set, onGet, currentRef, externalState, interiorState } = props
const { set, onGet, currentRef, externalState, interiorState, onBadge } = props
const [province, setprovince] = useState<any>([]);// 省列表
const [city, setcity] = useState<any>([]);// 市列表
const [requisitionFormAddress, setrequisitionFormAddress] = useState<any>([{
......@@ -184,8 +185,11 @@ const BasicInfo: React.FC<faceSetData> = (props) => {
requisitionFormAddress,
}
})
onBadge(0, 0)
}).catch(error => {
console.log(error)
if (error && error.errorFields) {
onBadge(error.errorFields.length, 0)
}
})
})
}
......
......@@ -21,10 +21,11 @@ export interface faceSetData {
get?: Function,
goodsInfo?: any,
attribute?:any,
currentRef?: any
currentRef?: any,
onBadge?: Function
}
const DemandDbutted: React.FC<faceSetData> = (props) => {
const { set, get, currentRef, goodsInfo, attribute } = props;
const { set, get, currentRef, goodsInfo, attribute, onBadge } = props;
const [form] = Form.useForm();
const [type, setType] = useState<Number>(0);
const ref = useRef<any>({});
......@@ -199,8 +200,11 @@ const DemandDbutted: React.FC<faceSetData> = (props) => {
...buttedObj
}
})
onBadge(0, 3)
}).catch(error => {
console.log(error)
if (error && error.errorFields) {
onBadge(error.errorFields.length, 3)
}
})
})
}
......
......@@ -12,10 +12,11 @@ const layout: any = {
export interface faceSetData {
set?: any,
get?: Function,
currentRef?: any
currentRef?: any,
onBadge?: Function
}
const TradingConditions: React.FC<faceSetData> = (props) => {
const { set, get, currentRef } = props
const { set, get, currentRef,onBadge } = props
const [TradingConditionsForm] = Form.useForm();
const [address, setAddress] = useState([]);
const [selectAddress, setselectAddress] = useState<any>({});
......@@ -48,8 +49,11 @@ const TradingConditions: React.FC<faceSetData> = (props) => {
taxes: res.taxes,
}
})
onBadge(0, 2)
}).catch(error => {
console.log(error)
if (error && error.errorFields) {
onBadge(error.errorFields.length, 2)
}
})
})
}
......@@ -135,4 +139,4 @@ const TradingConditions: React.FC<faceSetData> = (props) => {
)
}
export default TradingConditions
\ No newline at end of file
export default TradingConditions
......@@ -4,8 +4,8 @@ import {TimeList, filterExternalStateLabelList, filterInternalStateLabelList} fr
import { PublicApi } from '@/services/api';
/**
* @description: 待审核询价单
* @param {type}
* @return {type}
* @param {type}
* @return {type}
*/
export const pendingReviewSchema: ISchema = {
type:'object',
......@@ -78,36 +78,36 @@ export const pendingReviewSchema: ISchema = {
},
enum: TimeList
},
externalState:{
type:'string',
"x-component": 'Select',
"x-component-props":{
placeholder:'外部状态',
className: 'fixed-ant-selected-down', // 该类强制将显示的下拉框出现在select下, 只有这里出现问题, ??
fetchSearch: PublicApi.getOrderProductInquiryExternalStateEnum,
style: {
width: 160
}
},
},
interiorState :{
type:'string',
"x-component": 'Select',
"x-component-props":{
placeholder:'内部状态',
className: 'fixed-ant-selected-down', // 该类强制将显示的下拉框出现在select下, 只有这里出现问题, ??
fetchSearch: PublicApi.getOrderProductInquiryInteriorStateEnum,
style: {
width: 160
}
},
},
// externalState:{
// type:'string',
// "x-component": 'Select',
// "x-component-props":{
// placeholder:'外部状态',
// className: 'fixed-ant-selected-down', // 该类强制将显示的下拉框出现在select下, 只有这里出现问题, ??
// fetchSearch: PublicApi.getOrderProductInquiryExternalStateEnum,
// style: {
// width: 160
// }
// },
// },
// interiorState :{
// type:'string',
// "x-component": 'Select',
// "x-component-props":{
// placeholder:'内部状态',
// className: 'fixed-ant-selected-down', // 该类强制将显示的下拉框出现在select下, 只有这里出现问题, ??
// fetchSearch: PublicApi.getOrderProductInquiryInteriorStateEnum,
// style: {
// width: 160
// }
// },
// },
}
},
sumbit:{
"x-component":'Submit',
"x-mega-props":{
span:1
span:1
},
"x-component-props":{
children:'查询'
......
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