登录、home、工单管理

This commit is contained in:
2023-04-07 17:41:38 +08:00
parent c47cc6a357
commit 6917835ce2
15 changed files with 521 additions and 241 deletions

View File

@@ -0,0 +1,191 @@
<template>
<sec-header :deviceCode="deviceCode" activeIndex="1">
<div class="wrap">
<div class="wrap-filter">
<div class="fl mgt10">
工单日期&nbsp;
<el-date-picker
v-model="value1"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</div>
<div class="fl mgt10 keyValue">
&nbsp;关键字
<input type="text" class="input" v-model="keyValue" placeholder="请输入工单号、物料编码">
<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>
</div>
</div>
<table class="filter-table">
<tr>
<th width="4%"></th>
<th width="8%">工单号</th>
<th width="8%">班次</th>
<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="13%">开始时间</th>
<th width="13%">结束时间</th>
</tr>
<tr v-for="e in datas" :key="e.pk_id" @click="toRadio(e)">
<td>
<button class="iconfont select_icon" :class="pkId === e.pk_id ? 'selected_icon' : 'unselect_icon'"></button>
</td>
<td>{{e.produceorder_code}}</td>
<td>{{e.shift_type_scode_name}}</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>{{e.realproducestart_date}}</td>
<td>{{e.realproduceend_date}}</td>
</tr>
</table>
</div>
<Back></Back>
</sec-header>
</template>
<script>
import SecHeader from '@components/SecHeader.vue'
import {dateFtt} from '@config/utils.js'
import Back from '@components/Back.vue'
import {getTable, openStart, saveReport, tofinish} from './../../config/getData2.js'
export default {
name: 'workordermanage',
components: {
SecHeader,
Back
},
data () {
return {
value1: [new Date(), new Date()],
deviceCode: this.$route.query.code,
keyValue: '',
datas: [],
pkId: '',
pkObj: {},
disabled1: false,
disabled2: false,
disabled3: false
}
},
computed: {
closeIcon1 () {
return this.keyValue !== ''
},
closeIcon2 () {
return this.produceQty !== ''
}
},
created () {
this.getDatas()
},
methods: {
clearData (e) {
switch (e) {
case 1:
this.keyValue = ''
break
case 2:
this.produceQty = ''
break
}
},
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()
},
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
},
async _openStart () {
this.disabled1 = true
if (!this.pkId) {
this.toast('请选择一行')
this.disabled1 = false
return
}
try {
let res = await openStart()
this.toast(res.desc)
this.disabled1 = false
this.getDatas()
} catch (e) {
this.disabled1 = false
}
},
async _saveReport () {
this.disabled2 = true
if (!this.pkId) {
this.toast('请选择一行')
this.disabled2 = false
return
}
try {
let res = await saveReport()
this.toast(res.desc)
this.disabled2 = false
this.getDatas()
} catch (e) {
this.disabled2 = false
}
},
async _tofinish () {
this.disabled3 = true
if (!this.pkId) {
this.toast('请选择一行')
this.disabled3 = false
return
}
try {
let res = await tofinish()
this.toast(res.desc)
this.disabled3 = false
this.getDatas()
} catch (e) {
this.disabled3 = false
}
}
}
}
</script>
<style lang="stylus" scoped>
.input
width 1.2rem
.close_icon
top 0
</style>