Files
hht-ndxy-uni/pages/manage/mix-task.vue
2024-12-25 13:35:58 +08:00

105 lines
2.4 KiB
Vue

<template>
<view class="zd_container">
<nav-bar :title="title"></nav-bar>
<view class="zd_content">
<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>
<th>配料桶数</th>
<th>剩余桶数</th>
<th>物料重量</th>
<th>状态</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i" @click="toCheck(e)" :class="{'checked': e.work_code === pkId}">
<td>{{ e.mfg_order_name }}</td>
<td>{{ e.seq_no }}</td>
<td>{{ e.material_code }}</td>
<td>{{ e.material_name }}</td>
<td>{{ e.resource_name }}</td>
<td>{{ e.point_code }}</td>
<td>{{ e.require_num }}</td>
<td>{{ e.remain_num }}</td>
<td>{{ e.qty }}</td>
<td>{{ e.status }}</td>
</tr>
</tbody>
</table>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-11 button-default" @tap="clearUp">清空</button>
<button class="zd-col-11 button-primary" :disabled="disabled" :class="{'button-info': !pkId}" @tap="_handConfirm">确认</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {queryWorks, handConfirm} from '@/utils/mork2.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
title: '',
disabled: false,
dataList: [],
pkId: ''
};
},
onLoad (options) {
this.title = options.title
this._queryWorks()
},
methods: {
async _queryWorks () {
let res = await queryWorks()
this.dataList = [...res]
},
clearUp () {
this.dataList = []
this.disabled = false
this.pkId = ''
},
toCheck (e) {
this.pkId = this.pkId === e.work_code ? '' : e.work_code
},
async _handConfirm () {
this.disabled = true
if (!this.pkId) {
this.disabled = false
return
}
try {
let res = await handConfirm()
this.clearUp()
this._queryWorks()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
}
}
}
</script>
<style lang="stylus">
</style>