许静 5 年之前
父節點
當前提交
6bd9256203
共有 2 個檔案被更改,包括 7 行新增7 行删除
  1. 5
    4
      src/components/charts/Line.js
  2. 2
    3
      src/pages/person/customerAnalysis/analysis.js

+ 5
- 4
src/components/charts/Line.js 查看文件

35
 
35
 
36
   // 禁止 props 变更时渲染
36
   // 禁止 props 变更时渲染
37
   shouldComponentUpdate(nextProps) {
37
   shouldComponentUpdate(nextProps) {
38
-    console.log('------------>', this.props, nextProps)
39
     if (nextProps.source && nextProps.source.length) {
38
     if (nextProps.source && nextProps.source.length) {
40
-      this.refreshChart(this.props.source)
39
+      this.refreshChart(nextProps.source)
41
     }
40
     }
42
 
41
 
43
     return false
42
     return false
78
         left: '10%',
77
         left: '10%',
79
         right: '8%',
78
         right: '8%',
80
         bottom: '10%',
79
         bottom: '10%',
81
-        top: '6%',
80
+        top: '10%',
82
       },
81
       },
83
       series: [],
82
       series: [],
84
     }
83
     }
126
 
125
 
127
   refreshChart(source) {
126
   refreshChart(source) {
128
     const options = this.createOptions(source)
127
     const options = this.createOptions(source)
129
-    console.log(source,"source")
128
+
130
     if (!this.echart) {
129
     if (!this.echart) {
131
       if (this.ecComponent) {
130
       if (this.ecComponent) {
132
         const initFunc = initChart(this.handleChart.bind(this), options)
131
         const initFunc = initChart(this.handleChart.bind(this), options)
140
   }
139
   }
141
 
140
 
142
   render() {
141
   render() {
142
+    // this.refreshChart(this.props.source)
143
+
143
     return (
144
     return (
144
       <View className="map-container">
145
       <View className="map-container">
145
         <ec-canvas ref={this.handleEcComponent} ec={this.state.ec}></ec-canvas>
146
         <ec-canvas ref={this.handleEcComponent} ec={this.state.ec}></ec-canvas>

+ 2
- 3
src/pages/person/customerAnalysis/analysis.js 查看文件

77
       res.map((item, index) => {
77
       res.map((item, index) => {
78
         arr.push({ value: item.customerNum, name: item.day })
78
         arr.push({ value: item.customerNum, name: item.day })
79
       })
79
       })
80
-      console.log(arr, "88888888888888888888888888888888888")
80
+
81
       this.setState({
81
       this.setState({
82
         chartInfo: arr || []
82
         chartInfo: arr || []
83
       })
83
       })
94
         res.map((item, index) => {
94
         res.map((item, index) => {
95
           arr.push({ value: item.customerNum, name: item.day })
95
           arr.push({ value: item.customerNum, name: item.day })
96
         })
96
         })
97
-        console.log(arr, "88888888888888888888888888888888888")
98
         this.setState({
97
         this.setState({
99
           chartInfo: arr || []
98
           chartInfo: arr || []
100
         })
99
         })
101
       })
100
       })
102
     } else {
101
     } else {
103
       getEchartMonthInfo(params).then(res => {
102
       getEchartMonthInfo(params).then(res => {
104
-
105
         this.setState({
103
         this.setState({
104
+          chartInfo: res.map(x => ({ name: `${x.month.substr(4)}月`, value: x.customerNum }))
106
         })
105
         })
107
       })
106
       })
108
     }
107
     }