From 079739223a5276f21be6e294bb267f00a39c2082 Mon Sep 17 00:00:00 2001
From: zhengw <247276359@qq.com>
Date: Tue, 18 Apr 2023 17:28:06 +0800
Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=8F=91:=20=E6=B7=BB=E5=8A=A0?=
=?UTF-8?q?=E5=AE=A2=E6=88=B7=E5=88=97=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/pages/ChatLogs/ChatUtils.tsx | 8 +-
src/pages/ChatLogs/components/Gender.tsx | 9 +-
src/pages/ChatLogs/index.module.scss | 2 +-
src/pages/ChatLogs/index.tsx | 16 +-
src/pages/CustomList/index.module.scss | 17 +
src/pages/CustomList/index.tsx | 379 ++++++++++++++++-------
src/pages/DepartmentsList/index.tsx | 30 +-
src/pages/User/Login/index.tsx | 86 +----
src/pages/Workbench/index.tsx | 147 ++++++---
src/services/config.ts | 31 ++
10 files changed, 456 insertions(+), 269 deletions(-)
create mode 100644 src/services/config.ts
diff --git a/src/pages/ChatLogs/ChatUtils.tsx b/src/pages/ChatLogs/ChatUtils.tsx
index dfd22b6..e7e286c 100644
--- a/src/pages/ChatLogs/ChatUtils.tsx
+++ b/src/pages/ChatLogs/ChatUtils.tsx
@@ -69,7 +69,7 @@ export const formatTags = (data: any) => {
if (data) {
try {
const tags = JSON.parse(data);
- if (Array.isArray(tags)) {
+ if (Array.isArray(tags) && tags.length) {
return (
<>
{tags.map((item) => {
@@ -82,11 +82,9 @@ export const formatTags = (data: any) => {
>
);
}
- } catch (e) {
- return <>>;
- }
+ } catch (e) {}
}
- return <>>;
+ return
无标签
;
};
type IGroupIcon = {
diff --git a/src/pages/ChatLogs/components/Gender.tsx b/src/pages/ChatLogs/components/Gender.tsx
index 1ef9beb..20bfaeb 100644
--- a/src/pages/ChatLogs/components/Gender.tsx
+++ b/src/pages/ChatLogs/components/Gender.tsx
@@ -22,7 +22,14 @@ export const Gender: React.FC = (props) => {
)}
>
- ) : null}
+ ) : (
+
+ )}
>
);
};
diff --git a/src/pages/ChatLogs/index.module.scss b/src/pages/ChatLogs/index.module.scss
index 3764b9e..1d41167 100644
--- a/src/pages/ChatLogs/index.module.scss
+++ b/src/pages/ChatLogs/index.module.scss
@@ -150,7 +150,7 @@
pointer-events: none;
&.show {
- z-index: 1;
+ z-index: 11;
transform: translateY(0px);
visibility: visible;
opacity: 1;
diff --git a/src/pages/ChatLogs/index.tsx b/src/pages/ChatLogs/index.tsx
index 6bc2015..3e4bdf6 100644
--- a/src/pages/ChatLogs/index.tsx
+++ b/src/pages/ChatLogs/index.tsx
@@ -109,8 +109,8 @@ const ChatLogs: React.FC = () => {
setChatLogLoading(false);
isAllChatRef.current = count < param.page_count * param.curr_page;
if (res.err_code == 0) {
+ let arr: IChat[] = [];
if (Array.isArray(res.data) && res.data.length) {
- let arr: IChat[] = [];
const temp = res.data.reverse();
const mark = { curr_page: param.curr_page, msg_time: temp[temp.length - 1].msg_time };
if (param.curr_page == 1) {
@@ -140,8 +140,8 @@ const ChatLogs: React.FC = () => {
// }
// });
// }
- setChatLogs(arr);
}
+ setChatLogs(arr);
}
});
};
@@ -708,6 +708,18 @@ const ChatLogs: React.FC = () => {
备注名称:{selectCustFollow?.remark}
+
+ 标签
+
{formatTags(selectCustFollow?.tags)}
) : (
diff --git a/src/pages/CustomList/index.module.scss b/src/pages/CustomList/index.module.scss
index e69de29..11d2fbf 100644
--- a/src/pages/CustomList/index.module.scss
+++ b/src/pages/CustomList/index.module.scss
@@ -0,0 +1,17 @@
+.modalAvatar {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 60px;
+ height: 60px;
+ margin-right: 12px;
+ overflow: hidden;
+ background-color: #69b1ff;
+ border-radius: 6px;
+
+ img {
+ max-width: 100%;
+ max-height: 100%;
+ object-fit: cover;
+ }
+}
diff --git a/src/pages/CustomList/index.tsx b/src/pages/CustomList/index.tsx
index 886ddc0..86d051f 100644
--- a/src/pages/CustomList/index.tsx
+++ b/src/pages/CustomList/index.tsx
@@ -1,85 +1,92 @@
import { SearchBarPlugin, SearchBottonsCardPlugin } from '@/components/SearchBarPlugin';
import { post } from '@/services/ajax';
+import { AddWay, CustType } from '@/services/config';
import { PageContainer } from '@ant-design/pro-components';
-import { Button, Col, DatePicker, Drawer, Form, Input, Pagination, Row, Table } from 'antd';
+import {
+ Button,
+ Col,
+ DatePicker,
+ Drawer,
+ Form,
+ Image,
+ Input,
+ Pagination,
+ Popover,
+ Row,
+ Select,
+ Table,
+ Tag,
+} from 'antd';
import { stringify } from 'qs';
import React, { useEffect, useState } from 'react';
-import { IStaffsItem } from '../ChatLogs/ChatLogsType';
+import { formatTags } from '../ChatLogs/ChatUtils';
+import { Gender } from '../ChatLogs/components/Gender';
+import styles from './index.module.scss';
-interface IDepartment {
- children: null | IDepartment[];
- department_leader: string;
- id: number;
+interface ICustItem {
+ add_way: number;
+ avatar: string;
+ create_time: string;
+ cust_id: string;
+ description: string;
+ gender: number;
name: string;
- parent_id: number;
- sort: number;
-}
-
-interface IStaffsData {
- count: number;
- data?: IStaffsItem[];
+ oper_user_id: string;
+ remark: string;
+ remark_mobiles: string;
+ state: number;
+ tags: string;
+ type: number;
+ user_id: string;
}
type Param = {
curr_page: number;
page_count: number;
- dep_id: number;
+ type?: number | string;
name?: string;
- position?: string;
- telephone?: string;
- mobile?: string;
+ add_way?: string;
+ create_timeL?: string;
+ create_timeU?: string;
};
const CustomList: React.FC = () => {
const [param] = useState({
curr_page: 1,
page_count: 20,
- dep_id: 0,
+ type: '',
+ name: '',
+ add_way: '',
+ create_timeL: '',
+ create_timeU: '',
});
- const [departmentID, setDepartmentsID] = useState(0);
- const [departmentsList, setDepartmentsList] = useState([]);
- const [staffsData, setStaffsData] = useState({ count: 0, data: [] });
- const [loadingL, setLoadingL] = useState(false);
+ const [custsList, setCustsList] = useState([]);
+ const [count, setCount] = useState(0);
const [loading, setLoading] = useState(false);
const [open, setOpen] = useState(false);
- const [record, setRecord] = useState();
+ const [record, setRecord] = useState();
- const getStaffsList = () => {
+ const getCustsList = () => {
setLoading(true);
- post({ url: '/Staffs/List', data: stringify(param) }).then((res) => {
+ post({ url: '/CustFollows/CustsList', data: stringify(param) }).then((res) => {
setLoading(false);
if (res.err_code == 0) {
- if (!Array.isArray(res.data)) {
- res.data = [];
- }
- setStaffsData(res as IStaffsData);
- }
- });
- };
-
- const getDepartmentsList = () => {
- setLoadingL(true);
- post({ url: '/Departments/List' }).then((res) => {
- setLoadingL(false);
- if (res.err_code == 0) {
- if (Array.isArray(res.data) && res.data.length) {
- param.dep_id = res.data[0].id;
- setDepartmentsID(param.dep_id);
- setDepartmentsList(res.data);
- getStaffsList();
+ if (Array.isArray(res.data)) {
+ setCustsList(res.data);
}
+ setCount(res.count || 0);
}
});
};
const page = (page: number) => {
param.curr_page = page;
- getStaffsList();
+ getCustsList();
};
useEffect(() => {
- getDepartmentsList();
+ getCustsList();
}, []);
return (
@@ -88,9 +95,10 @@ const CustomList: React.FC = () => {
@@ -167,58 +179,203 @@ const CustomList: React.FC = () => {
{
+ return `${record.cust_id}_${record.user_id}`;
+ }}
loading={loading}
>
{
+ render={(value, record: ICustItem) => {
return (
{
setRecord(record);
setOpen(true);
}}
- style={{ color: '#1890ff', cursor: 'pointer' }}
+ style={{ cursor: 'pointer', display: 'flex' }}
>
- {
+ e.stopPropagation();
}}
>
- {value}
-
- {record?.isleader == 1 ? (
-
- 负责人
-
- ) : null}
+
+
+
+
+ {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) {}
+ return 无标签
;
+ }}
+ dataIndex={'tags'}
+ />
+
+ {/* */}
+ {
+ return <>{AddWay[value]}>;
+ }}
+ />
+
+ {/* */}
- setOpen(false)} width={800} />
+ setOpen(false)}
+ width={800}
+ >
+
+
+
+

+
+
+
+ {record?.name}
+
+
+
+ @{record ? CustType[record?.type] : ''}
+
+
{record?.description}
+
+
+
备注名称:{record?.remark}
+
添加方式:{record ? AddWay[record?.add_way] : ''}
+
跟进员工:{record?.user_id}
+
添加时间:{record?.create_time}
+
+ 标签
+
+ {formatTags(record?.tags)}
+
+
{
}}
current={param.curr_page}
pageSize={param.page_count}
- total={staffsData.count}
+ total={count}
pageSizeOptions={[10, 20, 50, 100]}
onShowSizeChange={(current, size) => {
param.page_count = size;
diff --git a/src/pages/DepartmentsList/index.tsx b/src/pages/DepartmentsList/index.tsx
index bd553b2..0f31a2d 100644
--- a/src/pages/DepartmentsList/index.tsx
+++ b/src/pages/DepartmentsList/index.tsx
@@ -78,11 +78,13 @@ const DepartmentsList: React.FC = () => {
post({ url: '/Departments/List' }).then((res) => {
setLoadingL(false);
if (res.err_code == 0) {
- if (Array.isArray(res.data) && res.data.length) {
- param.dep_id = res.data[0].id;
- setDepartmentsID(param.dep_id);
+ if (Array.isArray(res.data)) {
setDepartmentsList(res.data);
- getStaffsList();
+ if (res.data.length) {
+ param.dep_id = res.data[0].id;
+ setDepartmentsID(param.dep_id);
+ getStaffsList();
+ }
}
}
});
@@ -246,7 +248,7 @@ const DepartmentsList: React.FC = () => {
diff --git a/src/pages/User/Login/index.tsx b/src/pages/User/Login/index.tsx
index 45dd9d4..190988a 100644
--- a/src/pages/User/Login/index.tsx
+++ b/src/pages/User/Login/index.tsx
@@ -1,13 +1,6 @@
import Footer from '@/components/Footer';
import { IAjaxReturn, post } from '@/services/ajax';
-import {
- AlipayCircleOutlined,
- LockOutlined,
- MobileOutlined,
- TaobaoCircleOutlined,
- UserOutlined,
- WeiboCircleOutlined,
-} from '@ant-design/icons';
+import { LockOutlined, MobileOutlined, UserOutlined } from '@ant-design/icons';
import {
LoginForm,
ProFormCaptcha,
@@ -15,59 +8,13 @@ import {
ProFormText,
} from '@ant-design/pro-components';
import { useEmotionCss } from '@ant-design/use-emotion-css';
-import { FormattedMessage, Helmet, history, SelectLang, useModel } from '@umijs/max';
+import { FormattedMessage, Helmet, history, useModel } from '@umijs/max';
import { Alert, App, Tabs } from 'antd';
import { stringify as qsStringify } from 'qs';
import React, { useState } from 'react';
import { flushSync } from 'react-dom';
import Settings from '../../../../config/defaultSettings';
-const ActionIcons = () => {
- const langClassName = useEmotionCss(({ token }) => {
- return {
- marginLeft: '8px',
- color: 'rgba(0, 0, 0, 0.2)',
- fontSize: '24px',
- verticalAlign: 'middle',
- cursor: 'pointer',
- transition: 'color 0.3s',
- '&:hover': {
- color: token.colorPrimaryActive,
- },
- };
- });
-
- return (
- <>
-
-
-
- >
- );
-};
-
-const Lang = () => {
- const langClassName = useEmotionCss(({ token }) => {
- return {
- width: 42,
- height: 42,
- lineHeight: '42px',
- position: 'fixed',
- right: 16,
- borderRadius: token.borderRadius,
- ':hover': {
- backgroundColor: token.colorBgTextHover,
- },
- };
- });
-
- return (
-
- {SelectLang && }
-
- );
-};
-
const LoginMessage: React.FC<{
content: string;
}> = ({ content }) => {
@@ -100,17 +47,6 @@ const Login: React.FC = () => {
};
});
- const fetchUserInfo = async () => {
- const userInfo = await initialState?.fetchUserInfo?.();
- if (userInfo) {
- flushSync(() => {
- setInitialState((s) => ({
- ...s,
- currentUser: userInfo,
- }));
- });
- }
- };
const { notification } = App.useApp();
window.NotificationCF = notification;
@@ -154,24 +90,6 @@ const Login: React.FC = () => {
padding: '32px 0',
}}
>
- {/*
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- */}
{
- const [data, setData] = useState([]);
+type ICustChartItem = {
+ name: string;
+ num: number;
+ time: string;
+};
- const asyncFetch = () => {
- fetch('https://gw.alipayobjects.com/os/bmw-prod/e00d52f4-2fa6-47ee-a0d7-105dd95bde20.json')
- .then((response) => response.json())
- .then((json) => setData(json))
- .catch((error) => {
- console.log('fetch data failed', error);
- });
+type IData = {
+ overView: {
+ custs_total: number;
+ groups_members_total: number;
+ groups_total: number;
+ };
+ custsInfo: {
+ month_custs: number;
+ today_custs: number;
+ today_loss: number;
+ today_net_growth: number;
+ };
+ groupsInfo: {
+ today_diss_groups: number;
+ today_diss_groups_members: number;
+ today_groups: number;
+ today_groups_members: number;
+ };
+ custsChart: ICustChartItem[];
+ groupsChart: ICustChartItem[];
+};
+
+const Workbench: React.FC = () => {
+ const [data, setData] = useState({
+ overView: {
+ custs_total: 0,
+ groups_members_total: 0,
+ groups_total: 0,
+ },
+ custsInfo: {
+ month_custs: 0,
+ today_custs: 0,
+ today_loss: 0,
+ today_net_growth: 0,
+ },
+ groupsInfo: {
+ today_diss_groups: 0,
+ today_diss_groups_members: 0,
+ today_groups: 0,
+ today_groups_members: 0,
+ },
+ custsChart: [],
+ groupsChart: [],
+ });
+
+ const getWorkBenchInfo = () => {
+ post({ url: '/WorkBench/Info' }).then((res) => {
+ if (res.err_code == 0) {
+ if (res.over_view) {
+ data.overView = res.over_view;
+ }
+ if (res.groups_info) {
+ data.groupsInfo = res.groups_info;
+ }
+ if (res.custs_info) {
+ data.custsInfo = res.custs_info;
+ }
+ if (Array.isArray(res.custs_chart)) {
+ data.custsChart = res.custs_chart;
+ }
+ if (Array.isArray(res.groups_chart)) {
+ data.groupsChart = res.groups_chart;
+ }
+ setData({ ...data });
+ }
+ });
};
useEffect(() => {
- asyncFetch();
+ getWorkBenchInfo();
}, []);
- const [dataArea, setDataArea] = useState([
- { type: '订单数', date: '2021-02-01', value: 400 },
- { type: '订单数', date: '2021-02-05', value: 900 },
- { type: '订单数', date: '2021-02-08', value: 300 },
- { type: '收衣数', date: '2021-02-01', value: 700 },
- { type: '收衣数', date: '2021-02-05', value: 500 },
- { type: '收衣数', date: '2021-02-08', value: 1000 },
- ]);
-
return (
@@ -42,67 +96,72 @@ const Workbench: React.FC = () => {
padding: '0 24px',
}}
>
- 数据总览
- 更新时间:2022-12-12 23:30:30
+ 数据总览
+ {/* 更新时间:2022-12-12 23:30:30 */}
}
- count={111}
+ count={data.overView.custs_total}
/>
}
- count={111}
+ count={data.overView.groups_total}
/>
}
- count={111}
+ count={data.overView.groups_members_total}
/>
-
客户数据
+
客户数据
-
-
+ /> */}
+ {/* */}
+ {/*
+ /> */}
{
/>