Browse Source

延迟渲染图表

feature
mk 2 years ago
parent
commit
376abc64e0
  1. 4
      src/views/modules/satisfaction/communitySelfInsp/index.vue
  2. 11
      src/views/modules/satisfaction/satisfactionProvince/index.vue

4
src/views/modules/satisfaction/communitySelfInsp/index.vue

@ -295,7 +295,9 @@ export default {
this.myChart.on("click", function (params) { this.myChart.on("click", function (params) {
than.handelClickChart(params.name,params.seriesName); than.handelClickChart(params.name,params.seriesName);
}); });
window.addEventListener("resize", this.handleWindowResize); this.$nextTick(()=>{
window.addEventListener("resize", this.handleWindowResize);
})
}, },
handleWindowResize() { handleWindowResize() {
if (this.myChart) { if (this.myChart) {

11
src/views/modules/satisfaction/satisfactionProvince/index.vue

@ -344,12 +344,11 @@ export default {
this.formData.periodStart = util.formatDate(date, "yyyy-MM"); this.formData.periodStart = util.formatDate(date, "yyyy-MM");
this.user = this.$store.state.user; this.user = this.$store.state.user;
}, },
async mounted() { async mounted() {
this.agencyId = this.user.agencyId; this.agencyId = this.user.agencyId;
if (this.user.level != "street") { this.$nextTick(()=>{
this.initEcharts(); this.initEcharts();
} })
await this.getDicts(); await this.getDicts();
await this.getTableData(); await this.getTableData();
}, },
@ -378,14 +377,16 @@ export default {
}, },
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
initEcharts() { initEcharts() {
if(this.user.level == 'street') return
this.myChart = echarts.init(document.getElementById("myCharts")); this.myChart = echarts.init(document.getElementById("myCharts"));
this.myChart.setOption(this.option); this.myChart.setOption(this.option);
let than = this; let than = this;
this.myChart.on("click", function (params) { this.myChart.on("click", function (params) {
than.handelClickChart(params.name); than.handelClickChart(params.name);
}); });
this.$nextTick(()=>{
window.addEventListener("resize", this.handleWindowResize); window.addEventListener("resize", this.handleWindowResize);
})
}, },
handleWindowResize() { handleWindowResize() {
if (this.myChart) { if (this.myChart) {
@ -462,7 +463,7 @@ export default {
} else { } else {
const { statistics, code, msg, tableList } = await requestPost( const { statistics, code, msg, tableList } = await requestPost(
`/governance/provinceEvaluationRecord/staticStreetPeopleNum`, `/governance/provinceEvaluationRecord/staticStreetPeopleNum`,
{ ...this.formData } { ...this.formData,pageSize:this.pageSize,pageNo:this.pageNo }
); );
if (code == 0) { if (code == 0) {
statistics.forEach((item) => { statistics.forEach((item) => {

Loading…
Cancel
Save