This commit is contained in:
2023-04-10 11:16:58 +08:00
parent 6d1252502f
commit 8a867e704d
9 changed files with 67 additions and 124 deletions

View File

@@ -150,7 +150,7 @@ export default {
async loginApi () {
try {
let res = await handLogin(this.loginname, encrypt(this.password))
this.$store.dispatch('setUserInfo', JSON.stringify(res.user.user))
this.$store.dispatch('saveUserInfo', JSON.stringify(res.user.user))
this.$store.dispatch('saveToken', res.token)
this.$router.push('/home')
this.disabled = false

View File

@@ -18,10 +18,10 @@
<i v-show="closeIcon1" class="iconfont close_icon" @click="clearData(1)"></i>
</div>
<div class="fr mgt10">
<button class="mgr5 button--primary" @click="toSearch">&nbsp;&nbsp;</button>
<button class="button--primary" :disabled="disabled1" @click="_openStart">开工</button>
<button class="button--primary" :disabled="disabled2" @click="addProduce">报工</button>
<button class="button--primary" :disabled="disabled3" @click="addProduce">完工</button>
<button class="mgr5 button--primary" @click="getDatas">&nbsp;&nbsp;</button>
<button class="button--primary" :class="{'button--defalut': !pkId}" :disabled="disabled1" @click="_openStart">开工</button>
<button class="button--primary" :class="{'button--defalut': !pkId}" :disabled="disabled2" @click="_saveReport">报工</button>
<button class="button--primary" :class="{'button--defalut': !pkId}" :disabled="disabled3" @click="_tofinish">完工</button>
</div>
</div>
<table class="filter-table">
@@ -32,24 +32,24 @@
<th width="9%">物料名称</th>
<th width="8%">工序</th>
<th width="9%">工单状态</th>
<th width="10%">生产数量</th>
<th width="9%">上报残次数</th>
<th width="9%">本次加工</th>
<th width="10%">计划数量</th>
<th width="9%">实际数量</th>
<th width="9%">报工数量</th>
<th width="13%">开始时间</th>
<th width="13%">结束时间</th>
</tr>
<tr v-for="e in datas" :key="e.pk_id" @click="toRadio(e)">
<tr v-for="e in dataList" :key="e.workorder_id" @click="toRadio(e)">
<td>
<button class="iconfont select_icon" :class="pkId === e.pk_id ? 'selected_icon' : 'unselect_icon'"></button>
<button class="iconfont select_icon" :class="pkId === e.workorder_id ? 'selected_icon' : 'unselect_icon'"></button>
</td>
<td>{{e.produceorder_code}}</td>
<td>{{e.shift_type_scode_name}}</td>
<td>{{e.workorder_code}}</td>
<td>{{e.shift_type_scode}}</td>
<td>{{e.material_name}}</td>
<td>{{e.workprocedure_name}}</td>
<td>{{['未生产','生产中','生产完成','已报工'][Number(e.order_status)]}}</td>
<td>{{e.produce_qty}}</td>
<td>{{e.unqualified_qty}}</td>
<td>{{e.this_qty}}</td>
<td>{{['创建','下发','生产中','暂停', '完成'][Number(e.order_status) - 1]}}</td>
<td>{{e.plan_qty}}</td>
<td>{{e.real_qty}}</td>
<td>{{e.report_qty}}</td>
<td>{{e.realproducestart_date}}</td>
<td>{{e.realproduceend_date}}</td>
</tr>
@@ -75,7 +75,7 @@ export default {
value1: [new Date(), new Date()],
deviceCode: this.$route.query.code,
keyValue: '',
datas: [],
dataList: [],
pkId: '',
pkObj: {},
disabled1: false,
@@ -86,9 +86,6 @@ export default {
computed: {
closeIcon1 () {
return this.keyValue !== ''
},
closeIcon2 () {
return this.produceQty !== ''
}
},
created () {
@@ -106,30 +103,12 @@ export default {
}
},
async getDatas () {
let res = await getTable(this.$route.query.code, this.keyValue, this.value1 !== null ? dateFtt(this.value1[0]) : '', this.value1 !== null ? dateFtt(this.value1[1]) : '', '0', '', '0')
this.datas = [...res]
},
toSearch () {
this.getDatas()
let res = await getTable(this.$route.query.code, this.keyValue, this.value1 !== null ? dateFtt(this.value1[0]) : '', this.value1 !== null ? dateFtt(this.value1[1]) : '')
this.dataList = [...res.content]
},
toRadio (e) {
this.pkId = this.pkId === e.pk_id ? '' : e.pk_id
this.pkObj = this.pkId === e.pk_id ? e : {}
},
closeModalCall () {
this.mdShow = false
},
comfirmCall () {
this.disabled = true
if (this.produceQty === '' || this.produceQty === null) {
this.toast('请输入追加数量')
this.disabled = false
return
}
this.addProduceData()
},
addProduce () {
this.mdShow = true
this.pkId = this.pkId === e.workorder_id ? '' : e.workorder_id
this.pkObj = this.pkId === e.workorder_id ? e : {}
},
async _openStart () {
this.disabled1 = true
@@ -139,9 +118,11 @@ export default {
return
}
try {
let res = await openStart()
this.toast(res.desc)
let res = await openStart(this.pkId, this.deviceCode)
this.toast(res.message)
this.disabled1 = false
this.pkId = ''
this.pkObj = {}
this.getDatas()
} catch (e) {
this.disabled1 = false
@@ -155,9 +136,11 @@ export default {
return
}
try {
let res = await saveReport()
this.toast(res.desc)
let res = await saveReport(this.pkId, this.pkObj.report_qty)
this.toast(res.message)
this.disabled2 = false
this.pkId = ''
this.pkObj = {}
this.getDatas()
} catch (e) {
this.disabled2 = false
@@ -171,8 +154,8 @@ export default {
return
}
try {
let res = await tofinish()
this.toast(res.desc)
let res = await tofinish(this.pkObj)
this.toast(res.message)
this.disabled3 = false
this.getDatas()
} catch (e) {

View File

@@ -2,25 +2,22 @@
<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" v-for="e in dataList" :key="e.device_code" :class="{bg1:e.is_run=='1',bg2:e.is_run=='0'}" @click="toOperation(e)"
>
<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 class="device-top">
<div class="img"><img v-show="e.device_icon" :src="e.imgurl" alt=""></div></div>
<div class="fl icon" :class="['white', 'green', 'red', 'blue'][Number(e.device_status)]"></div>
<div class="fl desc">
<p class="device_name">{{e.deviceName}}</p>
<p class="ellipsis">任务数: {{e.job_count}}</p>
<p class="ellipsis">工单: {{e.workorderCode}}</p>
</div>
</div>
</div>
<Back></Back>
@@ -40,7 +37,7 @@ export default {
data () {
return {
timer: null,
list: []
dataList: []
}
},
mounted () {
@@ -51,29 +48,21 @@ export default {
refresh () {
this.timer = setInterval(() => {
this.getList()
}, 30000)
}, 3000)
},
async getList () {
let res = await getDevice()
let newArr = []
res.map(el => {
newArr.push(Object.assign({}, el, {imgurl: this.$store.getters.imgBaseUrl + el.device_icon}))
newArr.push(Object.assign({}, el, {imgurl: this.$store.getters.imgBaseUrl + '/' + el.device_icon}))
})
this.list = [...newArr]
// this.$store.dispatch('getIsProplan', res.result.is_productonplan)
this.dataList = [...newArr]
},
toIfWork () {
// this.$router.push('/ifwork')
},
toOperation (item) {
if (item.is_run === '1') {
// let obj = {
// code: item.device_code
// }
// this.$store.dispatch('setDevice', obj)
toOperation (e) {
if (e.is_run === '1') {
this.$router.push({
path: '/workordermanage',
query: {code: item.device_code}
query: {code: e.deviceCode}
})
}
}
@@ -161,7 +150,9 @@ export default {
line-height .25rem
p
font-size .13rem
color #fff
.device_name
max-height .5rem
overflow hidden
color #fff
</style>

View File

@@ -2,9 +2,8 @@
<div>
<header>
<div class="left-box">
<button class="fl logo iconfont dropdown_icon" ref="logo" @click="getInfo">登录人员 {{this.$store.getters.userName}}</button>
<button class="fl logo iconfont dropdown_icon" ref="logo" @click="getInfo">登录人员 {{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>
@@ -22,6 +21,7 @@ export default {
name: 'homeset',
data () {
return {
userName: this.$store.getters.userInfo !== '' ? JSON.parse(this.$store.getters.userInfo).username : '',
timer: null,
time: '',
date: '',
@@ -36,10 +36,10 @@ export default {
methods: {
getInfo () {
this.cwidth = this.$refs.logo.clientWidth
this.drift = this.drift === 0 ? 1 : 0
this.drift = this.drift === 0 ? 0.5 : 0
},
exit () {
this.$store.dispatch('setSignOut')
this.$store.dispatch('delUserInfo')
this.$router.push('/login')
},
updateTime () {