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 @@ @@ -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) +}