Browse Source

2025-10-29

过站采集创建分卷优化
master
fengyuan_yang 3 months ago
parent
commit
7ecc0fca61
  1. 277
      src/views/modules/yieldReport/com_separate_roll.vue

277
src/views/modules/yieldReport/com_separate_roll.vue

@ -1,6 +1,6 @@
<template>
<div class="customer-css">
<el-dialog :title="titleCon" v-drag v-bind="$attrs" v-on="$listeners" width="550px" style="height: 680px;" class="customer-dialog">
<el-dialog :title="titleCon" v-drag v-bind="$attrs" v-on="$listeners" width="700px" style="height: 680px;" class="customer-dialog">
<el-form :inline="true" label-position="top" style="height: auto;">
<!-- 时间和固定载具 -->
<el-row style="margin-top: -10px;">
@ -46,10 +46,11 @@
:data="rowDataList"
border
style="width: 100%; margin-top: 10px;"
max-height="350">
max-height="350"
:span-method="objectSpanMethod">
<el-table-column prop="rowNumber" label="NO." width="50" align="center">
</el-table-column>
<el-table-column label="良品数" width="150" align="center">
<el-table-column label="良品数" width="80" align="center">
<template slot-scope="scope">
<el-input-number
:controls="false" :step="0"
@ -61,25 +62,60 @@
</el-input-number>
</template>
</el-table-column>
<el-table-column label="不良数" width="150" align="center">
<el-table-column label="面损" width="80" align="center">
<template slot-scope="scope">
<el-input-number
:controls="false" :step="0"
v-model="scope.row.defectQty"
v-model="scope.row.surfaceLossQty"
@change="handleQtyChange(scope.row)"
style="width: 100%"
class="defect-qty-input"
:style="{'color': '#f56c6c', 'font-weight': 'bold'}">
style="width: 100%">
</el-input-number>
</template>
</el-table-column>
<el-table-column label="性能不良" width="80" align="center">
<template slot-scope="scope">
<el-input-number
:controls="false" :step="0"
v-model="scope.row.poorPerformanceQty"
@change="handleQtyChange(scope.row)"
style="width: 100%">
</el-input-number>
</template>
</el-table-column>
<el-table-column label="总数" align="center">
<el-table-column label="不良数" width="80" align="right">
<template slot-scope="scope">
<div class="total-display">
<div class="defect-display" :style="{'color': '#f56c6c', 'font-weight': 'bold', 'text-align': 'right', 'padding-right': '10px'}">
{{ scope.row.defectQty }}
</div>
</template>
</el-table-column>
<el-table-column label="良率" width="80" align="center">
<template slot-scope="scope">
<div class="yield-display" :style="{'color': '#409eff', 'font-weight': 'bold'}">
{{ scope.row.yieldRate }}
</div>
</template>
</el-table-column>
<el-table-column label="总数" width="80" align="right">
<template slot-scope="scope">
<div class="total-display" :style="{'text-align': 'right', 'padding-right': '10px'}">
{{ scope.row.totalQty }}
</div>
</template>
</el-table-column>
<el-table-column label="备注" align="center" class-name="remark-column">
<template slot-scope="scope">
<div class="remark-wrapper">
<el-input
type="textarea"
v-model="scope.row.remark"
resize="none"
:autosize="false"
class="remark-textarea">
</el-input>
</div>
</template>
</el-table-column>
</el-table>
</div>
</el-form>
@ -400,8 +436,12 @@ export default {
this.rowDataList.push({
rowNumber: i,
goodQty: 0,
surfaceLossQty: 0,
poorPerformanceQty: 0,
defectQty: 0,
totalQty: 0
yieldRate: '0.00%',
totalQty: 0,
remark: ''
})
}
},
@ -414,9 +454,21 @@ export default {
this.initRowDataList()
},
//
//
handleQtyChange(row) {
row.totalQty = (row.goodQty || 0) + (row.defectQty || 0)
// = +
row.defectQty = (row.surfaceLossQty || 0) + (row.poorPerformanceQty || 0)
// = +
row.totalQty = (row.goodQty || 0) + row.defectQty
// = / * 100%
if (row.totalQty > 0) {
const yieldValue = ((row.goodQty || 0) / row.totalQty * 100).toFixed(2)
row.yieldRate = yieldValue + '%'
} else {
row.yieldRate = '0.00%'
}
},
//
@ -453,6 +505,88 @@ export default {
return true
},
//
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
//
if (column.label === '备注') {
//
const rowsPerRoll = Math.floor(this.pageData.rowCount / this.pageData.rollCount)
const remainingRows = this.pageData.rowCount % this.pageData.rollCount
//
let currentRollIndex = 0
let accumulatedRows = 0
for (let i = 0; i < this.pageData.rollCount; i++) {
const currentRollRows = rowsPerRoll + (i < remainingRows ? 1 : 0)
if (rowIndex < accumulatedRows + currentRollRows) {
currentRollIndex = i
break
}
accumulatedRows += currentRollRows
}
//
const currentRollRows = rowsPerRoll + (currentRollIndex < remainingRows ? 1 : 0)
//
if (rowIndex === accumulatedRows) {
return {
rowspan: currentRollRows,
colspan: 1
}
} else {
//
return {
rowspan: 0,
colspan: 0
}
}
}
},
// wrapper使padding-top
getRemarkWrapperStyle(rowIndex) {
if (this.pageData.rowCount <= 0 || this.pageData.rollCount <= 0) {
return {}
}
//
const rowsPerRoll = Math.floor(this.pageData.rowCount / this.pageData.rollCount)
const remainingRows = this.pageData.rowCount % this.pageData.rollCount
//
let currentRollIndex = 0
let accumulatedRows = 0
for (let i = 0; i < this.pageData.rollCount; i++) {
const currentRollRows = rowsPerRoll + (i < remainingRows ? 1 : 0)
if (rowIndex < accumulatedRows + currentRollRows) {
currentRollIndex = i
break
}
accumulatedRows += currentRollRows
}
//
const currentRollRows = rowsPerRoll + (currentRollIndex < remainingRows ? 1 : 0)
// 32px
const rowHeight = 32
const totalHeight = currentRollRows * rowHeight
// textarea24px
const textareaHeight = 24
// padding-top
const paddingTop = (totalHeight - textareaHeight) / 2
//
return {
paddingTop: paddingTop + 'px'
}
},
// ===================== =====================
//
@ -580,15 +714,27 @@ export default {
let totalDefectQty = 0
const rollRows = []
//
let rollRemark = ''
for (let i = 0; i < currentRollRows; i++) {
const row = this.rowDataList[currentRowIndex + i]
totalGoodQty += row.goodQty || 0
totalDefectQty += row.defectQty || 0
//
if (i === 0) {
rollRemark = row.remark || ''
}
rollRows.push({
rowNumber: row.rowNumber,
goodQty: row.goodQty || 0,
surfaceLossQty: row.surfaceLossQty || 0,
poorPerformanceQty: row.poorPerformanceQty || 0,
defectQty: row.defectQty || 0,
totalQty: row.totalQty || 0
totalQty: row.totalQty || 0,
remark: row.remark || ''
})
}
@ -598,7 +744,8 @@ export default {
rollQty: totalGoodQty, //
rollNums: 1, // 1
totalDefectQty: totalDefectQty, //
rollRows: rollRows //
rollRows: rollRows, //
remark: rollRemark //
}
//
@ -742,6 +889,71 @@ export default {
font-size: 12px;
}
/* 备注列单元格样式 - 使用绝对定位填满 */
.customer-dialog >>> .el-table td:last-child {
padding: 0 !important;
position: relative !important;
}
.customer-dialog /deep/ .el-table td:last-child {
padding: 0 !important;
position: relative !important;
}
/* 备注包装器 - 绝对定位填满单元格 */
.customer-dialog >>> .remark-wrapper {
position: absolute !important;
top: 0 !important;
left: 0 !important;
right: 0 !important;
bottom: 0 !important;
width: 100% !important;
height: 100% !important;
}
.customer-dialog /deep/ .remark-wrapper {
position: absolute !important;
top: 0 !important;
left: 0 !important;
right: 0 !important;
bottom: 0 !important;
width: 100% !important;
height: 100% !important;
}
/* 备注textarea */
.customer-dialog >>> .remark-textarea {
width: 100% !important;
height: 100% !important;
}
.customer-dialog >>> .remark-textarea .el-textarea__inner {
border: none !important;
padding: 8px 10px !important;
border-radius: 0 !important;
resize: none !important;
width: 100% !important;
height: 100% !important;
box-sizing: border-box !important;
overflow-y: auto !important;
}
.customer-dialog /deep/ .remark-textarea {
width: 100% !important;
height: 100% !important;
}
.customer-dialog /deep/ .remark-textarea .el-textarea__inner {
border: none !important;
padding: 8px 10px !important;
border-radius: 0 !important;
resize: none !important;
width: 100% !important;
height: 100% !important;
box-sizing: border-box !important;
overflow-y: auto !important;
}
</style>
<style lang="scss">
@ -757,4 +969,39 @@ export default {
color: #f56c6c !important;
font-size: 16px !important;
}
/* 备注列样式 - 只针对创建分卷对话框 */
.customer-css .el-table td:last-child {
padding: 0 !important;
position: relative !important;
}
/* 备注包装器 - 填满整个单元格 */
.customer-css .remark-wrapper {
position: absolute !important;
top: 0 !important;
left: 0 !important;
right: 0 !important;
bottom: 0 !important;
width: 100% !important;
height: 100% !important;
}
/* 备注textarea容器 */
.customer-css .remark-textarea {
width: 100% !important;
height: 100% !important;
}
.customer-css .remark-textarea .el-textarea__inner {
border: none !important;
padding: 8px 10px !important;
border-radius: 0 !important;
resize: none !important;
width: 100% !important;
height: 100% !important;
box-sizing: border-box !important;
overflow-y: auto !important;
}
</style>
Loading…
Cancel
Save