页面开发
This commit is contained in:
141
pages/task/dwcz.vue
Normal file
141
pages/task/dwcz.vue
Normal file
@@ -0,0 +1,141 @@
|
||||
<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-6">
|
||||
<span class="filter_label">点位编码</span>
|
||||
</view>
|
||||
<view class="zd-col-18 filter_select">
|
||||
<search-box
|
||||
v-model="val1"
|
||||
@handleChange="handleChange"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="zd-row border-bottom filter_input_disabled">
|
||||
<view class="zd-col-6">
|
||||
<span class="filter_label">点位名称</span>
|
||||
</view>
|
||||
<view class="zd-col-18 filter_select">
|
||||
<input type="text" class="filter_input" v-model="val2" disabled>
|
||||
</view>
|
||||
</view>
|
||||
<view class="zd-row border-bottom" :class="{'filter_input_disabled': edit}">
|
||||
<view class="zd-col-6">
|
||||
<span class="filter_label">载具编码</span>
|
||||
</view>
|
||||
<view class="zd-col-18 filter_select">
|
||||
<input v-if="edit" type="text" class="filter_input" v-model="val3" disabled>
|
||||
<search-box
|
||||
v-else
|
||||
v-model="val3"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="zd-row submit-bar">
|
||||
<button class="zd-col-5 button-default" @tap="clearUp">清空</button>
|
||||
<button class="zd-col-8 button-primary" :class="{'button-info': !val1 || !val2 || !val3}" :disabled="disabled" @tap="_pointBinding">解绑</button>
|
||||
<button class="zd-col-8 button-primary" :class="{'button-info': !val1 || !val2 || !val3}" :disabled="disabled" @tap="_pointDissect">绑定</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import NavBar from '@/components/NavBar.vue'
|
||||
import SearchBox from '@/components/SearchBox.vue'
|
||||
import {pointGetPoint, pointBinding, pointDissect} from '@/utils/getData.js'
|
||||
export default {
|
||||
components: {
|
||||
NavBar,
|
||||
SearchBox
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
title: '',
|
||||
val1: '',
|
||||
val2: '',
|
||||
val3: '',
|
||||
edit: false,
|
||||
disabled: false
|
||||
};
|
||||
},
|
||||
onLoad (options) {
|
||||
this.title = options.title
|
||||
},
|
||||
methods: {
|
||||
handleChange (e) {
|
||||
if (e) {
|
||||
this._pointGetPoint(e)
|
||||
}
|
||||
},
|
||||
async _pointGetPoint (e) {
|
||||
try {
|
||||
let res = await pointGetPoint(this.val1)
|
||||
if (res) {
|
||||
this.val2 = res.data.point_name
|
||||
if (res.data.storagevehicle_code) {
|
||||
this.val3 = res.data.storagevehicle_code
|
||||
this.edit = true
|
||||
}
|
||||
} else {
|
||||
this.initData = {}
|
||||
}
|
||||
} catch (e) {
|
||||
this.initData = {}
|
||||
}
|
||||
},
|
||||
clearUp () {
|
||||
this.val1 = ''
|
||||
this.val2 = ''
|
||||
this.val3 = ''
|
||||
this.edit = false
|
||||
this.disabled = false
|
||||
},
|
||||
async _pointBinding () {
|
||||
this.disabled = true
|
||||
if (!this.val1 || !this.val2 || !this.val3) {
|
||||
this.disabled = false
|
||||
return
|
||||
}
|
||||
try {
|
||||
let res = await pointBinding(this.val1, this.val2, this.val3)
|
||||
this.disabled = false
|
||||
uni.showToast({
|
||||
title: res.message,
|
||||
icon: 'none'
|
||||
})
|
||||
this.clearUp()
|
||||
} catch (e) {
|
||||
this.disabled = false
|
||||
}
|
||||
},
|
||||
async _pointDissect () {
|
||||
this.disabled = true
|
||||
if (!this.val1 || !this.val2 || !this.val3) {
|
||||
this.disabled = false
|
||||
return
|
||||
}
|
||||
try {
|
||||
let res = await pointDissect(this.val1, this.val2, this.val3)
|
||||
this.disabled = false
|
||||
uni.showToast({
|
||||
title: res.message,
|
||||
icon: 'none'
|
||||
})
|
||||
this.clearUp()
|
||||
} catch (e) {
|
||||
this.disabled = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="stylus">
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user