Browse Source

更新chart1

develop
little4 2 months ago
parent
commit
1721e42cc3
  1. 61
      ruoyi-ui/src/views/JiHeExpressway/pages/service/analysis/charts.js
  2. 19
      ruoyi-ui/src/views/JiHeExpressway/pages/service/analysis/index.vue
  3. 16
      ruoyi-ui/src/views/JiHeExpressway/pages/service/analysis/search/index.vue

61
ruoyi-ui/src/views/JiHeExpressway/pages/service/analysis/charts.js

@ -1,7 +1,6 @@
import * as echarts from "echarts";
let options = {
color:['#00A3FF'],
tooltip: {
show: true,
trigger: "axis",
@ -86,62 +85,16 @@ let options = {
},
series: [
{
name: "事件数量",
name: "",
type: "bar",
barWidth: "10px",
selectedMode: false,
data: [],
},{
name: "",
type: "bar",
barWidth: "10px",
selectedMode: false,
select: {
itemStyle: {
opacity: 1,
color: function (params) {
var a = params;
return new echarts.graphic.LinearGradient(
0,
0,
0,
1,
[
{
offset: 0,
color: "#1AC5FD", // 0% 处的颜色
},
{
offset: 1,
color: "#003B4E", // 100% 处的颜色
},
],
false
);
},
},
},
itemStyle: {
barBorderRadius: [10, 10, 10, 10], // 圆角(左上、右上、右下、左下)
// lenged文本
opacity: 1,
color: function (params) {
var a = params.name;
// console.log("==========a=============", a);
return new echarts.graphic.LinearGradient(
0,
0,
0,
1,
[
{
offset: 0,
color: "#00A3FF", // 0% 处的颜色
},
{
offset: 1,
color: "#00A3FF00", // 100% 处的颜色
},
],
false
);
},
},
data: [],
}
],

19
ruoyi-ui/src/views/JiHeExpressway/pages/service/analysis/index.vue

@ -144,26 +144,25 @@ export default {
}).then(result=>{
if (result.code != 200) return this.$message.error(result?.msg);
this.tableCols = [{label:'路段桩号',value:'stake'},{label:'数量(起)',value:'num'}]
this.tableCols = [{label:'路段桩号',value:'stakeMark'},{label:query.thisTime+' 数量(起)',value:query.thisTime},{label:query.lastTime+' 数量(起)',value:query.lastTime}]
let _tableData = []
if(_.keys(result.data).length === 0){
chartsOptions.series[0].name = query.thisTime;
chartsOptions.series[1].name = query.lastTime;
if(result.data.length === 0){
this.tableData = []
chartsOptions.series[0].data = []
chartsOptions.series[1].data = []
this.myChart.setOption(chartsOptions);
this.myChart.resize();
this.$message.warning('暂无数据')
return;
}
for(let i in result.data){
_tableData.push({
stake:i, num:result.data[i]
})
}
this.tableData = _tableData;
this.tableData = result.data;
this.curid = id;
setTimeout(() => {
chartsOptions.series[0].data = _tableData.map(x=>x.num)
chartsOptions.xAxis.data = _tableData.map(x=>x.stake);
chartsOptions.series[0].data = _tableData.map(x=>x[query.thisTime])
chartsOptions.series[1].data = _tableData.map(x=>x[query.lastTime])
chartsOptions.xAxis.data = _tableData.map(x=>x.stakeMark);
this.myChart.setOption(chartsOptions);
this.myChart.resize();
}, 200);

16
ruoyi-ui/src/views/JiHeExpressway/pages/service/analysis/search/index.vue

@ -87,7 +87,7 @@ export default {
}
],
quarter: "2",
dateTime: [moment().format("YYYY-MM-DD"),moment().format("YYYY-MM-DD")],
dateTime: [moment().subtract(1,'years').format("YYYY-MM-DD"),moment().format("YYYY-MM-DD")],
dataList: [],
year: "",
@ -110,6 +110,7 @@ export default {
this.dateTime = n;
}
}
}
},
methods: {
//
@ -144,11 +145,18 @@ export default {
return filter;
},
getStartTime(){
if(this.dateTime.length === 1){
if (this.type == 2) {
this.dateTime.unshift(moment(this.dateTime[0]).subtract(1,'days').format("YYYY-MM-DD"))
} else if(this.type == 1){
this.dateTime.unshift(moment(this.dateTime[0]).subtract(1,'months').subtract.format("YYYY-MM-DD"))
} else {
this.dateTime.unshift(moment(this.dateTime[0]).subtract(1,'years').subtract.format("YYYY-MM-DD"))
}
}
let thisTime = this.dateTime[0];
let lastTime = this.dateTime[1];
if (this.type == 2) { //
// startTime = moment(this.dateTime).format("YYYY-MM-DD 00:00:00");
// endTime = moment(this.dateTime).format("YYYY-MM-DD 23:59:59");
thisTime = moment(this.dateTime[0]).format("YYYY-MM-DD");
lastTime = moment(this.dateTime[1]).format("YYYY-MM-DD");
} else if (this.type == 1) { //
@ -166,7 +174,7 @@ export default {
this.reset = true;
this.direction = "1";
this.type = "1";
this.dateTime = moment().format("YYYY-MM-DD HH:mm:ss");
this.dateTime = [moment().subtract(1,'years').format("YYYY-MM-DD"),moment().format("YYYY-MM-DD")];
this.$parent.bind()
},
onQuery(){

Loading…
Cancel
Save