Files
hht-longdianningxin-uni/pages/manage/axis-bind.vue
2024-11-01 15:19:23 +08:00

193 lines
5.2 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"
/>
</view>
</view>
<view class="zd-row">
<view class="zd-col-7">
<span class="filter_label">分切设备</span>
</view>
<view class="zd-col-17 filter_select">
<uni-data-select v-model="index" :localdata="options" @change="selectChange"></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>
<th>生产顺序</th>
<th>生产日期</th>
<th>订单号</th>
<th>纸筒/FRP管</th>
<th>纸筒/FRP管物料编码</th>
<th>纸筒/FRP管物料描述</th>
<th>纸筒/FRP管规格</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i" @click="toCheck(e)" :class="{'checked': e.checked}">
<td>{{e.container_name}}</td>
<td>{{['上', '下'][Number(e.up_or_down) - 1]}}</td>
<td>{{['左', '右'][Number(e.left_or_right) - 1]}}</td>
<td>{{e.resource_name}}</td>
<td>{{e.split_group}}</td>
<td>{{e.manufacture_sort}}</td>
<td>{{e.manufacture_date}}</td>
<td>{{e.mfg_order_name}}</td>
<td>{{['纸管', 'FRP管'][Number(e.paper_tube_or_FRP) - 1]}}</td>
<td v-show="e.paper_tube_or_FRP === '1'">{{e.paper_tube_material}}</td>
<td v-show="e.paper_tube_or_FRP === '1'">{{e.paper_tube_description}}</td>
<td v-show="e.paper_tube_or_FRP === '1'">{{e.paper_tube_model}}</td>
<td v-show="e.paper_tube_or_FRP === '2'">{{e.frp_material}}</td>
<td v-show="e.paper_tube_or_FRP === '2'">{{e.frp_description}}</td>
<td v-show="e.paper_tube_or_FRP === '2'">{{e.frp_model}}</td>
</tr>
</tbody>
</table>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-4 button-default" @tap="clearUp">清空</button>
<button class="zd-col-6 button-primary" :class="{'button-info': !val1}" :disabled="disabled" @tap="_doSendShaft">呼叫送轴</button>
<button class="zd-col-6 button-primary" :class="{'button-info': !val1}" :disabled="disabled" @tap="_toCleanCutCacheInventory">点位清除</button>
<button class="zd-col-6 button-primary" :class="{'button-info': !val1 || !checkArr.length}" :disabled="disabled" @tap="_doBindingGx">纸管绑定</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {getSlitterDeviceBox, getSlitterNeedShaftPlans, doSendShaft, toCleanCutCacheInventory, doBindingGx} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
title: '',
val1: '',
index: '',
options: [],
dataList: [],
checkArr: [],
disabled: false
};
},
onLoad (options) {
this.title = options.title
this._getSlitterDeviceBox()
this._getSlitterNeedShaftPlans('')
},
methods: {
async _getSlitterDeviceBox () {
let res = await getSlitterDeviceBox()
this.options = [...res]
},
selectChange (e) {
if (e) {
this._getSlitterNeedShaftPlans(e)
}
},
async _getSlitterNeedShaftPlans (e) {
let res = await getSlitterNeedShaftPlans(e)
res.map(el => {
this.$set(el, 'checked', false)
})
this.dataList = [...res]
},
async _doSendShaft () {
this.disabled = true
if (!this.val1) {
this.disabled = false
return
}
try {
let res = await doSendShaft(this.val1, this.index)
this.clearUp()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
},
async _toCleanCutCacheInventory () {
this.disabled = true
if (!this.val1) {
this.disabled = false
return
}
try {
let res = await toCleanCutCacheInventory(this.val1)
this.clearUp()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
},
async _doBindingGx () {
this.disabled = true
if (!this.val1 || !this.checkArr.length) {
this.disabled = false
return
}
if (this.checkArr.length > 2) {
uni.showToast({
title: '最多选择两条信息',
icon: 'none'
})
return
}
try {
let res = await doBindingGx(this.val1, this.checkArr)
this.clearUp()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
},
clearUp () {
this.val1 = ''
this.index = ''
this.dataList = []
this.checkArr = []
this.disabled = false
},
toCheck (e) {
e.checked = !e.checked
this.checkArr = this.dataList.filter(el => el.checked === true)
}
}
}
</script>
<style lang="stylus">
</style>