2024-09-13 16:11:36 +08:00
|
|
|
<template>
|
|
|
|
|
<view class="zd_container">
|
|
|
|
|
<nav-bar :title="title"></nav-bar>
|
|
|
|
|
<view class="zd_content">
|
|
|
|
|
<view class="zd_wrapper">
|
|
|
|
|
<view class="zd-row">
|
|
|
|
|
<view class="zd-col-5">
|
|
|
|
|
<span class="filter_label">类型</span>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="zd-col-19 filter_select">
|
|
|
|
|
<zxz-uni-data-select
|
|
|
|
|
v-model="index1"
|
|
|
|
|
:localdata="options1"
|
|
|
|
|
/>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="zd-row submit-bar">
|
|
|
|
|
<button class="zd-col-5 button-default" @tap="clearUp">清空</button>
|
2024-09-18 16:54:47 +08:00
|
|
|
<button class="zd-col-8 button-primary" :class="{'button-info': !index1}" :disabled="disabled" @tap="toSure('1')">锁定</button>
|
2024-09-13 17:24:53 +08:00
|
|
|
<button class="zd-col-8 button-primary" :class="{'button-info': !index1}" :disabled="disabled" @tap="_updateRouteStatus('0')">释放</button>
|
2024-09-13 16:11:36 +08:00
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import NavBar from '@/components/NavBar.vue'
|
|
|
|
|
import SearchBox from '@/components/SearchBox.vue'
|
2024-09-13 17:24:53 +08:00
|
|
|
import {updateRouteStatus} from '@/utils/getData2.js'
|
2024-09-20 11:24:16 +08:00
|
|
|
// import {updateRouteStatus} from '@/utils/mork2.js'
|
2024-09-13 16:11:36 +08:00
|
|
|
export default {
|
|
|
|
|
components: {
|
|
|
|
|
NavBar,
|
|
|
|
|
SearchBox
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
title: '',
|
|
|
|
|
options1: [{value: '1', text: '外协到冲床一'}, {value: '2', text: '外协到冲床二'}, {value: '3', text: '外协到冲床三'}, {value: '4', text: '外协到激光'}],
|
2024-09-13 17:24:53 +08:00
|
|
|
index1: '',
|
2024-09-13 16:11:36 +08:00
|
|
|
disabled: false
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
onLoad (options) {
|
|
|
|
|
this.title = options.title
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
2024-09-18 16:54:47 +08:00
|
|
|
toSure (type) {
|
|
|
|
|
this.disabled = true
|
|
|
|
|
if (!this.index1) {
|
|
|
|
|
this.disabled = false
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
uni.showModal({
|
|
|
|
|
title: '提示',
|
|
|
|
|
cancelText: '取消',
|
|
|
|
|
confirmText: '确定',
|
|
|
|
|
content: '请确认当前锁定路线不存在AGV',
|
|
|
|
|
success: (res) => {
|
|
|
|
|
if (res.confirm) {
|
|
|
|
|
this._updateRouteStatus(type)
|
|
|
|
|
} else if (res.cancel) {
|
|
|
|
|
this.disabled = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
2024-09-13 16:11:36 +08:00
|
|
|
async _updateRouteStatus (type) {
|
|
|
|
|
this.disabled = true
|
2024-09-13 17:24:53 +08:00
|
|
|
if (!this.index1) {
|
2024-09-13 16:11:36 +08:00
|
|
|
this.disabled = false
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
try {
|
2024-09-13 17:24:53 +08:00
|
|
|
let res = await updateRouteStatus(this.index1, type)
|
2024-09-13 16:11:36 +08:00
|
|
|
this.clearUp()
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: res.message,
|
|
|
|
|
icon: 'none'
|
|
|
|
|
})
|
2024-09-20 11:24:16 +08:00
|
|
|
this.$globalData.stopTimer()
|
|
|
|
|
if (type === '1') {
|
|
|
|
|
this.$store.dispatch('setRouteStatus', true)
|
|
|
|
|
this.$globalData.startTimer()
|
|
|
|
|
} else {
|
|
|
|
|
this.$store.dispatch('delRouteStatus', false)
|
|
|
|
|
this.$globalData.stopTimer()
|
|
|
|
|
}
|
2024-09-13 16:11:36 +08:00
|
|
|
} catch (e) {
|
|
|
|
|
this.disabled = false
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
clearUp () {
|
|
|
|
|
this.index1 = ''
|
|
|
|
|
this.disabled = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="stylus">
|
|
|
|
|
@import '../../common/style/mixin.styl';
|
|
|
|
|
</style>
|