Commit cbbf4db0 by zhangquan

页面开发

1 parent 738effea
...@@ -1536,6 +1536,11 @@ ...@@ -1536,6 +1536,11 @@
} }
} }
}, },
"base64-arraybuffer": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz",
"integrity": "sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ=="
},
"base64-js": { "base64-js": {
"version": "1.3.0", "version": "1.3.0",
"resolved": "http://registry.npm.taobao.org/base64-js/download/base64-js-1.3.0.tgz", "resolved": "http://registry.npm.taobao.org/base64-js/download/base64-js-1.3.0.tgz",
...@@ -2862,6 +2867,14 @@ ...@@ -2862,6 +2867,14 @@
"integrity": "sha1-gIrcLnnPhHOAabZGyyDsJ762KeA=", "integrity": "sha1-gIrcLnnPhHOAabZGyyDsJ762KeA=",
"dev": true "dev": true
}, },
"css-line-break": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/css-line-break/-/css-line-break-2.1.0.tgz",
"integrity": "sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==",
"requires": {
"utrie": "^1.0.2"
}
},
"css-loader": { "css-loader": {
"version": "0.28.11", "version": "0.28.11",
"resolved": "http://registry.npm.taobao.org/css-loader/download/css-loader-0.28.11.tgz", "resolved": "http://registry.npm.taobao.org/css-loader/download/css-loader-0.28.11.tgz",
...@@ -6239,6 +6252,15 @@ ...@@ -6239,6 +6252,15 @@
} }
} }
}, },
"html2canvas": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/html2canvas/-/html2canvas-1.4.1.tgz",
"integrity": "sha512-fPU6BHNpsyIhr8yyMpTLLxAbkaK8ArIBcmZIRiBLiDhjeqvXolaEmDGmELFuX9I4xDcaKKcJl+TKZLqruBbmWA==",
"requires": {
"css-line-break": "^2.1.0",
"text-segmentation": "^1.0.3"
}
},
"htmlparser2": { "htmlparser2": {
"version": "3.10.1", "version": "3.10.1",
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz",
...@@ -12827,6 +12849,14 @@ ...@@ -12827,6 +12849,14 @@
} }
} }
}, },
"text-segmentation": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/text-segmentation/-/text-segmentation-1.0.3.tgz",
"integrity": "sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==",
"requires": {
"utrie": "^1.0.2"
}
},
"text-table": { "text-table": {
"version": "0.2.0", "version": "0.2.0",
"resolved": "http://registry.npm.taobao.org/text-table/download/text-table-0.2.0.tgz", "resolved": "http://registry.npm.taobao.org/text-table/download/text-table-0.2.0.tgz",
...@@ -13401,6 +13431,14 @@ ...@@ -13401,6 +13431,14 @@
"integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=",
"dev": true "dev": true
}, },
"utrie": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/utrie/-/utrie-1.0.2.tgz",
"integrity": "sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==",
"requires": {
"base64-arraybuffer": "^1.0.2"
}
},
"uuid": { "uuid": {
"version": "3.4.0", "version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
"element-ui": "^2.13.2", "element-ui": "^2.13.2",
"es6-promise": "^4.2.4", "es6-promise": "^4.2.4",
"font-awesome": "^4.7.0", "font-awesome": "^4.7.0",
"html2canvas": "^1.4.1",
"moment": "^2.22.0", "moment": "^2.22.0",
"node-sass": "^7.0.1", "node-sass": "^7.0.1",
"qs": "^6.5.1", "qs": "^6.5.1",
......
...@@ -69,8 +69,8 @@ ...@@ -69,8 +69,8 @@
<div class="right-box" v-show="boxShow"> <div class="right-box" v-show="boxShow">
<!-- 用车行为分析 --> <!-- 用车行为分析 -->
<div class="use-car-box"> <div class="use-car-box">
<div class="title">用车行为分析</div> <div class="title">用车行为分析<div class="detail-btn" @click="goDetailPage()">风险评估详情</div></div>
<div class="x-name"><span>{{ linetype== 1 ? '周' : '天' }}</span><span v-if="lineChartsYear">-{{ lineChartsYear }}年</span></div> <div class="x-name" v-if="xAxisDataList.length"><span>{{ linetype== 1 ? '周' : '天' }}</span><span v-if="lineChartsYear">-{{ lineChartsYear }}年</span></div>
<div class="line-charts" v-if="xAxisDataList.length"> <div class="line-charts" v-if="xAxisDataList.length">
<LineCharts id="useCarCharts" ref="useCarChartsRef" height="250px" :linetype="linetype" :dataList="useCarData" <LineCharts id="useCarCharts" ref="useCarChartsRef" height="250px" :linetype="linetype" :dataList="useCarData"
:xAxisData="xAxisDataList" :lineChartsYear="lineChartsYear"></LineCharts> :xAxisData="xAxisDataList" :lineChartsYear="lineChartsYear"></LineCharts>
...@@ -181,6 +181,9 @@ export default { ...@@ -181,6 +181,9 @@ export default {
}, },
methods: { methods: {
goDetailPage() {
this.$router.push({name:'riskAssessDetail'})
},
resetWidth() { resetWidth() {
const homePage = document.querySelector('.desktop-left-sider'); const homePage = document.querySelector('.desktop-left-sider');
// 创建 ResizeObserver 对象 // 创建 ResizeObserver 对象
...@@ -593,6 +596,21 @@ export default { ...@@ -593,6 +596,21 @@ export default {
top: 10px; top: 10px;
right: 26px; right: 26px;
z-index: 9999; z-index: 9999;
.title{
display: flex;
align-items: center;
justify-content: space-between;
.detail-btn{
cursor: pointer;
width: 116px;
text-align: center;
color: #fff;
height: 32px;
line-height: 32px;
background: #0077FF;
border-radius: 4px;
}
}
} }
.detail-box { .detail-box {
...@@ -669,7 +687,7 @@ export default { ...@@ -669,7 +687,7 @@ export default {
color: #6e7079; color: #6e7079;
position: absolute; position: absolute;
right: 20px; right: 20px;
top: 30px; top: 50px;
} }
.title { .title {
font-weight: 500; font-weight: 500;
......
<template>
<div ref="pageDom" id="pageDom" class="pageDom">
<div class="wrap">
<div class="title">车辆风险评估报告<div class="tip-area">报告时间:2024-05-28 00:000:00
<div @click="printPage()" class="print-btn">打印</div></div></div>
<div class="main pie-main">
<ParCharts class="pie-wrap" ref="pieChartsRef" id="pie-chart" height="220px" :list="pieList" />
<div class="analyze-wrap">
<div class="info-item" v-for="(item, index) in analyzeInfoList" :key="index">
<label class="label" for="">{{ item.label }}</label>:
<span class="value">仲利国际租赁有限公司</span>
</div>
</div>
</div>
</div>
<div class="wrap">
<div class="title">基本信息</div>
<div class="main base-info-main">
<div class="info-item base-item" v-for="(item, index) in baseInfoMap" :key="index">
<label class="label" for="">{{ item.label }}</label>:
<span class="value">仲利国际租赁有限公司</span>
</div>
</div>
</div>
<div class="wrap">
<div class="title">状态分析</div>
<div class="main table-main">
<div class="desc-wrap"><div class="desc">车辆共安装 8 台设备,其中 3 台有线,5 台无线,离线 1 台设备<img class="risk-img" :src="require('@/assets/images/risk-level1.png')" /></div><div class="suggest"><img :src="require('@/assets/images/lamp_tip.png')" />建议电呼或者家访</div></div>
<el-table :data="tableData" border size="small" v-loading="loading" style="width: 100%">
<el-table-column fixed prop="vin" label="序号" min-width="60" align="center"></el-table-column>
<el-table-column fixed prop="vin" label="设备号" min-width="60" align="center"></el-table-column>
<el-table-column fixed prop="vin" label="总里程(km)" min-width="160" align="center"></el-table-column>
<el-table-column fixed prop="vin" label="状态" min-width="160" align="center"></el-table-column>
<el-table-column fixed prop="vin" label="状态时长" min-width="160" align="center"></el-table-column>
<el-table-column fixed prop="vin" label="最后定位时间" min-width="160" align="center"></el-table-column>
<el-table-column fixed prop="vin" label="最后定位地址" min-width="160" align="center"></el-table-column>
</el-table>
</div>
</div>
<div class="wrap">
<div class="title">预警分析</div>
<div class="main step-main">
<div class="sub-title">各项预警最新预警时间、录入时间与最后定位时间时间轴</div>
<div class="step-ctnr">
<div class="step-wrap">
<div v-for="item in stepList" class="step-item">
<div class="circle">
<div class="content">
<div class="name">{{ item.name }}</div>
<div>{{ item.date }}</div>
<div>{{ item.time }}</div>
<div>{{ item.deviceName }}</div>
</div>
</div>
<div class="line"></div>
</div>
</div>
<div class="suggest" style="text-align: right;"><img :src="require('@/assets/images/lamp_tip.png')" />建议电呼或者家访</div>
</div>
<div>
<div class="table-title">防拆报警<img class="risk-img" :src="require('@/assets/images/risk-level1.png')" /></div>
<el-table :data="tableData" border size="small" v-loading="loading" style="width: 100%">
<el-table-column fixed prop="vin" label="序号" min-width="60" align="center"></el-table-column>
<el-table-column fixed prop="vin" label="设备号" min-width="60" align="center"></el-table-column>
<el-table-column fixed prop="vin" label="总里程(km)" min-width="160" align="center"></el-table-column>
<el-table-column fixed prop="vin" label="状态" min-width="160" align="center"></el-table-column>
<el-table-column fixed prop="vin" label="状态时长" min-width="160" align="center"></el-table-column>
<el-table-column fixed prop="vin" label="最后定位时间" min-width="160" align="center"></el-table-column>
<el-table-column fixed prop="vin" label="最后定位地址" min-width="160" align="center"></el-table-column>
</el-table>
</div>
</div>
</div>
<div class="wrap">
<div class="title">用量分析</div>
<div class="main step-main">
<div class="sub-head">
<div class="sub-title">日均里程 <span class="active">189</span> km,超过全平台 <span class="active">189</span> 车主,用车天数 <span class="active">189</span> 天,用车活跃度 <span class="active">189</span></div>
<div class="suggest" style="text-align: right;"><img :src="require('@/assets/images/lamp_tip.png')" />重点观察</div>
</div>
<div class="eChart-box" id="dosage-echarts"></div>
</div>
</div>
</div>
</template>
<script>
import * as echarts from 'echarts'
import html2canvas from "html2canvas";
import { GET_ALARM_POINTLIST } from "@/api/services/monitor";
import ParCharts from '@/pages/monitor/ParCharts.vue';
export default{
components: { ParCharts },
data(){
return {
pieList: [],
stepList: [
{
name: '录入时间',
date: '2024-05-29',
time: '13:36:52',
deviceName: '设备1'
},
{
name: '录入时间',
date: '2024-05-29',
time: '13:36:52',
deviceName: '设备1'
},
{
name: '录入时间',
date: '2024-05-29',
time: '13:36:52',
deviceName: '设备1'
},
{
name: '录入时间',
date: '2024-05-29',
time: '13:36:52',
deviceName: '设备1'
},
{
name: '录入时间',
date: '2024-05-29',
time: '13:36:52',
deviceName: '设备1'
}
],
analyzeInfoList: [
{
label: '状态分析',
key: '展示类表单/文本域'
},
{
label: '预警分析',
key: '要求客户提供车辆位置情况'
},
{
label: '用量分析',
key: '继续观察/重点观察/建议电呼,核实用车行为'
},
],
baseInfoMap: [{
label: '客户姓名',
key: ''
},
{
label: '店面名称',
key: ''
},
{
label: '承租人姓名',
key: ''
},
{
label: '联系电话',
key: ''
},
{
label: '证件号',
key: ''
},
{
label: '安装城市',
key: ''
},
{
label: '工单创建时间',
key: ''
},
{
label: '业务工单号',
key: ''
},
{
label: '品牌',
key: ''
},
{
label: '车系',
key: ''
},
{
label: '车型',
key: ''
},
{
label: '贷款额',
key: ''
},
{
label: '车辆价格',
key: ''
},
{
label: '车架号',
key: ''
},
]
}
},
mounted(){
this.drawLine()
},
created(){
this.getAlarmInformation(73970)
},
methods: {
downloadFn() {
let dom = document.querySelector('#sub-system-frame')
const clientWidth = dom.offsetWidth;//获取容易的宽高
const clientHeight = dom.offsetHeight;
let canvas = document.createElement("canvas");//创建Canvas对象
var scale = 2;//用于渲染的比例。默认为浏览器设备像素比率
canvas.width = clientWidth * scale;
canvas.height = clientHeight * scale;
const ops = {
scale: scale,
width: clientWidth,//画布的宽度
height: clientHeight,//画布的高度
// 跨域配置
useCORS: true, // 使用跨域
allowTaint: true, // 允许使用跨域资源
tainTest: false,
backgroundColor: null,
};
html2canvas(dom, ops).then((canvas) => {
// 转成图片,生成图片地址
this.imgUrl = canvas.toDataURL("image/png");
this.download(this.imgUrl, [canvas.width, canvas.height]);
});
},
download(imgUrl, kh) {
this.getUrlBase64(imgUrl, kh).then((base64) => {
const link = document.createElement("a");
link.href = base64;
link.download = `图片.png`;
link.click();
});
},
getUrlBase64(url, kh) {
return new Promise((resolve) => {
let canvas = document.createElement("canvas");
const ctx = canvas.getContext("2d");
const img = new Image();
img.crossOrigin = "Anonymous"; // 允许跨域
img.src = url;
img.onload = () => {
// eslint-disable-next-line prefer-destructuring
canvas.height = kh[1];
// eslint-disable-next-line prefer-destructuring
canvas.width = kh[0];
ctx.drawImage(img, 0, 0, kh[0], kh[1]);
const dataURL = canvas.toDataURL("image/png");
canvas = null;
resolve(dataURL);
};
});
},
printPage() {
this.downloadFn()
},
drawLine(xList, yList, lineList) {
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('dosage-echarts'))
// 绘制图表
const colors = ['#5470C6', '#91CC75', '#EE6666'];
myChart.setOption({
title: {
text: '用车量与用车天数图',
left: 'center',
textStyle: {
color: '#909AAA',
fontSize: 14
}
},
color: colors,
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross'
}
},
xAxis: [
{
type: 'category',
boundaryGap: false,
splitLine: {
lineStyle: {
type: 'dashed',
},
interval: 'auto',
show: true //隐藏
},
axisLine: {
show: true,
lineStyle: {
color: '#F5F7FF'
}
},
axisLabel: {
textStyle: {
color: '#B4BCCA'
}
},
// prettier-ignore
data: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
}
],
yAxis: [
{
type: 'value',
name: '日里程 (km)',
nameTextStyle: {
color: '#B4BCCA'
},
alignTicks: true,
splitLine: {
lineStyle: {
type: 'dashed' //虚线
},
show: false //隐藏
},
axisLine: {
show: true,
lineStyle: {
color: '#F5F7FF'
}
},
axisLabel: {
formatter: '{value} ml',
textStyle: {
color: '#B4BCCA'
}
}
},
{
type: 'value',
name: '周用车天数 (天)',
splitLine: {
lineStyle: {
type: 'dashed' //虚线
},
show: true //隐藏
},
nameTextStyle: {
color: '#B4BCCA'
},
position: 'right',
alignTicks: true,
axisLine: {
show: true,
lineStyle: {
color: '#F5F7FF'
}
},
axisLabel: {
formatter: '{value} ml',
textStyle: {
color: '#B4BCCA'
}
}
}
],
series: [
{
type: 'line',
areaStyle: {
// 使用 areaStyle 来设置渐变背景
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: 'rgba(88, 80, 255, 0.5)'
}, // 渐变起始颜色
{
offset: 1,
color: 'rgba(145, 136, 255, 0)'
} // 渐变结束颜色
])
},
data: [2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3]
},
{
type: 'line',
areaStyle: {
// 使用 areaStyle 来设置渐变背景
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: 'rgba(88, 344, 255, 0.5)'
}, // 渐变起始颜色
{
offset: 1,
color: 'rgba(145, 136, 255, 0)'
} // 渐变结束颜色
])
},
yAxisIndex: 1,
data: [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3]
}
]
})
},
// 设备警情数据查询
getAlarmInformation(vehicleId) {
GET_ALARM_POINTLIST({ vehicleId }).then(res => {
if (res.code != 200) {
this.$message({
type: "error",
message: res.message,
})
return
}
let _list = res.data
if (_list.length === 0) {
this.$refs.pieChartsRef.draw()
return
}
_list[0].value = 1 / _list[0].alarmLevel * 100
this.pieList.push(_list[0])
this.$refs.pieChartsRef.draw()
})
},
}
}
</script>
<style lang="scss" scoped>
.pageDom{
background-color: #F9F9F9;
}
.wrap{
background-color: #fff;
margin-bottom: 16px;
box-shadow: 0 0 4px 0 #00000033;
border-radius: 4px;
.title{
text-align: center;
font-weight: 600;
font-size: 16px;
color: #111111;
border-bottom: 1px solid #E5E5E5;
height: 48px;
line-height: 48px;
position: relative;
.tip-area{
position: absolute;
top: 0;
right: 38px;
font-weight: 400;
font-size: 12px;
color: #666666;
.print-btn{
display: inline-block;
cursor: pointer;
width: 60px;
height: 32px;
line-height: 32px;
background: #0077FF;
border-radius: 4px;
color: #fff;
font-size: 14px;
margin-left: 16px;
}
}
}
.main{
padding: 16px 20px;
.suggest{
line-height: 22px;
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 12px;
color: #111111;
img{
width: 16px;
height: 16px;
margin-right: 8px;
vertical-align: sub;
}
}
.info-item{
height: 32px;
line-height: 32px;
font-weight: 400;
font-size: 14px;
.label{
width: 138px;
color: #666666;
text-align: right;
}
.value{
color: #1D1D1D;
text-align: left;
}
}
}
}
.pie-main{
display: flex;
.pie-wrap {
width: 300px;
height: 270px;
background: #fff;
box-shadow: 0 4px 6px 0 #00000014;
}
.analyze-wrap{
margin-left: 55px;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
}
.base-info-main{
.base-item{
width: 33%;
display: inline-block;
}
}
.table-main{
.desc-wrap{
display: flex;
justify-content: space-between;
margin-bottom: 16px;
align-items: center;
.desc{
font-weight: 400;
font-size: 14px;
color: #676A6C;
line-height: 22px;
.risk-img{
width: 100px;
height: 22px;
margin-left: 12px;
vertical-align: middle;
}
}
}
}
.step-main{
.sub-head{
display: flex;
justify-content: space-between;
}
.sub-title{
height: 20px;
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 14px;
color: #676A6C;
margin-bottom: 16px;
.active{
color: #0077FF;
}
}
.step-ctnr{
padding-bottom: 16px;
border-bottom: 1px dashed #eee;
margin-bottom: 40px;
}
.step-wrap{
display: flex;
width: 100%;
.step-item{
flex: 1;
width: 150px;
height: 200px;
position: relative;
&:first-child{
.line{
left: 50%;
}
}
&:last-child{
.line{
right: 50%;
}
}
&:nth-child(2n+1) {
.content{
transform: translate(-50%, calc(-100% - 16px));
}
}
&:nth-child(2n) {
.content{
top: calc(100% + 16px);
transform: translateX(-50%);
}
}
.circle{
position: absolute;
width: 12px;
height: 12px;
box-sizing: border-box;
background: #FFFFFF;
border: 3px solid #0077FF;
border-radius: 50%;
transform: translate(-50%, -50%);
left: 50%;
top: 50%;
z-index: 1;
}
.content{
position: absolute;
color: #676a6c;
font-size: 14px;
font-weight: 400;
max-width: 100px;
white-space: nowrap;
.name{
font-weight: 600;
}
}
.line{
height: 3px;
top: 50%;
transform: translateY(-50%);
left: 0;
right: 0;
position: absolute;
background-color: #0077FF;
}
}
}
.table-title{
width: 100%;
height: 48px;
line-height: 48px;
font-weight: 600;
font-size: 16px;
text-align: center;
color: #111111;
background: #FBFBFB;
position: relative;
.risk-img{
position: absolute;
width: 100px;
height: 22px;
margin-left: 12px;
vertical-align: middle;
top: 50%;
transform: translateY(-50%);
}
}
}
.eChart-box {
width: 100%;
height: 398px;
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -63,6 +63,8 @@ const tool = () => import(/* webpackChunkName: "tool" */ 'pages/tool/index.vue') ...@@ -63,6 +63,8 @@ const tool = () => import(/* webpackChunkName: "tool" */ 'pages/tool/index.vue')
const zoneCar = () => import(/* webpackChunkName: "zoneCar" */ 'pages/monitor/zoneCar.vue') const zoneCar = () => import(/* webpackChunkName: "zoneCar" */ 'pages/monitor/zoneCar.vue')
const riskAssessDetail = () => import(/* webpackChunkName: "riskAssessDetail" */ 'pages/monitor/detail')
const routes = [ const routes = [
/* { /* {
path: '*', path: '*',
...@@ -335,6 +337,11 @@ const routes = [ ...@@ -335,6 +337,11 @@ const routes = [
name: 'gqReport', name: 'gqReport',
meta: { title: '报表管理(广汽)' }, meta: { title: '报表管理(广汽)' },
component: gqReport component: gqReport
},{
path: 'riskAssessDetail',
name: 'riskAssessDetail',
meta: { title: '风险评估详情' },
component: riskAssessDetail
}] }]
}, },
{ {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!