区域锁定页

This commit is contained in:
2024-08-26 16:05:16 +08:00
parent cf138cf88b
commit 6b9756435b
4 changed files with 170 additions and 32 deletions

126
components/LinkScan.vue Normal file
View File

@@ -0,0 +1,126 @@
<template>
<view class="scan_wraper">
<view class="zd-row">
<view class="zd-col-24 zd-row jcflexstart" @tap="focusState=true">
<view v-show="scanList.length" class="scaned_font">{{scanList.join()+','}}</view>
<input
type="text"
class="search_input"
confirm-type="go"
v-model="value"
:focus="focusState"
@focus="handleFocus"
@blur="handleBlur"
@confirm="handleSend">
</view>
<uni-icons v-show="scanList.length" class="mgr20" type="clear" size="24" color="#4e6ef2" @tap="toDel"></uni-icons>
<uni-icons type="scan" size="22" :color="focusState ? '#D7592F' : '#4e6ef2'" @tap="focusState=true"></uni-icons>
</view>
<view v-show="scanList.length > 0 && show" class="scan_list_select">
<view class="pop_arrow"></view>
<view class="zd-row" v-for="(e, i) in scanList" :key="i">
<view class="scan_list_item">{{e}}</view>
<uni-icons type="clear" size="20" color="#666" @tap="toDelItem(i)"></uni-icons>
</view>
</view>
</view>
</template>
<script>
import permision from "@/utils/permission.js"
export default {
data() {
return {
focusState: false,
scanList: [],
value: '',
show: false
};
},
methods: {
handleFocus () {
this.focusState = true
this.show = true
},
handleBlur () {
this.focusState = false
if (this.value) {
this.scanList.push(this.value)
this.value = ''
this.$emit('getScanlist', this.scanList)
}
this.show = false
},
toDel () {
this.value = ''
this.scanList = []
// setTimeout(()=> {
// this.focusState = true
// }, 100)
},
toDelItem (i) {
this.scanList.splice(i, 1)
this.$emit('getScanlist', this.scanList)
setTimeout(()=> {
this.focusState = true
}, 100)
},
handleSend (e) {
if (this.value) {
this.scanList.push(this.value)
this.value = ''
}
setTimeout(()=> {
this.focusState = true
}, 100)
this.$emit('getScanlist', this.scanList)
}
}
}
</script>
<style lang="stylus" scoped>
@import '../common/style/mixin.styl';
.scan_wraper
position relative
_wh(100%, 80rpx)
background-color: #fff;
border-radius: 10rpx;
padding: 0 10rpx
.search_input
width 50%
height 80rpx;
_font(28rpx, 80rpx, #606266,,)
border: 0;
background-color: transparent;
.scaned_font
max-width 50%
_font(26rpx, 60rpx, #606266,,)
white-space nowrap
text-overflow ellipsis
overflow hidden
margin-right 6rpx
.scan_list_select
position absolute
top calc(100% + 12px)
left 0
z-index 3
width 100%
background-color: #FFFFFF;
border: 1px solid #EBEEF5;
border-radius: 6px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
padding: 8rpx 10rpx
.pop_arrow
position absolute
top: -12px
left: 10%
border: 6px solid #EBEEF5;
width: 0;
height: 0;
border-top-color: transparent;
border-left-color: transparent;
border-right-color: transparent;
.scan_list_select
_font(26rpx, 80rpx, #606266,,)
</style>

View File

@@ -8,15 +8,15 @@
<span class="filter_label">区域</span>
</view>
<view class="zd-col-19 filter_select">
<zxz-uni-data-select v-model="index1" filterable :localdata="options1" @change="selectChange"></zxz-uni-data-select>
<uni-data-select v-model="index" :localdata="options" @change="selectChange"></uni-data-select>
</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': index1 === ''}" :disabled="disabled" @tap="_fullVehicleOut">锁定</button>
<button class="zd-col-8 button-primary" :class="{'button-info': index1 === ''}" :disabled="disabled" @tap="_fullVehicleOut">释放</button>
<button class="zd-col-8 button-primary" :class="{'button-info': index === ''}" :disabled="disabled" @tap="_handheldLock('1')">锁定</button>
<button class="zd-col-8 button-primary" :class="{'button-info': index === ''}" :disabled="disabled" @tap="_handheldLock('0')">释放</button>
</view>
</view>
</template>
@@ -24,7 +24,7 @@
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {queryMaterial, queryLinkMaterial, fullVehicleOut} from '@/utils/getData2.js'
import {regionList, handheldLock} from '@/utils/getData2.js'
export default {
components: {
NavBar,
@@ -33,33 +33,34 @@
data() {
return {
title: '',
options1: [],
index1: '',
options: [],
index: '',
disabled: false
};
},
onLoad (options) {
this.title = options.title
this._regionList()
},
methods: {
async _queryMaterial (e) {
let res = await queryMaterial(e)
res.map(el => {
this.$set(el, 'value', el.material_id)
this.$set(el, 'text', el.material_name)
async _regionList () {
let res = await regionList()
this.options = [...res.content]
this.options.map(el => {
this.$set(el, 'text', el.label)
})
this.options1 = [...res]
},
selectChange (e) {
this.index = e
},
async _fullVehicleOut () {
async _handheldLock (type) {
this.disabled = true
if (this.index1 === '') {
if (this.index === '') {
this.disabled = false
return
}
try {
let res = await fullVehicleOut(this.index1)
let res = await handheldLock(this.index, type)
this.clearUp()
uni.showToast({
title: res.message,
@@ -70,7 +71,7 @@
}
},
clearUp () {
this.index1 = ''
this.index = ''
this.disabled = false
}
}

View File

@@ -5,7 +5,7 @@
<view class="zd_wrapper">
<view class="zd-row border-bottom">
<view class="zd-col-5">
<span class="filter_label">地面点位</span>
<span class="filter_label">当前点位</span>
</view>
<view class="zd-col-19">
<search-box
@@ -15,20 +15,17 @@
</view>
<view class="zd-row">
<view class="zd-col-5">
<span class="filter_label">载具类型</span>
<span class="filter_label">载具</span>
</view>
<view class="zd-col-17 filter_picker">
<picker @change="pickerChange" :value="index1" :range="options1" range-key="text">
<view class="uni-input">{{index1 !== '' ? options1[index1].text : ''}}</view>
</picker>
<view class="zd-col-19">
<link-scan ref="scanChild" @getScanlist="getScanlist"/>
</view>
<uni-icons type="right" size="14" color="#999"></uni-icons>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-7 button-default" @tap="clearUp">清空</button>
<button class="zd-col-15 button-primary" :class="{'button-info': index1 === '' || !val1}" :disabled="disabled" @tap="_callEmptyVehicle">送回确认</button>
<button class="zd-col-15 button-primary" :class="{'button-info': !val1}" :disabled="disabled" @tap="_callEmptyVehicle">送回确认</button>
</view>
</view>
</template>
@@ -36,20 +33,19 @@
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import LinkScan from '@/components/LinkScan.vue'
import {getVehicleType, callEmptyVehicle} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
SearchBox,
LinkScan
},
data() {
return {
title: '',
options1: [],
index1: '',
// options2: [],
// index2: '',
val1: '',
val2: '',
disabled: false
};
},
@@ -57,6 +53,9 @@
this.title = options.title
},
methods: {
getScanlist (e) {
this.val2 = e.join()
},
/** 载具类型下拉框 */
async _getVehicleType () {
let res = await getVehicleType()
@@ -67,12 +66,12 @@
},
async _callEmptyVehicle () {
this.disabled = true
if (!this.val1 || this.index1 === '') {
if (!this.val1) {
this.disabled = false
return
}
try {
let res = await callEmptyVehicle(this.options1[this.index1].value, this.val1)
let res = await callEmptyVehicle(this.val1)
this.clearUp()
uni.showToast({
title: res.message,
@@ -83,8 +82,9 @@
}
},
clearUp () {
this.index1 = ''
this.val1 = ''
this.val2 = ''
this.$refs.scanChild.toDel()
this.disabled = false
}
}

View File

@@ -20,6 +20,17 @@ export const handLogin = (user, password) => request({
password: password
}
})
// 区域
export const regionList = () => request({
url:'api/fab/regionList',
method: 'GET'
})
// 区域锁定
export const handheldLock = (code, status) => request({
url:'api/handheld/lock',
data: {region_code: code, status: status}
})
/**
* 空托盘出库
*/