This commit is contained in:
郭飞 2025-05-13 13:08:01 +08:00
commit ff2baf4d26
4 changed files with 471 additions and 60 deletions

View File

@ -1,11 +1,12 @@
<template> <template>
<view class="uni-numbox"> <view class="uni-numbox">
<view @click="_calcValue('minus')" class="uni-numbox__minus"> <view @click="_calcValue('minus')" class="uni-numbox__minus uni-numbox-btns" :style="{background}">
<text class="uni-numbox--text" :class="{ 'uni-numbox--disabled': inputValue <= min || disabled }">-</text> <text class="uni-numbox--text" :class="{ 'uni-numbox--disabled': inputValue <= min || disabled }" :style="{color}">-</text>
</view> </view>
<input :disabled="disabled" @blur="_onBlur" class="uni-numbox__value" type="number" v-model="inputValue" /> <input :disabled="disabled" @focus="_onFocus" @blur="_onBlur" class="uni-numbox__value" type="number"
<view @click="_calcValue('plus')" class="uni-numbox__plus"> v-model="inputValue" :style="{background, color}" />
<text class="uni-numbox--text" :class="{ 'uni-numbox--disabled': inputValue >= max || disabled }">+</text> <view @click="_calcValue('plus')" class="uni-numbox__plus uni-numbox-btns" :style="{background}">
<text class="uni-numbox--text" :class="{ 'uni-numbox--disabled': inputValue >= max || disabled }" :style="{color}">+</text>
</view> </view>
</view> </view>
</template> </template>
@ -18,17 +19,26 @@
* @property {Number} min 最小值 * @property {Number} min 最小值
* @property {Number} max 最大值 * @property {Number} max 最大值
* @property {Number} step 每次点击改变的间隔大小 * @property {Number} step 每次点击改变的间隔大小
* @property {String} background 背景色
* @property {String} color 字体颜色前景色
* @property {Boolean} disabled = [true|false] 是否为禁用状态 * @property {Boolean} disabled = [true|false] 是否为禁用状态
* @event {Function} change 输入框值改变时触发的事件参数为输入框当前的 value * @event {Function} change 输入框值改变时触发的事件参数为输入框当前的 value
* @event {Function} focus 输入框聚焦时触发的事件参数为 event 对象
* @event {Function} blur 输入框失焦时触发的事件参数为 event 对象
*/ */
export default { export default {
name: "UniNumberBox", name: "UniNumberBox",
emits: ['change', 'input', 'update:modelValue', 'blur', 'focus'],
props: { props: {
value: { value: {
type: [Number, String], type: [Number, String],
default: 1 default: 1
}, },
modelValue: {
type: [Number, String],
default: 1
},
min: { min: {
type: Number, type: Number,
default: 0 default: 0
@ -41,6 +51,14 @@
type: Number, type: Number,
default: 1 default: 1
}, },
background: {
type: String,
default: '#f5f5f5'
},
color: {
type: String,
default: '#333'
},
disabled: { disabled: {
type: Boolean, type: Boolean,
default: false default: false
@ -55,14 +73,17 @@
value(val) { value(val) {
this.inputValue = +val; this.inputValue = +val;
}, },
inputValue(newVal, oldVal) { modelValue(val) {
if (+newVal !== +oldVal) { this.inputValue = +val;
this.$emit("change", newVal);
}
} }
}, },
created() { created() {
this.inputValue = +this.value; if (this.value === 1) {
this.inputValue = +this.modelValue;
}
if (this.modelValue === 1) {
this.inputValue = +this.value;
}
}, },
methods: { methods: {
_calcValue(type) { _calcValue(type) {
@ -80,7 +101,9 @@
if (value > (this.max * scale)) { if (value > (this.max * scale)) {
value = this.max * scale value = this.max * scale
} }
} else if (type === "plus") { }
if (type === "plus") {
value += step; value += step;
if (value > (this.max * scale)) { if (value > (this.max * scale)) {
return; return;
@ -90,17 +113,24 @@
} }
} }
this.inputValue = String(value / scale); this.inputValue = (value / scale).toFixed(String(scale).length - 1);
this.$emit("change", +this.inputValue);
// TODO vue2
this.$emit("input", +this.inputValue);
// TODO vue3
this.$emit("update:modelValue", +this.inputValue);
}, },
_getDecimalScale() { _getDecimalScale() {
let scale = 1; let scale = 1;
// //
if (~~this.step !== this.step) { if (~~this.step !== this.step) {
scale = Math.pow(10, (this.step + "").split(".")[1].length); scale = Math.pow(10, String(this.step).split(".")[1].length);
} }
return scale; return scale;
}, },
_onBlur(event) { _onBlur(event) {
this.$emit('blur', event)
let value = event.detail.value; let value = event.detail.value;
if (!value) { if (!value) {
// this.inputValue = 0; // this.inputValue = 0;
@ -112,14 +142,23 @@
} else if (value < this.min) { } else if (value < this.min) {
value = this.min; value = this.min;
} }
this.inputValue = value; const scale = this._getDecimalScale();
this.inputValue = value.toFixed(String(scale).length - 1);
this.$emit("change", +this.inputValue);
this.$emit("input", +this.inputValue);
},
_onFocus(event) {
this.$emit('focus', event)
} }
} }
}; };
</script> </script>
<style scoped> <style lang="scss" >
/* #ifdef APP-NVUE */ $box-height: 35px;
/* #endif */ $bg: #f5f5f5;
$br: 2px;
$color: #333;
.uni-numbox { .uni-numbox {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: flex; display: flex;
@ -130,63 +169,55 @@
width: 120px; width: 120px;
} }
.uni-numbox-btns {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
align-items: center;
justify-content: center;
padding: 0 8px;
background-color: $bg;
/* #ifdef H5 */
cursor: pointer;
/* #endif */
}
.uni-numbox__value { .uni-numbox__value {
background-color: #ffffff; margin: 0 2px;
background-color: $bg;
width: 40px; width: 40px;
height: 35px; height: $box-height;
text-align: center; text-align: center;
font-size: 16px; font-size: 14px;
border-width: 1rpx;
border-style: solid;
border-color: #e5e5e5;
border-left-width: 0; border-left-width: 0;
border-right-width: 0; border-right-width: 0;
color: $color;
} }
.uni-numbox__minus { .uni-numbox__minus {
/* #ifndef APP-NVUE */ border-top-left-radius: $br;
display: flex; border-bottom-left-radius: $br;
/* #endif */
flex-direction: row;
align-items: center;
justify-content: center;
width: 35px;
height: 35px;
font-size: 20px;
color: #333;
background-color: #f8f8f8;
border-width: 1rpx;
border-style: solid;
border-color: #e5e5e5;
border-top-left-radius: 3px;
border-bottom-left-radius: 3px;
border-right-width: 0;
} }
.uni-numbox__plus { .uni-numbox__plus {
/* #ifndef APP-NVUE */ border-top-right-radius: $br;
display: flex; border-bottom-right-radius: $br;
/* #endif */
flex-direction: row;
align-items: center;
justify-content: center;
width: 35px;
height: 35px;
border-width: 1rpx;
border-style: solid;
border-color: #e5e5e5;
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
background-color: #f8f8f8;
border-left-width: 0;
} }
.uni-numbox--text { .uni-numbox--text {
font-size: 40rpx; // fix nvue
color: #333; line-height: 20px;
font-size: 20px;
font-weight: 300;
color: $color;
} }
.uni-numbox--disabled { .uni-numbox .uni-numbox--disabled {
color: #c0c0c0; color: #c0c0c0 !important;
/* #ifdef H5 */
cursor: not-allowed;
/* #endif */
} }
</style> </style>

