11-mes-new/src/views/orderManage/orderManagerCockpit/cockpit.vue

322 lines
9.3 KiB
Vue
Raw Normal View History

2022-11-07 14:54:47 +08:00
<template>
<div id="container" ref="container" class="visual-container order-cockpit">
<el-row
class="container-title"
:style="{
height: beilv * 88 + 'px',
lineHeight: beilv * 88 + 'px',
fontSize: beilv * 30 + 'px'
}"
>
<div :style="{ paddingLeft: 645 * beilv + 'px' }">
<img src="../../../assets/img/logo.png" style="width:1.1em;position: relative;top:.4em" alt="">
合肥新能源数字工厂工单管理驾驶舱
</div>
<el-button
type="text"
class="title-button"
2022-11-08 14:52:35 +08:00
:style="{ right: 0, top: 37 * beilv + 'px' }"
2022-11-07 14:54:47 +08:00
@click="changeFullScreen"
>
<svg-icon v-if="isFullScreen" icon-class="unFullScreenView" :style="{fontSize: 33 * beilv + 'px'}" />
<svg-icon v-else icon-class="fullScreenView" :style="{fontSize: 33 * beilv + 'px'}" />
</el-button>
</el-row>
<el-row class="container-main">
<!-- -->
<el-row :style="{ padding: '0 ' + 9 * beilv + 'px' }" :gutter="16 * beilv">
<el-col :span="10">
<base-container :beilv="beilv" :height="412" :title="'工单一览表'" :title-icon="'cockpit_1_1'">
<work-order :beilv="beilv" :order-msg="orderList" />
</base-container>
</el-col>
<el-col :span="14">
<base-container :beilv="beilv" :height="412" :title="'订单池'" :title-icon="'cockpit_1_2'">
<div class="box-padding specil-table1">
<base-table
:page="1"
:limit="12"
:show-index="false"
:beilv="beilv"
:table-config="orderPool"
:table-data="orderPoolList"
/>
</div>
</base-container>
</el-col>
</el-row>
<!-- -->
<el-row :style="{ padding: '0 ' + 9 * beilv + 'px' }">
<el-col :style="{ margin: 16 * beilv + 'px' + ' 0' }" :span="24">
<base-container :beilv="beilv" :height="520" :title="'在途/完成订单监控'" :title-icon="'cockpit_1_3'">
<div class="box-padding specil-table2">
<base-table
:page="1"
:limit="16"
:show-index="false"
:beilv="beilv"
:table-config="orderMonitiring"
:table-data="orderMonitiringList"
/>
</div>
</base-container>
</el-col>
</el-row>
</el-row>
</div>
</template>
<script>
import baseContainer from './components/baseContainer'
import workOrder from './components/workOrder.vue'
import screenfull from 'screenfull'
import BaseTable from './components/baseTable.vue'
import moment from 'moment'
import orderStatus from './components/orderStatus.vue'
const orderPool = [
{
prop: 'customerName',
label: '客户名称',
minWidth: 35.2
},
{
prop: 'orderCode',
label: '订单编号',
minWidth: 32
},
{
prop: 'productName',
label: '产品名称',
minWidth: 32
},
{
prop: 'planNum',
label: '计划加工量',
minWidth: 23.6
},
{
prop: 'planDelivery',
label: '计划交货期',
minWidth: 28.8
},
{
prop: 'status',
label: '订单状态',
subcomponent: orderStatus,
minWidth: 19
}
]
const orderMonitiring = [
{
prop: 'customerName',
label: '客户名称',
minWidth: 35.2
},
{
prop: 'orderCode',
label: '订单编号',
minWidth: 33.2
},
{
prop: 'status',
label: '订单状态',
subcomponent: orderStatus,
minWidth: 27
},
{
prop: 'completion',
label: '完成率',
minWidth: 24.8
},
{
prop: 'yield',
label: '良品率',
minWidth: 24.8
},
{
prop: 'shiftCosts',
label: '班组费用',
minWidth: 24.8
},
{
prop: 'energyCosts',
label: '能耗费用',
minWidth: 29.4
},
{
prop: 'equipmentCost',
label: '设备费用',
minWidth: 29.4
},
{
prop: 'materialCost',
label: '材料费用',
minWidth: 29.4
},
{
prop: 'totalCost',
label: '总费用',
minWidth: 31.6
}
]
export default {
name: 'Cockpit',
components: {
baseContainer,
workOrder,
BaseTable
},
data() {
return {
beilv: 1,
isFullScreen: false,
orderPool,
orderPoolList: [],
orderMonitiring,
orderMonitiringList: [],
orderList: []
}
},
watch: {
isFullScreen: function(val) {
if (val) {
this.beilv = document.body.offsetWidth / 1920
} else {
this.beilv = document.getElementById('container').offsetWidth / 1920
}
},
'sidebar.opened': function(val) {
console.log(val)
if (!this.isFullScreen) {
setTimeout(() => {
this.beilv = document.getElementById('container').offsetWidth / 1920
}, 300)
}
}
},
mounted() {
this.beilv = document.getElementById('container').offsetWidth / 1920
window.addEventListener('resize', () => {
if (this.isFullScreen) {
this.beilv = document.body.offsetWidth / 1920
} else {
this.beilv = document.getElementById('container').offsetWidth / 1920
}
})
this.getMsg()
},
methods: {
getMsg() {
this.orderList = [
{ code: 'ZGD20221024000110', state: '激活', name: '光伏玻璃2.0', line: 'A', workCode: '20221024000110', percentage: '100%' },
{ code: 'ZGD20221028000157', state: '激活', name: '光伏玻璃2.0', line: 'A', workCode: '20221028000157', percentage: '85%' },
{ code: 'ZGD20221030000142', state: '激活', name: '光伏玻璃2.0', line: 'A', workCode: '20221030000142', percentage: '72%' },
{ code: 'ZGD20221030000098', state: '激活', name: '光伏玻璃2.0', line: 'A', workCode: '20221030000098', percentage: '46%' }
]
const compList = ['SHABO沙玻', 'KIBING旗滨', '金晶玻璃', '济南金昊', '东莞佳美特', '汇中矿产', '文盛新材料', '西点化学', '开源塑胶', '奥驰商贸', '竹中科技', '程龙玻璃']
const arr = []
const temp = []
for (let i = 0; i < 20; i++) {
const obj = {}
const sj = parseInt(Math.random() * 200)
obj.customerName = compList[parseInt(Math.random() * (compList.length))]
obj.orderCode = moment().subtract(sj, 'days').format('YYYYMMDD') + '0000' + parseInt(Math.random() * 89 + 10)
obj.productName = '光伏玻璃2.0'
obj.planNum = parseInt(Math.random() * 800 + 100)
obj.planDelivery = moment().add(sj, 'days').format('YYYY-MM-DD')
obj.status = parseInt(Math.random() * 3 + 1)
arr.push(obj)
}
this.orderPoolList = arr
for (let i = 0; i < 20; i++) {
const obj = {}
const sj = parseInt(Math.random() * 200)
obj.customerName = compList[parseInt(Math.random() * (compList.length))]
obj.orderCode = moment().subtract(sj, 'days').format('YYYYMMDD') + '0000' + parseInt(Math.random() * 89 + 10)
obj.status = parseInt(Math.random() * 3 + 1)
obj.completion = obj.status === 1 ? '0.00%' : (obj.status === 3 ? '100%' : parseInt(Math.random() * 100) + '%')
obj.yield = parseInt(Math.random() * 50 + 50) + '%'
obj.shiftCosts = obj.status === 1 ? parseInt(0).toFixed(2) : parseInt(Math.random() * 800 + 100).toFixed(2)
obj.energyCosts = obj.status === 1 ? parseInt(0).toFixed(2) : parseInt(Math.random() * 800 + 100).toFixed(2)
obj.equipmentCost = obj.status === 1 ? parseInt(0).toFixed(2) : parseInt(Math.random() * 800 + 100).toFixed(2)
obj.materialCost = obj.status === 1 ? parseInt(0).toFixed(2) : parseInt(Math.random() * 800 + 100).toFixed(2)
obj.totalCost = parseInt(obj.shiftCosts + obj.energyCosts + obj.equipmentCost + obj.materialCost).toFixed(2)
temp.push(obj)
}
this.orderMonitiringList = temp
},
change() {
this.isFullScreen = screenfull.isFullscreen
},
init() {
if (screenfull.enabled) {
screenfull.on('change', this.change)
}
},
destroy() {
if (screenfull.enabled) {
screenfull.off('change', this.change)
}
},
changeFullScreen() {
if (!screenfull.enabled) {
this.$message({
message: 'you browser can not work',
type: 'warning'
})
return false
}
this.isFullScreen = !this.isFullScreen
screenfull.toggle(this.$refs.container)
}
}
}
</script>
<style lang="scss" scoped>
.visual-container {
width: 100%;
min-width: 960px;
background: url('../../../assets/img/cockpit/cockpit-back.png') no-repeat;
background-size: cover;
.container-title {
width: 100%;
background: url('../../../assets/img/cockpit/title.png') no-repeat;
background-size: 100% 100%;
color: #fff;
.title-button {
color: #00fff0;
font-size: 20px;
position: absolute;
}
}
.container-main {
padding: 16px 8px;
}
.box-padding {
padding: 0 16px;
}
}
</style>
<style lang="scss">
.order-cockpit {
.specil-table1 {
.el-table .cell {
padding-left: 25px;
padding-right: 25px;
}
.el-table--border th:first-child .cell,
.el-table--border td:first-child .cell {
padding-left: 25px;
}
}
.specil-table2 {
.el-table .cell {
padding-left: 50px;
}
.el-table--border th:first-child .cell,
.el-table--border td:first-child .cell {
padding-left: 50px;
}
}
}
</style>