Files
hht-ruitaimagang-uni/pages/modules/package-instore.vue
2024-06-07 15:22:54 +08:00

165 lines
5.0 KiB
Vue

<template>
<view class="zd_container">
<nav-bar title="包装入库"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
<view class="filter_item">
<view class="filter_label">钢托盘1编码</view>
<view class="filter_input_wraper">
<search-box v-model="code[0]" />
</view>
</view>
<view class="filter_item">
<view class="filter_label">物料数量</view>
<view class="filter_input_wraper">
<input type="number" class="filter_input" v-model="num[0]">
</view>
</view>
<view class="filter_item">
<view class="filter_label">钢托盘2编码</view>
<view class="filter_input_wraper">
<search-box v-model="code[1]" />
</view>
</view>
<view class="filter_item">
<view class="filter_label">物料数量</view>
<view class="filter_input_wraper">
<input type="number" class="filter_input" v-model="num[1]">
</view>
</view>
<view class="filter_item">
<view class="filter_label">钢托盘3编码</view>
<view class="filter_input_wraper">
<search-box v-model="code[2]" />
</view>
</view>
<view class="filter_item">
<view class="filter_label">物料数量</view>
<view class="filter_input_wraper">
<input type="number" class="filter_input" v-model="num[2]">
</view>
</view>
<view class="filter_item">
<view class="filter_label">木托盘编码</view>
<view class="filter_input_wraper">
<search-box v-model="code[3]" />
</view>
</view>
<view class="filter_item">
<view class="filter_label">物料数量</view>
<view class="filter_input_wraper">
<input type="number" class="filter_input" v-model="num1">
</view>
</view>
</view>
<view class="zd_wrapper grid-wraper">
<view class="slide_new">
<table>
<thead>
<tr>
<th>起点1</th>
<th>终点1</th>
<th>起点2</th>
<th>终点2</th>
<th>任务状态</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i">
<td>{{e.point_name1}}</td>
<td>{{e.point_name2}}</td>
<td>{{e.point_name3}}</td>
<td>{{e.point_name4}}</td>
<td>{{e.task_status}}</td>
</tr>
</tbody>
</table>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-7 submit-button" @tap="clearUp">清空</button>
<button class="zd-col-7 submit-button" @tap="_manualSortingPackingTaskShow">查询</button>
<button class="zd-col-7 submit-button" :class="{'btn-disabled': !(((code[0] !== '' && num[0] !== '') || (code[1] !== '' && num[1] !== '') || (code[2] !== '' && num[2] !== '')) && (code[3] !== '' && num1 !== ''))}" :disabled="disabled" @tap="toSure">确认</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {manualSortingPackingTaskShow, manualSortingPackingTask} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
code: this.$store.getters.codeArr || ['', '', '', ''],
num: this.$store.getters.numArr || ['', '', ''],
num1: this.$store.getters.num || '',
dataList: [],
disabled: false
};
},
watch: {
num () {
let num1 = this.num[0] !== '' ? parseFloat(this.num[0]) : ''
let num2 = this.num[1] !== '' ? parseFloat(this.num[1]) : ''
let num3 = this.num[2] !== '' ? parseFloat(this.num[2]) : ''
this.num1 = num1 + num2 + num3
}
},
created () {
this._manualSortingPackingTaskShow()
if (this.num1 === '') {
let num1 = this.num[0] !== '' ? parseFloat(this.num[0]) : ''
let num2 = this.num[1] !== '' ? parseFloat(this.num[1]) : ''
let num3 = this.num[2] !== '' ? parseFloat(this.num[2]) : ''
this.num1 = num1 + num2 + num3
}
},
beforeDestroy () {
this.$store.dispatch('setCodeArr', this.code)
this.$store.dispatch('setNumArr', this.num)
this.$store.dispatch('setNum', this.num1)
},
methods: {
clearUp () {
this.code = ['', '', '', '']
this.num = ['', '', '', '']
},
/** grid查询 */
async _manualSortingPackingTaskShow () {
let res = await manualSortingPackingTaskShow()
this.dataList = [...res]
},
/** 确认 */
async toSure () {
this.disabled = true
if (!(((this.code[0] !== '' && this.num[0] !== '') || (this.code[1] !== '' && this.num[1] !== '') || (this.code[2] !== '' && this.num[2] !== '')) && (this.code[3] !== '' && this.num1 !== ''))) {
this.disabled = false
return
}
try {
let res = await manualSortingPackingTask(this.code[0], this.num[0], this.code[1], this.num[1], this.code[2], this.num[2], this.code[3], this.num1)
this.disabled = false
this._manualSortingPackingTaskShow()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
}
}
}
</script>
<style lang="stylus" scoped>
.filter_label
width 100px
</style>