Merge remote-tracking branch 'origin/0.8.X' into 0.8.X
This commit is contained in:
@@ -20,9 +20,6 @@ export default {
|
|||||||
const { icon, title, hasChildren } = context.props
|
const { icon, title, hasChildren } = context.props
|
||||||
// 函数式组件中 :style 绑定不会进 props,需要从 context.data.style 读取
|
// 函数式组件中 :style 绑定不会进 props,需要从 context.data.style 读取
|
||||||
const customStyle = context.data.style || {}
|
const customStyle = context.data.style || {}
|
||||||
if (Object.keys(customStyle).length > 0) {
|
|
||||||
console.log('[Item] ✅ 收到 style:', customStyle, '| title:', title)
|
|
||||||
}
|
|
||||||
const vnodes = []
|
const vnodes = []
|
||||||
|
|
||||||
if (icon) {
|
if (icon) {
|
||||||
|
|||||||
@@ -513,6 +513,9 @@ export default {
|
|||||||
if (!rows.length) return []
|
if (!rows.length) return []
|
||||||
const detailCols = this.allCols.filter(c => c.$type === 'detail')
|
const detailCols = this.allCols.filter(c => c.$type === 'detail')
|
||||||
const metricCols = this.allCols.filter(c => c.$type === 'metric')
|
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 calc = (type) => {
|
||||||
const row = { detailDate: type === 'sum' ? '总和' : '平均', $isSummary: true, $summaryType: type }
|
const row = { detailDate: type === 'sum' ? '总和' : '平均', $isSummary: true, $summaryType: type }
|
||||||
const n = rows.length || 1
|
const n = rows.length || 1
|
||||||
@@ -528,17 +531,43 @@ export default {
|
|||||||
row['q' + col.itemId] = type === 'sum' ? s.toFixed(2) : (s / n).toFixed(2)
|
row['q' + col.itemId] = type === 'sum' ? s.toFixed(2) : (s / n).toFixed(2)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
metricCols.forEach(col => {
|
metricCols.forEach((m, mi) => {
|
||||||
if (col.isShift) {
|
if (!m.metricFormula) {
|
||||||
const s1 = rows.reduce((a, r) => a + (parseFloat(r['mv' + col.mIdx + '_1']) || 0), 0)
|
if (m.isShift) { row['mv'+m.mIdx+'_1'] = null; row['mv'+m.mIdx+'_2'] = null }
|
||||||
const s2 = rows.reduce((a, r) => a + (parseFloat(r['mv' + col.mIdx + '_2']) || 0), 0)
|
else row['mv'+m.mIdx] = null
|
||||||
row['mv' + col.mIdx + '_1'] = type === 'sum' ? s1.toFixed(2) : (s1 / n).toFixed(2)
|
return
|
||||||
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)
|
|
||||||
}
|
}
|
||||||
|
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
|
return row
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ const NODE_EVENT_CONFIG = {
|
|||||||
{ id: 'H', label: '加工完工质检', handler: 'handleOpen', params: { componentPath: 'mes/qc/qualityReview/index' } },
|
{ id: 'H', label: '加工完工质检', handler: 'handleOpen', params: { componentPath: 'mes/qc/qualityReview/index' } },
|
||||||
{ id: 'I', label: '登记质量缺陷', handler: 'handleOpen', params: { componentPath: 'wms/coil/abnormal/extend' } },
|
{ id: 'I', label: '登记质量缺陷', handler: 'handleOpen', params: { componentPath: 'wms/coil/abnormal/extend' } },
|
||||||
{ id: 'J', 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: 'L', label: '编排发货计划', handler: 'handleOpen', params: { componentPath: 'wms/delivery/waybill/index' } },
|
||||||
{ id: 'M', label: '生成发货单', handler: 'handleOpen', params: { componentPath: 'wms/delivery/bills/index' } },
|
{ id: 'M', label: '生成发货单', handler: 'handleOpen', params: { componentPath: 'wms/delivery/bills/index' } },
|
||||||
{ id: 'N', label: '发货质量校验', handler: 'handleOpen', params: { componentPath: 'mes/qc/qualityReview/index' } },
|
{ id: 'N', label: '发货质量校验', handler: 'handleOpen', params: { componentPath: 'mes/qc/qualityReview/index' } },
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ export default {
|
|||||||
customExportVisible: false,
|
customExportVisible: false,
|
||||||
columnGroups: {
|
columnGroups: {
|
||||||
'基本信息': ['itemTypeDesc', 'warehouseName', 'actualWarehouseName', 'dataTypeText'],
|
'基本信息': ['itemTypeDesc', 'warehouseName', 'actualWarehouseName', 'dataTypeText'],
|
||||||
'钢卷号': ['enterCoilNo', 'supplierCoilNo', 'currentCoilNo'],
|
'钢卷号': ['enterCoilNo', 'supplierCoilNo', 'currentCoilNo', 'coilId'],
|
||||||
'时间': ['createTime', 'exportTime', 'exportBy'],
|
'时间': ['createTime', 'exportTime', 'exportBy'],
|
||||||
'物理属性': ['netWeight', 'length', 'specification', 'actualThickness', 'actualLength', 'actualWidth', 'theoreticalThickness', 'theoreticalLength'],
|
'物理属性': ['netWeight', 'length', 'specification', 'actualThickness', 'actualLength', 'actualWidth', 'theoreticalThickness', 'theoreticalLength'],
|
||||||
'材质属性': ['material', 'manufacturer', 'surfaceTreatmentDesc', 'zincLayer', 'packingStatus', 'temperGrade', 'coatingType', 'chromePlateCoilNo', 'rawMaterialThickness'],
|
'材质属性': ['material', 'manufacturer', 'surfaceTreatmentDesc', 'zincLayer', 'packingStatus', 'temperGrade', 'coatingType', 'chromePlateCoilNo', 'rawMaterialThickness'],
|
||||||
|
|||||||
@@ -560,7 +560,7 @@ export default {
|
|||||||
customExportType: 'output',
|
customExportType: 'output',
|
||||||
columnGroups: {
|
columnGroups: {
|
||||||
'基本信息': ['itemTypeDesc', 'warehouseName', 'actualWarehouseName', 'dataTypeText'],
|
'基本信息': ['itemTypeDesc', 'warehouseName', 'actualWarehouseName', 'dataTypeText'],
|
||||||
'钢卷号': ['enterCoilNo', 'supplierCoilNo', 'currentCoilNo'],
|
'钢卷号': ['enterCoilNo', 'supplierCoilNo', 'currentCoilNo', 'coilId'],
|
||||||
'时间': ['createTime', 'exportTime', 'exportBy'],
|
'时间': ['createTime', 'exportTime', 'exportBy'],
|
||||||
'物理属性': ['netWeight', 'length', 'specification', 'actualThickness', 'actualLength', 'actualWidth', 'theoreticalThickness', 'theoreticalLength', 'scheduleThickness'],
|
'物理属性': ['netWeight', 'length', 'specification', 'actualThickness', 'actualLength', 'actualWidth', 'theoreticalThickness', 'theoreticalLength', 'scheduleThickness'],
|
||||||
'材质属性': ['material', 'manufacturer', 'surfaceTreatmentDesc', 'zincLayer', 'packingStatus', 'temperGrade', 'coatingType', 'chromePlateCoilNo', 'rawMaterialThickness'],
|
'材质属性': ['material', 'manufacturer', 'surfaceTreatmentDesc', 'zincLayer', 'packingStatus', 'temperGrade', 'coatingType', 'chromePlateCoilNo', 'rawMaterialThickness'],
|
||||||
|
|||||||
Reference in New Issue
Block a user