宣发统计

This commit is contained in:
liuye
2022-07-20 14:25:28 +08:00
parent 0fa2950bb7
commit 8aee36e808

View File

@@ -104,7 +104,9 @@
<div class="time-select" :class="departType == index ? 'active' : ''" v-for="(item, index) in dateTypeList" :key="index" @click="changeDepartType(index)">{{item}}</div> <div class="time-select" :class="departType == index ? 'active' : ''" v-for="(item, index) in dateTypeList" :key="index" @click="changeDepartType(index)">{{item}}</div>
</div> </div>
</div> </div>
<div id="departBarChart"></div> <div id="departBarChart">
<ai-empty v-if="!isDepartData"></ai-empty>
</div>
</div> </div>
<ai-dialog :visible.sync="dialogDate" title="选择时间" width="500px" customFooter :show-close="false"> <ai-dialog :visible.sync="dialogDate" title="选择时间" width="500px" customFooter :show-close="false">
@@ -119,7 +121,7 @@
<script> <script>
import * as echarts from "echarts"; import * as echarts from "echarts";
import { mapActions } from 'vuex'; import { mapActions, mapState } from 'vuex';
export default { export default {
name: 'AppAnnounceStatistics', name: 'AppAnnounceStatistics',
label: '协同宣发统计', label: '协同宣发统计',
@@ -150,10 +152,13 @@ import { mapActions } from 'vuex';
timeList: '', timeList: '',
deptList: [], deptList: [],
selectDeptName: '', selectDeptName: '',
isDepartData: true,
type: '', type: '',
} }
}, },
computed: {
...mapState(['user']),
},
watch: { watch: {
calendarDate: function() { calendarDate: function() {
var year = '' , month = '', date = '' var year = '' , month = '', date = ''
@@ -202,23 +207,6 @@ import { mapActions } from 'vuex';
this.getEffect() this.getEffect()
this.getDepart() this.getDepart()
this.dict.load("mstSendType") this.dict.load("mstSendType")
var items = [{type: 'departmentName', id: '10'}]
this.initOpenData({canvas:true})
setTimeout(() => {
this.transCanvas(items).then((data) => {
console.log(data)
})
}, 2000)
// WWOpenData.prefetch({ items }, (err, data) => {
// if (err) {
// console.log(err)
// }
// console.log(data)
// })
}, },
methods: { methods: {
...mapActions(['initOpenData', 'transCanvas']), ...mapActions(['initOpenData', 'transCanvas']),
@@ -325,17 +313,29 @@ import { mapActions } from 'vuex';
var startTime = this.timeList[0] || '' , endTime = this.timeList[1] || '' var startTime = this.timeList[0] || '' , endTime = this.timeList[1] || ''
this.instance.post(`/app/appmasssendingtask/statisticsDepart?type=${this.departType}&startTime=${startTime}&endTime=${endTime}`).then(res => { this.instance.post(`/app/appmasssendingtask/statisticsDepart?type=${this.departType}&startTime=${startTime}&endTime=${endTime}`).then(res => {
if (res.code == 0) { if (res.code == 0) {
// this.dateList = res.data if(res.data && res.data.length) {
// this.getTaskList(this.chooseDay) this.isDepartData = true
var items = [], xData = [], yData = []
this.setBarChart() res.data.map((item) => {
} var i = {type: 'departmentName', id: item.deptId, corpid: this.user.info.corpId}
items.push(i)
yData.push(item.taskCount)
}) })
this.initOpenData({canvas:true})
this.transCanvas(items).then((data) => {
data.items.map((i) => {
xData.push(i.data)
})
this.setBarChart(xData, yData)
})
}else {
this.isDepartData = false
}
}
})
}, },
setBarChart() { setBarChart(xData, yData) {
this.departBarChart = echarts.init(document.querySelector(`#departBarChart`)) this.departBarChart = echarts.init(document.querySelector(`#departBarChart`))
var option = { var option = {
color: ['#2891FF'], color: ['#2891FF'],
@@ -371,7 +371,7 @@ import { mapActions } from 'vuex';
} }
], ],
xAxis: { xAxis: {
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], data: xData,
silent: false, silent: false,
splitLine: { splitLine: {
show: false show: false
@@ -388,7 +388,7 @@ import { mapActions } from 'vuex';
series: [ series: [
{ {
type: 'bar', type: 'bar',
data:[120, 200, 150, 80, 70, 110, 130], data: yData,
barWidth: 20, barWidth: 20,
barGap: '250%', barGap: '250%',
large: true large: true