104 lines
2.0 KiB
Vue
104 lines
2.0 KiB
Vue
<template>
|
|
<view class="zd_container">
|
|
<!-- 装配线 -->
|
|
<nav-bar :title="title"></nav-bar>
|
|
<view class="zd_content">
|
|
<view class="zd_wrapper ocon">
|
|
<view class="obox" v-for="(e, i) in arrList" :key="i" :class="{'checked': e.device_code === pkId}" @tap="toCheck(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': !pkId}" :disabled="disabled" @tap="_createTask1">确认</button>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import NavBar from '@/components/NavBar.vue'
|
|
import SearchBox from '@/components/SearchBox.vue'
|
|
import { createTask1} from '@/utils/getData01.js'
|
|
export default {
|
|
components: {
|
|
NavBar,
|
|
SearchBox
|
|
},
|
|
data() {
|
|
return {
|
|
title: '',
|
|
pkId: '',
|
|
arrList: [
|
|
{
|
|
device_code:'ZPXA',
|
|
device_name: '装配线A'
|
|
},
|
|
{
|
|
device_code:'ZPXB',
|
|
device_name: '装配线B'
|
|
}
|
|
],
|
|
disabled: false
|
|
};
|
|
},
|
|
onLoad (options) {
|
|
this.title = options.title
|
|
},
|
|
created () {
|
|
},
|
|
methods: {
|
|
toCheck (e) {
|
|
this.pkId = this.pkId === e.device_code ? '' : e.device_code
|
|
},
|
|
clearUp () {
|
|
this.pkId = ''
|
|
},
|
|
async _createTask1 () {
|
|
this.disabled = true
|
|
if (!this.pkId) {
|
|
this.disabled = false
|
|
return
|
|
}
|
|
try {
|
|
let res = await createTask1(this.pkId)
|
|
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 150px
|
|
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
|
|
</style>
|