Browse Source

修改

master_tdsql
xzt 11 months ago
parent
commit
4adbeb2aee
  1. 1
      src/views/dike/safetyManage/declarationManage/declare/components/dataCharts.vue
  2. 2
      src/views/dike/safetyManage/declarationManage/examine/components/dataCharts.vue
  3. 29
      src/views/sluice/safetyManage/declarationManage/declare/components/dataCharts.vue
  4. 29
      src/views/sluice/safetyManage/declarationManage/examine/components/dataCharts.vue

1
src/views/dike/safetyManage/declarationManage/declare/components/dataCharts.vue

@ -11,7 +11,6 @@ export default {
data() { data() {
return { return {
pieChartData: [], pieChartData: [],
seriesData: [],
selected: {}, selected: {},
barChartData: [], barChartData: [],
loading: true, loading: true,

2
src/views/dike/safetyManage/declarationManage/examine/components/dataCharts.vue

@ -11,7 +11,6 @@ export default {
data() { data() {
return { return {
pieChartData: [], pieChartData: [],
seriesData: [],
selected: {}, selected: {},
barChartData: [], barChartData: [],
loading: true, loading: true,
@ -27,7 +26,6 @@ export default {
const res2 = await getHistogram(); const res2 = await getHistogram();
this.pieChartData = []; this.pieChartData = [];
for (let key in res1[0]) { for (let key in res1[0]) {
let name = key;
this.pieChartData.push({ this.pieChartData.push({
value: res1[0][key], value: res1[0][key],
name: key?.substring(0, 10), name: key?.substring(0, 10),

29
src/views/sluice/safetyManage/declarationManage/declare/components/dataCharts.vue

@ -1,5 +1,5 @@
<template> <template>
<div class="content"> <div class="content" v-loading="loading">
<div ref="pieEle" style="width: 30%; height: 100%"></div> <div ref="pieEle" style="width: 30%; height: 100%"></div>
<div ref="barEle" style="width: 70%; height: 100%"></div> <div ref="barEle" style="width: 70%; height: 100%"></div>
</div> </div>
@ -11,7 +11,9 @@ export default {
data() { data() {
return { return {
pieChartData: [], pieChartData: [],
selected: {},
barChartData: [], barChartData: [],
loading: true,
}; };
}, },
created() { created() {
@ -19,11 +21,19 @@ export default {
}, },
methods: { methods: {
async getData() { async getData() {
this.loading = true;
const res1 = await getPie(); const res1 = await getPie();
const res2 = await getHistogram(); const res2 = await getHistogram();
this.pieChartData = []; this.pieChartData = [];
for (let key in res1[0]) { for (let key in res1[0]) {
this.pieChartData.push({ value: res1[0][key], name: key }); this.pieChartData.push({
value: res1[0][key],
name: key?.substring(0, 10),
});
}
for (let i = 0; i < this.pieChartData.length; i++) {
let name = this.pieChartData[i].name;
this.selected[name] = i < 7; //10 name
} }
// for (let key in res1[0]) { // for (let key in res1[0]) {
// this.barChartData.push({ value: res1[0][key], name: key }); // this.barChartData.push({ value: res1[0][key], name: key });
@ -31,6 +41,7 @@ export default {
this.barChartData = res2; this.barChartData = res2;
this.pieInit(); this.pieInit();
this.barInit(); this.barInit();
this.loading = false;
console.log("pieChartData", this.pieChartData); console.log("pieChartData", this.pieChartData);
console.log("barChartData", this.barChartData); console.log("barChartData", this.barChartData);
}, },
@ -51,6 +62,8 @@ export default {
orient: "horizontal", orient: "horizontal",
bottom: "2%", bottom: "2%",
icon: "circle", icon: "circle",
type: "scroll",
selected: this.selected,
}, },
series: [ series: [
{ {
@ -106,6 +119,18 @@ export default {
bottom: "12%", bottom: "12%",
containLabel: true, containLabel: true,
}, },
dataZoom: [
{
type: "inside",
show: false,
xAxisIndex: [0],
start: 0,
end: 50,
// textStyle: {
// color: "#ccd7d7",
// },
},
],
xAxis: { xAxis: {
type: "category", type: "category",
axisLine: { axisLine: {

29
src/views/sluice/safetyManage/declarationManage/examine/components/dataCharts.vue

@ -1,5 +1,5 @@
<template> <template>
<div class="content"> <div class="content" v-loading="loading">
<div ref="pieEle" style="width: 30%; height: 100%"></div> <div ref="pieEle" style="width: 30%; height: 100%"></div>
<div ref="barEle" style="width: 70%; height: 100%"></div> <div ref="barEle" style="width: 70%; height: 100%"></div>
</div> </div>
@ -11,7 +11,9 @@ export default {
data() { data() {
return { return {
pieChartData: [], pieChartData: [],
selected: {},
barChartData: [], barChartData: [],
loading: true,
}; };
}, },
created() { created() {
@ -19,11 +21,19 @@ export default {
}, },
methods: { methods: {
async getData() { async getData() {
this.loading = true;
const res1 = await getPie(); const res1 = await getPie();
const res2 = await getHistogram(); const res2 = await getHistogram();
this.pieChartData = []; this.pieChartData = [];
for (let key in res1[0]) { for (let key in res1[0]) {
this.pieChartData.push({ value: res1[0][key], name: key }); this.pieChartData.push({
value: res1[0][key],
name: key?.substring(0, 10),
});
}
for (let i = 0; i < this.pieChartData.length; i++) {
let name = this.pieChartData[i].name;
this.selected[name] = i < 7; //10 name
} }
// for (let key in res1[0]) { // for (let key in res1[0]) {
// this.barChartData.push({ value: res1[0][key], name: key }); // this.barChartData.push({ value: res1[0][key], name: key });
@ -31,6 +41,7 @@ export default {
this.barChartData = res2; this.barChartData = res2;
this.pieInit(); this.pieInit();
this.barInit(); this.barInit();
this.loading = false;
console.log("pieChartData", this.pieChartData); console.log("pieChartData", this.pieChartData);
console.log("barChartData", this.barChartData); console.log("barChartData", this.barChartData);
}, },
@ -51,6 +62,8 @@ export default {
orient: "horizontal", orient: "horizontal",
bottom: "2%", bottom: "2%",
icon: "circle", icon: "circle",
type: "scroll",
selected: this.selected,
}, },
series: [ series: [
{ {
@ -106,6 +119,18 @@ export default {
bottom: "12%", bottom: "12%",
containLabel: true, containLabel: true,
}, },
dataZoom: [
{
type: "inside",
show: false,
xAxisIndex: [0],
start: 0,
end: 50,
// textStyle: {
// color: "#ccd7d7",
// },
},
],
xAxis: { xAxis: {
type: "category", type: "category",
axisLine: { axisLine: {

Loading…
Cancel
Save