Files
hht-nl-five-uni/pages/lines/hj-line.vue
2025-07-23 20:21:17 +08:00

155 lines
3.3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="zd_container">
<!-- 焊接线 -->
<nav-bar :title="title"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper xzbox">
<view class="ozxbox"><span>起点</span><span>{{start.device_name}}</span></view>
</view>
<view class="zd_wrapper ocon">
<view class="obox" v-for="(e, i) in arrList" :key="i" :class="{'checked': e.device_code === pkId1}" @tap="toCheck1(e)">
{{ e.device_name }}
</view>
</view>
</view>
<view class="zd_content">
<view class="zd_wrapper xzbox">
<view class="ozxbox"><span>终点</span><span>{{end.device_name}}</span></view>
</view>
<view class="zd_wrapper ocon">
<view class="obox" v-for="(e, i) in arrList" :key="i" :class="{'checked': e.device_code === pkId2}" @tap="toCheck2(e)">
{{ e.device_name }}
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-6 button-default" @tap="clearUp">清空</button>
<button class="zd-col-16 button-primary" :class="{'button-info': !pkId1 || !pkId2}" :disabled="disabled" @tap="_createTask1">确认</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import { createTask2} from '@/utils/getData01.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
title: '',
pkId: '',
pkId1: '',
pkId2: '',
start: '',
end: '',
arrList: [
{
device_code:'HJX1',
device_name: '缓存区A'
},
{
device_code:'HJX2',
device_name: '缓存区B'
},
{
device_code:'HJX3',
device_name: '焊接线3'
},
{
device_code:'HJX4',
device_name: '焊接线4'
},
{
device_code:'HJX5',
device_name: '焊接线5'
},
{
device_code:'HJX6',
device_name: '焊接线6'
}
],
disabled: false
};
},
onLoad (options) {
this.title = options.title
},
methods: {
toCheck1 (e) {
if (e.device_code === this.end.device_code) {
this.pkId1 = ''
this.start = ''
return
}
this.pkId1 = e.device_code
this.start = e
},
toCheck2 (e) {
if (e.device_code === this.start.device_code) {
this.pkId2 = ''
this.end = ''
return
}
this.pkId2 = e.device_code
this.end = e
},
clearUp () {
this.start = ''
this.end = ''
this.pkId1 = ''
this.pkId2 = ''
},
async _createTask1 () {
this.disabled = true
if (!this.pkId1 || this.pkId2) {
this.disabled = false
return
}
try {
let res = await createTask2(this.start.device_code, this.end.device_code)
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">
.ocon
display flex
flex-wrap wrap
.obox
width 140px
height 60px
line-height 60px
text-align center
background #ff0
// border 1px solid #666
border-radius 3px
background #eee
margin-right 5px
margin-bottom 5px
.checked
background #fffbe5
.zd_content
padding 12px 8px 8px 8px
</style>