This commit is contained in:
2026-08-18 14:46:36 +08:00
parent 9e94385dfc
commit a084fe1fd4
13 changed files with 647 additions and 235 deletions
+42 -15
View File
@@ -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
View File
@@ -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 || '', // 容器类型
+7
View File
@@ -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