View File

@ -42,6 +42,13 @@
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
}, },
{
"path": "pages/tms/index",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{ {
"path": "pages/account/index", "path": "pages/account/index",
"style": { "style": {
@ -639,6 +646,14 @@
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
},{
"path" : "pages/tms/features/VehicleInOut/index",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
} }
], ],
"globalStyle": { "globalStyle": {
@ -681,6 +696,12 @@
"text": "库内", "text": "库内",
"pagePath": "pages/checkplan/index" "pagePath": "pages/checkplan/index"
}, },
{
"iconPath": "static/img/material.png",
"selectedIconPath": "static/img/material_selected.png",
"text": "运输",
"pagePath": "pages/tms/index"
},
{ {
"iconPath": "static/img/account.png", "iconPath": "static/img/account.png",
"selectedIconPath": "static/img/account_selected.png", "selectedIconPath": "static/img/account_selected.png",

View File

@ -0,0 +1,160 @@
<template>
<view>
<u-navbar back-text="返回" title="车辆出入厂" :background="background"></u-navbar>
<u-form ref="testForm">
<u-form-item :border-bottom="false">
<label>选择车牌:</label>&nbsp;&nbsp;&nbsp;&nbsp;
<zxzUniDataSelect filterable v-model="carNum" :localdata="carNumList" @change="change">
</zxzUniDataSelect>
</u-form-item>
<u-form-item :border-bottom="false">
<label>入厂地磅:</label>
<uni-number-box :max="999999999" :step="0.1" v-model="enterWeight"/>
</u-form-item>
<u-form-item :border-bottom="false">
<label>出厂地磅:</label>
<uni-number-box :max="999999999" :step="0.1" v-model="exitWeight"/>
</u-form-item>
</u-form>
<u-row>
<u-col span="3"><label>入厂类型</label> </u-col>
<u-col span="3"><label>{{model.efType_dictText}}</label> </u-col>
<u-col span="3"><label>排队数</label> </u-col>
<u-col span="3"><label>{{model.lineUpCount}}</label> </u-col>
</u-row>
<u-row>
<u-col span="3"><label>物流公司</label> </u-col>
<u-col span="3"><label>{{model.logistics}}</label> </u-col>
<u-col span="3"><label>司机姓名</label> </u-col>
<u-col span="3"><label>{{model.driverName}}</label> </u-col>
</u-row>
<u-row>
<u-col span="3"><label>司机电话</label> </u-col>
<u-col span="3"><label>{{model.driverTel}}</label> </u-col>
<u-col span="3"><label>司机身份证</label> </u-col>
<u-col span="2"><label>{{model.driverIdCard}}</label> </u-col>
</u-row>
<u-row>
<u-col span="3"><label>进厂门</label> </u-col>
<u-col span="3"><label>{{model.enterFactoryDoor}}</label> </u-col>
<u-col span="3"><label>出厂门</label> </u-col>
<u-col span="2"><label>{{model.exitFactoryDoor}}</label> </u-col>
</u-row>
<u-row>
<u-col span="3"><label>当前状态</label> </u-col>
<u-col span="3"><label>{{model.currentStatus_dictText}}</label> </u-col>
</u-row>
<br />
<u-row>
<u-col span="3"><u-button @click="handleConfirm('1')" type="primary" size="mini">对接人确认</u-button></u-col>
<u-col span="3"><u-button @click="handleConfirm('3')" type="primary" size="mini">审核入厂</u-button></u-col>
<u-col span="3"><u-button @click="handleConfirm('4')" type="primary" size="mini">审核出厂</u-button></u-col>
<u-col span="3"><u-button @click="handleConfirm('5')" type="primary" size="mini">地磅确认</u-button></u-col>
</u-row>
</view>
</template>
<script>
import zxzUniDataSelect from "@/components/zxz-uni-data-select/zxz-uni-data-select.vue"
import uniNumberBox from "@/components/uni-number-box/uni-number-box.vue"
export default {
components: {
zxzUniDataSelect,
uniNumberBox
},
data() {
return {
title: 'Hello',
background: {
backgroundImage: 'linear-gradient(45deg, rgb(28, 187, 180), rgb(141, 198, 63))'
},
model:{},
carNum: '',
enterWeight: '',
exitWeight: '',
carNumList: [],
vehicleList: [],
baseUrl: 'http://114.215.188.164:9001/jeecg-boot',
url: {
getCarNum: '/vehicleinout/vehicleInOut/getCarNum',
handleConfirm: '/vehicleinout/vehicleInOut/handleConfirm'
}
}
},
mounted() {
this.getCarNum();
},
methods: {
getCarNum(){
this.getRequest(this.url.getCarNum,{},'GET').then(res => {
if (res.success) {
this.vehicleList = res.result.records;
this.carNumList = res.result.records.map(item => ({
text: item.carNum,
value: item.id,
}));
}
})
},
change(){
this.model = this.vehicleList.filter(item => item.id == this.carNum)[0]
},
handleConfirm(currentStatus){
if (this.carNum == '') {
this.$showMessage('请选择车牌');
return;
}
let param = {
id: this.model.id,
}
if (currentStatus != '5') {
param.currentStatus = currentStatus;
} else {
param.enterWeight = this.enterWeight;
param.exitWeight = this.exitWeight;
}
this.getRequest(this.url.handleConfirm,param).then(res => {
if (res.success) {
this.$showMessage(res.result);
this.model = {}
this.carNum = ''
this.enterWeight = ''
this.exitWeight = ''
} else {
this.$showMessage(res.message);
}
})
},
getRequest(url='',data={},method='',){
return new Promise((resolve, reject) => {
uni.request({
url: this.baseUrl + url, //
method: method||'POST',
header: {
'Content-type': 'application/json;charset=utf-8',
}, //Json
'timeout': 600000,
data:data,//
success:(res)=>{
// console.log(res)
resolve(res.data)//
},
fail:(err)=>{
// console.log(res)
resolve(err)
}
})
})
}
}
}
</script>
<style scoped>
::v-deep .uni-numbox__value{
width: 80px;
}
</style>

199
pages/tms/index.vue Normal file
View File

@ -0,0 +1,199 @@
<template>
<view>
<u-navbar :is-back="false" title="WMS PDA" :background="background"></u-navbar>
<scroll-view scroll-y class="page">
<view class="nav-list">
<view class="row-flex">
<view v-for="(item, i) in elements" :key="i" class="nav-view" v-if="$menuLimit(item.id)">
<navigator hover-class="none" :url="'/pages/tms/features/' + item.name" class="nav-a nav-li" navigateTo
:class="'bg-'+item.color">
<view class="nav-title">{{item.title}}</view>
<view class="nav-name">{{item.en_name}}</view>
<text :class="'cuIcon-' + item.cuIcon"></text>
</navigator>
</view>
</view>
</view>
</scroll-view>
<u-gap height="70"></u-gap>
</view>
</template>
<script>
export default {
data() {
return {
title: 'Hello',
background: {
backgroundImage: 'linear-gradient(45deg, rgb(28, 187, 180), rgb(141, 198, 63))'
},
elements: [{
title: '车辆审核',
name: 'VehicleInOut/index',
en_name: 'VehicleInOut',
color: 'cyan',
cuIcon: 'shop',
label: '车辆审核',
id:'500001'
},
],
}
},
computed: {
tabbar() {
return store.vuex_tabbar
}
},
}
</script>
<style lang="scss" scoped>
.demo-layout {
height: 80rpx;
border-radius: 8rpx;
}
.bg-purple {
background: #d3dce6;
}
.mt-10 {
margin-top: 10px;
}
.nav-view {
width: 45%;
margin: 2.5%;
// display: contents;
}
.row-flex {
width: 100%;
display: flex;
flex-wrap: wrap;
}
.nav-li {
// width: 45%;
width: 100%;
// margin: 0 2.5% 40upx;
background-image: url('../../static/img/background.png');
background-size: cover;
background-position: center;
position: relative;
z-index: 1;
}
.nav-a {
padding: 30upx;
border-radius: 12upx;
}
.nav-li::after {
content: "";
position: absolute;
z-index: -1;
background-color: inherit;
width: 100%;
height: 100%;
left: 0;
bottom: -10%;
border-radius: 10upx;
opacity: 0.2;
transform: scale(0.9, 0.9);
}
.nav-li.cur {
color: #fff;
background: rgb(94, 185, 94);
box-shadow: 4upx 4upx 6upx rgba(94, 185, 94, 0.4);
}
.nav-title {
font-size: 32upx;
font-weight: 300;
}
.nav-title::first-letter {
font-size: 40upx;
margin-right: 4upx;
}
.nav-name {
font-size: 28upx;
text-transform: Capitalize;
margin-top: 20upx;
position: relative;
}
.nav-name::before {
content: "";
position: absolute;
display: block;
width: 40upx;
height: 6upx;
background: #fff;
bottom: 0;
right: 0;
opacity: 0.5;
}
.nav-name::after {
content: "";
position: absolute;
display: block;
width: 100upx;
height: 1px;
background: #fff;
bottom: 0;
right: 40upx;
opacity: 0.3;
}
.nav-name::first-letter {
font-weight: bold;
font-size: 36upx;
margin-right: 1px;
}
.nav-li text {
position: absolute;
right: 30upx;
top: 30upx;
font-size: 52upx;
width: 60upx;
height: 60upx;
text-align: center;
line-height: 60upx;
}
.text-light {
font-weight: 300;
}
@keyframes show {
0% {
transform: translateY(-50px);
}
60% {
transform: translateY(40upx);
}
100% {
transform: translateY(0px);
}
}
@-webkit-keyframes show {
0% {
transform: translateY(-50px);
}
60% {
transform: translateY(40upx);
}
100% {
transform: translateY(0px);
}
}
</style>