Compare commits
5 Commits
a8ca4353e7
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| fb5ee8356b | |||
| a24e369ebb | |||
| c17b60dbe0 | |||
| ef873f242f | |||
| 3102b53b3f |
1191
apps/hand-factory/components/scan-coil/scan-coil.vue
Normal file
1191
apps/hand-factory/components/scan-coil/scan-coil.vue
Normal file
File diff suppressed because it is too large
Load Diff
886
apps/hand-factory/components/scan-inspect/scan-inspect.vue
Normal file
886
apps/hand-factory/components/scan-inspect/scan-inspect.vue
Normal file
@@ -0,0 +1,886 @@
|
||||
<template>
|
||||
<view class="inspection-container">
|
||||
<!-- 扫码区域 -->
|
||||
<view class="scan-section" @click="handleScan">
|
||||
<view class="scan-btn">
|
||||
<text class="scan-icon">📷</text>
|
||||
<text class="scan-text">{{ partInfo ? '重新扫码' : '点击扫码' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 加载状态 -->
|
||||
<view v-if="loading" class="loading-state">
|
||||
<uni-load-more status="loading" />
|
||||
</view>
|
||||
|
||||
<!-- 已扫码,显示巡检信息 -->
|
||||
<view v-if="partInfo && !loading" class="content-area">
|
||||
<!-- 部位 + 巡检信息 -->
|
||||
<view class="part-card">
|
||||
<view class="part-fields">
|
||||
<view class="field-row">
|
||||
<text class="field-label">检验部位</text>
|
||||
<text class="field-value">{{ partInfo.inspectPart || '-' }}</text>
|
||||
</view>
|
||||
<view class="field-row">
|
||||
<text class="field-label">产线</text>
|
||||
<text class="field-value">{{ partInfo.productionLine || '-' }}</text>
|
||||
</view>
|
||||
<view class="field-row">
|
||||
<text class="field-label">线别</text>
|
||||
<text class="field-value">{{ partInfo.lineSection || '-' }}</text>
|
||||
</view>
|
||||
<view class="field-row">
|
||||
<text class="field-label">备注</text>
|
||||
<text class="field-value">{{ partInfo.remark || '-' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="inspect-info">
|
||||
<view class="info-item">
|
||||
<text class="info-label">巡检人</text>
|
||||
<text class="info-value">{{ inspector }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">巡检时间</text>
|
||||
<text class="info-value">{{ inspectTime }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 班次选择 -->
|
||||
<view class="shift-section">
|
||||
<text class="shift-label">班次</text>
|
||||
<view class="shift-radio-group">
|
||||
<view class="shift-radio" :class="{ active: shift === 1 }" @click="shift = 1">
|
||||
<text class="shift-radio-dot" />
|
||||
<text>白班</text>
|
||||
</view>
|
||||
<view class="shift-radio" :class="{ active: shift === 2 }" @click="shift = 2">
|
||||
<text class="shift-radio-dot" />
|
||||
<text>夜班</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 待检项列表 -->
|
||||
<view class="checklist-section">
|
||||
<view class="section-title">
|
||||
<text>待检项({{ checklist.length }})</text>
|
||||
</view>
|
||||
|
||||
<view v-if="checklist.length === 0" class="empty-state">
|
||||
<text class="empty-text">该部位暂无待检项</text>
|
||||
</view>
|
||||
|
||||
<view v-for="item in checklist" :key="item.checkId" class="check-item-card">
|
||||
<view class="check-item-info">
|
||||
<text class="check-item-name">{{ item.checkName || item.checkContent || '检验项' }}</text>
|
||||
<text v-if="item.checkContent" class="check-item-content">{{ item.checkContent }}</text>
|
||||
<text v-if="item.standard" class="check-item-standard">标准:{{ item.standard }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 照片 -->
|
||||
<view class="photo-section">
|
||||
<view v-if="uploadingMap[item.checkId]" class="photo-uploading">
|
||||
<uni-load-more status="loading" />
|
||||
</view>
|
||||
<view v-else-if="photoMap[item.checkId]" class="photo-preview" @click="previewPhoto(item.checkId)">
|
||||
<image class="photo-img" :src="photoMap[item.checkId]" mode="aspectFill" />
|
||||
<view class="photo-delete" @click.stop="deletePhoto(item.checkId)">✕</view>
|
||||
</view>
|
||||
<view v-else class="photo-add" @click="choosePhoto(item)">
|
||||
<text class="photo-add-icon">📷</text>
|
||||
<text class="photo-add-text">拍照/选图</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="result-section">
|
||||
<!-- 已选择通过 -->
|
||||
<view v-if="selectedResults[item.checkId] === 1" class="result-row">
|
||||
<view class="result-tag result-pass">
|
||||
<text class="result-icon">✓</text>
|
||||
<text>正常</text>
|
||||
</view>
|
||||
<text class="result-time">{{ getResultTime(item.checkId) }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 已选择不通过 -->
|
||||
<view v-if="selectedResults[item.checkId] === 2" class="result-row">
|
||||
<view class="result-tag result-fail">
|
||||
<text class="result-icon">✕</text>
|
||||
<text>故障</text>
|
||||
</view>
|
||||
<text class="result-time">{{ getResultTime(item.checkId) }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 未选择,显示选择按钮 -->
|
||||
<view v-if="!selectedResults[item.checkId] && !pendingFail[item.checkId]" class="action-btns">
|
||||
<button class="btn btn-pass" :disabled="uploadingMap[item.checkId]"
|
||||
@click="handleResult(item, 1)">正常</button>
|
||||
<button class="btn btn-fail" :disabled="uploadingMap[item.checkId]"
|
||||
@click="handleFailSelect(item)">故障</button>
|
||||
</view>
|
||||
|
||||
<!-- 选择故障后,填写异常描述并提交 -->
|
||||
<view v-if="pendingFail[item.checkId]" class="abnormal-section">
|
||||
<textarea v-model="abnormalDescMap[item.checkId]" class="abnormal-input"
|
||||
placeholder="请输入异常描述(必填)" :maxlength="200" />
|
||||
<view class="abnormal-actions">
|
||||
<button class="btn btn-cancel" @click="cancelFail(item)">取消</button>
|
||||
<button class="btn btn-submit" :disabled="submitting[item.checkId]"
|
||||
@click="handleResult(item, 2)">
|
||||
{{ submitting[item.checkId] ? '提交中...' : '确认故障' }}
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 故障结果展示 -->
|
||||
<view v-if="selectedResults[item.checkId] === 2" class="abnormal-section result-abnormal">
|
||||
<text class="abnormal-label">异常描述:</text>
|
||||
<text class="abnormal-text">{{ abnormalDescMap[item.checkId] || '未填写' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 未扫码初始状态 -->
|
||||
<view v-if="!partInfo && !loading" class="initial-state">
|
||||
<text class="initial-icon">🔍</text>
|
||||
<text class="initial-text">请扫描设备部位二维码开始巡检</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listEquipmentChecklist
|
||||
} from '@/api/wms/equipmentChecklist'
|
||||
import {
|
||||
getEquipmentPart
|
||||
} from '@/api/wms/equipmentPart'
|
||||
import {
|
||||
addEquipmentInspectionRecord
|
||||
} from '@/api/wms/equipmentInspectionRecord'
|
||||
import upload from '@/utils/upload'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusBarHeight: 0,
|
||||
loading: false,
|
||||
partInfo: null,
|
||||
checklist: [],
|
||||
selectedResults: {},
|
||||
resultTimes: {},
|
||||
abnormalDescMap: {},
|
||||
submitting: {},
|
||||
pendingFail: {},
|
||||
shift: 1,
|
||||
inspector: '',
|
||||
inspectTime: '',
|
||||
photoMap: {},
|
||||
uploadingMap: {}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
const systemInfo = uni.getSystemInfoSync()
|
||||
this.statusBarHeight = systemInfo.statusBarHeight || 0
|
||||
|
||||
this.inspector = this.$store.state.user.nickName || this.$store.state.user.name || '未知'
|
||||
this.inspectTime = this.formatTime(new Date())
|
||||
|
||||
const hour = new Date().getHours()
|
||||
this.shift = hour >= 6 && hour < 18 ? 1 : 2
|
||||
console.log('[设备巡检] 初始化 - 巡检人:', this.inspector, '班次:', this.shift, '时间:', this.inspectTime)
|
||||
},
|
||||
methods: {
|
||||
async handleScan() {
|
||||
try {
|
||||
const code = await this.scan()
|
||||
console.log('[设备巡检] 扫码结果:', code)
|
||||
if (!code) return
|
||||
|
||||
if (typeof code !== 'string' || !code.startsWith('eqpPart::')) {
|
||||
uni.showToast({
|
||||
title: '二维码无效,请扫描设备部位二维码',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const partId = code.replace('eqpPart::', '')
|
||||
console.log('[设备巡检] 解析 partId:', partId)
|
||||
if (!partId) {
|
||||
uni.showToast({
|
||||
title: '二维码格式错误',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
this.loading = true
|
||||
this.partInfo = null
|
||||
this.checklist = []
|
||||
this.selectedResults = {}
|
||||
this.resultTimes = {}
|
||||
this.abnormalDescMap = {}
|
||||
this.submitting = {}
|
||||
this.pendingFail = {}
|
||||
this.photoMap = {}
|
||||
this.uploadingMap = {}
|
||||
|
||||
try {
|
||||
console.log('[设备巡检] 请求 getEquipmentPart, partId:', partId)
|
||||
const partRes = await getEquipmentPart(partId)
|
||||
console.log('[设备巡检] getEquipmentPart 响应:', partRes)
|
||||
this.partInfo = partRes.data || { partId }
|
||||
|
||||
console.log('[设备巡检] 请求 listEquipmentChecklist, params:', { partId })
|
||||
const checkRes = await listEquipmentChecklist({ partId })
|
||||
console.log('[设备巡检] listEquipmentChecklist 响应:', checkRes)
|
||||
this.checklist = checkRes.rows || []
|
||||
} catch (err) {
|
||||
console.error('[设备巡检] 获取数据失败:', err)
|
||||
uni.showToast({
|
||||
title: '获取数据失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
} catch (err) {
|
||||
// 用户取消扫码
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
|
||||
scan() {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.scanCode({
|
||||
success(res) {
|
||||
resolve(res.result)
|
||||
},
|
||||
fail() {
|
||||
reject()
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
formatTime(date) {
|
||||
const d = new Date(date)
|
||||
const bj = new Date(d.getTime() + 8 * 60 * 60 * 1000)
|
||||
const y = bj.getUTCFullYear()
|
||||
const M = (bj.getUTCMonth() + 1).toString().padStart(2, '0')
|
||||
const day = bj.getUTCDate().toString().padStart(2, '0')
|
||||
const h = bj.getUTCHours().toString().padStart(2, '0')
|
||||
const m = bj.getUTCMinutes().toString().padStart(2, '0')
|
||||
const s = bj.getUTCSeconds().toString().padStart(2, '0')
|
||||
return y + '-' + M + '-' + day + ' ' + h + ':' + m + ':' + s
|
||||
},
|
||||
|
||||
getResultTime(checkId) {
|
||||
return this.resultTimes[checkId] || ''
|
||||
},
|
||||
|
||||
handleFailSelect(item) {
|
||||
this.pendingFail = {
|
||||
...this.pendingFail,
|
||||
[item.checkId]: true
|
||||
}
|
||||
this.abnormalDescMap = {
|
||||
...this.abnormalDescMap,
|
||||
[item.checkId]: ''
|
||||
}
|
||||
},
|
||||
|
||||
cancelFail(item) {
|
||||
const pending = { ...this.pendingFail }
|
||||
delete pending[item.checkId]
|
||||
this.pendingFail = pending
|
||||
},
|
||||
|
||||
choosePhoto(item) {
|
||||
const checkId = item.checkId
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
sourceType: ['camera', 'album'],
|
||||
success: (res) => {
|
||||
const filePath = res.tempFilePaths[0]
|
||||
this.uploadPhoto(checkId, filePath)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
async uploadPhoto(checkId, filePath) {
|
||||
this.uploadingMap = { ...this.uploadingMap, [checkId]: true }
|
||||
try {
|
||||
console.log('[设备巡检] 上传照片, checkId:', checkId, 'filePath:', filePath)
|
||||
const res = await upload({
|
||||
url: '/system/oss/upload',
|
||||
filePath,
|
||||
name: 'file'
|
||||
})
|
||||
console.log('[设备巡检] 上传照片响应:', res)
|
||||
const url = res.data?.url || res.url || res.data || ''
|
||||
if (!url) {
|
||||
uni.showToast({ title: '上传失败,返回URL为空', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.photoMap = { ...this.photoMap, [checkId]: url }
|
||||
uni.showToast({ title: '照片上传成功', icon: 'success' })
|
||||
} catch (err) {
|
||||
console.error('[设备巡检] 上传照片失败:', err)
|
||||
uni.showToast({ title: '上传照片失败,请重试', icon: 'none' })
|
||||
} finally {
|
||||
this.uploadingMap = { ...this.uploadingMap, [checkId]: false }
|
||||
}
|
||||
},
|
||||
|
||||
deletePhoto(checkId) {
|
||||
const map = { ...this.photoMap }
|
||||
delete map[checkId]
|
||||
this.photoMap = map
|
||||
},
|
||||
|
||||
previewPhoto(checkId) {
|
||||
const url = this.photoMap[checkId]
|
||||
if (url) {
|
||||
uni.previewImage({ urls: [url] })
|
||||
}
|
||||
},
|
||||
|
||||
async handleResult(item, runStatus) {
|
||||
const checkId = item.checkId
|
||||
if (this.submitting[checkId]) return
|
||||
|
||||
console.log('[设备巡检] 提交巡检结果, checkId:', checkId, 'runStatus:', runStatus, 'item:', item)
|
||||
this.submitting = {
|
||||
...this.submitting,
|
||||
[checkId]: true
|
||||
}
|
||||
|
||||
try {
|
||||
const abnormalDesc = runStatus === 2 ? (this.abnormalDescMap[checkId] || '') : ''
|
||||
const now = new Date()
|
||||
const recordData = {
|
||||
checkId,
|
||||
runStatus,
|
||||
abnormalDesc,
|
||||
shift: this.shift,
|
||||
inspector: this.inspector,
|
||||
inspectTime: this.formatTime(now),
|
||||
photo: this.photoMap[checkId] || ''
|
||||
}
|
||||
console.log('[设备巡检] 请求 addEquipmentInspectionRecord, data:', recordData)
|
||||
const recordRes = await addEquipmentInspectionRecord(recordData)
|
||||
console.log('[设备巡检] addEquipmentInspectionRecord 响应:', recordRes)
|
||||
|
||||
const timeStr = now.getHours().toString().padStart(2, '0') + ':' + now.getMinutes().toString()
|
||||
.padStart(2, '0')
|
||||
this.selectedResults = {
|
||||
...this.selectedResults,
|
||||
[checkId]: runStatus
|
||||
}
|
||||
this.resultTimes = {
|
||||
...this.resultTimes,
|
||||
[checkId]: timeStr
|
||||
}
|
||||
|
||||
const pending = { ...this.pendingFail }
|
||||
delete pending[checkId]
|
||||
this.pendingFail = pending
|
||||
|
||||
uni.showToast({
|
||||
title: runStatus === 1 ? '已标记正常' : '已标记故障',
|
||||
icon: 'success'
|
||||
})
|
||||
} catch (err) {
|
||||
console.error('[设备巡检] 提交巡检结果失败:', err)
|
||||
uni.showToast({
|
||||
title: '提交失败,请重试',
|
||||
icon: 'none'
|
||||
})
|
||||
} finally {
|
||||
this.submitting = {
|
||||
...this.submitting,
|
||||
[checkId]: false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.inspection-container {
|
||||
min-height: 100vh;
|
||||
background: #f5f7fa;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.custom-nav-bar {
|
||||
background: #ffffff;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
|
||||
.nav-content {
|
||||
height: 88rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.nav-title {
|
||||
font-size: 34rpx;
|
||||
font-weight: 600;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.scan-section {
|
||||
padding: 40rpx 30rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
.scan-btn {
|
||||
width: 100%;
|
||||
height: 160rpx;
|
||||
background: linear-gradient(135deg, #1a73e8, #4a90d9);
|
||||
border-radius: 16rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0 4rpx 20rpx rgba(26, 115, 232, 0.3);
|
||||
|
||||
.scan-icon {
|
||||
font-size: 48rpx;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.scan-text {
|
||||
font-size: 32rpx;
|
||||
color: #ffffff;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
&:active {
|
||||
opacity: 0.85;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.loading-state {
|
||||
padding: 100rpx 0;
|
||||
}
|
||||
|
||||
.content-area {
|
||||
flex: 1;
|
||||
padding: 0 30rpx;
|
||||
|
||||
.part-card {
|
||||
background: #ffffff;
|
||||
border-radius: 12rpx;
|
||||
padding: 30rpx;
|
||||
margin-bottom: 20rpx;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.06);
|
||||
|
||||
.part-fields {
|
||||
.field-row {
|
||||
display: flex;
|
||||
margin-bottom: 12rpx;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.field-label {
|
||||
font-size: 26rpx;
|
||||
color: #999999;
|
||||
width: 120rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.field-value {
|
||||
font-size: 26rpx;
|
||||
color: #333333;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.inspect-info {
|
||||
display: flex;
|
||||
gap: 40rpx;
|
||||
padding-top: 16rpx;
|
||||
border-top: 1rpx solid #f0f0f0;
|
||||
|
||||
.info-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.info-label {
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
|
||||
.info-value {
|
||||
font-size: 26rpx;
|
||||
color: #333333;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.shift-section {
|
||||
background: #ffffff;
|
||||
border-radius: 12rpx;
|
||||
padding: 24rpx 30rpx;
|
||||
margin-bottom: 20rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.06);
|
||||
|
||||
.shift-label {
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
font-weight: 500;
|
||||
margin-right: 30rpx;
|
||||
}
|
||||
|
||||
.shift-radio-group {
|
||||
display: flex;
|
||||
gap: 24rpx;
|
||||
|
||||
.shift-radio {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 12rpx 24rpx;
|
||||
border-radius: 8rpx;
|
||||
background: #f5f5f5;
|
||||
font-size: 26rpx;
|
||||
color: #666666;
|
||||
|
||||
.shift-radio-dot {
|
||||
width: 18rpx;
|
||||
height: 18rpx;
|
||||
border-radius: 50%;
|
||||
border: 2rpx solid #cccccc;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
&.active {
|
||||
background: #e8f0fe;
|
||||
color: #1a73e8;
|
||||
|
||||
.shift-radio-dot {
|
||||
background: #1a73e8;
|
||||
border-color: #1a73e8;
|
||||
}
|
||||
}
|
||||
|
||||
&:active {
|
||||
opacity: 0.7;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.checklist-section {
|
||||
.section-title {
|
||||
font-size: 28rpx;
|
||||
color: #666666;
|
||||
margin-bottom: 20rpx;
|
||||
padding-left: 10rpx;
|
||||
}
|
||||
|
||||
.check-item-card {
|
||||
background: #ffffff;
|
||||
border-radius: 12rpx;
|
||||
padding: 30rpx;
|
||||
margin-bottom: 20rpx;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.06);
|
||||
|
||||
.check-item-info {
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
.check-item-name {
|
||||
font-size: 30rpx;
|
||||
color: #333333;
|
||||
font-weight: 500;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.check-item-content {
|
||||
font-size: 26rpx;
|
||||
color: #666666;
|
||||
margin-top: 10rpx;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.check-item-standard {
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
margin-top: 8rpx;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
.photo-section {
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
.photo-add {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
background: #f5f5f5;
|
||||
border: 2rpx dashed #cccccc;
|
||||
border-radius: 12rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.photo-add-icon {
|
||||
font-size: 40rpx;
|
||||
margin-bottom: 6rpx;
|
||||
}
|
||||
|
||||
.photo-add-text {
|
||||
font-size: 22rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
&:active {
|
||||
opacity: 0.7;
|
||||
}
|
||||
}
|
||||
|
||||
.photo-uploading {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #f8f8f8;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
|
||||
.photo-preview {
|
||||
position: relative;
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
border-radius: 12rpx;
|
||||
overflow: hidden;
|
||||
|
||||
.photo-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.photo-delete {
|
||||
position: absolute;
|
||||
top: 4rpx;
|
||||
right: 4rpx;
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
line-height: 36rpx;
|
||||
text-align: center;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
color: #ffffff;
|
||||
font-size: 22rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
&:active {
|
||||
opacity: 0.85;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.result-section {
|
||||
.result-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 12rpx 0;
|
||||
|
||||
.result-tag {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10rpx 28rpx;
|
||||
border-radius: 8rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
|
||||
.result-icon {
|
||||
margin-right: 8rpx;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
&.result-pass {
|
||||
background: #e8f5e9;
|
||||
color: #2e7d32;
|
||||
}
|
||||
|
||||
&.result-fail {
|
||||
background: #fbe9e7;
|
||||
color: #c62828;
|
||||
}
|
||||
}
|
||||
|
||||
.result-time {
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
|
||||
.action-btns {
|
||||
display: flex;
|
||||
gap: 20rpx;
|
||||
|
||||
.btn {
|
||||
flex: 1;
|
||||
height: 76rpx;
|
||||
line-height: 76rpx;
|
||||
text-align: center;
|
||||
border-radius: 8rpx;
|
||||
font-size: 28rpx;
|
||||
border: none;
|
||||
|
||||
&::after {
|
||||
border: none;
|
||||
}
|
||||
|
||||
&.btn-pass {
|
||||
background: #e8f5e9;
|
||||
color: #2e7d32;
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.4;
|
||||
}
|
||||
}
|
||||
|
||||
&.btn-fail {
|
||||
background: #fbe9e7;
|
||||
color: #c62828;
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.4;
|
||||
}
|
||||
}
|
||||
|
||||
&:active {
|
||||
opacity: 0.7;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.abnormal-section {
|
||||
margin-top: 20rpx;
|
||||
padding-top: 20rpx;
|
||||
border-top: 1rpx solid #f0f0f0;
|
||||
|
||||
.abnormal-input {
|
||||
width: 100%;
|
||||
min-height: 120rpx;
|
||||
background: #f8f8f8;
|
||||
border-radius: 8rpx;
|
||||
padding: 20rpx;
|
||||
font-size: 26rpx;
|
||||
color: #333333;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.abnormal-actions {
|
||||
display: flex;
|
||||
gap: 20rpx;
|
||||
margin-top: 20rpx;
|
||||
|
||||
.btn {
|
||||
flex: 1;
|
||||
height: 68rpx;
|
||||
line-height: 68rpx;
|
||||
text-align: center;
|
||||
border-radius: 8rpx;
|
||||
font-size: 26rpx;
|
||||
border: none;
|
||||
|
||||
&::after {
|
||||
border: none;
|
||||
}
|
||||
|
||||
&.btn-cancel {
|
||||
background: #f5f5f5;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
&.btn-submit {
|
||||
background: #c62828;
|
||||
color: #ffffff;
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
&:active {
|
||||
opacity: 0.7;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.result-abnormal {
|
||||
border-top: none;
|
||||
margin-top: 0;
|
||||
padding-top: 8rpx;
|
||||
|
||||
.abnormal-label {
|
||||
font-size: 24rpx;
|
||||
color: #c62828;
|
||||
}
|
||||
|
||||
.abnormal-text {
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.initial-state {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 200rpx 0;
|
||||
|
||||
.initial-icon {
|
||||
font-size: 120rpx;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.initial-text {
|
||||
font-size: 30rpx;
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
padding: 60rpx 0;
|
||||
|
||||
.empty-text {
|
||||
font-size: 28rpx;
|
||||
color: #999999;
|
||||
text-align: center;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -9,7 +9,7 @@ module.exports = {
|
||||
// 应用名称
|
||||
name: "ruoyi-app",
|
||||
// 应用版本
|
||||
version: "1.3.31",
|
||||
version: "1.3.34",
|
||||
// 应用logo
|
||||
logo: "/static/logo.jpg",
|
||||
// 官方网站
|
||||
|
||||
@@ -125,6 +125,18 @@
|
||||
"style": {
|
||||
"navigationBarTitleText": "缺陷维护"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/coil-detail/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "钢卷详情"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/scan/scan",
|
||||
"style": {
|
||||
"navigationBarTitleText": "扫码"
|
||||
}
|
||||
}
|
||||
],
|
||||
"globalStyle": {
|
||||
@@ -135,21 +147,15 @@
|
||||
"tabBar": {
|
||||
"selectedColor": "#17abe3",
|
||||
"list": [
|
||||
{
|
||||
"text": "产线",
|
||||
"pagePath": "pages/line/line",
|
||||
"selectedIconPath": "/static/images/tabbar/home_.png",
|
||||
"iconPath": "/static/images/tabbar/home.png"
|
||||
},
|
||||
{
|
||||
"text": "待办",
|
||||
"pagePath": "pages/todo/index",
|
||||
"selectedIconPath": "/static/images/tabbar/todo_.png",
|
||||
"iconPath": "/static/images/tabbar/todo.png"
|
||||
},
|
||||
// {
|
||||
// "text": "待办",
|
||||
// "pagePath": "pages/todo/index",
|
||||
// "selectedIconPath": "/static/images/tabbar/todo_.png",
|
||||
// "iconPath": "/static/images/tabbar/todo.png"
|
||||
// },
|
||||
{
|
||||
"text": "扫码",
|
||||
"pagePath": "pages/easycode/easycode",
|
||||
"pagePath": "pages/scan/scan",
|
||||
"selectedIconPath": "/static/images/tabbar/work_.png",
|
||||
"iconPath": "/static/images/tabbar/work.png"
|
||||
},
|
||||
|
||||
1172
apps/hand-factory/pages/coil-detail/index.vue
Normal file
1172
apps/hand-factory/pages/coil-detail/index.vue
Normal file
File diff suppressed because it is too large
Load Diff
@@ -32,6 +32,20 @@
|
||||
<text class="form-label-optional">逻辑库区</text>
|
||||
<klp-warehouse-picker v-model="searchForm.warehouseId" placeholder="请选择逻辑库区" />
|
||||
</view>
|
||||
<view class="form-item">
|
||||
<text class="form-label-optional">钢卷状态</text>
|
||||
<view class="status-picker">
|
||||
<view
|
||||
v-for="s in statusOptions"
|
||||
:key="s.value"
|
||||
class="status-option"
|
||||
:class="{ 'status-active': searchForm.status === s.value }"
|
||||
@click="searchForm.status = s.value"
|
||||
>
|
||||
<text>{{ s.label }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 查询悬浮按钮 -->
|
||||
@@ -97,30 +111,34 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 异常级别统计卡片 -->
|
||||
<view class="stats-card" v-if="defectList.length > 0">
|
||||
<view class="stat-item" v-for="stat in defectStats" :key="stat.label">
|
||||
<text class="stat-num" :style="{ color: stat.color }">{{ stat.count }}</text>
|
||||
<text class="stat-label">{{ stat.label }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="defectList.length === 0" class="empty-list">
|
||||
<text>该钢卷暂无异常记录</text>
|
||||
</view>
|
||||
|
||||
<view v-for="(item, index) in defectList" :key="item.abnormalId || index" class="defect-card">
|
||||
<view class="defect-card-top">
|
||||
<text class="defect-level" :class="'level-' + (item.abnormalLevel || 'C')">{{ item.abnormalLevel || 'C' }}级</text>
|
||||
<view class="defect-card-top-left">
|
||||
<text class="defect-code-badge">{{ item.defectCode || '-' }}</text>
|
||||
<text class="defect-degree-badge">{{ item.degree || '-' }}</text>
|
||||
<text class="defect-main-badge" v-if="item.mainMark == 1">主缺陷</text>
|
||||
</view>
|
||||
<view class="defect-actions">
|
||||
<text class="action-btn edit-btn" @click="editDefect(item)">编辑</text>
|
||||
<text class="action-btn del-btn" @click="deleteDefect(item)">删除</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="defect-desc">{{ item.abnormalDesc || '暂无描述' }}</view>
|
||||
<view class="defect-desc">{{ item.remark || '暂无描述' }}</view>
|
||||
<view class="defect-meta">
|
||||
<text class="meta-item" v-if="item.plateSurface">板面: {{ item.plateSurface }}</text>
|
||||
<text class="meta-item" v-if="item.position">断面: {{ item.position }}</text>
|
||||
<text class="meta-item" v-if="item.startPosition || item.endPosition">
|
||||
区间: {{ item.startPosition || '?' }}~{{ item.endPosition || '?' }}
|
||||
<text class="meta-unit" v-if="item.length"> (长 {{ item.length }})</text>
|
||||
</text>
|
||||
</view>
|
||||
<!-- 展示图片 -->
|
||||
<view class="defect-images" v-if="item.imgUrl">
|
||||
<image v-for="(url, i) in item.imgUrl.split(',')" :key="i" :src="url" class="defect-img" mode="aspectFill" @click="previewImage(url)"></image>
|
||||
<view class="defect-images" v-if="item.attachmentFiles">
|
||||
<image v-for="(url, i) in item.attachmentFiles.split(',')" :key="i" :src="url" class="defect-img" mode="aspectFill" @click="previewImage(url)"></image>
|
||||
</view>
|
||||
<view class="defect-time">{{ item.createTime || '' }}</view>
|
||||
</view>
|
||||
@@ -151,32 +169,56 @@
|
||||
<input v-model="defectForm.coilNo" class="form-input form-input-disabled" disabled placeholder="自动关联" />
|
||||
</view>
|
||||
|
||||
<!-- 异常描述 -->
|
||||
<!-- 缺陷描述 -->
|
||||
<view class="form-item">
|
||||
<text class="form-label">异常描述 <text class="required">*</text></text>
|
||||
<textarea v-model="defectForm.abnormalDesc" placeholder="请输入异常描述" class="form-textarea" />
|
||||
<text class="form-label">缺陷描述 <text class="required">*</text></text>
|
||||
<textarea v-model="defectForm.remark" placeholder="请输入缺陷描述" class="form-textarea" />
|
||||
</view>
|
||||
|
||||
<!-- 异常级别 -->
|
||||
<!-- 上下板面 -->
|
||||
<view class="form-item">
|
||||
<text class="form-label">异常级别 <text class="required">*</text></text>
|
||||
<view class="level-picker">
|
||||
<view
|
||||
v-for="level in levelOptions"
|
||||
:key="level.value"
|
||||
class="level-option"
|
||||
:class="{ 'level-active': defectForm.abnormalLevel === level.value }"
|
||||
:style="{ borderColor: level.value === defectForm.abnormalLevel ? level.color : '#e8e8e8', color: level.value === defectForm.abnormalLevel ? level.color : '#666' }"
|
||||
@click="defectForm.abnormalLevel = level.value"
|
||||
>
|
||||
<text>{{ level.label }}</text>
|
||||
</view>
|
||||
<text class="form-label">上下板面</text>
|
||||
<uni-data-checkbox multiple v-model="defectForm.plateSurface" :localdata="plateSurfaceOptions" />
|
||||
</view>
|
||||
|
||||
<!-- 断面位置 -->
|
||||
<view class="form-item">
|
||||
<text class="form-label">断面位置</text>
|
||||
<uni-data-checkbox multiple v-model="defectForm.position" :localdata="positionOptions" />
|
||||
<view class="form-tip">异常位置为内圈算起</view>
|
||||
</view>
|
||||
|
||||
<!-- 异常区间 -->
|
||||
<view class="form-item">
|
||||
<text class="form-label">异常区间 <text class="required">*</text></text>
|
||||
<view class="range-row">
|
||||
<input v-model="defectForm.startPosition" type="number" placeholder="开始位置" class="form-input range-input" @blur="calculateLength" />
|
||||
<text class="range-separator">~</text>
|
||||
<input v-model="defectForm.endPosition" type="number" placeholder="结束位置" class="form-input range-input" @blur="calculateLength" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 图片上传 -->
|
||||
<!-- 缺陷代码 -->
|
||||
<view class="form-item">
|
||||
<text class="form-label">现场照片</text>
|
||||
<text class="form-label">缺陷代码 <text class="required">*</text></text>
|
||||
<uni-data-checkbox v-model="defectForm.defectCode" :localdata="defectCodeOptions" />
|
||||
</view>
|
||||
|
||||
<!-- 程度 -->
|
||||
<view class="form-item">
|
||||
<text class="form-label">程度 <text class="required">*</text></text>
|
||||
<uni-data-checkbox v-model="defectForm.degree" :localdata="degreeOptions" />
|
||||
</view>
|
||||
|
||||
<!-- 主缺陷 -->
|
||||
<view class="form-item">
|
||||
<text class="form-label">主缺陷</text>
|
||||
<uni-data-checkbox multiple v-model="mainMarkBind" :localdata="[{text: '是否为主缺陷', value: '1'}]" />
|
||||
</view>
|
||||
|
||||
<!-- 缺陷图片(仅主缺陷时显示) -->
|
||||
<view class="form-item" v-if="defectForm.mainMark === 1">
|
||||
<text class="form-label">缺陷图片</text>
|
||||
<view class="upload-area">
|
||||
<!-- 已上传图片预览 -->
|
||||
<view v-for="(url, i) in uploadedImages" :key="i" class="upload-preview">
|
||||
@@ -190,12 +232,6 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 备注 -->
|
||||
<view class="form-item">
|
||||
<text class="form-label-optional">备注</text>
|
||||
<input v-model="defectForm.remark" placeholder="选填备注" class="form-input" />
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<view class="popup-footer">
|
||||
@@ -225,9 +261,19 @@ export default {
|
||||
itemName: '',
|
||||
itemSpecification: '',
|
||||
itemMaterial: '',
|
||||
warehouseId: ''
|
||||
warehouseId: '',
|
||||
status: '',
|
||||
netWeightStart: '',
|
||||
netWeightEnd: ''
|
||||
},
|
||||
|
||||
// 状态选项
|
||||
statusOptions: [
|
||||
{ label: '全部', value: '' },
|
||||
{ label: '在库', value: '0' },
|
||||
{ label: '已出库', value: '1' }
|
||||
],
|
||||
|
||||
// 分页
|
||||
pager: {
|
||||
pageNum: 1,
|
||||
@@ -242,22 +288,31 @@ export default {
|
||||
// 缺陷列表
|
||||
defectList: [],
|
||||
|
||||
// 缺陷级别选项
|
||||
levelOptions: [
|
||||
{ value: 'A', label: 'A级(严重)', color: '#ff4d4f' },
|
||||
{ value: 'B', label: 'B级(较重)', color: '#fa8c16' },
|
||||
{ value: 'C', label: 'C级(一般)', color: '#fadb14' },
|
||||
{ value: 'D', label: 'D级(轻微)', color: '#52c41a' }
|
||||
// 缺陷代码选项(从字典加载)
|
||||
defectCodeOptions: [],
|
||||
// 断面位置选项(从字典加载)
|
||||
positionOptions: [],
|
||||
// 程度选项(从字典加载)
|
||||
degreeOptions: [],
|
||||
// 上下板面选项
|
||||
plateSurfaceOptions: [
|
||||
{ text: '上板面', value: '上' },
|
||||
{ text: '下板面', value: '下' }
|
||||
],
|
||||
|
||||
// 缺陷表单
|
||||
defectForm: {
|
||||
coilId: '',
|
||||
coilNo: '',
|
||||
abnormalDesc: '',
|
||||
abnormalLevel: 'C',
|
||||
imgUrl: '',
|
||||
remark: ''
|
||||
remark: '',
|
||||
plateSurface: [],
|
||||
position: [],
|
||||
startPosition: undefined,
|
||||
endPosition: undefined,
|
||||
defectCode: '',
|
||||
degree: '',
|
||||
mainMark: 0,
|
||||
attachmentFiles: ''
|
||||
},
|
||||
formMode: 'add', // add | edit
|
||||
editingId: null,
|
||||
@@ -275,19 +330,31 @@ export default {
|
||||
if (this.total === 0) return 0
|
||||
return Math.ceil(this.total / this.pager.pageSize)
|
||||
},
|
||||
// 异常统计
|
||||
// 缺陷代码统计
|
||||
defectStats() {
|
||||
const stats = {}
|
||||
this.levelOptions.forEach(lo => {
|
||||
stats[lo.value] = { label: lo.label, color: lo.color, count: 0 }
|
||||
this.defectCodeOptions.forEach(dco => {
|
||||
stats[dco.value] = { label: dco.label, count: 0 }
|
||||
})
|
||||
this.defectList.forEach(d => {
|
||||
const key = d.abnormalLevel || 'C'
|
||||
const key = d.defectCode || ''
|
||||
if (stats[key]) stats[key].count++
|
||||
})
|
||||
return Object.values(stats)
|
||||
},
|
||||
/** 主缺陷双向绑定(uni-data-checkbox multiple 模式需要数组) */
|
||||
mainMarkBind: {
|
||||
get() {
|
||||
return this.defectForm.mainMark === 1 ? ['1'] : []
|
||||
},
|
||||
set(val) {
|
||||
this.defectForm.mainMark = val.length > 0 ? 1 : 0
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.loadDicts()
|
||||
},
|
||||
methods: {
|
||||
// ========== 钢卷搜索 ==========
|
||||
async searchCoil() {
|
||||
@@ -367,10 +434,15 @@ export default {
|
||||
this.defectForm = {
|
||||
coilId: this.selectedCoil.coilId || '',
|
||||
coilNo: this.selectedCoil.currentCoilNo || '',
|
||||
abnormalDesc: '',
|
||||
abnormalLevel: 'C',
|
||||
imgUrl: '',
|
||||
remark: ''
|
||||
remark: '',
|
||||
plateSurface: [],
|
||||
position: [],
|
||||
startPosition: undefined,
|
||||
endPosition: undefined,
|
||||
defectCode: '',
|
||||
degree: '',
|
||||
mainMark: 0,
|
||||
attachmentFiles: ''
|
||||
}
|
||||
this.uploadedImages = []
|
||||
this.$refs.defectPopup.open()
|
||||
@@ -382,12 +454,17 @@ export default {
|
||||
this.defectForm = {
|
||||
coilId: item.coilId || this.selectedCoil.coilId,
|
||||
coilNo: this.selectedCoil.currentCoilNo || '',
|
||||
abnormalDesc: item.abnormalDesc || '',
|
||||
abnormalLevel: item.abnormalLevel || 'C',
|
||||
imgUrl: item.imgUrl || '',
|
||||
remark: item.remark || ''
|
||||
remark: item.remark || '',
|
||||
plateSurface: item.plateSurface ? item.plateSurface.split(',') : [],
|
||||
position: item.position ? item.position.split(',') : [],
|
||||
startPosition: item.startPosition,
|
||||
endPosition: item.endPosition,
|
||||
defectCode: item.defectCode || '',
|
||||
degree: item.degree || '',
|
||||
mainMark: item.mainMark !== undefined ? item.mainMark : 0,
|
||||
attachmentFiles: item.attachmentFiles || ''
|
||||
}
|
||||
this.uploadedImages = item.imgUrl ? item.imgUrl.split(',').filter(u => u.trim()) : []
|
||||
this.uploadedImages = item.attachmentFiles ? item.attachmentFiles.split(',').filter(u => u.trim()) : []
|
||||
this.$refs.defectPopup.open()
|
||||
},
|
||||
|
||||
@@ -470,9 +547,56 @@ export default {
|
||||
},
|
||||
|
||||
// ========== 提交缺陷表单 ==========
|
||||
/** 计算缺陷长度 */
|
||||
calculateLength() {
|
||||
// 可在 submit 中自动计算
|
||||
},
|
||||
|
||||
/** 加载字典数据 */
|
||||
loadDicts() {
|
||||
this.getDicts('coil_abnormal_code').then(res => {
|
||||
this.defectCodeOptions = (res.data || []).map(item => ({
|
||||
text: item.dictLabel,
|
||||
value: item.dictValue
|
||||
}))
|
||||
})
|
||||
this.getDicts('coil_abnormal_position').then(res => {
|
||||
this.positionOptions = (res.data || []).map(item => ({
|
||||
text: item.dictLabel,
|
||||
value: item.dictValue
|
||||
}))
|
||||
})
|
||||
this.getDicts('coil_abnormal_degree').then(res => {
|
||||
this.degreeOptions = (res.data || []).map(item => ({
|
||||
text: item.dictLabel,
|
||||
value: item.dictValue
|
||||
}))
|
||||
})
|
||||
},
|
||||
|
||||
async submitDefectForm() {
|
||||
if (!this.defectForm.abnormalDesc) {
|
||||
uni.showToast({ title: '请输入异常描述', icon: 'none' })
|
||||
if (!this.defectForm.remark) {
|
||||
uni.showToast({ title: '请输入缺陷描述', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!this.defectForm.defectCode) {
|
||||
uni.showToast({ title: '请选择缺陷代码', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!this.defectForm.degree) {
|
||||
uni.showToast({ title: '请选择程度', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (this.defectForm.startPosition === undefined || this.defectForm.startPosition === '') {
|
||||
uni.showToast({ title: '请输入开始位置', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (this.defectForm.endPosition === undefined || this.defectForm.endPosition === '') {
|
||||
uni.showToast({ title: '请输入结束位置', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (parseInt(this.defectForm.startPosition) > parseInt(this.defectForm.endPosition)) {
|
||||
uni.showToast({ title: '开始位置必须小于结束位置', icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
@@ -480,10 +604,16 @@ export default {
|
||||
try {
|
||||
const formData = {
|
||||
coilId: this.defectForm.coilId,
|
||||
abnormalDesc: this.defectForm.abnormalDesc,
|
||||
abnormalLevel: this.defectForm.abnormalLevel,
|
||||
imgUrl: this.uploadedImages.join(','),
|
||||
remark: this.defectForm.remark
|
||||
remark: this.defectForm.remark,
|
||||
plateSurface: this.defectForm.plateSurface.join(','),
|
||||
position: this.defectForm.position.join(','),
|
||||
startPosition: this.defectForm.startPosition,
|
||||
endPosition: this.defectForm.endPosition,
|
||||
length: this.defectForm.endPosition - this.defectForm.startPosition,
|
||||
defectCode: this.defectForm.defectCode,
|
||||
degree: this.defectForm.degree,
|
||||
mainMark: this.defectForm.mainMark,
|
||||
attachmentFiles: this.uploadedImages.join(',')
|
||||
}
|
||||
|
||||
if (this.formMode === 'add') {
|
||||
@@ -612,13 +742,33 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
// ========== 级别选择器 ==========
|
||||
.level-picker {
|
||||
// ========== uni-data-checkbox 适配 ==========
|
||||
.uni-data-checklist {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
// ========== 范围输入行 ==========
|
||||
.range-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
|
||||
.level-option {
|
||||
.range-input {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.range-separator {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
// ========== 状态选择器 ==========
|
||||
.status-picker {
|
||||
display: flex;
|
||||
gap: 16rpx;
|
||||
|
||||
.status-option {
|
||||
padding: 14rpx 28rpx;
|
||||
border: 2rpx solid #e8e8e8;
|
||||
border-radius: 12rpx;
|
||||
@@ -626,9 +776,77 @@ export default {
|
||||
color: #666;
|
||||
background: #f8f9fa;
|
||||
|
||||
&.level-active {
|
||||
background: #fff;
|
||||
font-weight: 600;
|
||||
&.status-active {
|
||||
background: #e6f7ff;
|
||||
border-color: #1890ff;
|
||||
color: #1890ff;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ========== 提示文字 ==========
|
||||
.form-tip {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
|
||||
// ========== 缺陷代码标识 ==========
|
||||
.defect-code-badge {
|
||||
display: inline-block;
|
||||
padding: 4rpx 16rpx;
|
||||
background: #e6f7ff;
|
||||
border-radius: 8rpx;
|
||||
font-size: 24rpx;
|
||||
color: #1890ff;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.defect-degree-badge {
|
||||
display: inline-block;
|
||||
padding: 4rpx 16rpx;
|
||||
background: #f6ffed;
|
||||
border-radius: 8rpx;
|
||||
font-size: 24rpx;
|
||||
color: #52c41a;
|
||||
font-weight: 500;
|
||||
margin-left: 8rpx;
|
||||
}
|
||||
|
||||
.defect-main-badge {
|
||||
display: inline-block;
|
||||
padding: 4rpx 16rpx;
|
||||
background: #fff7e6;
|
||||
border-radius: 8rpx;
|
||||
font-size: 22rpx;
|
||||
color: #fa8c16;
|
||||
font-weight: 500;
|
||||
margin-left: 8rpx;
|
||||
}
|
||||
|
||||
.defect-card-top-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 6rpx;
|
||||
}
|
||||
|
||||
.defect-meta {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 12rpx;
|
||||
margin-bottom: 12rpx;
|
||||
|
||||
.meta-item {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
background: #f8f9fa;
|
||||
padding: 4rpx 14rpx;
|
||||
border-radius: 6rpx;
|
||||
|
||||
.meta-unit {
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -639,16 +857,16 @@ export default {
|
||||
right: 30rpx;
|
||||
bottom: 60rpx;
|
||||
z-index: 9999;
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
width: 140rpx;
|
||||
height: 140rpx;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #fff;
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.15);
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
box-shadow: 0 8rpx 28rpx rgba(0, 0, 0, 0.2);
|
||||
|
||||
&:active {
|
||||
transform: scale(0.95);
|
||||
@@ -659,12 +877,15 @@ export default {
|
||||
|
||||
.search-btn { background: linear-gradient(135deg, #007aff 0%, #0051d5 100%); }
|
||||
.back-btn { background: linear-gradient(135deg, #666 0%, #333 100%); }
|
||||
.add-btn { background: linear-gradient(135deg, #52c41a 0%, #389e0d 100%); }
|
||||
.add-btn {
|
||||
background: linear-gradient(135deg, #52c41a 0%, #389e0d 100%);
|
||||
font-size: 60rpx;
|
||||
}
|
||||
.back-small-btn {
|
||||
right: 180rpx;
|
||||
width: 90rpx;
|
||||
height: 90rpx;
|
||||
font-size: 36rpx;
|
||||
right: 210rpx;
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
font-size: 48rpx;
|
||||
background: rgba(0,0,0,0.5);
|
||||
}
|
||||
|
||||
@@ -841,12 +1062,13 @@ export default {
|
||||
|
||||
.defect-actions {
|
||||
display: flex;
|
||||
gap: 16rpx;
|
||||
gap: 20rpx;
|
||||
|
||||
.action-btn {
|
||||
font-size: 24rpx;
|
||||
padding: 4rpx 16rpx;
|
||||
border-radius: 8rpx;
|
||||
font-size: 28rpx;
|
||||
padding: 12rpx 28rpx;
|
||||
border-radius: 10rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.edit-btn { background: #e6f7ff; color: #1890ff; }
|
||||
@@ -942,7 +1164,7 @@ export default {
|
||||
.popup-wrap {
|
||||
background: #fff;
|
||||
border-radius: 24rpx 24rpx 0 0;
|
||||
max-height: 80vh;
|
||||
max-height: 92vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<!-- 分条操作区 -->
|
||||
<view class="section-card split-section">
|
||||
<!-- <view class="section-card split-section">
|
||||
<view class="section-title">
|
||||
<text class="title-icon">✂️</text>
|
||||
<text class="title-text">分条操作</text>
|
||||
@@ -12,10 +12,10 @@
|
||||
{{ item.dictLabel }}
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<!-- 其他操作区 -->
|
||||
<view class="section-card other-section">
|
||||
<!-- <view class="section-card other-section">
|
||||
<view class="section-title">
|
||||
<text class="title-icon">🔧</text>
|
||||
<text class="title-text">其他操作</text>
|
||||
@@ -26,7 +26,7 @@
|
||||
{{ item.dictLabel }}
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<!-- 快捷操作区 -->
|
||||
<view class="section-card quick-section">
|
||||
@@ -39,7 +39,7 @@
|
||||
<button class="type-btn cancelship-btn" @click="handleCancelShip">撤回发货</button>
|
||||
<button class="type-btn move-btn" @click="handleTranfer">移库</button>
|
||||
<button class="type-btn see-btn" @click="handleSee">查看存储钢卷</button>
|
||||
<button class="type-btn packing-btn" @click="handlePack">打包</button>
|
||||
<!-- <button class="type-btn packing-btn" @click="handlePack">打包</button> -->
|
||||
<button class="type-btn release-btn" @click="handleRelease">释放库位</button>
|
||||
</view>
|
||||
</view>
|
||||
@@ -346,7 +346,7 @@
|
||||
if (res.rows.length == 1) {
|
||||
const coilId = res.rows[0].coilId;
|
||||
uni.navigateTo({
|
||||
url: '/pages/easycode/editby?coilId=' + coilId
|
||||
url: '/pages/coil-detail/index?coilId=' + coilId
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getMaterialCoil, updateMaterialCoil } from '@/api/wms/coil';
|
||||
import { getMaterialCoil, updateMaterialCoilSimple } from '@/api/wms/coil';
|
||||
import { addPendingAction } from '@/api/wms/pendingAction';
|
||||
|
||||
export default {
|
||||
@@ -151,7 +151,7 @@
|
||||
this.loading = true;
|
||||
// 1. 更新钢卷
|
||||
console.log('待提交数据', this.form)
|
||||
await updateMaterialCoil(this.form)
|
||||
await updateMaterialCoilSimple(this.form)
|
||||
// 2. 创建操作记录
|
||||
await addPendingAction({
|
||||
actionType: 404,
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getMaterialCoil, updateMaterialCoil } from '@/api/wms/coil';
|
||||
import { getMaterialCoil, updateMaterialCoilSimple } from '@/api/wms/coil';
|
||||
import { addPendingAction } from '@/api/wms/pendingAction';
|
||||
|
||||
export default {
|
||||
@@ -157,7 +157,7 @@
|
||||
this.loading = true;
|
||||
// 1. 更新钢卷
|
||||
console.log('待提交数据', this.form)
|
||||
await updateMaterialCoil(this.form)
|
||||
await updateMaterialCoilSimple(this.form)
|
||||
// 2. 创建操作记录
|
||||
await addPendingAction({
|
||||
actionType: 405, // 405表示打包
|
||||
|
||||
@@ -1,886 +1,15 @@
|
||||
<template>
|
||||
<view class="inspection-container">
|
||||
<!-- 扫码区域 -->
|
||||
<view class="scan-section" @click="handleScan">
|
||||
<view class="scan-btn">
|
||||
<text class="scan-icon">📷</text>
|
||||
<text class="scan-text">{{ partInfo ? '重新扫码' : '点击扫码' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 加载状态 -->
|
||||
<view v-if="loading" class="loading-state">
|
||||
<uni-load-more status="loading" />
|
||||
</view>
|
||||
|
||||
<!-- 已扫码,显示巡检信息 -->
|
||||
<view v-if="partInfo && !loading" class="content-area">
|
||||
<!-- 部位 + 巡检信息 -->
|
||||
<view class="part-card">
|
||||
<view class="part-fields">
|
||||
<view class="field-row">
|
||||
<text class="field-label">检验部位</text>
|
||||
<text class="field-value">{{ partInfo.inspectPart || '-' }}</text>
|
||||
</view>
|
||||
<view class="field-row">
|
||||
<text class="field-label">产线</text>
|
||||
<text class="field-value">{{ partInfo.productionLine || '-' }}</text>
|
||||
</view>
|
||||
<view class="field-row">
|
||||
<text class="field-label">线别</text>
|
||||
<text class="field-value">{{ partInfo.lineSection || '-' }}</text>
|
||||
</view>
|
||||
<view class="field-row">
|
||||
<text class="field-label">备注</text>
|
||||
<text class="field-value">{{ partInfo.remark || '-' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="inspect-info">
|
||||
<view class="info-item">
|
||||
<text class="info-label">巡检人</text>
|
||||
<text class="info-value">{{ inspector }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="info-label">巡检时间</text>
|
||||
<text class="info-value">{{ inspectTime }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 班次选择 -->
|
||||
<view class="shift-section">
|
||||
<text class="shift-label">班次</text>
|
||||
<view class="shift-radio-group">
|
||||
<view class="shift-radio" :class="{ active: shift === 1 }" @click="shift = 1">
|
||||
<text class="shift-radio-dot" />
|
||||
<text>白班</text>
|
||||
</view>
|
||||
<view class="shift-radio" :class="{ active: shift === 2 }" @click="shift = 2">
|
||||
<text class="shift-radio-dot" />
|
||||
<text>夜班</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 待检项列表 -->
|
||||
<view class="checklist-section">
|
||||
<view class="section-title">
|
||||
<text>待检项({{ checklist.length }})</text>
|
||||
</view>
|
||||
|
||||
<view v-if="checklist.length === 0" class="empty-state">
|
||||
<text class="empty-text">该部位暂无待检项</text>
|
||||
</view>
|
||||
|
||||
<view v-for="item in checklist" :key="item.checkId" class="check-item-card">
|
||||
<view class="check-item-info">
|
||||
<text class="check-item-name">{{ item.checkName || item.checkContent || '检验项' }}</text>
|
||||
<text v-if="item.checkContent" class="check-item-content">{{ item.checkContent }}</text>
|
||||
<text v-if="item.standard" class="check-item-standard">标准:{{ item.standard }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 照片 -->
|
||||
<view class="photo-section">
|
||||
<view v-if="uploadingMap[item.checkId]" class="photo-uploading">
|
||||
<uni-load-more status="loading" />
|
||||
</view>
|
||||
<view v-else-if="photoMap[item.checkId]" class="photo-preview" @click="previewPhoto(item.checkId)">
|
||||
<image class="photo-img" :src="photoMap[item.checkId]" mode="aspectFill" />
|
||||
<view class="photo-delete" @click.stop="deletePhoto(item.checkId)">✕</view>
|
||||
</view>
|
||||
<view v-else class="photo-add" @click="choosePhoto(item)">
|
||||
<text class="photo-add-icon">📷</text>
|
||||
<text class="photo-add-text">拍照/选图</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="result-section">
|
||||
<!-- 已选择通过 -->
|
||||
<view v-if="selectedResults[item.checkId] === 1" class="result-row">
|
||||
<view class="result-tag result-pass">
|
||||
<text class="result-icon">✓</text>
|
||||
<text>正常</text>
|
||||
</view>
|
||||
<text class="result-time">{{ getResultTime(item.checkId) }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 已选择不通过 -->
|
||||
<view v-if="selectedResults[item.checkId] === 2" class="result-row">
|
||||
<view class="result-tag result-fail">
|
||||
<text class="result-icon">✕</text>
|
||||
<text>故障</text>
|
||||
</view>
|
||||
<text class="result-time">{{ getResultTime(item.checkId) }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 未选择,显示选择按钮 -->
|
||||
<view v-if="!selectedResults[item.checkId] && !pendingFail[item.checkId]" class="action-btns">
|
||||
<button class="btn btn-pass" :disabled="uploadingMap[item.checkId]"
|
||||
@click="handleResult(item, 1)">正常</button>
|
||||
<button class="btn btn-fail" :disabled="uploadingMap[item.checkId]"
|
||||
@click="handleFailSelect(item)">故障</button>
|
||||
</view>
|
||||
|
||||
<!-- 选择故障后,填写异常描述并提交 -->
|
||||
<view v-if="pendingFail[item.checkId]" class="abnormal-section">
|
||||
<textarea v-model="abnormalDescMap[item.checkId]" class="abnormal-input"
|
||||
placeholder="请输入异常描述(必填)" :maxlength="200" />
|
||||
<view class="abnormal-actions">
|
||||
<button class="btn btn-cancel" @click="cancelFail(item)">取消</button>
|
||||
<button class="btn btn-submit" :disabled="submitting[item.checkId]"
|
||||
@click="handleResult(item, 2)">
|
||||
{{ submitting[item.checkId] ? '提交中...' : '确认故障' }}
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 故障结果展示 -->
|
||||
<view v-if="selectedResults[item.checkId] === 2" class="abnormal-section result-abnormal">
|
||||
<text class="abnormal-label">异常描述:</text>
|
||||
<text class="abnormal-text">{{ abnormalDescMap[item.checkId] || '未填写' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 未扫码初始状态 -->
|
||||
<view v-if="!partInfo && !loading" class="initial-state">
|
||||
<text class="initial-icon">🔍</text>
|
||||
<text class="initial-text">请扫描设备部位二维码开始巡检</text>
|
||||
</view>
|
||||
<view class="">
|
||||
<ScanInspect />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listEquipmentChecklist
|
||||
} from '@/api/wms/equipmentChecklist'
|
||||
import {
|
||||
getEquipmentPart
|
||||
} from '@/api/wms/equipmentPart'
|
||||
import {
|
||||
addEquipmentInspectionRecord
|
||||
} from '@/api/wms/equipmentInspectionRecord'
|
||||
import upload from '@/utils/upload'
|
||||
|
||||
import ScanInspect from '@/components/scan-inspect/scan-inspect.vue'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
statusBarHeight: 0,
|
||||
loading: false,
|
||||
partInfo: null,
|
||||
checklist: [],
|
||||
selectedResults: {},
|
||||
resultTimes: {},
|
||||
abnormalDescMap: {},
|
||||
submitting: {},
|
||||
pendingFail: {},
|
||||
shift: 1,
|
||||
inspector: '',
|
||||
inspectTime: '',
|
||||
photoMap: {},
|
||||
uploadingMap: {}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
const systemInfo = uni.getSystemInfoSync()
|
||||
this.statusBarHeight = systemInfo.statusBarHeight || 0
|
||||
|
||||
this.inspector = this.$store.state.user.nickName || this.$store.state.user.name || '未知'
|
||||
this.inspectTime = this.formatTime(new Date())
|
||||
|
||||
const hour = new Date().getHours()
|
||||
this.shift = hour >= 6 && hour < 18 ? 1 : 2
|
||||
console.log('[设备巡检] 初始化 - 巡检人:', this.inspector, '班次:', this.shift, '时间:', this.inspectTime)
|
||||
},
|
||||
methods: {
|
||||
async handleScan() {
|
||||
try {
|
||||
const code = await this.scan()
|
||||
console.log('[设备巡检] 扫码结果:', code)
|
||||
if (!code) return
|
||||
|
||||
if (typeof code !== 'string' || !code.startsWith('eqpPart::')) {
|
||||
uni.showToast({
|
||||
title: '二维码无效,请扫描设备部位二维码',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const partId = code.replace('eqpPart::', '')
|
||||
console.log('[设备巡检] 解析 partId:', partId)
|
||||
if (!partId) {
|
||||
uni.showToast({
|
||||
title: '二维码格式错误',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
this.loading = true
|
||||
this.partInfo = null
|
||||
this.checklist = []
|
||||
this.selectedResults = {}
|
||||
this.resultTimes = {}
|
||||
this.abnormalDescMap = {}
|
||||
this.submitting = {}
|
||||
this.pendingFail = {}
|
||||
this.photoMap = {}
|
||||
this.uploadingMap = {}
|
||||
|
||||
try {
|
||||
console.log('[设备巡检] 请求 getEquipmentPart, partId:', partId)
|
||||
const partRes = await getEquipmentPart(partId)
|
||||
console.log('[设备巡检] getEquipmentPart 响应:', partRes)
|
||||
this.partInfo = partRes.data || { partId }
|
||||
|
||||
console.log('[设备巡检] 请求 listEquipmentChecklist, params:', { partId })
|
||||
const checkRes = await listEquipmentChecklist({ partId })
|
||||
console.log('[设备巡检] listEquipmentChecklist 响应:', checkRes)
|
||||
this.checklist = checkRes.rows || []
|
||||
} catch (err) {
|
||||
console.error('[设备巡检] 获取数据失败:', err)
|
||||
uni.showToast({
|
||||
title: '获取数据失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
} catch (err) {
|
||||
// 用户取消扫码
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
|
||||
scan() {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.scanCode({
|
||||
success(res) {
|
||||
resolve(res.result)
|
||||
},
|
||||
fail() {
|
||||
reject()
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
formatTime(date) {
|
||||
const d = new Date(date)
|
||||
const bj = new Date(d.getTime() + 8 * 60 * 60 * 1000)
|
||||
const y = bj.getUTCFullYear()
|
||||
const M = (bj.getUTCMonth() + 1).toString().padStart(2, '0')
|
||||
const day = bj.getUTCDate().toString().padStart(2, '0')
|
||||
const h = bj.getUTCHours().toString().padStart(2, '0')
|
||||
const m = bj.getUTCMinutes().toString().padStart(2, '0')
|
||||
const s = bj.getUTCSeconds().toString().padStart(2, '0')
|
||||
return y + '-' + M + '-' + day + ' ' + h + ':' + m + ':' + s
|
||||
},
|
||||
|
||||
getResultTime(checkId) {
|
||||
return this.resultTimes[checkId] || ''
|
||||
},
|
||||
|
||||
handleFailSelect(item) {
|
||||
this.pendingFail = {
|
||||
...this.pendingFail,
|
||||
[item.checkId]: true
|
||||
}
|
||||
this.abnormalDescMap = {
|
||||
...this.abnormalDescMap,
|
||||
[item.checkId]: ''
|
||||
}
|
||||
},
|
||||
|
||||
cancelFail(item) {
|
||||
const pending = { ...this.pendingFail }
|
||||
delete pending[item.checkId]
|
||||
this.pendingFail = pending
|
||||
},
|
||||
|
||||
choosePhoto(item) {
|
||||
const checkId = item.checkId
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
sourceType: ['camera', 'album'],
|
||||
success: (res) => {
|
||||
const filePath = res.tempFilePaths[0]
|
||||
this.uploadPhoto(checkId, filePath)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
async uploadPhoto(checkId, filePath) {
|
||||
this.uploadingMap = { ...this.uploadingMap, [checkId]: true }
|
||||
try {
|
||||
console.log('[设备巡检] 上传照片, checkId:', checkId, 'filePath:', filePath)
|
||||
const res = await upload({
|
||||
url: '/system/oss/upload',
|
||||
filePath,
|
||||
name: 'file'
|
||||
})
|
||||
console.log('[设备巡检] 上传照片响应:', res)
|
||||
const url = res.data?.url || res.url || res.data || ''
|
||||
if (!url) {
|
||||
uni.showToast({ title: '上传失败,返回URL为空', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.photoMap = { ...this.photoMap, [checkId]: url }
|
||||
uni.showToast({ title: '照片上传成功', icon: 'success' })
|
||||
} catch (err) {
|
||||
console.error('[设备巡检] 上传照片失败:', err)
|
||||
uni.showToast({ title: '上传照片失败,请重试', icon: 'none' })
|
||||
} finally {
|
||||
this.uploadingMap = { ...this.uploadingMap, [checkId]: false }
|
||||
}
|
||||
},
|
||||
|
||||
deletePhoto(checkId) {
|
||||
const map = { ...this.photoMap }
|
||||
delete map[checkId]
|
||||
this.photoMap = map
|
||||
},
|
||||
|
||||
previewPhoto(checkId) {
|
||||
const url = this.photoMap[checkId]
|
||||
if (url) {
|
||||
uni.previewImage({ urls: [url] })
|
||||
}
|
||||
},
|
||||
|
||||
async handleResult(item, runStatus) {
|
||||
const checkId = item.checkId
|
||||
if (this.submitting[checkId]) return
|
||||
|
||||
console.log('[设备巡检] 提交巡检结果, checkId:', checkId, 'runStatus:', runStatus, 'item:', item)
|
||||
this.submitting = {
|
||||
...this.submitting,
|
||||
[checkId]: true
|
||||
}
|
||||
|
||||
try {
|
||||
const abnormalDesc = runStatus === 2 ? (this.abnormalDescMap[checkId] || '') : ''
|
||||
const now = new Date()
|
||||
const recordData = {
|
||||
checkId,
|
||||
runStatus,
|
||||
abnormalDesc,
|
||||
shift: this.shift,
|
||||
inspector: this.inspector,
|
||||
inspectTime: this.formatTime(now),
|
||||
photo: this.photoMap[checkId] || ''
|
||||
}
|
||||
console.log('[设备巡检] 请求 addEquipmentInspectionRecord, data:', recordData)
|
||||
const recordRes = await addEquipmentInspectionRecord(recordData)
|
||||
console.log('[设备巡检] addEquipmentInspectionRecord 响应:', recordRes)
|
||||
|
||||
const timeStr = now.getHours().toString().padStart(2, '0') + ':' + now.getMinutes().toString()
|
||||
.padStart(2, '0')
|
||||
this.selectedResults = {
|
||||
...this.selectedResults,
|
||||
[checkId]: runStatus
|
||||
}
|
||||
this.resultTimes = {
|
||||
...this.resultTimes,
|
||||
[checkId]: timeStr
|
||||
}
|
||||
|
||||
const pending = { ...this.pendingFail }
|
||||
delete pending[checkId]
|
||||
this.pendingFail = pending
|
||||
|
||||
uni.showToast({
|
||||
title: runStatus === 1 ? '已标记正常' : '已标记故障',
|
||||
icon: 'success'
|
||||
})
|
||||
} catch (err) {
|
||||
console.error('[设备巡检] 提交巡检结果失败:', err)
|
||||
uni.showToast({
|
||||
title: '提交失败,请重试',
|
||||
icon: 'none'
|
||||
})
|
||||
} finally {
|
||||
this.submitting = {
|
||||
...this.submitting,
|
||||
[checkId]: false
|
||||
}
|
||||
}
|
||||
}
|
||||
components: {
|
||||
ScanInspect
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.inspection-container {
|
||||
min-height: 100vh;
|
||||
background: #f5f7fa;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.custom-nav-bar {
|
||||
background: #ffffff;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
|
||||
.nav-content {
|
||||
height: 88rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.nav-title {
|
||||
font-size: 34rpx;
|
||||
font-weight: 600;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.scan-section {
|
||||
padding: 40rpx 30rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
.scan-btn {
|
||||
width: 100%;
|
||||
height: 160rpx;
|
||||
background: linear-gradient(135deg, #1a73e8, #4a90d9);
|
||||
border-radius: 16rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0 4rpx 20rpx rgba(26, 115, 232, 0.3);
|
||||
|
||||
.scan-icon {
|
||||
font-size: 48rpx;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.scan-text {
|
||||
font-size: 32rpx;
|
||||
color: #ffffff;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
&:active {
|
||||
opacity: 0.85;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.loading-state {
|
||||
padding: 100rpx 0;
|
||||
}
|
||||
|
||||
.content-area {
|
||||
flex: 1;
|
||||
padding: 0 30rpx;
|
||||
|
||||
.part-card {
|
||||
background: #ffffff;
|
||||
border-radius: 12rpx;
|
||||
padding: 30rpx;
|
||||
margin-bottom: 20rpx;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.06);
|
||||
|
||||
.part-fields {
|
||||
.field-row {
|
||||
display: flex;
|
||||
margin-bottom: 12rpx;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.field-label {
|
||||
font-size: 26rpx;
|
||||
color: #999999;
|
||||
width: 120rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.field-value {
|
||||
font-size: 26rpx;
|
||||
color: #333333;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.inspect-info {
|
||||
display: flex;
|
||||
gap: 40rpx;
|
||||
padding-top: 16rpx;
|
||||
border-top: 1rpx solid #f0f0f0;
|
||||
|
||||
.info-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.info-label {
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
|
||||
.info-value {
|
||||
font-size: 26rpx;
|
||||
color: #333333;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.shift-section {
|
||||
background: #ffffff;
|
||||
border-radius: 12rpx;
|
||||
padding: 24rpx 30rpx;
|
||||
margin-bottom: 20rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.06);
|
||||
|
||||
.shift-label {
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
font-weight: 500;
|
||||
margin-right: 30rpx;
|
||||
}
|
||||
|
||||
.shift-radio-group {
|
||||
display: flex;
|
||||
gap: 24rpx;
|
||||
|
||||
.shift-radio {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 12rpx 24rpx;
|
||||
border-radius: 8rpx;
|
||||
background: #f5f5f5;
|
||||
font-size: 26rpx;
|
||||
color: #666666;
|
||||
|
||||
.shift-radio-dot {
|
||||
width: 18rpx;
|
||||
height: 18rpx;
|
||||
border-radius: 50%;
|
||||
border: 2rpx solid #cccccc;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
&.active {
|
||||
background: #e8f0fe;
|
||||
color: #1a73e8;
|
||||
|
||||
.shift-radio-dot {
|
||||
background: #1a73e8;
|
||||
border-color: #1a73e8;
|
||||
}
|
||||
}
|
||||
|
||||
&:active {
|
||||
opacity: 0.7;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.checklist-section {
|
||||
.section-title {
|
||||
font-size: 28rpx;
|
||||
color: #666666;
|
||||
margin-bottom: 20rpx;
|
||||
padding-left: 10rpx;
|
||||
}
|
||||
|
||||
.check-item-card {
|
||||
background: #ffffff;
|
||||
border-radius: 12rpx;
|
||||
padding: 30rpx;
|
||||
margin-bottom: 20rpx;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.06);
|
||||
|
||||
.check-item-info {
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
.check-item-name {
|
||||
font-size: 30rpx;
|
||||
color: #333333;
|
||||
font-weight: 500;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.check-item-content {
|
||||
font-size: 26rpx;
|
||||
color: #666666;
|
||||
margin-top: 10rpx;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.check-item-standard {
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
margin-top: 8rpx;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
.photo-section {
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
.photo-add {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
background: #f5f5f5;
|
||||
border: 2rpx dashed #cccccc;
|
||||
border-radius: 12rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.photo-add-icon {
|
||||
font-size: 40rpx;
|
||||
margin-bottom: 6rpx;
|
||||
}
|
||||
|
||||
.photo-add-text {
|
||||
font-size: 22rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
&:active {
|
||||
opacity: 0.7;
|
||||
}
|
||||
}
|
||||
|
||||
.photo-uploading {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #f8f8f8;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
|
||||
.photo-preview {
|
||||
position: relative;
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
border-radius: 12rpx;
|
||||
overflow: hidden;
|
||||
|
||||
.photo-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.photo-delete {
|
||||
position: absolute;
|
||||
top: 4rpx;
|
||||
right: 4rpx;
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
line-height: 36rpx;
|
||||
text-align: center;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
color: #ffffff;
|
||||
font-size: 22rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
&:active {
|
||||
opacity: 0.85;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.result-section {
|
||||
.result-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 12rpx 0;
|
||||
|
||||
.result-tag {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10rpx 28rpx;
|
||||
border-radius: 8rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
|
||||
.result-icon {
|
||||
margin-right: 8rpx;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
&.result-pass {
|
||||
background: #e8f5e9;
|
||||
color: #2e7d32;
|
||||
}
|
||||
|
||||
&.result-fail {
|
||||
background: #fbe9e7;
|
||||
color: #c62828;
|
||||
}
|
||||
}
|
||||
|
||||
.result-time {
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
|
||||
.action-btns {
|
||||
display: flex;
|
||||
gap: 20rpx;
|
||||
|
||||
.btn {
|
||||
flex: 1;
|
||||
height: 76rpx;
|
||||
line-height: 76rpx;
|
||||
text-align: center;
|
||||
border-radius: 8rpx;
|
||||
font-size: 28rpx;
|
||||
border: none;
|
||||
|
||||
&::after {
|
||||
border: none;
|
||||
}
|
||||
|
||||
&.btn-pass {
|
||||
background: #e8f5e9;
|
||||
color: #2e7d32;
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.4;
|
||||
}
|
||||
}
|
||||
|
||||
&.btn-fail {
|
||||
background: #fbe9e7;
|
||||
color: #c62828;
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.4;
|
||||
}
|
||||
}
|
||||
|
||||
&:active {
|
||||
opacity: 0.7;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.abnormal-section {
|
||||
margin-top: 20rpx;
|
||||
padding-top: 20rpx;
|
||||
border-top: 1rpx solid #f0f0f0;
|
||||
|
||||
.abnormal-input {
|
||||
width: 100%;
|
||||
min-height: 120rpx;
|
||||
background: #f8f8f8;
|
||||
border-radius: 8rpx;
|
||||
padding: 20rpx;
|
||||
font-size: 26rpx;
|
||||
color: #333333;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.abnormal-actions {
|
||||
display: flex;
|
||||
gap: 20rpx;
|
||||
margin-top: 20rpx;
|
||||
|
||||
.btn {
|
||||
flex: 1;
|
||||
height: 68rpx;
|
||||
line-height: 68rpx;
|
||||
text-align: center;
|
||||
border-radius: 8rpx;
|
||||
font-size: 26rpx;
|
||||
border: none;
|
||||
|
||||
&::after {
|
||||
border: none;
|
||||
}
|
||||
|
||||
&.btn-cancel {
|
||||
background: #f5f5f5;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
&.btn-submit {
|
||||
background: #c62828;
|
||||
color: #ffffff;
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
&:active {
|
||||
opacity: 0.7;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.result-abnormal {
|
||||
border-top: none;
|
||||
margin-top: 0;
|
||||
padding-top: 8rpx;
|
||||
|
||||
.abnormal-label {
|
||||
font-size: 24rpx;
|
||||
color: #c62828;
|
||||
}
|
||||
|
||||
.abnormal-text {
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.initial-state {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 200rpx 0;
|
||||
|
||||
.initial-icon {
|
||||
font-size: 120rpx;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.initial-text {
|
||||
font-size: 30rpx;
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
padding: 60rpx 0;
|
||||
|
||||
.empty-text {
|
||||
font-size: 28rpx;
|
||||
color: #999999;
|
||||
text-align: center;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</script>
|
||||
@@ -6,132 +6,26 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
tabVisible: {
|
||||
admin: [true, true, true, false, true, true],
|
||||
canteen: [false, false, false, true, false, true],
|
||||
worker: [false, true, true, false, true, true]
|
||||
},
|
||||
hasJumped: false, // 防止重复跳转的标记
|
||||
hasJumped: false,
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
// 已跳转过则不再执行逻辑
|
||||
if (this.hasJumped) return;
|
||||
|
||||
// 检查用户角色
|
||||
this.$store.dispatch('GetInfo')
|
||||
.then(res => {
|
||||
// 验证返回数据格式
|
||||
if (!res || !res.data || !Array.isArray(res.data.roles)) {
|
||||
throw new Error('用户角色信息格式错误');
|
||||
}
|
||||
|
||||
console.log('用户角色信息', res.data.roles)
|
||||
|
||||
const roles = res.data.roles;
|
||||
|
||||
if (roles.includes('admin')) {
|
||||
for (let i = 0; i < this.tabVisible.admin.length; i++) {
|
||||
const v = this.tabVisible.admin[i]
|
||||
uni.setTabBarItem({
|
||||
index: i,
|
||||
visible: v
|
||||
});
|
||||
}
|
||||
// 管理员角色跳转
|
||||
uni.switchTab({
|
||||
url: '/pages/line/line',
|
||||
success: () => {
|
||||
this.hasJumped = true; // 标记已跳转
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('管理员页面跳转失败:', err);
|
||||
uni.showToast({
|
||||
title: '跳转产线页面失败',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
});
|
||||
} else if (roles.includes('canteen')) {
|
||||
for (let i = 0; i < this.tabVisible.canteen.length; i++) {
|
||||
const v = this.tabVisible.canteen[i]
|
||||
uni.setTabBarItem({
|
||||
index: i,
|
||||
visible: v
|
||||
});
|
||||
}
|
||||
// 食堂角色跳转
|
||||
uni.switchTab({
|
||||
url: '/pages/meal/meal',
|
||||
success: () => {
|
||||
this.hasJumped = true; // 标记已跳转
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('管理员页面跳转失败:', err);
|
||||
uni.showToast({
|
||||
title: '跳转产线页面失败',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
});
|
||||
} else if (roles.includes('worker')) {
|
||||
// 工人角色跳转
|
||||
// 设置tab内容
|
||||
// 设置产线和复杂扫码不可见
|
||||
for (let i = 0; i < this.tabVisible.worker.length; i++) {
|
||||
const v = this.tabVisible.worker[i]
|
||||
uni.setTabBarItem({
|
||||
index: i,
|
||||
visible: v
|
||||
});
|
||||
}
|
||||
uni.switchTab({
|
||||
url: '/pages/easycode/easycode',
|
||||
success: () => {
|
||||
this.hasJumped = true; // 标记已跳转
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('工人页面跳转失败:', err);
|
||||
uni.showToast({
|
||||
title: '跳转扫码页面失败',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
for (let i = 0; i < this.tabVisible.worker.length; i++) {
|
||||
const v = this.tabVisible.worker[i]
|
||||
uni.setTabBarItem({
|
||||
index: i,
|
||||
visible: v
|
||||
});
|
||||
}
|
||||
// 延迟跳转,确保提示被用户看到
|
||||
setTimeout(() => {
|
||||
uni.switchTab({
|
||||
url: '/pages/easycode/easycode',
|
||||
success: () => {
|
||||
this.hasJumped = true;
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('默认角色页面跳转失败:', err);
|
||||
uni.showToast({
|
||||
title: '跳转默认页面失败',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
});
|
||||
}, 2000);
|
||||
}
|
||||
.then(() => {
|
||||
uni.switchTab({
|
||||
url: '/pages/scan/scan',
|
||||
success: () => {
|
||||
this.hasJumped = true;
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('跳转失败:', err);
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
uni.reLaunch({
|
||||
url: '/pages/login'
|
||||
})
|
||||
.catch(() => {
|
||||
uni.reLaunch({ url: '/pages/login' })
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,12 +33,19 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="list-cell list-cell-arrow" @click="handleToEqp">
|
||||
<!-- <view class="list-cell list-cell-arrow" @click="handleToEqp">
|
||||
<view class="menu-item-box">
|
||||
<view class="iconfont icon-setting menu-icon"></view>
|
||||
<view>设备巡检</view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<!-- <view class="list-cell list-cell-arrow" @click="handleToAb">
|
||||
<view class="menu-item-box">
|
||||
<view class="iconfont icon-setting menu-icon"></view>
|
||||
<view>钢卷异常</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<view class="list-cell list-cell-arrow" @click="handleLogout">
|
||||
<view class="menu-item-box">
|
||||
@@ -74,6 +81,9 @@
|
||||
handleToEqp() {
|
||||
this.$tab.navigateTo('/pages/eqp/eqp')
|
||||
},
|
||||
handleToAb() {
|
||||
this.$tab.navigateTo('/pages/defect/coil-defect')
|
||||
},
|
||||
handleLogout() {
|
||||
this.$modal.confirm('确定注销并退出系统吗?').then(() => {
|
||||
this.$store.dispatch('LogOut').then(() => {}).finally(() => {
|
||||
|
||||
105
apps/hand-factory/pages/scan/scan.vue
Normal file
105
apps/hand-factory/pages/scan/scan.vue
Normal file
@@ -0,0 +1,105 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<!-- Tab 切换栏 -->
|
||||
<view class="tabs-bar">
|
||||
<view
|
||||
class="tab-item"
|
||||
:class="{ 'tab-active': currentTab === 'coil' }"
|
||||
@click="currentTab = 'coil'"
|
||||
>
|
||||
<text class="tab-text">钢卷操作</text>
|
||||
</view>
|
||||
<view
|
||||
class="tab-item"
|
||||
:class="{ 'tab-active': currentTab === 'inspect' }"
|
||||
@click="currentTab = 'inspect'"
|
||||
>
|
||||
<text class="tab-text">设备巡检</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Tab 内容 -->
|
||||
<view class="tab-content">
|
||||
<view v-show="currentTab === 'coil'" class="tab-panel">
|
||||
<scan-coil ref="scanCoil" />
|
||||
</view>
|
||||
<view v-show="currentTab === 'inspect'" class="tab-panel">
|
||||
<scan-inspect ref="scanInspect" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ScanCoil from '@/components/scan-coil/scan-coil.vue'
|
||||
import ScanInspect from '@/components/scan-inspect/scan-inspect.vue'
|
||||
|
||||
export default {
|
||||
components: { ScanCoil, ScanInspect },
|
||||
data() {
|
||||
return {
|
||||
currentTab: 'coil'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
background-color: #f5f7fa;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
// ========== Tab 栏 ==========
|
||||
.tabs-bar {
|
||||
display: flex;
|
||||
background: #fff;
|
||||
border-bottom: 2rpx solid #f0f0f0;
|
||||
flex-shrink: 0;
|
||||
|
||||
.tab-item {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
padding: 24rpx 0;
|
||||
position: relative;
|
||||
|
||||
.tab-text {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
&.tab-active {
|
||||
.tab-text {
|
||||
color: #1a73e8;
|
||||
font-weight: 600;
|
||||
}
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 20%;
|
||||
right: 20%;
|
||||
height: 4rpx;
|
||||
background: #1a73e8;
|
||||
border-radius: 2rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ========== Tab 内容 ==========
|
||||
.tab-content {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.tab-panel {
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
padding: 15rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
@@ -131,79 +131,7 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 钢卷详情弹窗 -->
|
||||
<uni-popup ref="shipPopup" type="bottom">
|
||||
<view style="background-color: white; padding: 20rpx;">
|
||||
<!-- 弹窗标题+关闭按钮 -->
|
||||
<view class="popup-header flex justify-between align-center mb-20">
|
||||
<text class="font-32 font-bold">钢卷详情</text>
|
||||
<text class="icon-close font-40" @click="closePopup"></text>
|
||||
</view>
|
||||
|
||||
<view class="info-card" v-if="coilDetail.coilId">
|
||||
<view class="info-grid">
|
||||
<view class="info-item">
|
||||
<text class="item-label">入场钢卷号</text>
|
||||
<text class="item-value">{{ coilDetail.enterCoilNo || '-' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="item-label">当前钢卷号</text>
|
||||
<text class="item-value">{{ coilDetail.currentCoilNo || '-' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="item-label">厂家卷号</text>
|
||||
<text class="item-value">{{ coilDetail.supplierCoilNo || '-' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="item-label">状态</text>
|
||||
<text class="item-value">{{ getStatusText(coilDetail.status) }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="item-label">毛重 (吨)</text>
|
||||
<text class="item-value">{{ coilDetail.grossWeight || '-' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="item-label">净重 (吨)</text>
|
||||
<text class="item-value">{{ coilDetail.netWeight || '-' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="item-label">逻辑库区</text>
|
||||
<text class="item-value">{{ coilDetail.warehouseName || '-' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="item-label">真实库区</text>
|
||||
<text class="item-value">{{ coilDetail.actualWarehouseName || '-' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="item-label">班组</text>
|
||||
<text class="item-value">{{ coilDetail.team || '-' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="item-label">物料类型</text>
|
||||
<text class="item-value">{{ coilDetail.materialType || '-' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="item-label">品名</text>
|
||||
<text class="item-value">{{ coilDetail.itemName || '-' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="item-label">规格</text>
|
||||
<text class="item-value">{{ coilDetail.specification || '-' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="item-label">材质</text>
|
||||
<text class="item-value">{{ coilDetail.material || '-' }}</text>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<text class="item-label">厂家</text>
|
||||
<text class="item-value">{{ coilDetail.manufacturer || '-' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
|
||||
<!-- ✅ 新增:查询悬浮按钮 - search视图显示 -->
|
||||
<!-- 查询悬浮按钮 - search视图显示 -->
|
||||
<view class="float-btn search-btn" v-show="currentView === 'search'" @click="searchCoilList">
|
||||
<text class="btn-text">查询</text>
|
||||
</view>
|
||||
@@ -216,8 +144,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getMaterialCoil, listMaterialCoil } from '@/api/wms/coil';
|
||||
import { addPendingAction } from '@/api/wms/pendingAction';
|
||||
import { listMaterialCoil } from '@/api/wms/coil';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@@ -359,15 +286,11 @@
|
||||
this.scrollToPageTop()
|
||||
},
|
||||
|
||||
// 点击列表项-展示钢卷详情弹窗
|
||||
// 点击列表项-跳转钢卷详情页
|
||||
showCoilDetail(item) {
|
||||
this.coilDetail = { ...item }; // 深拷贝防止原数据被修改
|
||||
this.$refs.shipPopup.open(); // 打开底部弹窗
|
||||
},
|
||||
|
||||
// 关闭弹窗
|
||||
closePopup() {
|
||||
this.$refs.shipPopup.close();
|
||||
uni.navigateTo({
|
||||
url: '/pages/coil-detail/index?coilId=' + item.coilId
|
||||
});
|
||||
},
|
||||
|
||||
// 格式化状态文本:0=在库 1=已出库
|
||||
|
||||
@@ -73,7 +73,7 @@ function checkStorageSpace() {
|
||||
function checkUpdate(forceCheck = false) {
|
||||
// 1. 准备本地版本信息
|
||||
const localVersion = plus.runtime.version; // 基座版本
|
||||
const staticVersion = '1.3.31'; // 静态默认版本
|
||||
const staticVersion = '1.3.34'; // 静态默认版本
|
||||
// const localWgtVersion = staticVersion;
|
||||
const localWgtVersion = uni.getStorageSync('wgtVersion') || staticVersion; // 本地wgt版本(从存储获取或用默认)
|
||||
const currentVersion = compareVersion(localWgtVersion, localVersion) > 0
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "klp 1.3.31",
|
||||
"version": "klp 1.3.34",
|
||||
"wgtUrl": "http://49.232.154.205:10900/fadapp-update/klp/klp.wgt",
|
||||
"apkUrl": "http://49.232.154.205:10900/fadapp-update/klp/klp.apk"
|
||||
}
|
||||
Reference in New Issue
Block a user