From 297ab0778dfc381ae1a824d6f208c97326ffeecd Mon Sep 17 00:00:00 2001 From: zhengw <247276359@qq.com> Date: Fri, 28 Apr 2023 17:25:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=8F=91:=20=E9=83=A8=E5=88=86?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=85=BC=E5=AE=B9=E5=B0=8F=E5=B1=8F=E5=B9=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/SearchBarPlugin/index.tsx | 6 +- src/pages/ChatLogs/ChatLogsType.ts | 1 + src/pages/ChatLogs/ChatUtils.tsx | 9 +- src/pages/ChatLogs/index.tsx | 10 +- .../components/CustDetailContent.tsx | 6 +- src/pages/CustomList/index.tsx | 377 ++++++++++-------- src/pages/DepartmentsList/index.tsx | 262 ++++++++---- .../components/GroupDetailContent.tsx | 12 +- .../GroupList/components/index.mudule.scss | 1 - src/pages/GroupList/index.tsx | 162 +++++--- 10 files changed, 533 insertions(+), 313 deletions(-) diff --git a/src/components/SearchBarPlugin/index.tsx b/src/components/SearchBarPlugin/index.tsx index 0ff6ba7..ac93d73 100644 --- a/src/components/SearchBarPlugin/index.tsx +++ b/src/components/SearchBarPlugin/index.tsx @@ -6,6 +6,7 @@ import React, { useState } from 'react'; interface IProps { body: React.ReactNode; footer: React.ReactNode; + phoneBtns?: React.ReactNode; } export const SearchBarPlugin: React.FC = (props) => { @@ -43,7 +44,7 @@ export const SearchBarPlugin: React.FC = (props) => { <> {isPhone ? ( <> - setOpen(false)} width={'80%'}> + setOpen(false)} width={'85%'}>
{props.body}
= (props) => { background: '#fff', display: 'flex', justifyContent: 'flex-end', - padding: '8px 0', + padding: '8px 12px', borderRadius: 6, }} > + {props.phoneBtns}
)} diff --git a/src/pages/ChatLogs/index.tsx b/src/pages/ChatLogs/index.tsx index 6c61318..6fd1684 100644 --- a/src/pages/ChatLogs/index.tsx +++ b/src/pages/ChatLogs/index.tsx @@ -258,15 +258,9 @@ const ChatLogs: React.FC = () => { }; // 监听DOM变动 - const callback = function (mutationsList: any) { + const callback = function () { // Use traditional 'for loops' for IE 11 - for (let mutation of mutationsList) { - if (mutation.type === 'childList') { - document.querySelector('.curr_page' + param.curr_page)?.scrollIntoView(true); - } else if (mutation.type === 'attributes') { - console.log('The ' + mutation.attributeName + ' attribute was modified.'); - } - } + document.querySelector('.curr_page' + param.curr_page)?.scrollIntoView(true); }; const observer = new MutationObserver(callback); diff --git a/src/pages/CustomList/components/CustDetailContent.tsx b/src/pages/CustomList/components/CustDetailContent.tsx index 874ca3d..adb39b4 100644 --- a/src/pages/CustomList/components/CustDetailContent.tsx +++ b/src/pages/CustomList/components/CustDetailContent.tsx @@ -3,7 +3,7 @@ import { formatTags } from '@/pages/ChatLogs/ChatUtils'; import { Gender } from '@/pages/ChatLogs/components/Gender'; import { post } from '@/services/ajax'; import { AddWay, CustType } from '@/services/config'; -import { Spin, Steps } from 'antd'; +import { Image, Spin, Steps } from 'antd'; import { stringify } from 'qs'; import React, { useEffect, useState } from 'react'; import styles from './index.module.scss'; @@ -63,7 +63,7 @@ export const CustDetailContent: React.FC = (props) => { }} >
- +
@@ -77,7 +77,7 @@ export const CustDetailContent: React.FC = (props) => {
添加方式:{record ? AddWay[record?.add_way] : ''}
-
跟进员工:{record?.user_id}
+
跟进员工:{record?.staff_name}
添加时间:{record?.create_time}
{ } /> - - { - return `${record.cust_id}_${record.user_id}`; - }} - loading={loading} - onRow={(record: ICustFollow) => { - if ( - record?.add_staff_tot && - !isNaN(record?.add_staff_tot) && - Number(record?.add_staff_tot) > 1 - ) { - return { - style: { - background: '#fcffe6', - }, - }; - } - return {}; - }} - > - { + {isPhone ? ( + + {custsList.map((item) => { return ( -
{ - setRecord(record); + setRecord(item); setOpen(true); }} - style={{ cursor: 'pointer', display: 'flex' }} > -
{ - e.stopPropagation(); - }} - > - -
-
-
- {value}[{record.remark}] +
+
{ + e.stopPropagation(); + }} + > +
-
- - - @{CustType[record.type]} - +
+
+ {item.name}[{item.remark}] +
+
+ + + @{CustType[item.type]} + +
-
+ ); + })} + + ) : ( +
{ + return `${record.cust_id}_${record.user_id}`; }} - /> - { - return { - style: { - paddingBottom: 8, - }, - }; - }} - render={(value) => { - try { - let arr = JSON.parse(value); - if (arr.length) { - return ( - <> - {arr.length >= 3 ? ( - { - return ( - <> - {arr.map((item: any) => { - return ( - - {item?.tag_name} - - ); - })} - - ); - }} - > - - {arr[0]?.tag_name} - - {arr[1] ? ( - - {arr[1]?.tag_name} - - ) : null} - - ... - - - ) : ( -
- - {arr[0]?.tag_name} - - {arr[1] ? ( - - {arr[1]?.tag_name} - - ) : null} -
- )} - - ); - } - } catch (e) { - /* empty */ + loading={loading} + onRow={(record: ICustFollow) => { + if ( + record?.add_staff_tot && + !isNaN(record?.add_staff_tot) && + Number(record?.add_staff_tot) > 1 + ) { + return { + style: { + background: '#fcffe6', + }, + }; } - return
无标签
; + return {}; }} - dataIndex={'tags'} - /> - { - return <>{record?.staff_name}; - }} - dataIndex={'user_id'} - /> - {/* */} - { - return <>{AddWay[value]}; - }} - /> - - {/* */} -
+ > + { + return ( +
{ + setRecord(record); + setOpen(true); + }} + style={{ cursor: 'pointer', display: 'flex' }} + > +
{ + e.stopPropagation(); + }} + > + +
+
+
+ {value}[{record.remark}] +
+
+ + + @{CustType[record.type]} + +
+
+
+ ); + }} + /> + { + return { + style: { + paddingBottom: 8, + }, + }; + }} + render={(value) => { + try { + let arr = JSON.parse(value); + if (arr.length) { + return ( + <> + {arr.length >= 3 ? ( + { + return ( + <> + {arr.map((item: any) => { + return ( + + {item?.tag_name} + + ); + })} + + ); + }} + > + + {arr[0]?.tag_name} + + {arr[1] ? ( + + {arr[1]?.tag_name} + + ) : null} + + ... + + + ) : ( +
+ + {arr[0]?.tag_name} + + {arr[1] ? ( + + {arr[1]?.tag_name} + + ) : null} +
+ )} + + ); + } + } catch (e) { + /* empty */ + } + return
无标签
; + }} + dataIndex={'tags'} + /> + { + return <>{record?.staff_name}; + }} + dataIndex={'user_id'} + /> + {/* */} + { + return <>{AddWay[value]}; + }} + /> + + {/* */} + + )} { { pageSize={param.page_count} total={count} pageSizeOptions={[10, 20, 50, 100]} - onShowSizeChange={(current, size) => { + onShowSizeChange={(_current, size) => { param.page_count = size; page(1); }} diff --git a/src/pages/DepartmentsList/index.tsx b/src/pages/DepartmentsList/index.tsx index 2404ac3..80359d4 100644 --- a/src/pages/DepartmentsList/index.tsx +++ b/src/pages/DepartmentsList/index.tsx @@ -1,9 +1,11 @@ import { SearchBarPlugin } from '@/components/SearchBarPlugin'; import { post } from '@/services/ajax'; +import { getDevice } from '@/services/utils'; import { PageContainer } from '@ant-design/pro-components'; import { App, Button, + Card, Col, Drawer, Form, @@ -58,7 +60,9 @@ const DepartmentsList: React.FC = () => { const [loadingL, setLoadingL] = useState(false); const [loading, setLoading] = useState(false); const [open, setOpen] = useState(false); + const [phoneDepOpen, setPhoneDepOpen] = useState(false); const [record, setRecord] = useState(); + const isPhone = getDevice() == 'phone'; const getStaffsList = () => { setLoading(true); @@ -145,26 +149,93 @@ const DepartmentsList: React.FC = () => { return ( -
-
setPhoneDepOpen(false)} + width={'85%'} + placement="left" + > + { + setPhoneDepOpen(false); + if (selectedKeys.length) { + setDepartmentsID(Number(selectedKeys[0])); + param.dep_id = Number(selectedKeys[0]); + page(1); + } }} - > - - {departmentsList.length ? ( + titleRender={(nodeData: any) => { + // console.log(nodeData); + return ( +
+
+ {nodeData.name} +
+ {/*
+ { + e.stopPropagation(); + setOpen(true); + }} + className={styles.edit} + /> + { + setPopOpen(-1); + e?.stopPropagation(); + }} + onConfirm={(e) => { + e?.stopPropagation(); + console.log(nodeData.id); + }} + > + { + e.stopPropagation(); + setPopOpen(nodeData.id); + }} + className={styles.del} + /> + +
*/} +
+ ); + }} + /> + +
+ {isPhone ? null : ( +
+ { ); }} /> - ) : null} - -
+ +
+ )} { } + phoneBtns={ + isPhone ? ( + + ) : null + } /> - - - { + {isPhone ? ( + + {staffsData.data?.map((item) => { return ( -
{ - setRecord(record); + setRecord(item); setOpen(true); }} - style={{ color: '#1890ff', cursor: 'pointer' }} + key={item.user_id} + title={{item.name}} + style={{ marginTop: 16 }} + extra={ + item.isleader == 1 ? ( + + 负责人 + + ) : null + } > - 职务:{item.position || '未设置'}
+
部门:{item?.dep_name?.join(',') || '未设置'}
+
手机号:{item.mobile || '未设置'}
+
企业邮箱:{item.biz_mail || '未设置'}
+ + ); + })} +
+ ) : ( +
+ { + return ( +
{ + setRecord(record); + setOpen(true); }} + style={{ color: '#1890ff', cursor: 'pointer' }} > - {value} - - {record?.isleader == 1 ? ( - 负责人 + {value} - ) : null} -
- ); - }} - /> - - { - return <>{val.join(',')}; - }} - /> - - -
- setOpen(false)} width={800}> + {record?.isleader == 1 ? ( + + 负责人 + + ) : null} +
+ ); + }} + /> + + { + return <>{val.join(',')}; + }} + /> + + + + )} + setOpen(false)} + width={isPhone ? '90%' : 800} + destroyOnClose + > = (props) => { const [groupMembersList, setGroupMembersList] = useState([]); const [loading, setLoading] = useState(false); const groupMembersObjRef = useRef({}); - + const isPhone = getDevice() === 'phone'; const getList = () => { setLoading(true); post({ @@ -60,10 +61,10 @@ export const GroupDetailContent: React.FC = (props) => { }, [props.record]); return ( - + {groupMembersList.length ? (
-
+
群主: @@ -74,7 +75,10 @@ export const GroupDetailContent: React.FC = (props) => {
创建时间:{record?.create_time}
-
+
{ create_timeL: '', create_timeU: '', }); - + const isPhone = getDevice() === 'phone'; const [groupsList, setGroupsList] = useState([]); const [count, setCount] = useState(0); const [loading, setLoading] = useState(false); @@ -145,33 +159,61 @@ const GroupList: React.FC = () => { } /> - - { - return `${record.group_id}_${record.name}`; - }} - loading={loading} - > - { + {isPhone ? ( + + {groupsList.map((item) => { return ( -
{ - setRecord(record); + setRecord(item); setOpen(true); }} - style={{ cursor: 'pointer', display: 'flex' }} + style={{ marginTop: 16 }} + title={ +
+ {item.name || '未知群名'} +
+ } + extra={ + {item.state == 1 ? '正常' : '已解散'} + } > - {/*
群主:{item.staff_name}
+
群人数:{item?.members_tot}
+
群状态:{groupStatus[item.status]}
+
创建时间:{item.create_time}
+ + ); + })} + + ) : ( +
{ + return `${record.group_id}_${record.name}`; + }} + loading={loading} + > + { + return ( +
{ + setRecord(record); + setOpen(true); + }} + style={{ cursor: 'pointer', display: 'flex' }} + > + {/*
{ >
*/} -
+
{value || '未知群名'}
-
- ); - }} - /> - { - return <>{r?.staff_name}; - }} - dataIndex={'owner'} - /> - { - return <>{groupStatus[v]}; - }} - dataIndex={'status'} - /> - - { - return <>{v == 1 ? '正常' : '已解散'}; - }} - dataIndex={'state'} - /> - - {/* */} -
+ ); + }} + /> + { + return <>{r?.staff_name}; + }} + dataIndex={'owner'} + /> + { + return <>{groupStatus[v]}; + }} + dataIndex={'status'} + /> + + { + return <>{v == 1 ? '正常' : '已解散'}; + }} + dataIndex={'state'} + /> + + {/* */} + + )} + setOpen(false)} - width={800} + width={isPhone ? '90%' : 800} >