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

🐞 fix: 修复采购询价bug

parent c49d7c42
...@@ -121,8 +121,8 @@ const ModalTable:React.FC<ModalTableProps> = (props) => { ...@@ -121,8 +121,8 @@ const ModalTable:React.FC<ModalTableProps> = (props) => {
tableType='small' tableType='small'
currentRef={selfRef} currentRef={selfRef}
formRender={(child, ps) => <Row justify='space-between' style={{marginBottom: 16}}> formRender={(child, ps) => <Row justify='space-between' style={{marginBottom: 16}}>
<Col span={18} style={{ zIndex: 99 }}>{child}</Col> <Col span={22} style={{ zIndex: 99 }}>{child}</Col>
<Col style={{ marginTop: 4 }}>{ps}</Col> <Col span={2} style={{ marginTop: 4 }}>{ps}</Col>
</Row >} </Row >}
formilyProps={ formilyProps={
modalType === 'none' ? null : { modalType === 'none' ? null : {
......
...@@ -133,7 +133,7 @@ const TableModal: React.FC<Iprops> = (props: Iprops) => { ...@@ -133,7 +133,7 @@ const TableModal: React.FC<Iprops> = (props: Iprops) => {
onClose={handleOnClose} onClose={handleOnClose}
onCancel={handleOnClose} onCancel={handleOnClose}
// onOk={handleOk} // onOk={handleOk}
width={840} width={900}
{...otherProps} {...otherProps}
> >
<StandardTable <StandardTable
...@@ -142,6 +142,7 @@ const TableModal: React.FC<Iprops> = (props: Iprops) => { ...@@ -142,6 +142,7 @@ const TableModal: React.FC<Iprops> = (props: Iprops) => {
...tableProps, ...tableProps,
pagination: false pagination: false
}} }}
tableType="small"
fetchTableData={fetchData} fetchTableData={fetchData}
currentRef={ref} currentRef={ref}
rowSelection={{ rowSelection={{
...@@ -151,7 +152,7 @@ const TableModal: React.FC<Iprops> = (props: Iprops) => { ...@@ -151,7 +152,7 @@ const TableModal: React.FC<Iprops> = (props: Iprops) => {
hideSelectAll: customizeRadio, hideSelectAll: customizeRadio,
}} }}
formRender={(child, ps) => <Row justify='space-between' style={{ marginBottom: 16 }}> formRender={(child, ps) => <Row justify='space-between' style={{ marginBottom: 16 }}>
<Col style={{ zIndex: 99 }}>{child}</Col> <Col span={18} style={{ zIndex: 99 }}>{child}</Col>
<Col style={{ marginTop: 4 }}>{ps}</Col> <Col style={{ marginTop: 4 }}>{ps}</Col>
</Row >} </Row >}
controlRender={ controlRender={
......
...@@ -203,6 +203,7 @@ export default AddQuotes ...@@ -203,6 +203,7 @@ export default AddQuotes
// const [form] = Form.useForm(); // const [form] = Form.useForm();
// const [unsaved, setUnsaved] = useState<boolean>(false); // const [unsaved, setUnsaved] = useState<boolean>(false);
// const [dataSource, setDataSource] = useState({}); // const [dataSource, setDataSource] = useState({});
// const [productQuote, setProductQuote] = useState([])
// useEffect(() => { // useEffect(() => {
// if (id && !spam) { // if (id && !spam) {
...@@ -213,6 +214,7 @@ export default AddQuotes ...@@ -213,6 +214,7 @@ export default AddQuotes
// return // return
// } // }
// setDataSource(res.data); // setDataSource(res.data);
// setProductQuote(res.data.inquiryListProductRequests)
// form.setFieldsValue({ // form.setFieldsValue({
// ...res.data, // ...res.data,
// }) // })
...@@ -242,8 +244,8 @@ export default AddQuotes ...@@ -242,8 +244,8 @@ export default AddQuotes
// } // }
// }} // }}
// > // >
// <BasicInfoLayout /> // <BasicInfoLayout isEdit={spam} />
// <ProductQuoteLayout /> // <ProductQuoteLayout setProductQuote={productQuote} />
// <OtherExplainLayout /> // <OtherExplainLayout />
// <AttachLayout /> // <AttachLayout />
// </Form> // </Form>
......
...@@ -194,10 +194,12 @@ export default BasicInfo ...@@ -194,10 +194,12 @@ export default BasicInfo
// import { FORM_FILTER_PATH } from '@/formSchema/const'; // import { FORM_FILTER_PATH } from '@/formSchema/const';
// import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'; // import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
// interface BasicInfoLayoutProps { // interface BasicInfoLayoutProps {
// /** 是否可修改 */
// isEdit?: boolean,
// } // }
// const BasicInfoLayout: React.FC<BasicInfoLayoutProps> = () => { // const BasicInfoLayout: React.FC<BasicInfoLayoutProps> = (props: any) => {
// const { isEdit } = props;
// const context = useContext(Context); // const context = useContext(Context);
// const format = (text, fmt?: string) => { // const format = (text, fmt?: string) => {
// return <>{moment(text).format(fmt || "YYYY-MM-DD HH:mm:ss")}</> // return <>{moment(text).format(fmt || "YYYY-MM-DD HH:mm:ss")}</>
...@@ -260,7 +262,7 @@ export default BasicInfo ...@@ -260,7 +262,7 @@ export default BasicInfo
// <Input /> // <Input />
// </Form.Item> // </Form.Item>
// <Form.Item label="对应询价单号" name='inquiryListNo' rules={[{ required: true, message: '请选择对应询价单号' }]}> // <Form.Item label="对应询价单号" name='inquiryListNo' rules={[{ required: true, message: '请选择对应询价单号' }]}>
// <Input.Search readOnly onSearch={() => toggle(true)} enterButton={<Button style={{ height: '31.19px' }} icon={<LinkOutlined />}>选择</Button>} /> // <Input.Search readOnly onSearch={() => toggle(true)} enterButton={<Button disabled={isEdit} style={{ height: '31.19px' }} icon={<LinkOutlined />}>选择</Button>} />
// </Form.Item> // </Form.Item>
// </Col> // </Col>
// <Col span={12} className={style.searchColor}> // <Col span={12} className={style.searchColor}>
...@@ -330,7 +332,7 @@ export default BasicInfo ...@@ -330,7 +332,7 @@ export default BasicInfo
// span: 5 // span: 5
// }, // },
// "x-component-props": { // "x-component-props": {
// inline: true // inline: true,
// }, // },
// properties: { // properties: {
// memberName: { // memberName: {
......
import React, { useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Form, Button, Table, InputNumber, Image } from 'antd'; import { Form, Button, Table, Input, Image } from 'antd';
import { LinkOutlined } from '@ant-design/icons';
import { ColumnType } from 'antd/lib/table/interface'; import { ColumnType } from 'antd/lib/table/interface';
import Card from '@/pages/transaction/components/card'; import Card from '@/pages/transaction/components/card';
import { isEmpty } from '@/components/NiceForm/components/AntUpload/shared';
interface ProductQuoteLayoutProps { interface ProductQuoteLayoutProps {
/** 回显 */
setProductQuote?: any[],
} }
const ProductQuoteLayout: React.FC<ProductQuoteLayoutProps> = () => { const ProductQuoteLayout: React.FC<ProductQuoteLayoutProps> = (props: any) => {
const [dataSource, setDataSource] = useState<any[]>([]) const { setProductQuote } = props;
const [dataSource, setDataSource] = useState<any[]>([]);
const count = (num: any, price: any) => {
let money: any = null;
money = (Number(price) * 1) / Number(num);
return Number(money).toFixed(2);
}
const handleChange = (id, e) => {
const { value } = e.target
dataSource.forEach(v => {
if (v.productId === id) {
v.price = value
v.money = count(v.purchaseCount, value);
}
})
setDataSource([...dataSource]);
}
const columns: ColumnType<any>[] = [ const columns: ColumnType<any>[] = [
{ {
title: "商品ID", title: "商品ID",
...@@ -41,20 +58,21 @@ const ProductQuoteLayout: React.FC<ProductQuoteLayoutProps> = () => { ...@@ -41,20 +58,21 @@ const ProductQuoteLayout: React.FC<ProductQuoteLayoutProps> = () => {
title: "采购数量/单位", title: "采购数量/单位",
key: "purchaseCount", key: "purchaseCount",
dataIndex: "purchaseCount", dataIndex: "purchaseCount",
render: (text: any, record: any) => <>{`${text}/${record.unit}`}</>
}, },
{ {
title: "含税/税率",
key: "",
dataIndex: ""
},
{
title: "报价单价", title: "报价单价",
key: "price", key: "price",
dataIndex: "price", dataIndex: "price",
render: (text, _data, index) => ( width: 150,
<Form.Item initialValue={text} name={`purchaseCount${index}`} rules={[{ required: true, message: '请输入采购数量' }]} style={{ marginBottom: '0px' }}> render: (text, record, index) => (
<InputNumber min={1} /> <Form.Item initialValue={record.price} name={`purchaseCount${index}`} rules={[{ required: true, message: '请输入采购数量' }]} style={{ marginBottom: '0px' }}>
<Input
onBlur={(e) => handleChange(record.productId, e)}
addonBefore="¥"
min={1}
type="number" />
</Form.Item> </Form.Item>
) )
...@@ -64,16 +82,23 @@ const ProductQuoteLayout: React.FC<ProductQuoteLayoutProps> = () => { ...@@ -64,16 +82,23 @@ const ProductQuoteLayout: React.FC<ProductQuoteLayoutProps> = () => {
key: "money", key: "money",
dataIndex: "money" dataIndex: "money"
}, },
{ // {
title: "操作", // title: "操作",
key: "operate", // key: "operate",
dataIndex: "operate", // dataIndex: "operate",
render: (_text, _data, index) => ( // render: (_text, _data, index) => (
<Button type="link">历史报价</Button> // <Button type="link">历史报价</Button>
) // )
}, // },
] ]
useEffect(() => {
if (!isEmpty(setProductQuote)) {
console.log(setProductQuote)
setDataSource([...setProductQuote])
}
}, [setProductQuote])
return ( return (
<Card <Card
id="productQuoteLayout" id="productQuoteLayout"
......
...@@ -75,7 +75,7 @@ const TradingConditions: React.FC<queryProps> = (props) => { ...@@ -75,7 +75,7 @@ const TradingConditions: React.FC<queryProps> = (props) => {
<Row gutter={70}> <Row gutter={70}>
<Col span={12}> <Col span={12}>
<Form.Item label='最小起订' name='minimumOrder' rules={[{ required: true, message: '请输入最小起订' }]}> <Form.Item label='最小起订' name='minimumOrder' rules={[{ required: true, message: '请输入最小起订' }]}>
<InputNumber min={1} placeholder='请输入数量' /> <InputNumber style={{ width: '100%' }} min={1} placeholder='请输入数量' />
</Form.Item> </Form.Item>
<Form.Item label='交付说明' name='deliveryInstructions'> <Form.Item label='交付说明' name='deliveryInstructions'>
<Input.TextArea placeholder='最长100个字符,50个汉字' /> <Input.TextArea placeholder='最长100个字符,50个汉字' />
......
...@@ -67,7 +67,6 @@ const ContrastLyout1: React.FC<IProps> = (props: any) => { ...@@ -67,7 +67,6 @@ const ContrastLyout1: React.FC<IProps> = (props: any) => {
const [encrypt, setEncrypt] = useState<number>(0); const [encrypt, setEncrypt] = useState<number>(0);
/** 当前数据的第0条 */ /** 当前数据的第0条 */
const [idx, setIdx] = useState<number>(0); const [idx, setIdx] = useState<number>(0);
/** 报价轮次 */ /** 报价轮次 */
const handleTurn = (num: number) => { const handleTurn = (num: number) => {
let isTurn: Array<number> = []; let isTurn: Array<number> = [];
...@@ -84,7 +83,6 @@ const ContrastLyout1: React.FC<IProps> = (props: any) => { ...@@ -84,7 +83,6 @@ const ContrastLyout1: React.FC<IProps> = (props: any) => {
/** 格式化数据 */ /** 格式化数据 */
const formatting = (data: any, index: number) => { const formatting = (data: any, index: number) => {
console.log(index, 10086)
const arr: any = data[0].awardInfoResponses.sort((a, b) => { return a.goodsId - b.goodsId }) || [] const arr: any = data[0].awardInfoResponses.sort((a, b) => { return a.goodsId - b.goodsId }) || []
const params: any = []; const params: any = [];
arr.forEach((i: any, index: number) => { arr.forEach((i: any, index: number) => {
...@@ -131,7 +129,7 @@ const ContrastLyout1: React.FC<IProps> = (props: any) => { ...@@ -131,7 +129,7 @@ const ContrastLyout1: React.FC<IProps> = (props: any) => {
const dataSoure = { ...soure } const dataSoure = { ...soure }
dataSoure[index] = [...params] dataSoure[index] = [...params]
setSoure(dataSoure); setSoure(dataSoure);
if (preview) { if (preview || isEdit) {
redux(params) redux(params)
} }
} }
...@@ -173,7 +171,6 @@ const ContrastLyout1: React.FC<IProps> = (props: any) => { ...@@ -173,7 +171,6 @@ const ContrastLyout1: React.FC<IProps> = (props: any) => {
* i: 当前tab 下标 * i: 当前tab 下标
*/ */
const fetchTableData = async (t: string, i?: number) => { const fetchTableData = async (t: string, i?: number) => {
console.log(i)
const params = { const params = {
id, id,
turn: t, turn: t,
...@@ -284,7 +281,7 @@ const ContrastLyout1: React.FC<IProps> = (props: any) => { ...@@ -284,7 +281,7 @@ const ContrastLyout1: React.FC<IProps> = (props: any) => {
data-index={index} data-index={index}
tab={`第${chNum[item]}轮`} tab={`第${chNum[item]}轮`}
> >
{(rowSource[idx] && rowSource[idx].length > 0 ) ? <RowLayout encrypt={encrypt} rowSource={rowSource[idx]} /> : {(rowSource[idx] && rowSource[idx].length > 0 ) ? <RowLayout priceContrast={context.priceContrast} encrypt={encrypt} rowSource={rowSource[idx]} /> :
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} /> <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
} }
<Skeleton <Skeleton
......
...@@ -9,13 +9,18 @@ export interface IProps { ...@@ -9,13 +9,18 @@ export interface IProps {
rowSource?: any, rowSource?: any,
/** 是否加密 */ /** 是否加密 */
encrypt?: number, encrypt?: number,
/** 比价方式 */
priceContrast?: number,
} }
const RowLayout: React.FC<IProps> = (props: any) => { const RowLayout: React.FC<IProps> = (props: any) => {
const { rowSource, encrypt } = props; const { rowSource, encrypt, priceContrast } = props;
const format = (text, fmt?: string) => { const format = (text, fmt?: string) => {
return <>{moment(text).format(fmt || "YYYY-MM-DD HH:mm:ss")}</> return <>{moment(text).format(fmt || "YYYY-MM-DD HH:mm:ss")}</>
} }
console.log(priceContrast, 123)
return ( return (
<Fragment> <Fragment>
<div className={style.divider}><Divider type='vertical' className={style.vertical} />供应商信息</div> <div className={style.divider}><Divider type='vertical' className={style.vertical} />供应商信息</div>
...@@ -64,7 +69,7 @@ const RowLayout: React.FC<IProps> = (props: any) => { ...@@ -64,7 +69,7 @@ const RowLayout: React.FC<IProps> = (props: any) => {
</Row> </Row>
</div> </div>
<div className={style['card-badge']}> <div className={style['card-badge']}>
{item.isDecrypt === PRICECONTRAST_TYPE.UNENCRYPTED ? (encrypt === 1 ? '未加密' : '已解密') : '未解密'} {item.isDecrypt === PRICECONTRAST_TYPE.UNENCRYPTED ? (priceContrast === 1 ? '已解密' : '未加密') : '未解密'}
</div> </div>
{item.isDecrypt === PRICECONTRAST_TYPE.UNENCRYPTED && <Typography.Link href={`/memberCenter/procurementAbility/confirmOffer/quote/detail?id=${item.id}&number=${item.quotedPriceNo}&turn=${item.turn}`} className={style['card-link']}>查看报价详情</Typography.Link>} {item.isDecrypt === PRICECONTRAST_TYPE.UNENCRYPTED && <Typography.Link href={`/memberCenter/procurementAbility/confirmOffer/quote/detail?id=${item.id}&number=${item.quotedPriceNo}&turn=${item.turn}`} className={style['card-link']}>查看报价详情</Typography.Link>}
{item.isDecrypt === PRICECONTRAST_TYPE.UNDECRYPTED && <Tooltip placement="topLeft" title='当前报价为密封报价,请先解密报价单'><Typography.Text className={style['card-link']} type='success'>查看报价详情</Typography.Text></Tooltip>} {item.isDecrypt === PRICECONTRAST_TYPE.UNDECRYPTED && <Tooltip placement="topLeft" title='当前报价为密封报价,请先解密报价单'><Typography.Text className={style['card-link']} type='success'>查看报价详情</Typography.Text></Tooltip>}
......
...@@ -2,7 +2,7 @@ import React, { useEffect } from 'react'; ...@@ -2,7 +2,7 @@ import React, { useEffect } from 'react';
import { Modal } from 'antd'; import { Modal } from 'antd';
import { import {
SchemaForm, SchemaMarkupField as Field, SchemaForm, SchemaMarkupField as Field,
createFormActions, createAsyncFormActions ,
FormEffectHooks, FormEffectHooks,
} from '@formily/antd' } from '@formily/antd'
import { Input, Radio, DatePicker, Checkbox } from '@formily/antd-components' import { Input, Radio, DatePicker, Checkbox } from '@formily/antd-components'
...@@ -11,7 +11,7 @@ import moment from 'moment'; ...@@ -11,7 +11,7 @@ import moment from 'moment';
import styles from './index.less'; import styles from './index.less';
import { isEmpty } from 'lodash'; import { isEmpty } from 'lodash';
const actions = createFormActions() const actions = createAsyncFormActions ()
const { onFieldChange$ } = FormEffectHooks; const { onFieldChange$ } = FormEffectHooks;
export interface IProps { export interface IProps {
...@@ -40,7 +40,7 @@ const ModalOperate: React.FC<IProps> = (props: any) => { ...@@ -40,7 +40,7 @@ const ModalOperate: React.FC<IProps> = (props: any) => {
} = props; } = props;
const useFormEffects = () => { const useFormEffects = () => {
const { setFieldState } = createFormActions() const { setFieldState } = createAsyncFormActions ()
if (modalType === 'audit') { if (modalType === 'audit') {
onFieldChange$('state').subscribe(({ value }) => { onFieldChange$('state').subscribe(({ value }) => {
setFieldState('auditOpinion', state => { setFieldState('auditOpinion', state => {
......
...@@ -140,7 +140,7 @@ const DemandDetailed = () => { ...@@ -140,7 +140,7 @@ const DemandDetailed = () => {
} }
const fetchDataSource = async () => { const fetchDataSource = async () => {
let shopList = GlobalConfig.web.shopInfo.filter(v => v.type == 1).map( let shopList = GlobalConfig.web.shopInfo.filter(v => v.type == 6).map(
v => v v => v
) )
const params = { const params = {
......
...@@ -130,7 +130,8 @@ const AddForm = () => { ...@@ -130,7 +130,8 @@ const AddForm = () => {
params.memberRoleId = memberRoleId; params.memberRoleId = memberRoleId;
await PublicApi.postPurchaseQuotedPriceAdd({...params}).then(res => { await PublicApi.postPurchaseQuotedPriceAdd({...params}).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
history.goBack() // history.goBack()
history.push(`/memberCenter/procurementAbility/offter/addOffter`)
} else { } else {
setLoading(false); setLoading(false);
} }
......
...@@ -130,7 +130,6 @@ const OfferInfo: React.FC<IProps> = (props: any) => { ...@@ -130,7 +130,6 @@ const OfferInfo: React.FC<IProps> = (props: any) => {
rules={[{ required: true, message: '请选择' }]} rules={[{ required: true, message: '请选择' }]}
> >
<Select <Select
defaultValue={1}
style={{ width: 100 }} style={{ width: 100 }}
onChange={(e) => handleEdit(e, 'isTax', index)} onChange={(e) => handleEdit(e, 'isTax', index)}
disabled={fetchdata && (count !== tabs[0])} disabled={fetchdata && (count !== tabs[0])}
...@@ -222,7 +221,7 @@ const OfferInfo: React.FC<IProps> = (props: any) => { ...@@ -222,7 +221,7 @@ const OfferInfo: React.FC<IProps> = (props: any) => {
const setFieldsValueFn = (params: any) => { const setFieldsValueFn = (params: any) => {
params.forEach((it: any, i: number) => { params.forEach((it: any, i: number) => {
form.setFieldsValue({ form.setFieldsValue({
['isTax' + i]: it.isTax, ['isTax' + i]: it.isTax ? it.isTax : 1,
['taxProbability' + i]: it.taxProbability, ['taxProbability' + i]: it.taxProbability,
['taxUnitPrice' + i]: it.taxUnitPrice ['taxUnitPrice' + i]: it.taxUnitPrice
}) })
...@@ -243,14 +242,13 @@ const OfferInfo: React.FC<IProps> = (props: any) => { ...@@ -243,14 +242,13 @@ const OfferInfo: React.FC<IProps> = (props: any) => {
return return
} }
if (res.data.data.length > 0) { if (res.data.data.length > 0) {
console.log(1)
param[index] = [...res.data.data]; param[index] = [...res.data.data];
if (param[index]) { if (param[index]) {
setFieldsValueFn(param[index]) setFieldsValueFn(param[index])
} }
} else { } else {
console.log(2)
param[index] = fetchdata.materiels; param[index] = fetchdata.materiels;
setFieldsValueFn(param[index])
} }
setData({ ...param }); setData({ ...param });
}) })
......
...@@ -282,7 +282,7 @@ const CrossSellProducts: React.FC<IProps> = (props: any) => { ...@@ -282,7 +282,7 @@ const CrossSellProducts: React.FC<IProps> = (props: any) => {
</> </>
)} )}
{!preview && ( {!preview && (
<Button onClick={() => { setFlag(true); setProductId(product.productId); console.log(product) }} block type="dashed" style={{ margin: '16px 0px' }}> <Button onClick={() => { setFlag(true); setProductId(product.id); console.log(product) }} block type="dashed" style={{ margin: '16px 0px' }}>
<PlusSquareOutlined /> <PlusSquareOutlined />
选择商品 选择商品
</Button> </Button>
......
...@@ -15,7 +15,7 @@ import { searchSelectGetSelectCategoryOptionEffect } from '@/pages/transaction/e ...@@ -15,7 +15,7 @@ import { searchSelectGetSelectCategoryOptionEffect } from '@/pages/transaction/e
import { import {
OfferProductSchema, OfferProductSchema,
} from '../../../schema'; } from '../../../schema';
import { ISchema} from '@formily/antd'; import { ISchema } from '@formily/antd';
const formActions = createFormActions(); const formActions = createFormActions();
...@@ -57,7 +57,7 @@ const SelectProduct: React.FC<Iprops> = (props: any) => { ...@@ -57,7 +57,7 @@ const SelectProduct: React.FC<Iprops> = (props: any) => {
const data = { const data = {
environment: 1, environment: 1,
shopType: 1, shopType: 1,
// priceTypeList: [2] priceTypeList: [1, 2]
} }
PublicApi.getProductCommodityCommonGetCommodityListBySeller({ ...params, ...data }).then(res => { PublicApi.getProductCommodityCommonGetCommodityListBySeller({ ...params, ...data }).then(res => {
resolve(res.data) resolve(res.data)
...@@ -159,11 +159,12 @@ const SelectProduct: React.FC<Iprops> = (props: any) => { ...@@ -159,11 +159,12 @@ const SelectProduct: React.FC<Iprops> = (props: any) => {
} }
useEffect(() => { useEffect(() => {
console.log(id) if (id) {
if (!!id) {
RowCtl.setSelectedRowKeys([id]); RowCtl.setSelectedRowKeys([id]);
} else {
RowCtl.setSelectedRowKeys([]);
} }
}, [id]) }, [visible])
return ( return (
<Drawer <Drawer
......
...@@ -230,7 +230,7 @@ const SearchDetail = () => { ...@@ -230,7 +230,7 @@ const SearchDetail = () => {
} }
const fetchDataSource = async () => { const fetchDataSource = async () => {
let shopList = GlobalConfig.web.shopInfo.filter(v => v.type == 1).map( let shopList = GlobalConfig.web.shopInfo.filter(v => v.type == 6).map(
v => v v => v
) )
const params = { const params = {
...@@ -291,7 +291,7 @@ const SearchDetail = () => { ...@@ -291,7 +291,7 @@ const SearchDetail = () => {
}else{ }else{
return null return null
} }
case 'readyExamineOne': case 'readyExamineOne':
case 'readyExamineTwo': case 'readyExamineTwo':
case 'readyExamineSignUp': case 'readyExamineSignUp':
......
...@@ -186,7 +186,7 @@ const Demand: React.FC<Iprops> = (props: any) => { ...@@ -186,7 +186,7 @@ const Demand: React.FC<Iprops> = (props: any) => {
} }
useEffect(() => { useEffect(() => {
let shopList = GlobalConfig.web.shopInfo.filter(v => v.type == 1).map( let shopList = GlobalConfig.web.shopInfo.filter(v => v.type == 6).map(
v => v v => v
) )
setStoreList(shopList) setStoreList(shopList)
...@@ -231,7 +231,7 @@ const Demand: React.FC<Iprops> = (props: any) => { ...@@ -231,7 +231,7 @@ const Demand: React.FC<Iprops> = (props: any) => {
type: fetchdata.type type: fetchdata.type
}) })
if (fetchdata.type === 1) { if (fetchdata.type === 1) {
let shopList = GlobalConfig.web.shopInfo.filter(v => v.type == 1).map( let shopList = GlobalConfig.web.shopInfo.filter(v => v.type == 6).map(
v => v v => v
) )
setStoreList(shopList) setStoreList(shopList)
......
...@@ -38,49 +38,23 @@ const Material: React.FC<Iprops> = (props: any) => { ...@@ -38,49 +38,23 @@ const Material: React.FC<Iprops> = (props: any) => {
const [form] = Form.useForm(); const [form] = Form.useForm();
const { currentRef, fetchdata, onBadge } = props; const { currentRef, fetchdata, onBadge } = props;
/** 表单表头 */ /** 表单表头 */
const [flag, setFlag] = useState<boolean>(false) const [flag, setFlag] = useState<boolean>(false);
const [edit, setEdit] = useState<any>({});
const [dataSource, setDataSource] = useState<any>([]) const [dataSource, setDataSource] = useState<any>([])
const [category, setcategory] = useState([]);
/**查询品类树 */
const searchCategoryTree = (id: any) => {
return new Promise(resolve => {
PublicApi.getProductPlatformGetCategoryTree({ rootNodeId: id }).then(res => {
if (res.code === 1000) {
resolve(res.data)
}
})
}).then((data: any) => {
console.log(data)
setcategory(data)
})
}
/** 修改列表表单 */
const handleEdit = (e: any, name: string, index: number, flag?: boolean) => {
const params = [...dataSource];
Object.keys(params[index]).map(key => {
if (key === name) {
if (flag) {
params[index][key] = e
} else {
params[index][key] = e.target.value
}
}
})
setDataSource(params)
}
/** 修改品类 */
const handleEditCategory = (e: any, value: any, index: number) => {
const params = [...dataSource];
params[index].ids = e;
params[index].category = value[value.length - 1].title;
setDataSource(params);
}
/** 删除列表 */ /** 删除列表 */
const handleRemove = (index: number) => { const handleRemove = (index: number) => {
const data = [...dataSource]; const data = [...dataSource];
data.splice(index, 1); data.splice(index, 1);
setDataSource(data) setDataSource(data)
} }
/** 编辑列表 */
const handleEdit = (data) => {
setEdit(data);
setFlag(true)
}
const columns: ColumnType<Object>[] = [ const columns: ColumnType<Object>[] = [
{ {
title: '物料编号', title: '物料编号',
...@@ -91,118 +65,41 @@ const Material: React.FC<Iprops> = (props: any) => { ...@@ -91,118 +65,41 @@ const Material: React.FC<Iprops> = (props: any) => {
title: '物料名称', title: '物料名称',
key: 'name', key: 'name',
dataIndex: 'name', dataIndex: 'name',
render: (text: any, record: any, index: number) => (
<Form.Item
style={{ margin: 0 }}
name={`name_${index + 1}`}
initialValue={text}
rules={[{ required: true, message: '请输入' }]}
>
<Input onChange={(e) => handleEdit(e, 'name', index)} />
</Form.Item>
)
}, },
{ {
title: '规格型号', title: '规格型号',
key: 'model', key: 'model',
dataIndex: 'model', dataIndex: 'model',
render: (text: any, record: any, index: number) => (
<Form.Item
style={{ margin: 0 }}
name={`model_${index + 1}`}
initialValue={text}
rules={[{ required: true, message: '请输入' }]}
>
<Input onChange={(e) => handleEdit(e, 'model', index)} />
</Form.Item>
)
}, },
{ {
title: '品类', title: '品类',
key: 'category', key: 'category',
dataIndex: 'category', dataIndex: 'category',
render: (text: any, record: any, index: number) => (
<>
{Array.isArray(record.ids) ? (
<Form.Item
style={{ margin: 0 }}
name={`category_${index + 1}`}
initialValue={record.ids}
rules={[{ required: true, message: '请输入' }]}
>
<Cascader
options={category}
onChange={(e, value) => handleEditCategory(e, value, index)}
fieldNames={{ label: 'title', value: 'id', children: 'children' }}
placeholder="请选择品类"
allowClear={false}
notFoundContent={<Spin size="small" />}
/>
</Form.Item>
) : (
<Form.Item
style={{ margin: 0 }}
name={`category_${index + 1}`}
initialValue={text}
rules={[{ required: true, message: '请输入' }]}
>
<Input onChange={(e) => handleEdit(e, 'category', index)} />
</Form.Item>
)}
</>
),
}, },
{ {
title: '品牌', title: '品牌',
key: 'brand', key: 'brand',
dataIndex: 'brand', dataIndex: 'brand',
render: (text: any, record: any, index: number) => (
<Form.Item
style={{ margin: 0 }}
name={`brand_${index + 1}`}
initialValue={text}
>
<Input onChange={(e) => handleEdit(e, 'brand', index)} />
</Form.Item>
)
}, },
{ {
title: '单位', title: '单位',
key: 'unit', key: 'unit',
dataIndex: 'unit', dataIndex: 'unit',
render: (text: any, record: any, index: number) => (
<Form.Item
style={{ margin: 0 }}
name={`unit_${index + 1}`}
initialValue={text}
rules={[{ required: true, message: '请输入' }]}
>
<Input onChange={(e) => handleEdit(e, 'unit', index)} />
</Form.Item>
)
}, },
{ {
title: '采购数量', title: '采购数量',
key: 'purchaseCount', key: 'purchaseCount',
dataIndex: 'purchaseCount', dataIndex: 'purchaseCount',
render: (text: any, record: any, index: number) => (
<Form.Item
style={{ margin: 0 }}
name={`purchaseCount_${index + 1}`}
initialValue={text}
rules={[{ required: true, message: '请输入' }]}
>
<InputNumber onChange={(e) => handleEdit(e, 'purchaseCount', index, true)} />
</Form.Item>
)
}, },
{ {
title: '操作', title: '操作',
key: 'operate', key: 'operate',
dataIndex: 'operate', dataIndex: 'operate',
render: (text: any, record: any, index: number) => ( render: (_text: any, record: any, index: number) => (
<Button onClick={() => handleRemove(index)} type='link'>删除</Button> <>
<Button type='link' onClick={() => handleEdit(record) }>编辑</Button>
<Button onClick={() => handleRemove(index)} type='link'>删除</Button>
</>
) )
} }
] ]
...@@ -231,9 +128,7 @@ const Material: React.FC<Iprops> = (props: any) => { ...@@ -231,9 +128,7 @@ const Material: React.FC<Iprops> = (props: any) => {
setDataSource([...dataSource, ...data]); setDataSource([...dataSource, ...data]);
} }
} }
useEffect(() => {
searchCategoryTree('0');
}, [])
useEffect(() => { useEffect(() => {
currentRef.current = { currentRef.current = {
get: () => new Promise((resolve: any) => { get: () => new Promise((resolve: any) => {
...@@ -280,7 +175,7 @@ const Material: React.FC<Iprops> = (props: any) => { ...@@ -280,7 +175,7 @@ const Material: React.FC<Iprops> = (props: any) => {
> >
<Radio.Group onChange={checkRadio}> <Radio.Group onChange={checkRadio}>
<Radio value={1}>选择货品添加</Radio> <Radio value={1}>选择货品添加</Radio>
<Radio value={2}>导入货品生成</Radio> {/* <Radio value={2}>导入货品生成</Radio> */}
</Radio.Group> </Radio.Group>
</Form.Item> </Form.Item>
{materielMode >= 1 {materielMode >= 1
...@@ -307,6 +202,7 @@ const Material: React.FC<Iprops> = (props: any) => { ...@@ -307,6 +202,7 @@ const Material: React.FC<Iprops> = (props: any) => {
{materielMode === 1 {materielMode === 1
&& ( && (
<DrawerWrite <DrawerWrite
edit={edit}
flag={flag} flag={flag}
onClose={() => setFlag(false)} onClose={() => setFlag(false)}
onConfirm={fetchTableList} onConfirm={fetchTableList}
......
...@@ -19,6 +19,7 @@ import { UPLOAD_TYPE } from '@/constants' ...@@ -19,6 +19,7 @@ import { UPLOAD_TYPE } from '@/constants'
import { DeleteOutlined, LinkOutlined, UploadOutlined } from '@ant-design/icons'; import { DeleteOutlined, LinkOutlined, UploadOutlined } from '@ant-design/icons';
import SelectProduct from './selectProduct'; import SelectProduct from './selectProduct';
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
import { isEmpty } from 'lodash';
const layout: any = { const layout: any = {
colon: false, colon: false,
...@@ -31,6 +32,8 @@ interface Iprops { ...@@ -31,6 +32,8 @@ interface Iprops {
flag: boolean, flag: boolean,
onClose: () => void, onClose: () => void,
onConfirm?(e: any), onConfirm?(e: any),
/** 编辑的数据 */
edit?: any,
} }
const DrawerWrite: React.FC<Iprops> = (props: any) => { const DrawerWrite: React.FC<Iprops> = (props: any) => {
...@@ -38,6 +41,7 @@ const DrawerWrite: React.FC<Iprops> = (props: any) => { ...@@ -38,6 +41,7 @@ const DrawerWrite: React.FC<Iprops> = (props: any) => {
flag, flag,
onClose, onClose,
onConfirm, onConfirm,
edit
} = props; } = props;
const [form] = Form.useForm(); const [form] = Form.useForm();
const [visible, setVisile] = useState<boolean>(false) const [visible, setVisile] = useState<boolean>(false)
...@@ -153,11 +157,23 @@ const DrawerWrite: React.FC<Iprops> = (props: any) => { ...@@ -153,11 +157,23 @@ const DrawerWrite: React.FC<Iprops> = (props: any) => {
setFiles(arr); setFiles(arr);
} }
useEffect(() => { useEffect(() => {
form.resetFields(); form.resetFields();
searchCategoryTree('0'); searchCategoryTree('0');
}, [flag]) if (!isEmpty(edit)) {
form.setFieldsValue({
number: edit.number,
name: edit.name,
model: edit.model,
brand: edit.brand,
unit: edit.unit,
ids: edit.ids,
purchaseCount: edit.purchaseCount,
})
setFiles(edit.urls)
}
}, [flag]);
return ( return (
<> <>
<Drawer <Drawer
...@@ -238,6 +254,7 @@ const DrawerWrite: React.FC<Iprops> = (props: any) => { ...@@ -238,6 +254,7 @@ const DrawerWrite: React.FC<Iprops> = (props: any) => {
rules={[{ required: true, message: '请输入货号' }]} rules={[{ required: true, message: '请输入货号' }]}
> >
<Input.Search <Input.Search
readOnly
enterButton={<><LinkOutlined /> 选择</>} enterButton={<><LinkOutlined /> 选择</>}
onSearch={() => setVisile(true)} onSearch={() => setVisile(true)}
/> />
...@@ -247,14 +264,14 @@ const DrawerWrite: React.FC<Iprops> = (props: any) => { ...@@ -247,14 +264,14 @@ const DrawerWrite: React.FC<Iprops> = (props: any) => {
name='name' name='name'
rules={[{ required: true, message: '请输入货品名称' }]} rules={[{ required: true, message: '请输入货品名称' }]}
> >
<Input /> <Input disabled />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label='规格型号' label='规格型号'
name='model' name='model'
rules={[{ required: true, message: '请输入规格型号' }]} rules={[{ required: true, message: '请输入规格型号' }]}
> >
<Input /> <Input disabled />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label='品类' label='品类'
...@@ -262,6 +279,7 @@ const DrawerWrite: React.FC<Iprops> = (props: any) => { ...@@ -262,6 +279,7 @@ const DrawerWrite: React.FC<Iprops> = (props: any) => {
rules={[{ required: true, message: '请选择品类' }]} rules={[{ required: true, message: '请选择品类' }]}
> >
<Cascader <Cascader
disabled
options={category} options={category}
fieldNames={{ label: 'title', value: 'id', children: 'children' }} fieldNames={{ label: 'title', value: 'id', children: 'children' }}
placeholder="请选择品类" placeholder="请选择品类"
...@@ -305,7 +323,7 @@ const DrawerWrite: React.FC<Iprops> = (props: any) => { ...@@ -305,7 +323,7 @@ const DrawerWrite: React.FC<Iprops> = (props: any) => {
name='unit' name='unit'
rules={[{ required: true, message: '请选择单位' }]} rules={[{ required: true, message: '请选择单位' }]}
> >
<Input /> <Input disabled />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label='采购数量' label='采购数量'
......
...@@ -143,7 +143,7 @@ const DemandDetailed = () => { ...@@ -143,7 +143,7 @@ const DemandDetailed = () => {
} }
const fetchDataSource = async () => { const fetchDataSource = async () => {
let shopList = GlobalConfig.web.shopInfo.filter(v => v.type == 1).map( let shopList = GlobalConfig.web.shopInfo.filter(v => v.type == 6).map(
v => v v => v
) )
const params = { const params = {
......
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