Files
hht-xinrui-mes/src/pages/xinrui/storage/emptytray/WeighExceptionHandle.vue
2022-07-18 15:02:49 +08:00

139 lines
3.5 KiB
Vue

<template>
<section>
<nav-bar title="称重异常处理"></nav-bar>
<section class="content mgt186 mgb70">
<div class="filter-wraper">
<search-box
label="托盘"
v-model="val1"
:seaShow="false"
></search-box>
<search-box
label="扫桶"
:focused='true'
v-model="val2"
@handleChange="handleChange2"
></search-box>
</div>
<div class="grid-wraper">
<div class="left_fixed">
<table class="layout-t left_layout_t">
<tr>
<th>顺序号</th>
</tr>
<tr v-for="e in dataList" :key="e.bucketunique">
<td>{{e.indexId}}</td>
</tr>
</table>
</div>
<div class="slide">
<table class="layout-t">
<tr>
<th>桶码</th>
<th>物料编码</th>
<th>批次</th>
<th>重量kg</th>
<th>工艺指令卡</th>
</tr>
<tr v-for="e in dataList" :key="e.bucketunique">
<td>{{e.bucketunique}}</td>
<td>{{e.material_code}}</td>
<td>{{e.pcsn}}</td>
<td>{{e.qty | numeric(3)}}</td>
<td>{{e.workorder_code}}</td>
</tr>
</table>
</div>
</div>
</section>
<section class="calc_value_wraper">
<div class="bottom-filter-tip">
<div class="filter-label txtjustify">总重量</div>
<div class="fxcol mgl20">
<input type="text" class="filter-input filter-scan-input" v-model="val3">
</div>
<div class="mgl20">KG</div>
</div>
</section>
<section class="submit-bar">
<button class="btn submit-button" :disabled="disabled" :class="{'btn-disabled': dataList.length === 0}" @click="_emptyVehicleProcess">处理</button>
</section>
</section>
</template>
<script>
import NavBar from '@components/NavBar.vue'
import SearchBox from '@components/SearchBox.vue'
import {unUsualQuery, emptyVehicleProcess} from '@config/getData2.js'
import {accAdd} from '@config/mUtils.js'
export default {
name: 'WeighExceptionHandle',
components: {
NavBar,
SearchBox
},
data () {
return {
val1: '',
val2: '',
dataList: [],
disabled: false
}
},
computed: {
val3 () {
let cur = '0.000'
if (this.dataList.length) {
this.dataList.map(el => {
cur = accAdd(cur, el.qty)
})
cur = Number(cur).toFixed(3) + ''
}
return cur
}
},
methods: {
handleChange2 (e, type) {
if (type) {
this._unUsualQuery(e)
}
},
/** 查询 */
async _unUsualQuery (e) {
if (this.val1 === '' || this.val2 === '') {
return
}
let res = await unUsualQuery(e, this.val1)
if (res.code === '1') {
res.rows.map((e, i) => {
this.$set(e, 'indexId', parseInt(i) + 1)
})
this.dataList = [...res.rows]
} else {
this.toast(res.desc)
}
},
/** 处理 */
async _emptyVehicleProcess () {
this.disabled = true
if (!this.dataList.length) {
this.disabled = false
return
}
try {
let res = await emptyVehicleProcess(this.dataList)
if (res.code === '1') {
this.toast(res.desc)
Object.assign(this.$data, this.$options.data())
} else {
this.Dialog(res.desc)
}
this.disabled = false
} catch (e) {
this.disabled = false
}
}
}
}
</script>