This commit is contained in:
2023-04-03 11:14:32 +08:00
commit e423452dfd
70 changed files with 14097 additions and 0 deletions

268
src/pages/homeset/Home.vue Normal file
View File

@@ -0,0 +1,268 @@
<template>
<div>
<section class="content">
<div class="device-status">
<button class="fl mgt10 mgl10 button--primary" @click="toIfWork">设备开/完工</button>
<p><span class="icon red"></span><span class="txt">有任务</span></p>
<p><span class="icon green"></span><span class="txt">生产中</span></p>
<p><span class="icon blue"></span><span class="txt">停机</span></p>
<p><span class="icon white"></span><span class="txt">待机</span></p>
</div>
<div class="list-box">
<div class="device"
:class="{bg1:item.is_run=='1',bg2:item.is_run=='0'}"
v-for="(item, index) in list" :key="index"
@click="toOperation(item)"
>
<div class="device-top"><div class="img"><img v-show="item.device_icon" :src="item.imgurl" alt=""></div></div>
<div class="fl icon" :class="{blue:item.device_status=='3',red:item.device_status=='2',green:item.device_status=='1',white:item.device_status=='0'}"></div>
<div class="fl desc">
<p class="device_name">{{item.device_name}}</p>
<p class="ellipsis">任务数: {{item.job_count}}</p>
<p class="ellipsis">工单: {{item.produceorder_code}}</p>
</div>
</div>
</div>
<Back></Back>
</section>
</div>
</template>
<script>
import Back from '@components/Back.vue'
export default {
name: 'Home',
components: {
Back
},
data () {
return {
timer: null,
list: []
// list: [
// {
// device_status: '0',
// is_setstatus: '0',
// device_code: 'A0001',
// device_name: '设备名称设备名称设备名称设备名称哈哈哈你好吗好哦',
// job_count: '6',
// produceorder_code: 'gd0002',
// imgurl: '//img14.360buyimg.com/babel/s190x210_jfs/t1/54510/8/1271/6158/5cef5bfbEede24168/4aa624bd9ada781f.png!q90!cc_190x210'
// },
// {
// device_status: '1',
// is_setstatus: '1',
// device_code: 'A0002',
// job_count: '6',
// produceorder_code: 'gd0002',
// imgurl: '//img1.360buyimg.com/da/s590x470_jfs/t1/36626/1/11773/101331/5cf9fd07E20a31b94/57ae8abe34bebdd3.jpg!q90!cc_590x470.webp'
// },
// {
// device_status: '2',
// is_setstatus: '0',
// device_code: 'A0003',
// job_count: '6',
// produceorder_code: 'gd0002',
// imgurl: '//img14.360buyimg.com/mobilecms/s580x176_jfs/t1/45895/4/2239/49551/5d009864Ea34300cd/5a5e78699233f6dd.jpg!cr_1190x360_4_0'
// },
// {
// device_status: '0',
// is_setstatus: '0',
// device_code: 'A0004',
// job_count: '6',
// produceorder_code: 'gd0002',
// imgurl: ''
// },
// {
// device_status: '1',
// is_setstatus: '0',
// device_code: 'A0005',
// job_count: '6',
// produceorder_code: 'gd0002',
// imgurl: ''
// },
// {
// device_status: '2',
// is_setstatus: '1',
// device_code: 'A0006',
// job_count: '6',
// produceorder_code: 'gd0002',
// imgurl: ''
// },
// {
// device_status: '0',
// is_setstatus: '0',
// device_code: 'A0007',
// job_count: '6',
// produceorder_code: 'gd0002',
// imgurl: ''
// },
// {
// device_status: '0',
// is_setstatus: '0',
// device_code: 'A0008',
// job_count: '6',
// produceorder_code: 'gd0002',
// imgurl: ''
// },
// {
// device_status: '1',
// is_setstatus: '0',
// device_code: 'A0009',
// job_count: '6',
// produceorder_code: 'gd0002',
// imgurl: ''
// },
// {
// device_status: '2',
// is_setstatus: '1',
// device_code: 'A00010',
// job_count: '6',
// produceorder_code: 'gd0002',
// imgurl: ''
// },
// {
// device_status: '0',
// is_setstatus: '0',
// device_code: 'A00011',
// job_count: '6',
// produceorder_code: 'gd0002',
// imgurl: ''
// }
// ]
}
},
mounted () {
this.getList()
this.refresh()
},
methods: {
refresh () {
this.timer = setInterval(() => {
this.getList()
}, 30000)
},
getList () {
let data = {
'_SRVNAME': 'service.mps.AIOProduceReport20',
'_SRVMETHOD': 'queryEquip',
'_DATA': JSON.stringify({
accountId: this.$store.getters.accountId
})
}
this
.$post(data)
.then(res => {
if (res.code === '1') {
let newArr = []
res.allrows.map(el => {
newArr.push(Object.assign({}, el, {imgurl: this.$store.getters.imgBaseUrl + el.device_icon}))
})
this.list = newArr
this.$store.dispatch('getIsProplan', res.result.is_productonplan)
} else {
this.Dialog(res.desc)
}
})
},
toIfWork () {
this.$router.push('/ifwork')
},
toOperation (item) {
if (item.is_run === '1') {
let obj = {
deviceUuid: item.device_uuid,
deviceCode: item.device_name
}
this.$store.dispatch('setDevice', obj)
this.$router.push('/operation')
}
}
},
beforeDestroy () {
clearInterval(this.timer)
}
}
</script>
<style lang="stylus" scoped>
.red
background red
.green
background #09ed20
.blue
background #53ccf9
.white
background white
.bg1
background #1E307E
border 1px solid #4F93D9
.bg2
background rgba(0,0,0,0.50)
border 1px solid #7B7B7B
.content
clear both
box-sizing border-box
// height 5rem
width 7.9rem
.device-status
text-align right
font-size .18rem
padding .1rem 0 0 .1rem
p
display inline-block
text-align left
.icon
display inline-block
width .2rem
height .2rem
border-radius .1rem
margin-top .08rem
.txt
display inline-block
width .56rem
line-height .4rem
margin-left .11rem
float right
.list-box
padding-bottom .2rem
// height 4.6rem
// overflow-y scroll
.device
display inline-block
width 1.75rem
height 2.1rem
margin .18rem 0rem 0 .19rem
overflow hidden
.device-top
box-sizing border-box
height 1rem
background #1E307E
box-shadow inset 0 0 5px 0 #4F93D9
padding .12rem .18rem .12rem .18rem
.img
width 1.37rem
height .76rem
background #fff
text-align center
img
width 1.37rem
height .76rem
.icon
display inline-block
width .2rem
height .2rem
border-radius .1rem
margin .1rem .06rem 0 .04rem
.desc
display inline-block
width 1.35rem
margin-top: .05rem
line-height .25rem
p
font-size .13rem
.device_name
max-height .5rem
overflow hidden
</style>

