130 lines
3.5 KiB
Vue
130 lines
3.5 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 line_item">
|
|
<view class="zd-col-20 zd-row jcflexstart">
|
|
<button class="point_item" v-for="e in pointInfo.S04" :key="e.point_code" :class="['bg_gray', 'bg_green'][Number(e.point_status)]" :disabled="disabled" @tap="toCheck(e)"></button>
|
|
</view>
|
|
<view class="zd-col-4 font-size-1">S04</view>
|
|
</view>
|
|
<view class="zd-row line_item">
|
|
<view class="zd-col-20 zd-row jcflexstart">
|
|
<button class="point_item" v-for="e in pointInfo.S06" :key="e.point_code" :class="['bg_gray', 'bg_green'][Number(e.point_status)]" :disabled="disabled" @tap="toCheck(e)"></button>
|
|
</view>
|
|
<view class="zd-col-4 font-size-1">S06</view>
|
|
</view>
|
|
<view class="zd-row line_item">
|
|
<view class="zd-col-20 zd-row jcflexstart">
|
|
<button class="point_item" v-for="e in pointInfo.R01" :key="e.point_code" :class="['bg_gray', 'bg_green'][Number(e.point_status)]" :disabled="disabled" @tap="toCheck(e)"></button>
|
|
</view>
|
|
<view class="zd-col-4 font-size-1">R01</view>
|
|
</view>
|
|
<view class="zd-row line_item">
|
|
<view class="zd-col-20 zd-row jcflexstart">
|
|
<button class="point_item" v-for="e in pointInfo.R02" :key="e.point_code" :class="['bg_gray', 'bg_green'][Number(e.point_status)]" :disabled="disabled" @tap="toCheck(e)"></button>
|
|
</view>
|
|
<view class="zd-col-4 font-size-1">R02</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="zd-row submit-bar">
|
|
<button class="zd-col-22 button-primary" @tap="_getLlddw">刷新</button>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import NavBar from '@/components/NavBar.vue'
|
|
import {getLlddw, fillUpEmpty} from '@/utils/getData2.js'
|
|
export default {
|
|
components: {
|
|
NavBar
|
|
},
|
|
data() {
|
|
return {
|
|
title: '',
|
|
pointInfo: {S04: [], S06: [], R01: [], R02: []},
|
|
disabled: false
|
|
};
|
|
},
|
|
onLoad (options) {
|
|
this.title = options.title
|
|
this._getLlddw()
|
|
},
|
|
methods: {
|
|
async _getLlddw () {
|
|
let res = await getLlddw()
|
|
if (res) {
|
|
this.pointInfo.S04 = [...res].slice(0, 4)
|
|
this.pointInfo.S04.reverse()
|
|
this.pointInfo.S06 = [...res].slice(4, 8)
|
|
this.pointInfo.S06.reverse()
|
|
this.pointInfo.R01 = [...res].slice(8, 11)
|
|
this.pointInfo.R01.reverse()
|
|
this.pointInfo.R02 = [...res].slice(11, 14)
|
|
this.pointInfo.R02.reverse()
|
|
}
|
|
},
|
|
toCheck (e) {
|
|
this.disabled = true
|
|
if (e.point_status === '1') {
|
|
this.disabled = false
|
|
return
|
|
}
|
|
uni.showModal({
|
|
title: '提示',
|
|
cancelText: '取消',
|
|
confirmText: '确定',
|
|
content: `请确认当前点位${e.point_code}补空框?`,
|
|
success: (res) => {
|
|
if (res.confirm) {
|
|
this._fillUpEmpty(e)
|
|
} else if (res.cancel) {
|
|
this.disabled = false
|
|
}
|
|
}
|
|
})
|
|
},
|
|
async _fillUpEmpty (e) {
|
|
try {
|
|
let res = await fillUpEmpty(e)
|
|
if (res) {
|
|
this.disabled = false
|
|
this._getLlddw()
|
|
uni.showToast({
|
|
title: res.message,
|
|
icon: 'none'
|
|
})
|
|
}
|
|
} catch (e) {
|
|
this.disabled = false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="stylus" scoped>
|
|
@import '../../common/style/mixin.styl';
|
|
.line_item
|
|
padding 20rpx 20rpx
|
|
background-color #f3f3f3
|
|
margin-bottom 20rpx
|
|
.point_item
|
|
width 23%
|
|
height 100rpx
|
|
padding 0
|
|
margin-left 0
|
|
margin-right 2%
|
|
border-radius 4px
|
|
.bg_gray
|
|
background #c9c9c9 !important
|
|
.bg_green
|
|
background #6CBE8B !important
|
|
.font-size-1
|
|
font-size 40rpx
|
|
text-align right
|
|
</style>
|