|
@@ -20,45 +20,44 @@
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div class="info-grid">
|
|
<div class="info-grid">
|
|
|
- <div class="info-item">
|
|
|
|
|
- <div class="info-label">用户ID</div>
|
|
|
|
|
- <div class="info-value">{{ userInfo.userId }}</div>
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+<!-- <div class="info-item">-->
|
|
|
|
|
+<!-- <div class="info-label">用户ID</div>-->
|
|
|
|
|
+<!-- <div class="info-value">{{ userInfo.userId }}</div>-->
|
|
|
|
|
+<!-- </div>-->
|
|
|
|
|
|
|
|
<div class="info-item">
|
|
<div class="info-item">
|
|
|
<div class="info-label">用户姓名</div>
|
|
<div class="info-label">用户姓名</div>
|
|
|
<div class="info-value">{{ userInfo.name }}</div>
|
|
<div class="info-value">{{ userInfo.name }}</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
-<!-- <div class="info-item">-->
|
|
|
|
|
-<!-- <div class="info-label">IP地址</div>-->
|
|
|
|
|
-<!-- <div class="info-value">{{ ipAddress || '获取中...' }}</div>-->
|
|
|
|
|
-<!-- </div>-->
|
|
|
|
|
-
|
|
|
|
|
<div class="info-item">
|
|
<div class="info-item">
|
|
|
<div class="info-label">MAC地址</div>
|
|
<div class="info-label">MAC地址</div>
|
|
|
<div class="info-value">{{ mac }}</div>
|
|
<div class="info-value">{{ mac }}</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+
|
|
|
|
|
+ <div class="info-item">
|
|
|
|
|
+ <div class="info-label">仓库</div>
|
|
|
|
|
+ <div class="info-value">{{ frogPosition.warehouse }}</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <div class="info-item">
|
|
|
|
|
+ <div class="info-label">位置编号</div>
|
|
|
|
|
+ <div class="info-value">{{ frogPosition.code }}</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <div class="info-item">
|
|
|
|
|
+ <div class="info-label">用途类型</div>
|
|
|
|
|
+ <div class="info-value">{{ frogPosition.type }}</div>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div class="error-section">
|
|
<div class="error-section">
|
|
|
- <div class="error-display">
|
|
|
|
|
- <div class="error-label">错误数量</div>
|
|
|
|
|
- <div class="error-count">{{ errNum }}</div>
|
|
|
|
|
- </div>
|
|
|
|
|
- <!-- 添加的一键重传按钮 -->
|
|
|
|
|
- <van-button
|
|
|
|
|
- v-if="errNum > 0"
|
|
|
|
|
- plain
|
|
|
|
|
- :loading="isOnePush"
|
|
|
|
|
- :disabled="isOnePush"
|
|
|
|
|
- loading-text="重传中..."
|
|
|
|
|
- type="danger"
|
|
|
|
|
- class="retry-btn"
|
|
|
|
|
- @click="_one_click_push">
|
|
|
|
|
- 一键重传
|
|
|
|
|
- </van-button>
|
|
|
|
|
|
|
+<!-- <div class="error-display">-->
|
|
|
|
|
+<!-- <div class="error-label">错误数量</div>-->
|
|
|
|
|
+<!-- <div class="error-count">{{ errNum }}</div>-->
|
|
|
|
|
+<!-- </div>-->
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+
|
|
|
</van-col>
|
|
</van-col>
|
|
|
<van-col span="18" class="table-container">
|
|
<van-col span="18" class="table-container">
|
|
|
<van-cell-group class="custom-cell-group">
|
|
<van-cell-group class="custom-cell-group">
|
|
@@ -72,7 +71,6 @@
|
|
|
<div class="col time">时间</div>
|
|
<div class="col time">时间</div>
|
|
|
<div class="col operator">操作人</div>
|
|
<div class="col operator">操作人</div>
|
|
|
<div class="col content">操作内容</div>
|
|
<div class="col content">操作内容</div>
|
|
|
- <div class="col status">操作状态</div>
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<van-pull-refresh
|
|
<van-pull-refresh
|
|
@@ -93,14 +91,9 @@
|
|
|
class="table-row"
|
|
class="table-row"
|
|
|
>
|
|
>
|
|
|
<div class="col index">{{ index + 1 }}</div>
|
|
<div class="col index">{{ index + 1 }}</div>
|
|
|
- <div class="col time">{{ item.operationTime }}</div>
|
|
|
|
|
|
|
+ <div class="col time">{{ item.operationTime.replace(/^\d{4}-/, '') }}</div>
|
|
|
<div class="col operator">{{ item.operatorName }}</div>
|
|
<div class="col operator">{{ item.operatorName }}</div>
|
|
|
<div class="col content">{{ item.deliveryNo }}</div>
|
|
<div class="col content">{{ item.deliveryNo }}</div>
|
|
|
- <div class="col status"
|
|
|
|
|
- :style="{ color: item.isPush === 0 ? '#333' : item.isPush === 1 ? '#67C23A' : '#F56C6C' }"
|
|
|
|
|
- @click="_rePush(item)">
|
|
|
|
|
- {{ item.isPush === 0 ? '上传' : item.isPush === 1 ? '成功' : '重传' }}
|
|
|
|
|
- </div>
|
|
|
|
|
</div>
|
|
</div>
|
|
|
<van-back-top />
|
|
<van-back-top />
|
|
|
</van-list>
|
|
</van-list>
|
|
@@ -153,11 +146,11 @@
|
|
|
import { onMounted, onUnmounted, ref, watch } from 'vue'
|
|
import { onMounted, onUnmounted, ref, watch } from 'vue'
|
|
|
import { closeListener, openListener, scanInit } from '@/utils/keydownListener'
|
|
import { closeListener, openListener, scanInit } from '@/utils/keydownListener'
|
|
|
import { scanSuccess, scanError } from '@/utils/android'
|
|
import { scanSuccess, scanError } from '@/utils/android'
|
|
|
-import { getVersionName, checkUpdate, saveUserId, getUserId, scanRepeat, saveMacAddress, listErrRecords,
|
|
|
|
|
- readMacAddress, pageDelivery, addDelivery, updateDeliveryPushFail, markAsPushed, getErrRecordsCount } from '@/utils/androidPiece'
|
|
|
|
|
|
|
+import { getVersionName, checkUpdate, saveUserId, getUserId, scanRepeat, saveMacAddress, listErrRecords, reLoginTip,
|
|
|
|
|
+ readMacAddress, pageDelivery, addDelivery, isDeliveryNoExists, markAsPushed, getErrRecordsCount } from '@/utils/androidPiece'
|
|
|
import { showLoadingToast, showNotify } from 'vant'
|
|
import { showLoadingToast, showNotify } from 'vant'
|
|
|
import { getUserIdByCert, getUserNameById } from '@/api/login/index'
|
|
import { getUserIdByCert, getUserNameById } from '@/api/login/index'
|
|
|
-import { receive } from '@/api/scan/index'
|
|
|
|
|
|
|
+import { receive, getScanDriverInfo } from '@/api/scan/index'
|
|
|
import { formatDateTime } from '@/utils/date'
|
|
import { formatDateTime } from '@/utils/date'
|
|
|
|
|
|
|
|
// 在输入对话框或界面中添加提示文本
|
|
// 在输入对话框或界面中添加提示文本
|
|
@@ -178,6 +171,13 @@ const loading = ref(false)
|
|
|
const finished = ref(false)
|
|
const finished = ref(false)
|
|
|
const errNum = ref(0)
|
|
const errNum = ref(0)
|
|
|
|
|
|
|
|
|
|
+// 小青蛙位置属性
|
|
|
|
|
+const frogPosition = ref({
|
|
|
|
|
+ warehouse: '',
|
|
|
|
|
+ type:'',
|
|
|
|
|
+ code:''
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
|
|
|
|
|
const isOnline = ref(navigator.onLine)
|
|
const isOnline = ref(navigator.onLine)
|
|
|
// 更新网络状态
|
|
// 更新网络状态
|
|
@@ -219,11 +219,19 @@ onMounted(() => {
|
|
|
window.addEventListener('offline', updateNetworkStatus)
|
|
window.addEventListener('offline', updateNetworkStatus)
|
|
|
|
|
|
|
|
mac.value = readMacAddress()
|
|
mac.value = readMacAddress()
|
|
|
- const userId = getUserId()
|
|
|
|
|
- if (userId) {
|
|
|
|
|
- userInfo.value.userId = userId
|
|
|
|
|
- getUserName(userId)
|
|
|
|
|
|
|
+ // 获取用户信息
|
|
|
|
|
+ if (!userInfo.value.userId) {
|
|
|
|
|
+ const userId = getUserId()
|
|
|
|
|
+ if (userId) {
|
|
|
|
|
+ userInfo.value.userId = userId
|
|
|
|
|
+ getUserName(userId)
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ // 获取机器位置信息
|
|
|
|
|
+ if (!frogPosition.value.warehouse && mac.value) {
|
|
|
|
|
+ getFrogPosition()
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if (mac.value) {
|
|
if (mac.value) {
|
|
|
_openScan()
|
|
_openScan()
|
|
|
} else {
|
|
} else {
|
|
@@ -235,6 +243,15 @@ onMounted(() => {
|
|
|
errNum.value = getErrNum()
|
|
errNum.value = getErrNum()
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+const getFrogPosition = () => {
|
|
|
|
|
+ getScanDriverInfo(mac.value).then(res => {
|
|
|
|
|
+ if (res && res.data) {
|
|
|
|
|
+ frogPosition.value.warehouse = res.data.warehouseCode
|
|
|
|
|
+ frogPosition.value.type = res.data.type
|
|
|
|
|
+ frogPosition.value.code = res.data.code
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
const _openScan = () => {
|
|
const _openScan = () => {
|
|
|
openListener()
|
|
openListener()
|
|
@@ -243,7 +260,6 @@ const _openScan = () => {
|
|
|
},300)
|
|
},300)
|
|
|
}
|
|
}
|
|
|
const _handlerScan = (code) => {
|
|
const _handlerScan = (code) => {
|
|
|
- console.log(code)
|
|
|
|
|
code = fixDuplicateText(code)
|
|
code = fixDuplicateText(code)
|
|
|
// 校验扫描的是否为登录二维码
|
|
// 校验扫描的是否为登录二维码
|
|
|
const regex = /\{"sign":"([^"]*)",\s*"identity":(\d+)\}/;
|
|
const regex = /\{"sign":"([^"]*)",\s*"identity":(\d+)\}/;
|
|
@@ -284,34 +300,40 @@ const _handlerScan = (code) => {
|
|
|
// 校验是否已存在
|
|
// 校验是否已存在
|
|
|
const currentTime = formatDateTime(new Date())
|
|
const currentTime = formatDateTime(new Date())
|
|
|
|
|
|
|
|
- const result = addDelivery(mac.value, code, userInfo.value.userId, userInfo.value.name)
|
|
|
|
|
- if (result === -1) {
|
|
|
|
|
|
|
+ const exists = isDeliveryNoExists(code)
|
|
|
|
|
+ if (!exists) {
|
|
|
scanRepeat()
|
|
scanRepeat()
|
|
|
message.value = '该快递单已扫描!'
|
|
message.value = '该快递单已扫描!'
|
|
|
showNotify({ type: 'danger', style: 'font-size: 30px !important;height:50px', message: '该快递单已扫描!' });
|
|
showNotify({ type: 'danger', style: 'font-size: 30px !important;height:50px', message: '该快递单已扫描!' });
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- if (result === -2) {
|
|
|
|
|
- scanError()
|
|
|
|
|
- showNotify({ type: 'danger', style: 'font-size: 30px !important;height:50px', message: '插入失败,请联系开发人员!' });
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
message.value = ''
|
|
message.value = ''
|
|
|
- const dto = { deliveryNo: code, machine: mac.value, operator: userInfo.value.userId, operationTime: currentTime, operatorName: userInfo.value.name, isPush: 0 }
|
|
|
|
|
|
|
+ const dto = { deliveryNo: code, machine: mac.value, operator: userInfo.value.userId, operationTime: currentTime, operatorName: userInfo.value.name, isPush: 1 }
|
|
|
receive(dto).then(res => {
|
|
receive(dto).then(res => {
|
|
|
- console.log(res)
|
|
|
|
|
- dto.isPush = 1
|
|
|
|
|
- scanSuccess()
|
|
|
|
|
- markAsPushed(code);
|
|
|
|
|
- list.value.unshift(dto)
|
|
|
|
|
- showNotify({ type: 'success', style: 'font-size: 30px !important;height:50px', message: '扫描成功!' });
|
|
|
|
|
|
|
+ if (res && res.code === 200) {
|
|
|
|
|
+ const result = addDelivery(mac.value, code, userInfo.value.userId, userInfo.value.name)
|
|
|
|
|
+ if (result === -1) {
|
|
|
|
|
+ scanRepeat()
|
|
|
|
|
+ message.value = '该快递单已扫描!'
|
|
|
|
|
+ showNotify({ type: 'danger', style: 'font-size: 30px !important;height:50px', message: '该快递单已扫描!' });
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ if (result === -2) {
|
|
|
|
|
+ scanError()
|
|
|
|
|
+ showNotify({ type: 'danger', style: 'font-size: 30px !important;height:50px', message: '添加失败,请联系开发人员!' });
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ scanSuccess()
|
|
|
|
|
+ list.value.unshift(dto)
|
|
|
|
|
+ showNotify({ type: 'success', style: 'font-size: 30px !important;height:50px', message: '扫描成功!' });
|
|
|
|
|
+ }
|
|
|
}).catch(err => {
|
|
}).catch(err => {
|
|
|
- console.log(err)
|
|
|
|
|
- dto.isPush = 2
|
|
|
|
|
- scanError()
|
|
|
|
|
- updateDeliveryPushFail(code)
|
|
|
|
|
- list.value.unshift(dto)
|
|
|
|
|
- errNum.value += 1
|
|
|
|
|
|
|
+ if (err.code === 700) {
|
|
|
|
|
+ userInfo.value = {}
|
|
|
|
|
+ reLoginTip()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ scanError()
|
|
|
|
|
+ }
|
|
|
showNotify({ type: 'danger', style: 'font-size: 30px !important;height:50px', message: `扫描失败!${err.message}` });
|
|
showNotify({ type: 'danger', style: 'font-size: 30px !important;height:50px', message: `扫描失败!${err.message}` });
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
@@ -398,7 +420,7 @@ const _rePush = (item) => {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const getUserName = (userId) => {
|
|
const getUserName = (userId) => {
|
|
|
- getUserNameById(userId).then(res => {
|
|
|
|
|
|
|
+ getUserNameById(userId, mac.value).then(res => {
|
|
|
if (res && res.data) {
|
|
if (res && res.data) {
|
|
|
saveUserId(userInfo.value.userId)
|
|
saveUserId(userInfo.value.userId)
|
|
|
userInfo.value.name = res.data
|
|
userInfo.value.name = res.data
|
|
@@ -444,6 +466,7 @@ const _saveMac = () => {
|
|
|
}
|
|
}
|
|
|
showNotify({ type: 'success', style: 'font-size: 30px !important;height:50px', message: 'MAC保存成功!' });
|
|
showNotify({ type: 'success', style: 'font-size: 30px !important;height:50px', message: 'MAC保存成功!' });
|
|
|
mac.value = setting.value.mac
|
|
mac.value = setting.value.mac
|
|
|
|
|
+ getFrogPosition()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function isValidMacAddress(mac) {
|
|
function isValidMacAddress(mac) {
|
|
@@ -644,13 +667,13 @@ span
|
|
|
|
|
|
|
|
/* 列宽设置 - 确保表头和表体使用相同的宽度 */
|
|
/* 列宽设置 - 确保表头和表体使用相同的宽度 */
|
|
|
.index
|
|
.index
|
|
|
- flex: 0 0 24px
|
|
|
|
|
|
|
+ flex: 0 0 30px
|
|
|
width: 30px
|
|
width: 30px
|
|
|
text-align: center
|
|
text-align: center
|
|
|
|
|
|
|
|
.time
|
|
.time
|
|
|
- flex: 0 0 60px
|
|
|
|
|
- width: 60px
|
|
|
|
|
|
|
+ flex: 0 0 75px
|
|
|
|
|
+ width: 75px
|
|
|
|
|
|
|
|
.operator
|
|
.operator
|
|
|
flex: 0 0 55px
|
|
flex: 0 0 55px
|
|
@@ -791,9 +814,9 @@ span
|
|
|
flex-direction: column
|
|
flex-direction: column
|
|
|
|
|
|
|
|
.info-label
|
|
.info-label
|
|
|
- font-size: 8px
|
|
|
|
|
|
|
+ font-size: 7px
|
|
|
color: #7f8c8d
|
|
color: #7f8c8d
|
|
|
- margin-bottom: 2px
|
|
|
|
|
|
|
+ margin-bottom: 1px
|
|
|
display: flex
|
|
display: flex
|
|
|
align-items: center
|
|
align-items: center
|
|
|
|
|
|
|
@@ -808,8 +831,8 @@ span
|
|
|
|
|
|
|
|
.info-value
|
|
.info-value
|
|
|
font-size: 8px
|
|
font-size: 8px
|
|
|
- font-weight: 500
|
|
|
|
|
- color: #2c3e50
|
|
|
|
|
|
|
+ font-weight: 400
|
|
|
|
|
+ color: #1e1f1f
|
|
|
padding-left: 8px
|
|
padding-left: 8px
|
|
|
|
|
|
|
|
.error-section
|
|
.error-section
|