Commit 54d97bbc authored by 前端-黄佳鑫's avatar 前端-黄佳鑫
parents 49bd3c0f c3e0c079
...@@ -17,6 +17,7 @@ import { GlobalConfig } from '@/global/config'; ...@@ -17,6 +17,7 @@ import { GlobalConfig } from '@/global/config';
import LRU from '@/utils/lru'; import LRU from '@/utils/lru';
const recent = new LRU(6); const recent = new LRU(6);
recent.init();
setup() setup()
// 与用户登录相关路由 // 与用户登录相关路由
......
...@@ -32,7 +32,7 @@ const columns = [ ...@@ -32,7 +32,7 @@ const columns = [
{title: '收货批次', dataIndex: 'batch'}, {title: '收货批次', dataIndex: 'batch'},
{title: '收货时间', dataIndex: 'receiveTime'}, {title: '收货时间', dataIndex: 'receiveTime'},
{title: '收货数量', dataIndex: 'receiveTime'}, {title: '收货数量', dataIndex: 'receiveTime'},
{title: '加工单价', dataIndex: 'processPrice'}, // {title: '加工单价', dataIndex: 'processPrice'},
{title: '结算金额', dataIndex: 'settlementAmount'}, {title: '结算金额', dataIndex: 'settlementAmount'},
] ]
......
...@@ -32,7 +32,7 @@ const columns = [ ...@@ -32,7 +32,7 @@ const columns = [
{title: '收货批次', dataIndex: 'batch'}, {title: '收货批次', dataIndex: 'batch'},
{title: '收货时间', dataIndex: 'receiveTime'}, {title: '收货时间', dataIndex: 'receiveTime'},
{title: '收货数量', dataIndex: 'receiveTime'}, {title: '收货数量', dataIndex: 'receiveTime'},
{title: '加工单价', dataIndex: 'processPrice'}, // {title: '加工单价', dataIndex: 'processPrice'},
{title: '结算金额', dataIndex: 'settlementAmount'}, {title: '结算金额', dataIndex: 'settlementAmount'},
] ]
......
import React, { useState, useCallback, useEffect } from 'react'; import React, { useState, useCallback, useEffect } from 'react';
import { PageHeaderWrapper } from '@ant-design/pro-layout'; import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { SaveOutlined } from '@ant-design/icons'; import { SaveOutlined } from '@ant-design/icons';
import { Button, Card, Select, DatePicker, Radio, Table, Space } from 'antd'; import { Button, Card, Select, DatePicker, Radio, Table, Space, message } from 'antd';
import { history } from 'umi'; import { history } from 'umi';
import ReutrnEle from '@/components/ReturnEle'; import ReutrnEle from '@/components/ReturnEle';
import { createFormActions, FormEffectHooks } from '@formily/antd'; import { createFormActions, FormEffectHooks } from '@formily/antd';
...@@ -274,9 +274,17 @@ const Add: React.FC<{}> = () => { ...@@ -274,9 +274,17 @@ const Add: React.FC<{}> = () => {
...rest ...rest
} = values; } = values;
const deliveryDateFormat = deliveryDate.unix() * 1000; const deliveryDateFormat = deliveryDate.unix() * 1000;
const isSomeFieldNotFill = someLists.some((item) => {
return typeof item.processNum === 'undefined' || typeof item.processUnitPrice === 'undefined'
})
if(isSomeFieldNotFill) {
message.error("通知单明细中有加工商品的加工数量或加工单价未填写");
return
}
const detailList = someLists.map((item) => { const detailList = someLists.map((item) => {
return { return {
orederNo: null, orederNo: item.orderNo, // 如果是商品加工,那么他没有订单号
productId: item.id, // skuid productId: item.id, // skuid
productName: item.name, productName: item.name,
category: item.customerCategoryName, category: item.customerCategoryName,
......
...@@ -227,7 +227,13 @@ const detailTab = { ...@@ -227,7 +227,13 @@ const detailTab = {
prefix: "{{tableAddButton}}", prefix: "{{tableAddButton}}",
columns: "{{noticesDetailColumn}}" columns: "{{noticesDetailColumn}}"
// columns: "{{tableColumns}}", // columns: "{{tableColumns}}",
} },
'x-rules': [
{
required: true,
message: '请选择要加工的商品'
}
]
} }
} }
} }
......
...@@ -158,67 +158,77 @@ export const outerWorkflowRecordsColumn: ColumnsType = [ ...@@ -158,67 +158,77 @@ export const outerWorkflowRecordsColumn: ColumnsType = [
* 生产通知单收货统计 * 生产通知单收货统计
*/ */
export const receiveColumns: ColumnsType = [
{ export const receiveColumns = (type: "order" | 'product'): ColumnsType<any> => {
title: '订单号', /**
dataIndex: 'orderNo', * 如果是商品加工,那么没有订单号
}, */
{ const temp = [
title: 'ID', {
dataIndex: 'id', title: '订单号',
}, dataIndex: 'orderNo',
{ },
title: '商品名称', {
dataIndex: 'productName', title: 'ID',
}, dataIndex: 'id',
{ },
title: '品类', {
dataIndex: 'category', title: '商品名称',
}, dataIndex: 'productName',
{ },
title: '品牌', {
dataIndex: 'brand', title: '品类',
}, dataIndex: 'category',
{ },
title: '单位', {
dataIndex: 'unit', title: '品牌',
}, dataIndex: 'brand',
{ },
title: '加工数量', {
dataIndex: 'processNum', title: '单位',
}, dataIndex: 'unit',
{ },
title: '加工单价', {
dataIndex: 'processPrice', title: '加工数量',
}, dataIndex: 'processNum',
{ },
title: '加工费', {
dataIndex: 'processTotalPrice', title: '加工单价',
}, dataIndex: 'processPrice',
{ },
title: '交期', {
dataIndex: 'deliveryDate', title: '加工费',
render: (text, record) => { dataIndex: 'processTotalPrice',
return moment(text).format('YYYY-MM-DD'); },
{
title: '交期',
dataIndex: 'deliveryDate',
render: (text, record) => {
return moment(text).format('YYYY-MM-DD');
}
},
{
title: '已发货',
dataIndex: 'deliverNum'
},
{
title: '已收货',
dataIndex: 'receiveNum'
},
{
title: '差异数量',
dataIndex: 'differenceNum'
},
{
title: '未发货',
dataIndex: 'notDeliverNum'
} }
}, ];
{ if(type === 'order') {
title: '已发货', return temp
dataIndex: 'deliverNum' }
}, return temp.slice(1)
{ }
title: '已收货',
dataIndex: 'receiveNum'
},
{
title: '差异数量',
dataIndex: 'differenceNum'
},
{
title: '未发货',
dataIndex: 'notDeliverNum'
}
];
export const pnoReceiveDeliverDetailDOListColumns = [ export const pnoReceiveDeliverDetailDOListColumns = [
{ {
......
...@@ -2,7 +2,7 @@ import React, {useState, useEffect, useCallback, useMemo} from 'react'; ...@@ -2,7 +2,7 @@ import React, {useState, useEffect, useCallback, useMemo} from 'react';
import { PageHeaderWrapper } from '@ant-design/pro-layout'; import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { history } from 'umi'; import { history } from 'umi';
import AvatarWrap from '@/components/AvatarWrap'; import AvatarWrap from '@/components/AvatarWrap';
import { PageHeader, Descriptions, Card, Tabs, Row, Col, Button, Badge, Table, Popconfirm } from 'antd'; import { PageHeader, Descriptions, Card, Tabs, Row, Col, Button, Badge, Table, Popconfirm, Space } from 'antd';
import Circulation from '../../components/Circulation'; import Circulation from '../../components/Circulation';
import OtherRequirement from '../../components/OtherRequirement'; import OtherRequirement from '../../components/OtherRequirement';
import Appendix from '../../components/Appendix'; import Appendix from '../../components/Appendix';
...@@ -78,24 +78,20 @@ const Detail: React.FC<{}> = () => { ...@@ -78,24 +78,20 @@ const Detail: React.FC<{}> = () => {
const [loading, setLoading] = useState<boolean>(false); const [loading, setLoading] = useState<boolean>(false);
const [deliverAddressOption, setDeliverAddressOption] = useState([]); const [deliverAddressOption, setDeliverAddressOption] = useState([]);
const [activeAddress, setActiveAddress] = useState<string | null>(null) const [activeAddress, setActiveAddress] = useState<string | null>(null)
const tips = useMemo(() => { const hasProductNoDelievery = useMemo(() => {
let string = "" let res = false
if(pathname === `${PENDING_RECEIPT_PATH}/detail`) { if(pathname === `${PENDING_RECEIPT_PATH}/detail`) {
if(!info || !info.pnoReceiveDeliverDetailDOList) { if(!info || !info.pnoReceiveDeliverDetailDOList) {
return "" return false
} }
const flag = info.pnoReceiveDeliverDetailDOList.some((item) => { res = info.pnoReceiveDeliverDetailDOList.some((item) => {
return item.pnoReceiveDeliverDetailProductBOList.some((row) => { return item.pnoReceiveDeliverDetailProductBOList.some((row) => {
return row.processNum - row.deliverNum > 0 // 还有未发货的 return row.processNum - row.deliverNum > 0 // 还有未发货的
}) })
}); });
if(flag) { return res
string = "您还有未发货的商品,是否确认全部发货已完成"
} else {
string = "确认本单全部发货单是否已全部收到回单"
}
} }
return string return res;
}, [info]) }, [info])
const getInfo = () => { const getInfo = () => {
...@@ -210,12 +206,14 @@ const Detail: React.FC<{}> = () => { ...@@ -210,12 +206,14 @@ const Detail: React.FC<{}> = () => {
/** /**
* 确认全部发货 * 确认全部发货
*/ */
const handleAllReceiptReceive = () => { const handleAllReceiptReceive = (status: boolean) => {
postService( postService(
PublicApi.postEnhanceProcessToBeConfirmReceiptConfirmAllReceipt, PublicApi.postEnhanceProcessToBeConfirmReceiptConfirmAllReceipt,
{ {
produceNoticeOrderId: id, status: true} produceNoticeOrderId: id,
) status: status
}
)
} }
const renderExtra = () => { const renderExtra = () => {
...@@ -227,9 +225,23 @@ const Detail: React.FC<{}> = () => { ...@@ -227,9 +225,23 @@ const Detail: React.FC<{}> = () => {
const SubmitBtn = <Button loading={loading} icon={<FormOutlined />} onClick={submit} type="primary"> 提交通知单</Button> const SubmitBtn = <Button loading={loading} icon={<FormOutlined />} onClick={submit} type="primary"> 提交通知单</Button>
const NextBtn = <Button loading={loading} onClick={toNext}>提交</Button> const NextBtn = <Button loading={loading} onClick={toNext}>提交</Button>
const AllReceiptReceive = ( const AllReceiptReceive = (
<Popconfirm title={tips} onConfirm={handleAllReceiptReceive}> <Space direction={"vertical"}>
<Button loading={loading} type="primary">确认本单全部发货单已收到回单</Button> <Popconfirm
</Popconfirm> title={hasProductNoDelievery ? '您还有未发货的商品,是否确认全部发货已完成' : '确认本单全部发货单是否已全部收到回单'}
onConfirm={() => handleAllReceiptReceive(true)}
>
<Button loading={loading} type="primary" style={{width: '100%'}}>确认本单全部发货单已收到回单</Button>
</Popconfirm>
<div style={{display: 'flex', justifyContent: 'flex-end'}}>
<Popconfirm
title={hasProductNoDelievery ? '是否继续发货' : '您商品都已发货,是否确认还需要继续发货'}
onConfirm={() => handleAllReceiptReceive(false)}
>
<Button loading={loading}>继续发货</Button>
</Popconfirm>
</div>
</Space>
) )
const COMPONENT_MAP = { const COMPONENT_MAP = {
...@@ -345,12 +357,12 @@ const Detail: React.FC<{}> = () => { ...@@ -345,12 +357,12 @@ const Detail: React.FC<{}> = () => {
{/* 这里全部是走 非手工发货,当有手工发货按钮是,此时下面收发货明细隐藏 */} {/* 这里全部是走 非手工发货,当有手工发货按钮是,此时下面收发货明细隐藏 */}
<div style={{marginTop: '20px'}}> <div style={{marginTop: '20px'}}>
<ReceiptDeliveryDetailsCard> <ReceiptDeliveryDetailsCard>
<StatisticsTab tab="收发货统计" columns={receiveColumns} dataSource={info.details}></StatisticsTab> <StatisticsTab tab="收发货统计" columns={receiveColumns(info.source === 2 ? 'product' : 'order')} dataSource={info.details}></StatisticsTab>
{ {
info.pnoReceiveDeliverDetailDOList && info.pnoReceiveDeliverDetailDOList &&
info.pnoReceiveDeliverDetailDOList.length > 0 info.pnoReceiveDeliverDetailDOList.length > 0
? <DetailTab ? <DetailTab
tab="生产通知单收发货明细" tab="收发货明细"
columns={pnoReceiveDeliverDetailDOListColumns} columns={pnoReceiveDeliverDetailDOListColumns}
dataSource={info.pnoReceiveDeliverDetailDOList} dataSource={info.pnoReceiveDeliverDetailDOList}
handleConfirm={handleConfirm} handleConfirm={handleConfirm}
......
...@@ -23,10 +23,20 @@ const styles = { ...@@ -23,10 +23,20 @@ const styles = {
const AppendixItem = (props) => { const AppendixItem = (props) => {
const handleDownload = (name:string, url: string) => {
let link = document.createElement("a");
link.style.display = "none";
link.href = url;
link.setAttribute("download", name);
document.body.appendChild(link) //a标签插至页面中
link.click();
document.body.removeChild(link);
}
return ( return (
<div style={styles}> <div style={styles}>
<img src={pdf_icon} style={{width: '20px', marginRight: '15px'}} /> <img src={pdf_icon} style={{width: '20px', marginRight: '15px'}} />
<div >{props.name}</div> <div onClick={() => handleDownload(props.name, props.value)}>{props.name}</div>
</div> </div>
) )
} }
......
...@@ -38,7 +38,6 @@ const SearchForm = (props) => { ...@@ -38,7 +38,6 @@ const SearchForm = (props) => {
state.props["x-component-props"]["loading"] = true; state.props["x-component-props"]["loading"] = true;
}) })
props.request(values).then((res) => { props.request(values).then((res) => {
console.log(res);
if(res.code === 1000) { if(res.code === 1000) {
setTableStatus({dataSource:res.data.data, totalCount: res.data.totalCount}) setTableStatus({dataSource:res.data.data, totalCount: res.data.totalCount})
} else { } else {
...@@ -59,7 +58,7 @@ const SearchForm = (props) => { ...@@ -59,7 +58,7 @@ const SearchForm = (props) => {
}) })
actions.setFieldState('pagination', state => { actions.setFieldState('pagination', state => {
//@ts-ignore //@ts-ignore
state.props["x-component-props"]["total"] = totalCount || 1; state.props["x-component-props"]["total"] = totalCount || 0;
}) })
} }
......
import React from 'react';
import { Modal } from 'antd';
const WrapModal = () => {
return (
<div></div>
)
}
export default WrapModal;
\ No newline at end of file
...@@ -48,7 +48,7 @@ const ProcessProducts = ({visible, cancel, ...restProps}) => { ...@@ -48,7 +48,7 @@ const ProcessProducts = ({visible, cancel, ...restProps}) => {
const expandable = { const expandable = {
expandedRowRender: record => { expandedRowRender: record => {
const renderData = record.productDateilss.map( const renderData = record.productDateilss && record.productDateilss.map(
(item) => { (item) => {
return { return {
orderNo: record.orderNo, orderNo: record.orderNo,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @description 加工通用列表页列表页, 用于 ["生产通知单","待生产通知单","待审核生产通知单(一级)", ""]等 * @description 加工通用列表页列表页, 用于 ["生产通知单","待生产通知单","待审核生产通知单(一级)", ""]等
*/ */
import React, { useRef, useState } from 'react'; import React, { useRef, useState, useCallback } from 'react';
import { PageHeaderWrapper } from '@ant-design/pro-layout'; import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { Card, Space, Button, Menu, Dropdown, Badge, Spin } from 'antd'; import { Card, Space, Button, Menu, Dropdown, Badge, Spin } from 'antd';
import NiceForm from '@/components/NiceForm'; import NiceForm from '@/components/NiceForm';
...@@ -15,6 +15,7 @@ import { createFormActions } from '@formily/antd'; ...@@ -15,6 +15,7 @@ import { createFormActions } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const'; import { FORM_FILTER_PATH } from '@/formSchema/const';
import { PlusOutlined } from '@ant-design/icons'; import { PlusOutlined } from '@ant-design/icons';
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect'; import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
import { ColumnsType } from 'antd/es/table'; import { ColumnsType } from 'antd/es/table';
import { DownOutlined, DeleteOutlined } from '@ant-design/icons'; import { DownOutlined, DeleteOutlined } from '@ant-design/icons';
import { querySchema, tobeAddQuerySchema, pendingFirstQuerySchema } from './schema'; import { querySchema, tobeAddQuerySchema, pendingFirstQuerySchema } from './schema';
...@@ -42,7 +43,6 @@ const formActions = createFormActions(); ...@@ -42,7 +43,6 @@ const formActions = createFormActions();
[ASSIGN_PENDING_FIRST]: pendingFirstQuerySchema, [ASSIGN_PENDING_FIRST]: pendingFirstQuerySchema,
[ASSIGN_PENDING_SECOND]: pendingFirstQuerySchema, [ASSIGN_PENDING_SECOND]: pendingFirstQuerySchema,
[ASSIGN_PENDING_SUBMIT]: pendingFirstQuerySchema, // 带审核生产通知单 [ASSIGN_PENDING_SUBMIT]: pendingFirstQuerySchema, // 带审核生产通知单
// [PENDING_RECEIVE]: querySchema
} }
// 根据 path, 得到对应的列表页 service // 根据 path, 得到对应的列表页 service
...@@ -52,7 +52,6 @@ const SERVICES = { ...@@ -52,7 +52,6 @@ const SERVICES = {
[ASSIGN_PENDING_FIRST]: PublicApi.getEnhanceSupplierToBeFirstExamList, [ASSIGN_PENDING_FIRST]: PublicApi.getEnhanceSupplierToBeFirstExamList,
[ASSIGN_PENDING_SECOND]: PublicApi.getEnhanceSupplierToBeSecondExamList, [ASSIGN_PENDING_SECOND]: PublicApi.getEnhanceSupplierToBeSecondExamList,
[ASSIGN_PENDING_SUBMIT]: PublicApi.getEnhanceSupplierToBeSubmitList, [ASSIGN_PENDING_SUBMIT]: PublicApi.getEnhanceSupplierToBeSubmitList,
// [PENDING_RECEIVE]: PublicApi.getEnhanceSupplierToBeReceiveList
} }
const Query: React.FC<{}> = (props) => { const Query: React.FC<{}> = (props) => {
...@@ -72,9 +71,16 @@ const Query: React.FC<{}> = (props) => { ...@@ -72,9 +71,16 @@ const Query: React.FC<{}> = (props) => {
}; };
// 初始化高级筛选选项 // 初始化高级筛选选项
const fetchSelectOptions = async () => { const fetchSelectOptions = useCallback(async () => {
return {}; const { data, code } = await PublicApi.getEnhanceSupplierAllOuterAndInner()
}; if(code === 1000) {
return {
innerStatus: data.innerList.map((item: any) => ({label: item.message, value: item.code})),
outerStatus: data.outerList.map((item: any) => ({label: item.message, value: item.code})),
}
}
return {}
}, []);
const menu = ( const menu = (
<Menu > <Menu >
...@@ -283,7 +289,7 @@ const Query: React.FC<{}> = (props) => { ...@@ -283,7 +289,7 @@ const Query: React.FC<{}> = (props) => {
* 查询 * 查询
* @params values 表单字段 * @params values 表单字段
*/ */
const handleSearch = (values: any) => { const handleSearch = useCallback((values: any) => {
const {docTime, ...rest} = values; const {docTime, ...rest} = values;
const {st, et} = timeRange(docTime); const {st, et} = timeRange(docTime);
let searchData = { let searchData = {
...@@ -291,9 +297,8 @@ const Query: React.FC<{}> = (props) => { ...@@ -291,9 +297,8 @@ const Query: React.FC<{}> = (props) => {
startTime: st, startTime: st,
endTtime: et endTtime: et
} }
ref.current.reload(searchData) ref.current.reload(searchData)
} }, [ref])
return ( return (
<PageHeaderWrapper <PageHeaderWrapper
......
...@@ -133,7 +133,7 @@ export const tobeAddQuerySchema: ISchema = { ...@@ -133,7 +133,7 @@ export const tobeAddQuerySchema: ISchema = {
allowClear: true, allowClear: true,
}, },
}, },
time: { docTime: {
type: 'string', type: 'string',
default: 0, default: 0,
enum: docTime, enum: docTime,
...@@ -227,7 +227,7 @@ export const pendingFirstQuerySchema: ISchema = { ...@@ -227,7 +227,7 @@ export const pendingFirstQuerySchema: ISchema = {
allowClear: true, allowClear: true,
}, },
}, },
time: { docTime: {
type: 'string', type: 'string',
default: undefined, default: undefined,
enum: [], enum: [],
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
.fileName { .fileName {
color: @main-color; color: @main-color;
font-size: 14px; font-size: 14px;
display: block;
} }
.remove { .remove {
......
...@@ -31,7 +31,7 @@ const FileList: React.FC<Iprops> = (props) => { ...@@ -31,7 +31,7 @@ const FileList: React.FC<Iprops> = (props) => {
<div className={styles.icon}> <div className={styles.icon}>
<img src={pdf_icon} className={styles.img} /> <img src={pdf_icon} className={styles.img} />
</div> </div>
<div className={styles.fileName}>{name}</div> <a className={styles.fileName} download={name} href={url} target={"_blank"}>{name}</a>
<div className={styles.remove} onClick={() => !!props.removeFile && props.removeFile(name)}> <div className={styles.remove} onClick={() => !!props.removeFile && props.removeFile(name)}>
<DeleteOutlined /> <DeleteOutlined />
</div> </div>
......
...@@ -4,6 +4,7 @@ import { Upload, Button, message } from 'antd'; ...@@ -4,6 +4,7 @@ import { Upload, Button, message } from 'antd';
import { UploadOutlined } from '@ant-design/icons' import { UploadOutlined } from '@ant-design/icons'
import { UPLOAD_TYPE } from '@/constants' import { UPLOAD_TYPE } from '@/constants'
import FileListItem from './FileList'; import FileListItem from './FileList';
import url from '*.svg';
const UploadFile = (props) => { const UploadFile = (props) => {
const { fileList = [], onChange, fileMaxSize = 20 } = props const { fileList = [], onChange, fileMaxSize = 20 } = props
...@@ -64,7 +65,7 @@ const UploadFile = (props) => { ...@@ -64,7 +65,7 @@ const UploadFile = (props) => {
<FileListItem <FileListItem
key={item} key={item}
name={item.name} name={item.name}
url={""} url={item.url}
removeFile={removeFile} removeFile={removeFile}
/> />
) )
......
...@@ -74,10 +74,17 @@ const Query: React.FC<{}> = (props) => { ...@@ -74,10 +74,17 @@ const Query: React.FC<{}> = (props) => {
// 初始化高级筛选选项 // 初始化高级筛选选项
const fetchSelectOptions = async () => { const fetchSelectOptions = useCallback(async () => {
return {}; const { data, code } = await PublicApi.getEnhanceSupplierAllOuterAndInner()
}; if(code === 1000) {
return {
innerStatus: data.innerList.map((item: any) => ({label: item.message, value: item.code})),
outerStatus: data.outerList.map((item: any) => ({label: item.message, value: item.code})),
}
}
return {}
}, []);
const columns: ColumnsType = [ const columns: ColumnsType = [
...@@ -195,7 +202,7 @@ const Query: React.FC<{}> = (props) => { ...@@ -195,7 +202,7 @@ const Query: React.FC<{}> = (props) => {
* 查询 * 查询
* @params values 表单字段 * @params values 表单字段
*/ */
const handleSearch = (values: any) => { const handleSearch = useCallback((values: any) => {
const {docTime, ...rest} = values; const {docTime, ...rest} = values;
const {st, et} = timeRange(docTime); const {st, et} = timeRange(docTime);
let searchData = { let searchData = {
...@@ -205,7 +212,7 @@ const Query: React.FC<{}> = (props) => { ...@@ -205,7 +212,7 @@ const Query: React.FC<{}> = (props) => {
} }
ref.current.reload(searchData) ref.current.reload(searchData)
} }, [ref])
return ( return (
<PageHeaderWrapper <PageHeaderWrapper
......
...@@ -203,7 +203,7 @@ export const pendingFirstQuerySchema: ISchema = { ...@@ -203,7 +203,7 @@ export const pendingFirstQuerySchema: ISchema = {
allowClear: true, allowClear: true,
}, },
}, },
time: { docTime: {
type: 'string', type: 'string',
default: undefined, default: undefined,
enum: [], enum: [],
......
...@@ -2,7 +2,8 @@ import React from 'react'; ...@@ -2,7 +2,8 @@ import React from 'react';
import { getAuth } from '@/utils/auth'; import { getAuth } from '@/utils/auth';
interface Iprops { interface Iprops {
url: string url: string,
canView?: boolean
} }
const Authorize: React.FC<Iprops> = (props) => { const Authorize: React.FC<Iprops> = (props) => {
...@@ -11,7 +12,7 @@ const Authorize: React.FC<Iprops> = (props) => { ...@@ -11,7 +12,7 @@ const Authorize: React.FC<Iprops> = (props) => {
return ( return (
<> <>
{ {
authUrls.includes(props.url) authUrls.includes(props.url) || props.canView
? props.children ? props.children
: null : null
} }
...@@ -19,4 +20,8 @@ const Authorize: React.FC<Iprops> = (props) => { ...@@ -19,4 +20,8 @@ const Authorize: React.FC<Iprops> = (props) => {
) )
} }
Authorize.defaultProps = {
canView: false
}
export default Authorize export default Authorize
\ No newline at end of file
import React, { useCallback} from 'react'; import React, { useCallback} from 'react';
import AbilityContainer from './Container'; import AbilityContainer from './Container';
import styles from './center.less' import styles from './center.less'
import logistics from '@/assets/imgs/logistics.png'; import settlement_platformCollection from '@/assets/imgs/settlement_platformCollection.png';
import logistics_form from '@/assets/imgs/logistics_form.png'; import settlement_integrate from '@/assets/imgs/settlement_integrate.png';
import logistics_address from '@/assets/imgs/logistics_address.png'; import settlement_accountReceive from '@/assets/imgs/settlement_accountReceive.png';
import logistics_cost from '@/assets/imgs/logistics_cost.png'; import settlement_accountPayable from '@/assets/imgs/settlement_accountPayable.png';
import settlement_invoice from '@/assets/imgs/settlement_invoice.png';
import { Row, Col, Skeleton } from 'antd'; import { Row, Col, Skeleton } from 'antd';
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
import { Link } from 'umi' import { Link } from 'umi'
import { getAuth } from '@/utils/auth';
interface Iprops {}; interface Iprops {};
const KEY_TO_TITLE = { const KEY_TO_TITLE = {
...@@ -22,6 +23,32 @@ const FundCenter: React.FC<Iprops> = () => { ...@@ -22,6 +23,32 @@ const FundCenter: React.FC<Iprops> = () => {
return res; return res;
}, []) }, [])
const userAuth = getAuth();
const urls = userAuth.urls;
const tagsList = [
{
icon: settlement_platformCollection,
text: '资金账户',
url: '/memberCenter/payandSettle/capitalAccounts/accountLists'
},
{
icon: settlement_integrate,
text: '授信账户',
url: '/memberCenter/payandSettle/creditManage/quotaMenage'
},
{
icon: settlement_accountReceive,
text: '资金账户管理',
url: '/memberCenter/payandSettle/capitalAccounts/accountLists'
},
{
icon: settlement_accountPayable,
text: '授信管理',
url: '/memberCenter/payandSettle/creditManage/quotaMenage'
},
]
return ( return (
<AbilityContainer <AbilityContainer
title="资金账户管理" title="资金账户管理"
...@@ -37,6 +64,24 @@ const FundCenter: React.FC<Iprops> = () => { ...@@ -37,6 +64,24 @@ const FundCenter: React.FC<Iprops> = () => {
? <Skeleton active /> ? <Skeleton active />
: ( : (
<> <>
<div className={styles.tags}>
{
tagsList.map((item) => {
const hasAuth = !urls.includes(item.url);
if(!hasAuth) {
return null
}
return (
<Link to={item.url} className={styles.tagsItem} key={item.text}>
<div className={styles.icon}>
<img src={item.icon} />
</div>
<div className={styles.text}>{item.text}</div>
</Link>
)
})
}
</div>
<div> <div>
{ {
Object.keys(requestData).map((item) => { Object.keys(requestData).map((item) => {
......
...@@ -22,23 +22,28 @@ const LogisticsCenter: React.FC<Iprops> = () => { ...@@ -22,23 +22,28 @@ const LogisticsCenter: React.FC<Iprops> = () => {
const data = [ const data = [
{ {
icon: logistics, icon: logistics,
text: '物流派单' text: '物流派单',
url: '/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList'
}, },
{ {
icon: logistics_form, icon: logistics_form,
text: '接单报价' text: '接单报价',
url: '/memberCenter/logisticsAbility/logisticsResult/toOrderComfirmList'
}, },
{ {
icon: logistics_address, icon: logistics_address,
text: '收货地址管理' text: '收货地址管理',
url: "/memberCenter/logisticsAbility/logistics/receivingAddress"
}, },
{ {
icon: logistics_address, icon: logistics_address,
text: '发货地址管理' text: '发货地址管理',
url: "/memberCenter/logisticsAbility/logistics/deliveryAddress",
}, },
{ {
icon: logistics_cost, icon: logistics_cost,
text: '运费模板' text: '运费模板',
url: "/memberCenter/logisticsAbility/logistics/template"
} }
] ]
return ( return (
......
import React from 'react'; import React, { useCallback } from 'react';
import AbilityContainer from './Container'; import AbilityContainer from './Container';
import styles from './center.less' import styles from './center.less'
import create_shop from '@/assets/imgs/create_shop.png'; import create_shop from '@/assets/imgs/create_shop.png';
import { BellOutlined } from '@ant-design/icons' import { BellOutlined } from '@ant-design/icons'
import { getAuth } from '@/utils/auth';
import { Link } from 'umi'; import { Link } from 'umi';
import Authorize from '../Authorize'; import Authorize from '../Authorize';
import { PublicApi } from '@/services/api';
import { Skeleton } from 'antd';
interface Iprops {} interface Iprops {}
const SHOP_CENTER = '/memberCenter/shopAbility/template' const SHOP_CENTER = '/memberCenter/shopAbility/template'
const CREATE_SHOP = '/memberCenter/shopAbility/infoManage'; const CREATE_SHOP = '/memberCenter/shopAbility/infoManage';
const ShopCenter: React.FC<Iprops> = () => { const ShopCenter: React.FC<Iprops> = () => {
///template/shop/findShopList
const request = useCallback(async () => {
const {code, data} = await PublicApi.getTemplateShopFindShopList({current: '1', pageSize: '1', categoryId: '0', areaCode: '', memberName: ''});
if(code === 1000) {
return {totalCount: data.totalCount}
}
return {
totalCount: 0
}
}, [])
return ( return (
<AbilityContainer <AbilityContainer
title="店铺中心" title="店铺中心"
...@@ -23,43 +35,56 @@ const ShopCenter: React.FC<Iprops> = () => { ...@@ -23,43 +35,56 @@ const ShopCenter: React.FC<Iprops> = () => {
<Link to={SHOP_CENTER}>进入店铺中心</Link> <Link to={SHOP_CENTER}>进入店铺中心</Link>
</div> </div>
</Authorize> </Authorize>
} }
request={request}
> >
<div className={styles.tags}> {
<Authorize url={CREATE_SHOP}> ({loading, requestData}) => {
<div className={styles.tagsSpecial} > return (
<Link to={CREATE_SHOP} className={styles.tagsItem}> loading
<div className={styles.icon}> ? <Skeleton active />
<img src={create_shop} /> : <div className={styles.tags}>
</div> <Authorize url={CREATE_SHOP} canView={true}>
<div className={styles.text}>创建店铺</div> <div className={styles.tagsSpecial} >
</Link> <Link to={CREATE_SHOP} className={styles.tagsItem}>
<div className={styles.ding_tips}> <div className={styles.icon}>
<div className={styles.ding_icon}> <img src={create_shop} />
<BellOutlined /> </div>
<div className={styles.text}>创建店铺</div>
</Link>
{
requestData.totalCount
? <div className={styles.ding_tips}>
<div className={styles.ding_icon}>
<BellOutlined />
</div>
<span>你还没有创建店铺,请先创建店铺</span>
</div>
: null
}
</div>
</Authorize>
<Authorize url={SHOP_CENTER}>
<Link to={SHOP_CENTER} className={styles.tagsItem} >
<div className={styles.icon}>
<img src={create_shop} />
</div>
<div className={styles.text}>店铺模板</div>
</Link>
</Authorize>
<Authorize url={SHOP_CENTER}>
<Link to={SHOP_CENTER} className={styles.tagsItem} >
<div className={styles.icon}>
<img src={create_shop} />
</div>
<div className={styles.text}>店铺装修</div>
</Link>
</Authorize>
</div> </div>
<span>你还没有创建店铺,请先创建店铺</span> )
</div> }
</div> }
</Authorize>
<Authorize url={SHOP_CENTER}>
<Link to={SHOP_CENTER} className={styles.tagsItem} >
<div className={styles.icon}>
<img src={create_shop} />
</div>
<div className={styles.text}>店铺模板</div>
</Link>
</Authorize>
<Authorize url={SHOP_CENTER}>
<Link to={SHOP_CENTER} className={styles.tagsItem} >
<div className={styles.icon}>
<img src={create_shop} />
</div>
<div className={styles.text}>店铺装修</div>
</Link>
</Authorize>
</div>
</AbilityContainer> </AbilityContainer>
) )
} }
......
/** /**
* 最近未使用算法 * 最近未使用算法
* 设置最长的长度为6,之而立其实不能用map,后面再改进吧,应为map的话不能放到localstorage,需要遍历一次, * 设置最长的长度为6,好像只能用map,后面再改进吧,应为map的话不能放到localstorage,需要遍历一次,
* 双向链表 用JSON.stringify 会报错,应该是因为有一个环
*/ */
var LRUCache = function (capacity: number) {
const LRUCache = function (capacity: number) {
this.cache = new Map(); this.cache = new Map();
this.capacity = capacity; this.capacity = capacity;
this.instance = null
}; };
LRUCache.prototype.get = function (key) { LRUCache.prototype.init = function() {
if (this.cache.has(key)) { const recentVisit = localStorage.getItem('recentVisit') && JSON.parse(localStorage.getItem('recentVisit')) || {};
// 存在即更新 Object.keys(recentVisit).map((item) => {
let temp = this.cache.get(key); this.cache.set(item, recentVisit[item]);
this.cache.delete(key); })
this.cache.set(key, temp); // return recentVisit;
return temp; }
}
return -1;
};
LRUCache.prototype.put = function (key: string, value: string) { LRUCache.prototype.put = function (key: string, value: string) {
if (this.cache.has(key)) { if (this.cache.has(key)) {
......
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