Files
hht-shangdianke-uni/pages/manage/man-group-disk.vue

233 lines
6.1 KiB
Vue
Raw Normal View History

2024-02-18 17:59:15 +08:00
<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">载具类型</view>
<view class="filter_input_wraper">
<uni-data-select v-model="index1" :localdata="options1" @change="selectChange1"></uni-data-select>
</view>
</view>
<view class="filter_item">
<view class="filter_label_wraper">
<span class="filter_label">载具编码</span>
</view>
<view class="filter_input_wraper">
<search-box
v-model="val1"
@handleChange="handleChange"
/>
</view>
</view>
<view class="filter_item">
<view class="filter_label_wraper">
<span class="filter_label">物料</span>
</view>
<view class="filter_input_wraper">
<input type="text" class="filter_input filter_input_disabled pointer" v-model="val2" @tap="getMater">
</view>
</view>
<view class="filter_item">
<view class="filter_label_wraper">
<span class="filter_label">物料数量</span>
</view>
<view class="filter_input_wraper">
<input type="number" class="filter_input" v-model="val3">
</view>
</view>
<view class="filter_item">
<view class="filter_label">当前点位</view>
<view class="filter_input_wraper">
<uni-data-select v-model="index2" :localdata="options2" @change="selectChange2"></uni-data-select>
</view>
</view>
</view>
<view class="zd_wrapper grid-wraper">
<view class="slide_new">
<table>
<thead>
<tr>
<th>载具编码</th>
<th>载具类型</th>
<th>物料编码</th>
<th>物料名称</th>
<th>点位</th>
2024-02-19 09:48:42 +08:00
<th>物料数量</th>
2024-02-18 17:59:15 +08:00
</tr>
</thead>
<tbody>
2024-02-19 09:48:42 +08:00
<tr v-for="(e, i) in dataList" :key="i" @click="toCheck(e)" :class="{'checked': e.checked}">
2024-02-18 17:59:15 +08:00
<td>{{e.vehicle_code}}</td>
<td>{{e.vehicle_type}}</td>
<td>{{e.material_code}}</td>
<td>{{e.material_name}}</td>
<td>{{e.point_code}}</td>
2024-02-19 09:48:42 +08:00
<td>{{e.material_qty}}</td>
2024-02-18 17:59:15 +08:00
</tr>
</tbody>
</table>
</view>
</view>
</view>
<view class="submit-bar_new">
<view class="zd-col-7">
<view class="zd-row jcflexstart">
<view class="iconfont icon_unchecked" :class="{'icon_checked': isV}" @tap="isVirtual">&#xe66b;</view>
<view class="filter_input_wraper_inn_text">是否配盘</view>
</view>
</view>
<button class="zd-col-4 submit-button_new" @tap="clearUp">清空</button>
<button class="zd-col-6 submit-button_new" :class="{'btn-disabled': !index1 || !val1 || !val3 || !index2 || !$store.getters.publicObj}" :disabled="disabled1" @tap="_groupManual">开始组盘</button>
2024-02-19 09:48:42 +08:00
<button class="zd-col-6 submit-button_new" :class="{'btn-disabled': checkArr.length === 0}" :disabled="disabled2" @tap="_groupLink">开始配盘</button>
2024-02-18 17:59:15 +08:00
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {queryPoints, getVehicleType, queryVehicleGroup, groupManual, groupLink} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
options1: [],
index1: '',
val1: '',
val2: '',
val3: '',
val4: '',
val5: '',
options2: [],
index2: '',
dataList: [],
isV: false,
disabled1: false,
disabled2: false,
2024-02-19 09:48:42 +08:00
checkArr: []
2024-02-18 17:59:15 +08:00
};
},
created () {
this._getVehicleType()
this._queryPoints()
this._queryVehicleGroup()
},
destroyed () {
this.$store.dispatch('setPublicObj', '')
},
onShow() {
if (this.$store.getters.publicObj) {
this.val2 = this.$store.getters.publicObj.material_name
this.val4 = this.$store.getters.publicObj.material_id
this.val5 = this.$store.getters.publicObj.material_code
}
},
methods: {
/** 选择器 */
selectChange1(e) {
this.index1 = e
},
selectChange2(e) {
this.index2 = e
},
/** 载具类型下拉框 */
async _getVehicleType () {
let res = await getVehicleType()
this.options1 = [...res]
},
/** 点位下拉框 */
async _queryPoints () {
let res = await queryPoints('1')
res.map(el => {
this.$set(el, 'value', el.point_code)
this.$set(el, 'text', el.point_name)
})
this.options2 = [...res]
},
/** grid */
async _queryVehicleGroup () {
let res = await queryVehicleGroup()
2024-02-19 09:48:42 +08:00
res.map(el => {
this.$set(el, 'checked', false)
})
2024-02-18 17:59:15 +08:00
this.dataList = [...res]
},
getMater () {
uni.navigateTo({
url: '/pages/manage/search-mater-1'
})
},
toCheck (e) {
2024-02-19 09:48:42 +08:00
e.checked = !e.checked
this.checkArr = this.dataList.filter(i => { return i.checked === true })
2024-02-18 17:59:15 +08:00
},
isVirtual () {
this.isV = !this.isV
},
/** 开始组盘 */
async _groupManual () {
this.disabled1 = true
if (!this.index1 || !this.val1 || !this.val3 || !this.index2 || !this.$store.getters.publicObj) {
this.disabled1 = false
return
}
try {
let res = await groupManual(this.index1, this.val1, this.index2, this.val4, this.val5, this.val3, this.isV)
this.disabled1 = false
2024-02-19 09:48:42 +08:00
this.checkArr = []
2024-02-18 17:59:15 +08:00
this.clearUp()
this._queryVehicleGroup()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled1 = false
}
},
/** 开始配盘 */
async _groupLink () {
this.disabled2 = true
2024-02-19 09:48:42 +08:00
if (this.checkArr.length === 0) {
2024-02-18 17:59:15 +08:00
this.disabled2 = false
return
}
try {
2024-02-19 09:48:42 +08:00
let arr = []
this.checkArr.map(el => {
if (el.checked) {
arr.push(el.group_id)
}
})
let res = await groupLink(arr.toString(), this.val1)
2024-02-18 17:59:15 +08:00
this.disabled2 = false
2024-02-19 09:48:42 +08:00
this.checkArr = []
2024-02-18 17:59:15 +08:00
this.clearUp()
this._queryVehicleGroup()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled2 = false
}
},
clearUp () {
this.index1 = ''
this.index2 = ''
this.val1 = ''
this.val2 = ''
this.val3 = ''
this.$store.dispatch('setPublicObj', '')
}
}
}
</script>
<style lang="stylus">
</style>