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
+29 -4
View File
@@ -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 = {