Browse Source

多次点击问题bug

jly/task002
tianq 2 years ago
parent
commit
6243538d4b
  1. 29
      src/views/modules/census/census-accountList.vue
  2. 302
      src/views/modules/census/chart.vue

29
src/views/modules/census/census-accountList.vue

@ -97,7 +97,7 @@
style="width: 100%" style="width: 100%"
:height="maxTableHeight" :height="maxTableHeight"
> >
<el-table-column label="序号" type="index" align="center" width="50" /> <el-table-column label="序号" type="index" align="center" width="50" />
<el-table-column prop="agencyName" align="center" label="社区名称" :show-overflow-tooltip="true"></el-table-column> <el-table-column prop="agencyName" align="center" label="社区名称" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="streetName" label="所属街道" align="center" :show-overflow-tooltip="true" /> <el-table-column prop="streetName" label="所属街道" align="center" :show-overflow-tooltip="true" />
<el-table-column prop="districtName" label="所属区县" align="center" :show-overflow-tooltip="true"></el-table-column> <el-table-column prop="districtName" label="所属区县" align="center" :show-overflow-tooltip="true"></el-table-column>
@ -123,27 +123,27 @@
<el-dialog :title="title" :visible.sync="dialogVisible" v-if="dialogVisible" width="50%" :before-close="handleClose"> <el-dialog :title="title" :visible.sync="dialogVisible" v-if="dialogVisible" width="50%" :before-close="handleClose">
<div <div
style=" text-align: right; style=" text-align: right;
margin-top: -30px; margin-top: -10px;
margin-bottom: 10px;" margin-bottom: 10px;"
> >
<el-button size="small" v-if="orgType == 'community'" class="diy-button--output" @click="handleExport()">导出</el-button> <el-button size="small" v-if="orgType == 'community'" class="diy-button--output" @click="handleExport()">导出</el-button>
</div> </div>
<el-table :data="tableDataView" border v-loading="tableLoading2" :header-cell-style="{ background: '#2195FE', color: '#FFFFFF' }" class="table" style="width: 100%"> <el-table :data="tableDataView" border v-loading="tableLoading2" :header-cell-style="{ background: '#2195FE', color: '#FFFFFF' }" class="table" style="width: 100%">
<template v-if="orgType == 'community'"> <template v-if="orgType == 'community'">
<el-table-column label="序号" type="index" align="center" width="50" /> <el-table-column label="序号" type="index" align="center" width="50" />
<el-table-column prop="agencyName" align="center" label="社区名称" :show-overflow-tooltip="true"></el-table-column> <el-table-column prop="agencyName" align="center" label="社区名称" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="streetName" label="所属街道" align="center" :show-overflow-tooltip="true" /> <el-table-column prop="streetName" label="所属街道" align="center" :show-overflow-tooltip="true" />
<el-table-column prop="districtName" label="所属区县" align="center" :show-overflow-tooltip="true"></el-table-column> <el-table-column prop="districtName" label="所属区县" align="center" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="count" align="center" label="登录次数" :show-overflow-tooltip="true"></el-table-column> <el-table-column prop="count" align="center" label="登录次数" :show-overflow-tooltip="true"></el-table-column>
</template> </template>
<template v-if="orgType == 'street'"> <template v-if="orgType == 'street'">
<el-table-column label="序号" type="index" align="center" width="50" /> <el-table-column label="序号" type="index" align="center" width="50" />
<el-table-column prop="agencyName" label="镇街名称" align="center" :show-overflow-tooltip="true" /> <el-table-column prop="agencyName" label="镇街名称" align="center" :show-overflow-tooltip="true" />
<el-table-column prop="districtName" label="所属区县" align="center" :show-overflow-tooltip="true"></el-table-column> <el-table-column prop="districtName" label="所属区县" align="center" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="count" align="center" label="登录次数" :show-overflow-tooltip="true"></el-table-column> <el-table-column prop="count" align="center" label="登录次数" :show-overflow-tooltip="true"></el-table-column>
</template> </template>
<template v-if="orgType == 'district'"> <template v-if="orgType == 'district'">
<el-table-column label="序号" type="index" align="center" width="50" /> <el-table-column label="序号" type="index" align="center" width="50" />
<el-table-column prop="agencyName" label="区县名称" align="center" :show-overflow-tooltip="true"></el-table-column> <el-table-column prop="agencyName" label="区县名称" align="center" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="count" align="center" label="登录次数" :show-overflow-tooltip="true"></el-table-column> <el-table-column prop="count" align="center" label="登录次数" :show-overflow-tooltip="true"></el-table-column>
</template> </template>
@ -540,7 +540,7 @@ export default {
// //
async iniPieChart(chartData) { async iniPieChart(chartData) {
this.$refs.pieChart.clear(); this.$refs.pieChart.clear();
// pieChart // pieChart
this.pieOption = { this.pieOption = {
grid: { grid: {
@ -591,8 +591,8 @@ export default {
color: '#F3F7FD' color: '#F3F7FD'
} }
}, },
min:0, min: 0,
max:1000, max: 1000
}, },
series: [ series: [
{ {
@ -601,14 +601,14 @@ export default {
type: 'bar', type: 'bar',
itemStyle: { itemStyle: {
color: 'rgb(33, 149, 254)', color: 'rgb(33, 149, 254)',
borderRadius: [4, 4, 0, 0], borderRadius: [4, 4, 0, 0]
} }
} }
] ]
}; };
if (chartData.data.length>0) { if (chartData.data.length > 0) {
this.pieOption.yAxis.max=null this.pieOption.yAxis.max = null;
} }
this.$refs.pieChart.setOption(this.pieOption); this.$refs.pieChart.setOption(this.pieOption);
}, },
handelClickMyPei(param) { handelClickMyPei(param) {
@ -687,8 +687,8 @@ export default {
} }
} }
} }
.div_table{ .div_table {
padding: 30px!important; padding: 30px !important;
} }
.div_table_title { .div_table_title {
margin-top: -10px; margin-top: -10px;
@ -719,5 +719,4 @@ export default {
flex: 1; flex: 1;
} }
} }
</style> </style>

