|
@@ -110,16 +110,16 @@
|
|
|
<div>备件类型数量统计</div>
|
|
|
<!-- <div>设备总数100</div> -->
|
|
|
</div>
|
|
|
- <div id="container-pie"></div>
|
|
|
+ <chart-view height="400px" :chartOption="chartOption1" />
|
|
|
</div>
|
|
|
</a-col>
|
|
|
<a-col class="gutter-row" :span="12">
|
|
|
<div style="height: 471px;background: #FFFFFF; padding:24px;">
|
|
|
- <div style="display:flex;justify-content: space-between;width:190px;height: 18px; font-size:16px;color: #555555; margin-bottom:80px;">
|
|
|
+ <div style="display:flex;justify-content: space-between;width:190px;height: 18px; font-size:16px;color: #555555; margin-bottom:20px;">
|
|
|
<div style="width: 7px;background: #4D86ED;"></div>
|
|
|
<div>近一周每日出入库数据</div>
|
|
|
</div>
|
|
|
- <div id="container-line"></div>
|
|
|
+ <chart-view height="360px" :chartOption="chartOption2" />
|
|
|
</div>
|
|
|
</a-col>
|
|
|
<a-col class="gutter-row" :span="4">
|
|
@@ -226,6 +226,7 @@ import { STable } from '@/components'
|
|
|
import { getWorkplaceBacklogUserPage, getWorkplaceBacklogTopData, getWorkplaceBacklogWeekData, getWorkplaceBacklogPie } from '@/api/workplace/backlog'
|
|
|
import { getCalendarNotice } from '@/api/repair/application-form'
|
|
|
import { Chart } from '@antv/g2'
|
|
|
+import cookie from 'vue-cookie'
|
|
|
export default {
|
|
|
name: 'NewWorkplaceBacklog',
|
|
|
components: {
|
|
@@ -361,6 +362,99 @@ export default {
|
|
|
} else {
|
|
|
return 'undifined'
|
|
|
}
|
|
|
+ },
|
|
|
+ chartOption1 () {
|
|
|
+ return {
|
|
|
+ legend: {
|
|
|
+ type: 'scroll',
|
|
|
+ top: '10%'
|
|
|
+ },
|
|
|
+ grid: {
|
|
|
+ left: '3%',
|
|
|
+ right: '4%',
|
|
|
+ bottom: '3%',
|
|
|
+ containLabel: true
|
|
|
+ },
|
|
|
+ series: [
|
|
|
+ {
|
|
|
+ type: 'pie',
|
|
|
+ center: ['50%', '50%'],
|
|
|
+ radius: [50, 100],
|
|
|
+ label: {
|
|
|
+ formatter: `{b}:{c}`,
|
|
|
+ textBorderColor: '#000',
|
|
|
+ textBorderWidth: 0,
|
|
|
+ fontSize: 16,
|
|
|
+ overflow: 'breakAll',
|
|
|
+ labelLine: {
|
|
|
+ length: 3
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ data: this.equipmentData
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ chartOption2 () {
|
|
|
+ return {
|
|
|
+ // tooltip: {
|
|
|
+ // trigger: 'axis',
|
|
|
+ // axisPointer: {
|
|
|
+ // type: 'shadow'
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ legend: {},
|
|
|
+ grid: {
|
|
|
+ left: '3%',
|
|
|
+ right: '4%',
|
|
|
+ bottom: '3%',
|
|
|
+ containLabel: true
|
|
|
+ },
|
|
|
+ yAxis: {
|
|
|
+ type: 'value'
|
|
|
+ },
|
|
|
+ xAxis: {
|
|
|
+ type: 'category',
|
|
|
+ data: this.lineData.inStoreDetailVOS.map(item => item.weekDayName)
|
|
|
+ },
|
|
|
+ series: [
|
|
|
+ {
|
|
|
+ name: '入库数',
|
|
|
+ type: 'bar',
|
|
|
+ data: this.lineData.inStoreDetailVOS.map(item => item.num),
|
|
|
+ itemStyle: {
|
|
|
+ normal: {
|
|
|
+ label: {
|
|
|
+ show: true, // 开启显示
|
|
|
+ position: 'top', // 在上方显示
|
|
|
+ textStyle: { // 数值样式
|
|
|
+ color: 'black',
|
|
|
+ fontSize: 16
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '出库数',
|
|
|
+ type: 'bar',
|
|
|
+ data: this.lineData.outStoreDetailVOS.map(item => item.num),
|
|
|
+ itemStyle: {
|
|
|
+ normal: {
|
|
|
+ label: {
|
|
|
+ show: true, // 开启显示
|
|
|
+ position: 'top', // 在上方显示
|
|
|
+ textStyle: { // 数值样式
|
|
|
+ color: 'black',
|
|
|
+ fontSize: 16
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
created () {
|
|
@@ -370,14 +464,6 @@ export default {
|
|
|
},
|
|
|
mounted () {
|
|
|
},
|
|
|
- updated () {
|
|
|
- if (this.lineData.length > 0 && this.equipmentData.length > 0) {
|
|
|
- this.$nextTick(function () {
|
|
|
- this.getPieCharts('container-pie', this.equipmentData)
|
|
|
- this.getLineCharts('container-line', this.lineData)
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
methods: {
|
|
|
getDict () {
|
|
|
this.typeDict = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.WORKPLACE_BACKLOG_TYPE)
|
|
@@ -404,36 +490,17 @@ export default {
|
|
|
getWorkplaceBacklogPie(this.role),
|
|
|
getWorkplaceBacklogTopData(this.role)
|
|
|
]).then(res => {
|
|
|
- const data = res[0].data.inStoreDetailVOS.reduce((pre, item) => {
|
|
|
- pre.push({
|
|
|
- week: item.weekDayName,
|
|
|
- value: item.num,
|
|
|
- name: '入库'
|
|
|
- })
|
|
|
- return pre
|
|
|
- }, [])
|
|
|
- data.push(
|
|
|
- ...res[0].data.outStoreDetailVOS.reduce((pre, item) => {
|
|
|
- pre.push({
|
|
|
- week: item.weekDayName,
|
|
|
- value: item.num,
|
|
|
- name: '出库'
|
|
|
-
|
|
|
- })
|
|
|
- return pre
|
|
|
- }, [])
|
|
|
- )
|
|
|
- this.lineData = data
|
|
|
const data2 = res[1].data.reduce((pre, item) => {
|
|
|
pre.push({
|
|
|
- item: item.name,
|
|
|
- count: item.currentStock,
|
|
|
- percent: item.currentStock
|
|
|
+ name: item.name,
|
|
|
+ value: item.currentStock
|
|
|
})
|
|
|
return pre
|
|
|
}, [])
|
|
|
this.equipmentData = data2
|
|
|
this.topData = res[2].data
|
|
|
+ this.lineData = res[0].data
|
|
|
+ console.log(res[0].data)
|
|
|
})
|
|
|
},
|
|
|
handleView (record) {
|
|
@@ -442,95 +509,6 @@ export default {
|
|
|
modal.base(res.data)
|
|
|
})
|
|
|
},
|
|
|
- getPieCharts (id, data) {
|
|
|
- this.chartPie && this.chartPie.destroy()// 防止点击搜索按钮新增一个
|
|
|
- this.chartPie = new Chart({
|
|
|
- container: id,
|
|
|
- autoFit: true,
|
|
|
- height: 400
|
|
|
- })
|
|
|
- this.chartPie.data(data)
|
|
|
- this.chartPie.scale('count', {
|
|
|
- nice: true
|
|
|
- })
|
|
|
- this.chartPie.coordinate('theta', {
|
|
|
- radius: 0.6,
|
|
|
- innerRadius: 0.5
|
|
|
- })
|
|
|
- this.chartPie.tooltip({
|
|
|
- showTitle: false,
|
|
|
- showMarkers: false,
|
|
|
- itemTpl: `<li class="g2-tooltip-list-item">
|
|
|
- <span style="background-color:{color};" class="g2-tooltip-marker"></span>
|
|
|
- {name}: {value}
|
|
|
- </li>`
|
|
|
- })
|
|
|
- // 辅助文本
|
|
|
- this.chartPie
|
|
|
- .annotation()
|
|
|
- this.chartPie
|
|
|
- .interval()
|
|
|
- .adjust('stack')
|
|
|
- .position('percent')
|
|
|
- .color('item')
|
|
|
- .label('percent', (percent) => {
|
|
|
- return {
|
|
|
- content: (data) => {
|
|
|
- return `${data.item}: ${percent}`
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- .tooltip('item*count', (item, count) => {
|
|
|
- return {
|
|
|
- name: item,
|
|
|
- value: count
|
|
|
- }
|
|
|
- })
|
|
|
- // this.chartPie.interaction('element-active')
|
|
|
- this.chartPie.interaction('active-region')
|
|
|
-
|
|
|
- this.chartPie.render()
|
|
|
- },
|
|
|
- getLineCharts (id, data) {
|
|
|
- this.chartLine = new Chart({
|
|
|
- container: id,
|
|
|
- autoFit: true,
|
|
|
- height: 300
|
|
|
- })
|
|
|
-
|
|
|
- this.chartLine.data(data)
|
|
|
- this.chartLine.scale({
|
|
|
-
|
|
|
- value: {
|
|
|
- min: 0,
|
|
|
- nice: true
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- this.chartLine.tooltip({
|
|
|
- showCrosshairs: true, // 展示 Tooltip 辅助线
|
|
|
- shared: true
|
|
|
- })
|
|
|
-
|
|
|
- this.chartLine.axis('value', {
|
|
|
- label: {
|
|
|
- formatter: (val) => {
|
|
|
- return val
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- this.chartLine.interval().position('week*value').color('name').adjust([
|
|
|
- {
|
|
|
- type: 'dodge',
|
|
|
- marginRatio: 0
|
|
|
- }
|
|
|
- ])
|
|
|
-
|
|
|
- this.chartLine.interaction('active-region')
|
|
|
-
|
|
|
- this.chartLine.render()
|
|
|
- },
|
|
|
handleOk () {
|
|
|
this.visible = true
|
|
|
this.getDict()
|