| src/api/home/index.js | ●●●●● patch | view | raw | blame | history | |
| src/axios.js | ●●●●● patch | view | raw | blame | history | |
| src/store/modules/user.js | ●●●●● patch | view | raw | blame | history | |
| src/views/Home/components/HomeLeft/InspectionRaskDetails.vue | ●●●●● patch | view | raw | blame | history |
src/api/home/index.js
New file @@ -0,0 +1,17 @@ import request from '@/axios'; // 巡检总任务数量 export const getTotalJobNum = () => { return request({ url: '/drone-device-core/wayline/waylineJobInfo/totalJobNum', method: 'get', }); }; // 巡检任务item数量 export const getJobStatistics = () => { return request({ url: '/drone-device-core/wayline/waylineJobInfo/jobStatistics', method: 'post', }); }; src/axios.js
@@ -48,6 +48,7 @@ if (!isURL(config.url) && !config.url.startsWith(baseUrl)) { config.url = baseUrl + config.url; } config.headers['areaCode'] = store.state.user.selectedAreaCode; //安全请求header config.headers['Blade-Requested-With'] = 'BladeHttpRequest'; //headers判断是否需要 src/store/modules/user.js
@@ -25,10 +25,13 @@ import { encrypt } from '@/utils/sm2'; import md5 from 'js-md5'; const userInfoData = getStore({ name: 'userInfo' }) || {} const user = { state: { // 当前选中的请求头 selectedAreaCode: userInfoData?.detail?.areaCode || '', tenantId: getStore({ name: 'tenantId' }) || '', userInfo: getStore({ name: 'userInfo' }) || [], userInfo: userInfoData, permission: getStore({ name: 'permission' }) || {}, roles: [], menuId: {}, @@ -334,6 +337,7 @@ if (!validatenull(userInfo.oauth_id)) { userInfo.oauthId = userInfo.oauth_id; } userInfo.selectedAreaCode = userInfo?.detail?.areaCode || ''; state.userInfo = userInfo; } setStore({ name: 'userInfo', content: state.userInfo }); src/views/Home/components/HomeLeft/InspectionRaskDetails.vue
@@ -9,7 +9,7 @@ <div class="inspection-rask-details"> <div class="inspection-num"> <div class="total"> <div class="value">88</div> <div class="value">{{total}}</div> <div class="name">总任务数</div> </div> <div class="status"> @@ -29,6 +29,7 @@ import { pxToRem } from '@/utils/rem'; import CommonTitle from '@/components/CommonTitle.vue'; import CommonDateTime from '@/components/CommonDateTime.vue'; import { getJobStatistics, getTotalJobNum } from '@/api/home'; const list = ref([ { name: '计划执行', value: 89, color: '#FFFFFF' }, @@ -37,15 +38,6 @@ { name: '已执行', value: 10, color: '#8EFFAC' }, { name: '执行失败', value: 10, color: '#FF8E8E' }, ]); const detailsFun = () => { console.log('details'); }; const chartRef = ref(null); onMounted(() => { const chart = echarts.init(chartRef.value); const option = { grid: { top: '15%', @@ -147,8 +139,21 @@ ], }; chart.setOption(option); const detailsFun = () => { console.log('details'); }; const chartRef = ref(null); const total = ref(0); onMounted(() => { getTotalJobNum().then(res => { total.value = res.data?.data || 0 }) getJobStatistics().then(res => { }) const chart = echarts.init(chartRef.value); chart.setOption(option); // 监听窗口大小变化 window.addEventListener('resize', () => { chart.resize(); @@ -182,6 +187,7 @@ font-weight: 500; font-size: 14px; color: #ffffff; text-align: center; font-family: Source Han Sans CN, Source Han Sans CN; line-height: 19px; .value {