View File

@@ -0,0 +1,302 @@
<template>
<div>
<div class="wrap">
<div class="wrap-filter">
<div class="fr filter-btns">
<button class="mgr10 button--primary" @click="goback">返回</button>
<button class="mgr10 button--primary" @click="startOverWork('01')" :disabled="disabled">开工</button>
<div class="xl-box">
<button class="button--primary" @click="getInfo(1)">准备</button>
<ul class="fl drift" :style="{'height': drift1+'rem'}">
<li @click="startOverWork('11')" :disabled="disabled">准备开始</li>
<li @click="startOverWork('12')" :disabled="disabled">准备结束</li>
</ul>
</div>
<div class="xl-box">
<button class="button--primary" @click="getInfo(2)">暂停</button>
<ul class="fl drift" :style="{'height': drift2+'rem'}">
<li @click="startOverWork('21')" :disabled="disabled">暂停设备</li>
<li @click="startOverWork('22')" :disabled="disabled">恢复启动</li>
</ul>
</div>
<div class="xl-box">
<button class="button--primary" @click="getInfo(3)">维护</button>
<ul class="fl drift" :style="{'height': drift3+'rem'}">
<li @click="startOverWork('31')" :disabled="disabled">维护开始</li>
<li @click="startOverWork('32')" :disabled="disabled">维护完成</li>
</ul>
</div>
<button class="button--primary" @click="startOverWork('02')" :disabled="disabled">完工</button>
</div>
</div>
<table class="filter-table">
<tr>
<th width="4%">
<button class="iconfont select_icon select_square_icon" :class="{'selected_icon': allcheck,'unselect_icon': !allcheck}" @click="allCheck"></button>
</th>
<th width="13%">设备号</th>
<th width="13%">设备名称</th>
<th width="13%">设备型号</th>
<th width="8%">设备状态</th>
<th width="10%">操作工</th>
<th width="8%">班次</th>
<th width="13%">操作时间</th>
<th width="10%">加工数量</th>
</tr>
<tr v-for="item in list" :key="item.pk_id" @click="Select(item)">
<td>
<button class="iconfont select_icon select_square_icon" :class="{'selected_icon': item.checked,'unselect_icon': !item.checked}"></button>
</td>
<td>{{item.device_code}}</td>
<td>{{item.device_name}}</td>
<td>{{item.device_model}}</td>
<td>{{item.devicestatus_name}}</td>
<td>{{item.jockey_name}}</td>
<td>{{item.shift_type_scode_name}}</td>
<td>{{item.realproducestart_date}}</td>
<td>{{item.finish_qty}}</td>
</tr>
</table>
</div>
<modal
:mdShow='mdShow'
message="提示"
@closeModalCallback="closeModalCall"
@comfirmCallback="comfirmCall">
{{status}}
</modal>
<Back></Back>
</div>
</template>
<script>
import Back from '@components/Back.vue'
import Modal from '@components/Modal.vue'
export default {
name: 'IfWork',
components: {
Modal,
Back
},
data () {
return {
drift1: 0,
drift2: 0,
drift3: 0,
allcheck: false,
list: [],
checkedids: [],
type: '',
status: '1',
mdShow: false,
disabled: false
}
},
mounted () {
this.getList()
},
methods: {
getInfo (n) {
switch (n) {
case 1:
this.drift1 = this.drift1 === 0 ? 0.61 : 0
this.drift2 = 0
this.drift3 = 0
break
case 2:
this.drift2 = this.drift2 === 0 ? 0.61 : 0
this.drift1 = 0
this.drift3 = 0
break
default:
this.drift3 = this.drift3 === 0 ? 0.61 : 0
this.drift1 = 0
this.drift2 = 0
}
},
closeModalCall () {
this.mdShow = false
this.disabled = false
},
comfirmCall () {
this.onoffEquipForJockey()
},
allCheck () {
this.allcheck = !this.allcheck
this.list.map(el => {
el.checked = this.allcheck
})
},
Select (i) {
i.checked = !i.checked
if (!i.checked) {
this.allcheck = false
} else {
let arr = this.list.filter(i => i.checked === true)
if (this.list.length === arr.length) {
this.allcheck = true
}
}
},
goback () {
this.$router.push('./home')
},
getList () {
let data = {
'_SRVNAME': 'service.mps.AIOProduceReport20',
'_SRVMETHOD': 'queryEquipWorkTeam',
'_DATA': JSON.stringify({
accountId: this.$store.getters.accountId
})
}
this
.$post(data)
.then(res => {
if (res.code === '1') {
let newArr = []
res.allrows.map(el => { newArr.push(Object.assign({}, el, {checked: false})) })
this.list = newArr
} else {
this.Dialog(res.desc)
}
})
},
onoffEquipForJockey () {
let data = {
'_SRVNAME': 'service.mps.AIOProduceReport20',
'_SRVMETHOD': 'onoffEquipForJockey',
'_DATA': JSON.stringify({
accountId: this.$store.getters.accountId,
form: {
operate_type: this.type
},
allrows: this.checkedids
})
}
this
.$post(data)
.then(res => {
this.mdShow = false
if (res.code === '1') {
this.$router.push('/home')
} else {
this.Dialog(res.desc)
}
this.disabled = false
})
.catch(error => {
this.disabled = false
console.log(error)
})
},
startOverWork (type) {
this.drift1 = 0
this.drift2 = 0
this.drift3 = 0
this.type = type
this.disabled = true
this.checkedids = []
let checkedrows = []
let flag = false
checkedrows = this.list.filter(el => el.checked === true)
if (checkedrows.length === 0) {
this.toast('请选择设备')
this.disabled = false
return
}
checkedrows.map(el => {
this.checkedids.push({
device_uuid: el.device_uuid
})
})
checkedrows.map(el => {
// 01 开工、02 完工11 准备、12 准备结束21 暂停、22 启动31 维修、32 维修完成;
// if (type === '01' && !(el.devicestatus_code === '02' || el.devicestatus_code === '')) {
// this.toast('所选设备状态必须为完工状态或新设备')
// flag = true
// this.disabled = false
// }
if (type === '01' && (el.devicestatus_code === '01' || el.devicestatus_code === '11' || el.devicestatus_code === '12' || el.devicestatus_code === '21' || el.devicestatus_code === '22' || el.devicestatus_code === '31' || el.devicestatus_code === '32')) {
this.toast('所选设备状态必须为完工状态或新设备')
flag = true
this.disabled = false
}
if (type === '02' && el.devicestatus_code === '02') {
this.toast('所选设备班次状态必须不为完工')
flag = true
this.disabled = false
}
if (type === '02' && (el.devicestatus_code === '11' || el.devicestatus_code === '21' || el.devicestatus_code === '31')) {
this.mdShow = true
// this.status = `当前设备为正在处理中,确定要完工吗?`
}
if (type === '11' && el.devicestatus_code !== '01') {
this.toast('选择设备必须为开工状态')
flag = true
this.disabled = false
}
if (type === '12' && el.devicestatus_code !== '11') {
this.toast('选择设备必须为准备状态')
flag = true
this.disabled = false
}
if (type === '21' && el.devicestatus_code !== '01') {
this.toast('选择设备必须为开工状态')
flag = true
this.disabled = false
}
if (type === '22' && el.devicestatus_code !== '21') {
this.toast('选择设备必须为暂停状态')
flag = true
this.disabled = false
}
if (type === '31' && el.devicestatus_code !== '01') {
this.toast('选择设备必须为开工状态')
flag = true
this.disabled = false
}
if (type === '32' && el.devicestatus_code !== '31') {
this.toast('选择设备必须为维修状态')
flag = true
this.disabled = false
}
})
if (flag) {
return
}
if (type === '02' && this.mdShow) {
// this.mdShow = true
// this.status = `当前设备为${checkedrows[0].devicestatus_name}状态,确定要完工吗?`
this.status = `当前设备为正处理中,确定要完工吗?`
} else {
this.onoffEquipForJockey()
}
}
}
}
</script>
<style lang="stylus" scoped>
.drift
transition height .3s linear
.xl-box
display inline-block
position relative
ul
min-width .6rem
background #2d9e9e
color #fff
position absolute
border-radius 2px
box-shadow 1px 2px 3px rgba(228,243,244,0.5)
overflow hidden
li
line-height .3rem
font-size .13rem
border-bottom 1px solid #767a82
text-align center
cursor pointer
&:nth-of-type(2)
border none
</style>

