Browse Source

修改统计页面图表加载方式

jw-featrue-zhanlibiao
战立标 2 years ago
parent
commit
68c87ee78c
  1. 19
      pages/statistics/modules/HotlineComplaints/HotlineComplaints.js
  2. 28
      pages/statistics/modules/SmyddcSqmydzc/SmyddcSqmydzc.js
  3. 16
      pages/statistics/modules/Trend/Trend.js
  4. 22
      subpages/statistics/pages/qzbmy/qzbmy.js
  5. 2
      subpages/statistics/pages/qzbmy/qzbmy.wxml
  6. 6
      subpages/statistics/pages/qzbmy/qzbmy.wxss

19
pages/statistics/modules/HotlineComplaints/HotlineComplaints.js

@ -38,7 +38,8 @@ Component({
}, },
data: { data: {
ec: { ec: {
onInit: initChart lazyLoad: true
// onInit: initChart
}, },
tabList: [{ tabList: [{
label: "问题突出类别", label: "问题突出类别",
@ -55,13 +56,21 @@ Component({
} }
}, },
methods: { methods: {
tabChange(index) { tabChange({detail}) {
this.setData({ this.setData({
tabValue: this.tabList[index].value tabValue: this.data.tabList[detail].value
}) })
this.getData() this.getData()
}, },
getData() { getData() {
this.selectComponent('#hotlineComplaints').init((canvas, width, height, dpr) => {
chart = echarts.init(canvas, null, {
width: width,
height: height,
devicePixelRatio: dpr // 像素比
});
canvas.setChart(chart);
let params = { let params = {
startTime: '', startTime: '',
endTime: '' endTime: ''
@ -105,7 +114,6 @@ Component({
color: '#fff', color: '#fff',
fontSize: 14 fontSize: 14
}, },
backgroundColor: "#04229a",
formatter(params) { formatter(params) {
// console.log(params) // console.log(params)
if (params.name === '') { if (params.name === '') {
@ -150,7 +158,8 @@ Component({
}; };
chart.setOption(option); chart.setOption(option);
}) })
return chart;
});
} }
} }
}); });

28
pages/statistics/modules/SmyddcSqmydzc/SmyddcSqmydzc.js

@ -35,7 +35,8 @@ Component({
}, },
data: { data: {
ec: { ec: {
onInit: initChart lazyLoad: true
// onInit: initChart
} }
}, },
lifetimes: { lifetimes: {
@ -45,6 +46,13 @@ Component({
}, },
methods: { methods: {
getData() { getData() {
this.selectComponent('#smyddcSqmydzc').init((canvas, width, height, dpr) => {
chart = echarts.init(canvas, null, {
width: width,
height: height,
devicePixelRatio: dpr // 像素比
});
canvas.setChart(chart);
let params = { let params = {
startTime: '', startTime: '',
endTime: '' endTime: ''
@ -135,8 +143,18 @@ Component({
}] }]
var option = { var option = {
tooltip: { tooltip: {
show: false, show: true,
trigger: "item", textStyle: {
color: '#fff',
fontSize: 14
},
formatter(params) {
// console.log(params)
if (params.name === '') {
return '';
}
return `${params.name} : ${params.percent}%`;
},
}, },
legend: { legend: {
show: true, show: true,
@ -195,7 +213,9 @@ Component({
}, },
series series
}; };
chart.setOption(option,true); chart.setOption(option, true);
})
return chart;
}) })
} }
} }

16
pages/statistics/modules/Trend/Trend.js

@ -18,7 +18,8 @@ Component({
properties: {}, properties: {},
data: { data: {
ec: { ec: {
onInit: initChart lazyLoad: true
// onInit: initChart
} }
}, },
lifetimes: { lifetimes: {
@ -28,13 +29,20 @@ Component({
}, },
methods: { methods: {
getData() { getData() {
this.selectComponent('#Trend').init((canvas, width, height, dpr) => {
chart = echarts.init(canvas, null, {
width: width,
height: height,
devicePixelRatio: dpr // 像素比
});
canvas.setChart(chart);
notSatisfactionTrend().then(({data}) => { notSatisfactionTrend().then(({data}) => {
let xData = data.monthTimes.map(item => (item.split('-')[1] - 0) + '月'); let xData = data.monthTimes.map(item => (item.split('-')[1] - 0) + '月');
let series = [] let series = []
let color = ['#3A80E7', '#EB8E16', '#10B2A5',] let color = ['#3A80E7', '#EB8E16', '#10B2A5',]
data.series.forEach((item,index) => { data.series.forEach((item, index) => {
series.push({ series.push({
name:item.name, name: item.name,
type: 'line', type: 'line',
showAllSymbol: true, showAllSymbol: true,
symbol: 'circle', symbol: 'circle',
@ -141,6 +149,8 @@ Component({
chart.setOption(option); chart.setOption(option);
}) })
return chart
})
} }
} }
}); });

22
subpages/statistics/pages/qzbmy/qzbmy.js

@ -1,4 +1,4 @@
import {getPotentialDissatisfiedCountDetail, maporg} from "../../../../utils/statisticsApi"; import { getPotentialDissatisfiedCountDetail, maporg } from "../../../../utils/statisticsApi";
Page({ Page({
data: { data: {
@ -17,8 +17,8 @@ Page({
}, },
getOrg() { getOrg() {
maporg().then(async ({data}) => { maporg().then(async ({ data }) => {
let parent = {value: data.id, label: data.name} let parent = { value: data.id, label: data.name }
this.setData({ this.setData({
orgList: [ orgList: [
parent, ...data.children.map(item => { parent, ...data.children.map(item => {
@ -33,15 +33,23 @@ Page({
}) })
}, },
gotopage({currentTarget: {dataset}}) { gotopage({ currentTarget: { dataset } }) {
const {url} = dataset; const { url } = dataset;
wx.navigateTo({url}) wx.navigateTo({ url })
}, },
setVal(e) { setVal(e) {
this.setData({ this.setData({
[e.currentTarget.dataset.key]: e.detail.value [e.currentTarget.dataset.key]: e.detail.value
}) })
}, },
search() {
this.setData({
pageNo: 1,
list: [],
total: 0,
})
this.getList()
},
getList() { getList() {
getPotentialDissatisfiedCountDetail({ getPotentialDissatisfiedCountDetail({
pageNo: this.data.pageNo, pageNo: this.data.pageNo,
@ -49,7 +57,7 @@ Page({
agencyId: this.data.orgList[this.data.orgIndex].value, agencyId: this.data.orgList[this.data.orgIndex].value,
name: this.data.name, name: this.data.name,
mobile: this.data.mobile, mobile: this.data.mobile,
}).then(({data}) => { }).then(({ data }) => {
this.setData({ this.setData({
list: this.data.list.concat(data.list), list: this.data.list.concat(data.list),
total: data.total total: data.total

2
subpages/statistics/pages/qzbmy/qzbmy.wxml

@ -14,7 +14,7 @@
</picker> </picker>
<input placeholder="按姓名" bind:input="setVal" data-key="name" class="picker-type"/> <input placeholder="按姓名" bind:input="setVal" data-key="name" class="picker-type"/>
<input placeholder="按电话" bind:input="setVal" data-key="mobile" class="picker-type"/> <input placeholder="按电话" bind:input="setVal" data-key="mobile" class="picker-type"/>
<view class="btn">筛选</view> <view class="btn" bind:tap="search">筛选</view>
</view> </view>
<view class="qz-container"> <view class="qz-container">

6
subpages/statistics/pages/qzbmy/qzbmy.wxss

@ -28,6 +28,12 @@ page {
justify-content: space-between; justify-content: space-between;
padding: 0 30rpx; padding: 0 30rpx;
box-sizing: border-box; box-sizing: border-box;
}
.picker text {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
} }
.picker-type image, .picker-type image,

Loading…
Cancel
Save