|
@@ -5,21 +5,16 @@
|
|
|
<div class="statistics-data">
|
|
|
<h2>{{ title }}统计</h2>
|
|
|
<div class="data-main">
|
|
|
- <div class="data-item">
|
|
|
- <label>交付已延期</label>
|
|
|
- <div class="number">1</div>
|
|
|
+ <div v-for="(item,index) in statisticsList" :key="title+'-statistics-'+index" class="data-item" @click="changeData(item.idList,item.label)">
|
|
|
+ <label>{{ item.label }}</label>
|
|
|
+ <div class="number">{{ item.total }}</div>
|
|
|
</div>
|
|
|
- <div class="data-item" />
|
|
|
- <div class="data-item" />
|
|
|
- <div class="data-item" />
|
|
|
- <div class="data-item" />
|
|
|
- <div class="data-item" />
|
|
|
</div>
|
|
|
</div>
|
|
|
<div v-if="title !=='缺陷'" class="statistics-chart">
|
|
|
<h2>未上线{{ title }}状态分布</h2>
|
|
|
<div class="chart-contain">
|
|
|
- <normal-echart v-if="echartsOption" :chart-id="type+title" :option="echartsOption" />
|
|
|
+ <normal-echart v-if="echartsOption" :chart-id="type+title" :option="echartsOption" @onClick="chartChange" />
|
|
|
</div>
|
|
|
</div>
|
|
|
<div v-if="title ==='缺陷'" class="statistics-chart">
|
|
@@ -29,10 +24,10 @@
|
|
|
</div>
|
|
|
<div class="two-chart-contain">
|
|
|
<div class="chart-contain">
|
|
|
- <normal-echart v-if="echartsOption" :chart-id="type+title+'1'" :option="echartsOption" />
|
|
|
+ <normal-echart v-if="echartsOption" :chart-id="type+title+'1'" :option="echartsOption" @onClick="chartChange" />
|
|
|
</div>
|
|
|
<div class="chart-contain">
|
|
|
- <normal-echart v-if="echartsOption" :chart-id="type+title+'2'" :option="echartsOption2" />
|
|
|
+ <normal-echart v-if="echartsOption2" :chart-id="type+title+'2'" :option="echartsOption2" @onClick="chartChange" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -65,7 +60,7 @@ export default {
|
|
|
},
|
|
|
type: { // 个人还是团队
|
|
|
type: String,
|
|
|
- default: 'person',
|
|
|
+ default: 'team',
|
|
|
required: false
|
|
|
},
|
|
|
title: {
|
|
@@ -82,6 +77,7 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
show: true,
|
|
|
+ statisticsList: [],
|
|
|
echartsOption: null,
|
|
|
echartsOption2: null,
|
|
|
tips: {
|
|
@@ -105,33 +101,86 @@ export default {
|
|
|
watch: {
|
|
|
searchForm: {
|
|
|
handler(newV) {
|
|
|
-
|
|
|
+ this.initData()
|
|
|
+ },
|
|
|
+ deep: true,
|
|
|
+ immediate: true
|
|
|
+ },
|
|
|
+ title: {
|
|
|
+ handler(newV) {
|
|
|
+ this.initData()
|
|
|
},
|
|
|
- deep: true
|
|
|
+ immediate: true
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- initData() {
|
|
|
+ initData() { // 初始化
|
|
|
if (this.requestObj) {
|
|
|
const { requestData, requestChart } = this.requestObj
|
|
|
this.getData(requestData)
|
|
|
- this.getChart(requestChart)
|
|
|
+ if (this.title === '缺陷') {
|
|
|
+ this.getChart(requestChart, '3')
|
|
|
+ this.getChart(requestChart, '5')
|
|
|
+ } else {
|
|
|
+ this.getChart(requestChart)
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
- async getData(requestUrl) {
|
|
|
- const res = await requestUrl()
|
|
|
+ async getData(requestUrl) { // 获取顶部数据
|
|
|
+ const res = await requestUrl({ teamSearchInfo: this.searchForm })
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.statisticsList = res.data || []
|
|
|
+ console.log(res.data)
|
|
|
+ this.changeData(this.statisticsList[0].idList, this.statisticsList[0].label)
|
|
|
+ }
|
|
|
},
|
|
|
- async getChart(requestUrl) {
|
|
|
- const res = await requestUrl()
|
|
|
+ async getChart(requestUrl, type) { // 获取图表数据
|
|
|
+ if (type) {
|
|
|
+ const res = await requestUrl({ teamSearchInfo: this.searchForm, type: type })
|
|
|
+ if (type === '3') {
|
|
|
+ this.echartsOption = this.setChart(res.data)
|
|
|
+ } else if (type === '5') {
|
|
|
+ this.echartsOption2 = this.setChart(res.data)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ const res = await requestUrl({ teamSearchInfo: this.searchForm })
|
|
|
+ this.echartsOption = this.setChart(res.data)
|
|
|
+ }
|
|
|
},
|
|
|
- changeData() {
|
|
|
- this.$emit('change', this.title)
|
|
|
+ setChart(chartData) { // 设置图表options
|
|
|
+ const childArr = chartData.xaxis.map((item, index) => {
|
|
|
+ return {
|
|
|
+ value: chartData.yaxis[0] && chartData.yaxis[0].data[index] || null,
|
|
|
+ idList: chartData.yaxis[0] && chartData.yaxis[0].idList[index] || []
|
|
|
+ }
|
|
|
+ })
|
|
|
+ const option = {
|
|
|
+ color: ['#3AA1FF'],
|
|
|
+ tooltip: { trigger: 'axis', axisPointer: { type: 'line' }}, // 默认为直线,可选为:'line' | 'shadow'
|
|
|
+ grid: { left: '0', right: '0', top: '10%', bottom: '0', containLabel: true },
|
|
|
+ xAxis: [{ type: 'category', data: chartData.xaxis, axisLabel: { interval: 0, rotate: 15 }, axisTick: { alignWithLabel: true }}],
|
|
|
+ yAxis: [{ type: 'value', axisLine: { show: false }, splitLine: { lineStyle: { type: 'dashed' }}}],
|
|
|
+ series: [{
|
|
|
+ name: '数量', type: 'bar', barWidth: '20px', data: childArr,
|
|
|
+ itemStyle: { normal: { label: { show: true, formatter: '{c}', position: 'top' }}}
|
|
|
+ }]
|
|
|
+ }
|
|
|
+ return option
|
|
|
+ },
|
|
|
+ chartChange(params) { // 点击图表产生触发列表更改
|
|
|
+ this.changeData(params.data.idList, params.name)
|
|
|
+ },
|
|
|
+ changeData(idList, name) { // 点击顶部数据触发列表更改
|
|
|
+ this.$emit('change', this.title, idList, name)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
+.color-red {
|
|
|
+ color:#E02020;
|
|
|
+}
|
|
|
.drawer-statistics {
|
|
|
position: relative;
|
|
|
width: 100%;
|
|
@@ -155,7 +204,7 @@ export default {
|
|
|
height: 474px;
|
|
|
padding: 27px 35px;
|
|
|
display: grid;
|
|
|
- grid-template-columns: repeat(2,50%);
|
|
|
+ grid-template-columns: 40% 60%;
|
|
|
h2 {
|
|
|
color: #333333;
|
|
|
font-size: 16px;
|
|
@@ -173,6 +222,7 @@ export default {
|
|
|
grid-row-gap: 20px;
|
|
|
}
|
|
|
.data-item {
|
|
|
+ cursor:pointer;
|
|
|
box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.2);
|
|
|
border-radius: 5px;
|
|
|
display: grid;
|
|
@@ -194,17 +244,19 @@ export default {
|
|
|
.two-title {
|
|
|
width: 100%;
|
|
|
display: grid;
|
|
|
- grid-template-columns: repeat(2,50%);
|
|
|
+ grid-template-columns: repeat(2,47.5%);
|
|
|
+ grid-column-gap: 5%;
|
|
|
}
|
|
|
.two-chart-contain {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
display: grid;
|
|
|
- grid-template-columns: repeat(2,50%);
|
|
|
+ grid-template-columns: repeat(2,47.5%);
|
|
|
+ grid-column-gap: 5%;
|
|
|
}
|
|
|
.chart-contain {
|
|
|
width: 100%;
|
|
|
- height: 350px;
|
|
|
+ height: 380px;
|
|
|
}
|
|
|
}
|
|
|
.drawer-statistics:after {
|