| | |
| | | <template> |
| | | <view class="container"> |
| | | <view class="container"> |
| | | <uni-icons type="bars" size="30" color="#b1b3b8" class="select" @click="jump()"></uni-icons> |
| | | <!-- 左 --> |
| | | |
| | | <view class="zcard"> |
| | | <view class="zcard-flex"> |
| | | <view class="button-nk" @click="click('left')">上架</view> |
| | | <view class="button-nk" v-for="item in groundSiteList" @click="click(item,'left')">{{item.name}}</view> |
| | | </view> |
| | | </view> |
| | | <!-- 右 --> |
| | | |
| | | <view class="zcard"> |
| | | <view class="zcard-flex"> |
| | | <view class="button-nk" style="background-color: brown;" @click="click('right')">下架</view> |
| | | <view class="button-nk" style="background-color: brown;" @click="putOut('out2')">仓库-满托盘(出库)</view> |
| | | <view class="button-nk" style="background-color: brown;" v-for="item in cacheSiteList" |
| | | @click="click(item,'right')">{{item.name}}</view> |
| | | </view> |
| | | </view> |
| | | |
| | | |
| | | <view> |
| | | <uni-popup ref="revise" type="dialog"> |
| | | <view class="popup"> |
| | | <view class="popup3-input-title">{{text}}</view> |
| | | <view class="button-nk" @click="option(item)" v-for="item in btns">{{item.name}}</view> |
| | | <view v-if="outType" class="popup"> |
| | | <view class="popup3-input-title">{{text}}</view> |
| | | <view class="button-nk" @click="upPallet()">盘头上架</view> |
| | | </view> |
| | | <view v-else class="popup"> |
| | | <view class="popup3-input-title">{{text}}</view> |
| | | <view class="button-nk" @click="downPallet()">盘头下架</view> |
| | | </view> |
| | | </uni-popup> |
| | | </view> |
| | | |
| | | |
| | | <view> |
| | | <uni-popup ref="numberPopup" type="dialog"> |
| | | <uni-popup ref="downPalletPopup" type="dialog"> |
| | | <view class="popup2"> |
| | | <view class="popup3-input-title">{{tipsTitle}}</view> |
| | | <view class="popup3-input-title">盘头下架</view> |
| | | <uni-data-select v-model="groundSite" :localdata="groundEmptySiteList"></uni-data-select> |
| | | <view class="button-nk" @click="goDown(2)">2个</view> |
| | | <view class="button-nk" @click="goDown(4)">4个</view> |
| | | </view> |
| | | </uni-popup> |
| | | </view> |
| | | |
| | | <view> |
| | | <uni-popup ref="upPalletPopup" type="dialog"> |
| | | <view class="popup2"> |
| | | <view class="popup3-input-title">盘头上架</view> |
| | | <view class="popup3-input-box"> |
| | | <uni-data-select v-model="chooseCacheSite" :localdata="chooseCacheSiteList" placeholder="请选择站点"></uni-data-select> |
| | | </view> |
| | | <view class="popup3-input-box"> |
| | | <uni-data-select v-model="chooseMat" :localdata="emptyMatList" placeholder="请选择物料"></uni-data-select> |
| | | </view> |
| | | <view class="popup3-input-box"> |
| | | <text>订单号:</text> |
| | | <view style="margin-left: 3rpx;"> |
| | | <input type="text" v-model="code" /> |
| | | </view> |
| | | </view> |
| | | <view class="popup3-input-box"> |
| | | <text>米数:</text> |
| | | <view style="margin-left: 3rpx;"> |
| | | <input type="text" v-model="meter" /> |
| | | </view> |
| | | </view> |
| | | <view class="button-nk" @click="goUp(2)">2个</view> |
| | | <view class="button-nk" @click="goUp(4)">4个</view> |
| | | </view> |
| | | </uni-popup> |
| | | </view> |
| | | |
| | | <view> |
| | | <uni-popup ref="inputPopup" type="dialog"> |
| | | <view class="popup3"> |
| | | <view class="popup3-input-title">{{tipsTitle}}</view> |
| | | <view class="popup3-input-box2" :class="item.chose" |
| | | v-if="!meterShow" v-for="item in emptyMatList" @click="chose(item.matnr)"> |
| | | <view> |
| | | {{item.maktx}} |
| | | </view> |
| | | </view> |
| | | <view class="popup3-input-box" v-if="meterShow"> |
| | | <text>{{desc}}:</text> |
| | | <view style="margin-left: 3rpx;"> |
| | | <input type="text" v-model="code"/> |
| | | </view> |
| | | </view> |
| | | <view class="popup3-input-box" v-if="meterShow"> |
| | | <text>米数:</text> |
| | | <view style="margin-left: 3rpx;"> |
| | | <input type="text" v-model="meter"/> |
| | | </view> |
| | | </view> |
| | | <view class="button-nk" @click="confirm(2)">确定</view> |
| | | </view> |
| | | </uni-popup> |
| | | </view> |
| | | |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | import code from '../../../uni_modules/uview-ui/libs/config/props/code'; |
| | | export default { |
| | | data() { |
| | | return { |
| | | baseUrl: '', |
| | | token: '', |
| | | onBtns: [ |
| | | {name: '1号空盘位上架',code:'1-Q1',traget: '12-F1',type: 'foolr'}, |
| | | {name: '2号空盘位上架',code:'2-Q1',traget: '12-F1',type: 'foolr'}, |
| | | groundSiteList: [{ |
| | | name: 'B-C-K-1', |
| | | code: 'B-C-K-1', |
| | | type: 'ground-k' |
| | | }, |
| | | { |
| | | name: 'B-C-M-1', |
| | | code: 'B-C-M-1', |
| | | type: 'ground-m' |
| | | }, |
| | | { |
| | | name: 'B-C-K-2', |
| | | code: 'B-C-K-2', |
| | | type: 'ground-k' |
| | | }, |
| | | { |
| | | name: 'B-C-M-2', |
| | | code: 'B-C-M-2', |
| | | type: 'ground-m' |
| | | }, |
| | | ], |
| | | outBtns: [ |
| | | {name: '下架至1号位',code:'11-Q1',traget: '1-F1',type: 'foolr'}, |
| | | {name: '下架至2号位',code:'11-Q1',traget: '2-F1',type: 'foolr'}, |
| | | {name: '下架至3号位',code:'11-Q1',traget: '3-F1',type: 'foolr'}, |
| | | cacheSiteList: [{ |
| | | name: 'B-H-1', |
| | | code: 'B-H-1', |
| | | type: 'cache' |
| | | }, |
| | | { |
| | | name: 'B-H-2', |
| | | code: 'B-H-2', |
| | | type: 'cache' |
| | | }, |
| | | { |
| | | name: 'B-H-3', |
| | | code: 'B-H-3', |
| | | type: 'cache' |
| | | }, |
| | | { |
| | | name: 'B-H-4', |
| | | code: 'B-H-4', |
| | | type: 'cache' |
| | | }, |
| | | { |
| | | name: 'B-H-5', |
| | | code: 'B-H-5', |
| | | type: 'cache' |
| | | }, |
| | | { |
| | | name: 'B-H-6', |
| | | code: 'B-H-6', |
| | | type: 'cache' |
| | | }, |
| | | { |
| | | name: 'B-H-7', |
| | | code: 'B-H-7', |
| | | type: 'cache' |
| | | }, |
| | | ], |
| | | btns: [], |
| | | outType: '', |
| | | emptyMatList: [], |
| | | chooseMat: '', |
| | | groundSite: '', |
| | | groundEmptySiteList: [], |
| | | chooseCacheSite: '', |
| | | chooseCacheSiteList: [], |
| | | item: '', |
| | | text: '', |
| | | btnTitle: '', |
| | | btnTitle1: '', |
| | | btnTitle2: '', |
| | | btnTitle3: '', |
| | | outType: '', |
| | | stationType: 'load', |
| | | type: '', |
| | | tipsTitle: '', |
| | | item: {}, |
| | | meterShow: false, |
| | | originLocal: '', |
| | | targetLocal: '', |
| | | code: '', |
| | | emptyMatList: '', |
| | | meter: '' |
| | | |
| | | |
| | | meter: '', |
| | | meterShow: '', |
| | | desc: '', |
| | | tipsTitle: '', |
| | | } |
| | | }, |
| | | onShow() { |
| | | if (uni.getStorageSync('Network')) { |
| | | let network = uni.getStorageSync('Network') |
| | | this.baseUrl = `http://${network[0].ip}:${network[0].port}/${network[0].address}` |
| | | this.token = uni.getStorageSync('token'); |
| | | } |
| | | let network = uni.getStorageSync('Network') |
| | | this.baseUrl = `http://${network[0].ip}:${network[0].port}/${network[0].address}` |
| | | this.token = uni.getStorageSync('token'); |
| | | |
| | | this.getEmptyMatList() |
| | | }, |
| | | methods: { |
| | | jump() { |
| | |
| | | url: '/pages/project/jmAGV/home' |
| | | }) |
| | | }, |
| | | // 满版出库 |
| | | putOut(type) { |
| | | this.type = type |
| | | this.inputPopup() |
| | | }, |
| | | inputPopup() { |
| | | if (this.type == 'out1') { |
| | | this.tipsTitle = '空托盘出库' |
| | | this.desc = '物料码' |
| | | this.meterShow = false |
| | | let that = this |
| | | uni.request({ |
| | | url: `${that.baseUrl}/agv/getEmptyMat`, |
| | | header: { 'token': uni.getStorageSync('token') }, |
| | | method: 'GET', |
| | | success(res) { |
| | | res = res.data |
| | | if (res.code === 200) { |
| | | res.data['chose'] = '' |
| | | that.emptyMatList = res.data |
| | | |
| | | } |
| | | } |
| | | }) |
| | | } else { |
| | | this.tipsTitle = '满托盘出库' |
| | | this.desc = '订单号' |
| | | this.meterShow = true |
| | | this.$refs.inputPopup.open('center') |
| | | } |
| | | this.$refs.inputPopup.open('center') |
| | | }, |
| | | click(type) { |
| | | click(item, type) { |
| | | this.item = item |
| | | this.text = item.name |
| | | if (type == 'left') { |
| | | this.btns = this.onBtns |
| | | this.text = '上架' |
| | | this.type = 'load' |
| | | this.tipsTitle = '上架数量' |
| | | this.outType = true |
| | | } else { |
| | | this.btns = this.outBtns |
| | | this.type = 'unload' |
| | | this.text = '下架' |
| | | this.tipsTitle = '下架数量' |
| | | this.outType = false |
| | | } |
| | | this.$refs.revise.open(type) |
| | | }, |
| | | option(item) { |
| | | this.item = item |
| | | this.$refs.numberPopup.open('center') |
| | | getEmptyMatList() { |
| | | let that = this |
| | | uni.request({ |
| | | url: `${that.baseUrl}/agv/getEmptyMat`, |
| | | header: { 'token': uni.getStorageSync('token') }, |
| | | method: 'GET', |
| | | success(res) { |
| | | res = res.data |
| | | if (res.code === 200) { |
| | | let tmp = [] |
| | | res.data.forEach((item) => { |
| | | tmp.push({ |
| | | text: item.maktx, |
| | | value: item.matnr |
| | | }) |
| | | }) |
| | | that.emptyMatList = tmp |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | upPallet() { |
| | | let tmp = []; |
| | | this.cacheSiteList.forEach((item) => { |
| | | tmp.push({ |
| | | text: item.name, |
| | | value: item.code |
| | | }) |
| | | }) |
| | | |
| | | this.chooseCacheSiteList = tmp; |
| | | this.upPalletPopup() |
| | | }, |
| | | downPallet() { |
| | | let tmp = []; |
| | | this.groundSiteList.forEach((item) => { |
| | | if (item.type == 'ground-k') { |
| | | tmp.push({ |
| | | text: item.name, |
| | | value: item.code |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | this.groundEmptySiteList = tmp; |
| | | this.downPalletPopup() |
| | | }, |
| | | upPalletPopup() { |
| | | this.$refs.upPalletPopup.open('center') |
| | | }, |
| | | downPalletPopup() { |
| | | this.$refs.downPalletPopup.open('center') |
| | | }, |
| | | goUp(num) { |
| | | let _this = this |
| | | let data = { |
| | | originLocal: this.item.code, |
| | | targetLocal: this.item.traget, |
| | | type: this.type, |
| | | anfme: num |
| | | } |
| | | this.webServer(data) |
| | | }, |
| | | confirm() { |
| | | let data = {} |
| | | |
| | | if(this.chooseCacheSite == ''){ |
| | | uni.showToast({ |
| | | title: '请选择站点', |
| | | icon: "none", |
| | | position: 'top' |
| | | }) |
| | | return; |
| | | } |
| | | |
| | | if(this.chooseMat == ''){ |
| | | uni.showToast({ |
| | | title: '请选择物料', |
| | | icon: "none", |
| | | position: 'top' |
| | | }) |
| | | return; |
| | | } |
| | | |
| | | if(this.code == ''){ |
| | | uni.showToast({ |
| | | title: '请输入订单号', |
| | | icon: "none", |
| | | position: 'top' |
| | | }) |
| | | return; |
| | | } |
| | | |
| | | if(this.meter == ''){ |
| | | uni.showToast({ |
| | | title: '请输入米数', |
| | | icon: "none", |
| | | position: 'top' |
| | | }) |
| | | return; |
| | | } |
| | | |
| | | data = { |
| | | originLocal: '11-Q1', |
| | | targetLocal: '11-Q1', |
| | | type: this.type, |
| | | originLocal: this.item.code, |
| | | targetLocal: this.chooseCacheSite, |
| | | type: 'load', |
| | | anfme: num, |
| | | matnr: this.chooseMat, |
| | | orderNo: this.code, |
| | | meter: this.meter |
| | | } |
| | | this.webServer(data) |
| | | setTimeout(()=>{ |
| | | this.$refs.inputPopup.close() |
| | | this.$refs.upPalletPopup.close() |
| | | this.chooseMat = '' |
| | | this.code = '' |
| | | this.meter = '' |
| | | this.chooseCacheSite = '' |
| | | },300) |
| | | }, |
| | | goDown(num) { |
| | | let data = {} |
| | | |
| | | if(this.groundSite == ''){ |
| | | uni.showToast({ |
| | | title: '请选择站点', |
| | | icon: "none", |
| | | position: 'top' |
| | | }) |
| | | return; |
| | | } |
| | | |
| | | data = { |
| | | originLocal: this.item.code, |
| | | targetLocal: this.groundSite, |
| | | type: 'unload', |
| | | anfme: num, |
| | | } |
| | | this.webServer(data) |
| | | setTimeout(()=>{ |
| | | this.$refs.downPalletPopup.close() |
| | | },300) |
| | | }, |
| | | // 所有服务 |
| | |
| | | uni.request({ |
| | | url: `${_this.baseUrl}/agv/requestTask`, |
| | | data: data, |
| | | header: { 'token': uni.getStorageSync('token') }, |
| | | header: { |
| | | 'token': uni.getStorageSync('token') |
| | | }, |
| | | method: 'POST', |
| | | success(res) { |
| | | res = res.data |
| | | if (res.code === 200) { |
| | | setTimeout(()=>{ |
| | | this.$refs.revise.close() |
| | | },300) |
| | | uni.showToast({ title: '操作成功', icon: "none", position: 'top' }) |
| | | uni.showToast({ |
| | | title: '操作成功', |
| | | icon: "none", |
| | | position: 'top' |
| | | }) |
| | | _this.$refs.revise.close() |
| | | } else { |
| | | uni.showToast({ title: res.msg, icon: "none", position: 'top' }) |
| | | uni.showToast({ |
| | | title: res.msg, |
| | | icon: "none", |
| | | position: 'top' |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | |
| | | <style> |
| | | .container { |
| | | height: 100%; |
| | | display: grid; |
| | | grid-template-columns: 50% 50%; |
| | | /* background-color: aqua; */ |
| | | /* display: grid; |
| | | grid-template-columns: 50% 50%; */ |
| | | width: 100%; |
| | | |
| | | } |
| | | |
| | | .btn-box { |
| | | /* margin: 1%; */ |
| | | background-color: azure; |
| | | } |
| | | |
| | | .zcard { |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | margin-top: 20px; |
| | | } |
| | | |
| | | .zcard-flex { |
| | | /* background-color: coral; */ |
| | | /* flex-direction: column; */ |
| | | margin-top: 20rpx; |
| | | width: 100%; |
| | | height: 100%; |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | /* flex-direction: column; */ |
| | | justify-content: space-around; |
| | | align-items: center; |
| | | margin-right: 20px; |
| | | margin-left: 20px; |
| | | } |
| | | |
| | | .button-nk { |
| | | margin: 10rpx 0rpx; |
| | | margin: 30rpx 50rpx; |
| | | /* padding: 20rpx 70rpx; */ |
| | | /* background-color: azure; */ |
| | | min-width: 350rpx; |
| | | min-width: 150rpx; |
| | | /* margin: 0 auto; */ |
| | | height: 50rpx; |
| | | text-align: center; |
| | |
| | | inset -4px -4px 4px rgba(255, 255, 255, .4), |
| | | -4px -4px 5px rgba(0, 0, 0, .4); |
| | | } |
| | | |
| | | .button-nk:active { |
| | | transform: translateY(2px) scale(0.99, 0.99); |
| | | box-shadow: inset 4px 4px 4px rgba(0, 0, 0, .3), |
| | | inset -4px -4px 8px rgba(255, 255, 255, .7), |
| | | -5px -5px 5px rgba(0, 0, 0, .3); |
| | | } |
| | | |
| | | .popup { |
| | | background-color: #eee; |
| | | width: 30vw; |
| | |
| | | flex-direction: column; |
| | | justify-content: space-around; |
| | | } |
| | | |
| | | .popup2 { |
| | | background-color: #eee; |
| | | width: 30vw; |
| | |
| | | justify-content: space-around; |
| | | border-radius: 10rpx; |
| | | } |
| | | .popup3-input-title { |
| | | text-align: center; |
| | | margin: 10rpx; |
| | | font-size: 18px; |
| | | font-weight: bold; |
| | | } |
| | | .select { |
| | | position: absolute; |
| | | bottom: 12px; |
| | | right: 16px; |
| | | border-radius: 10px; |
| | | padding: 4px 10px; |
| | | box-shadow: inset 2px 2px 2px rgba(0, 0, 0, .3), |
| | | inset -2px -2px 2px rgba(255, 255, 255, .7), |
| | | -2px -2px 2px rgba(0, 0, 0, .4); |
| | | } |
| | | |
| | | .popup3 { |
| | | background-color: #eee; |
| | | max-height: 80vw; |
| | |
| | | border-radius: 10rpx; |
| | | color: #565656; |
| | | } |
| | | |
| | | .popup3-input-title { |
| | | text-align: center; |
| | | margin: 10rpx; |
| | | font-size: 18px; |
| | | font-weight: bold; |
| | | } |
| | | .popup3-input-box { |
| | | |
| | | .popup3-input-box { |
| | | display: flex; |
| | | border: 1px solid #cecece; |
| | | border-radius: 5rpx; |
| | | padding: 2rpx 10rpx; |
| | | margin: 20rpx; |
| | | } |
| | | |
| | | .popup3-input-box2 { |
| | | display: flex; |
| | | border: 1px solid #cecece; |
| | |
| | | margin: 10rpx; |
| | | background-color: #FFF; |
| | | } |
| | | </style> |
| | | |
| | | .chosed { |
| | | background-color: #67C23A; |
| | | color: #e8e8e8; |
| | | } |
| | | |
| | | .select { |
| | | position: absolute; |
| | | bottom: 12px; |
| | | right: 16px; |
| | | border-radius: 10px; |
| | | padding: 4px 10px; |
| | | box-shadow: inset 2px 2px 2px rgba(0, 0, 0, .3), |
| | | inset -2px -2px 2px rgba(255, 255, 255, .7), |
| | | -2px -2px 2px rgba(0, 0, 0, .4); |
| | | } |
| | | </style> |
| | |
| | | <template> |
| | | <view class="container"> |
| | | <uni-icons type="bars" size="30" color="#b1b3b8" class="select" @click="jump()"></uni-icons> |
| | | <!-- 左 --> |
| | | |
| | | <view class="zcard"> |
| | | <view class="zcard-flex"> |
| | | <view class="button-nk" v-for="item in groundSiteList" @click="click(item,'left')">{{item.name}}</view> |
| | | </view> |
| | | </view> |
| | | <!-- 右 --> |
| | | |
| | | <view class="zcard"> |
| | | <view class="zcard-flex"> |
| | | <view class="button-nk" style="background-color: brown;" v-for="item in traySiteList" @click="click(item,'right')">{{item.name}}</view> |
| | | <view class="button-nk" style="background-color: brown;" v-for="item in cacheSiteList" |
| | | @click="click(item,'right')">{{item.name}}</view> |
| | | </view> |
| | | </view> |
| | | |
| | | |
| | | |
| | | <view> |
| | | <uni-popup ref="revise" type="dialog"> |
| | | <view class="popup"> |
| | | <view class="popup3-input-title">{{text}}</view> |
| | | <view class="button-nk" @click="upTray()">{{btnTitle1}}</view> |
| | | <view class="button-nk" @click="downTray()">{{btnTitle2}}</view> |
| | | <view v-show="outType" class="button-nk" @click="downTray1()">{{btnTitle3}}</view> |
| | | <view v-if="outType" class="popup"> |
| | | <view class="popup3-input-title">{{text}}</view> |
| | | <view class="button-nk" @click="upPallet()">盘头上架</view> |
| | | </view> |
| | | <view v-else class="popup"> |
| | | <view class="popup3-input-title">{{text}}</view> |
| | | <view class="button-nk" @click="downPallet()">盘头下架</view> |
| | | </view> |
| | | </uni-popup> |
| | | </view> |
| | | |
| | | |
| | | <view> |
| | | <uni-popup ref="numberPopup" type="dialog"> |
| | | <uni-popup ref="downPalletPopup" type="dialog"> |
| | | <view class="popup2"> |
| | | <view class="popup3-input-title">{{tipsTitle}}</view> |
| | | <view class="popup3-input-title">盘头下架</view> |
| | | <uni-data-select v-model="groundSite" :localdata="groundEmptySiteList"></uni-data-select> |
| | | <view class="button-nk" @click="goDown(2)">2个</view> |
| | | <view class="button-nk" @click="goDown(4)">4个</view> |
| | | </view> |
| | | </uni-popup> |
| | | </view> |
| | | |
| | | <view> |
| | | <uni-popup ref="upPalletPopup" type="dialog"> |
| | | <view class="popup2"> |
| | | <view class="popup3-input-title">盘头上架</view> |
| | | <view class="popup3-input-box"> |
| | | <uni-data-select v-model="chooseCacheSite" :localdata="chooseCacheSiteList" placeholder="请选择站点"></uni-data-select> |
| | | </view> |
| | | <view class="popup3-input-box"> |
| | | <uni-data-select v-model="chooseMat" :localdata="emptyMatList" placeholder="请选择物料"></uni-data-select> |
| | | </view> |
| | | <view class="popup3-input-box"> |
| | | <text>订单号:</text> |
| | | <view style="margin-left: 3rpx;"> |
| | | <input type="text" v-model="code" /> |
| | | </view> |
| | | </view> |
| | | <view class="popup3-input-box"> |
| | | <text>米数:</text> |
| | | <view style="margin-left: 3rpx;"> |
| | | <input type="text" v-model="meter" /> |
| | | </view> |
| | | </view> |
| | | <view class="button-nk" @click="goUp(2)">2个</view> |
| | | <view class="button-nk" @click="goUp(4)">4个</view> |
| | | </view> |
| | | </uni-popup> |
| | | </view> |
| | | |
| | | <view> |
| | | <uni-popup ref="inputPopup" type="dialog"> |
| | | <view class="popup3"> |
| | | <view class="popup3-input-title">{{tipsTitle}}</view> |
| | | <view class="popup3-input-box2" :class="item.chose" |
| | | v-if="!meterShow" v-for="item in emptyMatList" @click="chose(item.matnr)"> |
| | | <view> |
| | | {{item.maktx}} |
| | | </view> |
| | | </view> |
| | | <view class="popup3-input-box" v-if="meterShow"> |
| | | <text>{{desc}}:</text> |
| | | <view style="margin-left: 3rpx;"> |
| | | <input type="text" v-model="code"/> |
| | | </view> |
| | | </view> |
| | | <view class="popup3-input-box" v-if="meterShow"> |
| | | <text>米数:</text> |
| | | <view style="margin-left: 3rpx;"> |
| | | <input type="text" v-model="meter"/> |
| | | </view> |
| | | </view> |
| | | <view class="button-nk" @click="confirm(2)">确定</view> |
| | | </view> |
| | | </uni-popup> |
| | | </view> |
| | | |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | import code from '../../../uni_modules/uview-ui/libs/config/props/code'; |
| | | import code from '../../../uni_modules/uview-ui/libs/config/props/code'; |
| | | export default { |
| | | data() { |
| | | return { |
| | | baseUrl: '', |
| | | token: '', |
| | | groundSiteList: [ |
| | | {name: '1号地面站',code:'1-C1',traget: '1-A1',type: 'foolr'}, |
| | | {name: '2号地面站',code:'2-C1',traget: '2-A1',type: 'foolr'}, |
| | | {name: '3号地面站',code:'3-C1',traget: '3-A1',type: 'foolr'}, |
| | | {name: '4号地面站',code:'4-C1',traget: '4-A1',type: 'foolr'}, |
| | | {name: '5号地面站',code:'5-C1',traget: '5-A1',type: 'foolr'}, |
| | | {name: '6号地面站',code:'6-C1',traget: '6-A1',type: 'foolr'}, |
| | | {name: '7号地面站',code:'7-C1',traget: '7-A1',type: 'foolr'}, |
| | | {name: '8号地面站',code:'8-C1',traget: '8-A1',type: 'foolr'}, |
| | | {name: '9号地面站',code:'9-C1',traget: '9-A1',type: 'foolr'}, |
| | | {name: '10号地面站',code:'10-C1',traget: '10-A1',type: 'foolr'} |
| | | groundSiteList: [{ |
| | | name: 'A-C-K-1', |
| | | code: 'A-C-K-1', |
| | | type: 'ground-k' |
| | | }, |
| | | { |
| | | name: 'A-C-M-1', |
| | | code: 'A-C-M-1', |
| | | type: 'ground-m' |
| | | }, |
| | | { |
| | | name: 'A-C-K-2', |
| | | code: 'A-C-K-2', |
| | | type: 'ground-k' |
| | | }, |
| | | { |
| | | name: 'A-C-M-2', |
| | | code: 'A-C-M-2', |
| | | type: 'ground-m' |
| | | }, |
| | | { |
| | | name: 'A-C-K-3', |
| | | code: 'A-C-K-3', |
| | | type: 'ground-k' |
| | | }, |
| | | { |
| | | name: 'A-C-M-3', |
| | | code: 'A-C-M-3', |
| | | type: 'ground-m' |
| | | }, |
| | | ], |
| | | traySiteList: [ |
| | | {name: '1号托盘站',code:'KW-1',type: 'tray'}, |
| | | {name: '2号托盘站',code:'KW-2',type: 'tray'}, |
| | | {name: '3号托盘站',code:'KW-3',type: 'tray'}, |
| | | {name: '4号托盘站',code:'KW-4',type: 'tray'}, |
| | | {name: '5号托盘站',code:'KW-5',type: 'tray'}, |
| | | {name: '6号托盘站',code:'KW-6',type: 'tray'}, |
| | | {name: '7号托盘站',code:'KW-7',type: 'tray'}, |
| | | {name: '8号托盘站',code:'KW-8',type: 'tray'}, |
| | | {name: '9号托盘站',code:'KW-9',type: 'tray'}, |
| | | {name: '10号托盘站',code:'KW-10',type: 'tray'} |
| | | cacheSiteList: [{ |
| | | name: 'A-H-1', |
| | | code: 'A-H-1', |
| | | type: 'cache' |
| | | }, |
| | | { |
| | | name: 'A-H-2', |
| | | code: 'A-H-2', |
| | | type: 'cache' |
| | | }, |
| | | { |
| | | name: 'A-H-3', |
| | | code: 'A-H-3', |
| | | type: 'cache' |
| | | }, |
| | | { |
| | | name: 'A-H-4', |
| | | code: 'A-H-4', |
| | | type: 'cache' |
| | | }, |
| | | { |
| | | name: 'A-H-5', |
| | | code: 'A-H-5', |
| | | type: 'cache' |
| | | }, |
| | | { |
| | | name: 'A-H-6', |
| | | code: 'A-H-6', |
| | | type: 'cache' |
| | | }, |
| | | { |
| | | name: 'A-H-7', |
| | | code: 'A-H-7', |
| | | type: 'cache' |
| | | }, |
| | | { |
| | | name: 'A-H-8', |
| | | code: 'A-H-8', |
| | | type: 'cache' |
| | | }, |
| | | { |
| | | name: 'A-H-9', |
| | | code: 'A-H-9', |
| | | type: 'cache' |
| | | }, |
| | | { |
| | | name: 'A-H-10', |
| | | code: 'A-H-10', |
| | | type: 'cache' |
| | | }, |
| | | { |
| | | name: 'A-H-11', |
| | | code: 'A-H-11', |
| | | type: 'cache' |
| | | }, |
| | | { |
| | | name: 'A-H-12', |
| | | code: 'A-H-12', |
| | | type: 'cache' |
| | | }, |
| | | { |
| | | name: 'A-H-13', |
| | | code: 'A-H-13', |
| | | type: 'cache' |
| | | }, |
| | | { |
| | | name: 'A-H-14', |
| | | code: 'A-H-14', |
| | | type: 'cache' |
| | | }, |
| | | { |
| | | name: 'A-H-15', |
| | | code: 'A-H-15', |
| | | type: 'cache' |
| | | }, |
| | | { |
| | | name: 'A-H-16', |
| | | code: 'A-H-16', |
| | | type: 'cache' |
| | | }, |
| | | { |
| | | name: 'A-H-17', |
| | | code: 'A-H-17', |
| | | type: 'cache' |
| | | }, |
| | | ], |
| | | emptyMatList: [], |
| | | chooseMat: '', |
| | | groundSite: '', |
| | | groundEmptySiteList: [], |
| | | chooseCacheSite: '', |
| | | chooseCacheSiteList: [], |
| | | item: '', |
| | | text: '', |
| | | btnTitle1: '', |
| | |
| | | btnTitle3: '', |
| | | outType: '', |
| | | stationType: 'load', |
| | | type: '' , |
| | | type: '', |
| | | originLocal: '', |
| | | targetLocal: '', |
| | | code: '', |
| | |
| | | }, |
| | | onShow() { |
| | | let network = uni.getStorageSync('Network') |
| | | this.baseUrl = `http://${network[0].ip}:${network[0].port}/${network[0].address}` |
| | | this.baseUrl = `http://${network[0].ip}:${network[0].port}/${network[0].address}` |
| | | this.token = uni.getStorageSync('token'); |
| | | |
| | | this.getEmptyMatList() |
| | | }, |
| | | methods: { |
| | | jump() { |
| | |
| | | url: '/pages/project/jmAGV/floorOne' |
| | | }) |
| | | }, |
| | | click(item,type) { |
| | | click(item, type) { |
| | | this.item = item |
| | | this.text = item.name |
| | | if (type == 'left') { |
| | | this.outType = false |
| | | this.btnTitle1 = '地面站放置托盘(上架)' |
| | | this.btnTitle2 = '托盘站取置地面(下架)' |
| | | } else { |
| | | this.outType = true |
| | | this.btnTitle1 = '托盘-仓库(入库)' |
| | | this.btnTitle2 = '仓库-空托盘(出库)' |
| | | this.btnTitle3 = '仓库-满托盘(出库)' |
| | | } else { |
| | | this.outType = false |
| | | } |
| | | this.$refs.revise.open(type) |
| | | }, |
| | | chose(matnr) { |
| | | for (let k of this.emptyMatList) { |
| | | if (k.matnr == matnr) { |
| | | k.chose = 'chosed' |
| | | } else { |
| | | k.chose = '' |
| | | } |
| | | this.$forceUpdate() // 强制刷新 |
| | | } |
| | | this.code = matnr |
| | | }, |
| | | // 地面站上架 / 托盘站入库按钮 |
| | | upTray() { |
| | | if (this.item.type == 'foolr') { |
| | | this.type = 'load', // 上架 |
| | | this.originLocal = this.item.code, |
| | | this.targetLocal = this.item.traget |
| | | this.tipsTitle = '上架数量' |
| | | this.numberPopup() |
| | | } else { |
| | | this.type = 'in' // 入库 |
| | | this.originLocal = this.item.code, |
| | | this.targetLocal = 'KW-J' |
| | | this.pakin() |
| | | } |
| | | }, |
| | | downTray() { |
| | | if (this.item.type == 'foolr') { |
| | | this.type = 'unload', // 下架 |
| | | this.originLocal = this.item.traget, |
| | | this.targetLocal = this.item.code |
| | | this.tipsTitle = '下架数量' |
| | | this.numberPopup() |
| | | } else { |
| | | this.type = 'out1' // 出库 |
| | | this.originLocal = 'KW-C' |
| | | this.targetLocal = this.item.code |
| | | this.inputPopup() |
| | | } |
| | | }, |
| | | downTray1() { |
| | | if (this.item.type == 'foolr') { |
| | | this.type = 'unload', // 下架 |
| | | this.originLocal = this.item.traget, |
| | | this.targetLocal = this.item.code |
| | | } else { |
| | | this.type = 'out2' // 出库 |
| | | this.originLocal = 'KW-C' |
| | | this.targetLocal = this.item.code |
| | | this.inputPopup() |
| | | } |
| | | }, |
| | | numberPopup() { |
| | | this.$refs.numberPopup.open('center') |
| | | }, |
| | | inputPopup() { |
| | | if (this.type == 'out1') { |
| | | this.tipsTitle = '空托盘出库' |
| | | this.desc = '物料码' |
| | | this.meterShow = false |
| | | let that = this |
| | | uni.request({ |
| | | url: `${that.baseUrl}/agv/getEmptyMat`, |
| | | header: { 'token': uni.getStorageSync('token') }, |
| | | method: 'GET', |
| | | success(res) { |
| | | res = res.data |
| | | if (res.code === 200) { |
| | | res.data['chose'] = '' |
| | | that.emptyMatList = res.data |
| | | |
| | | } |
| | | getEmptyMatList() { |
| | | let that = this |
| | | uni.request({ |
| | | url: `${that.baseUrl}/agv/getEmptyMat`, |
| | | header: { 'token': uni.getStorageSync('token') }, |
| | | method: 'GET', |
| | | success(res) { |
| | | res = res.data |
| | | if (res.code === 200) { |
| | | let tmp = [] |
| | | res.data.forEach((item) => { |
| | | tmp.push({ |
| | | text: item.maktx, |
| | | value: item.matnr |
| | | }) |
| | | }) |
| | | that.emptyMatList = tmp |
| | | } |
| | | }) |
| | | } else { |
| | | this.tipsTitle = '满托盘出库' |
| | | this.desc = '订单号' |
| | | this.meterShow = true |
| | | this.$refs.inputPopup.open('center') |
| | | } |
| | | this.$refs.inputPopup.open('center') |
| | | } |
| | | }) |
| | | }, |
| | | // 上 / 下 架数量 |
| | | upPallet() { |
| | | let tmp = []; |
| | | this.cacheSiteList.forEach((item) => { |
| | | tmp.push({ |
| | | text: item.name, |
| | | value: item.code |
| | | }) |
| | | }) |
| | | |
| | | this.chooseCacheSiteList = tmp; |
| | | this.upPalletPopup() |
| | | }, |
| | | downPallet() { |
| | | let tmp = []; |
| | | this.groundSiteList.forEach((item) => { |
| | | if (item.type == 'ground-k') { |
| | | tmp.push({ |
| | | text: item.name, |
| | | value: item.code |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | this.groundEmptySiteList = tmp; |
| | | this.downPalletPopup() |
| | | }, |
| | | upPalletPopup() { |
| | | this.$refs.upPalletPopup.open('center') |
| | | }, |
| | | downPalletPopup() { |
| | | this.$refs.downPalletPopup.open('center') |
| | | }, |
| | | goUp(num) { |
| | | let data = {} |
| | | |
| | | if(this.chooseCacheSite == ''){ |
| | | uni.showToast({ |
| | | title: '请选择站点', |
| | | icon: "none", |
| | | position: 'top' |
| | | }) |
| | | return; |
| | | } |
| | | |
| | | if(this.chooseMat == ''){ |
| | | uni.showToast({ |
| | | title: '请选择物料', |
| | | icon: "none", |
| | | position: 'top' |
| | | }) |
| | | return; |
| | | } |
| | | |
| | | if(this.code == ''){ |
| | | uni.showToast({ |
| | | title: '请输入订单号', |
| | | icon: "none", |
| | | position: 'top' |
| | | }) |
| | | return; |
| | | } |
| | | |
| | | if(this.meter == ''){ |
| | | uni.showToast({ |
| | | title: '请输入米数', |
| | | icon: "none", |
| | | position: 'top' |
| | | }) |
| | | return; |
| | | } |
| | | |
| | | data = { |
| | | originLocal: this.originLocal, |
| | | targetLocal: this.targetLocal, |
| | | type: this.type, |
| | | originLocal: this.item.code, |
| | | targetLocal: this.chooseCacheSite, |
| | | type: 'load', |
| | | anfme: num, |
| | | matnr: this.chooseMat, |
| | | orderNo: this.code, |
| | | meter: this.meter |
| | | } |
| | | this.webServer(data) |
| | | setTimeout(()=>{ |
| | | this.$refs.upPalletPopup.close() |
| | | this.chooseMat = '' |
| | | this.code = '' |
| | | this.meter = '' |
| | | this.chooseCacheSite = '' |
| | | },300) |
| | | }, |
| | | goDown(num) { |
| | | let data = {} |
| | | |
| | | if(this.groundSite == ''){ |
| | | uni.showToast({ |
| | | title: '请选择站点', |
| | | icon: "none", |
| | | position: 'top' |
| | | }) |
| | | return; |
| | | } |
| | | |
| | | data = { |
| | | originLocal: this.item.code, |
| | | targetLocal: this.groundSite, |
| | | type: 'unload', |
| | | anfme: num, |
| | | } |
| | | this.webServer(data) |
| | | setTimeout(()=>{ |
| | | this.$refs.numberPopup.close() |
| | | },300) |
| | | }, |
| | | pakin() { |
| | | let data = {} |
| | | data = { |
| | | originLocal: this.originLocal, |
| | | targetLocal: this.targetLocal, |
| | | type: this.type, |
| | | } |
| | | this.webServer(data) |
| | | setTimeout(()=>{ |
| | | this.$refs.numberPopup.close() |
| | | },300) |
| | | }, |
| | | confirm() { |
| | | let data = {} |
| | | if (this.type == 'out1') { |
| | | data = { |
| | | originLocal: this.originLocal, |
| | | targetLocal: this.targetLocal, |
| | | type: this.type, |
| | | matnr: this.code, |
| | | anfme: 4 |
| | | } |
| | | } else { |
| | | data = { |
| | | originLocal: this.originLocal, |
| | | targetLocal: this.targetLocal, |
| | | type: this.type, |
| | | orderNo: this.code, |
| | | meter: this.meter |
| | | } |
| | | } |
| | | this.webServer(data) |
| | | setTimeout(()=>{ |
| | | this.$refs.inputPopup.close() |
| | | this.code = '' |
| | | this.meter = '' |
| | | this.$refs.downPalletPopup.close() |
| | | },300) |
| | | }, |
| | | // 所有服务 |
| | |
| | | uni.request({ |
| | | url: `${_this.baseUrl}/agv/requestTask`, |
| | | data: data, |
| | | header: { 'token': uni.getStorageSync('token') }, |
| | | header: { |
| | | 'token': uni.getStorageSync('token') |
| | | }, |
| | | method: 'POST', |
| | | success(res) { |
| | | res = res.data |
| | | if (res.code === 200) { |
| | | uni.showToast({ |
| | | title: '操作成功', |
| | | icon: "none", |
| | | position: 'top' |
| | | }) |
| | | this.$refs.revise.close() |
| | | uni.showToast({ title: '操作成功', icon: "none", position: 'top' }) |
| | | } else { |
| | | uni.showToast({ title: res.msg, icon: "none", position: 'top' }) |
| | | uni.showToast({ |
| | | title: res.msg, |
| | | icon: "none", |
| | | position: 'top' |
| | | }) |
| | | } |
| | | |
| | | } |
| | | }) |
| | | } |
| | |
| | | .container { |
| | | height: 100%; |
| | | /* background-color: aqua; */ |
| | | display: grid; |
| | | grid-template-columns: 50% 50%; |
| | | /* display: grid; |
| | | grid-template-columns: 50% 50%; */ |
| | | width: 100%; |
| | | |
| | | } |
| | | |
| | | .btn-box { |
| | | /* margin: 1%; */ |
| | | background-color: azure; |
| | | } |
| | | /* .zcard { |
| | | margin: 10px 100px; |
| | | background-color: #409EFF; |
| | | } */ |
| | | |
| | | .zcard { |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | margin-top: 20px; |
| | | } |
| | | |
| | | .zcard-flex { |
| | | /* background-color: coral; */ |
| | | /* flex-direction: column; */ |
| | | margin-top: 20rpx; |
| | | width: 100%; |
| | | height: 100%; |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | /* flex-direction: column; */ |
| | | justify-content: space-around; |
| | | align-items: center; |
| | | margin-right: 20px; |
| | | margin-left: 20px; |
| | | } |
| | | |
| | | .button-nk { |
| | | margin: 10rpx 0rpx; |
| | | margin: 30rpx 50rpx; |
| | | /* padding: 20rpx 70rpx; */ |
| | | /* background-color: azure; */ |
| | | min-width: 100rpx; |
| | | min-width: 150rpx; |
| | | /* margin: 0 auto; */ |
| | | height: 50rpx; |
| | | text-align: center; |
| | |
| | | inset -4px -4px 4px rgba(255, 255, 255, .4), |
| | | -4px -4px 5px rgba(0, 0, 0, .4); |
| | | } |
| | | |
| | | .button-nk:active { |
| | | transform: translateY(2px) scale(0.99, 0.99); |
| | | box-shadow: inset 4px 4px 4px rgba(0, 0, 0, .3), |
| | | inset -4px -4px 8px rgba(255, 255, 255, .7), |
| | | -5px -5px 5px rgba(0, 0, 0, .3); |
| | | } |
| | | |
| | | .popup { |
| | | background-color: #eee; |
| | | width: 30vw; |
| | |
| | | flex-direction: column; |
| | | justify-content: space-around; |
| | | } |
| | | |
| | | .popup2 { |
| | | background-color: #eee; |
| | | width: 30vw; |
| | |
| | | justify-content: space-around; |
| | | border-radius: 10rpx; |
| | | } |
| | | |
| | | .popup3 { |
| | | background-color: #eee; |
| | | max-height: 80vw; |
| | |
| | | border-radius: 10rpx; |
| | | color: #565656; |
| | | } |
| | | |
| | | .popup3-input-title { |
| | | text-align: center; |
| | | margin: 10rpx; |
| | | font-size: 18px; |
| | | font-weight: bold; |
| | | } |
| | | .popup3-input-box { |
| | | |
| | | .popup3-input-box { |
| | | display: flex; |
| | | border: 1px solid #cecece; |
| | | border-radius: 5rpx; |
| | | padding: 2rpx 10rpx; |
| | | margin: 20rpx; |
| | | } |
| | | |
| | | .popup3-input-box2 { |
| | | display: flex; |
| | | border: 1px solid #cecece; |
| | |
| | | margin: 10rpx; |
| | | background-color: #FFF; |
| | | } |
| | | |
| | | .chosed { |
| | | background-color: #67C23A; |
| | | color: #e8e8e8; |
| | | } |
| | | |
| | | .select { |
| | | position: absolute; |
| | | bottom: 12px; |
| | |
| | | inset -2px -2px 2px rgba(255, 255, 255, .7), |
| | | -2px -2px 2px rgba(0, 0, 0, .4); |
| | | } |
| | | </style> |
| | | </style> |
New file |
| | |
| | | ## 1.0.8(2024-03-28) |
| | | - 修复 在vue2下:style动态绑定导致编译失败的bug |
| | | ## 1.0.7(2024-01-20) |
| | | - 修复 长文本回显超过容器的bug,超过容器部分显示省略号 |
| | | ## 1.0.6(2023-04-12) |
| | | - 修复 微信小程序点击时会改变背景颜色的 bug |
| | | ## 1.0.5(2023-02-03) |
| | | - 修复 禁用时会显示清空按钮 |
| | | ## 1.0.4(2023-02-02) |
| | | - 优化 查询条件短期内多次变更只查询最后一次变更后的结果 |
| | | - 调整 内部缓存键名调整为 uni-data-select-lastSelectedValue |
| | | ## 1.0.3(2023-01-16) |
| | | - 修复 不关联服务空间报错的问题 |
| | | ## 1.0.2(2023-01-14) |
| | | - 新增 属性 `format` 可用于格式化显示选项内容 |
| | | ## 1.0.1(2022-12-06) |
| | | - 修复 当where变化时,数据不会自动更新的问题 |
| | | ## 0.1.9(2022-09-05) |
| | | - 修复 微信小程序下拉框出现后选择会点击到蒙板后面的输入框 |
| | | ## 0.1.8(2022-08-29) |
| | | - 修复 点击的位置不准确 |
| | | ## 0.1.7(2022-08-12) |
| | | - 新增 支持 disabled 属性 |
| | | ## 0.1.6(2022-07-06) |
| | | - 修复 pc端宽度异常的bug |
| | | ## 0.1.5 |
| | | - 修复 pc端宽度异常的bug |
| | | ## 0.1.4(2022-07-05) |
| | | - 优化 显示样式 |
| | | ## 0.1.3(2022-06-02) |
| | | - 修复 localdata 赋值不生效的 bug |
| | | - 新增 支持 uni.scss 修改颜色 |
| | | - 新增 支持选项禁用(数据选项设置 disabled: true 即禁用) |
| | | ## 0.1.2(2022-05-08) |
| | | - 修复 当 value 为 0 时选择不生效的 bug |
| | | ## 0.1.1(2022-05-07) |
| | | - 新增 记住上次的选项(仅 collection 存在时有效) |
| | | ## 0.1.0(2022-04-22) |
| | | - 初始化 |
New file |
| | |
| | | <template> |
| | | <view class="uni-stat__select"> |
| | | <span v-if="label" class="uni-label-text hide-on-phone">{{label + ':'}}</span> |
| | | <view class="uni-stat-box" :class="{'uni-stat__actived': current}"> |
| | | <view class="uni-select" :class="{'uni-select--disabled':disabled}"> |
| | | <view class="uni-select__input-box" @click="toggleSelector"> |
| | | <view v-if="current" class="uni-select__input-text">{{textShow}}</view> |
| | | <view v-else class="uni-select__input-text uni-select__input-placeholder">{{typePlaceholder}}</view> |
| | | <view v-if="current && clear && !disabled" @click.stop="clearVal"> |
| | | <uni-icons type="clear" color="#c0c4cc" size="24" /> |
| | | </view> |
| | | <view v-else> |
| | | <uni-icons :type="showSelector? 'top' : 'bottom'" size="14" color="#999" /> |
| | | </view> |
| | | </view> |
| | | <view class="uni-select--mask" v-if="showSelector" @click="toggleSelector" /> |
| | | <view class="uni-select__selector" :style="getOffsetByPlacement" v-if="showSelector"> |
| | | <view :class="placement=='bottom'?'uni-popper__arrow_bottom':'uni-popper__arrow_top'"></view> |
| | | <scroll-view scroll-y="true" class="uni-select__selector-scroll"> |
| | | <view class="uni-select__selector-empty" v-if="mixinDatacomResData.length === 0"> |
| | | <text>{{emptyTips}}</text> |
| | | </view> |
| | | <view v-else class="uni-select__selector-item" v-for="(item,index) in mixinDatacomResData" :key="index" |
| | | @click="change(item)"> |
| | | <text :class="{'uni-select__selector__disabled': item.disable}">{{formatItemName(item)}}</text> |
| | | </view> |
| | | </scroll-view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | /** |
| | | * DataChecklist 数据选择器 |
| | | * @description 通过数据渲染的下拉框组件 |
| | | * @tutorial https://uniapp.dcloud.io/component/uniui/uni-data-select |
| | | * @property {String} value 默认值 |
| | | * @property {Array} localdata 本地数据 ,格式 [{text:'',value:''}] |
| | | * @property {Boolean} clear 是否可以清空已选项 |
| | | * @property {Boolean} emptyText 没有数据时显示的文字 ,本地数据无效 |
| | | * @property {String} label 左侧标题 |
| | | * @property {String} placeholder 输入框的提示文字 |
| | | * @property {Boolean} disabled 是否禁用 |
| | | * @property {String} placement 弹出位置 |
| | | * @value top 顶部弹出 |
| | | * @value bottom 底部弹出(default) |
| | | * @event {Function} change 选中发生变化触发 |
| | | */ |
| | | |
| | | export default { |
| | | name: "uni-data-select", |
| | | mixins: [uniCloud.mixinDatacom || {}], |
| | | props: { |
| | | localdata: { |
| | | type: Array, |
| | | default () { |
| | | return [] |
| | | } |
| | | }, |
| | | value: { |
| | | type: [String, Number], |
| | | default: '' |
| | | }, |
| | | modelValue: { |
| | | type: [String, Number], |
| | | default: '' |
| | | }, |
| | | label: { |
| | | type: String, |
| | | default: '' |
| | | }, |
| | | placeholder: { |
| | | type: String, |
| | | default: '请选择' |
| | | }, |
| | | emptyTips: { |
| | | type: String, |
| | | default: '无选项' |
| | | }, |
| | | clear: { |
| | | type: Boolean, |
| | | default: true |
| | | }, |
| | | defItem: { |
| | | type: Number, |
| | | default: 0 |
| | | }, |
| | | disabled: { |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | // 格式化输出 用法 field="_id as value, version as text, uni_platform as label" format="{label} - {text}" |
| | | format: { |
| | | type: String, |
| | | default: '' |
| | | }, |
| | | placement: { |
| | | type: String, |
| | | default: 'bottom' |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | showSelector: false, |
| | | current: '', |
| | | mixinDatacomResData: [], |
| | | apps: [], |
| | | channels: [], |
| | | cacheKey: "uni-data-select-lastSelectedValue", |
| | | }; |
| | | }, |
| | | created() { |
| | | this.debounceGet = this.debounce(() => { |
| | | this.query(); |
| | | }, 300); |
| | | if (this.collection && !this.localdata.length) { |
| | | this.debounceGet(); |
| | | } |
| | | }, |
| | | computed: { |
| | | typePlaceholder() { |
| | | const text = { |
| | | 'opendb-stat-app-versions': '版本', |
| | | 'opendb-app-channels': '渠道', |
| | | 'opendb-app-list': '应用' |
| | | } |
| | | const common = this.placeholder |
| | | const placeholder = text[this.collection] |
| | | return placeholder ? |
| | | common + placeholder : |
| | | common |
| | | }, |
| | | valueCom() { |
| | | // #ifdef VUE3 |
| | | return this.modelValue; |
| | | // #endif |
| | | // #ifndef VUE3 |
| | | return this.value; |
| | | // #endif |
| | | }, |
| | | textShow() { |
| | | // 长文本显示 |
| | | let text = this.current; |
| | | if (text.length > 10) { |
| | | return text.slice(0, 25) + '...'; |
| | | } |
| | | return text; |
| | | }, |
| | | getOffsetByPlacement() { |
| | | switch (this.placement) { |
| | | case 'top': |
| | | return "bottom:calc(100% + 12px);"; |
| | | case 'bottom': |
| | | return "top:calc(100% + 12px);"; |
| | | } |
| | | } |
| | | }, |
| | | |
| | | watch: { |
| | | localdata: { |
| | | immediate: true, |
| | | handler(val, old) { |
| | | if (Array.isArray(val) && old !== val) { |
| | | this.mixinDatacomResData = val |
| | | } |
| | | } |
| | | }, |
| | | valueCom(val, old) { |
| | | this.initDefVal() |
| | | }, |
| | | mixinDatacomResData: { |
| | | immediate: true, |
| | | handler(val) { |
| | | if (val.length) { |
| | | this.initDefVal() |
| | | } |
| | | } |
| | | }, |
| | | |
| | | }, |
| | | methods: { |
| | | debounce(fn, time = 100) { |
| | | let timer = null |
| | | return function(...args) { |
| | | if (timer) clearTimeout(timer) |
| | | timer = setTimeout(() => { |
| | | fn.apply(this, args) |
| | | }, time) |
| | | } |
| | | }, |
| | | // 执行数据库查询 |
| | | query() { |
| | | this.mixinDatacomEasyGet(); |
| | | }, |
| | | // 监听查询条件变更事件 |
| | | onMixinDatacomPropsChange() { |
| | | if (this.collection) { |
| | | this.debounceGet(); |
| | | } |
| | | }, |
| | | initDefVal() { |
| | | let defValue = '' |
| | | if ((this.valueCom || this.valueCom === 0) && !this.isDisabled(this.valueCom)) { |
| | | defValue = this.valueCom |
| | | } else { |
| | | let strogeValue |
| | | if (this.collection) { |
| | | strogeValue = this.getCache() |
| | | } |
| | | if (strogeValue || strogeValue === 0) { |
| | | defValue = strogeValue |
| | | } else { |
| | | let defItem = '' |
| | | if (this.defItem > 0 && this.defItem <= this.mixinDatacomResData.length) { |
| | | defItem = this.mixinDatacomResData[this.defItem - 1].value |
| | | } |
| | | defValue = defItem |
| | | } |
| | | if (defValue || defValue === 0) { |
| | | this.emit(defValue) |
| | | } |
| | | } |
| | | const def = this.mixinDatacomResData.find(item => item.value === defValue) |
| | | this.current = def ? this.formatItemName(def) : '' |
| | | }, |
| | | |
| | | /** |
| | | * @param {[String, Number]} value |
| | | * 判断用户给的 value 是否同时为禁用状态 |
| | | */ |
| | | isDisabled(value) { |
| | | let isDisabled = false; |
| | | |
| | | this.mixinDatacomResData.forEach(item => { |
| | | if (item.value === value) { |
| | | isDisabled = item.disable |
| | | } |
| | | }) |
| | | |
| | | return isDisabled; |
| | | }, |
| | | |
| | | clearVal() { |
| | | this.emit('') |
| | | if (this.collection) { |
| | | this.removeCache() |
| | | } |
| | | }, |
| | | change(item) { |
| | | if (!item.disable) { |
| | | this.showSelector = false |
| | | this.current = this.formatItemName(item) |
| | | this.emit(item.value) |
| | | } |
| | | }, |
| | | emit(val) { |
| | | this.$emit('input', val) |
| | | this.$emit('update:modelValue', val) |
| | | this.$emit('change', val) |
| | | if (this.collection) { |
| | | this.setCache(val); |
| | | } |
| | | }, |
| | | toggleSelector() { |
| | | if (this.disabled) { |
| | | return |
| | | } |
| | | |
| | | this.showSelector = !this.showSelector |
| | | }, |
| | | formatItemName(item) { |
| | | let { |
| | | text, |
| | | value, |
| | | channel_code |
| | | } = item |
| | | channel_code = channel_code ? `(${channel_code})` : '' |
| | | |
| | | if (this.format) { |
| | | // 格式化输出 |
| | | let str = ""; |
| | | str = this.format; |
| | | for (let key in item) { |
| | | str = str.replace(new RegExp(`{${key}}`, "g"), item[key]); |
| | | } |
| | | return str; |
| | | } else { |
| | | return this.collection.indexOf('app-list') > 0 ? |
| | | `${text}(${value})` : |
| | | ( |
| | | text ? |
| | | text : |
| | | `未命名${channel_code}` |
| | | ) |
| | | } |
| | | }, |
| | | // 获取当前加载的数据 |
| | | getLoadData() { |
| | | return this.mixinDatacomResData; |
| | | }, |
| | | // 获取当前缓存key |
| | | getCurrentCacheKey() { |
| | | return this.collection; |
| | | }, |
| | | // 获取缓存 |
| | | getCache(name = this.getCurrentCacheKey()) { |
| | | let cacheData = uni.getStorageSync(this.cacheKey) || {}; |
| | | return cacheData[name]; |
| | | }, |
| | | // 设置缓存 |
| | | setCache(value, name = this.getCurrentCacheKey()) { |
| | | let cacheData = uni.getStorageSync(this.cacheKey) || {}; |
| | | cacheData[name] = value; |
| | | uni.setStorageSync(this.cacheKey, cacheData); |
| | | }, |
| | | // 删除缓存 |
| | | removeCache(name = this.getCurrentCacheKey()) { |
| | | let cacheData = uni.getStorageSync(this.cacheKey) || {}; |
| | | delete cacheData[name]; |
| | | uni.setStorageSync(this.cacheKey, cacheData); |
| | | }, |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss"> |
| | | $uni-base-color: #6a6a6a !default; |
| | | $uni-main-color: #333 !default; |
| | | $uni-secondary-color: #909399 !default; |
| | | $uni-border-3: #e5e5e5; |
| | | |
| | | /* #ifndef APP-NVUE */ |
| | | @media screen and (max-width: 500px) { |
| | | .hide-on-phone { |
| | | display: none; |
| | | } |
| | | } |
| | | |
| | | /* #endif */ |
| | | .uni-stat__select { |
| | | display: flex; |
| | | align-items: center; |
| | | // padding: 15px; |
| | | /* #ifdef H5 */ |
| | | cursor: pointer; |
| | | /* #endif */ |
| | | width: 100%; |
| | | flex: 1; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .uni-stat-box { |
| | | width: 100%; |
| | | flex: 1; |
| | | } |
| | | |
| | | .uni-stat__actived { |
| | | width: 100%; |
| | | flex: 1; |
| | | // outline: 1px solid #2979ff; |
| | | } |
| | | |
| | | .uni-label-text { |
| | | font-size: 14px; |
| | | font-weight: bold; |
| | | color: $uni-base-color; |
| | | margin: auto 0; |
| | | margin-right: 5px; |
| | | } |
| | | |
| | | .uni-select { |
| | | font-size: 14px; |
| | | border: 1px solid $uni-border-3; |
| | | box-sizing: border-box; |
| | | border-radius: 4px; |
| | | padding: 0 5px; |
| | | padding-left: 10px; |
| | | position: relative; |
| | | /* #ifndef APP-NVUE */ |
| | | display: flex; |
| | | user-select: none; |
| | | /* #endif */ |
| | | flex-direction: row; |
| | | align-items: center; |
| | | border-bottom: solid 1px $uni-border-3; |
| | | width: 100%; |
| | | flex: 1; |
| | | height: 35px; |
| | | |
| | | &--disabled { |
| | | background-color: #f5f7fa; |
| | | cursor: not-allowed; |
| | | } |
| | | } |
| | | |
| | | .uni-select__label { |
| | | font-size: 16px; |
| | | // line-height: 22px; |
| | | height: 35px; |
| | | padding-right: 10px; |
| | | color: $uni-secondary-color; |
| | | } |
| | | |
| | | .uni-select__input-box { |
| | | height: 35px; |
| | | position: relative; |
| | | /* #ifndef APP-NVUE */ |
| | | display: flex; |
| | | /* #endif */ |
| | | flex: 1; |
| | | flex-direction: row; |
| | | align-items: center; |
| | | } |
| | | |
| | | .uni-select__input { |
| | | flex: 1; |
| | | font-size: 14px; |
| | | height: 22px; |
| | | line-height: 22px; |
| | | } |
| | | |
| | | .uni-select__input-plac { |
| | | font-size: 14px; |
| | | color: $uni-secondary-color; |
| | | } |
| | | |
| | | .uni-select__selector { |
| | | /* #ifndef APP-NVUE */ |
| | | box-sizing: border-box; |
| | | /* #endif */ |
| | | position: absolute; |
| | | left: 0; |
| | | width: 100%; |
| | | background-color: #FFFFFF; |
| | | border: 1px solid #EBEEF5; |
| | | border-radius: 6px; |
| | | box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); |
| | | z-index: 3; |
| | | padding: 4px 0; |
| | | } |
| | | |
| | | .uni-select__selector-scroll { |
| | | /* #ifndef APP-NVUE */ |
| | | max-height: 200px; |
| | | box-sizing: border-box; |
| | | /* #endif */ |
| | | } |
| | | |
| | | /* #ifdef H5 */ |
| | | @media (min-width: 768px) { |
| | | .uni-select__selector-scroll { |
| | | max-height: 600px; |
| | | } |
| | | } |
| | | |
| | | /* #endif */ |
| | | |
| | | .uni-select__selector-empty, |
| | | .uni-select__selector-item { |
| | | /* #ifndef APP-NVUE */ |
| | | display: flex; |
| | | cursor: pointer; |
| | | /* #endif */ |
| | | line-height: 35px; |
| | | font-size: 14px; |
| | | text-align: center; |
| | | /* border-bottom: solid 1px $uni-border-3; */ |
| | | padding: 0px 10px; |
| | | } |
| | | |
| | | .uni-select__selector-item:hover { |
| | | background-color: #f9f9f9; |
| | | } |
| | | |
| | | .uni-select__selector-empty:last-child, |
| | | .uni-select__selector-item:last-child { |
| | | /* #ifndef APP-NVUE */ |
| | | border-bottom: none; |
| | | /* #endif */ |
| | | } |
| | | |
| | | .uni-select__selector__disabled { |
| | | opacity: 0.4; |
| | | cursor: default; |
| | | } |
| | | |
| | | /* picker 弹出层通用的指示小三角 */ |
| | | .uni-popper__arrow_bottom, |
| | | .uni-popper__arrow_bottom::after, |
| | | .uni-popper__arrow_top, |
| | | .uni-popper__arrow_top::after, |
| | | { |
| | | position: absolute; |
| | | display: block; |
| | | width: 0; |
| | | height: 0; |
| | | border-color: transparent; |
| | | border-style: solid; |
| | | border-width: 6px; |
| | | } |
| | | |
| | | .uni-popper__arrow_bottom { |
| | | filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03)); |
| | | top: -6px; |
| | | left: 10%; |
| | | margin-right: 3px; |
| | | border-top-width: 0; |
| | | border-bottom-color: #EBEEF5; |
| | | } |
| | | |
| | | .uni-popper__arrow_bottom::after { |
| | | content: " "; |
| | | top: 1px; |
| | | margin-left: -6px; |
| | | border-top-width: 0; |
| | | border-bottom-color: #fff; |
| | | } |
| | | |
| | | .uni-popper__arrow_top { |
| | | filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03)); |
| | | bottom: -6px; |
| | | left: 10%; |
| | | margin-right: 3px; |
| | | border-bottom-width: 0; |
| | | border-top-color: #EBEEF5; |
| | | } |
| | | |
| | | .uni-popper__arrow_top::after { |
| | | content: " "; |
| | | bottom: 1px; |
| | | margin-left: -6px; |
| | | border-bottom-width: 0; |
| | | border-top-color: #fff; |
| | | } |
| | | |
| | | |
| | | .uni-select__input-text { |
| | | // width: 280px; |
| | | width: 100%; |
| | | color: $uni-main-color; |
| | | white-space: nowrap; |
| | | text-overflow: ellipsis; |
| | | -o-text-overflow: ellipsis; |
| | | overflow: hidden; |
| | | } |
| | | |
| | | .uni-select__input-placeholder { |
| | | color: $uni-base-color; |
| | | font-size: 12px; |
| | | } |
| | | |
| | | .uni-select--mask { |
| | | position: fixed; |
| | | top: 0; |
| | | bottom: 0; |
| | | right: 0; |
| | | left: 0; |
| | | z-index: 2; |
| | | } |
| | | </style> |
New file |
| | |
| | | { |
| | | "id": "uni-data-select", |
| | | "displayName": "uni-data-select 下拉框选择器", |
| | | "version": "1.0.8", |
| | | "description": "通过数据驱动的下拉框选择器", |
| | | "keywords": [ |
| | | "uni-ui", |
| | | "select", |
| | | "uni-data-select", |
| | | "下拉框", |
| | | "下拉选" |
| | | ], |
| | | "repository": "https://github.com/dcloudio/uni-ui", |
| | | "engines": { |
| | | "HBuilderX": "^3.1.1" |
| | | }, |
| | | "directories": { |
| | | "example": "../../temps/example_temps" |
| | | }, |
| | | "dcloudext": { |
| | | "sale": { |
| | | "regular": { |
| | | "price": "0.00" |
| | | }, |
| | | "sourcecode": { |
| | | "price": "0.00" |
| | | } |
| | | }, |
| | | "contact": { |
| | | "qq": "" |
| | | }, |
| | | "declaration": { |
| | | "ads": "无", |
| | | "data": "无", |
| | | "permissions": "无" |
| | | }, |
| | | "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", |
| | | "type": "component-vue" |
| | | }, |
| | | "uni_modules": { |
| | | "dependencies": ["uni-load-more"], |
| | | "encrypt": [], |
| | | "platforms": { |
| | | "cloud": { |
| | | "tcb": "y", |
| | | "aliyun": "y", |
| | | "alipay": "n" |
| | | }, |
| | | "client": { |
| | | "App": { |
| | | "app-vue": "u", |
| | | "app-nvue": "n" |
| | | }, |
| | | "H5-mobile": { |
| | | "Safari": "y", |
| | | "Android Browser": "y", |
| | | "微信浏览器(Android)": "y", |
| | | "QQ浏览器(Android)": "y" |
| | | }, |
| | | "H5-pc": { |
| | | "Chrome": "y", |
| | | "IE": "y", |
| | | "Edge": "y", |
| | | "Firefox": "y", |
| | | "Safari": "y" |
| | | }, |
| | | "小程序": { |
| | | "微信": "y", |
| | | "阿里": "u", |
| | | "百度": "u", |
| | | "字节跳动": "u", |
| | | "QQ": "u", |
| | | "京东": "u" |
| | | }, |
| | | "快应用": { |
| | | "华为": "u", |
| | | "联盟": "u" |
| | | }, |
| | | "Vue": { |
| | | "vue2": "y", |
| | | "vue3": "y" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | ## DataSelect 下拉框选择器 |
| | | > **组件名:uni-data-select** |
| | | > 代码块: `uDataSelect` |
| | | |
| | | 当选项过多时,使用下拉菜单展示并选择内容 |
| | | |
| | | ### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-data-select) |
| | | #### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 |