|
@@ -2,21 +2,33 @@
|
|
|
<div class="service-info">
|
|
|
<div class="card">
|
|
|
<h5 class="c-tit">为老服务商</h5>
|
|
|
- <div class="total">总数:<span>34092</span>家</div>
|
|
|
- <div id="echarts"></div>
|
|
|
+ <div class="total">总数:
|
|
|
+ <count-to :start-val="0" :end-val="+serviceObj.data1" :duration="duration" />
|
|
|
+ 家
|
|
|
+ </div>
|
|
|
+ <div id="echarts1"></div>
|
|
|
</div>
|
|
|
<div class="card">
|
|
|
<h5 class="c-tit">为老服务产品</h5>
|
|
|
- <div class="total">总计: <span>15</span>类<span>3452</span>个</div>
|
|
|
- <div id="echarts1"></div>
|
|
|
+ <div class="total">总计:
|
|
|
+ <count-to :start-val="0" :end-val="+productObj.data1" :duration="duration" />
|
|
|
+ 类
|
|
|
+ <count-to :start-val="0" :end-val="+productObj.data2" :duration="duration" />
|
|
|
+ 个
|
|
|
+ </div>
|
|
|
+ <div id="echarts2"></div>
|
|
|
<div class="flex product">
|
|
|
<div class="f-item1">
|
|
|
<div class="percent">成交笔数</div>
|
|
|
- <p>2550笔</p>
|
|
|
+ <p>
|
|
|
+ <count-to :start-val="0" :end-val="+productObj.data3" :duration="duration" suffix="笔" />
|
|
|
+ </p>
|
|
|
</div>
|
|
|
<div class="f-item1">
|
|
|
<div class="percent">交易金额</div>
|
|
|
- <p>2514650元</p>
|
|
|
+ <p>
|
|
|
+ <count-to :start-val="0" :end-val="+productObj.data4" :duration="duration" suffix="元" />
|
|
|
+ </p>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -24,29 +36,74 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { getstatisticaldata } from '@/api/system/dict/type'
|
|
|
+import { mapState } from 'vuex'
|
|
|
+
|
|
|
export default {
|
|
|
name: 'Service',
|
|
|
data() {
|
|
|
return {
|
|
|
- serviceChart: null
|
|
|
+ duration: 2000, // 数字滚动时间
|
|
|
+ serviceChart: null,
|
|
|
+ queryParams: {
|
|
|
+ dictType: 'DP001',
|
|
|
+ para2: null // 区划ID locationCode
|
|
|
+ },
|
|
|
+ serviceList: [],
|
|
|
+ productList: [],
|
|
|
+ productObj: {
|
|
|
+ data1: 0,
|
|
|
+ data2: 0,
|
|
|
+ data3: 0,
|
|
|
+ data4: 0
|
|
|
+ },
|
|
|
+ serviceObj: { data1: 0 }
|
|
|
}
|
|
|
},
|
|
|
- mounted() {
|
|
|
- this.$nextTick(() => {
|
|
|
- this.echartsInit()
|
|
|
- })
|
|
|
+ computed: {
|
|
|
+ ...mapState(['user'])
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.queryParams.para2 = this.user.userData.dept.locationCode
|
|
|
+ this.getProductList()
|
|
|
+ this.getServiceList()
|
|
|
},
|
|
|
methods: {
|
|
|
- echartsInit() {
|
|
|
- let serviceChart = this.$echarts.init(document.getElementById('echarts'), 'dark')
|
|
|
- let productChart = this.$echarts.init(document.getElementById('echarts1'), 'dark')
|
|
|
- const options = {
|
|
|
+ echartsInit(divId, source) {
|
|
|
+ let vales = source.vales[0], xAisData = [], seriesData = [['男'], ['女']]
|
|
|
+ source.keys.forEach((item, idx) => {
|
|
|
+ item.label = item.label.replace('男', '')
|
|
|
+ item.label = item.label.replace('女', '')
|
|
|
+ if (idx % 2 === 0) {
|
|
|
+ seriesData[0].push(vales[item.prop])
|
|
|
+ } else {
|
|
|
+ seriesData[1].push(vales[item.prop])
|
|
|
+ xAisData.push(item.label)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ console.log(seriesData)
|
|
|
+ this.ageChart = this.$echarts.init(document.getElementById(divId), 'dark')
|
|
|
+
|
|
|
+ const seriresTemp = {
|
|
|
+ type: 'bar',
|
|
|
+ barMaxWidth: '30%',
|
|
|
+ // name: '男',
|
|
|
+ // data: [10086, 9000, 6000, 2569, 1006],
|
|
|
+ colorBy: 'series',
|
|
|
+ label: {
|
|
|
+ show: true,
|
|
|
+ position: 'top',
|
|
|
+ color: '#fff'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.ageChart.setOption({
|
|
|
title: {},
|
|
|
+ color: ['#1f48cb', '#d52abe', '#fac858', '#ee6666', '#73c0de', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc'],
|
|
|
grid: {
|
|
|
left: 10,
|
|
|
right: 10,
|
|
|
bottom: 10,
|
|
|
- top: 20,
|
|
|
+ top: 40,
|
|
|
containLabel: true
|
|
|
},
|
|
|
legend: {},
|
|
@@ -66,31 +123,40 @@ export default {
|
|
|
nameTextStyle: {
|
|
|
color: '#36a3f7'
|
|
|
},
|
|
|
- data: ['60+老人', '70+老人', '80+老人', '90+老人', '100+老人']
|
|
|
+ data: xAisData
|
|
|
},
|
|
|
yAxis: {
|
|
|
axisLine: {
|
|
|
show: true
|
|
|
}
|
|
|
},
|
|
|
- series: [
|
|
|
- {
|
|
|
- type: 'bar',
|
|
|
- data: [10086, 9000, 6000, 2569, 1006],
|
|
|
- barMaxWidth: '30%',
|
|
|
- label: {
|
|
|
- show: true,
|
|
|
- position: 'top',
|
|
|
- color: '#fff'
|
|
|
- },
|
|
|
- itemStyle: {
|
|
|
- color: '#36a3f7'
|
|
|
- }
|
|
|
- },
|
|
|
- ]
|
|
|
+ series: seriesData.map((item, i) => {
|
|
|
+ let name = item.splice(0, 1)
|
|
|
+ return { ...seriresTemp, name: name[0], data: item }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ async getServiceList() {
|
|
|
+ this.queryParams.dictType = 'DP007'
|
|
|
+ const retdata = await getstatisticaldata(this.queryParams)
|
|
|
+ if (retdata.code === 200) {
|
|
|
+ const data = this.$DBRetToObjA(retdata.data)
|
|
|
+ console.log(data)
|
|
|
+ this.serviceList = data[0]
|
|
|
+ this.serviceObj = data[0].vales[0]
|
|
|
+ this.echartsInit('echarts1', this.serviceList)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async getProductList() {
|
|
|
+ this.queryParams.dictType = 'DP003'
|
|
|
+ const retdata = await getstatisticaldata(this.queryParams)
|
|
|
+ if (retdata.code === 200) {
|
|
|
+ const data = this.$DBRetToObjA(retdata.data)
|
|
|
+ console.log('getProductList', data)
|
|
|
+ this.productList = data[0]
|
|
|
+ this.productObj = data[0].vales[0]
|
|
|
+ this.echartsInit('echarts2', this.productList)
|
|
|
}
|
|
|
- serviceChart.setOption(options)
|
|
|
- productChart.setOption(options)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -128,8 +194,8 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-#echarts,#echarts1 {
|
|
|
- height: 300px;
|
|
|
+#echarts, #echarts1 {
|
|
|
+ height: 200px;
|
|
|
width: 100%;
|
|
|
}
|
|
|
</style>
|