Commit 8e2b9501 authored by 前端-彭佳文's avatar 前端-彭佳文

Merge branch 'v2-0418-xxx' into 'v2-220418'

请购单新曾 See merge request linkseeks-design/pro-platform!113
parents 07056c1a 26470cad
......@@ -8,13 +8,15 @@ import BillDetailSection from '../components/billDetailSection';
import { useIntl } from 'umi';
const OrderPreview: React.FC = () => {
const { formContext } = useBillDetail({type: 'requestBill'})
const { formContext } = useBillDetail({ type: 'requestBill' })
const intl = useIntl()
const anchorTitleList = [
{ title: intl.formatMessage({ id: 'purchaseRequisition.liuzhuanjindu', defaultMessage: '流转进度' }), id: 'transferProcess', componentName: "TransferProcess" },
{ title: intl.formatMessage({ id: 'purchaseRequisition.jibenxinxi', defaultMessage: '基本信息' }), id: 'baseicInfo', type: "basicInfo" },
{ title: '送货/交期信息', id: 'BillDelivery', type: "BillDelivery", componentName: "BillDelivery" },
{ title: intl.formatMessage({ id: 'purchaseRequisition.qinggouwuliao', defaultMessage: '请购物料' }), id: 'billMaterial', componentName: "BillMaterial" },
{ title: intl.formatMessage({ id: 'purchaseRequisition.liuzhuanjilu', defaultMessage: '流转记录' }), id: 'transferRecord', componentName: "TransformRecord" },
{ title: "附件", id: 'BilEnclosure', componentName: "BilEnclosure" },
]
return (
......
.cardWrap {
:global {
.ant-radio-button-wrapper:hover {
color: #606266;
}
.ant-radio-group-solid .ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled) {
color: #fff;
background: #6B778C;
border-color: #6B778C;
}
.ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled)::before {
background-color: #6B778C;
}
}
}
import React, { useContext, useEffect, useState } from 'react'
import { Table, Radio } from 'antd'
import { formatTimeString } from '@/utils'
import MellowCard from '@/components/MellowCard'
import { TransferEnum } from '../transferProcess';
import style from './index.less'
import { BillDetailContext } from '@/pages/transaction/_public/bill/effects/context';
import { useIntl } from 'umi';
/**
* 附件
*/
export interface BidTransformRecordProps {
cardTitle?: string;
}
const BilEnclosure: React.FC<BidTransformRecordProps> = ({ cardTitle }) => {
const { data } = useContext(BillDetailContext)
const intl = useIntl()
const { attachments = [] } = data
console.log(attachments)
const outReocrdCols: any[] = [
{
title: "文件",
dataIndex: 'name',
align: 'left',
key: 'name',
},
{
title: "关联物料",
dataIndex: 'goodsName',
align: 'left',
key: 'goodsName',
},
]
return (
<MellowCard
title={cardTitle}
style={{ marginTop: 24 }}
bordered={false}
className={style.cardWrap}
>
<Table
columns={outReocrdCols}
dataSource={attachments}
pagination={{ size: "small" }}
rowKey="id"
/>
</MellowCard>
)
}
BilEnclosure.defaultProps = {}
export default BilEnclosure
.card-list {
font-size: 12px;
line-height: 20px;
margin-top: 24px;
}
.card-list_title {
font-size: 12px;
color: #909399;
}
.resultFail {
font-size: 16px;
font-weight: 500;
color: #303133;
}
.resultFailSubtitle {
font-size: 12px;
font-weight: 400;
color: #303133;
padding-left: 32px;
}
.thankModal{
:global{
.ant-modal-header {
display: none;
}
.ant-modal-content {
height: 440px;
background: url("/static/imgs/thankLetterBg.png") center center no-repeat;
// background: url('../../../../assets/imgs/thankLetterBg.png') center center no-repeat;
}
.ant-modal-footer {
display: none;
}
}
}
.thankLetter {
// width: 660px;
// height: 440px;
h2 {
text-align: center;
font-size: 24px;
font-weight: 500;
color: #303133;
// height: 36px;
// line-height: 36px;
padding-top: 20px;
}
h4 {
text-align: center;
font-size: 16px;
font-weight: 500;
color: #C0C4CC;
line-height: 16px;
padding: 0 24px;
}
p {
font-size: 14px;
font-weight: 400;
color: #303133;
line-height: 24px;
padding: 0 24px;
}
.name {
font-weight: 500;
text-align: left;
padding: 0 24px;
}
.company {
text-align: right;
padding: 0 24px;
margin-top: 100px;
}
.time {
text-align: right;
padding: 0 24px;
}
}
import React, { useContext } from 'react'
import { Row, Col } from 'antd'
import MellowCard from '@/components/MellowCard'
import style from './index.less'
import { BillDetailContext } from '@/pages/transaction/_public/bill/effects/context';
import { useIntl } from 'umi';
/**
* 描述信息列表
*/
export interface BasicInfoProps {
/**
* title标题
*/
cardTitle?: string;
/** 显示信息类型
* 'BillDelivery' 送货时间
*/
type?: 'BillDelivery';
styles?: React.CSSProperties,
}
const BillDelivery: React.FC<BasicInfoProps> = ({ cardTitle, type, styles }) => {
const bidDetailContext = useContext(BillDetailContext)
const { data: _data } = bidDetailContext
console.log(_data, 'typetypetypetype')
const intl = useIntl()
// 送货时间
const basicColumnList = [
{
span: 8,
fieldList: [
{ title: "预交日期:", name: 'deliverTime' },
{ title: "送货地址:", name: 'deliveryAddressId' },
]
},
{
span: 8,
fieldList: [
{ title: "配送方式:", name: 'deliveryMethodName' },
]
}
]
/** 类型数据映射 */
const Type_Data_Map = {
'BillDelivery': basicColumnList,
}
const RenderBasicInfoColumns = ({ infoList = [], dataSource }) => <Row>
{
infoList.map(({ span, fieldList = [] }, index) => (<Col key={index} span={span}>
{
fieldList.length ? fieldList.map((_v, _i) => <Row key={_v.name} className={style['card-list']} style={_v.rowStyle}>
{_v?.noTitle ? null : <Col span={6} className={style['card-list_title']}>{_v.title}</Col>}
<Col><p style={{ paddingRight: 20 }}>{_v.render ? _v.render(dataSource[_v.name], dataSource) : dataSource[_v.name]}</p></Col>
</Row>) : null
}
</Col>))
}
</Row>
return (
<MellowCard
title={cardTitle}
style={{ marginTop: 24, ...styles }}
bordered={false}
fullHeight
>
<RenderBasicInfoColumns infoList={Type_Data_Map[type]} dataSource={_data} />
</MellowCard>)
}
BillDelivery.defaultProps = {}
export default BillDelivery
......@@ -4,7 +4,9 @@ import DescriptionsInfo from '../descriptionsInfo'
import BillMaterial from '../billMaterial'
import TransferProcess from '../transferProcess'
import TransformRecord from '../transferRecord'
import BillDelivery from '../billDelivery'
import AuditProcess from '@/components/AuditProcess'
import BilEnclosure from '../bilEnclosure'
export interface anchorItemProps {
title: string,
......@@ -19,7 +21,7 @@ export interface BillDetailSectionProps {
anchorList?: anchorItemProps[],
}
const BillDetailSection:React.FC<BillDetailSectionProps> = ({
const BillDetailSection: React.FC<BillDetailSectionProps> = ({
formContext,
anchorList = [],
}) => {
......@@ -30,6 +32,8 @@ const BillDetailSection:React.FC<BillDetailSectionProps> = ({
"TransferProcess": TransferProcess,
// 信息 基本信息组件
"DescriptionsInfo": DescriptionsInfo,
// 送货时间
'BillDelivery': BillDelivery,
// 请购物料组件
"BillMaterial": BillMaterial,
// 流转记录组件
......@@ -37,9 +41,9 @@ const BillDetailSection:React.FC<BillDetailSectionProps> = ({
}
const RenderDetailSection = ({ componentList }) => {
if(componentList && componentList.length > 0) {
if (componentList && componentList.length > 0) {
return componentList.map((item, index) => (
<div key={index} id={item['id']}>{ RenderCertainContent(item) }</div>
<div key={index} id={item['id']}>{RenderCertainContent(item)}</div>
))
} else {
return null
......@@ -48,7 +52,7 @@ const BillDetailSection:React.FC<BillDetailSectionProps> = ({
const RenderCertainContent = ({ title, type = null, componentName = null, styles }) => {
let RcDom: any = null;
switch(componentName) {
switch (componentName) {
case 'TransferProcess':
RcDom = (<AuditProcess
customTitleKey='stepName'
......@@ -80,6 +84,12 @@ const BillDetailSection:React.FC<BillDetailSectionProps> = ({
case "TransformRecord":
RcDom = (<TransformRecord cardTitle={title} />)
break;
case "BillDelivery":
RcDom = (<BillDelivery cardTitle={title} type={type} />)
break;
case "BilEnclosure":
RcDom = (<BilEnclosure cardTitle={title} />)
break;
default:
RcDom = (<DescriptionsInfo cardTitle={title} type={type} styles={styles} />)
}
......@@ -88,9 +98,9 @@ const BillDetailSection:React.FC<BillDetailSectionProps> = ({
return (
formContext.data &&
<div className={[style.anchorContentWrap, "anchorContent"].join(' ')}>
<RenderDetailSection componentList={anchorList} />
</div>
<div className={[style.anchorContentWrap, "anchorContent"].join(' ')}>
<RenderDetailSection componentList={anchorList} />
</div>
)
}
......
......@@ -119,6 +119,9 @@ const IncreaseRequisition: React.FC<{}> = () => {
const _params = procurementProcessField(params)
console.log(_params)
if (_params.deliveryAddressId) {
_params.deliveryAddressId = _params.deliveryAddressId.id;
}
if (id) {
fnResult = await postPurchaseRequisitionUpdate({ ..._params, id })
} else {
......@@ -163,9 +166,9 @@ const IncreaseRequisition: React.FC<{}> = () => {
formContext,
}
const [dataSource, setdataSource] = useState<any>([]);
// 上传附件表格
const enclosureColumns = [
const [enclosureColumns, setenclosureColumns] = useState<any>([
{
title: '文件',
key: 'name',
......@@ -175,35 +178,82 @@ const IncreaseRequisition: React.FC<{}> = () => {
title: '关联物料',
key: 'goodsName',
dataIndex: 'goodsName',
render: (text, record) => {
return (
<Select defaultValue="全部" style={{ width: 230 }} >
<Option value="0">全部</Option>
<Option value="1">图片</Option>
<Option value="2">视频</Option>
<Option value="3">文件</Option>
</Select>
)
}
},
{
title: '操作',
}
]
]);
// 删除关联物流
const del = (record) => {
const newData = [...addSchemaAction.getFieldValue('attachments')]
// 删除formvalue
const colIndex = newData.findIndex(v => v.id === record.id)
newData.splice(colIndex, 1)
addSchemaAction.setFieldValue('attachments', newData)
}
const handleFirstChange = (value: number, index: number) => {
const newData = [...addSchemaAction.getFieldValue('attachments')]
newData[index].goodsName = value;
addSchemaAction.setFieldValue('attachments', newData)
console.log(value, index);
}
// 上传
const handleFrontUrl = async ({ fileList }) => {
if (fileList[0].response) {
if (fileList[0].response.code === 1000) {
const data = [...dataSource];
data.push({
const newData = [...addSchemaAction.getFieldValue('attachments')]
newData.push({
name: fileList[0].name,
url: fileList[0].url,
index: dataSource.length + 1
url: fileList[0].response.data,
index: newData.length + 1
})
addSchemaAction.setFieldValue('attachments', newData)
const list = addSchemaAction.getFieldValue('products');
const arr = list.map((item: any) => {
return { label: item.name, value: item.id }
})
setdataSource(data);
addSchemaAction.setFieldValue('productsList', data)
const Colist = [
{
title: '文件',
key: 'name',
dataIndex: 'name',
},
{
title: '关联物料',
key: 'goodsName',
dataIndex: 'goodsName',
render: (text, record, index) => {
return (
<Select style={{ width: 230 }} onChange={(value) => handleFirstChange(value, index)}>
{
arr.map((item: any) => {
return (
<Option value={item.label} key={item.value}>{item.label}</Option>
)
})
}
</Select>
)
}
},
{
title: '操作',
render: (text, record) => {
return (
<Button type='link' onClick={() => del(record)} >{intl.formatMessage({ id: 'purchaseRequisition.shanchu', defaultMessage: '删除' })}</Button>
)
}
}
]
console.log(Colist)
setenclosureColumns([...Colist])
}
}
}
const fetchOptions = (service) => {
console.log(service, 'service')
return async function () {
......@@ -233,7 +283,6 @@ const IncreaseRequisition: React.FC<{}> = () => {
beforeUpload={beforeDocUpload}
onChange={handleFrontUrl}
accept='.doc,.docx,.pdf'
maxCount={1}
style={{ width: '100%' }}
>
<Button style={{ width: '100%' }} >
......
......@@ -153,7 +153,8 @@ const delivery: ISchema = {
columns: 2,
},
properties: {
deliverTime: {
// deliverTime
advanceDeliveryDate: {
type: 'string',
"x-component": 'date',
title: getIntl().formatMessage({ id: 'purchaseRequisition.yujiaoriqi', defaultMessage: '预交日期' }),
......@@ -172,16 +173,16 @@ const delivery: ISchema = {
type: 'string',
title: "配送方式",
enum: [],
"x-rules": [
{
required: true,
message: getIntl().formatMessage({ id: 'purchaseRequisition.qingshuruqinggou', defaultMessage: '请输入配送方式' })
},
{
limitByte: true,
maxByte: 100
}
],
// "x-rules": [
// {
// required: true,
// message: getIntl().formatMessage({ id: 'purchaseRequisition.qingshuruqinggou', defaultMessage: '请输入配送方式' })
// },
// {
// limitByte: true,
// maxByte: 100
// }
// ],
"x-mega-props": {
span: 1
}
......@@ -191,7 +192,6 @@ const delivery: ISchema = {
visible:false,
type: 'string',
title: '送货地址',
required: true,
'x-component': 'CustomAddressSelect',
'x-component-props': {
isDefaultAddress: true,
......@@ -204,16 +204,16 @@ const delivery: ISchema = {
// visible:false,
type: 'string',
title: "送货地址",
"x-rules": [
{
required: true,
message:"请输入送货地址"
},
{
limitByte: true,
maxByte: 100
}
],
// "x-rules": [
// {
// required: true,
// message:"请输入送货地址"
// },
// {
// limitByte: true,
// maxByte: 100
// }
// ],
"x-mega-props": {
span: 1
}
......@@ -262,10 +262,9 @@ const enclosure: ISchema = {
id: 'enclosure',
},
properties: {
productsList: {
attachments: {
type: 'array',
"x-component": 'MultTable',
required: true,
"x-component-props": {
rowKey: 'id',
columns: "{{enclosureColumns}}",
......
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