109
src/pages/homeset/index.vue Normal file
View File

@@ -0,0 +1,109 @@
<template>
<div>
<header>
<div class="left-box">
<button class="fl logo iconfont dropdown_icon" ref="logo" @click="getInfo">登录人员 {{this.$store.getters.userName}}</button>
<ul class="drift dropdown-ul" id="dropdown-ul" :style="{'height': drift+'rem','width' : cwidth + 'px'}">
<li>部门: {{this.$store.getters.deptName}}</li>
<li @click="exit">退出</li>
</ul>
</div>
<div class="fr date-box">
<p class="time">{{time}}</p>
<p class="date">{{date}}<span class="week">{{week}}</span></p>
</div>
</header>
<router-view></router-view>
</div>
</template>
<script>
export default {
name: 'homeset',
data () {
return {
timer: null,
time: '',
date: '',
week: '',
drift: 0,
cwidth: ''
}
},
mounted () {
this.timer = window.setInterval(this.updateTime, 1000)
},
methods: {
getInfo () {
this.cwidth = this.$refs.logo.clientWidth
this.drift = this.drift === 0 ? 1 : 0
},
exit () {
this.$store.dispatch('setSignOut')
this.$router.push('/login')
},
updateTime () {
let cd = new Date()
let year = cd.getFullYear()
let month = cd.getMonth() + 1 < 10 ? '0' + (cd.getMonth() + 1) : cd.getMonth() + 1
let date = cd.getDate() < 10 ? '0' + cd.getDate() : cd.getDate()
let hh = cd.getHours() < 10 ? '0' + cd.getHours() : cd.getHours()
let mm = cd.getMinutes() < 10 ? '0' + cd.getMinutes() : cd.getMinutes()
let ss = cd.getSeconds() < 10 ? '0' + cd.getSeconds() : cd.getSeconds()
var weekday = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
let myddy = new Date().getDay()
let week = weekday[myddy]
this.time = `${hh}:${mm}:${ss}`
this.date = `${year}${month}${date}`
this.week = `${week}`
}
}
}
</script>
<style lang="stylus" scoped>
.left-box
position relative
.logo
position relative
max-width 50%
height .6rem
overflow hidden
padding-right .3rem
line-height .6rem
font-size .2rem
background none
.dropdown-ul
position absolute
background #3157a3
top calc(.6rem + 3px)
left 0
overflow hidden
border-bottom-left-radius .05rem
border-bottom-right-radius .05rem
box-shadow 0 2px 3px rgba(228,243,244,0.5)
li
text-align center
line-height .5rem
font-size .15rem
border-bottom 1px solid #767a82
&:last-child
border-bottom none
.date-box
max-width 50%
height .6rem
overflow hidden
.time
font-size .24rem
line-height .24rem
margin-top .09rem
text-align right
.date
font-size .14rem
line-height .2rem
text-align right
.week
font-size .14rem
.drift
transition height .3s linear
</style>