482 lines
12 KiB
Vue
482 lines
12 KiB
Vue
|
|
<template>
|
||
|
|
<div class="hello">
|
||
|
|
<h1>统计</h1>
|
||
|
|
<div>{{ lastTime }}</div>
|
||
|
|
|
||
|
|
<!-- <ButtonGroup>
|
||
|
|
<Button type="success" to="http://10.0.0.3:8877/test.html"
|
||
|
|
>ERP与WMS库存比较</Button
|
||
|
|
>
|
||
|
|
<Button type="warning" @click="handelERPStock">ERP库存比较</Button>
|
||
|
|
</ButtonGroup> -->
|
||
|
|
<Divider orientation="right"> </Divider>
|
||
|
|
<h2>近五日出入库流量</h2>
|
||
|
|
|
||
|
|
<Table
|
||
|
|
size="small"
|
||
|
|
context-menu
|
||
|
|
show-context-menu
|
||
|
|
show-summary
|
||
|
|
border
|
||
|
|
stripe
|
||
|
|
:columns="columns"
|
||
|
|
:data="datas"
|
||
|
|
></Table>
|
||
|
|
<Divider />
|
||
|
|
<h3>效率</h3>
|
||
|
|
<echart :options="option1"> </echart>
|
||
|
|
<h4>故障</h4>
|
||
|
|
<echart :options="option2"> </echart>
|
||
|
|
</div>
|
||
|
|
</template>
|
||
|
|
|
||
|
|
<script>
|
||
|
|
import axios from 'axios'
|
||
|
|
import expandRow from './table-expand.vue'
|
||
|
|
import { numberFormat, dateFormatFull, dateFormat, edit1, edit2 } from '@/libs/tools'
|
||
|
|
import echart from './custom-chart.vue'
|
||
|
|
|
||
|
|
export default {
|
||
|
|
components: {
|
||
|
|
expandRow,
|
||
|
|
echart
|
||
|
|
},
|
||
|
|
name: 'HelloWorld',
|
||
|
|
props: {
|
||
|
|
msg: String
|
||
|
|
},
|
||
|
|
computed: {
|
||
|
|
lastTime() {
|
||
|
|
return dateFormatFull(this.lastUpdate)
|
||
|
|
},
|
||
|
|
option1() {
|
||
|
|
var _xy = []
|
||
|
|
this.datas.forEach((item) => {
|
||
|
|
_xy.push({
|
||
|
|
product: dateFormat(item.DATE),
|
||
|
|
托盘: item.tray,
|
||
|
|
品种: item.gnum,
|
||
|
|
数量: item.gnuq
|
||
|
|
})
|
||
|
|
// item.add_time = formatTime(item.add_time);
|
||
|
|
})
|
||
|
|
|
||
|
|
return {
|
||
|
|
legend: {},
|
||
|
|
tooltip: {},
|
||
|
|
dataset: {
|
||
|
|
dimensions: ['product', '托盘', '品种', '数量'],
|
||
|
|
source: _xy
|
||
|
|
},
|
||
|
|
xAxis: { type: 'category' },
|
||
|
|
yAxis: [
|
||
|
|
{
|
||
|
|
type: 'value',
|
||
|
|
name: '托盘/品种',
|
||
|
|
|
||
|
|
axisLabel: {
|
||
|
|
formatter: '{value} 个'
|
||
|
|
}
|
||
|
|
},
|
||
|
|
{
|
||
|
|
type: 'value',
|
||
|
|
name: '数量',
|
||
|
|
|
||
|
|
axisLabel: {
|
||
|
|
formatter: '{value} '
|
||
|
|
}
|
||
|
|
}
|
||
|
|
],
|
||
|
|
// Declare several bar series, each will be mapped
|
||
|
|
// to a column of dataset.source by default.
|
||
|
|
series: [
|
||
|
|
{
|
||
|
|
type: 'bar',
|
||
|
|
label: {
|
||
|
|
show: true,
|
||
|
|
position: 'top'
|
||
|
|
}
|
||
|
|
},
|
||
|
|
{
|
||
|
|
type: 'bar',
|
||
|
|
label: {
|
||
|
|
show: true,
|
||
|
|
position: 'top'
|
||
|
|
}
|
||
|
|
},
|
||
|
|
{
|
||
|
|
type: 'line',
|
||
|
|
yAxisIndex: 1,
|
||
|
|
label: {
|
||
|
|
show: true,
|
||
|
|
position: 'top'
|
||
|
|
}
|
||
|
|
}
|
||
|
|
]
|
||
|
|
}
|
||
|
|
},
|
||
|
|
option2() {
|
||
|
|
var _xy = []
|
||
|
|
this.datas.forEach((item) => {
|
||
|
|
_xy.push({
|
||
|
|
product: dateFormat(item.DATE),
|
||
|
|
次数: item.times,
|
||
|
|
时长: item.duration
|
||
|
|
})
|
||
|
|
// item.add_time = formatTime(item.add_time);
|
||
|
|
})
|
||
|
|
|
||
|
|
return {
|
||
|
|
legend: {},
|
||
|
|
tooltip: {},
|
||
|
|
dataset: {
|
||
|
|
dimensions: ['product', '次数', '时长'],
|
||
|
|
source: _xy
|
||
|
|
},
|
||
|
|
xAxis: { type: 'category' },
|
||
|
|
yAxis: [
|
||
|
|
{
|
||
|
|
type: 'value',
|
||
|
|
name: '次数',
|
||
|
|
|
||
|
|
axisLabel: {
|
||
|
|
formatter: '{value} '
|
||
|
|
}
|
||
|
|
},
|
||
|
|
{
|
||
|
|
type: 'value',
|
||
|
|
name: '时长/min',
|
||
|
|
|
||
|
|
axisLabel: {
|
||
|
|
formatter: '{value} '
|
||
|
|
}
|
||
|
|
}
|
||
|
|
],
|
||
|
|
// Declare several bar series, each will be mapped
|
||
|
|
// to a column of dataset.source by default.
|
||
|
|
series: [
|
||
|
|
{
|
||
|
|
type: 'bar',
|
||
|
|
label: {
|
||
|
|
show: true,
|
||
|
|
position: 'top'
|
||
|
|
}
|
||
|
|
},
|
||
|
|
{
|
||
|
|
type: 'line',
|
||
|
|
yAxisIndex: 1,
|
||
|
|
label: {
|
||
|
|
show: true,
|
||
|
|
position: 'top'
|
||
|
|
}
|
||
|
|
}
|
||
|
|
]
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
data() {
|
||
|
|
return {
|
||
|
|
date1: [],
|
||
|
|
show: false,
|
||
|
|
datas: [],
|
||
|
|
details: [],
|
||
|
|
voucherDetail: null,
|
||
|
|
showDetails: [],
|
||
|
|
tag: '',
|
||
|
|
showTitle: '',
|
||
|
|
lastUpdate: new Date(),
|
||
|
|
// cInvCode,
|
||
|
|
// cInvName,
|
||
|
|
// cInvStd: "CT-GMSB13-15"
|
||
|
|
// iQuantity: "1.0000000000"
|
||
|
|
// price: null
|
||
|
|
|
||
|
|
dataCompare: [],
|
||
|
|
|
||
|
|
// select RdRecordtype AS '单据类型' ,RdRecordnum250 as '250服务器单据个数',RdRecordnum12 as '12服务器单据个数',balanceRdRecordnum as '个数差异',
|
||
|
|
// iQuantity250 as '250服务器数量' ,iQuantity12 as '12服务器数量', balanceiQuantity as '数量差异'
|
||
|
|
// ,iPrice250 as '250服务器金额' ,iPrice12 as '12服务器金额', balanceiPrice as '金额差异'
|
||
|
|
columns: [
|
||
|
|
{
|
||
|
|
title: '日期',
|
||
|
|
key: 'DATE',
|
||
|
|
render: (h, params) => {
|
||
|
|
return <div> {dateFormat(params.row.DATE)} </div>
|
||
|
|
}
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: '故障情况',
|
||
|
|
align: 'center',
|
||
|
|
children: [
|
||
|
|
{
|
||
|
|
title: '次数',
|
||
|
|
align: 'center',
|
||
|
|
key: 'times',
|
||
|
|
className: 'demo-table-info-old'
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: '时长/min',
|
||
|
|
align: 'center',
|
||
|
|
key: 'duration',
|
||
|
|
className: 'demo-table-info-old'
|
||
|
|
}
|
||
|
|
]
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: '托盘',
|
||
|
|
align: 'center',
|
||
|
|
children: [
|
||
|
|
{
|
||
|
|
title: '托盘总量',
|
||
|
|
align: 'center',
|
||
|
|
key: 'tray',
|
||
|
|
className: 'demo-table-info-new'
|
||
|
|
// children: [
|
||
|
|
// {
|
||
|
|
// title: "正式服务器",
|
||
|
|
// align: "right",
|
||
|
|
// className: "demo-table-info-old",
|
||
|
|
// key: "rdRecordnum250",
|
||
|
|
// },
|
||
|
|
// {
|
||
|
|
// title: "测试服务器",
|
||
|
|
// align: "right",
|
||
|
|
// className: "demo-table-info-new",
|
||
|
|
// key: "rdRecordnum12",
|
||
|
|
// },
|
||
|
|
// // {
|
||
|
|
// // title: "差异",
|
||
|
|
// // align: "right",
|
||
|
|
// // key: "balanceRdRecordnum",
|
||
|
|
// // className: "demo-table-info-ex",
|
||
|
|
// // render: (h, params) => {
|
||
|
|
// // return (
|
||
|
|
// // <span>
|
||
|
|
// // {params.row.rdRecordnum250 - params.row.rdRecordnum12}
|
||
|
|
// // </span>
|
||
|
|
// // );
|
||
|
|
// // },
|
||
|
|
// // },
|
||
|
|
// ],
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: '托盘出库量',
|
||
|
|
align: 'center',
|
||
|
|
key: 'trayout',
|
||
|
|
className: 'demo-table-info-old'
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: '托盘入库量',
|
||
|
|
align: 'center',
|
||
|
|
key: 'trayin',
|
||
|
|
className: 'demo-table-info-old'
|
||
|
|
}
|
||
|
|
]
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: '品种',
|
||
|
|
align: 'center',
|
||
|
|
children: [
|
||
|
|
{
|
||
|
|
title: '出入库品种总量',
|
||
|
|
align: 'center',
|
||
|
|
key: 'gnum',
|
||
|
|
className: 'demo-table-info-new'
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: '出库品种量',
|
||
|
|
align: 'center',
|
||
|
|
key: 'gnumout',
|
||
|
|
className: 'demo-table-info-old'
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: '入库品种量',
|
||
|
|
align: 'center',
|
||
|
|
key: 'gnumin',
|
||
|
|
className: 'demo-table-info-old'
|
||
|
|
}
|
||
|
|
]
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: '数量',
|
||
|
|
align: 'center',
|
||
|
|
children: [
|
||
|
|
{
|
||
|
|
title: '出入库总数量',
|
||
|
|
align: 'center',
|
||
|
|
key: 'gnuq',
|
||
|
|
className: 'demo-table-info-new'
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: '出库数量',
|
||
|
|
align: 'center',
|
||
|
|
key: 'gnuqout',
|
||
|
|
className: 'demo-table-info-old'
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: '入库数量',
|
||
|
|
align: 'center',
|
||
|
|
key: 'gnuqin',
|
||
|
|
className: 'demo-table-info-old'
|
||
|
|
}
|
||
|
|
]
|
||
|
|
}
|
||
|
|
// {
|
||
|
|
// title: "物料数量",
|
||
|
|
// align: "center",
|
||
|
|
// children: [
|
||
|
|
// {
|
||
|
|
// title: "正式服务器",
|
||
|
|
// align: "right",
|
||
|
|
// key: "iQuantity250",
|
||
|
|
// className: "demo-table-info-old",
|
||
|
|
// render: (h, params) => {
|
||
|
|
// return <span>{numberFormat(params.row.iQuantity250)}</span>;
|
||
|
|
// },
|
||
|
|
// },
|
||
|
|
// {
|
||
|
|
// title: "测试服务器",
|
||
|
|
// align: "right",
|
||
|
|
// key: "iQuantity12",
|
||
|
|
// className: "demo-table-info-new",
|
||
|
|
// render: (h, params) => {
|
||
|
|
// return <span>{numberFormat(params.row.iQuantity12)}</span>;
|
||
|
|
// },
|
||
|
|
// },
|
||
|
|
// // {
|
||
|
|
// // title: "差异",
|
||
|
|
// // align: "right",
|
||
|
|
// // key: "balanceiQuantity",
|
||
|
|
// // className: "demo-table-info-ex",
|
||
|
|
|
||
|
|
// // render: (h, params) => {
|
||
|
|
// // return (
|
||
|
|
// // <span>
|
||
|
|
// // {numberFormat(
|
||
|
|
// // params.row.iQuantity250 - params.row.iQuantity12
|
||
|
|
// // )}
|
||
|
|
// // </span>
|
||
|
|
// // );
|
||
|
|
// // },
|
||
|
|
// // },
|
||
|
|
// ],
|
||
|
|
// },
|
||
|
|
// {
|
||
|
|
// title: "金额",
|
||
|
|
// align: "center",
|
||
|
|
// children: [
|
||
|
|
// {
|
||
|
|
// align: "right",
|
||
|
|
// title: "差异",
|
||
|
|
// key: "balanceiPrice",
|
||
|
|
// className: "demo-table-info-ex",
|
||
|
|
// render: (h, params) => {
|
||
|
|
// return (
|
||
|
|
// <span>
|
||
|
|
// {numberFormat(params.row.iPrice250 - params.row.iPrice12)}
|
||
|
|
// </span>
|
||
|
|
// );
|
||
|
|
// },
|
||
|
|
// },
|
||
|
|
// ],
|
||
|
|
// },
|
||
|
|
]
|
||
|
|
}
|
||
|
|
},
|
||
|
|
mounted() {
|
||
|
|
setInterval(() => {
|
||
|
|
this.loadData()
|
||
|
|
}, 60000)
|
||
|
|
this.loadData()
|
||
|
|
},
|
||
|
|
methods: {
|
||
|
|
sysAppIds(e) {
|
||
|
|
console.log(e)
|
||
|
|
},
|
||
|
|
onCopy(e) {
|
||
|
|
console.log(e)
|
||
|
|
},
|
||
|
|
// 复制失败
|
||
|
|
onError(e) {
|
||
|
|
alert('失败')
|
||
|
|
},
|
||
|
|
cancel() {
|
||
|
|
this.showDetails = []
|
||
|
|
this.show = false
|
||
|
|
},
|
||
|
|
handleClick(name) {
|
||
|
|
this.tag = name
|
||
|
|
},
|
||
|
|
|
||
|
|
async loadData() {
|
||
|
|
if (this.loading) {
|
||
|
|
return
|
||
|
|
}
|
||
|
|
try {
|
||
|
|
this.loading = true
|
||
|
|
var res = await axios.get('/api/erp/wmsxl')
|
||
|
|
this.datas = res.data
|
||
|
|
// var respDetail = await axios.get("/api/erp/detail");
|
||
|
|
// this.details = respDetail.data;
|
||
|
|
this.lastUpdate = new Date()
|
||
|
|
} finally {
|
||
|
|
this.loading = false
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
rowClassName(row, index) {
|
||
|
|
if (index === 1) {
|
||
|
|
return 'demo-table-info-row'
|
||
|
|
} else if (index === 3) {
|
||
|
|
return 'demo-table-error-row'
|
||
|
|
}
|
||
|
|
return ''
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
|
||
|
|
|
||
|
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||
|
|
<style >
|
||
|
|
h3 {
|
||
|
|
margin: 40px 0 0;
|
||
|
|
}
|
||
|
|
ul {
|
||
|
|
list-style-type: none;
|
||
|
|
padding: 0;
|
||
|
|
}
|
||
|
|
li {
|
||
|
|
display: inline-block;
|
||
|
|
margin: 0 10px;
|
||
|
|
}
|
||
|
|
a {
|
||
|
|
color: #42b983;
|
||
|
|
}
|
||
|
|
|
||
|
|
.ivu-table .demo-table-info-row td {
|
||
|
|
background-color: #2db7f5;
|
||
|
|
color: #fff;
|
||
|
|
}
|
||
|
|
.ivu-table .demo-table-error-row td {
|
||
|
|
background-color: #ff6600;
|
||
|
|
color: #fff;
|
||
|
|
}
|
||
|
|
|
||
|
|
.ivu-table td.demo-table-info-old {
|
||
|
|
color: #2db7f5;
|
||
|
|
}
|
||
|
|
|
||
|
|
.ivu-table td.demo-table-info-new {
|
||
|
|
color: #ff6600;
|
||
|
|
}
|
||
|
|
.ivu-table td.demo-table-info-ex {
|
||
|
|
color: #187;
|
||
|
|
font-weight: 600;
|
||
|
|
}
|
||
|
|
body {
|
||
|
|
padding: 10px 1;
|
||
|
|
}
|
||
|
|
</style>
|