Commit 004f146a authored by GuanHua's avatar GuanHua

merge

parent f574a668
import React from 'react'; import React from 'react';
import { FilePdfFilled, FileWordFilled, FileFilled } from '@ant-design/icons'; import { FilePdfFilled, FileWordFilled, FileFilled } from '@ant-design/icons';
import { PublicApi } from '@/services/api' import { PublicApi } from '@/services/api'
import styles from './index.less'; import styles from './index.less';
interface ContractItem { interface ContractItem {
electronicContractUrl?: string; electronicContractUrl?: string;
electronicContractName?: string; electronicContractName?: string;
}; };
interface ContractList { interface ContractList {
dataSource: ContractItem[]; dataSource: ContractItem[];
}; };
const IconMap = { const IconMap = {
'.pdf': <FilePdfFilled />, '.pdf': <FilePdfFilled />,
'.doc': <FileWordFilled />, '.doc': <FileWordFilled />,
'.doxc': <FileWordFilled />, '.doxc': <FileWordFilled />,
}; };
const ContractItem: React.FC<ContractItem> = ({ const ContractItem: React.FC<ContractItem> = ({
electronicContractUrl, electronicContractUrl,
electronicContractName, electronicContractName,
}) => { }) => {
const index1 = electronicContractUrl.lastIndexOf('.'); const index1 = electronicContractUrl.lastIndexOf('.');
const suffix = electronicContractUrl.slice(index1); const suffix = electronicContractUrl.slice(index1);
const index2 = electronicContractUrl.lastIndexOf('/'); const index2 = electronicContractUrl.lastIndexOf('/');
// 如果没有文件名,但是有链接就从链接截取文件名 // 如果没有文件名,但是有链接就从链接截取文件名
const fileName = electronicContractName ? electronicContractName : electronicContractUrl.slice(index2 + 1); const fileName = electronicContractName ? electronicContractName : electronicContractUrl.slice(index2 + 1);
const handleDownload = (name, url) => { const handleDownload = (name, url) => {
window.location.href = `/api/order/contractTemplate/downloadContract?contractName=${name}&contractUrl=${url}`; window.location.href = `/api/order/contractTemplate/downloadContract?contractName=${name}&contractUrl=${url}`;
}; };
return ( return (
<li className={styles['contractList-item']} onClick={() => handleDownload(fileName, electronicContractUrl)}> <li className={styles['contractList-item']} onClick={() => handleDownload(fileName, electronicContractUrl)}>
<a> <a>
<div className={styles['contractList-item-icon']}> <div className={styles['contractList-item-icon']}>
{IconMap[suffix] || <FileFilled />} {IconMap[suffix] || <FileFilled />}
</div> </div>
<div <div
className={styles['contractList-item-name']} className={styles['contractList-item-name']}
title={fileName} title={fileName}
> >
{fileName} {fileName}
</div> </div>
</a> </a>
</li> </li>
); );
}; };
const ContractList: React.FC<ContractList> = ({ dataSource }) => { const ContractList: React.FC<ContractList> = ({ dataSource }) => {
if (!Array.isArray(dataSource)) { if (!Array.isArray(dataSource)) {
return <div className={styles.noData}>没有相关数据~</div>; return <div className={styles.noData}>没有相关数据~</div>;
} }
return ( return (
<ul className={styles.contractList}> <ul className={styles.contractList}>
{dataSource.map((item, index) => ( {dataSource.map((item, index) => (
<ContractItem <ContractItem
key={index} key={index}
electronicContractUrl={item.electronicContractUrl} electronicContractUrl={item.electronicContractUrl}
electronicContractName={item.electronicContractName} electronicContractName={item.electronicContractName}
/> />
))} ))}
</ul> </ul>
); );
}; };
export default ContractList; export default ContractList;
\ No newline at end of file
.titleAvator { .titleAvator {
width:48px; width:48px;
height:48px; height:48px;
background:rgba(135,119,217,1); background:rgba(135,119,217,1);
border-radius:4px; border-radius:4px;
border:1px solid rgba(223,225,230,1); border:1px solid rgba(223,225,230,1);
line-height: 48px; line-height: 48px;
text-align: center; text-align: center;
color: #fff; color: #fff;
margin: 0 24px; margin: 0 24px;
} }
.titleAvatorText { .titleAvatorText {
color: #303133; color: #303133;
font-size: 18px; font-size: 18px;
line-height: 20px; line-height: 20px;
} }
.detailHeader { .detailHeader {
background: #fff; background: #fff;
padding: 24px; padding: 24px;
} }
.detailCol { .detailCol {
display: flex; display: flex;
margin-top: 20px; margin-top: 20px;
color: #303133; color: #303133;
} }
.colLabel { .colLabel {
color: #909399; color: #909399;
margin-right: 16px; margin-right: 16px;
} }
\ No newline at end of file
.wrapper { .wrapper {
padding: 24px; padding: 24px;
} }
\ No newline at end of file
import React from 'react' import React from 'react'
import style from './index.less' import style from './index.less'
export interface OrderDetailWrapperProps {} export interface OrderDetailWrapperProps {}
const OrderDetailWrapper:React.FC<OrderDetailWrapperProps> = (props) => { const OrderDetailWrapper:React.FC<OrderDetailWrapperProps> = (props) => {
return ( return (
<div className={style.wrapper}>{props.children}</div> <div className={style.wrapper}>{props.children}</div>
) )
} }
OrderDetailWrapper.defaultProps = {} OrderDetailWrapper.defaultProps = {}
export default OrderDetailWrapper export default OrderDetailWrapper
\ 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