1.1.1
This commit is contained in:
+115
-13
@@ -29,12 +29,15 @@
|
||||
<!-- 名称 -->
|
||||
<text>{{ item.fwmc }}</text>
|
||||
<!-- 代码 -->
|
||||
<text>{{ item.fwdm }}</text>
|
||||
<!-- <text>{{ item.fwdm }}</text> -->
|
||||
<!-- 重量 单位 -->
|
||||
<text>{{ item.csl || item.rkl}}{{ item.jldw }}</text>
|
||||
<!-- 时间 -->
|
||||
<text>{{ item.cssj }}</text>
|
||||
</view>
|
||||
<view class="data-card-text">
|
||||
<text class="light">{{ item.szsbm }}</text>
|
||||
</view>
|
||||
<!-- 选择模式下显示右侧箭头 -->
|
||||
<view class="select-arrow" v-if="isSelectMode">
|
||||
<uni-icons type="right" size="16" color="#cccccc"></uni-icons>
|
||||
@@ -47,6 +50,22 @@
|
||||
<uni-load-more :contentText="{contentdown: '显示更多'}" v-if="dataList.length > 0" :status="loadMoreStatus" @clickLoadMore="handleLoadMore" />
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 操作选择弹窗:撤销 / 补打 -->
|
||||
<uni-popup ref="actionPopup" type="center">
|
||||
<view class="action-popup" v-if="selectedItem">
|
||||
<!-- <view class="action-popup-title">请选择操作</view> -->
|
||||
<view class="action-popup-info">
|
||||
<text class="action-popup-name">{{ selectedItem.fwmc }}</text>
|
||||
<text class="action-popup-name">{{ selectedItem.fwdm }}</text>
|
||||
<text class="action-popup-code">{{ selectedItem.szsbm }}</text>
|
||||
</view>
|
||||
<view class="action-popup-btns">
|
||||
<button class="btn btn-outline action-btn" @click="handleUndo">撤 销</button>
|
||||
<button class="btn btn-primary action-btn" @click="handleReprint">补 打</button>
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -77,7 +96,9 @@ export default {
|
||||
/*手机高度*/
|
||||
phoneHeight: 0,
|
||||
/* 选择模式 */
|
||||
isSelectMode: false,
|
||||
isSelectMode: true,
|
||||
/* 弹窗选中的台账条目 */
|
||||
selectedItem: null,
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
@@ -163,19 +184,45 @@ export default {
|
||||
this.currentPage += 1
|
||||
this.loadData(true)
|
||||
},
|
||||
/** 选择模式下点击数据条目,将数据回传给上一页 */
|
||||
/** 点击列表项:选择模式下回传数据,普通模式弹出操作选择 */
|
||||
handleSelectItem(item) {
|
||||
if (!this.isSelectMode) return
|
||||
const pages = getCurrentPages()
|
||||
const prevPage = pages[pages.length - 2]
|
||||
if (prevPage) {
|
||||
// 将选中项存入上一页,由上一页根据需要提取字段
|
||||
prevPage.$vm.selectedItem = item
|
||||
prevPage.$vm.isSelected = true
|
||||
}
|
||||
uni.navigateBack()
|
||||
// 选择模式:将数据回传给上一页
|
||||
// if (this.isSelectMode) {
|
||||
// const pages = getCurrentPages()
|
||||
// const prevPage = pages[pages.length - 2]
|
||||
// if (prevPage) {
|
||||
// // 将选中项存入上一页,由上一页根据需要提取字段
|
||||
// prevPage.$vm.selectedItem = item
|
||||
// prevPage.$vm.isSelected = true
|
||||
// }
|
||||
// uni.navigateBack()
|
||||
// return
|
||||
// }
|
||||
// 普通模式:弹出撤销/补打选择弹窗
|
||||
this.selectedItem = item
|
||||
this.$refs.actionPopup.open()
|
||||
},
|
||||
handleScan() { uni.showToast({ title: '扫码查询', icon: 'none' }) }
|
||||
/** 撤销:跳转数据撤销页并携带数字识别码 */
|
||||
handleUndo() {
|
||||
const code = this.selectedItem ? this.selectedItem.szsbm : ''
|
||||
this.$refs.actionPopup.close()
|
||||
if (!code) {
|
||||
uni.showToast({ title: '该条数据无数字识别码,无法撤销', icon: 'none' })
|
||||
return
|
||||
}
|
||||
uni.navigateTo({ url: `/pages/waste/undo?code=${encodeURIComponent(code)}` })
|
||||
},
|
||||
/** 补打:跳转标签补打页并携带数字识别码 */
|
||||
handleReprint() {
|
||||
const code = this.selectedItem ? this.selectedItem.szsbm : ''
|
||||
this.$refs.actionPopup.close()
|
||||
if (!code) {
|
||||
uni.showToast({ title: '该条数据无数字识别码,无法补打', icon: 'none' })
|
||||
return
|
||||
}
|
||||
uni.navigateTo({ url: `/pages/waste/reprint?code=${encodeURIComponent(code)}` })
|
||||
},
|
||||
// handleScan() { uni.showToast({ title: '扫码查询', icon: 'none' }) }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -212,6 +259,9 @@ export default {
|
||||
.data-card-text{
|
||||
justify-content: space-between;
|
||||
display: flex;
|
||||
.light{
|
||||
opacity: 0.7;
|
||||
}
|
||||
}
|
||||
|
||||
/* 选择模式右侧箭头 */
|
||||
@@ -226,4 +276,56 @@ export default {
|
||||
text-align: center;
|
||||
padding: $spacing-md 0;
|
||||
}
|
||||
|
||||
/* 撤销/补打操作弹窗 */
|
||||
.action-popup {
|
||||
width: 100%;
|
||||
background: #ffffff;
|
||||
border-radius: $border-radius-lg;
|
||||
padding: $spacing-lg $spacing-md $spacing-md;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
.action-popup-title {
|
||||
font-size: $font-size-lg;
|
||||
font-weight: 600;
|
||||
color: $text-primary;
|
||||
}
|
||||
|
||||
.action-popup-info {
|
||||
width: 100%;
|
||||
margin-top: $spacing-md;
|
||||
padding: $spacing-base;
|
||||
// background: $bg-primary;
|
||||
// border-radius: $border-radius-sm;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
.action-popup-name {
|
||||
font-size: $font-size-md;
|
||||
color: $text-primary;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.action-popup-code {
|
||||
margin-top: $spacing-xs;
|
||||
font-size: $font-size-sm;
|
||||
color: $text-secondary;
|
||||
}
|
||||
}
|
||||
|
||||
.action-popup-btns {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
gap: $spacing-base;
|
||||
margin-top: $spacing-lg;
|
||||
|
||||
.action-btn {
|
||||
flex: 1;
|
||||
height: 40px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="label">说明</text>
|
||||
<text class="value value-desc">{{ scanMode === 'uniapp' ? '使用默认摄像头扫码' : scanMode === 'idata' ? '仅支持 iData 设备内置扫码' : '通用 Android PDA 设备' }}
|
||||
<text class="value value-desc">{{ scanModeDesc }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -130,10 +130,22 @@ export default {
|
||||
scanModeText() {
|
||||
const map = {
|
||||
uniapp: '安卓设备',
|
||||
idata: 'IDATA PDA设备',
|
||||
android: '带扫码PDA设备'
|
||||
idata: 'IDATA设备',
|
||||
android: '通用扫码设备',
|
||||
pda: 'PDA设备'
|
||||
}
|
||||
return map[this.scanMode] || '安卓设备'
|
||||
},
|
||||
|
||||
// 扫码模式说明
|
||||
scanModeDesc() {
|
||||
const map = {
|
||||
uniapp: '使用默认摄像头扫码',
|
||||
idata: '仅支持 iData 设备内置扫码',
|
||||
android: '通用 Android PDA 设备',
|
||||
pda: '带物理扫码键 PDA 设备(hbyapi 广播协议)'
|
||||
}
|
||||
return map[this.scanMode] || '使用默认摄像头扫码'
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
@@ -174,8 +186,9 @@ export default {
|
||||
// 使用对象数组,key:value 形式定义选项
|
||||
const modeOptions = [
|
||||
{ key: 'uniapp', label: '安卓设备' },
|
||||
{ key: 'idata', label: 'IDATA PDA设备' },
|
||||
{ key: 'android', label: '带扫码PDA设备' }
|
||||
{ key: 'idata', label: 'IDATA设备' },
|
||||
{ key: 'android', label: '通用扫码设备' },
|
||||
{ key: 'pda', label: 'PDA设备' }
|
||||
]
|
||||
|
||||
const res = await uni.showActionSheet({
|
||||
|
||||
@@ -294,9 +294,10 @@ export default {
|
||||
*/
|
||||
selectCommandType(type) {
|
||||
this.commandType = type
|
||||
printerService.setCommandType(type)
|
||||
// 切换指令类型时同步更新纸张尺寸
|
||||
printerService.setPaperSize(this.paperWidth, this.paperHeight)
|
||||
// 测试页临时切换指令类型,不覆盖正式配置
|
||||
printerService.setCommandTypeTemporary(type)
|
||||
// 切换指令类型时同步更新纸张尺寸(临时生效)
|
||||
printerService.setPaperSizeTemporary(this.paperWidth, this.paperHeight)
|
||||
},
|
||||
/**
|
||||
* 选择打印纸尺寸
|
||||
@@ -304,7 +305,8 @@ export default {
|
||||
selectPaperSize(width, height) {
|
||||
this.paperWidth = width
|
||||
this.paperHeight = height
|
||||
printerService.setPaperSize(width, height)
|
||||
// 测试页临时切换纸张尺寸,不覆盖正式配置
|
||||
printerService.setPaperSizeTemporary(width, height)
|
||||
},
|
||||
/**
|
||||
* 快捷模板
|
||||
@@ -325,29 +327,29 @@ export default {
|
||||
riqi: new Date().toISOString().split('T')[0],
|
||||
zhongliang: '10kg',
|
||||
beizhu: '测试备注',
|
||||
biaoshi: '',
|
||||
biaoshi: [1, 2, 3, 4],
|
||||
qrcode: 'https://www.cswm.org.cn/qr/?code=7G6MOYELnFHZfF1Y0F8e6gjxR2K2pALNJJNhJSuOg17LV6IZfuDWUnF2qC3Rsdejs&type=WFBQ'
|
||||
}
|
||||
// 确保 service 使用当前的 commandType 和 paperSize
|
||||
printerService.setCommandType(this.commandType)
|
||||
printerService.setPaperSize(this.paperWidth, this.paperHeight)
|
||||
// 确保 service 使用当前的 commandType 和 paperSize(临时生效,不覆盖配置)
|
||||
printerService.setCommandTypeTemporary(this.commandType)
|
||||
printerService.setPaperSizeTemporary(this.paperWidth, this.paperHeight)
|
||||
this.printContent = printerService.generateWasteLabel(testData)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (type === 'qrcode') {
|
||||
printerService.setCommandType(this.commandType)
|
||||
printerService.setPaperSize(this.paperWidth, this.paperHeight)
|
||||
if (type === 'qrcode') {
|
||||
printerService.setCommandTypeTemporary(this.commandType)
|
||||
printerService.setPaperSizeTemporary(this.paperWidth, this.paperHeight)
|
||||
this.printContent = printerService.generateQRCodeTemplate('https://www.example.com')
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (type === 'barcode') {
|
||||
printerService.setCommandType(this.commandType)
|
||||
printerService.setPaperSize(this.paperWidth, this.paperHeight)
|
||||
if (type === 'barcode') {
|
||||
printerService.setCommandTypeTemporary(this.commandType)
|
||||
printerService.setPaperSizeTemporary(this.paperWidth, this.paperHeight)
|
||||
this.printContent = printerService.generateBarcodeTemplate('1234567890')
|
||||
return
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 清空打印内容
|
||||
@@ -367,9 +369,9 @@ export default {
|
||||
|
||||
this.isPrinting = true
|
||||
try {
|
||||
// 确保打印前同步配置
|
||||
printerService.setCommandType(this.commandType)
|
||||
printerService.setPaperSize(this.paperWidth, this.paperHeight)
|
||||
// 确保打印前同步配置(测试页临时生效,不覆盖正式配置)
|
||||
printerService.setCommandTypeTemporary(this.commandType)
|
||||
printerService.setPaperSizeTemporary(this.paperWidth, this.paperHeight)
|
||||
await printerService.printText(this.printContent)
|
||||
uni.showToast({ title: '打印成功', icon: 'success' })
|
||||
} catch (err) {
|
||||
|
||||
+42
-15
@@ -35,20 +35,37 @@
|
||||
<view class="data-list" v-if="selectedTypeCorp">
|
||||
<view class="data-card">
|
||||
<view class="data-card-header"><text class="data-card-title">已选处置公司</text></view>
|
||||
<view class="data-card-row"><text>处置公司:</text><text class="val">{{ selectedTypeCorp.jydwmc || '-' }}</text></view>
|
||||
<view class="data-card-row"><text>废物名称:</text><text class="val">{{ selectedTypeCorp.fwmc || '-' }}</text></view>
|
||||
<view class="data-card-row"><text>废物代码:</text><text class="val">{{ selectedTypeCorp.fwdm || '-' }}</text></view>
|
||||
<view class="data-card-row">
|
||||
<view class="label">处置公司:</view>
|
||||
<text class="val">{{ selectedTypeCorp.jydwmc || '-' }}</text></view>
|
||||
<view class="data-card-row">
|
||||
<view class="label">废物名称:</view>
|
||||
<text class="val">{{ selectedTypeCorp.fwmc || '-' }}</text></view>
|
||||
<view class="data-card-row">
|
||||
<view class="label">废物代码:</view>
|
||||
<text class="val">{{ selectedTypeCorp.fwdm || '-' }}</text></view>
|
||||
</view>
|
||||
<!-- type_corp_info 返回的信息 -->
|
||||
<view class="data-card" v-if="typeCorpInfoData.summary_lines && typeCorpInfoData.summary_lines.length">
|
||||
<view class="data-card">
|
||||
<view class="data-card-header" @click="summaryExpanded = !summaryExpanded">
|
||||
<text class="data-card-title">汇总信息</text>
|
||||
<text class="data-card-toggle">{{ summaryExpanded ? '收起 ▲' : '更多 ▼' }}</text>
|
||||
</view>
|
||||
<view class="data-card-body" :class="{ collapsed: !summaryExpanded }">
|
||||
<view class="data-card-row" v-for="(line, i) in typeCorpInfoData.summary_lines" :key="'s'+i">
|
||||
<text class="val summary-text">{{ line }}</text>
|
||||
<view class="data-card-body">
|
||||
<view class="data-card-row">
|
||||
<text class="val summary-text">总条数: {{ typeCorpInfoData.total_items }} 总重量: {{ typeCorpInfoData.total_weight }}千克</text>
|
||||
</view>
|
||||
<template v-if="summaryExpanded">
|
||||
<view class="data-card-row" v-for="(group, gi) in typeCorpInfoData.waste_groups" :key="'g'+gi">
|
||||
<text>
|
||||
{{ group.waste_name }}
|
||||
{{ group.waste_count }}件
|
||||
</text>
|
||||
<text class="val">
|
||||
{{ group.total_weight }} {{ group.rows[0].unit }}
|
||||
</text>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
<view class="data-card" v-if="typeCorpInfoData.receiver_company || typeCorpInfoData.transport_company">
|
||||
@@ -87,16 +104,19 @@
|
||||
</view>
|
||||
<view class="data-card-row">
|
||||
<text>转运数量:</text>
|
||||
<text class="val">{{ item.zysl }}</text><text class="val">{{ item.jldw || '' }}</text>
|
||||
<text class="val">{{ item.zysl }}{{ item.jldw || '' }}</text>
|
||||
</view>
|
||||
<view class="data-card-row">
|
||||
<text>接收数量:</text><text class="val">{{ item.jssl }}</text><text class="val">{{ item.jldw || '' }}</text>
|
||||
<text>接收数量:</text>
|
||||
<text class="val">{{ item.jssl }}{{ item.jldw || '' }}</text>
|
||||
</view>
|
||||
<view class="data-card-row">
|
||||
<text>危废运出时间:</text><text class="val">{{ item.wfycsj || '-' }}</text>
|
||||
<text>危废运出时间:</text>
|
||||
<text class="val">{{ item.wfycsj || '-' }}</text>
|
||||
</view>
|
||||
<view class="data-card-row">
|
||||
<text>办结时间:</text><text class="val">{{ item.bjsj || '-' }}</text>
|
||||
<text>办结时间:</text>
|
||||
<text class="val">{{ item.bjsj || '-' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -105,6 +125,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { api } from '@/api/index'
|
||||
export default {
|
||||
data() {
|
||||
@@ -211,8 +232,10 @@ export default {
|
||||
} else {
|
||||
this.typeCorpInfoData = {}
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
console.error('[联单] typeCorpInfo 加载失败:', e)
|
||||
// console.error('[联单] typeCorpInfo 加载失败:', e)
|
||||
uni.showToast({ title: '加载处置公司详情失败,'+e.message, icon: 'none' })
|
||||
this.typeCorpInfoData = {}
|
||||
}
|
||||
},
|
||||
@@ -331,9 +354,6 @@ export default {
|
||||
color: #999;
|
||||
font-weight: 400;
|
||||
}
|
||||
.data-card-body.collapsed .data-card-row:nth-child(n+4) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.data-card-tag {
|
||||
padding: 2px 8px;
|
||||
@@ -350,4 +370,11 @@ export default {
|
||||
border: 1px solid #ffa39e;
|
||||
}
|
||||
}
|
||||
|
||||
.data-card-row {
|
||||
.label {
|
||||
white-space: nowrap;
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
+40
-3
@@ -82,6 +82,13 @@ export default {
|
||||
expanded: false
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
// 从台账详情跳转:携带数字识别码,自动查询
|
||||
if (options && options.code) {
|
||||
this.form.code = decodeURIComponent(options.code)
|
||||
this.handleQuery()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/** 扫码结果回调:填充数字识别码 -> 自动查询 */
|
||||
onBarcodeScanned(barcode) {
|
||||
@@ -119,13 +126,17 @@ export default {
|
||||
uni.showToast({ title: '打印中...', icon: 'none' })
|
||||
try {
|
||||
await printerService.init()
|
||||
await printerService.autoConnect()
|
||||
const connected = await printerService.autoConnect()
|
||||
if (!connected) {
|
||||
// 真实失败原因已在 printerService 内 console.error 输出
|
||||
throw new Error('打印机连接失败,请检查设备蓝牙是否开启或已配对')
|
||||
}
|
||||
await printerService.printWasteLabel(printData)
|
||||
await this.handleDisconnect()
|
||||
uni.showToast({ title: '打印成功', icon: 'success' })
|
||||
} catch (error) {
|
||||
console.error('[补打] 打印失败:', error)
|
||||
uni.showToast({ title: '打印失败: ' + error, icon: 'none' })
|
||||
uni.showToast({ title: '打印失败: ' + error.message, icon: 'none' })
|
||||
}
|
||||
// #endif
|
||||
// #ifdef MP
|
||||
@@ -142,6 +153,32 @@ export default {
|
||||
}
|
||||
},
|
||||
// #endif
|
||||
/**
|
||||
* 解析危废危险特性,返回标识点位置编号数组
|
||||
* 固定映射:1=腐蚀性(左上)、2=毒性(右上)、3=易燃性(左下)、4=反应性(右下)
|
||||
* 感染性不占位
|
||||
* @param {Object} data 危废信息对象(危险特性字段 hazardous_properties 或 wxtx,逗号分隔)
|
||||
* @returns {number[]} 位置编号数组,如 [1,2,3,4]
|
||||
*/
|
||||
processBiaoshi(data) {
|
||||
const raw = (data && (data.hazardous_properties || data.wxtx)) || '';
|
||||
if (!raw) return [];
|
||||
const properties = raw.split(',').map(s => s.trim()).filter(Boolean);
|
||||
const PROPERTY_TO_POSITION = {
|
||||
'腐蚀性': 1,
|
||||
'毒性': 2,
|
||||
'易燃性': 3,
|
||||
'反应性': 4
|
||||
};
|
||||
const positions = [];
|
||||
properties.forEach(prop => {
|
||||
const pos = PROPERTY_TO_POSITION[prop];
|
||||
if (pos !== undefined && !positions.includes(pos)) {
|
||||
positions.push(pos);
|
||||
}
|
||||
});
|
||||
return positions;
|
||||
},
|
||||
printData() {
|
||||
const printData = {
|
||||
'mingcheng': this.previewData.fwmc || '', // 危废名称
|
||||
@@ -157,7 +194,7 @@ export default {
|
||||
'riqi': (this.previewData.cssj || '').split(' ')[0], // 产生时间(仅日期)
|
||||
'zhongliang': (this.previewData.csl || '') + ' ' + (this.previewData.jldw || ''), // 重量
|
||||
'beizhu': this.previewData.wxtx || '-', // 备注 危险特征
|
||||
'biaoshi': '', // 标识
|
||||
'biaoshi': this.processBiaoshi(this.previewData), // 标识(危险特性点位)
|
||||
'qrcode': this.previewData.wxfwbqewm || '', // 二维码
|
||||
'lianxidianhua': this.previewData.lxrsj || '', // 联系电话
|
||||
'rongqileixing': this.previewData.rqlx || '', // 容器类型
|
||||
|
||||
@@ -57,6 +57,13 @@ export default {
|
||||
recordData: {}
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
// 从台账详情跳转:携带数字识别码,自动查询
|
||||
if (options && options.code) {
|
||||
this.form.code = decodeURIComponent(options.code)
|
||||
this.handleQuery()
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
canUndo() {
|
||||
return this.recordData.list && this.recordData.list.length && this.form.reason
|
||||
|
||||
@@ -341,7 +341,6 @@ export default {
|
||||
|
||||
if (res.code == 1000) {
|
||||
uni.showToast({ title: '登记成功', icon: 'success' })
|
||||
// const data = res.data
|
||||
const hwInfo = this.hwInfo
|
||||
const result = res.data
|
||||
const printData = {
|
||||
@@ -353,12 +352,12 @@ export default {
|
||||
'youhaichengfen': hwInfo.hazardous_components || '-', // 有害成分
|
||||
'zhuyi': hwInfo.main_properties || '-', // 注意事项
|
||||
'shibiema': result.digital_id, // 数字识别码
|
||||
'danwei': hwInfo.unit, // 单位
|
||||
'danwei': hwInfo.enterprise_name || '-', // 单位名称
|
||||
'lianxi': '', // 联系人
|
||||
'riqi': getDate(), // 日期
|
||||
'zhongliang': submitData.weight, // 重量
|
||||
'zhongliang': submitData.weight + hwInfo.unit, // 重量
|
||||
'beizhu': result.produce_ledger_no || '-', // 备注 台账编号,包装类型
|
||||
'biaoshi': '', // 标识
|
||||
'biaoshi': this.processBiaoshi(hwInfo), // 标识
|
||||
'qrcode': result.label_qrcode // 二维码
|
||||
}
|
||||
this.currentPrintData = printData
|
||||
@@ -367,6 +366,32 @@ export default {
|
||||
})
|
||||
|
||||
},
|
||||
/**
|
||||
* 解析危废危险特性,返回标识点位置编号数组
|
||||
* 固定映射:1=腐蚀性(左上)、2=毒性(右上)、3=易燃性(左下)、4=反应性(右下)
|
||||
* 感染性不占位
|
||||
* @param {Object} hwInfo 危废信息对象(接口返回 hazardous_properties 逗号分隔字符串)
|
||||
* @returns {number[]} 位置编号数组,如 [1,2,3,4]
|
||||
*/
|
||||
processBiaoshi(hwInfo) {
|
||||
const raw = (hwInfo && hwInfo.hazardous_properties) || '';
|
||||
if (!raw) return [];
|
||||
const properties = raw.split(',').map(s => s.trim()).filter(Boolean);
|
||||
const PROPERTY_TO_POSITION = {
|
||||
'腐蚀性': 1,
|
||||
'毒性': 2,
|
||||
'易燃性': 3,
|
||||
'反应性': 4
|
||||
};
|
||||
const positions = [];
|
||||
properties.forEach(prop => {
|
||||
const pos = PROPERTY_TO_POSITION[prop];
|
||||
if (pos !== undefined && !positions.includes(pos)) {
|
||||
positions.push(pos);
|
||||
}
|
||||
});
|
||||
return positions;
|
||||
},
|
||||
async doPrint() {
|
||||
|
||||
// const printData = {
|
||||
|
||||
Reference in New Issue
Block a user