From ab36a85b22f086f6332cd350a0339616faca6f88 Mon Sep 17 00:00:00 2001 From: LiaoYijun Date: Thu, 29 May 2025 16:00:49 +0800 Subject: [PATCH] =?UTF-8?q?perf=EF=BC=9A=E5=88=A0=E9=99=A4=E5=8E=9F?= =?UTF-8?q?=E6=9C=89=E8=A1=A8=E6=A0=BC=E5=92=8C=E6=97=A0=E7=94=A8=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/orders/Follow.jsx | 265 +----------------------------------- 1 file changed, 2 insertions(+), 263 deletions(-) diff --git a/src/views/orders/Follow.jsx b/src/views/orders/Follow.jsx index 9dd8dcb..117528c 100644 --- a/src/views/orders/Follow.jsx +++ b/src/views/orders/Follow.jsx @@ -40,189 +40,7 @@ import { UNREAD_MARK } from '@/actions/ConversationActions' import AdvanceSearchForm from './AdvanceSearchForm' function OrderGroupTable({ formValues }) { - const handleImportEmail = useCallback((order) => { - importEmailMessage({ orderId: order.COLI_SN, orderNumber: order.COLI_ID }) - .then((r) => { - console.info(r) - notification.info({ - message: 'Notification', - description: '订单:' + order.COLI_ID + ' 导入' + r.result.length + '条邮件消息', - placement: 'top', - }) - }) - .catch((ex) => - notification.error({ - message: 'Notification', - description: ex.message, - placement: 'top', - duration: 4, - }), - ) - }, []) - - const orderColumns = [ - { - title: '订单号', - dataIndex: 'COLI_ID', - width: 222, - render: (text, record) => { - let tagIcon = '' - - if (record.COLI_LineGrade === 240003) tagIcon = 重点 - else if (record.COLI_LineGrade === 240002) tagIcon = 次重点 - else if (record.COLI_LineGrade === 240001) tagIcon = 一般 - - return ( - - } size='small' onClick={() => handleImportEmail(record)} />} - /> - - {text} - - {tagIcon} - - ) - }, - }, - { - title: '客人姓名', - dataIndex: 'coli_guest', - render: (text, record) => { - let regularText = '' - if (record.buytime > 0) regularText = '(R' + record.buytime + ')' - return ( - - - - - } - /> - {text + regularText} - = UNREAD_MARK ? ' ' : record.unread_msg} - style={{ - backgroundColor: '#52c41a', - }} - /> - - ) - }, - }, - { - title: '订单状态', - dataIndex: 'COLI_State', - width: 140, - render: (text, record) => { - let extra = '' - if (record.coli_ordertype === 3 || record.coli_ordertype === 4 || record.coli_ordertype === 5) { - extra = '(' + (record.coli_ordertype - 2) + '催)' - } - - return ( - - {extra} - {text} - - ) - }, - }, - { - title: '报价 Title', - dataIndex: 'lettertitle', - ellipsis: true, - hidden: false, - }, - { - title: '出发日期', - dataIndex: 'COLI_OrderStartDate', - width: 120, - hidden: false, - sortDirections: ['ascend', 'descend'], - sorter: (a, b) => { - const datejsA = isEmpty(a.COLI_OrderStartDate) ? 0 : new dayjs(a.COLI_OrderStartDate).valueOf() - const datejsB = isEmpty(b.COLI_OrderStartDate) ? 0 : new dayjs(b.COLI_OrderStartDate).valueOf() - return datejsA - datejsB - }, - }, - { - title: '客人最后一次回复时间', - dataIndex: 'last_received_time', - width: 180, - render: (text, record) => { - if (record.last_received_time) { - return new dayjs(record.last_received_time).format('YYYY-MM-DD HH:mm:ss') - } - }, - }, - { - title: '附加信息', - ellipsis: true, - dataIndex: 'COLI_Introduction', - }, - ] - const { notification } = App.useApp() - const [loading, setLoading] = useState(false) - const orderList = useOrderStore((state) => state.orderList) - const fetchOrderList = useOrderStore((state) => state.fetchOrderList) - const importEmailMessage = useOrderStore((state) => state.importEmailMessage) - const [loginUser, isPermitted] = useAuthStore((state) => [state.loginUser, state.isPermitted]) - - useEffect(() => { - let canSearch = true - - if (formValues.type === 'advance') { - const copyObject = copy(formValues) - delete copyObject.type - const allEmpty = Object.values(copyObject).every((val) => { - return val === null || val === '' || val === undefined - }) - if (allEmpty) { - canSearch = false - notification.warning({ - message: '温馨提示', - description: '请输入至少一个条件', - placement: 'top', - duration: 60, - }) - } - } - - if (canSearch) { - setLoading(true) - fetchOrderList(formValues, loginUser) - .finally(() => setLoading(false)) - .catch((reason) => { - notification.error({ - message: '查询出错', - description: reason.message, - placement: 'top', - duration: 60, - }) - }) - } - }, [formValues]) - - const paginationProps = { - showQuickJumper: true, - showLessItems: true, - showSizeChanger: true, - showTotal: (total) => { - return `总数:${total}` - }, - } - - function groupByParam(array, param) { - return array.reduce((result, item) => { - ;(result[item[param]] = result[item[param]] || []).push(item) - return result - }, {}) - } const deptMap = new Map([ ['1', 'CH直销组'], @@ -257,85 +75,6 @@ function OrderGroupTable({ formValues }) { ['35', 'newsletter营销'], ]) - const groupOrderData = groupByParam(orderList, 'OPI_DEI_SN') - const deptKeys = Object.keys(groupOrderData) - const deptItems = [] - - deptKeys.forEach((deptNo, index) => { - const deptOrderList = groupOrderData[deptNo] - // 1新订单;2未读消息;3需一催;4需二催;5需三催;6未处理邮件;入境提醒coli_ordertype=7,余款提醒coli_ordertype=8 - const newOrderList = deptOrderList.filter((o) => { - return o.coli_ordertype === 1 - }) - const newMsgList = deptOrderList.filter((o) => { - return o.coli_ordertype === 2 || o.coli_ordertype === 6 - }) - const followUpList = deptOrderList.filter((o) => { - return o.coli_ordertype === 3 || o.coli_ordertype === 4 || o.coli_ordertype === 5 - }) - const entryList = deptOrderList.filter((o) => { - return o.coli_ordertype === 7 - }) - const paymentList = deptOrderList.filter((o) => { - return o.coli_ordertype === 8 - }) - if (formValues.type === 'today') { - deptItems.push({ - key: index, - label: deptMap.get(deptNo), - children: ( - <> - 新订单 - 0} - whenTrue={} - whenFalse={} - /> - - 新消息/老邮件 - 0} - whenTrue={
} - whenFalse={} - /> - - 催信 - 0} - whenTrue={
} - whenFalse={} - /> - - 余款收付 - 0} - whenTrue={
} - whenFalse={} - /> - - 入境提醒 - 0} - whenTrue={
} - whenFalse={} - /> - - ), - }) - } else { - deptItems.push({ - key: index, - label: deptMap.get(deptNo), - children: ( - <> -
- - ), - }) - } - }) - - return 0} whenTrue={} whenFalse={} /> } function Follow() { @@ -374,7 +113,7 @@ const [collapsed, setCollapsed] = useState(false) onSelect={(selectedKeys, e) => { console.info('selectedKeys: ', selectedKeys) }} - defaultExpandedKeys={['0-0-today-task', '0-1-todo-task']} + defaultExpandedKeys={['0-0-today-task', '0-1-todo-list']} defaultSelectedKeys={['0-0-0']} treeData={[ { @@ -394,7 +133,7 @@ const [collapsed, setCollapsed] = useState(false) }, { title: '待办任务', - key: '0-1-todo-task', + key: '0-1-todo-list', icon: , children: [ {