feat: 添加扫码成功页面和实际库区选择功能
- 新增扫码成功页面,优化用户体验 - 添加实际库区选择组件和API接口 - 修改合并功能表单,增加实际库区选择 - 更新应用版本号和配置 - 优化首页跳转逻辑和错误处理
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
export default {
|
export default {
|
||||||
onLaunch: function() {
|
onLaunch: function() {
|
||||||
this.initApp()
|
this.initApp()
|
||||||
updateManager.checkUpdate();
|
// updateManager.checkUpdate();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 初始化应用
|
// 初始化应用
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
this.$tab.reLaunch('/pages/login')
|
this.$tab.reLaunch('/pages/login')
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.$store.dispatch('GetInfo')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
44
apps/hand-factory/api/wms/actualWarehouse.js
Normal file
44
apps/hand-factory/api/wms/actualWarehouse.js
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询实际库区/库位自关联列表
|
||||||
|
export function listActualWarehouse(query) {
|
||||||
|
return request({
|
||||||
|
url: '/wms/actualWarehouse/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询实际库区/库位自关联详细
|
||||||
|
export function getActualWarehouse(actualWarehouseId) {
|
||||||
|
return request({
|
||||||
|
url: '/wms/actualWarehouse/' + actualWarehouseId,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增实际库区/库位自关联
|
||||||
|
export function addActualWarehouse(data) {
|
||||||
|
return request({
|
||||||
|
url: '/wms/actualWarehouse',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改实际库区/库位自关联
|
||||||
|
export function updateActualWarehouse(data) {
|
||||||
|
return request({
|
||||||
|
url: '/wms/actualWarehouse',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除实际库区/库位自关联
|
||||||
|
export function delActualWarehouse(actualWarehouseId) {
|
||||||
|
return request({
|
||||||
|
url: '/wms/actualWarehouse/' + actualWarehouseId,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -0,0 +1,425 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<!-- 选择器触发按钮 -->
|
||||||
|
<view
|
||||||
|
class="picker-input"
|
||||||
|
@click="handleOpen"
|
||||||
|
:class="{ 'picker-input-disabled': disabled }"
|
||||||
|
>
|
||||||
|
<text class="picker-text" :class="{ 'picker-placeholder': !selectedName }">
|
||||||
|
{{ selectedName || placeholder }}
|
||||||
|
</text>
|
||||||
|
<text class="picker-arrow" v-if="!disabled">▼</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 弹窗内容 -->
|
||||||
|
<uni-popup ref="popup" type="bottom" @close="handlePopupClose">
|
||||||
|
<view class="warehouse-popup">
|
||||||
|
<!-- 弹窗头部 -->
|
||||||
|
<view class="popup-header">
|
||||||
|
<text class="popup-title">{{ title || (wareType === 'virtual' ? '选择逻辑库区' : '选择真实库区') }}</text>
|
||||||
|
<text class="popup-close" @click="handleClose">✕</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 加载状态 -->
|
||||||
|
<view class="loading-tip" v-if="loading">
|
||||||
|
<uni-loading type="circle" size="24"></uni-loading>
|
||||||
|
<text class="loading-text">加载库区中...</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 搜索框 -->
|
||||||
|
<view class="popup-search" v-if="!loading">
|
||||||
|
<input
|
||||||
|
v-model="searchKeyword"
|
||||||
|
@input="handleSearch"
|
||||||
|
placeholder="搜索库区名称"
|
||||||
|
class="search-input"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 库区列表 -->
|
||||||
|
<scroll-view class="popup-body" scroll-y v-if="!loading">
|
||||||
|
<view
|
||||||
|
class="warehouse-item"
|
||||||
|
v-for="item in filteredList"
|
||||||
|
:key="getItemId(item)"
|
||||||
|
@click="handleSelect(item)"
|
||||||
|
>
|
||||||
|
<text class="warehouse-name">{{ getItemName(item) }}</text>
|
||||||
|
<text class="warehouse-check" v-if="getItemId(item) === selectedId">✓</text>
|
||||||
|
</view>
|
||||||
|
<view class="empty-tip" v-if="filteredList.length === 0">
|
||||||
|
<text>未找到匹配的库区</text>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
|
||||||
|
<!-- 错误提示 -->
|
||||||
|
<view class="error-tip" v-if="error">
|
||||||
|
<text class="error-icon">⚠️</text>
|
||||||
|
<text class="error-text">{{ errorMsg || '加载库区失败' }}</text>
|
||||||
|
<button class="retry-btn" @click="loadWarehouses">重试</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</uni-popup>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { listWarehouse } from '@/api/wms/warehouse.js'
|
||||||
|
import { listActualWarehouse } from '@/api/wms/actualWarehouse.js'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'WarehousePicker',
|
||||||
|
props: {
|
||||||
|
// 已选中的库区ID(用于回显)
|
||||||
|
value: {
|
||||||
|
type: [String, Number],
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
// 禁用状态
|
||||||
|
disabled: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
// 按钮占位文本
|
||||||
|
placeholder: {
|
||||||
|
type: String,
|
||||||
|
default: '请选择库区'
|
||||||
|
},
|
||||||
|
// 弹窗标题
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
// 库区类型:virtual-逻辑库区,actual-真实库区
|
||||||
|
wareType: {
|
||||||
|
type: String,
|
||||||
|
default: 'virtual',
|
||||||
|
validator: (value) => {
|
||||||
|
return ['virtual', 'actual'].includes(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 弹窗显示状态
|
||||||
|
showPopup: false,
|
||||||
|
// 所有库区列表
|
||||||
|
dataList: [],
|
||||||
|
// 过滤后的库区列表
|
||||||
|
filteredList: [],
|
||||||
|
// 搜索关键词
|
||||||
|
searchKeyword: '',
|
||||||
|
// 加载状态
|
||||||
|
loading: false,
|
||||||
|
// 错误状态
|
||||||
|
error: false,
|
||||||
|
// 错误信息
|
||||||
|
errorMsg: '',
|
||||||
|
// 选中的库区名称(用于显示)
|
||||||
|
selectedName: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
// 选中的库区ID(双向绑定)
|
||||||
|
selectedId: {
|
||||||
|
get() {
|
||||||
|
return this.value
|
||||||
|
},
|
||||||
|
set(val) {
|
||||||
|
this.$emit('input', val)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
// 监听选中值变化,更新显示名称
|
||||||
|
value: {
|
||||||
|
immediate: true,
|
||||||
|
handler(val) {
|
||||||
|
if (val && this.dataList.length) {
|
||||||
|
const matched = this.dataList.find(item => this.getItemId(item) === val)
|
||||||
|
this.selectedName = matched ? this.getItemName(matched) : ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 监听库区类型变化,重新加载数据
|
||||||
|
wareType: {
|
||||||
|
immediate: true,
|
||||||
|
handler() {
|
||||||
|
this.loadWarehouses()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 根据类型获取项目ID
|
||||||
|
getItemId(item) {
|
||||||
|
return this.wareType === 'virtual' ? item.warehouseId : item.actualWarehouseId
|
||||||
|
},
|
||||||
|
|
||||||
|
// 根据类型获取项目名称
|
||||||
|
getItemName(item) {
|
||||||
|
return this.wareType === 'virtual' ? item.warehouseName : item.actualWarehouseName
|
||||||
|
},
|
||||||
|
|
||||||
|
// 加载库区列表
|
||||||
|
async loadWarehouses() {
|
||||||
|
if (this.loading) return
|
||||||
|
|
||||||
|
this.loading = true
|
||||||
|
this.error = false
|
||||||
|
this.errorMsg = ''
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 根据类型选择不同的API
|
||||||
|
const res = this.wareType === 'virtual'
|
||||||
|
? await listWarehouse({ pageNum: 1, pageSize: 1000 })
|
||||||
|
: await listActualWarehouse({ pageNum: 1, pageSize: 1000 })
|
||||||
|
|
||||||
|
if (res.code === 200) {
|
||||||
|
this.dataList = res[this.wareType === 'virtual' ? 'data' : 'rows'] || []
|
||||||
|
this.filteredList = [...this.dataList]
|
||||||
|
// 初始化选中项名称
|
||||||
|
this.updateSelectedName()
|
||||||
|
} else {
|
||||||
|
throw new Error(res.msg || `${this.wareType === 'virtual' ? '逻辑' : '真实'}库区数据加载失败`)
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
this.error = true
|
||||||
|
this.errorMsg = err.message
|
||||||
|
console.error(`${this.wareType === 'virtual' ? '逻辑' : '真实'}库区加载失败:`, err)
|
||||||
|
} finally {
|
||||||
|
this.loading = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 更新选中的库区名称
|
||||||
|
updateSelectedName() {
|
||||||
|
if (!this.selectedId) return
|
||||||
|
|
||||||
|
const matched = this.dataList.find(
|
||||||
|
item => this.getItemId(item) === this.selectedId
|
||||||
|
)
|
||||||
|
this.selectedName = matched ? this.getItemName(matched) : ''
|
||||||
|
},
|
||||||
|
|
||||||
|
// 搜索过滤
|
||||||
|
handleSearch() {
|
||||||
|
const keyword = this.searchKeyword.trim().toLowerCase()
|
||||||
|
if (!keyword) {
|
||||||
|
this.filteredList = [...this.dataList]
|
||||||
|
} else {
|
||||||
|
this.filteredList = this.dataList.filter(item =>
|
||||||
|
this.getItemName(item).toLowerCase().includes(keyword)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 选择库区
|
||||||
|
handleSelect(item) {
|
||||||
|
this.selectedId = this.getItemId(item)
|
||||||
|
this.selectedName = this.getItemName(item)
|
||||||
|
// 通知父组件选中的完整信息
|
||||||
|
this.$emit('change', item)
|
||||||
|
this.handleClose()
|
||||||
|
},
|
||||||
|
|
||||||
|
// 打开弹窗
|
||||||
|
handleOpen() {
|
||||||
|
if (this.disabled) return
|
||||||
|
// 每次打开前重置搜索
|
||||||
|
this.searchKeyword = ''
|
||||||
|
this.filteredList = [...this.dataList]
|
||||||
|
this.showPopup = true
|
||||||
|
this.$refs.popup.open()
|
||||||
|
},
|
||||||
|
|
||||||
|
// 关闭弹窗
|
||||||
|
handleClose() {
|
||||||
|
this.showPopup = false
|
||||||
|
this.$refs.popup.close()
|
||||||
|
},
|
||||||
|
|
||||||
|
// 弹窗关闭回调
|
||||||
|
handlePopupClose() {
|
||||||
|
this.showPopup = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
/* 保持原有样式不变 */
|
||||||
|
.picker-input {
|
||||||
|
width: 100%;
|
||||||
|
height: 88rpx;
|
||||||
|
padding: 0 24rpx;
|
||||||
|
background: #f8f9fa;
|
||||||
|
border: 2rpx solid #e8e8e8;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
transition: all 0.3s;
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
background: #fff;
|
||||||
|
border-color: #007aff;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.picker-input-disabled {
|
||||||
|
background: #f5f5f5;
|
||||||
|
color: #999;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.picker-text {
|
||||||
|
flex: 1;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333;
|
||||||
|
|
||||||
|
&.picker-placeholder {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.picker-arrow {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999;
|
||||||
|
margin-left: 10rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.warehouse-popup {
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 24rpx 24rpx 0 0;
|
||||||
|
max-height: 70vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 30rpx;
|
||||||
|
border-bottom: 1rpx solid #f0f0f0;
|
||||||
|
|
||||||
|
.popup-title {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #333;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-close {
|
||||||
|
font-size: 40rpx;
|
||||||
|
color: #999;
|
||||||
|
width: 60rpx;
|
||||||
|
height: 60rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-tip {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 60rpx 0;
|
||||||
|
gap: 16rpx;
|
||||||
|
|
||||||
|
.loading-text {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-tip {
|
||||||
|
padding: 40rpx 30rpx;
|
||||||
|
text-align: center;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 20rpx;
|
||||||
|
|
||||||
|
.error-icon {
|
||||||
|
font-size: 48rpx;
|
||||||
|
color: #ff4d4f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-text {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #ff4d4f;
|
||||||
|
max-width: 80%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.retry-btn {
|
||||||
|
margin-top: 10rpx;
|
||||||
|
padding: 10rpx 30rpx;
|
||||||
|
background: #007aff;
|
||||||
|
color: #fff;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-search {
|
||||||
|
padding: 20rpx 30rpx;
|
||||||
|
border-bottom: 1rpx solid #f0f0f0;
|
||||||
|
|
||||||
|
.search-input {
|
||||||
|
width: 100%;
|
||||||
|
height: 80rpx;
|
||||||
|
padding: 0 20rpx;
|
||||||
|
background: #f8f9fa;
|
||||||
|
border: 2rpx solid #e8e8e8;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
background: #fff;
|
||||||
|
border-color: #007aff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-body {
|
||||||
|
max-height: 400rpx;
|
||||||
|
|
||||||
|
.warehouse-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 30rpx;
|
||||||
|
border-bottom: 1rpx solid #f5f5f5;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
background: #f0f7ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.warehouse-name {
|
||||||
|
flex: 1;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.warehouse-check {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #007aff;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-tip {
|
||||||
|
text-align: center;
|
||||||
|
padding: 60rpx 0;
|
||||||
|
color: #999;
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -71,18 +71,26 @@
|
|||||||
|
|
||||||
<!-- 目标库区 -->
|
<!-- 目标库区 -->
|
||||||
<view class="form-item form-item-optional">
|
<view class="form-item form-item-optional">
|
||||||
<text class="form-label-optional">目标库区</text>
|
<text class="form-label-optional">目标库位</text>
|
||||||
<view
|
<view
|
||||||
class="picker-input"
|
class="picker-input"
|
||||||
@click="showWarehousePicker()"
|
@click="showWarehousePicker()"
|
||||||
>
|
>
|
||||||
<text class="picker-text" :class="{ 'picker-placeholder': !warehouseName }">
|
<text class="picker-text" :class="{ 'picker-placeholder': !warehouseName }">
|
||||||
{{ warehouseName || '请选择目标库区' }}
|
{{ warehouseName || '请选择目标库位' }}
|
||||||
</text>
|
</text>
|
||||||
<text class="picker-arrow">▼</text>
|
<text class="picker-arrow">▼</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 实际库区 -->
|
||||||
|
<view class="form-item form-item-optional">
|
||||||
|
<text class="form-label-optional">实际库区</text>
|
||||||
|
<klp-warehouse-picker v-model="actualWarehouseId" placeholder="请选择目标库区"
|
||||||
|
ware-type="actual" />
|
||||||
|
</view>
|
||||||
|
|
||||||
|
|
||||||
<!-- 物品类型选择 -->
|
<!-- 物品类型选择 -->
|
||||||
<view class="form-item form-item-optional">
|
<view class="form-item form-item-optional">
|
||||||
<text class="form-label-optional">物品类型</text>
|
<text class="form-label-optional">物品类型</text>
|
||||||
@@ -299,6 +307,7 @@ export default {
|
|||||||
mergedCoilNo: '',
|
mergedCoilNo: '',
|
||||||
team: '',
|
team: '',
|
||||||
warehouseId: undefined,
|
warehouseId: undefined,
|
||||||
|
actualWarehouseId: undefined,
|
||||||
warehouseName: '',
|
warehouseName: '',
|
||||||
warehouseKeyword: '',
|
warehouseKeyword: '',
|
||||||
warehouses: [],
|
warehouses: [],
|
||||||
@@ -686,6 +695,7 @@ export default {
|
|||||||
this.mergedCoilNo = '';
|
this.mergedCoilNo = '';
|
||||||
this.team = '';
|
this.team = '';
|
||||||
this.warehouseId = undefined;
|
this.warehouseId = undefined;
|
||||||
|
this.actualWarehouseId = undefined;
|
||||||
this.warehouseName = '';
|
this.warehouseName = '';
|
||||||
this.warehouseKeyword = '';
|
this.warehouseKeyword = '';
|
||||||
this.itemType = '';
|
this.itemType = '';
|
||||||
@@ -752,6 +762,7 @@ export default {
|
|||||||
itemType: this.itemType || this.scannedCoils[0].itemType, // 优先使用选择的itemType
|
itemType: this.itemType || this.scannedCoils[0].itemType, // 优先使用选择的itemType
|
||||||
itemId: this.itemId || this.scannedCoils[0].itemId, // 优先使用选择的itemId
|
itemId: this.itemId || this.scannedCoils[0].itemId, // 优先使用选择的itemId
|
||||||
warehouseId: this.warehouseId || this.scannedCoils[0].warehouseId, // 使用选择的库区或第一个钢卷的库区
|
warehouseId: this.warehouseId || this.scannedCoils[0].warehouseId, // 使用选择的库区或第一个钢卷的库区
|
||||||
|
actualWarehouseId: this.actualWarehouseId || this.scannedCoils[0].actualWarehouseId
|
||||||
grossWeight: this.grossWeight ? Number(this.grossWeight) : null,
|
grossWeight: this.grossWeight ? Number(this.grossWeight) : null,
|
||||||
netWeight: this.netWeight ? Number(this.netWeight) : null,
|
netWeight: this.netWeight ? Number(this.netWeight) : null,
|
||||||
newCoils: this.scannedCoils.map(coil => ({
|
newCoils: this.scannedCoils.map(coil => ({
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,14 +1,14 @@
|
|||||||
// 应用全局配置
|
// 应用全局配置
|
||||||
module.exports = {
|
module.exports = {
|
||||||
baseUrl: 'http://192.168.31.116:8080',
|
// baseUrl: 'http://192.168.31.116:8080',
|
||||||
// baseUrl: 'http://140.143.206.120:8080',
|
baseUrl: 'http://140.143.206.120:8080',
|
||||||
// baseUrl: 'http://localhost:8080',
|
// baseUrl: 'http://localhost:8080',
|
||||||
// 应用信息
|
// 应用信息
|
||||||
appInfo: {
|
appInfo: {
|
||||||
// 应用名称
|
// 应用名称
|
||||||
name: "ruoyi-app",
|
name: "ruoyi-app",
|
||||||
// 应用版本
|
// 应用版本
|
||||||
version: "1.2.0",
|
version: "1.3.5",
|
||||||
// 应用logo
|
// 应用logo
|
||||||
logo: "/static/logo.jpg",
|
logo: "/static/logo.jpg",
|
||||||
// 官方网站
|
// 官方网站
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"name" : "科伦普",
|
"name" : "科伦普",
|
||||||
"appid" : "__UNI__E781B49",
|
"appid" : "__UNI__E781B49",
|
||||||
"description" : "",
|
"description" : "",
|
||||||
"versionName" : "3.4",
|
"versionName" : "3.5",
|
||||||
"versionCode" : 1,
|
"versionCode" : 1,
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
"app-plus" : {
|
"app-plus" : {
|
||||||
|
|||||||
@@ -48,6 +48,13 @@
|
|||||||
"navigationBarTitleText" : "产线监控",
|
"navigationBarTitleText" : "产线监控",
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path" : "pages/scansuccess/scansuccess",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText" : "扫码结果"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// {
|
// {
|
||||||
// "path": "pages/register",
|
// "path": "pages/register",
|
||||||
|
|||||||
@@ -137,17 +137,20 @@
|
|||||||
|
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
console.log('=== 扫码流程完成 ===');
|
console.log('=== 扫码流程完成 ===');
|
||||||
uni.showToast({
|
uni.navigateTo({
|
||||||
title: '创建成功',
|
url: '/pages/scansuccess/scansuccess'
|
||||||
icon: 'success',
|
})
|
||||||
duration: 2000
|
// uni.showToast({
|
||||||
});
|
// title: '创建成功',
|
||||||
|
// icon: 'success',
|
||||||
|
// duration: 2000
|
||||||
|
// });
|
||||||
|
|
||||||
// 延迟后返回或跳转
|
// // 延迟后返回或跳转
|
||||||
setTimeout(() => {
|
// setTimeout(() => {
|
||||||
// 可以跳转到待操作列表或返回上一页
|
// // 可以跳转到待操作列表或返回上一页
|
||||||
uni.navigateBack();
|
// uni.navigateBack();
|
||||||
}, 2000);
|
// }, 2000);
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('=== 扫码处理失败 ===');
|
console.error('=== 扫码处理失败 ===');
|
||||||
|
|||||||
@@ -1,93 +1,139 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- <view class="production-page">
|
<!-- 模板内容保持不变(注释部分可根据需求保留) -->
|
||||||
|
|
||||||
<klp-header @lineChange="setActive" class="line-header"></klp-header>
|
|
||||||
|
|
||||||
<view class="content-wrapper">
|
|
||||||
<Acidity v-if="active == 0"/>
|
|
||||||
<Paint v-else-if="active == 1"/>
|
|
||||||
<Zinc1 v-else-if="active == 2"></Zinc1>
|
|
||||||
<Zinc2 v-else-if="active == 3"></Zinc2>
|
|
||||||
<Zinc3 v-else-if="active == 4"></Zinc3>
|
|
||||||
</view>
|
|
||||||
</view> -->
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// 根据不同的全责跳转到不同的页面
|
|
||||||
// 如果是工人跳转到扫码页面
|
|
||||||
// 如果是管理员跳转到产线
|
|
||||||
export default {
|
export default {
|
||||||
created() {
|
data() {
|
||||||
|
return {
|
||||||
|
hasJumped: false // 防止重复跳转的标记
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
// 已跳转过则不再执行逻辑
|
||||||
|
if (this.hasJumped) return;
|
||||||
|
|
||||||
|
// 显示加载状态,提升用户感知
|
||||||
|
uni.showLoading({
|
||||||
|
title: '验证身份中...',
|
||||||
|
mask: true // 防止用户重复操作
|
||||||
|
});
|
||||||
|
|
||||||
// 检查用户角色
|
// 检查用户角色
|
||||||
this.$store.dispatch('GetInfo').then(res => {
|
this.$store.dispatch('GetInfo')
|
||||||
const roles = res.data.roles;
|
.then(res => {
|
||||||
|
uni.hideLoading(); // 关闭加载提示
|
||||||
if (roles.includes('admin')) {
|
|
||||||
// 管理员角色,跳转到产线页面
|
console.log('获取身份信息内容', res.data, )
|
||||||
uni.switchTab({
|
// 验证返回数据格式
|
||||||
url: '/pages/line/line'
|
if (!res || !res.data || !Array.isArray(res.data.roles)) {
|
||||||
});
|
throw new Error('用户角色信息格式错误');
|
||||||
} else if (roles.includes('worker')) {
|
}
|
||||||
// 工人角色,跳转到扫码页面
|
|
||||||
uni.navigateTo({
|
console.log('用户角色信息', res.data.roles)
|
||||||
url: '/pages/easycode/easycode'
|
|
||||||
});
|
const roles = res.data.roles;
|
||||||
}
|
|
||||||
// else {
|
if (roles.includes('admin')) {
|
||||||
// // 其他角色,跳转到扫码页面
|
// 管理员角色跳转
|
||||||
// uni.navigateTo({
|
uni.switchTab({
|
||||||
// url: '/pages/easycode/easycode'
|
url: '/pages/line/line',
|
||||||
|
success: () => {
|
||||||
|
this.hasJumped = true; // 标记已跳转
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.error('管理员页面跳转失败:', err);
|
||||||
|
uni.showToast({
|
||||||
|
title: '跳转产线页面失败',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (roles.includes('worker')) {
|
||||||
|
// 工人角色跳转
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/easycode/easycode',
|
||||||
|
success: () => {
|
||||||
|
this.hasJumped = true; // 标记已跳转
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.error('工人页面跳转失败:', err);
|
||||||
|
uni.showToast({
|
||||||
|
title: '跳转扫码页面失败',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// 处理未定义角色(默认角色)
|
||||||
|
uni.showToast({
|
||||||
|
title: '检测到未知角色,将跳转至默认页面',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
|
||||||
|
// 延迟跳转,确保提示被用户看到
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/easycode/easycode',
|
||||||
|
success: () => {
|
||||||
|
this.hasJumped = true;
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.error('默认角色页面跳转失败:', err);
|
||||||
|
uni.showToast({
|
||||||
|
title: '跳转默认页面失败',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, 2000);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/pages/login'
|
||||||
|
})
|
||||||
|
// uni.hideLoading(); // 关闭加载提示
|
||||||
|
// console.error('用户信息获取失败:', err);
|
||||||
|
|
||||||
|
// // 区分错误类型,给出更精准提示
|
||||||
|
// const errorMsg = err.message || '网络异常,请检查网络后重试';
|
||||||
|
// uni.showToast({
|
||||||
|
// title: errorMsg,
|
||||||
|
// icon: 'none',
|
||||||
|
// duration: 3000
|
||||||
// });
|
// });
|
||||||
// }
|
|
||||||
})
|
// // 提供重试入口
|
||||||
|
// setTimeout(() => {
|
||||||
|
// uni.showModal({
|
||||||
|
// title: '加载失败',
|
||||||
|
// content: '是否重新登录?',
|
||||||
|
// success: (res) => {
|
||||||
|
// if (res.confirm) {
|
||||||
|
// uni.reLaunch({
|
||||||
|
// url: '/pages/login'
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }, 3000);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// import Acidity from '@/components/lines/acidity.vue'
|
|
||||||
// import Paint from '@/components/lines/paint.vue'
|
|
||||||
// import Zinc1 from '@/components/lines/zinc1.vue'
|
|
||||||
// import Zinc2 from '@/components/lines/zinc2.vue'
|
|
||||||
// import Zinc3 from '@/components/lines/zinc3.vue'
|
|
||||||
|
|
||||||
// export default {
|
|
||||||
// components: {
|
|
||||||
// Acidity,
|
|
||||||
// Paint,
|
|
||||||
// Zinc1,
|
|
||||||
// Zinc2,
|
|
||||||
// Zinc3
|
|
||||||
// },
|
|
||||||
// data() {
|
|
||||||
// return {
|
|
||||||
// active: 0
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// methods: {
|
|
||||||
// next() {
|
|
||||||
// if (this.active >= 5) {
|
|
||||||
// this.active = 0
|
|
||||||
// } else {
|
|
||||||
// this.active += 1
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// setActive({ index, line }) {
|
|
||||||
// this.active = index;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
/* 主容器 - 简洁背景 */
|
/* 样式保持不变 */
|
||||||
.production-page {
|
.production-page {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
background: #f6f6f6;
|
background: #f6f6f6;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 顶部装饰 */
|
|
||||||
.page-header {
|
.page-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -124,8 +170,7 @@ export default {
|
|||||||
background: #fff;
|
background: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 内容容器 */
|
|
||||||
.content-wrapper {
|
.content-wrapper {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
142
apps/hand-factory/pages/scansuccess/scansuccess.vue
Normal file
142
apps/hand-factory/pages/scansuccess/scansuccess.vue
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
<template>
|
||||||
|
<view class="scan-success-page">
|
||||||
|
<!-- 成功图标 -->
|
||||||
|
<view class="success-icon">
|
||||||
|
<view class="icon-circle">
|
||||||
|
<view class="icon-check"></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 成功提示文字 -->
|
||||||
|
<view class="success-text">
|
||||||
|
<text class="main-text">扫码成功</text>
|
||||||
|
<text class="sub-text">信息已验证通过</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 返回按钮 -->
|
||||||
|
<button class="back-btn" @click="handleBack">
|
||||||
|
返回
|
||||||
|
</button>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
methods: {
|
||||||
|
// 处理返回逻辑
|
||||||
|
handleBack() {
|
||||||
|
// 返回上一页,如果是从首页跳转可改为switchTab
|
||||||
|
uni.navigateBack({
|
||||||
|
delta: 1,
|
||||||
|
fail: () => {
|
||||||
|
// 若返回失败则改用switchTab跳转
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/code/code'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.scan-success-page {
|
||||||
|
min-height: 100vh;
|
||||||
|
background-color: #ffffff;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 0 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 成功图标样式
|
||||||
|
.success-icon {
|
||||||
|
margin-bottom: 60rpx;
|
||||||
|
|
||||||
|
.icon-circle {
|
||||||
|
width: 180rpx;
|
||||||
|
height: 180rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: #eaffea;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
animation: circleScale 0.5s ease-out;
|
||||||
|
|
||||||
|
.icon-check {
|
||||||
|
width: 100rpx;
|
||||||
|
height: 50rpx;
|
||||||
|
border-left: 10rpx solid #00b42a;
|
||||||
|
border-bottom: 10rpx solid #00b42a;
|
||||||
|
transform: rotate(-45deg);
|
||||||
|
animation: checkShow 0.3s ease-out 0.2s backwards;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 文字提示样式
|
||||||
|
.success-text {
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 100rpx;
|
||||||
|
|
||||||
|
.main-text {
|
||||||
|
font-size: 36rpx;
|
||||||
|
color: #333333;
|
||||||
|
font-weight: 600;
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sub-text {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #666666;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回按钮样式
|
||||||
|
.back-btn {
|
||||||
|
width: 100%;
|
||||||
|
height: 90rpx;
|
||||||
|
line-height: 90rpx;
|
||||||
|
background-color: #007aff;
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 32rpx;
|
||||||
|
border-radius: 45rpx;
|
||||||
|
margin-top: 40rpx;
|
||||||
|
box-shadow: 0 4rpx 10rpx rgba(0, 122, 255, 0.3);
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
background-color: #0066cc;
|
||||||
|
transform: scale(0.98);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 动画定义
|
||||||
|
@keyframes circleScale {
|
||||||
|
0% {
|
||||||
|
transform: scale(0);
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
70% {
|
||||||
|
transform: scale(1.1);
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes checkShow {
|
||||||
|
0% {
|
||||||
|
opacity: 0;
|
||||||
|
transform: rotate(-45deg) scale(0.5);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
opacity: 1;
|
||||||
|
transform: rotate(-45deg) scale(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user