| xqd
@@ -112,31 +112,36 @@ Page({
|
|
|
app.resetDataFilter()
|
|
|
},
|
|
|
|
|
|
- switchCheck: function(e) {
|
|
|
+ switchCheck: function (e) {
|
|
|
var index = e.currentTarget.dataset.index
|
|
|
var projects = this.data.projects
|
|
|
projects[index].checked = projects[index].checked ? false : true
|
|
|
- this.setData({projects})
|
|
|
+ this.setData({
|
|
|
+ projects
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
- closeProject: function(e) {
|
|
|
+ closeProject: function (e) {
|
|
|
var project_ids = []
|
|
|
var project_names = []
|
|
|
var projects = this.data.projects
|
|
|
- for(var i = 0; i < projects.length; ++i) {
|
|
|
- if(projects[i].checked) {
|
|
|
+ for (var i = 0; i < projects.length; ++i) {
|
|
|
+ if (projects[i].checked) {
|
|
|
project_ids.push(projects[i].id)
|
|
|
project_names.push(projects[i].name)
|
|
|
}
|
|
|
}
|
|
|
project_names = project_names.join(',')
|
|
|
- this.setData({project_ids, project_names})
|
|
|
+ this.setData({
|
|
|
+ project_ids,
|
|
|
+ project_names
|
|
|
+ })
|
|
|
this.switchShow(e)
|
|
|
this.getData()
|
|
|
this.getTotalInfo()
|
|
|
},
|
|
|
|
|
|
- getSearchItems: function() {
|
|
|
+ getSearchItems: function () {
|
|
|
var ids = this.data.project_ids
|
|
|
if (ids.length <= 0) return false
|
|
|
var filter = this.data.filter
|
| xqd
@@ -162,8 +167,8 @@ Page({
|
|
|
http({
|
|
|
url: 'data/getTotalInfo',
|
|
|
data: data,
|
|
|
- success: function(res) {
|
|
|
- if(res.code == 0) {
|
|
|
+ success: function (res) {
|
|
|
+ if (res.code == 0) {
|
|
|
that.setData(res.data)
|
|
|
}
|
|
|
}
|
| xqd
@@ -176,8 +181,8 @@ Page({
|
|
|
http({
|
|
|
url: 'data/getDetailData',
|
|
|
data: data,
|
|
|
- success: function(res) {
|
|
|
- if(res.code == 0) {
|
|
|
+ success: function (res) {
|
|
|
+ if (res.code == 0) {
|
|
|
that.setData({
|
|
|
detail_data: res.data
|
|
|
})
|
| xqd
@@ -189,19 +194,21 @@ Page({
|
|
|
getData() {
|
|
|
var data = this.getSearchItems()
|
|
|
var that = this
|
|
|
- if(!data.project_ids || data.project_ids.length <= 0) return false
|
|
|
+ if (!data.project_ids || data.project_ids.length <= 0) return false
|
|
|
var chart_type = this.data.charts[this.data.chartIndex]
|
|
|
http({
|
|
|
url: 'data/getStat',
|
|
|
data: data,
|
|
|
- success: function(res) {
|
|
|
- if(res.code == 0) {
|
|
|
- if(chart_type == 'detail') {
|
|
|
+ success: function (res) {
|
|
|
+ if (res.code == 0) {
|
|
|
+ if (chart_type == 'detail') {
|
|
|
that.setData({
|
|
|
detail_data: res.data
|
|
|
})
|
|
|
} else {
|
|
|
- that.setData({data: res.data})
|
|
|
+ that.setData({
|
|
|
+ data: res.data
|
|
|
+ })
|
|
|
that.updateChart()
|
|
|
}
|
|
|
}
|
| xqd
@@ -225,30 +232,30 @@ Page({
|
|
|
onChange: function (e) {
|
|
|
var value = e.detail.value
|
|
|
var name = e.currentTarget.dataset.name
|
|
|
- if(this.data[name] == value) return false;
|
|
|
+ if (this.data[name] == value) return false;
|
|
|
this.setData({
|
|
|
[name]: value
|
|
|
})
|
|
|
- if(name == 'chartIndex') {
|
|
|
+ if (name == 'chartIndex') {
|
|
|
var chart = this.data.charts[this.data.chartIndex]
|
|
|
- if(chart.type == 'detail') {
|
|
|
+ if (chart.type == 'detail') {
|
|
|
this.getDetailData()
|
|
|
} else {
|
|
|
this.getData()
|
|
|
}
|
|
|
- } else if(name == 'date') {
|
|
|
+ } else if (name == 'date') {
|
|
|
this.getTotalInfo()
|
|
|
}
|
|
|
},
|
|
|
- updateChart: function() {
|
|
|
+ updateChart: function () {
|
|
|
var data = this.data.data
|
|
|
option.xAxis.data = data.names;
|
|
|
option.legend = {
|
|
|
data: data.legends
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
var type = this.data.charts[this.data.chartIndex].type
|
|
|
- if(type == 'pie') {
|
|
|
+ if (type == 'pie') {
|
|
|
option.series = [{
|
|
|
data: data.data,
|
|
|
type: type,
|
| xqd
@@ -258,10 +265,20 @@ Page({
|
|
|
}
|
|
|
}]
|
|
|
option.xAxis.show = false
|
|
|
+ } else if (type == 'radar') {
|
|
|
+ option.xAxis.show = false
|
|
|
+ option.radar = {
|
|
|
+ // shape: 'circle',
|
|
|
+ indicator: data.indicator
|
|
|
+ }
|
|
|
+ option.series = [{
|
|
|
+ type: type,
|
|
|
+ data: data.data
|
|
|
+ }]
|
|
|
} else {
|
|
|
option.xAxis.show = true
|
|
|
var values = data.values
|
|
|
- for(var i = 0; i < values.length; ++i) {
|
|
|
+ for (var i = 0; i < values.length; ++i) {
|
|
|
option.series[i] = {
|
|
|
label: {
|
|
|
show: true,
|
| xqd
@@ -273,13 +290,13 @@ Page({
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
chart.setOption(option)
|
|
|
},
|
|
|
|
|
|
radioChange: function (e) {
|
|
|
var dateIndex = e.currentTarget.dataset.index
|
|
|
- if(dateIndex == this.data.dateIndex) return false
|
|
|
+ if (dateIndex == this.data.dateIndex) return false
|
|
|
var start_date = this.data.start_date
|
|
|
var end_date = this.data.end_date
|
|
|
var start_date = dateIndex == 1 ? start_date + '-01' : start_date.substr(0, 7)
|
| xqd
@@ -297,7 +314,7 @@ Page({
|
|
|
this.setData({
|
|
|
[name]: show
|
|
|
})
|
|
|
- if(name == 'dateShow' && !show) {
|
|
|
+ if (name == 'dateShow' && !show) {
|
|
|
this.getData()
|
|
|
}
|
|
|
},
|
| xqd
@@ -320,7 +337,7 @@ Page({
|
|
|
this.getData()
|
|
|
},
|
|
|
|
|
|
- navigate: function(e) {
|
|
|
+ navigate: function (e) {
|
|
|
var url = e.currentTarget.dataset.url
|
|
|
wx.navigateTo({
|
|
|
url: url,
|