This commit is contained in:
2025-09-08 17:48:45 +08:00
parent 40740964ab
commit 6cd801410e
6 changed files with 283 additions and 156 deletions

View File

@@ -6,34 +6,7 @@
<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-24 filter_select">
<!-- <uni-data-select v-model="index2" :localdata="options2" @change="selectChange2"></uni-data-select> -->
<uni-datetime-picker type="date" :value="singleDate" @change="onSingleDateChange" />
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label">单据</span>
</view>
<view class="zd-col-24 filter_select">
<uni-data-select v-model="index" :localdata="options" @change="selectChange"></uni-data-select>
</view>
</view>
<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="val2"
/>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label">托盘码</span>
<span class="filter_label">托盘码/点位码</span>
</view>
<view class="zd-col-17">
<search-box
@@ -97,17 +70,23 @@
<table>
<thead>
<tr>
<th>选择</th>
<th>托盘码</th>
<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.vid}"> -->
<!-- <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.vehicle_code}}</td>
<td>{{e.site_code}}</td>
<td>{{e.vehicle_code}}</td>
<td>{{e.material_code}}</td>
<td>{{e.qty}}</td>
<td>{{e.bill_code}}</td>
</tr>
</tbody>
</table>
@@ -116,7 +95,7 @@
</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': !index || !dataList.length}" @tap="_zwConfirmIn">全部提交</button>
<button class="zd-col-11 button-primary" :class="{'button-info': !dataList.length}" @tap="_zwConfirmIn">全部提交</button>
</view>
</view>
</template>
@@ -134,15 +113,19 @@
return {
singleDate: '',
title: '',
options: [],
index: '',
options2: [{text:'当天', value: '1'}, {text:'前一天', value: '2'}],
index2: '',
id: '',
code: '',
val1: '',
val2: '',
dataList: [],
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: {},
@@ -155,13 +138,8 @@
this.id = options.id
},
created () {
this._getFormDataList()
},
methods: {
onSingleDateChange(e) {
this.singleDate = e
this._getFormDataList()
},
handleChange (e) {
if (e) {
this._inCheck()
@@ -171,58 +149,45 @@
if (!this.val1 || !this.val2) {
return
}
this.dataList.push({vehicle_code: this.val1, site_code: this.val2})
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) {
}
},
// 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)
},
async _getFormDataList () {
try {
let res = await getFormDataList(this.singleDate)
if (res) {
this.options = res.data
} else {
this.options = []
}
} catch (e) {
this.options = []
}
toChek (e) {
this.pkId = this.pkId === e.site_code ? '' : e.site_code
this.pkObj = this.pkId === e.site_code ? e : {}
},
selectChange (e) {
this.index = e
},
selectChange2 (e) {
this.index2 = e
},
// toChek (e) {
// this.pkId = this.pkId === e.vid ? '' : e.vid
// this.pkObj = this.pkId === e.vid ? 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 = []
@@ -230,8 +195,9 @@
},
async _inCheck () {
try {
let res = await inCheck(this.val2, this.val1)
let res = await inCheck(this.val1)
if (res.code === '200') {
this.dataList = res.data
this.handleAdd()
} else {
uni.showToast({
@@ -244,12 +210,12 @@
},
async _zwConfirmIn () {
this.disabled = true
if (!this.index || !this.dataList.length) {
if (!this.dataList.length) {
this.disabled = false
return
}
try {
let res = await zwConfirmIn(this.index, this.dataList)
let res = await zwConfirmIn(this.dataList)
if (res.code === '200') {
uni.showToast({
title: res.message,