|
|
|
|
@ -24,9 +24,6 @@
|
|
|
|
|
</view>
|
|
|
|
|
</picker>
|
|
|
|
|
<view class="reset-filter-btn" @click="resetFilters">{{ t('functionCommon.reset') }}</view>
|
|
|
|
|
<view class="scan-btn" @click="handleScan">
|
|
|
|
|
<uni-icons type="scan" size="22" color="#111827"></uni-icons>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<scroll-view
|
|
|
|
|
@ -227,51 +224,6 @@ function onStatusFilterChange(event) {
|
|
|
|
|
fetchList(true)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function handleScan() {
|
|
|
|
|
try {
|
|
|
|
|
const res = await uni.scanCode({ scanType: ['qrCode', 'barCode'] })
|
|
|
|
|
const result = String(res?.result || '').trim()
|
|
|
|
|
if (!result) {
|
|
|
|
|
uni.showToast({ title: t('moldRepair.scanUnrecognized'), icon: 'none' })
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
const scan = parseMoldScanResult(result)
|
|
|
|
|
if (!scan.id) {
|
|
|
|
|
uni.showToast({ title: t('moldRepair.scanMoldRequired'), icon: 'none' })
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
selectedMoldId.value = scan.id
|
|
|
|
|
searchKeyword.value = ''
|
|
|
|
|
await fetchList(true)
|
|
|
|
|
} catch (error) {
|
|
|
|
|
const message = String(error?.errMsg || '')
|
|
|
|
|
if (message.includes('cancel')) return
|
|
|
|
|
uni.showToast({ title: t('moldRepair.scanFailed'), icon: 'none' })
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function parseMoldScanResult(result) {
|
|
|
|
|
const text = String(result || '').trim()
|
|
|
|
|
const directMatch = text.match(/^([A-Z_]+)-(\d+)$/i)
|
|
|
|
|
if (directMatch) {
|
|
|
|
|
return {
|
|
|
|
|
type: directMatch[1].toUpperCase(),
|
|
|
|
|
id: directMatch[1].toUpperCase() === 'MOLD' ? directMatch[2] : ''
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
const parsed = JSON.parse(text)
|
|
|
|
|
const type = String(parsed?.type || parsed?.bizType || parsed?.codeType || '').toUpperCase()
|
|
|
|
|
const id = String(parsed?.id || parsed?.moldId || parsed?.deviceId || '').trim()
|
|
|
|
|
return {
|
|
|
|
|
type,
|
|
|
|
|
id: type === 'MOLD' && id ? id : ''
|
|
|
|
|
}
|
|
|
|
|
} catch {
|
|
|
|
|
return { type: '', id: '' }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function canEdit(item) {
|
|
|
|
|
return !isProcessedRepair(item?.repairStatus)
|
|
|
|
|
}
|
|
|
|
|
@ -406,7 +358,7 @@ function textValue(value) {
|
|
|
|
|
|
|
|
|
|
.filter-bar {
|
|
|
|
|
display: grid;
|
|
|
|
|
grid-template-columns: minmax(0, 1fr) 150rpx 96rpx 64rpx;
|
|
|
|
|
grid-template-columns: minmax(0, 1fr) 150rpx 96rpx;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 14rpx;
|
|
|
|
|
padding: 18rpx 4rpx 20rpx;
|
|
|
|
|
@ -414,8 +366,7 @@ function textValue(value) {
|
|
|
|
|
|
|
|
|
|
.keyword-box,
|
|
|
|
|
.status-box,
|
|
|
|
|
.reset-filter-btn,
|
|
|
|
|
.scan-btn {
|
|
|
|
|
.reset-filter-btn {
|
|
|
|
|
height: 66rpx;
|
|
|
|
|
background: #ffffff;
|
|
|
|
|
border: 1rpx solid #d9dde5;
|
|
|
|
|
@ -452,13 +403,6 @@ function textValue(value) {
|
|
|
|
|
color: #a8adb7;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.scan-btn {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
background: #ffffff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.reset-filter-btn {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
|