From c8ace90b43d8c0e8ebc97837ad6d2a82f9cbdd89 Mon Sep 17 00:00:00 2001
From: kaeery <3491123437@qq.com>
Date: Wed, 5 Mar 2025 19:14:58 +0800
Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=8B=9B=E7=94=9F=E5=B0=8F=E7=A8=8B?=
=?UTF-8?q?=E5=BA=8F=E3=80=91=20=E6=96=B0=E5=A2=9E#=20=E4=B8=BB=E8=B4=A6?=
=?UTF-8?q?=E5=8F=B7-=E5=9B=A2=E9=98=9F=EF=BC=9A=E5=AF=B9=E6=8E=A5?=
=?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=AE=80=E6=8A=A5=E3=80=81=E7=BA=BF=E7=B4=A2?=
=?UTF-8?q?=E8=BD=AC=E5=8C=96=E6=83=85=E5=86=B5=E5=88=86=E6=9E=90=E6=8E=A5?=
=?UTF-8?q?=E5=8F=A3=E4=BB=A5=E5=8F=8A=E6=9D=A1=E4=BB=B6=E6=9F=A5=E8=AF=A2?=
=?UTF-8?q?=EF=BC=88=E5=9B=A2=E9=98=9F=E3=80=81=E7=BB=84=E7=BB=87=E3=80=81?=
=?UTF-8?q?=E6=97=A5=E6=9C=9F=EF=BC=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.env.development | 1 +
src/api/admin.ts | 31 +++
src/bundle/pages/login/login.vue | 2 +-
src/components/da-dropdown/utils.ts | 2 +-
src/components/date-dropdown/daterange.vue | 13 +-
src/components/select-dropdown/index.vue | 197 ++++++++++++++++++
src/components/widgets/admin/orga-picker.vue | 7 +-
.../personally/components/telesale-card.vue | 4 +-
.../widgets/admin/personally/index.vue | 63 +++---
.../admin/team/components/clue-status.vue | 31 ++-
.../team/components/converted-overview.vue | 3 +-
.../admin/team/components/data-overview.vue | 35 ++--
src/components/widgets/admin/team/index.vue | 151 ++++++++++----
src/hooks/useCommon.ts | 3 +-
src/hooks/useRoleData.ts | 2 +-
src/pages.json | 14 +-
src/pages/index/index.vue | 6 +-
src/utils/util.ts | 9 +
18 files changed, 466 insertions(+), 108 deletions(-)
create mode 100644 src/api/admin.ts
create mode 100644 src/components/select-dropdown/index.vue
diff --git a/.env.development b/.env.development
index da6b919..d4b3d31 100644
--- a/.env.development
+++ b/.env.development
@@ -8,5 +8,6 @@
# 请求域名
# VITE_APP_BASE_URL= 'http://192.168.111.5:8086'
VITE_APP_BASE_URL="http://192.168.111.98:8086"
+# VITE_APP_BASE_URL="http://f35n565161.vicp.fun"
# VITE_APP_BASE_URL="https://124.220.209.120:8086"
# VITE_APP_SOCKET_URL = 'wss://front.yuegoodlife.com'
\ No newline at end of file
diff --git a/src/api/admin.ts b/src/api/admin.ts
new file mode 100644
index 0000000..e2ed477
--- /dev/null
+++ b/src/api/admin.ts
@@ -0,0 +1,31 @@
+import request from '@/utils/request'
+
+// 组织列表
+export function apiOrganizationList() {
+ return request.get({ url: '/organization/list' })
+}
+// 获取所有团队
+export function apiOrganizationTeamList() {
+ return request.get({ url: '/organization/getAllGroup' })
+}
+// 获取组织
+export function apiOrganizationByIdList() {
+ return request.get({ url: '/organization/getAllOrg' })
+}
+// 获取该账号下的所有组织架构以及人员
+export function apiOrganizationAllList() {
+ return request.get({ url: '/organization/getAllChildOrgInfo' })
+}
+
+// 数据简报
+export function apiDataOverview(params: any) {
+ return request.get({ url: '/control/dataPresentation', data: params })
+}
+// 线索转客户统计
+export function convertProcessApi(params?: any) {
+ return request.get({ url: '/control/leadToCustomerStatistics', data: params })
+}
+// 线索转化情况统计
+export function clueStatusApi(params?: any) {
+ return request.get({ url: '/control/clueStatistics', data: params })
+}
diff --git a/src/bundle/pages/login/login.vue b/src/bundle/pages/login/login.vue
index 98fdbf0..30c5acc 100644
--- a/src/bundle/pages/login/login.vue
+++ b/src/bundle/pages/login/login.vue
@@ -235,7 +235,7 @@ async function loginHandle(data: any) {
// appStore.setFirstLogin(true)
const { userInfo } = userStore
// 判断是主账号登录还是电销/招生登录
- if (userInfo.postIds == 0) {
+ if (userInfo.postIds == 0 && userInfo.masterAccount == 1) {
cache.set(ROLEINDEX, 2)
setNextRoute()
} else {
diff --git a/src/components/da-dropdown/utils.ts b/src/components/da-dropdown/utils.ts
index 75927d7..2e375c1 100644
--- a/src/components/da-dropdown/utils.ts
+++ b/src/components/da-dropdown/utils.ts
@@ -144,7 +144,7 @@ export function getRangeDate(v) {
// 昨日
if (v === '-1') {
- dateRange.start = formatTime(new Date(nowTime - oneDay), 'y-m-d')
+ dateRange.start = formatTime(new Date(nowTime), 'y-m-d')
dateRange.end = dateRange.start
// 本周
} else if (v === '-7') {
diff --git a/src/components/date-dropdown/daterange.vue b/src/components/date-dropdown/daterange.vue
index 6e28e95..3851574 100644
--- a/src/components/date-dropdown/daterange.vue
+++ b/src/components/date-dropdown/daterange.vue
@@ -36,9 +36,10 @@
+
+
diff --git a/src/components/widgets/admin/orga-picker.vue b/src/components/widgets/admin/orga-picker.vue
index 3eb17c5..26aad10 100644
--- a/src/components/widgets/admin/orga-picker.vue
+++ b/src/components/widgets/admin/orga-picker.vue
@@ -4,7 +4,7 @@
diff --git a/src/components/widgets/admin/personally/components/telesale-card.vue b/src/components/widgets/admin/personally/components/telesale-card.vue
index 6855995..ea70703 100644
--- a/src/components/widgets/admin/personally/components/telesale-card.vue
+++ b/src/components/widgets/admin/personally/components/telesale-card.vue
@@ -62,7 +62,7 @@ const emit = defineEmits(['handleCardClick'])
const parsePostionText = computed(() => {
const { postId } = props.item
- const ids = postId.split(',')
+ const ids = postId?.split(',')
const positionsList = [
{ name: '电销老师', id: 5 },
{ name: '招生老师', id: 6 }
@@ -93,7 +93,7 @@ const data = computed(() => {
})
const parsePostIds = computed(() => {
const { postId } = props.item
- return postId.split(',').map(Number)
+ return postId?.split(',').map(Number)
})
const containPostIds = computed(() => {
return parsePostIds.value.includes(5) && parsePostIds.value.includes(6)
diff --git a/src/components/widgets/admin/personally/index.vue b/src/components/widgets/admin/personally/index.vue
index 5859aa9..2f0cd22 100644
--- a/src/components/widgets/admin/personally/index.vue
+++ b/src/components/widgets/admin/personally/index.vue
@@ -14,7 +14,7 @@
handleReset('organization')"
@confirm="value => handleConfirm('organization', value)"
/>
@@ -55,6 +55,7 @@ import telesaleCard from './components/telesale-card.vue'
import dateDropdownPicker from '@/components/date-dropdown/daterange.vue'
import { useZPaging } from '@/hooks/useZPaging'
import { apiTeleClueList } from '@/api/clue'
+import { apiOrganizationAllList } from '@/api/admin'
const dropdownMenuList2 = {
showQuick: true,
@@ -65,31 +66,7 @@ const dropdownMenuList2 = {
// value: { start: '2022-01-01', end: '2022-02-01' },
}
const postId = ref()
-const dropdownMenuList = [
- {
- label: '级联X1',
- value: '1',
- children: [
- {
- label: '级联X11',
- value: '11',
- children: [
- { label: '级联X111', value: '111' },
- { label: '级联X122', value: '122' }
- ]
- },
- { label: '级联X12', value: '12' }
- ]
- },
- {
- label: '级联X2',
- value: '2',
- children: [
- { label: '级联X21', value: '21' },
- { label: '级联X22', value: '22' }
- ]
- }
-]
+const dropdownMenuOrgList = ref([])
const queryParams = ref({
likeWork: ''
@@ -140,6 +117,40 @@ const handleReset = (type: string) => {
break
}
}
+const fetchAllOrganizationList = async () => {
+ try {
+ const result = await apiOrganizationAllList()
+ dropdownMenuOrgList.value = renameFields(result)
+ console.log(dropdownMenuOrgList.value)
+ } catch (error) {}
+}
+const renameFields = (data: any[]): any[] => {
+ return data.map(item => {
+ const newItem = { ...item }
+ newItem.label = item.name
+ newItem.value = item.id
+ if (newItem.organizationVoList) {
+ newItem.children = renameFields(newItem.organizationVoList)
+ delete newItem.organizationVoList
+ }
+ if (newItem.userVos) {
+ newItem.userVos.forEach(item => {
+ item.label = item.username
+ item.value = item.id
+ })
+ newItem.children = newItem.children
+ ? [...newItem.children, ...newItem.userVos]
+ : newItem.userVos
+ delete newItem.userVos
+ }
+ if (!newItem.children.length) {
+ newItem.disabled = true
+ }
+ return newItem
+ })
+}
+
+fetchAllOrganizationList()
diff --git a/src/components/widgets/admin/team/components/clue-status.vue b/src/components/widgets/admin/team/components/clue-status.vue
index 01c6ce5..5a95547 100644
--- a/src/components/widgets/admin/team/components/clue-status.vue
+++ b/src/components/widgets/admin/team/components/clue-status.vue
@@ -29,6 +29,8 @@
diff --git a/src/hooks/useCommon.ts b/src/hooks/useCommon.ts
index 98e05f2..a61cc7e 100644
--- a/src/hooks/useCommon.ts
+++ b/src/hooks/useCommon.ts
@@ -1,4 +1,5 @@
import { apiCluseDetail } from '@/api/clue'
+import { IForm } from '@/components/widgets/admin/team/index.vue'
import { computed, ref, shallowRef } from 'vue'
// 获取线索详情
@@ -72,7 +73,7 @@ export function useRank({ width }: { width: number }) {
resolve(tabs.value)
})
}
- const fetchData = async () => {
+ const fetchData = async (payload: IForm) => {
await fetchTabs()
console.log(activeTab.value)
loading.value = true
diff --git a/src/hooks/useRoleData.ts b/src/hooks/useRoleData.ts
index 998534b..9b1734e 100644
--- a/src/hooks/useRoleData.ts
+++ b/src/hooks/useRoleData.ts
@@ -120,7 +120,7 @@ export const setNextRoute = () => {
const { userInfo } = userStore
const ind = cache.get(ROLEINDEX) || 0
const obj = roles[ind]
- if (userInfo.postIds == 0 && obj.ids.length == 0) {
+ if (userInfo.postIds == 0 && obj.ids.length == 0 && userInfo.masterAccount == 1) {
tabBarStore.setTabBarList(obj.tabBarList)
uni.reLaunch({
url: obj.tabBarList[0].path
diff --git a/src/pages.json b/src/pages.json
index 76e715a..fc47931 100644
--- a/src/pages.json
+++ b/src/pages.json
@@ -1,12 +1,5 @@
{
"pages": [
- {
- "path": "pages/admin/home/index",
- "style": {
- "navigationBarTitleText": ""
- }
- },
-
{
"path": "pages/index/index",
"style": {
@@ -14,6 +7,13 @@
"navigationStyle": "custom"
}
},
+ {
+ "path": "pages/admin/home/index",
+ "style": {
+ "navigationBarTitleText": ""
+ }
+ },
+
{
"path": "pages/telesale/home/index",
"style": {
diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue
index c2353fb..92132be 100644
--- a/src/pages/index/index.vue
+++ b/src/pages/index/index.vue
@@ -14,9 +14,9 @@ onLoad(() => {
// 已经登录 => 首页
setNextRoute()
} else {
- // uni.navigateTo({
- // url: '/bundle/pages/login/login'
- // })
+ uni.navigateTo({
+ url: '/bundle/pages/login/login'
+ })
}
})
diff --git a/src/utils/util.ts b/src/utils/util.ts
index d9c88df..94f6a63 100644
--- a/src/utils/util.ts
+++ b/src/utils/util.ts
@@ -397,3 +397,12 @@ export function throttle(fn: any, gapTime: number) {
}
}
}
+// 获取今天
+export function getCurDate(type: string, format = 'YYYY-MM-DD HH:mm:ss') {
+ return formateDate('today', type, format)
+}
+// 格式化日期
+export function formateDate(value: string, type: string, format = 'YYYY-MM-DD HH:mm:ss') {
+ const date = value == 'today' ? dayjs() : dayjs(value)
+ return type == 'start' ? date.startOf('day').format(format) : date.endOf('day').format(format)
+}