diff --git a/klp-ui/src/layout/components/Sidebar/Item.vue b/klp-ui/src/layout/components/Sidebar/Item.vue index 23c3ca452..1d971d4f2 100644 --- a/klp-ui/src/layout/components/Sidebar/Item.vue +++ b/klp-ui/src/layout/components/Sidebar/Item.vue @@ -20,9 +20,6 @@ export default { const { icon, title, hasChildren } = context.props // 函数式组件中 :style 绑定不会进 props,需要从 context.data.style 读取 const customStyle = context.data.style || {} - if (Object.keys(customStyle).length > 0) { - console.log('[Item] ✅ 收到 style:', customStyle, '| title:', title) - } const vnodes = [] if (icon) { diff --git a/klp-ui/src/views/cost/comprehensive.vue b/klp-ui/src/views/cost/comprehensive.vue index 845b899a0..53073a236 100644 --- a/klp-ui/src/views/cost/comprehensive.vue +++ b/klp-ui/src/views/cost/comprehensive.vue @@ -513,6 +513,9 @@ export default { if (!rows.length) return [] const detailCols = this.allCols.filter(c => c.$type === 'detail') const metricCols = this.allCols.filter(c => c.$type === 'metric') + const rp = this.activeReport || {} + const esc = s => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + const evalF = (f) => { const s = f.replace(/[^0-9+\-*/.()\s]/g,''); if(!s) return null; try { const r = new Function('return ('+s+')')(); return isFinite(r)?(Math.round(r*100)/100).toFixed(2):null } catch(e){ return null } } const calc = (type) => { const row = { detailDate: type === 'sum' ? '总和' : '平均', $isSummary: true, $summaryType: type } const n = rows.length || 1 @@ -528,17 +531,43 @@ export default { row['q' + col.itemId] = type === 'sum' ? s.toFixed(2) : (s / n).toFixed(2) } }) - metricCols.forEach(col => { - if (col.isShift) { - const s1 = rows.reduce((a, r) => a + (parseFloat(r['mv' + col.mIdx + '_1']) || 0), 0) - const s2 = rows.reduce((a, r) => a + (parseFloat(r['mv' + col.mIdx + '_2']) || 0), 0) - row['mv' + col.mIdx + '_1'] = type === 'sum' ? s1.toFixed(2) : (s1 / n).toFixed(2) - row['mv' + col.mIdx + '_2'] = type === 'sum' ? s2.toFixed(2) : (s2 / n).toFixed(2) - row['mv' + col.mIdx] = type === 'sum' ? (s1 + s2).toFixed(2) : ((s1 + s2) / n).toFixed(2) - } else { - const s = rows.reduce((a, r) => a + (parseFloat(r['mv' + col.mIdx]) || 0), 0) - row['mv' + col.mIdx] = type === 'sum' ? s.toFixed(2) : (s / n).toFixed(2) + metricCols.forEach((m, mi) => { + if (!m.metricFormula) { + if (m.isShift) { row['mv'+m.mIdx+'_1'] = null; row['mv'+m.mIdx+'_2'] = null } + else row['mv'+m.mIdx] = null + return } + const ef = (shiftId) => { + let f = m.metricFormula + for (let pmi = 0; pmi < mi; pmi++) { + const pm = metricCols[pmi]; if (!pm.metricName) continue + const pn = esc(pm.metricName) + if (pm.isShift) { + const pv1 = row['mv'+pm.mIdx+'_1']; const pv2 = row['mv'+pm.mIdx+'_2'] + if (pv1 != null) f = f.replace(new RegExp('@\\{'+pn+'\\}\\.甲班','g'), pv1) + if (pv2 != null) f = f.replace(new RegExp('@\\{'+pn+'\\}\\.乙班','g'), pv2) + } + const pv = pm.isShift ? (shiftId ? row['mv'+pm.mIdx+'_'+shiftId] : null) : row['mv'+pm.mIdx] + if (pv != null) f = f.replace(new RegExp('@\\{'+pn+'\\}','g'), pv) + } + detailCols.forEach(c => { + const item = this.allItems.find(i => String(i.itemId) === String(c.itemId)) + if (!item || !item.itemCode) return; const code = item.itemCode + if (c.isShift) { + const v1 = parseFloat(row['q'+c.itemId+'_1'])||0; const v2 = parseFloat(row['q'+c.itemId+'_2'])||0 + f = f.replace(new RegExp('@\\{'+code+'\\}\\.甲班','g'), v1).replace(new RegExp('@\\{'+code+'\\}\\.乙班','g'), v2) + const v = shiftId ? (shiftId==='1'?v1:v2) : v1+v2 + f = f.replace(new RegExp('@\\{'+code+'\\}','g'), v) + } else { + const v = parseFloat(row['q'+c.itemId])||0 + f = f.replace(new RegExp('@\\{'+code+'\\}\\.甲班','g'), v).replace(new RegExp('@\\{'+code+'\\}\\.乙班','g'), v).replace(new RegExp('@\\{'+code+'\\}','g'), v) + } + }) + f = f.replace(/input_weight/g, rp.inputWeight||0).replace(/output_weight/g, rp.outputWeight||0).replace(/price/g, (m.usePrice == 1) ? (m.metricValue || 0) : 0) + return evalF(f) + } + if (m.isShift) { row['mv'+m.mIdx+'_1']=ef('1'); row['mv'+m.mIdx+'_2']=ef('2') } + else row['mv'+m.mIdx]=ef(null) }) return row } diff --git a/klp-ui/src/views/wms/post/flow.vue b/klp-ui/src/views/wms/post/flow.vue index 52f0dae8e..f9d587e8b 100644 --- a/klp-ui/src/views/wms/post/flow.vue +++ b/klp-ui/src/views/wms/post/flow.vue @@ -81,7 +81,7 @@ const NODE_EVENT_CONFIG = { { id: 'H', label: '加工完工质检', handler: 'handleOpen', params: { componentPath: 'mes/qc/qualityReview/index' } }, { id: 'I', label: '登记质量缺陷', handler: 'handleOpen', params: { componentPath: 'wms/coil/abnormal/extend' } }, { id: 'J', label: '质量等级判定', handler: 'handleOpen', params: { componentPath: 'wms/coil/abnormal/extend' } }, - { id: 'K', label: '单卷档案', handler: 'handleOpen', params: { componentPath: 'wms/coil/info/index' } }, + // { id: 'K', label: '单卷档案', handler: 'handleOpen', params: { componentPath: 'wms/coil/info/index' } }, { id: 'L', label: '编排发货计划', handler: 'handleOpen', params: { componentPath: 'wms/delivery/waybill/index' } }, { id: 'M', label: '生成发货单', handler: 'handleOpen', params: { componentPath: 'wms/delivery/bills/index' } }, { id: 'N', label: '发货质量校验', handler: 'handleOpen', params: { componentPath: 'mes/qc/qualityReview/index' } },