|
@@ -46,18 +46,16 @@
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
|
...mapState(["entCode", "communityId"]),
|
|
...mapState(["entCode", "communityId"]),
|
|
|
- lastMonthData() {
|
|
|
|
|
- const data = this.data || {}
|
|
|
|
|
- return Object.keys(data).map((key, index) => {
|
|
|
|
|
- return -data[key].last_month
|
|
|
|
|
- }).reverse()
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ watch: {
|
|
|
|
|
+ data: {
|
|
|
|
|
+ handler(newVal, oldVal) {
|
|
|
|
|
+ if (newVal) {
|
|
|
|
|
+ this.initChart()
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ deep: true,
|
|
|
},
|
|
},
|
|
|
- thisMonthData() {
|
|
|
|
|
- const data = this.data || {}
|
|
|
|
|
- return Object.keys(data).map((key, index) => {
|
|
|
|
|
- return data[key].this_month
|
|
|
|
|
- }).reverse()
|
|
|
|
|
- }
|
|
|
|
|
},
|
|
},
|
|
|
mounted() {
|
|
mounted() {
|
|
|
this.init()
|
|
this.init()
|
|
@@ -84,6 +82,18 @@
|
|
|
document.getElementById("marketChart2")
|
|
document.getElementById("marketChart2")
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
+ const lastMonthData = Object.keys(this.data)
|
|
|
|
|
+ .map((key, index) => {
|
|
|
|
|
+ return -this.data[key].last_month
|
|
|
|
|
+ })
|
|
|
|
|
+ .reverse()
|
|
|
|
|
+
|
|
|
|
|
+ const thisMonthData = Object.keys(this.data)
|
|
|
|
|
+ .map((key, index) => {
|
|
|
|
|
+ return this.data[key].this_month
|
|
|
|
|
+ })
|
|
|
|
|
+ .reverse()
|
|
|
|
|
+
|
|
|
const optionA = {
|
|
const optionA = {
|
|
|
tooltip: {
|
|
tooltip: {
|
|
|
trigger: "axis",
|
|
trigger: "axis",
|
|
@@ -146,7 +156,7 @@
|
|
|
name: "上月",
|
|
name: "上月",
|
|
|
type: "bar",
|
|
type: "bar",
|
|
|
// barMinHeight: 20,
|
|
// barMinHeight: 20,
|
|
|
- data: this.lastMonthData,
|
|
|
|
|
|
|
+ data: lastMonthData,
|
|
|
itemStyle: {
|
|
itemStyle: {
|
|
|
// 左侧渐变色:从#F66757到#FCE2B4
|
|
// 左侧渐变色:从#F66757到#FCE2B4
|
|
|
color: new echarts.graphic.LinearGradient(1, 0, 0, 0, [
|
|
color: new echarts.graphic.LinearGradient(1, 0, 0, 0, [
|
|
@@ -234,7 +244,7 @@
|
|
|
name: "本月",
|
|
name: "本月",
|
|
|
type: "bar",
|
|
type: "bar",
|
|
|
// barMinHeight: 20,
|
|
// barMinHeight: 20,
|
|
|
- data: this.thisMonthData,
|
|
|
|
|
|
|
+ data: thisMonthData,
|
|
|
itemStyle: {
|
|
itemStyle: {
|
|
|
// 右侧渐变色:从#1620D4到#3AB3E3
|
|
// 右侧渐变色:从#1620D4到#3AB3E3
|
|
|
color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
|
|
color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
|