|
|
|
@ -964,6 +964,105 @@ |
|
|
|
<!-- 打印标签 --> |
|
|
|
<qr-code ref="qrCode"></qr-code> |
|
|
|
|
|
|
|
<el-dialog title="打印" :visible.sync="printDialogVisible" width="92%" top="4vh" :close-on-click-modal="false" :modal-append-to-body="false"> |
|
|
|
<div class="ipqc-print-wrap"> |
|
|
|
<div class="picked-no">检验单:{{ printOrder.inspectionNo }}</div> |
|
|
|
<div class="ipqc-print-sheet" ref="ipqcPrintSheet"> |
|
|
|
<table class="ipqc-print-table"> |
|
|
|
<colgroup> |
|
|
|
<col class="p-seq" /><col class="p-op col-op" /><col class="p-mode col-mode" /><col class="p-name" /> |
|
|
|
<col class="p-std" /><col class="p-tol" /><col class="p-min" /><col class="p-max" /> |
|
|
|
<col v-for="n in 10" :key="'pc'+n" class="p-cav" /> |
|
|
|
<col class="p-ok" /><col class="p-ng" /> |
|
|
|
</colgroup> |
|
|
|
<tr class="th"> |
|
|
|
<td rowspan="3" class="seq-cell"> |
|
|
|
<button type="button" class="sign-btn plus no-print" @click="addPrintRow">+</button> |
|
|
|
序号 |
|
|
|
</td> |
|
|
|
<td rowspan="3" class="col-op">操作</td> |
|
|
|
<td rowspan="3" class="col-mode">展现方式</td> |
|
|
|
<td rowspan="3">项目名称</td> |
|
|
|
<td rowspan="3">标准值 (MM)</td> |
|
|
|
<td rowspan="3">+Tol/-Tol</td> |
|
|
|
<td rowspan="3">MIN</td> |
|
|
|
<td rowspan="3">MAX</td> |
|
|
|
<td colspan="10">Measurement Results</td> |
|
|
|
<td rowspan="3">OK</td> |
|
|
|
<td rowspan="3">NOT OK</td> |
|
|
|
</tr> |
|
|
|
<tr class="th"> |
|
|
|
<td v-for="n in 10" :key="'cav'+n">CAV</td> |
|
|
|
</tr> |
|
|
|
<tr class="th"> |
|
|
|
<td v-for="n in 10" :key="'idx'+n">{{ n }}</td> |
|
|
|
</tr> |
|
|
|
<tr v-for="(row, index) in printRows" :key="row.uid"> |
|
|
|
<td class="seq-cell"> |
|
|
|
<button type="button" class="sign-btn minus no-print" @click="deletePrintRow(index)">−</button> |
|
|
|
{{ index + 1 }} |
|
|
|
</td> |
|
|
|
<td class="col-op"> |
|
|
|
<el-button size="mini" @click="openPrintItemDialog(row)">选择</el-button> |
|
|
|
</td> |
|
|
|
<td class="col-mode"> |
|
|
|
<select v-model="row.displayMode" class="mode-select" @change="rebuildPrintRow(row)"> |
|
|
|
<option value="列转行">列转行</option> |
|
|
|
<option value="行转列">行转列</option> |
|
|
|
</select> |
|
|
|
</td> |
|
|
|
<td class="left">{{ row.itemDesc }}</td> |
|
|
|
<td>{{ printNum(row.stdValue) }}</td> |
|
|
|
<td></td> |
|
|
|
<td>{{ printNum(row.minValue) }}</td> |
|
|
|
<td>{{ printNum(row.maxValue) }}</td> |
|
|
|
<td v-for="n in 10" :key="row.uid+'-'+n">{{ row.measures[n - 1] }}</td> |
|
|
|
<td>{{ row.itemResult === 'Y' ? '✓' : '' }}</td> |
|
|
|
<td>{{ row.itemResult === 'N' ? '✓' : '' }}</td> |
|
|
|
</tr> |
|
|
|
</table> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div slot="footer"> |
|
|
|
<el-button @click="printDialogVisible = false">取消</el-button> |
|
|
|
<el-button type="primary" @click="confirmPrintSheet">确定</el-button> |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
<el-dialog title="选择检验项目" :visible.sync="printItemVisible" width="60%" top="8vh" append-to-body :close-on-click-modal="false"> |
|
|
|
<el-form :inline="true" size="small"> |
|
|
|
<el-form-item label="项目名称"> |
|
|
|
<el-input v-model="printItemKey" clearable style="width: 200px" @keyup.enter.native="searchPrintItems"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item> |
|
|
|
<el-button type="primary" @click="searchPrintItems">查询</el-button> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
<el-table :data="printItemPage" border stripe highlight-current-row height="400" @current-change="row => printItemRow = row" @row-dblclick="confirmPrintItem"> |
|
|
|
<el-table-column type="index" label="序号" width="60" align="center"></el-table-column> |
|
|
|
<el-table-column prop="itemNo" label="检验项目编码" min-width="120"></el-table-column> |
|
|
|
<el-table-column prop="itemDesc" label="检验项目名称" min-width="180"></el-table-column> |
|
|
|
<el-table-column prop="defaultValue" label="标准值" min-width="100"></el-table-column> |
|
|
|
<el-table-column prop="minValue" label="最小值" min-width="90"></el-table-column> |
|
|
|
<el-table-column prop="maxValue" label="最大值" min-width="90"></el-table-column> |
|
|
|
<el-table-column prop="textValue" label="实测值" min-width="120"></el-table-column> |
|
|
|
</el-table> |
|
|
|
<el-pagination |
|
|
|
@size-change="val => { printItemLimit = val; printItemPageNo = 1 }" |
|
|
|
@current-change="val => { printItemPageNo = val }" |
|
|
|
:current-page="printItemPageNo" |
|
|
|
:page-sizes="[10, 20, 50]" |
|
|
|
:page-size="printItemLimit" |
|
|
|
:total="printItemFiltered.length" |
|
|
|
layout="total, sizes, prev, pager, next" |
|
|
|
style="margin-top: 10px; text-align: right;"> |
|
|
|
</el-pagination> |
|
|
|
<div slot="footer"> |
|
|
|
<el-button @click="printItemVisible = false">取消</el-button> |
|
|
|
<el-button type="primary" :disabled="!printItemRow" @click="confirmPrintItem()">确定</el-button> |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
<!-- 设置动态列 --> |
|
|
|
<column v-if="visible" ref="column" @refreshData="refreshColumnList"></column> |
|
|
|
</div> |
|
|
|
@ -1028,7 +1127,6 @@ |
|
|
|
getOperatorList |
|
|
|
} from '@/api/eam/eam.js' |
|
|
|
import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js' |
|
|
|
import {qcPrint} from '@/api/qc/qcPrint.js' |
|
|
|
import qcFAIUploadFile from "./qc_FAI_upload_file" |
|
|
|
import comQcItemImageUploadFile from "./com_qc_itemImage_upload_file" |
|
|
|
import subDetailUpload from "./sub_detail_upload"; |
|
|
|
@ -1055,6 +1153,17 @@ |
|
|
|
end = this.tableData.length |
|
|
|
} |
|
|
|
return this.tableData.slice(start,end) |
|
|
|
}, |
|
|
|
printItemFiltered () { |
|
|
|
const key = this.printItemQuery || '' |
|
|
|
return (this.printDetailList || []).filter(item => { |
|
|
|
if (!key) return true |
|
|
|
return String(item.itemDesc || '').toLowerCase().indexOf(key) >= 0 || String(item.itemNo || '').toLowerCase().indexOf(key) >= 0 |
|
|
|
}) |
|
|
|
}, |
|
|
|
printItemPage () { |
|
|
|
const start = (this.printItemPageNo - 1) * this.printItemLimit |
|
|
|
return this.printItemFiltered.slice(start, start + this.printItemLimit) |
|
|
|
} |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
@ -2265,6 +2374,18 @@ |
|
|
|
resourceList: [], |
|
|
|
partList: [], |
|
|
|
IPQCSelections: [], |
|
|
|
printDialogVisible: false, |
|
|
|
printOrder: {}, |
|
|
|
printRows: [], |
|
|
|
printSeed: 1, |
|
|
|
printDetailList: [], |
|
|
|
printItemVisible: false, |
|
|
|
printItemKey: '', |
|
|
|
printItemQuery: '', |
|
|
|
printItemPageNo: 1, |
|
|
|
printItemLimit: 10, |
|
|
|
printItemRow: null, |
|
|
|
printCurrentRow: null, |
|
|
|
rules: { |
|
|
|
seqNoType: [ |
|
|
|
{ |
|
|
|
@ -2684,11 +2805,157 @@ |
|
|
|
this.$message.warning('请勾选要打印的检验单!') |
|
|
|
return |
|
|
|
} |
|
|
|
const inspectionNos = this.$refs.qrCode.init(this.IPQCSelections.map(item => item.inspectionNo)) |
|
|
|
for (let i = 0; i < inspectionNos.length; i++) { |
|
|
|
this.IPQCSelections[i].qrCode = inspectionNos[i] |
|
|
|
if (this.IPQCSelections.length !== 1) { |
|
|
|
this.$message.warning('一次只能选择一个检验单!') |
|
|
|
return |
|
|
|
} |
|
|
|
const order = this.IPQCSelections[0] |
|
|
|
this.printOrder = order |
|
|
|
this.printRows = [] |
|
|
|
for (let i = 0; i < 6; i++) this.printRows.push(this.newPrintRow()) |
|
|
|
this.printDetailList = [] |
|
|
|
this.printDialogVisible = true |
|
|
|
ipqcDetailSearch({ |
|
|
|
site: order.site, |
|
|
|
buNo: order.buNo, |
|
|
|
inspectionNo: order.inspectionNo |
|
|
|
}).then(({data}) => { |
|
|
|
this.printDetailList = (data && data.code === 0 && data.rows) ? data.rows : [] |
|
|
|
}) |
|
|
|
}, |
|
|
|
newPrintRow () { |
|
|
|
this.printSeed += 1 |
|
|
|
return { |
|
|
|
uid: this.printSeed, |
|
|
|
displayMode: '列转行', |
|
|
|
itemNo: '', |
|
|
|
itemDesc: '', |
|
|
|
stdValue: '', |
|
|
|
minValue: '', |
|
|
|
maxValue: '', |
|
|
|
itemResult: '', |
|
|
|
subDetails: [], |
|
|
|
measures: ['', '', '', '', '', '', '', '', '', ''] |
|
|
|
} |
|
|
|
}, |
|
|
|
addPrintRow () { |
|
|
|
this.printRows.push(this.newPrintRow()) |
|
|
|
}, |
|
|
|
deletePrintRow (index) { |
|
|
|
this.printRows.splice(index, 1) |
|
|
|
}, |
|
|
|
printNum (value) { |
|
|
|
return value == null || value === '' ? '' : value |
|
|
|
}, |
|
|
|
openPrintItemDialog (row) { |
|
|
|
if (!this.printDetailList.length) { |
|
|
|
this.$message.warning('当前检验单没有检验项目') |
|
|
|
return |
|
|
|
} |
|
|
|
this.printCurrentRow = row |
|
|
|
this.printItemRow = null |
|
|
|
this.printItemKey = '' |
|
|
|
this.printItemQuery = '' |
|
|
|
this.printItemPageNo = 1 |
|
|
|
this.printItemVisible = true |
|
|
|
}, |
|
|
|
searchPrintItems () { |
|
|
|
this.printItemQuery = (this.printItemKey || '').trim().toLowerCase() |
|
|
|
this.printItemPageNo = 1 |
|
|
|
}, |
|
|
|
confirmPrintItem (row) { |
|
|
|
if (row && row.itemNo) this.printItemRow = row |
|
|
|
const detail = this.printItemRow |
|
|
|
const current = this.printCurrentRow |
|
|
|
if (!detail || !current) return |
|
|
|
this.$set(current, 'itemNo', detail.itemNo || '') |
|
|
|
this.$set(current, 'itemDesc', detail.itemDesc || '') |
|
|
|
this.$set(current, 'stdValue', detail.defaultValue != null ? detail.defaultValue : '') |
|
|
|
this.$set(current, 'minValue', detail.minValue != null ? detail.minValue : '') |
|
|
|
this.$set(current, 'maxValue', detail.maxValue != null ? detail.maxValue : '') |
|
|
|
this.$set(current, 'itemResult', detail.itemResult || '') |
|
|
|
this.printItemVisible = false |
|
|
|
selectIPQCSubDetailedRecord({ |
|
|
|
site: this.printOrder.site || '', |
|
|
|
buNo: this.printOrder.buNo || '', |
|
|
|
inspectionNo: this.printOrder.inspectionNo || '', |
|
|
|
itemNo: current.itemNo |
|
|
|
}).then(({data}) => { |
|
|
|
const list = ((data && data.rows) || []).slice().sort((a, b) => (a.num || 0) - (b.num || 0)) |
|
|
|
this.$set(current, 'subDetails', list) |
|
|
|
this.rebuildPrintRow(current) |
|
|
|
}) |
|
|
|
}, |
|
|
|
rebuildPrintRow (row) { |
|
|
|
this.$set(row, 'measures', this.calcPrintMeasures(row.displayMode, row.subDetails || [])) |
|
|
|
}, |
|
|
|
calcPrintMeasures (mode, subDetails) { |
|
|
|
const textOf = value => value == null ? '' : String(value).trim() |
|
|
|
const rows = (subDetails || []).slice().sort((a, b) => (a.num || 0) - (b.num || 0)) |
|
|
|
const raw = [] |
|
|
|
if (mode === '行转列') { |
|
|
|
const first = rows[0] || {} |
|
|
|
const second = rows[1] || {} |
|
|
|
;[first.subDetailValue, first.subDetailValueB, first.subDetailValueC, first.subDetailValueD, first.subDetailValueE, |
|
|
|
second.subDetailValue, second.subDetailValueB, second.subDetailValueC, second.subDetailValueD, second.subDetailValueE] |
|
|
|
.forEach(value => raw.push(textOf(value))) |
|
|
|
} else { |
|
|
|
rows.forEach(item => raw.push(textOf(item.subDetailValue))) |
|
|
|
if (raw.filter(value => value).length < 10) { |
|
|
|
rows.forEach(item => raw.push(textOf(item.subDetailValueB))) |
|
|
|
} |
|
|
|
} |
|
|
|
qcPrint(this.IPQCSelections) |
|
|
|
const out = raw.filter(value => value) |
|
|
|
while (out.length < 10) out.push('') |
|
|
|
return out.slice(0, 10) |
|
|
|
}, |
|
|
|
confirmPrintSheet () { |
|
|
|
const sheet = this.$refs.ipqcPrintSheet |
|
|
|
if (!sheet) return |
|
|
|
const clone = sheet.cloneNode(true) |
|
|
|
const hidden = { 2: true, 3: true } |
|
|
|
Array.prototype.forEach.call(clone.querySelectorAll('.no-print'), function (el) { |
|
|
|
if (el.parentNode) el.parentNode.removeChild(el) |
|
|
|
}) |
|
|
|
Array.prototype.forEach.call(clone.querySelectorAll('tr'), function (tr) { |
|
|
|
let col = 1 |
|
|
|
const cells = [] |
|
|
|
Array.prototype.forEach.call(tr.children, function (el) { |
|
|
|
if (el.tagName === 'TD') cells.push(el) |
|
|
|
}) |
|
|
|
cells.forEach(function (cell) { |
|
|
|
const span = parseInt(cell.getAttribute('colspan') || '1', 10) |
|
|
|
let hiddenCount = 0 |
|
|
|
for (let c = col; c < col + span; c++) { |
|
|
|
if (hidden[c]) hiddenCount++ |
|
|
|
} |
|
|
|
const drop = cell.classList.contains('col-op') || cell.classList.contains('col-mode') |
|
|
|
if (drop) { |
|
|
|
if (cell.parentNode) cell.parentNode.removeChild(cell) |
|
|
|
} else if (span > 1 && hiddenCount > 0) { |
|
|
|
cell.setAttribute('colspan', String(span - hiddenCount)) |
|
|
|
} |
|
|
|
col += span |
|
|
|
}) |
|
|
|
}) |
|
|
|
Array.prototype.forEach.call(clone.querySelectorAll('col.col-op, col.col-mode'), function (col) { |
|
|
|
if (col.parentNode) col.parentNode.removeChild(col) |
|
|
|
}) |
|
|
|
const style = ` |
|
|
|
@page { size: A4 landscape; margin: 8mm; } |
|
|
|
body { margin: 0; } |
|
|
|
table { width: 100%; border-collapse: collapse; table-layout: fixed; } |
|
|
|
td { border: 1px solid #000; text-align: center; vertical-align: middle; font-size: 10px; padding: 2px; word-break: break-all; } |
|
|
|
.left { text-align: left; } |
|
|
|
` |
|
|
|
const printWindow = window.open('', '_blank') |
|
|
|
printWindow.document.write('<!DOCTYPE html><html><head><title>IPQC检验</title><style>' + style + '</style></head><body>' + clone.innerHTML + '</body></html>') |
|
|
|
printWindow.document.close() |
|
|
|
printWindow.focus() |
|
|
|
setTimeout(() => { |
|
|
|
printWindow.print() |
|
|
|
printWindow.close() |
|
|
|
}, 300) |
|
|
|
}, |
|
|
|
|
|
|
|
// 数据采集 |
|
|
|
@ -4570,4 +4837,52 @@ |
|
|
|
height: auto; |
|
|
|
line-height: 1.5; |
|
|
|
} |
|
|
|
.ipqc-print-wrap .picked-no { |
|
|
|
margin-bottom: 8px; |
|
|
|
color: #606266; |
|
|
|
} |
|
|
|
.ipqc-print-sheet { |
|
|
|
overflow: auto; |
|
|
|
padding-left: 28px; |
|
|
|
} |
|
|
|
.ipqc-print-table { |
|
|
|
width: 100%; |
|
|
|
min-width: 1100px; |
|
|
|
border-collapse: collapse; |
|
|
|
table-layout: fixed; |
|
|
|
} |
|
|
|
.ipqc-print-table td { |
|
|
|
border: 1px solid #000; |
|
|
|
text-align: center; |
|
|
|
vertical-align: middle; |
|
|
|
font-size: 12px; |
|
|
|
height: 28px; |
|
|
|
padding: 2px 4px; |
|
|
|
} |
|
|
|
.ipqc-print-table .left { text-align: left; padding-left: 4px; } |
|
|
|
.ipqc-print-table .th td { font-weight: 700; background: #f7f7f7; } |
|
|
|
.p-seq { width: 42px; } |
|
|
|
.p-op { width: 64px; } |
|
|
|
.p-mode { width: 78px; } |
|
|
|
.p-name { width: 120px; } |
|
|
|
.p-std, .p-tol, .p-min, .p-max { width: 72px; } |
|
|
|
.p-cav { width: 42px; } |
|
|
|
.p-ok, .p-ng { width: 48px; } |
|
|
|
.seq-cell { position: relative; } |
|
|
|
.sign-btn { |
|
|
|
position: absolute; |
|
|
|
left: -22px; |
|
|
|
top: 50%; |
|
|
|
width: 18px; |
|
|
|
height: 18px; |
|
|
|
margin-top: -9px; |
|
|
|
padding: 0; |
|
|
|
border-radius: 2px; |
|
|
|
background: #fff; |
|
|
|
line-height: 16px; |
|
|
|
cursor: pointer; |
|
|
|
} |
|
|
|
.sign-btn.minus { color: #f56c6c; border: 1px solid #f56c6c; } |
|
|
|
.sign-btn.plus { color: #409eff; border: 1px solid #409eff; top: 14px; } |
|
|
|
.mode-select { width: 72px; height: 22px; font-size: 12px; } |
|
|
|
</style> |