From 7b6184907d70a14b129996d0010566f39307ccb7 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期三, 24 七月 2024 19:25:12 +0800
Subject: [PATCH] agv平板开发
---
uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue | 562 +++++++++++++++++++
uni_modules/uni-data-select/changelog.md | 39 +
uni_modules/uni-data-select/readme.md | 8
pages/project/jmAGV/floorOne.vue | 460 ++++++++++-----
uni_modules/uni-data-select/package.json | 86 ++
pages/project/jmAGV/home.vue | 544 +++++++++++-------
6 files changed, 1,341 insertions(+), 358 deletions(-)
diff --git a/pages/project/jmAGV/floorOne.vue b/pages/project/jmAGV/floorOne.vue
index cfdcb29..c9ec660 100644
--- a/pages/project/jmAGV/floorOne.vue
+++ b/pages/project/jmAGV/floorOne.vue
@@ -1,104 +1,169 @@
<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() {
@@ -106,80 +171,147 @@
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)
},
// 鎵�鏈夋湇鍔�
@@ -188,17 +320,25 @@
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'
+ })
}
}
})
@@ -210,26 +350,43 @@
<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;
@@ -242,12 +399,14 @@
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;
@@ -257,6 +416,7 @@
flex-direction: column;
justify-content: space-around;
}
+
.popup2 {
background-color: #eee;
width: 30vw;
@@ -267,22 +427,7 @@
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;
@@ -294,19 +439,22 @@
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;
@@ -315,4 +463,20 @@
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>
\ No newline at end of file
diff --git a/pages/project/jmAGV/home.vue b/pages/project/jmAGV/home.vue
index 61a83ab..af0fc69 100644
--- a/pages/project/jmAGV/home.vue
+++ b/pages/project/jmAGV/home.vue
@@ -1,103 +1,206 @@
<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: '',
@@ -105,7 +208,7 @@
btnTitle3: '',
outType: '',
stationType: 'load',
- type: '' ,
+ type: '',
originLocal: '',
targetLocal: '',
code: '',
@@ -117,8 +220,10 @@
},
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() {
@@ -126,153 +231,147 @@
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)
},
// 鎵�鏈夋湇鍔�
@@ -281,17 +380,26 @@
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'
+ })
}
-
}
})
}
@@ -303,35 +411,42 @@
.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;
@@ -344,12 +459,14 @@
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;
@@ -359,6 +476,7 @@
flex-direction: column;
justify-content: space-around;
}
+
.popup2 {
background-color: #eee;
width: 30vw;
@@ -369,6 +487,7 @@
justify-content: space-around;
border-radius: 10rpx;
}
+
.popup3 {
background-color: #eee;
max-height: 80vw;
@@ -380,19 +499,22 @@
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;
@@ -401,10 +523,12 @@
margin: 10rpx;
background-color: #FFF;
}
+
.chosed {
background-color: #67C23A;
color: #e8e8e8;
}
+
.select {
position: absolute;
bottom: 12px;
@@ -415,4 +539,4 @@
inset -2px -2px 2px rgba(255, 255, 255, .7),
-2px -2px 2px rgba(0, 0, 0, .4);
}
-</style>
+</style>
\ No newline at end of file
diff --git a/uni_modules/uni-data-select/changelog.md b/uni_modules/uni-data-select/changelog.md
new file mode 100644
index 0000000..016e3d2
--- /dev/null
+++ b/uni_modules/uni-data-select/changelog.md
@@ -0,0 +1,39 @@
+## 1.0.8锛�2024-03-28锛�
+- 淇 鍦╲ue2涓�: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锛�
+- 淇 褰搘here鍙樺寲鏃讹紝鏁版嵁涓嶄細鑷姩鏇存柊鐨勯棶棰�
+## 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锛�
+- 鍒濆鍖�
diff --git a/uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue b/uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue
new file mode 100644
index 0000000..edab65a
--- /dev/null
+++ b/uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue
@@ -0,0 +1,562 @@
+<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 搴曢儴寮瑰嚭锛坉efault)
+ * @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>
diff --git a/uni_modules/uni-data-select/package.json b/uni_modules/uni-data-select/package.json
new file mode 100644
index 0000000..5864594
--- /dev/null
+++ b/uni_modules/uni-data-select/package.json
@@ -0,0 +1,86 @@
+{
+ "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"
+ }
+ }
+ }
+ }
+}
diff --git a/uni_modules/uni-data-select/readme.md b/uni_modules/uni-data-select/readme.md
new file mode 100644
index 0000000..eb58de3
--- /dev/null
+++ b/uni_modules/uni-data-select/readme.md
@@ -0,0 +1,8 @@
+## DataSelect 涓嬫媺妗嗛�夋嫨鍣�
+> **缁勪欢鍚嶏細uni-data-select**
+> 浠g爜鍧楋細 `uDataSelect`
+
+褰撻�夐」杩囧鏃讹紝浣跨敤涓嬫媺鑿滃崟灞曠ず骞堕�夋嫨鍐呭
+
+### [鏌ョ湅鏂囨。](https://uniapp.dcloud.io/component/uniui/uni-data-select)
+#### 濡備娇鐢ㄨ繃绋嬩腑鏈変换浣曢棶棰橈紝鎴栬�呮偍瀵箄ni-ui鏈変竴浜涘ソ鐨勫缓璁紝娆㈣繋鍔犲叆 uni-ui 浜ゆ祦缇わ細871950839
--
Gitblit v1.9.1