Files
hht-xzhy-uni/pages/General/pt-update.vue

146 lines
3.7 KiB
Vue
Raw Normal View History

2025-09-03 09:57:06 +08:00
<template>
2025-09-03 17:08:48 +08:00
<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-6">
<span class="filter_label">点位</span>
</view>
<view class="zd-col-18">
2025-09-08 15:41:33 +08:00
<search-box v-model="pointCode"/>
2025-09-03 17:08:48 +08:00
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label">载具编码</span>
</view>
<view class="zd-col-13">
2025-09-08 15:41:33 +08:00
<search-box v-model="vehicleCode"/>
2025-09-03 17:08:48 +08:00
</view>
2025-12-04 13:59:33 +08:00
<button class="mini-btn" type="primary" @tap="_updatePointqueryPointInfo">查询</button>
2025-09-03 17:08:48 +08:00
</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>
2025-09-08 15:41:33 +08:00
<tr v-for="(e, i) in dataList" :key="i" :class="{'checked': e.material_code === pkId}">
<td>{{i+1}}</td>
2025-09-03 17:08:48 +08:00
<td>{{e.material_code}}</td>
<td>{{e.material_name}}</td>
<td>{{e.pcsn}}</td>
2025-09-08 15:41:33 +08:00
<td>{{e.qty}}</td>
<td>{{e.qty_unit_name}}</td>
2025-09-03 17:08:48 +08:00
</tr>
</tbody>
</table>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-5 button-default" @tap="toEmpty">清空</button>
2025-09-08 15:41:33 +08:00
<button class="zd-col-6 button-primary" :class="{'button-info': !pointCode || !vehicleCode}" :disabled="disabled" @tap="_bindVehicle">绑定</button>
<button class="zd-col-6 button-primary" :class="{'button-info': !pointCode || !vehicleCode}" :disabled="disabled" @tap="_clearVehicle">清载具</button>
<button class="zd-col-6 button-primary" :class="{'button-info': !pointCode || !vehicleCode}" :disabled="disabled" @tap="_clearMaterial">清物料</button>
2025-09-03 17:08:48 +08:00
</view>
2025-09-03 09:57:06 +08:00
</view>
</template>
<script>
2025-09-03 17:08:48 +08:00
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
2025-09-08 16:45:57 +08:00
// import {updatePointqueryPointInfo} from '@/utils/mork2.js'
import {updatePointqueryPointInfo, bindVehicle, clearVehicle, clearMaterial} from '@/utils/getData2.js'
2025-09-03 09:57:06 +08:00
export default {
2025-09-03 17:08:48 +08:00
components: {
NavBar,
SearchBox
},
2025-09-03 09:57:06 +08:00
data() {
return {
2025-09-03 17:08:48 +08:00
title: '',
2025-09-08 15:41:33 +08:00
pointCode: '',
vehicleCode: '',
2025-09-03 17:08:48 +08:00
dataList: [],
2025-09-08 15:41:33 +08:00
disabled: false
2025-09-03 09:57:06 +08:00
};
2025-09-03 17:08:48 +08:00
},
onLoad (options) {
this.title = options.title
},
methods: {
2025-09-08 15:41:33 +08:00
async _updatePointqueryPointInfo () {
try {
let res = await updatePointqueryPointInfo(this.pointCode, this.vehicleCode)
if (res && res.data.length > 0) {
this.dataList = [...res.data]
2025-09-03 17:08:48 +08:00
} else {
this.dataList = []
}
2025-09-08 15:41:33 +08:00
} catch (e) {
this.dataList = []
2025-09-03 17:08:48 +08:00
}
},
2025-09-08 15:41:33 +08:00
toEmpty () {
this.pointCode = ''
this.vehicleCode = ''
this.dataList = []
this.disabled = false
},
async _bindVehicle () {
try {
let res = await bindVehicle(this.pointCode, this.vehicleCode)
if (res) {
uni.showToast({
title: res.message,
icon: 'none'
})
}
this.toEmpty()
} catch (e) {
this.disabled = false
2025-09-03 17:08:48 +08:00
}
},
2025-09-08 15:41:33 +08:00
async _clearVehicle () {
try {
let res = await clearVehicle(this.pointCode, this.vehicleCode)
if (res) {
uni.showToast({
title: res.message,
icon: 'none'
})
}
this.toEmpty()
} catch (e) {
this.disabled = false
}
2025-09-03 17:08:48 +08:00
},
2025-09-08 15:41:33 +08:00
async _clearMaterial () {
try {
let res = await clearMaterial(this.pointCode, this.vehicleCode)
if (res) {
uni.showToast({
title: res.message,
icon: 'none'
})
}
this.toEmpty()
} catch (e) {
this.disabled = false
2025-09-03 17:08:48 +08:00
}
}
2025-09-03 09:57:06 +08:00
}
}
2025-09-03 17:08:48 +08:00
</script>