瀏覽代碼

reactor:对接首页数据;

zhangchong 1 年之前
父節點
當前提交
9124392122
共有 7 個文件被更改,包括 64 次插入96 次删除
  1. 2 2
      src/App.vue
  2. 11 1
      src/api/home/index.ts
  3. 0 26
      src/components/Auth/auth.vue
  4. 0 27
      src/components/Auth/authAll.vue
  5. 0 27
      src/components/Auth/auths.vue
  6. 0 1
      src/main.ts
  7. 51 12
      src/views/home/component/Numbers.vue

+ 2 - 2
src/App.vue

@@ -3,7 +3,7 @@
 		<el-watermark :content="watermarkText" class="h100">
 			<router-view v-show="setLockScreen" />
 			<LockScreen v-if="themeConfig.isLockScreen" />
-			<Setings ref="setTingsRef" v-show="setLockScreen" />
+			<SetTings ref="setTingsRef" v-show="setLockScreen" />
 			<CloseFull v-if="!themeConfig.isLockScreen" />
 		</el-watermark>
 	</el-config-provider>
@@ -26,7 +26,7 @@ import { getImageUrl } from '@/utils/tools';
 import { useKeepALiveNames } from '@/stores/keepAliveNames';
 // 引入组件
 const LockScreen = defineAsyncComponent(() => import('@/layout/lockScreen/index.vue'));
-const Setings = defineAsyncComponent(() => import('@/layout/navBars/breadcrumb/setings.vue'));
+const SetTings = defineAsyncComponent(() => import('@/layout/navBars/breadcrumb/setings.vue'));
 const CloseFull = defineAsyncComponent(() => import('@/layout/navBars/breadcrumb/closeFull.vue'));
 
 const route = useRoute();

+ 11 - 1
src/api/home/index.ts

@@ -37,4 +37,14 @@ export const setFastMenu = (data: object) => {
         method: 'post',
         data
     });
-};
+};
+/**
+ * @description 获取首页数据
+ * @return {*}
+ */
+export const getHomeData = () => {
+    return request({
+        url: '/api/v1/CommonP/home_data',
+        method: 'get'
+    });
+}

+ 0 - 26
src/components/Auth/auth.vue

@@ -1,26 +0,0 @@
-<template>
-  <slot v-if="getUserAuthBtnList" />
-</template>
-
-<script setup lang="ts" name="auth">
-import { computed } from 'vue';
-import { storeToRefs } from 'pinia';
-import { useUserInfo } from '@/stores/userInfo';
-
-// 定义父组件传过来的值
-const props = defineProps({
-  value: {
-    type: String,
-    default: () => '',
-  },
-});
-
-// 定义变量内容
-const stores = useUserInfo();
-const { userInfos } = storeToRefs(stores);
-
-// 获取 pinia 中的用户权限
-const getUserAuthBtnList = computed(() => {
-  return userInfos.value.authBtnList.some((v: string) => v === props.value);
-});
-</script>

+ 0 - 27
src/components/Auth/authAll.vue

@@ -1,27 +0,0 @@
-<template>
-  <slot v-if="getUserAuthBtnList" />
-</template>
-
-<script setup lang="ts" name="authAll">
-import { computed } from 'vue';
-import { storeToRefs } from 'pinia';
-import { useUserInfo } from '@/stores/userInfo';
-import { judgementSameArr } from '@/utils/arrayOperation';
-
-// 定义父组件传过来的值
-const props = defineProps({
-  value: {
-    type: Array,
-    default: () => [],
-  },
-});
-
-// 定义变量内容
-const stores = useUserInfo();
-const { userInfos } = storeToRefs(stores);
-
-// 获取 pinia 中的用户权限
-const getUserAuthBtnList = computed(() => {
-  return judgementSameArr(props.value, userInfos.value.authBtnList);
-});
-</script>

+ 0 - 27
src/components/Auth/auths.vue

@@ -1,27 +0,0 @@
-<template>
-  <slot v-if="getUserAuthBtnList" />
-</template>
-
-<script setup lang="ts" name="authAll">
-import { computed } from 'vue';
-import { storeToRefs } from 'pinia';
-import { useUserInfo } from '@/stores/userInfo';
-import { judgementSameArr } from '@/utils/arrayOperation';
-
-// 定义父组件传过来的值
-const props = defineProps({
-  value: {
-    type: Array,
-    default: () => [],
-  },
-});
-
-// 定义变量内容
-const stores = useUserInfo();
-const { userInfos } = storeToRefs(stores);
-
-// 获取 pinia 中的用户权限
-const getUserAuthBtnList = computed(() => {
-  return judgementSameArr(props.value, userInfos.value.authBtnList);
-});
-</script>

+ 0 - 1
src/main.ts

@@ -23,5 +23,4 @@ other.elSvg(app);
 // 全局组件挂载
 app.component('Pagination', Pagination);
 app.component('Empty', Empty);
-console.log(ElementPlus)
 app.use(pinia).use(router).use(ElementPlus).use(MotionPlugin).mount('#app');

+ 51 - 12
src/views/home/component/Numbers.vue

@@ -1,54 +1,66 @@
 <template>
 	<el-row :gutter="20">
 		<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="8">
