订单监控图
This commit is contained in:
@@ -65,7 +65,7 @@ const tableProps = [
|
||||
prop: 'createTime',
|
||||
label: '添加时间',
|
||||
filter: parseTime,
|
||||
minWidth: 150
|
||||
minWidth: 160
|
||||
},
|
||||
{
|
||||
prop: 'name',
|
||||
@@ -101,12 +101,12 @@ const tableProps = [
|
||||
{
|
||||
prop: 'planQuantity',
|
||||
label: '计划加工量',
|
||||
width: 90
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
prop: 'actualQuantity',
|
||||
label: '实际加工量',
|
||||
width: 90
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
prop: 'productName',
|
||||
@@ -341,6 +341,7 @@ export default {
|
||||
item.customerId = i.name
|
||||
}
|
||||
}
|
||||
item.price = item.price.toFixed(2)
|
||||
})
|
||||
this.list = arr
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<span class="blueTitle"></span>
|
||||
<span>订单编码: {{orderMsg.code}}</span>
|
||||
</div>
|
||||
<el-button type="primary" plain size="small" style="float: right;" @click="returnOrderManage">返回</el-button>
|
||||
<div style="padding-left: 14px;">
|
||||
<el-row>
|
||||
<el-col :span='3'>
|
||||
@@ -133,7 +134,7 @@ const tableProps1 = [
|
||||
prop: 'issueTime',
|
||||
label: '下发时间',
|
||||
filter: parseTime,
|
||||
minWidth: 150
|
||||
minWidth: 160
|
||||
},
|
||||
{
|
||||
prop: 'name',
|
||||
@@ -147,19 +148,19 @@ const tableProps1 = [
|
||||
minWidth: 150
|
||||
},
|
||||
{
|
||||
prop: 'planQuantity',
|
||||
prop: 'planAssignmentQuantity',
|
||||
label: '计划加工量',
|
||||
width: 90
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
prop: 'actualQuantity',
|
||||
label: '实际加工量',
|
||||
width: 90
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
prop: 'actualArea',
|
||||
label: '加工平方数',
|
||||
width: 90
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
prop: 'status',
|
||||
@@ -170,13 +171,13 @@ const tableProps1 = [
|
||||
prop: 'startProduceTime',
|
||||
label: '开始时间',
|
||||
filter: parseTime,
|
||||
minWidth: 150
|
||||
minWidth: 160
|
||||
},
|
||||
{
|
||||
prop: 'finishProduceTime',
|
||||
label: '结束时间',
|
||||
filter: parseTime,
|
||||
minWidth: 150
|
||||
minWidth: 160
|
||||
},
|
||||
{
|
||||
prop: 'productLineNames',
|
||||
@@ -278,6 +279,10 @@ export default {
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
// 返回
|
||||
returnOrderManage() {
|
||||
this.$router.push({path: '/order/base/order-manage'})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
168
src/views/order/monitoring/components/monitoringRingCharts.vue
Normal file
168
src/views/order/monitoring/components/monitoringRingCharts.vue
Normal file
@@ -0,0 +1,168 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="boxTitle">
|
||||
<span class="blueTitle"></span>
|
||||
<span>各订单环形图</span>
|
||||
</div>
|
||||
<div class="chartBox" id='orderChartBox' v-show='chartList.length'>
|
||||
<div class="chartItem" v-for="(item, index) in chartList" :key='index' :style="{width: 388*beilv+'px',height: 286*beilv+'px',padding:14*beilv+'px',marginRight:9*beilv+'px',marginBottom:9*beilv+'px'}">
|
||||
<div class="topTitle" :style="{fontSize: 14 * beilv + 'px'}">
|
||||
<svg-icon icon-class="order-monitoring" :style="{fontSize: 16*beilv+'px'}"/>
|
||||
<span class="orderName" :style="{paddingRight:8*beilv+'px',marginRight:8*beilv+'px'}">{{item.orderName}}</span>
|
||||
<span>订单计划数量{{item.num}}</span>
|
||||
</div>
|
||||
<div
|
||||
:id="item.id"
|
||||
:style="{width: 166*beilv+'px',height: 166*beilv+'px',margin: 'auto'}"
|
||||
></div>
|
||||
<div class="legend" :style="{height: 54 * beilv + 'px', marginTop: 10*beilv+'px'}">
|
||||
<div class="legendItem" v-for="(subItem, i) in item.workOrder" :key='i' :style="{paddingRight:9*beilv+'px',marginRight:9*beilv+'px'}">
|
||||
<span class="itemNum" :style="{fontSize: 18 * beilv + 'px'}">{{subItem.value}}</span>
|
||||
<div>
|
||||
<span class="itemName" :style="{fontSize: 14 * beilv + 'px'}">
|
||||
<span class="smallBlock" :style="{backgroundColor:subItem.color,width:8*beilv+'px',height:8*beilv+'px'}"></span>
|
||||
{{subItem.name}}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 空图 -->
|
||||
<div class="no-data-bg" v-show='!chartList.length'></div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import * as echarts from 'echarts'
|
||||
import { debounce } from '@/utils/debounce'
|
||||
export default {
|
||||
name: 'MonitoringRingCharts',
|
||||
props: {
|
||||
chartList: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
myChart: [],
|
||||
beilv: 1,
|
||||
canvasReset: ''
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.beilv = document.getElementById('orderChartBox').offsetWidth / 1610
|
||||
this.canvasReset = debounce(() => {
|
||||
this.initChart()
|
||||
}, 500)
|
||||
window.addEventListener('resize', () => {
|
||||
this.beilv = document.getElementById('orderChartBox').offsetWidth / 1610
|
||||
this.canvasReset()
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 饼图
|
||||
initChart() {
|
||||
if (this.chartList.length <= 0) {
|
||||
return false
|
||||
}
|
||||
// 销毁实例
|
||||
for (let j = 0;j < this.chartList.length; j++) {
|
||||
if (this.myChart[j]) {
|
||||
this.myChart[j].dispose() // 页面多次刷新会出现警告,Dom已经初始化了一个实例,这是销毁实例
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < this.chartList.length; i++) {
|
||||
var chartDom = document.getElementById(this.chartList[i].id);
|
||||
this.myChart[i] = echarts.init(chartDom);
|
||||
let colorList = []
|
||||
this.chartList[i].workOrder.map(item => {
|
||||
colorList.push(item.color)
|
||||
})
|
||||
let percentage = (this.chartList[i].sunNum/this.chartList[i].num*100).toFixed(0)
|
||||
var option = {
|
||||
color: colorList,
|
||||
series: [
|
||||
{
|
||||
name: 'Access From',
|
||||
type: 'pie',
|
||||
radius: ['75%', '95%'],
|
||||
avoidLabelOverlap: false,
|
||||
itemStyle: {
|
||||
borderRadius: 5,
|
||||
borderColor: '#fff',
|
||||
borderWidth: 2
|
||||
},
|
||||
label: {
|
||||
show: true,
|
||||
position: 'center',
|
||||
color: '#000',
|
||||
formatter: [
|
||||
'{a|'+percentage+'%}',
|
||||
'{b|生产'+this.chartList[i].sunNum+'}'
|
||||
].join('\n\n'),
|
||||
rich: {
|
||||
a: {
|
||||
fontSize: this.beilv*24 +'px'
|
||||
},
|
||||
b: {
|
||||
fontSize: this.beilv*12 +'px'
|
||||
}
|
||||
}
|
||||
},
|
||||
emphasis: {
|
||||
disabled: true
|
||||
},
|
||||
labelLine: {
|
||||
show: false
|
||||
},
|
||||
data: this.chartList[i].workOrder
|
||||
}
|
||||
]
|
||||
};
|
||||
option && this.myChart[i].setOption(option)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang='scss' scoped>
|
||||
.chartBox {
|
||||
width: 100%;
|
||||
padding-right: 6px;
|
||||
height: calc(100vh - 310px);
|
||||
display: flex;
|
||||
flex-flow: row wrap;
|
||||
overflow: auto;
|
||||
align-content: flex-start;
|
||||
.chartItem {
|
||||
border-radius: 8px;
|
||||
border: 1px solid #CACACA;
|
||||
.topTitle {
|
||||
margin-bottom: 10px;
|
||||
.orderName {
|
||||
border-right: 1px solid #CACACA;
|
||||
}
|
||||
}
|
||||
.legend {
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
overflow: auto;
|
||||
.legendItem {
|
||||
display: inline-block;
|
||||
border-right: 1px solid #E8E8E8;
|
||||
.itemName {
|
||||
.smallBlock {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
}
|
||||
.legendItem:last-child {
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -6,59 +6,45 @@
|
||||
ref="searchBarForm"
|
||||
@headBtnClick="buttonClick"
|
||||
/>
|
||||
<base-table
|
||||
:page="1"
|
||||
:limit="5000"
|
||||
:table-props="tableProps"
|
||||
:table-data="list"
|
||||
:max-height="tableH"
|
||||
>
|
||||
<method-btn
|
||||
v-if="tableBtn.length"
|
||||
slot="handleBtn"
|
||||
:width="250"
|
||||
label="操作"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleClick"
|
||||
<el-tabs v-model="activeName" @tab-click="toggleTab">
|
||||
<el-tab-pane label="数据列表" name="dataList"></el-tab-pane>
|
||||
<el-tab-pane label="环形图" name="barChart"></el-tab-pane>
|
||||
</el-tabs>
|
||||
<!-- 表 -->
|
||||
<div v-if="activeName === 'dataList'">
|
||||
<base-table
|
||||
:page="queryParams.pageNo"
|
||||
:limit="queryParams.pageSize"
|
||||
:table-props="tableProps"
|
||||
:table-data="list"
|
||||
:max-height="tableH"
|
||||
>
|
||||
<method-btn
|
||||
v-if="tableBtn.length"
|
||||
slot="handleBtn"
|
||||
:width="250"
|
||||
label="操作"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleClick"
|
||||
/>
|
||||
</base-table>
|
||||
<pagination
|
||||
:page.sync="queryParams.pageNo"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
:total="total"
|
||||
@pagination="getPage"
|
||||
/>
|
||||
</base-table>
|
||||
<!-- <el-tabs v-model="activeName" @tab-click="toggleTab">
|
||||
<el-tab-pane label="数据列表" name="dataList">
|
||||
<base-table
|
||||
:page="queryParams.pageNo"
|
||||
:limit="queryParams.pageSize"
|
||||
:table-props="tableProps"
|
||||
:table-data="list"
|
||||
:max-height="tableH"
|
||||
>
|
||||
<method-btn
|
||||
v-if="tableBtn.length"
|
||||
slot="handleBtn"
|
||||
:width="250"
|
||||
label="操作"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleClick"
|
||||
/>
|
||||
</base-table>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="环形图" name="barChart">
|
||||
<div class="boxTitle">
|
||||
<span class="blueTitle"></span>
|
||||
<span>各订单环形图</span>
|
||||
</div>
|
||||
<div
|
||||
id="orderPieBar"
|
||||
style="width: 182px; height: 180px;"
|
||||
></div>
|
||||
</el-tab-pane>
|
||||
</el-tabs> -->
|
||||
</div>
|
||||
<!-- 图 -->
|
||||
<monitoring-ring-charts ref='monitoringRingCharts' v-else :chart-list='chartList'/>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import * as echarts from 'echarts'
|
||||
import { parseTime } from '@/utils/ruoyi'
|
||||
import { publicFormatter } from '@/utils/dict'
|
||||
import { orderMonitor, orderList } from '@/api/base/orderManage'
|
||||
import { orderMonitor, orderAssignmentList } from '@/api/base/orderManage'
|
||||
import MonitoringRingCharts from './../components/monitoringRingCharts'
|
||||
import moment from "moment"
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'name',
|
||||
@@ -76,13 +62,13 @@ const tableProps = [
|
||||
prop: 'planStartTime',
|
||||
label: '计划开始时间',
|
||||
filter: parseTime,
|
||||
minWidth: 150
|
||||
minWidth: 160
|
||||
},
|
||||
{
|
||||
prop: 'planFinishTime',
|
||||
label: '计划完成时间',
|
||||
filter: parseTime,
|
||||
minWidth: 150
|
||||
minWidth: 160
|
||||
},
|
||||
{
|
||||
prop: 'status',
|
||||
@@ -93,13 +79,13 @@ const tableProps = [
|
||||
prop: 'startProduceTime',
|
||||
label: '实际开始时间',
|
||||
filter: parseTime,
|
||||
minWidth: 150
|
||||
minWidth: 160
|
||||
},
|
||||
{
|
||||
prop: 'finishProduceTime',
|
||||
label: '实际完成时间',
|
||||
filter: parseTime,
|
||||
minWidth: 150
|
||||
minWidth: 160
|
||||
},
|
||||
{
|
||||
prop: 'productLines',
|
||||
@@ -125,7 +111,7 @@ const tableProps = [
|
||||
{
|
||||
prop: 'workOrderNum',
|
||||
label: '关联工单数量',
|
||||
width: 100
|
||||
width: 110
|
||||
}
|
||||
]
|
||||
export default {
|
||||
@@ -134,9 +120,8 @@ export default {
|
||||
return {
|
||||
formConfig: [
|
||||
{
|
||||
type: 'select',
|
||||
type: 'input',
|
||||
label: '订单名称',
|
||||
selectOptions: [],
|
||||
param: 'name'
|
||||
},
|
||||
{
|
||||
@@ -162,15 +147,14 @@ export default {
|
||||
activeName: 'dataList',
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
// pageNo: 1,
|
||||
// pageSize: 5000,
|
||||
pageNo: 1,
|
||||
pageSize: 20,
|
||||
name: null,
|
||||
startProduceTime: []
|
||||
},
|
||||
tableProps,
|
||||
list: [],
|
||||
// tableH: this.tableHeight(270),
|
||||
tableH: this.tableHeight(230),
|
||||
tableH: this.tableHeight(315),
|
||||
total: 0,
|
||||
tableBtn: [
|
||||
this.$auth.hasPermi('base:order-completion-monitoring:orderDet')
|
||||
@@ -191,149 +175,79 @@ export default {
|
||||
btnName: '发货详情'
|
||||
}
|
||||
: undefined
|
||||
].filter((v) => v)
|
||||
].filter((v) => v),
|
||||
chartList: []
|
||||
}
|
||||
},
|
||||
components: { MonitoringRingCharts },
|
||||
mounted() {
|
||||
window.addEventListener('resize', () => {
|
||||
// this.tableH = this.tableHeight(270)
|
||||
this.tableH = this.tableHeight(230)
|
||||
this.tableH = this.tableHeight(315)
|
||||
})
|
||||
this.getOrderList()
|
||||
let start = moment().subtract(30, 'days').format('yyyy-MM-DD')
|
||||
let end = moment().format('yyyy-MM-DD')
|
||||
this.formConfig[1].defaultSelect = [start, end]
|
||||
this.queryParams.startProduceTime[0] = start + ' 00:00:00'
|
||||
this.queryParams.startProduceTime[1] = end + ' 23:59:59'
|
||||
this.getPage()
|
||||
},
|
||||
methods: {
|
||||
getOrderList() {
|
||||
orderList({}).then(res => {
|
||||
this.formConfig[0].selectOptions = res.data || []
|
||||
})
|
||||
},
|
||||
getPage() {
|
||||
// 表数据
|
||||
orderMonitor({...this.queryParams}).then(res => {
|
||||
this.list = res.data || []
|
||||
// this.getPieChart()
|
||||
this.list = res.data.records || []
|
||||
this.total = res.data.total || 0
|
||||
if (this.list.length > 0) {
|
||||
let orderIdList = []
|
||||
this.list.map(item => {
|
||||
orderIdList.push(item.orderid)
|
||||
})
|
||||
// 图的数据
|
||||
orderAssignmentList({orderIdList:orderIdList}).then(res => {
|
||||
let color = ['#7164FF','#288AFF','#63BDFF','#8EF0AB','#FFCE6A']
|
||||
let tempArr = res.data || {}
|
||||
let tempArr2 = []
|
||||
for (let key in tempArr) {
|
||||
let tempArr3 = []
|
||||
let obj = {}
|
||||
obj.orderName = tempArr[key][0].orderName
|
||||
obj.id = key
|
||||
obj.num = tempArr[key][0].planQuantity
|
||||
let sunNum = 0
|
||||
for (let i = 0; i < tempArr[key].length; i++) {
|
||||
let subObj = {}
|
||||
subObj.value = tempArr[key][i].actualAssignmentQuantity
|
||||
subObj.name = tempArr[key][i].woName
|
||||
if (i < 5) {
|
||||
subObj.color = color[i]
|
||||
} else {
|
||||
subObj.color = color[i%5]
|
||||
}
|
||||
sunNum+=tempArr[key][i].actualAssignmentQuantity
|
||||
tempArr3.push(subObj)
|
||||
}
|
||||
tempArr3.push({
|
||||
value: tempArr[key][0].planQuantity - sunNum > 0 ? tempArr[key][0].planQuantity - sunNum : 0,
|
||||
name: '未下发',
|
||||
color: '#F5F5F5'
|
||||
})
|
||||
obj.sunNum = sunNum
|
||||
obj.workOrder = tempArr3
|
||||
tempArr2.push(obj)
|
||||
}
|
||||
this.chartList = tempArr2
|
||||
if (this.activeName === 'barChart' && this.chartList.length > 0) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.monitoringRingCharts.initChart()
|
||||
})
|
||||
}
|
||||
})
|
||||
}else{
|
||||
// 显示无数据的图片
|
||||
this.chartList = []
|
||||
}
|
||||
})
|
||||
},
|
||||
// 饼图
|
||||
getPieChart() {
|
||||
var chartDom = document.getElementById('orderPieBar');
|
||||
var myChart = echarts.init(chartDom);
|
||||
var option = {
|
||||
color:['#288AFF','#7164FF','#fff','#63BDFF','#8EF0AB','#FFCE6A'],
|
||||
series: [
|
||||
{
|
||||
name: 'Access From',
|
||||
type: 'pie',
|
||||
radius: ['92%', '100%'],
|
||||
avoidLabelOverlap: false,
|
||||
label: {
|
||||
show: true,
|
||||
position: 'center'
|
||||
},
|
||||
emphasis: {
|
||||
disabled: true,
|
||||
scale:false,
|
||||
scaleSize: 0
|
||||
},
|
||||
labelLine: {
|
||||
show: false
|
||||
},
|
||||
data: [
|
||||
{ value: 1000, name: '1' }
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'Access From',
|
||||
type: 'pie',
|
||||
radius: ['84%', '92%'],
|
||||
avoidLabelOverlap: false,
|
||||
label: {
|
||||
show: false,
|
||||
position: 'center'
|
||||
},
|
||||
emphasis: {
|
||||
disabled: true,
|
||||
scale:false,
|
||||
scaleSize: 0
|
||||
},
|
||||
labelLine: {
|
||||
show: false
|
||||
},
|
||||
data: [
|
||||
{ value: 50 ,name: '2' },
|
||||
{ value: 500, name: 'xxx' }
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'Access From',
|
||||
type: 'pie',
|
||||
radius: ['76%', '84%'],
|
||||
avoidLabelOverlap: false,
|
||||
label: {
|
||||
show: false,
|
||||
position: 'center'
|
||||
},
|
||||
emphasis: {
|
||||
disabled: true,
|
||||
scale:false,
|
||||
scaleSize: 0
|
||||
},
|
||||
labelLine: {
|
||||
show: false
|
||||
},
|
||||
data: [
|
||||
{ value: 250, name: '3' },
|
||||
{ value: 750, name: 'xxx' }
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'Access From',
|
||||
type: 'pie',
|
||||
radius: ['68%', '76%'],
|
||||
avoidLabelOverlap: false,
|
||||
label: {
|
||||
show: false,
|
||||
position: 'center'
|
||||
},
|
||||
emphasis: {
|
||||
disabled: true,
|
||||
scale:false,
|
||||
scaleSize: 0
|
||||
},
|
||||
labelLine: {
|
||||
show: false
|
||||
},
|
||||
data: [
|
||||
{ value: 800, name: '4' },
|
||||
{ value: 1048, name: 'xxx' }
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'Access From',
|
||||
type: 'pie',
|
||||
radius: ['60%', '68%'],
|
||||
avoidLabelOverlap: false,
|
||||
label: {
|
||||
show: false,
|
||||
position: 'center'
|
||||
},
|
||||
emphasis: {
|
||||
disabled: true,
|
||||
scale:false,
|
||||
scaleSize: 0
|
||||
},
|
||||
labelLine: {
|
||||
show: false
|
||||
},
|
||||
data: [
|
||||
{ value: 800, name: '5' },
|
||||
{ value: 1048, name: 'xxx' }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
option && myChart.setOption(option)
|
||||
},
|
||||
// 查询
|
||||
buttonClick(val) {
|
||||
this.queryParams.name = val.name
|
||||
@@ -365,8 +279,10 @@ export default {
|
||||
}
|
||||
},
|
||||
toggleTab() {
|
||||
if (this.activeName === 'barChart') {
|
||||
this.getPieChart()
|
||||
if (this.activeName === 'barChart' && this.chartList.length > 0) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.monitoringRingCharts.initChart()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -382,7 +298,6 @@ export default {
|
||||
width: 100%;
|
||||
height: 2px;
|
||||
background-color: #e4e7ed;
|
||||
/* z-index: 1; */
|
||||
}
|
||||
.el-tabs__nav-wrap::after {
|
||||
width: 0;
|
||||
@@ -404,7 +319,7 @@ export default {
|
||||
font-size: 16px;
|
||||
font-weight: 400;
|
||||
color: #000000;
|
||||
margin:0 10px 20px 0;
|
||||
margin:0 10px 16px 0;
|
||||
}
|
||||
.blueTitle {
|
||||
content: '';
|
||||
|
||||
Reference in New Issue
Block a user