302
src/views/modules/census/chart.vue

@ -1,163 +1,163 @@
<template> <template>
<div class="screenEchartsFrame" <div class="screenEchartsFrame" ref="screenEchartsFrame"></div>
ref="screenEchartsFrame"></div>
</template> </template>
<script> <script>
import * as echarts from 'echarts'; import * as echarts from 'echarts';
export default { export default {
name: 'screen-echarts-frame', name: 'screen-echarts-frame',
data () { data() {
return { return {
myChart: '' myChart: ''
} };
}, },
props: { props: {
chartMethod: { chartMethod: {
type: Function type: Function
} }
}, },
mounted () { mounted() {
this.initChart() this.initChart();
window.onresize = () => { window.onresize = () => {
this.myChart.resize() this.myChart.resize();
} };
}, },
beforeDestroy () { beforeDestroy() {
// echarts // echarts
if (this.myChart) this.myChart.dispose() if (this.myChart) this.myChart.dispose();
}, },
watch: {}, watch: {},
methods: { methods: {
initChart () { initChart() {
this.$nextTick(() => { this.$nextTick(() => {
const dom = this.$refs.screenEchartsFrame const dom = this.$refs.screenEchartsFrame;
this.myChart = echarts.init(dom) this.myChart = echarts.init(dom);
// this.myChart.setOption(this.chartMethod()) // this.myChart.setOption(this.chartMethod())
this.$emit('myChartMethod', this.myChart) this.$emit('myChartMethod', this.myChart);
}) });
}, },
// option // option
setOption (option) { setOption(option) {
this.myChart.setOption(option) this.myChart.setOption(option);
let than = this let than = this;
this.myChart.on('click',function(param){ this.myChart.off('click');
than.$emit('handelClickMyPei',param) this.myChart.on('click', function(param) {
}) than.$emit('handelClickMyPei', param);
}, });
// option },
getOption () { // option
if (this.myChart) { getOption() {
return this.myChart.getOption() if (this.myChart) {
} else { return this.myChart.getOption();
return null } else {
} return null;
}, }
// },
resize () { //
if (this.myChart) { resize() {
this.myChart.resize() if (this.myChart) {
} this.myChart.resize();
}, }
clear () { },
if (this.myChart) { clear() {
this.myChart.clear() if (this.myChart) {
} this.myChart.clear();
}, }
showLoading () { },
if (this.myChart) { showLoading() {
this.$nextTick(() => { if (this.myChart) {
this.myChart.showLoading({ this.$nextTick(() => {
text: '', this.myChart.showLoading({
color: '#29cdff', text: '',
textColor: '#29cdff', color: '#29cdff',
maskColor: 'rgba(255, 255, 255, 0)', textColor: '#29cdff',
zlevel: 0 maskColor: 'rgba(255, 255, 255, 0)',
}) zlevel: 0
}) });
} });
}, }
hideLoading () { },
if (this.myChart) { hideLoading() {
this.myChart.hideLoading() if (this.myChart) {
} this.myChart.hideLoading();
}, }
// 使 },
tooltipAnimate (chart, length) { // 使
// tooltipAnimate(chart, length) {
this.timeTicket && clearInterval(this.timeTicket) //
const count = 0 this.timeTicket && clearInterval(this.timeTicket);
// const count = 0;
this._action(chart, count, length) //
chart && // this._action(chart, count, length);
chart.on('mouseover', params => { chart && //
this._cleanAction(chart, params) chart.on('mouseover', params => {
}) this._cleanAction(chart, params);
// });
chart && //
chart.on('mouseout', () => { chart &&
this._action(chart, count, length) chart.on('mouseout', () => {
}) this._action(chart, count, length);
}, });
// tooltipaction },
_action (chart, count, length) { // tooltipaction
this.timeTicket && clearInterval(this.timeTicket) _action(chart, count, length) {
this.timeTicket = setInterval(() => { this.timeTicket && clearInterval(this.timeTicket);
if (!chart) { this.timeTicket = setInterval(() => {
clearInterval(this.timeTicket) if (!chart) {
return clearInterval(this.timeTicket);
} return;
chart && }
chart.dispatchAction({ chart &&
type: 'downplay', chart.dispatchAction({
seriesIndex: 0 type: 'downplay',
}) seriesIndex: 0
chart && });
chart.dispatchAction({ chart &&
type: 'highlight', chart.dispatchAction({
seriesIndex: 0, type: 'highlight',
dataIndex: count % length seriesIndex: 0,
}) dataIndex: count % length
chart && });
chart.dispatchAction({ chart &&
type: 'showTip', chart.dispatchAction({
seriesIndex: 0, type: 'showTip',
dataIndex: count % length seriesIndex: 0,
}) dataIndex: count % length
count++ });
}, 1000 * 3) count++;
}, }, 1000 * 3);
_cleanAction (chart, params) { },
this.timeTicket && clearInterval(this.timeTicket) _cleanAction(chart, params) {
if (!chart) { this.timeTicket && clearInterval(this.timeTicket);
clearInterval(this.timeTicket) if (!chart) {
return clearInterval(this.timeTicket);
} return;
chart && }
chart.dispatchAction({ chart &&
type: 'downplay', chart.dispatchAction({
seriesIndex: 0 type: 'downplay',
}) seriesIndex: 0
chart && });
chart.dispatchAction({ chart &&
type: 'highlight', chart.dispatchAction({
seriesIndex: 0, type: 'highlight',
dataIndex: params.dataIndex seriesIndex: 0,
}) dataIndex: params.dataIndex
chart && });
chart.dispatchAction({ chart &&
type: 'showTip', chart.dispatchAction({
seriesIndex: 0, type: 'showTip',
dataIndex: params.dataIndex seriesIndex: 0,
}) dataIndex: params.dataIndex
} });
} }
} }
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.screenEchartsFrame { .screenEchartsFrame {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
</style> </style>

Loading…
Cancel
Save