-			<el-card shadow="never" v-loading="state.loading" class="statistics-item">
+			<el-card shadow="never" v-loading="loading" class="statistics-item">
 				<div class="statistics-title">
 					<img v-lazy="getImageUrl('home/Call.png')" alt="" src="" />
 					{{ userInfos.isCenter ? '今日来电' : '今日待办' }}
 				</div>
 				<div class="statistics-number">
 					<div class="statistics-number-item">
-						<p class="statistics-number-item-number"><b>520</b></p>
+						<p class="statistics-number-item-number">
+							<b> {{ userInfos.isCenter ? state.data.callNum : state.data.handleNum }} </b>
+						</p>
 						<p class="statistics-number-item-tips">{{ userInfos.isCenter ? '全部' : '我的' }}</p>
 					</div>
 					<div class="statistics-number-item">
-						<p class="statistics-number-item-number"><b>200</b></p>
+						<p class="statistics-number-item-number">
+							<b>{{ userInfos.isCenter ? state.data.validCallNum : state.data.handleOrgNum }}</b>
+						</p>
 						<p class="statistics-number-item-tips">{{ userInfos.isCenter ? '有效' : '部门' }}</p>
 					</div>
 				</div>
 			</el-card>
 		</el-col>
 		<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="8">
-			<el-card shadow="never" v-loading="state.loading" class="statistics-item">
+			<el-card shadow="never" v-loading="loading" class="statistics-item">
 				<div class="statistics-title">
 					<img v-lazy="getImageUrl('home/connectionRate.png')" alt="" src="" />
 					{{ userInfos.isCenter ? '今日接通率' : '已办' }}
 				</div>
 				<div class="statistics-number">
 					<div class="statistics-number-item">
-						<p class="statistics-number-item-number"><b>198</b></p>
+						<p class="statistics-number-item-number">
+							<b>{{ userInfos.isCenter ? state.data.answeredNum : state.data.tasksOkNum }}</b>
+						</p>
 						<p class="statistics-number-item-tips">{{ userInfos.isCenter ? '接通' : '我的' }}</p>
 					</div>
 					<div class="statistics-number-item">
-						<p class="statistics-number-item-number"><b>90%</b></p>
+						<p class="statistics-number-item-number">
+							<b>{{ userInfos.isCenter ? state.data.answeredRate : state.data.tasksOkOrgNum }}</b>
+						</p>
 						<p class="statistics-number-item-tips">{{ userInfos.isCenter ? '接通率' : '部门' }}</p>
 					</div>
 				</div>
 			</el-card>
 		</el-col>
 		<el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="8">
-			<el-card shadow="never" v-loading="state.loading" class="statistics-item">
+			<el-card shadow="never" v-loading="loading" class="statistics-item">
 				<div class="statistics-title">
 					<img v-lazy="getImageUrl('home/workOrder.png')" alt="" src="" />
 					{{ userInfos.isCenter ? '今日受理工单' : '部门超期工单' }}
 				</div>
 				<div class="statistics-number">
 					<div class="statistics-number-item">
-						<p class="statistics-number-item-number"><b>980</b></p>
+						<p class="statistics-number-item-number">
+							<b>{{ userInfos.isCenter ? state.data.orderNum : state.data.exceedTasksOkNum }}</b>
+						</p>
 						<p class="statistics-number-item-tips">{{ userInfos.isCenter ? '受理工单量' : '待办超期' }}</p>
 					</div>
 					<div class="statistics-number-item">
-						<p class="statistics-number-item-number"><b>730</b></p>
+						<p class="statistics-number-item-number">
+							<b>{{ userInfos.isCenter ? state.data.directlyNum : state.data.exceedHandleNum }}</b>
+						</p>
 						<p class="statistics-number-item-tips">{{ userInfos.isCenter ? '今日直办工单量' : '已办超期' }}</p>
 					</div>
 				</div>
@@ -58,15 +70,42 @@
 </template>
 <script setup lang="ts">
 import { getImageUrl } from '@/utils/tools';
-import { reactive } from 'vue';
+import { reactive, ref } from 'vue';
 import { storeToRefs } from 'pinia';
 import { useUserInfo } from '@/stores/userInfo';
+import { getHomeData } from '@/api/home';
 const stores = useUserInfo(); // 用户信息
 const { userInfos } = storeToRefs(stores); // 用户信息
-console.log(userInfos.value);
 const state = reactive({
-	loading: false, //头部
+	data: {
+		answeredNum: 0, // 今日来电
+		answeredRate: 0, // 今日接通率
+		callNum: 0, // 今日来电
+		directlyNum: 0, // 今日直办
+		orderNum: 0, // 今日受理工单
+		validCallNum: 0, // 今日有效来电
+		exceedHandleNum: 0, // 超期办理工单
+		exceedTasksOkNum: 0, // 超期办结工单
+		handleNum: 0, // 已办工单
+		handleOrgNum: 0, // 部门已办工单
+		tasksOkNum: 0, // 已办结工单
+		tasksOkOrgNum: 0, // 部门已办结工单
+	},
 });
+const loading = ref(false);
+// 获取首页数据
+const getHomeDataFn = async () => {
+	loading.value = true;
+	try {
+		const { result } = await getHomeData();
+		state.data = result;
+	} catch (error) {
+		console.log(error);
+	} finally {
+		loading.value = false;
+	}
+};
+getHomeDataFn();
 </script>
 <style scoped lang="scss">
 .statistics {