Files
hht-zzzw-uni/pages/zw/ll-instore.vue
2025-09-16 10:13:01 +08:00

247 lines
6.5 KiB
Vue

<template>
<view class="zd_container">
<!-- 来料入库 -->
<nav-bar :title="title"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label">托盘/点位码</span>
</view>
<view class="zd-col-17">
<search-box
v-model="val1"
@handleChange="handleChange"
/>
</view>
</view>
<!-- <view class="zd-row">
<view class="zd-col-19">
</view>
<view class="zd-col-4">
<button class="mini-btn" size="mini" style="display: block; margin-top: 9px;" type="primary" @tap="handleAdd">添加</button>
</view>
</view> -->
</view>
<view class="zd_wrapper" v-if="flag">
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label filter_input_disabled">载具编码</span>
</view>
<view class="zd-col-17">
<input type="text" class="filter_input filter_input_disabled" v-model="currentData.storagevehicle_code" disabled>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label filter_input_disabled">物料编码</span>
</view>
<view class="zd-col-17">
<input type="text" class="filter_input filter_input_disabled" v-model="currentData.material_code" disabled>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label filter_input_disabled">物料名称</span>
</view>
<view class="zd-col-17">
<input type="text" class="filter_input filter_input_disabled" v-model="currentData.material_name" disabled>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label filter_input_disabled">批次</span>
</view>
<view class="zd-col-17">
<input type="text" class="filter_input filter_input_disabled" v-model="currentData.pcsn" disabled>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label filter_input_disabled">可用数</span>
</view>
<view class="zd-col-17">
<input type="text" class="filter_input filter_input_disabled" v-model="currentData.qty" disabled>
</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>
<th>单据</th>
</tr>
</thead>
<tbody>
<!-- <tr v-for="(e, i) in dataList" :key="i" @tap="toChek(e)" :class="{'checked': pkId === e.site_code}"> -->
<tr v-for="(e, i) in dataList" :key="i">
<td @tap="toCheck(e)"><uni-icons :type="e.checked ? 'checkbox' : 'circle'" size="24" color="#4e6ef2"></uni-icons></td>
<td>{{e.site_code}}</td>
<td>{{e.vehicle_code}}</td>
<td>{{e.material_code}}</td>
<td>{{e.qty}}</td>
<td>{{e.form_data_code}}</td>
</tr>
</tbody>
</table>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-11 button-primary" :class="{'button-info': !checkedArr.length}" @tap="toDel()">删除选中行</button>
<button class="zd-col-11 button-primary" :class="{'button-info': !dataList.length}" @tap="_zwConfirmIn">全部提交</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {getFormDataList, getPlate, inCheck, zwConfirmIn} from '@/utils/getData4.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
singleDate: '',
title: '',
id: '',
code: '',
val1: '',
pkId: '',
pkObj: {},
dataList: [],
// dataList: [
// {site_code: 's01', vehicle_code: 'v01', checked: false},
// {site_code: 's02', vehicle_code: 'v02', checked: false},
// {site_code: 's03', vehicle_code: 'v03', checked: false},
// {site_code: 's04', vehicle_code: 'v04', checked: false}
// ],
checkedArr: [],
pkId: '',
currentData: {},
flag: false,
disabled: false
};
},
onLoad (options) {
this.title = options.title
this.id = options.id
},
created () {
},
methods: {
handleChange (e) {
if (e) {
this._inCheck()
}
},
handleAdd () {
if (!this.val1) {
return
}
this.dataList.map(el => {
this.$set(el, 'checked', false)
})
},
// async _getPlate () {
// try {
// let res = await getPlate(this.val1)
// if (res.code === '200') {
// this.flag = true
// this.currentData = res.data
// setTimeout(() => {
// this.flag = false
// },1000)
// this.handleAdd()
// } else {
// uni.showToast({
// title: res.message,
// icon: 'none'
// })
// }
// } catch (e) {
// }
// },
toDel () {
this.dataList = this.dataList.filter(el => el.checked === false)
},
toChek (e) {
this.pkId = this.pkId === e.site_code ? '' : e.site_code
this.pkObj = this.pkId === e.site_code ? e : {}
},
toCheck (e) {
e.checked = !e.checked
this.checkedArr = this.dataList.filter(el => el.checked === true)
if (this.checkedArr.length > 0) {
this.dataList.map(el => {
this.$set(el, 'checked', false)
})
e.checked = !e.checked
}
},
clearUp () {
this.dataList = []
this.checkedArr = []
},
async _inCheck () {
try {
let res = await inCheck(this.val1)
if (res.code === '200') {
this.dataList = [...this.dataList, ...res.data]
this.handleAdd()
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
}
} catch (e) {
}
},
async _zwConfirmIn () {
this.disabled = true
if (!this.dataList.length) {
this.disabled = false
return
}
try {
let res = await zwConfirmIn(this.dataList)
if (res.code === '200') {
uni.showToast({
title: res.message,
icon: 'none'
})
this.clearUp()
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
this.disabled = false
}
} catch (e) {
this.disabled = false
}
}
}
}
</script>
<style lang="stylus" scoped>
.checked
background #ffffff
.slide_new table tr.checked td {
// background-color: transparent;
// color: #fff;
}
</style>