Files
hht-xinrui-mes/src/pages/xinrui/equipment/ScanInStore.vue

149 lines
4.5 KiB
Vue
Raw Normal View History

2022-07-01 14:23:52 +08:00
<template>
<section>
<nav-bar :inner="true" title="扫码入库"></nav-bar>
<section class="content mgt186">
<div class="filter-wraper">
<search-box
label="备品备件"
v-model="val1"
@handleChange="handleChange1"
></search-box>
<div class="bottom-filter-tip">
<div class="filter-label txtjustify">入库单</div>
<div class="fxcol mgl20">
2022-07-05 15:59:51 +08:00
<input type="text" class="filter-input filter-scan-input" placeholder="" v-model="val2" disabled>
2022-07-01 14:23:52 +08:00
</div>
</div>
<div class="bottom-filter-tip">
<div class="filter-label txtjustify">物料</div>
<div class="fxcol mgl20">
2022-07-05 15:59:51 +08:00
<input type="text" class="filter-input filter-scan-input" placeholder="" v-model="val3" disabled>
2022-07-01 14:23:52 +08:00
</div>
</div>
<div class="bottom-filter-tip">
2022-07-01 16:21:52 +08:00
<div class="filter-label txtjustify">待入数</div>
2022-07-01 14:23:52 +08:00
<div class="fxcol mgl20">
2022-07-05 15:59:51 +08:00
<input type="text" class="filter-input filter-scan-input" placeholder="" v-model="val4" disabled>
2022-07-01 14:23:52 +08:00
</div>
</div>
<div class="bottom-filter-tip">
2022-07-01 16:21:52 +08:00
<div class="filter-label txtjustify">已入数</div>
2022-07-01 14:23:52 +08:00
<div class="fxcol mgl20">
2022-07-05 15:59:51 +08:00
<input type="text" class="filter-input filter-scan-input" placeholder="" v-model="val5" disabled>
2022-07-01 14:23:52 +08:00
</div>
</div>
</div>
<div class="grid-wraper">
<div class="slide">
<table class="layout-t">
<tr>
<th>备件唯一编码</th>
<th>备件名称</th>
<th>数量</th>
2022-07-01 16:21:52 +08:00
<th>单位</th>
2022-07-01 14:23:52 +08:00
</tr>
2022-07-01 16:21:52 +08:00
<tr v-for="e in dataList" :key="e.sparepart_only_id" @click="toCheck(e)" :class="{'checked': e.sparepart_only_id === pkId}">
<td>{{e.sparepart_only_id}}</td>
<td>{{e.material_name}}</td>
<td>{{e.real_qty}}</td>
<td>{{e.qty_unit_name}}</td>
2022-07-01 14:23:52 +08:00
</tr>
</table>
</div>
</div>
</section>
<section class="submit-bar">
2022-07-01 16:21:52 +08:00
<button class="btn submit-button" :class="{'btn-disabled': !pkId}" @click="del()">删除</button>
<button class="btn submit-button" :class="{'btn-disabled': dataList.length === 0}" :disabled="disabled1" @click="toSure">确认</button>
2022-07-01 14:23:52 +08:00
</section>
</section>
</template>
<script>
import NavBar from '@components/NavBar.vue'
import SearchBox from '@components/SearchBox.vue'
2022-07-01 16:21:52 +08:00
import {queryIODis, confirmDis} from '@config/getData1.js'
2022-07-01 14:23:52 +08:00
export default {
name: 'ScanInStore',
components: {
NavBar,
SearchBox
},
data () {
return {
val1: '',
2022-07-01 16:21:52 +08:00
val2: this.$store.getters.materObj.bill_code || '',
val3: this.$store.getters.materObj.material_name || '',
val4: this.$store.getters.materObj.need_qty || '',
val5: this.$store.getters.materObj.finish_qty || '',
2022-07-01 14:23:52 +08:00
dataList: [],
pkId: '',
pkObj: {},
2022-07-01 16:21:52 +08:00
disabled1: false
2022-07-01 14:23:52 +08:00
}
},
methods: {
handleChange1 (e, type) {
if (type) {
2022-07-01 16:21:52 +08:00
this._queryIODis(e)
2022-07-01 14:23:52 +08:00
}
},
toCheck (e) {
2022-07-01 16:21:52 +08:00
this.pkId = this.pkId === e.sparepart_only_id ? '' : e.sparepart_only_id
this.pkObj = this.pkId === e.sparepart_only_id ? e : {}
2022-07-01 14:23:52 +08:00
},
2022-07-01 16:21:52 +08:00
/** 1.2备品备件扫描 */
async _queryIODis (e) {
let res = await queryIODis(e, this.$store.getters.materObj.iostorinvdtl_id)
2022-07-01 14:23:52 +08:00
if (res.code === '1') {
2022-07-05 16:51:05 +08:00
if (!this.dataList.length) {
2022-07-05 15:59:51 +08:00
this.dataList.push(res.content)
2022-07-05 16:51:05 +08:00
} else {
2022-07-05 17:37:00 +08:00
if (JSON.stringify(this.dataList).indexOf(JSON.stringify(res.content)) === -1) {
2022-07-05 16:51:05 +08:00
this.dataList.push(res.content)
}
2022-07-05 15:59:51 +08:00
}
2022-07-01 14:23:52 +08:00
} else {
this.Dialog(res.desc)
}
},
2022-07-01 16:21:52 +08:00
async _confirmDis () {
2022-07-01 14:23:52 +08:00
try {
2022-07-01 16:21:52 +08:00
let res = await confirmDis('0', this.$store.getters.materObj, this.dataList)
2022-07-01 14:23:52 +08:00
if (res.code === '1') {
this.toast(res.desc)
2022-07-05 16:51:05 +08:00
this.$router.push({
path: '/SparePartInstore'
})
2022-07-01 14:23:52 +08:00
} else {
this.Dialog(res.desc)
}
this.disabled1 = false
} catch (e) {
this.disabled1 = false
}
},
2022-07-01 16:21:52 +08:00
del () {
if (!this.pkId) {
2022-07-01 14:23:52 +08:00
return
}
2022-07-01 16:21:52 +08:00
this.dataList.map((el, i) => {
if (el.sparepart_only_id === this.pkId) {
this.dataList.splice(i, 1)
}
})
this.pkId = ''
this.pkObj = {}
2022-07-01 14:23:52 +08:00
},
2022-07-01 16:21:52 +08:00
toSure () {
this.disabled1 = true
2022-07-01 14:23:52 +08:00
if (!this.dataList.length) {
2022-07-01 16:21:52 +08:00
this.disabled1 = false
2022-07-01 14:23:52 +08:00
return
}
2022-07-01 16:21:52 +08:00
this._confirmDis()
2022-07-01 14:23:52 +08:00
}
}
}
</script>