Commit 17a3b180 by zhangquan

格式化文档

1 parent 91583106
<template> <template>
<div ref="pageDom" id="pageDom" class="pageDom"> <div ref="pageDom" id="pageDom" class="pageDom">
<div class="wrap"> <div class="wrap">
<div class="title">车辆风险评估报告<div class="tip-area">报告时间:{{ getCurrentDate() }} <div class="title">
<div @click="printPage()" class="print-btn">打印</div></div></div> 车辆风险评估报告
<div class="tip-area">
报告时间:{{ getCurrentDate() }}
<div @click="printPage()" class="print-btn">打印</div>
</div>
</div>
<div class="main pie-main"> <div class="main pie-main">
<ParCharts class="pie-wrap" ref="pieChartsRef" :configObj="configObj" id="pie-chart" height="220px" :list="pieList" /> <ParCharts class="pie-wrap" ref="pieChartsRef" :configObj="configObj" id="pie-chart" height="220px" :list="pieList" />
<div class="analyze-wrap"> <div class="analyze-wrap">
<div class="info-item" v-for="(item, index) in analyzeInfoList" :key="index"> <div class="info-item" v-for="(item, index) in analyzeInfoList" :key="index">
<label class="label" for="">{{ item }}</label>: <label class="label" for="">{{ item }}</label>
<span class="value" v-if="item=='用量分析'">{{ dosageInfo.tips }}</span> :
<span class="value" v-else>{{pieList.length ? pieList[0].advise : '--'}}</span> <span class="value" v-if="item == '用量分析'">{{ dosageInfo.tips }}</span>
<span class="value" v-else>{{ pieList.length ? pieList[0].advise : '--' }}</span>
</div> </div>
</div> </div>
</div> </div>
...@@ -18,18 +24,28 @@ ...@@ -18,18 +24,28 @@
<div class="title">基本信息</div> <div class="title">基本信息</div>
<div class="main base-info-main"> <div class="main base-info-main">
<div class="info-item base-item" v-for="(item, index) in baseInfoMap" :key="index"> <div class="info-item base-item" v-for="(item, index) in baseInfoMap" :key="index">
<label class="label" for="">{{ item.label }}</label>: <label class="label" for="">{{ item.label }}</label>
<span class="value">{{baseInfoObj[item.key] || '--'}}</span> :
<span class="value">{{ baseInfoObj[item.key] || '--' }}</span>
</div> </div>
</div> </div>
</div> </div>
<div class="wrap"> <div class="wrap">
<div class="title">状态分析</div> <div class="title">状态分析</div>
<div class="main table-main"> <div class="main table-main">
<div class="desc-wrap"><div class="desc">车辆共安装 {{ deviceInfo.wiredNum + deviceInfo.wirelessNum }} 台设备,其中 {{ deviceInfo.wiredNum }} 台有线,{{ deviceInfo.wirelessNum }} 台无线,离线 {{ deviceInfo.offlineNum }} 台设备<img class="risk-img" v-if="pieList[0] && pieList[0].alarmLevel" :src="require(`@/assets/images/risk-level${pieList[0].alarmLevel}.png`)" /></div><div class="suggest"><img :src="require('@/assets/images/lamp_tip.png')" />建议电呼或者家访</div></div> <div class="desc-wrap">
<div class="desc">
车辆共安装 {{ deviceInfo.wiredNum + deviceInfo.wirelessNum }} 台设备,其中 {{ deviceInfo.wiredNum }} 台有线,{{ deviceInfo.wirelessNum }} 台无线,离线 {{ deviceInfo.offlineNum }} 台设备
<img class="risk-img" v-if="pieList[0] && pieList[0].alarmLevel" :src="require(`@/assets/images/risk-level${pieList[0].alarmLevel}.png`)" />
</div>
<div class="suggest">
<img :src="require('@/assets/images/lamp_tip.png')" />
建议电呼或者家访
</div>
</div>
<el-table :data="deviceTableData" border size="small" v-loading="loading" style="width: 100%"> <el-table :data="deviceTableData" border size="small" v-loading="loading" style="width: 100%">
<el-table-column prop="idx" label="序号" ></el-table-column> <el-table-column prop="idx" label="序号"></el-table-column>
<el-table-column prop="sn" label="设备号" ></el-table-column> <el-table-column prop="sn" label="设备号"></el-table-column>
<el-table-column prop="totalMileage" label="总里程(km)"></el-table-column> <el-table-column prop="totalMileage" label="总里程(km)"></el-table-column>
<el-table-column prop="deviceStateName" label="状态"></el-table-column> <el-table-column prop="deviceStateName" label="状态"></el-table-column>
<el-table-column prop="deviceStateStr" label="状态时长"></el-table-column> <el-table-column prop="deviceStateStr" label="状态时长"></el-table-column>
...@@ -47,7 +63,7 @@ ...@@ -47,7 +63,7 @@
<div v-for="item in stepList" class="step-item"> <div v-for="item in stepList" class="step-item">
<div class="circle"> <div class="circle">
<div class="content"> <div class="content">
<div class="name" v-for="(typeItem,typeIdx) in item.alarmTypeList" :key="typeIdx">{{ typeItem }}</div> <div class="name" v-for="(typeItem, typeIdx) in item.alarmTypeList" :key="typeIdx">{{ typeItem }}</div>
<div>{{ item.alarmTime }}</div> <div>{{ item.alarmTime }}</div>
<div v-if="item.device">{{ item.device }}</div> <div v-if="item.device">{{ item.device }}</div>
</div> </div>
...@@ -55,10 +71,16 @@ ...@@ -55,10 +71,16 @@
<div class="line"></div> <div class="line"></div>
</div> </div>
</div> </div>
<div class="suggest" style="text-align: right;"><img :src="require('@/assets/images/lamp_tip.png')" />建议电呼或者家访</div> <div class="suggest" style="text-align: right;">
<img :src="require('@/assets/images/lamp_tip.png')" />
建议电呼或者家访
</div>
</div> </div>
<div style="margin-bottom: 19px;" v-if="disTableData && disTableData.length"> <div style="margin-bottom: 19px;" v-if="disTableData && disTableData.length">
<div class="table-title">防拆报警<img class="risk-img" v-if="disTableData.length" :src="require('@/assets/images/risk-level1.png')" /></div> <div class="table-title">
防拆报警
<img class="risk-img" v-if="disTableData.length" :src="require('@/assets/images/risk-level1.png')" />
</div>
<el-table class="table" :data="disTableData" border size="small" v-loading="loading" style="width: 100%"> <el-table class="table" :data="disTableData" border size="small" v-loading="loading" style="width: 100%">
<el-table-column fixed prop="idx" label="序号" min-width="60" align="center"></el-table-column> <el-table-column fixed prop="idx" label="序号" min-width="60" align="center"></el-table-column>
<el-table-column label="设备号" prop="sn"></el-table-column> <el-table-column label="设备号" prop="sn"></el-table-column>
...@@ -68,7 +90,10 @@ ...@@ -68,7 +90,10 @@
</el-table> </el-table>
</div> </div>
<div style="margin-bottom: 19px;" v-if="sitTableData && sitTableData.length"> <div style="margin-bottom: 19px;" v-if="sitTableData && sitTableData.length">
<div class="table-title">警情研判<img class="risk-img" v-if="pieList[0] && pieList[0].alarmLevel" :src="require(`@/assets/images/risk-level${pieList[0].alarmLevel}.png`)" /></div> <div class="table-title">
警情研判
<img class="risk-img" v-if="pieList[0] && pieList[0].alarmLevel" :src="require(`@/assets/images/risk-level${pieList[0].alarmLevel}.png`)" />
</div>
<el-table class="table" :data="sitTableData" border size="small" v-loading="loading" style="width: 100%"> <el-table class="table" :data="sitTableData" border size="small" v-loading="loading" style="width: 100%">
<el-table-column fixed prop="idx" label="序号" min-width="60" align="center"></el-table-column> <el-table-column fixed prop="idx" label="序号" min-width="60" align="center"></el-table-column>
<el-table-column label="设备号" prop="sn"></el-table-column> <el-table-column label="设备号" prop="sn"></el-table-column>
...@@ -90,8 +115,20 @@ ...@@ -90,8 +115,20 @@
<div class="title">用量分析</div> <div class="title">用量分析</div>
<div class="main step-main"> <div class="main step-main">
<div class="sub-head"> <div class="sub-head">
<div class="sub-title">日均里程 <span class="active">{{dosageInfo.average}}</span> km,超过全平台 <span class="active">{{ dosageInfo.percentage }}%</span> 车主,用车天数 <span class="active">{{ dosageInfo.days }}</span> 天,用车活跃度 <span class="active">{{ dosageInfo.levelName }}</span></div> <div class="sub-title">
<div v-if="showDosage" class="suggest" style="text-align: right;"><img :src="require('@/assets/images/lamp_tip.png')" />{{ dosageInfo.tips }}</div> 日均里程
<span class="active">{{ dosageInfo.average }}</span>
km,超过全平台
<span class="active">{{ dosageInfo.percentage }}%</span>
车主,用车天数
<span class="active">{{ dosageInfo.days }}</span>
天,用车活跃度
<span class="active">{{ dosageInfo.levelName }}</span>
</div>
<div v-if="showDosage" class="suggest" style="text-align: right;">
<img :src="require('@/assets/images/lamp_tip.png')" />
{{ dosageInfo.tips }}
</div>
</div> </div>
<div class="eChart-box" id="dosage-echarts"></div> <div class="eChart-box" id="dosage-echarts"></div>
<div class="empty" v-if="!showDosage"> <div class="empty" v-if="!showDosage">
...@@ -100,16 +137,15 @@ ...@@ -100,16 +137,15 @@
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import * as echarts from 'echarts' import * as echarts from 'echarts'
import html2canvas from "html2canvas"; import html2canvas from 'html2canvas'
import { GET_ALARM_POINTLIST, GET_BASIC_INFORMATION, GET_DETAIL_DEVICE_LIST, GET_ALARM_TIME_LIST, GETCOMMONTEARDOWNSEARCH, GETJUDGMENTSEARCH, GET_RESIDENT_INFORMATION, GET_DOSAGE_ANALYSIS_DATA } from "@/api/services/monitor"; import { GET_ALARM_POINTLIST, GET_BASIC_INFORMATION, GET_DETAIL_DEVICE_LIST, GET_ALARM_TIME_LIST, GETCOMMONTEARDOWNSEARCH, GETJUDGMENTSEARCH, GET_RESIDENT_INFORMATION, GET_DOSAGE_ANALYSIS_DATA } from '@/api/services/monitor'
import ParCharts from '@/pages/monitor/ParCharts.vue'; import ParCharts from '@/pages/monitor/ParCharts.vue'
export default{ export default {
components: { ParCharts }, components: { ParCharts },
data(){ data() {
return { return {
configObj: { configObj: {
pointerColor: '#F2F2F3', pointerColor: '#F2F2F3',
...@@ -143,7 +179,8 @@ import ParCharts from '@/pages/monitor/ParCharts.vue'; ...@@ -143,7 +179,8 @@ import ParCharts from '@/pages/monitor/ParCharts.vue';
typeName: '', typeName: '',
vin: '' vin: ''
}, },
baseInfoMap: [{ baseInfoMap: [
{
label: '客户姓名', label: '客户姓名',
key: 'userName' key: 'userName'
}, },
...@@ -198,13 +235,12 @@ import ParCharts from '@/pages/monitor/ParCharts.vue'; ...@@ -198,13 +235,12 @@ import ParCharts from '@/pages/monitor/ParCharts.vue';
{ {
label: '车架号', label: '车架号',
key: 'vin' key: 'vin'
}, }
] ]
} }
}, },
mounted(){ mounted() {},
}, created() {
created(){
this.pageQuery = this.$route.query this.pageQuery = this.$route.query
const { vehicleId, vin } = this.pageQuery const { vehicleId, vin } = this.pageQuery
// this.getAlarmInformation(67755) // this.getAlarmInformation(67755)
...@@ -223,22 +259,24 @@ import ParCharts from '@/pages/monitor/ParCharts.vue'; ...@@ -223,22 +259,24 @@ import ParCharts from '@/pages/monitor/ParCharts.vue';
this.getSituationData(vin) this.getSituationData(vin)
this.getAddressData(vehicleId) this.getAddressData(vehicleId)
this.getDosageChartsData(vehicleId) this.getDosageChartsData(vehicleId)
}, },
methods: { methods: {
getCurrentDate() { getCurrentDate() {
const today = new Date(); const today = new Date()
const year = today.getFullYear().toString(); const year = today.getFullYear().toString()
const month = (today.getMonth() + 1).toString().padStart(2, '0'); const month = (today.getMonth() + 1).toString().padStart(2, '0')
const day = today.getDate().toString().padStart(2, '0'); const day = today
.getDate()
.toString()
.padStart(2, '0')
return `${year}-${month}-${day} 00:00:00`; return `${year}-${month}-${day} 00:00:00`
}, },
getDosageChartsData(vehicleId) { getDosageChartsData(vehicleId) {
GET_DOSAGE_ANALYSIS_DATA({vehicleId}).then((res) => { GET_DOSAGE_ANALYSIS_DATA({ vehicleId }).then(res => {
this.showDosage = res && res.data && res.data.mileage && res.data.mileage.length this.showDosage = res && res.data && res.data.mileage && res.data.mileage.length
if(res && res.data){ if (res && res.data) {
res.data.levelName = {1: '低风险',2: '中风险',3: '高风险'}[res.data.level] res.data.levelName = { 1: '低风险', 2: '中风险', 3: '高风险' }[res.data.level]
this.dosageInfo = res.data this.dosageInfo = res.data
let { mileage, daysOfVehicle } = res.data let { mileage, daysOfVehicle } = res.data
...@@ -275,106 +313,120 @@ import ParCharts from '@/pages/monitor/ParCharts.vue'; ...@@ -275,106 +313,120 @@ import ParCharts from '@/pages/monitor/ParCharts.vue';
// { "x": "2024-06-08", // { "x": "2024-06-08",
// "y": 5} // "y": 5}
// ] // ]
if(mileage && mileage.length){ if (mileage && mileage.length) {
let xList = mileage.map(item => item.x) let xList = mileage.map(item => item.x)
let y1DataList = mileage.map(item => item.y) let y1DataList = mileage.map(item => item.y)
let y2DataList = [,,,] let y2DataList = [, , ,]
daysOfVehicle.forEach((item,index) => { daysOfVehicle.forEach((item, index) => {
y2DataList =index<daysOfVehicle.length ? y2DataList.concat([item.y,,,,,,]):y2DataList.concat([item.y]) y2DataList = index < daysOfVehicle.length ? y2DataList.concat([item.y, , , , , ,]) : y2DataList.concat([item.y])
}); })
// y2DataList = xList.map((x, index) => ({ value: [x, y2DataList[index]] })) // y2DataList = xList.map((x, index) => ({ value: [x, y2DataList[index]] }))
let y3DataList = y1DataList.map(item => Math.max(...y1DataList)) let y3DataList = y1DataList.map(item => Math.max(...y1DataList))
this.drawLine(xList, y1DataList,y2DataList, y3DataList) this.drawLine(xList, y1DataList, y2DataList, y3DataList)
} }
} }
}); })
}, },
getDismantleData(vin){ getDismantleData(vin) {
const params = { const params = {
alarmStatus: 1, alarmStatus: 1,
keywords: vin, keywords: vin,
pageSize: 10, pageSize: 10,
pageNumber: 1 pageNumber: 1
} }
GETCOMMONTEARDOWNSEARCH(params).then((res) => { GETCOMMONTEARDOWNSEARCH(params).then(res => {
if(res && res.data && res.data.list && res.data.list.length) { if (res && res.data && res.data.list && res.data.list.length) {
let wiredList = res.data.list.filter(item => item.source==1).map((item, index) => { let wiredList =
res.data.list
.filter(item => item.source == 1)
.map((item, index) => {
return { return {
...item, ...item,
idx : `有线设备${index+1}` idx: `有线设备${index + 1}`
} }
}) || [] }) || []
let wirelessList = res.data.list.filter(item => !item.source).map((item, index) => { let wirelessList =
res.data.list
.filter(item => !item.source)
.map((item, index) => {
return { return {
...item, ...item,
idx : `无线设备${index+1}` idx: `无线设备${index + 1}`
} }
}) || [] }) || []
this.disTableData = [...wiredList, ...wirelessList] || [] this.disTableData = [...wiredList, ...wirelessList] || []
} }
}); })
}, },
getSituationData(vin){ getSituationData(vin) {
const params = { const params = {
alarmStatus: 1, alarmStatus: 1,
keywords: vin, keywords: vin,
pageSize: 10, pageSize: 10,
pageNumber: 1 pageNumber: 1
} }
GETJUDGMENTSEARCH(params).then((res) => { GETJUDGMENTSEARCH(params).then(res => {
if(res && res.data && res.data.list && res.data.list.length) { if (res && res.data && res.data.list && res.data.list.length) {
let wiredList = res.data.list.filter(item => item.source==1).map((item, index) => { let wiredList =
res.data.list
.filter(item => item.source == 1)
.map((item, index) => {
return { return {
...item, ...item,
idx : `有线设备${index+1}` idx: `有线设备${index + 1}`
} }
}) || [] }) || []
let wirelessList = res.data.list.filter(item => !item.source).map((item, index) => { let wirelessList =
res.data.list
.filter(item => !item.source)
.map((item, index) => {
return { return {
...item, ...item,
idx : `无线设备${index+1}` idx: `无线设备${index + 1}`
} }
}) || [] }) || []
this.sitTableData = [...wiredList, ...wirelessList] || [] this.sitTableData = [...wiredList, ...wirelessList] || []
} }
}); })
}, },
getAddressData(vehicleId) { getAddressData(vehicleId) {
GET_RESIDENT_INFORMATION({ vehicleId }).then((res) => { GET_RESIDENT_INFORMATION({ vehicleId }).then(res => {
let homeItem = {action: '预测家庭地址', result: '--'} let homeItem = { action: '预测家庭地址', result: '--' }
let workItem = {action: '预测工作地址', result: '--'} let workItem = { action: '预测工作地址', result: '--' }
if(res && res.data){ if (res && res.data) {
homeItem.result = res.data.homeAddress || '--' homeItem.result = res.data.homeAddress || '--'
workItem.result = res.data.workAddress || '--' workItem.result = res.data.workAddress || '--'
} }
this.addressTableData = [homeItem, workItem] this.addressTableData = [homeItem, workItem]
}); })
}, },
getTimelineData(vehicleId){ getTimelineData(vehicleId) {
GET_ALARM_TIME_LIST({ vehicleId }).then(res => { GET_ALARM_TIME_LIST({ vehicleId }).then(res => {
if(res && res.data && res.data.length) { if (res && res.data && res.data.length) {
res.data.forEach(item => {item.alarmTypeList = [item.alarmType]}) res.data.forEach(item => {
item.alarmTypeList = [item.alarmType]
})
let stepList = [] let stepList = []
if(res.data.length>2){ if (res.data.length > 2) {
this.stepList = res.data this.stepList = res.data
} }
let newList = res.data.slice(1, res.data.length - 1); let newList = res.data.slice(1, res.data.length - 1)
newList.forEach((item,index) =>{ newList.forEach((item, index) => {
const existingItem = stepList.find(newItem => (newItem.alarmTime === item.alarmTime && newItem.device === item.device)); const existingItem = stepList.find(newItem => newItem.alarmTime === item.alarmTime && newItem.device === item.device)
if (existingItem) { if (existingItem) {
existingItem.alarmTypeList.push(item.alarmType); existingItem.alarmTypeList.push(item.alarmType)
} else { } else {
stepList.push(item); stepList.push(item)
} }
}); })
this.stepList = [res.data[0], ...stepList, res.data[res.data.length-1]] this.stepList = [res.data[0], ...stepList, res.data[res.data.length - 1]]
} }
}) })
}, },
getBaseInfo(vehicleId) { getBaseInfo(vehicleId) {
GET_BASIC_INFORMATION({ vehicleId }).then(res => { GET_BASIC_INFORMATION({ vehicleId }).then(res => {
if(res && res.data) { if (res && res.data) {
for(let key in this.baseInfoObj){ for (let key in this.baseInfoObj) {
this.baseInfoObj[key] = res.data[key] this.baseInfoObj[key] = res.data[key]
} }
} }
...@@ -382,26 +434,32 @@ import ParCharts from '@/pages/monitor/ParCharts.vue'; ...@@ -382,26 +434,32 @@ import ParCharts from '@/pages/monitor/ParCharts.vue';
}, },
getDeviceListData(vehicleId) { getDeviceListData(vehicleId) {
GET_DETAIL_DEVICE_LIST({ vehicleId }).then(res => { GET_DETAIL_DEVICE_LIST({ vehicleId }).then(res => {
if(res && res.data && res.data.length) { if (res && res.data && res.data.length) {
const statusMap = {0: '行驶中', 1: '静止', 2: '离线', 3: '在线'} const statusMap = { 0: '行驶中', 1: '静止', 2: '离线', 3: '在线' }
let wiredList = res.data.filter(item => item.source==1).map((item, index) => { let wiredList =
res.data
.filter(item => item.source == 1)
.map((item, index) => {
return { return {
...item, ...item,
idx : `有线设备${index+1}`, idx: `有线设备${index + 1}`,
totalMileage : item.totalMileage ? (item.totalMileage / 1000).toFixed(3) : '--', totalMileage: item.totalMileage ? (item.totalMileage / 1000).toFixed(3) : '--',
deviceStateName : statusMap[item.deviceState] deviceStateName: statusMap[item.deviceState]
} }
}) || [] }) || []
let wirelessList = res.data.filter(item => !item.source).map((item, index) => { let wirelessList =
res.data
.filter(item => !item.source)
.map((item, index) => {
return { return {
...item, ...item,
idx : `无线设备${index+1}`, idx: `无线设备${index + 1}`,
totalMileage : '--', totalMileage: '--',
deviceStateName : statusMap[item.deviceState] deviceStateName: statusMap[item.deviceState]
} }
}) || [] }) || []
this.deviceTableData = [...wiredList, ...wirelessList] this.deviceTableData = [...wiredList, ...wirelessList]
let offlineNum = this.deviceTableData.filter(item => item.deviceState==2).length let offlineNum = this.deviceTableData.filter(item => item.deviceState == 2).length
this.deviceInfo = { this.deviceInfo = {
wiredNum: wiredList.length, wiredNum: wiredList.length,
wirelessNum: wirelessList.length, wirelessNum: wirelessList.length,
...@@ -410,68 +468,72 @@ import ParCharts from '@/pages/monitor/ParCharts.vue'; ...@@ -410,68 +468,72 @@ import ParCharts from '@/pages/monitor/ParCharts.vue';
} }
}) })
}, },
downloadFn() { downloadFn() {
let dom = document.querySelector('#sub-system-frame') let dom = document.querySelector('#sub-system-frame')
const clientWidth = dom.offsetWidth;//获取容易的宽高 const clientWidth = dom.offsetWidth //获取容易的宽高
const clientHeight = dom.offsetHeight; const clientHeight = dom.offsetHeight
let canvas = document.createElement("canvas");//创建Canvas对象 let canvas = document.createElement('canvas') //创建Canvas对象
var scale = 2;//用于渲染的比例。默认为浏览器设备像素比率 var scale = 2 //用于渲染的比例。默认为浏览器设备像素比率
canvas.width = clientWidth * scale; canvas.width = clientWidth * scale
canvas.height = clientHeight * scale; canvas.height = clientHeight * scale
const ops = { const ops = {
scale: scale, scale: scale,
width: clientWidth,//画布的宽度 width: clientWidth, //画布的宽度
height: clientHeight,//画布的高度 height: clientHeight, //画布的高度
// 跨域配置 // 跨域配置
useCORS: true, // 使用跨域 useCORS: true, // 使用跨域
allowTaint: true, // 允许使用跨域资源 allowTaint: true, // 允许使用跨域资源
tainTest: false, tainTest: false,
backgroundColor: null, backgroundColor: null
}; }
html2canvas(dom, ops).then((canvas) => { html2canvas(dom, ops).then(canvas => {
// 转成图片,生成图片地址 // 转成图片,生成图片地址
this.imgUrl = canvas.toDataURL("image/png"); this.imgUrl = canvas.toDataURL('image/png')
this.download(this.imgUrl, [canvas.width, canvas.height]); this.download(this.imgUrl, [canvas.width, canvas.height])
}); })
}, },
download(imgUrl, kh) { download(imgUrl, kh) {
this.getUrlBase64(imgUrl, kh).then((base64) => { this.getUrlBase64(imgUrl, kh).then(base64 => {
const link = document.createElement("a"); const link = document.createElement('a')
link.href = base64; link.href = base64
link.download = `车辆风险评估报告.png`; link.download = `车辆风险评估报告.png`
link.click(); link.click()
}); })
}, },
getUrlBase64(url, kh) { getUrlBase64(url, kh) {
return new Promise((resolve) => { return new Promise(resolve => {
let canvas = document.createElement("canvas"); let canvas = document.createElement('canvas')
const ctx = canvas.getContext("2d"); const ctx = canvas.getContext('2d')
const img = new Image(); const img = new Image()
img.crossOrigin = "Anonymous"; // 允许跨域 img.crossOrigin = 'Anonymous' // 允许跨域
img.src = url; img.src = url
img.onload = () => { img.onload = () => {
// eslint-disable-next-line prefer-destructuring // eslint-disable-next-line prefer-destructuring
canvas.height = kh[1]; canvas.height = kh[1]
// eslint-disable-next-line prefer-destructuring // eslint-disable-next-line prefer-destructuring
canvas.width = kh[0]; canvas.width = kh[0]
ctx.drawImage(img, 0, 0, kh[0], kh[1]); ctx.drawImage(img, 0, 0, kh[0], kh[1])
const dataURL = canvas.toDataURL("image/png"); const dataURL = canvas.toDataURL('image/png')
canvas = null; canvas = null
resolve(dataURL); resolve(dataURL)
}; }
}); })
}, },
printPage() { printPage() {
this.downloadFn() this.downloadFn()
}, },
drawLine(xList, y1DataList, y2DataList, y3DataList) { drawLine(xList, y1DataList, y2DataList, y3DataList) {
var myChart = echarts.init(document.getElementById('dosage-echarts')) var myChart = echarts.init(document.getElementById('dosage-echarts'))
let _yAxisList = xList.length < 7 ? [] : [{ let _yAxisList =
xList.length < 7
? []
: [
{
type: 'value', type: 'value',
name: '周用车天数 (天)', name: '周用车天数 (天)',
max: 7, max: 7,
min: 0, min: 0,
splitNumber:1, splitNumber: 1,
splitLine: { splitLine: {
lineStyle: { lineStyle: {
type: 'dashed' //虚线 type: 'dashed' //虚线
...@@ -494,15 +556,20 @@ downloadFn() { ...@@ -494,15 +556,20 @@ downloadFn() {
color: '#B4BCCA' color: '#B4BCCA'
} }
} }
}] }
let _otherSeries = xList.length < 7 ? [] : [ { ]
let _otherSeries =
xList.length < 7
? []
: [
{
type: 'line', type: 'line',
name: '周用车天数', name: '周用车天数',
lineStyle: { lineStyle: {
color: '#FDA886', // 设置线条颜色 color: '#FDA886' // 设置线条颜色
}, },
itemStyle: { itemStyle: {
color: '#FDA886', // 设置数据点颜色 color: '#FDA886' // 设置数据点颜色
}, },
areaStyle: { areaStyle: {
// 使用 areaStyle 来设置渐变背景 // 使用 areaStyle 来设置渐变背景
...@@ -519,21 +586,22 @@ downloadFn() { ...@@ -519,21 +586,22 @@ downloadFn() {
}, },
yAxisIndex: 1, yAxisIndex: 1,
connectNulls: true, connectNulls: true,
data: y2DataList, data: y2DataList
}, },
{ {
type: 'line', type: 'line',
symbol: 'none', symbol: 'none',
name: '上边缘', name: '上边缘',
lineStyle: { lineStyle: {
color: '#8CF5FE', // 设置线条颜色 color: '#8CF5FE' // 设置线条颜色
}, },
itemStyle: { itemStyle: {
color: '#8CF5FE', // 设置数据点颜色 color: '#8CF5FE' // 设置数据点颜色
}, },
yAxisIndex: 0, yAxisIndex: 0,
data: y3DataList data: y3DataList
}] }
]
myChart.setOption({ myChart.setOption({
title: { title: {
text: '用车量与用车天数图', text: '用车量与用车天数图',
...@@ -550,7 +618,7 @@ downloadFn() { ...@@ -550,7 +618,7 @@ downloadFn() {
} }
}, },
legend: { legend: {
data: ['日里程', '周用车天数','上边缘'], data: ['日里程', '周用车天数', '上边缘'],
left: 'right', left: 'right',
bottom: 10 bottom: 10
}, },
...@@ -560,7 +628,7 @@ downloadFn() { ...@@ -560,7 +628,7 @@ downloadFn() {
boundaryGap: false, boundaryGap: false,
splitLine: { splitLine: {
lineStyle: { lineStyle: {
type: 'dashed', type: 'dashed'
}, },
interval: 'auto', interval: 'auto',
show: true //隐藏 show: true //隐藏
...@@ -628,9 +696,9 @@ downloadFn() { ...@@ -628,9 +696,9 @@ downloadFn() {
]) ])
}, },
lineStyle: { lineStyle: {
color: '#7194F9', // 设置线条颜色 color: '#7194F9' // 设置线条颜色
}, },
yAxisIndex: 0 , yAxisIndex: 0,
data: y1DataList data: y1DataList
}, },
..._otherSeries ..._otherSeries
...@@ -642,8 +710,8 @@ downloadFn() { ...@@ -642,8 +710,8 @@ downloadFn() {
GET_ALARM_POINTLIST({ vehicleId }).then(res => { GET_ALARM_POINTLIST({ vehicleId }).then(res => {
if (res.code != 200) { if (res.code != 200) {
this.$message({ this.$message({
type: "error", type: 'error',
message: res.message, message: res.message
}) })
return return
} }
...@@ -652,54 +720,54 @@ downloadFn() { ...@@ -652,54 +720,54 @@ downloadFn() {
this.$refs.pieChartsRef.draw() this.$refs.pieChartsRef.draw()
return return
} }
_list[0].value = 1 / _list[0].alarmLevel * 100 _list[0].value = (1 / _list[0].alarmLevel) * 100
this.pieList.push(_list[0]) this.pieList.push(_list[0])
this.$refs.pieChartsRef.draw() this.$refs.pieChartsRef.draw()
}) })
},
} }
} }
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
/deep/ table{ /deep/ table {
th{ th {
background-color: #F2F4F7; background-color: #f2f4f7;
} }
tbody{ tbody {
tr:nth-child(2n){ tr:nth-child(2n) {
background-color: #F6F9FF; background-color: #f6f9ff;
} }
} }
} }
.empty{ .empty {
width: 100%; width: 100%;
height: 176px; height: 176px;
display: flex; display: flex;
background: #FFFFFF; background: #ffffff;
} }
.pageDom{ .pageDom {
background-color: #fff; background-color: #fff;
padding: 1px; padding: 1px;
} }
.table :empty::before{ .table :empty::before {
content:'--'; content: '--';
color:gray; color: gray;
} }
.wrap{ .wrap {
background-color: #fff; background-color: #fff;
margin-bottom: 16px; margin-bottom: 16px;
border: 1px solid #E5E5E5; border: 1px solid #e5e5e5;
border-radius: 4px; border-radius: 4px;
.title{ .title {
text-align: center; text-align: center;
font-weight: 600; font-weight: 600;
font-size: 16px; font-size: 16px;
color: #111111; color: #111111;
border-bottom: 1px solid #E5E5E5; border-bottom: 1px solid #e5e5e5;
height: 48px; height: 48px;
line-height: 48px; line-height: 48px;
position: relative; position: relative;
.tip-area{ .tip-area {
position: absolute; position: absolute;
top: 0; top: 0;
right: 38px; right: 38px;
...@@ -707,13 +775,13 @@ downloadFn() { ...@@ -707,13 +775,13 @@ downloadFn() {
font-size: 12px; font-size: 12px;
color: #666666; color: #666666;
.print-btn{ .print-btn {
display: inline-block; display: inline-block;
cursor: pointer; cursor: pointer;
width: 60px; width: 60px;
height: 32px; height: 32px;
line-height: 32px; line-height: 32px;
background: #0077FF; background: #0077ff;
border-radius: 4px; border-radius: 4px;
color: #fff; color: #fff;
font-size: 14px; font-size: 14px;
...@@ -721,47 +789,47 @@ downloadFn() { ...@@ -721,47 +789,47 @@ downloadFn() {
} }
} }
} }
.main{ .main {
padding: 16px 20px; padding: 16px 20px;
.suggest{ .suggest {
line-height: 22px; line-height: 22px;
font-family: PingFangSC-Regular; font-family: PingFangSC-Regular;
font-weight: 400; font-weight: 400;
font-size: 12px; font-size: 12px;
color: #111111; color: #111111;
img{ img {
width: 16px; width: 16px;
height: 16px; height: 16px;
margin-right: 8px; margin-right: 8px;
vertical-align: sub; vertical-align: sub;
} }
} }
.info-item{ .info-item {
height: 32px; height: 32px;
line-height: 32px; line-height: 32px;
font-weight: 400; font-weight: 400;
font-size: 14px; font-size: 14px;
.label{ .label {
width: 138px; width: 138px;
color: #666666; color: #666666;
text-align: right; text-align: right;
} }
.value{ .value {
color: #1D1D1D; color: #1d1d1d;
text-align: left; text-align: left;
} }
} }
} }
} }
.pie-main{ .pie-main {
display: flex; display: flex;
.pie-wrap { .pie-wrap {
width: 300px; width: 300px;
height: 270px; height: 270px;
background: #fff; background: #fff;
} }
.analyze-wrap{ .analyze-wrap {
margin-left: 55px; margin-left: 55px;
display: flex; display: flex;
justify-content: center; justify-content: center;
...@@ -769,25 +837,25 @@ downloadFn() { ...@@ -769,25 +837,25 @@ downloadFn() {
flex-direction: column; flex-direction: column;
} }
} }
.base-info-main{ .base-info-main {
.base-item{ .base-item {
width: 33%; width: 33%;
display: inline-block; display: inline-block;
} }
} }
.table-main{ .table-main {
.desc-wrap{ .desc-wrap {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin-bottom: 16px; margin-bottom: 16px;
align-items: center; align-items: center;
.desc{ .desc {
font-weight: 400; font-weight: 400;
font-size: 14px; font-size: 14px;
color: #676A6C; color: #676a6c;
line-height: 22px; line-height: 22px;
.risk-img{ .risk-img {
width: 100px; width: 100px;
height: 22px; height: 22px;
margin-left: 12px; margin-left: 12px;
...@@ -797,93 +865,92 @@ downloadFn() { ...@@ -797,93 +865,92 @@ downloadFn() {
} }
} }
.step-main{ .step-main {
.sub-head{ .sub-head {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
.sub-title{ .sub-title {
height: 20px; height: 20px;
font-family: PingFangSC-Regular; font-family: PingFangSC-Regular;
font-weight: 400; font-weight: 400;
font-size: 14px; font-size: 14px;
color: #676A6C; color: #676a6c;
margin-bottom: 16px; margin-bottom: 16px;
.active{ .active {
color: #0077FF; color: #0077ff;
} }
} }
.step-ctnr{ .step-ctnr {
padding-bottom: 16px; padding-bottom: 16px;
border-bottom: 1px dashed #eee; border-bottom: 1px dashed #eee;
margin-bottom: 40px; margin-bottom: 40px;
} }
.step-wrap{ .step-wrap {
display: flex; display: flex;
width: 100%; width: 100%;
.step-item{ .step-item {
flex: 1; flex: 1;
width: 150px; width: 150px;
height: 200px; height: 200px;
position: relative; position: relative;
&:first-child{ &:first-child {
.line{ .line {
left: 50%; left: 50%;
} }
} }
&:last-child{ &:last-child {
.line{ .line {
right: 50%; right: 50%;
} }
} }
&:nth-child(2n+1) { &:nth-child(2n + 1) {
.content{ .content {
transform: translate(-50%, calc(-100% - 16px)); transform: translate(-50%, calc(-100% - 16px));
} }
} }
&:nth-child(2n) { &:nth-child(2n) {
.content{ .content {
top: calc(100% + 16px); top: calc(100% + 16px);
transform: translateX(-50%); transform: translateX(-50%);
} }
} }
.circle{ .circle {
position: absolute; position: absolute;
width: 12px; width: 12px;
height: 12px; height: 12px;
box-sizing: border-box; box-sizing: border-box;
background: #FFFFFF; background: #ffffff;
border: 3px solid #0077FF; border: 3px solid #0077ff;
border-radius: 50%; border-radius: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
left: 50%; left: 50%;
top: 50%; top: 50%;
z-index: 1; z-index: 1;
} }
.content{ .content {
position: absolute; position: absolute;
color: #676a6c; color: #676a6c;
font-size: 14px; font-size: 14px;
font-weight: 400; font-weight: 400;
max-width: 100px; max-width: 100px;
white-space: nowrap; white-space: nowrap;
.name{ .name {
font-weight: 600; font-weight: 600;
} }
} }
.line{ .line {
height: 3px; height: 3px;
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
left: 0; left: 0;
right: 0; right: 0;
position: absolute; position: absolute;
background-color: #0077FF; background-color: #0077ff;
} }
} }
} }
.table-title{ .table-title {
width: 100%; width: 100%;
height: 48px; height: 48px;
line-height: 48px; line-height: 48px;
...@@ -891,9 +958,9 @@ downloadFn() { ...@@ -891,9 +958,9 @@ downloadFn() {
font-size: 16px; font-size: 16px;
text-align: center; text-align: center;
color: #111111; color: #111111;
background: #FBFBFB; background: #fbfbfb;
position: relative; position: relative;
.risk-img{ .risk-img {
position: absolute; position: absolute;
width: 100px; width: 100px;
height: 22px; height: 22px;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!