4 changed files with 826 additions and 10 deletions
-
BINsrc/assets/img/dimension-report-logo.png
-
1src/router/index.js
-
11src/views/modules/qc/qmsPropertiesModel.vue
-
824src/views/modules/report/dimension_report.vue
|
After Width: 397 | Height: 137 | Size: 9.6 KiB |
@ -0,0 +1,824 @@ |
|||||
|
<template> |
||||
|
<div class="dimension-report-container"> |
||||
|
<div class="toolbar no-print"> |
||||
|
<el-button type="warning" @click="openTemplateDialog">选择模板</el-button> |
||||
|
<el-button type="primary" :disabled="!selectedTemplateCode" @click="openSelectDialog">选择检验单</el-button> |
||||
|
<el-button type="success" @click="printReport">打印</el-button> |
||||
|
<span v-if="reportData.inspectionNo" class="picked-no">检验单:{{ reportData.inspectionNo }}</span> |
||||
|
</div> |
||||
|
|
||||
|
<div class="report-content" v-if="selectedTemplateCode"> |
||||
|
<table class="dim-table"> |
||||
|
<colgroup> |
||||
|
<col class="c-a" /><col class="c-b" /><col class="c-c" /><col class="c-d" /> |
||||
|
<col class="c-e" /><col class="c-f" /><col class="c-g" /><col class="c-h" /> |
||||
|
<col v-for="n in 10" :key="'cv'+n" class="c-cav" /> |
||||
|
<col class="c-ok" /><col class="c-ng" /> |
||||
|
</colgroup> |
||||
|
<tr class="head-row"> |
||||
|
<td colspan="7" class="logo-cell"> |
||||
|
<img :src="logo" class="logo" alt="" /> |
||||
|
</td> |
||||
|
<td colspan="13" class="title-cell">Products Dimension Inspection Report</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td colspan="5" class="label">Part Type</td> |
||||
|
<td colspan="3" class="value"> |
||||
|
<span class="opt" @click="partType = 'New'">{{ partType === 'New' ? '■' : '□' }} New</span> |
||||
|
<span class="opt" @click="partType = 'Production'">{{ partType === 'Production' ? '■' : '□' }} Production</span> |
||||
|
<span class="opt" @click="partType = 'Stock'">{{ partType === 'Stock' ? '■' : '□' }} Stock</span> |
||||
|
</td> |
||||
|
<td colspan="2" class="label">Part Name</td> |
||||
|
<td colspan="2" class="value">{{ reportData.partDesc || '' }}</td> |
||||
|
<td colspan="2" class="label">Raw Material</td> |
||||
|
<td colspan="2" class="value">{{ headerText('Raw Material') }}</td> |
||||
|
<td colspan="2" class="label">Durometer</td> |
||||
|
<td colspan="2" class="value">{{ headerText('Durometer') }}</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td colspan="5" class="label">Vulcanize Temp.</td> |
||||
|
<td colspan="3" class="value">{{ headerText('Vulcanize Temp.') }}</td> |
||||
|
<td colspan="2" class="label">Curing Pressure</td> |
||||
|
<td colspan="2" class="value">{{ headerText('Curing Pressure') }}</td> |
||||
|
<td colspan="2" class="label">Curing Time:</td> |
||||
|
<td colspan="2" class="value">{{ headerText('Curing Time') }}</td> |
||||
|
<td colspan="2" class="label">Added Weight</td> |
||||
|
<td colspan="2" class="value">{{ headerText('Added Weight') }}</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td colspan="5" class="label">Bake Channels</td> |
||||
|
<td colspan="3" class="value">{{ headerText('Bake Channels') }}</td> |
||||
|
<td colspan="2" class="label">Hi-Temp Furnace</td> |
||||
|
<td colspan="2" class="value">{{ headerText('Hi-Temp Furnace') }}</td> |
||||
|
<td colspan="2" class="label">Channel Speed</td> |
||||
|
<td colspan="2" class="value">{{ headerText('Channel Speed') }}</td> |
||||
|
<td colspan="2" class="label">Extrusion Power</td> |
||||
|
<td colspan="2" class="value">{{ headerText('Extrusion Power') }}</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td colspan="5" class="label">Front DIM.</td> |
||||
|
<td colspan="3" class="value">{{ headerText('Front DIM.') }}</td> |
||||
|
<td colspan="2" class="label">Back DIM</td> |
||||
|
<td colspan="2" class="value">{{ headerText('Back DIM') }}</td> |
||||
|
<td colspan="2" class="label">filter mash</td> |
||||
|
<td colspan="2" class="value">{{ headerText('filter mash') }}</td> |
||||
|
<td colspan="2" class="label">Job Number:</td> |
||||
|
<td colspan="2" class="value">{{ headerText('Job Number') }}</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td colspan="5" class="label">Cooling Temp.</td> |
||||
|
<td colspan="2" class="value">{{ headerText('Cooling Temp.') }}</td> |
||||
|
<td colspan="2" class="label">Feed/Body Temp.</td> |
||||
|
<td colspan="3" class="value">{{ feedBodyText() }}</td> |
||||
|
<td colspan="2" class="label">Post Cure Temp.</td> |
||||
|
<td colspan="2" class="value">{{ headerText('Post Cure Temp.') }}</td> |
||||
|
<td colspan="2" class="label">Post Cure Time:</td> |
||||
|
<td colspan="2" class="value">{{ headerText('Post Cure Time') }}</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td colspan="5"></td> |
||||
|
<td colspan="3"></td> |
||||
|
<td colspan="2" class="label">Tolerance STD</td> |
||||
|
<td colspan="2" class="value">{{ headerText('Tolerance STD') }}</td> |
||||
|
<td colspan="2" class="label">Curing Agent</td> |
||||
|
<td colspan="2" class="value">{{ headerText('Curing Agent') }}</td> |
||||
|
<td colspan="2" class="label">Machine Type</td> |
||||
|
<td colspan="2" class="value">{{ headerText('Machine Type') }}</td> |
||||
|
</tr> |
||||
|
<tr class="th"> |
||||
|
<td rowspan="3">序号</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" class="measure-title">Measurement Results</td> |
||||
|
<td rowspan="3">OK</td> |
||||
|
<td rowspan="3">NOT OK</td> |
||||
|
</tr> |
||||
|
<tr class="th cav-row"> |
||||
|
<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 measureRows" :key="index"> |
||||
|
<td class="seq-cell"> |
||||
|
<button type="button" class="sign-btn minus no-print" @click="deleteMeasureRow(index)">−</button> |
||||
|
{{ index + 1 }} |
||||
|
</td> |
||||
|
<td class="col-op"> |
||||
|
<el-button size="mini" @click="openItemDialog(row)">选择</el-button> |
||||
|
</td> |
||||
|
<td class="col-mode"> |
||||
|
<select v-model="row.displayMode" class="mode-select" @change="rebuildMeasures(row)"> |
||||
|
<option value="列转行">列转行</option> |
||||
|
<option value="行转列">行转列</option> |
||||
|
</select> |
||||
|
</td> |
||||
|
<td class="left">{{ row.itemDesc }}</td> |
||||
|
<td>{{ displayNum(row.stdValue) }}</td> |
||||
|
<td></td> |
||||
|
<td>{{ displayNum(row.minValue) }}</td> |
||||
|
<td>{{ displayNum(row.maxValue) }}</td> |
||||
|
<td v-for="n in 10" :key="'m'+index+'-'+n">{{ row.measures[n - 1] }}</td> |
||||
|
<td>{{ row.itemResult === 'Y' ? '✓' : '' }}</td> |
||||
|
<td>{{ row.itemResult === 'N' ? '✓' : '' }}</td> |
||||
|
</tr> |
||||
|
<tr class="foot-row"> |
||||
|
<td colspan="5" class="label left-label seq-cell"> |
||||
|
<button type="button" class="sign-btn plus no-print" @click="addMeasureRow">+</button> |
||||
|
Inspector |
||||
|
</td> |
||||
|
<td colspan="2" class="value"> |
||||
|
<input v-model="inspector" class="plain-input" /> |
||||
|
</td> |
||||
|
<td colspan="2" class="label">Measure Date</td> |
||||
|
<td colspan="2" class="value"> |
||||
|
<input v-model="measureDate" class="plain-input" /> |
||||
|
</td> |
||||
|
<td colspan="2" class="label">Sample Date</td> |
||||
|
<td colspan="2" class="value"> |
||||
|
<input v-model="sampleDate" class="plain-input" /> |
||||
|
</td> |
||||
|
<td colspan="2" class="label">Measure Machine</td> |
||||
|
<td colspan="3" class="value"> |
||||
|
<span class="opt" @click="toggleMachine('Callipers')">{{ machines.indexOf('Callipers') >= 0 ? '■' : '□' }} Callipers</span> |
||||
|
<span class="opt" @click="toggleMachine('VMS2030')">{{ machines.indexOf('VMS2030') >= 0 ? '■' : '□' }} VMS2030</span> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</table> |
||||
|
</div> |
||||
|
|
||||
|
<div v-else class="empty-state"> |
||||
|
<i class="el-icon-document" style="font-size: 60px; color: #dcdfe6;"></i> |
||||
|
<p style="color: #909399; margin-top: 20px;">请先点击"选择模板"按钮选择属性模板,再选择检验单</p> |
||||
|
</div> |
||||
|
|
||||
|
<el-dialog title="选择检验单" :visible.sync="selectDialogVisible" width="90%" top="5vh" :modal-append-to-body="false" :destroy-on-close="true"> |
||||
|
<el-form :inline="true" :model="searchData" size="small"> |
||||
|
<el-form-item label="检验单号"> |
||||
|
<el-input v-model="searchData.inspectionNo" clearable style="width: 150px"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="物料编码"> |
||||
|
<el-input v-model="searchData.partNo" clearable style="width: 150px"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="物料名称"> |
||||
|
<el-input v-model="searchData.partDesc" clearable style="width: 200px"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item> |
||||
|
<el-button type="primary" @click="searchInspectionList">查询</el-button> |
||||
|
<el-button @click="resetSearch">重置</el-button> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
<el-table :data="inspectionList" border stripe highlight-current-row height="450" @current-change="row => selectedRow = row" @row-dblclick="handleRowDblClick"> |
||||
|
<el-table-column type="index" label="序号" width="60" align="center"></el-table-column> |
||||
|
<el-table-column prop="inspectionNo" label="检验单号" min-width="150"></el-table-column> |
||||
|
<el-table-column prop="partNo" label="物料编码" min-width="120"></el-table-column> |
||||
|
<el-table-column prop="partDesc" label="物料名称" min-width="150"></el-table-column> |
||||
|
<el-table-column prop="inspectionResult" label="检验结论" min-width="100" align="center"></el-table-column> |
||||
|
<el-table-column prop="taskDate" label="送检日期" min-width="150"></el-table-column> |
||||
|
</el-table> |
||||
|
<el-pagination |
||||
|
@size-change="val => { searchData.limit = val; searchData.page = 1; searchInspectionList() }" |
||||
|
@current-change="val => { searchData.page = val; searchInspectionList() }" |
||||
|
:current-page="searchData.page" |
||||
|
:page-sizes="[10, 20, 50, 100]" |
||||
|
:page-size="searchData.limit" |
||||
|
:total="totalPage" |
||||
|
layout="total, sizes, prev, pager, next, jumper" |
||||
|
style="margin-top: 10px; text-align: right;"> |
||||
|
</el-pagination> |
||||
|
<div slot="footer"> |
||||
|
<el-button @click="selectDialogVisible = false">取消</el-button> |
||||
|
<el-button type="primary" :disabled="!selectedRow" @click="confirmInspection">确定</el-button> |
||||
|
</div> |
||||
|
</el-dialog> |
||||
|
|
||||
|
<el-dialog title="选择模板" :visible.sync="templateDialogVisible" width="60%" top="8vh" :modal-append-to-body="false" :destroy-on-close="true"> |
||||
|
<el-form :inline="true" :model="templateSearchData" size="small"> |
||||
|
<el-form-item label="模板编号"> |
||||
|
<el-input v-model="templateSearchData.codeNo" clearable style="width: 150px"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="模板名称"> |
||||
|
<el-input v-model="templateSearchData.codeDesc" clearable style="width: 200px"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item> |
||||
|
<el-button type="primary" @click="searchTemplateList">查询</el-button> |
||||
|
<el-button @click="resetTemplateSearch">重置</el-button> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
<el-table :data="attributeTemplateList" border stripe highlight-current-row height="400" @current-change="row => selectedTemplateRow = row" @row-dblclick="handleTemplateRowDblClick"> |
||||
|
<el-table-column type="index" label="序号" width="60" align="center"></el-table-column> |
||||
|
<el-table-column prop="codeNo" label="属性模板编号" min-width="150"></el-table-column> |
||||
|
<el-table-column prop="codeDesc" label="属性模板名称" min-width="220"></el-table-column> |
||||
|
<el-table-column prop="functionType" label="功能类型" min-width="100"></el-table-column> |
||||
|
</el-table> |
||||
|
<el-pagination |
||||
|
@size-change="val => { templateSearchData.limit = val; templateSearchData.page = 1; searchTemplateList() }" |
||||
|
@current-change="val => { templateSearchData.page = val; searchTemplateList() }" |
||||
|
:current-page="templateSearchData.page" |
||||
|
:page-sizes="[10, 20, 50, 100]" |
||||
|
:page-size="templateSearchData.limit" |
||||
|
:total="templateTotalPage" |
||||
|
layout="total, sizes, prev, pager, next, jumper" |
||||
|
style="margin-top: 10px; text-align: right;"> |
||||
|
</el-pagination> |
||||
|
<div slot="footer"> |
||||
|
<el-button @click="templateDialogVisible = false">取消</el-button> |
||||
|
<el-button type="primary" :disabled="!selectedTemplateRow" @click="confirmTemplateSelection">确定</el-button> |
||||
|
</div> |
||||
|
</el-dialog> |
||||
|
|
||||
|
<el-dialog title="选择检验项目" :visible.sync="itemDialogVisible" width="60%" top="8vh" :modal-append-to-body="false" :destroy-on-close="true"> |
||||
|
<el-form :inline="true" :model="itemSearchData" size="small"> |
||||
|
<el-form-item label="项目名称"> |
||||
|
<el-input v-model="itemSearchData.itemDesc" clearable style="width: 200px"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item> |
||||
|
<el-button type="primary" @click="searchItemList">查询</el-button> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
<el-table :data="itemList" border stripe highlight-current-row height="400" @current-change="row => selectedItemRow = row" @row-dblclick="handleItemDblClick"> |
||||
|
<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 => { itemSearchData.limit = val; itemSearchData.page = 1; searchItemList() }" |
||||
|
@current-change="val => { itemSearchData.page = val; searchItemList() }" |
||||
|
:current-page="itemSearchData.page" |
||||
|
:page-sizes="[10, 20, 50, 100]" |
||||
|
:page-size="itemSearchData.limit" |
||||
|
:total="itemTotalPage" |
||||
|
layout="total, sizes, prev, pager, next, jumper" |
||||
|
style="margin-top: 10px; text-align: right;"> |
||||
|
</el-pagination> |
||||
|
<div slot="footer"> |
||||
|
<el-button @click="itemDialogVisible = false">取消</el-button> |
||||
|
<el-button type="primary" :disabled="!selectedItemRow" @click="confirmItem">确定</el-button> |
||||
|
</div> |
||||
|
</el-dialog> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import logo from '@/assets/img/dimension-report-logo.png' |
||||
|
import { getIQCRecordList, getPropertiesModelList, getPropertiesModelDetail, getIQCDetailedRecordList } from '@/api/qc/qc_report.js' |
||||
|
import { selectIQCSubDetailedRecord } from '@/api/qc/qc.js' |
||||
|
|
||||
|
const HEADER_LABELS = [ |
||||
|
'Raw Material', 'Durometer', 'Vulcanize Temp.', 'Curing Pressure', 'Curing Time', |
||||
|
'Added Weight', 'Bake Channels', 'Hi-Temp Furnace', 'Channel Speed', 'Extrusion Power', |
||||
|
'Front DIM.', 'Back DIM', 'filter mash', 'Job Number', 'Cooling Temp.', |
||||
|
'Feed/Body Temp.', 'Post Cure Temp.', 'Post Cure Time', 'Tolerance STD', |
||||
|
'Curing Agent', 'Machine Type' |
||||
|
] |
||||
|
|
||||
|
function normName (value) { |
||||
|
return String(value == null ? '' : value).replace(/[\s::.。]/g, '').toLowerCase() |
||||
|
} |
||||
|
|
||||
|
const HEADER_KEY_SET = {} |
||||
|
HEADER_LABELS.forEach(label => { HEADER_KEY_SET[normName(label)] = true }) |
||||
|
|
||||
|
export default { |
||||
|
name: '产品尺寸测量报告', |
||||
|
data () { |
||||
|
return { |
||||
|
logo, |
||||
|
partType: '', |
||||
|
machines: [], |
||||
|
inspector: '', |
||||
|
measureDate: '', |
||||
|
sampleDate: '', |
||||
|
headerValues: {}, |
||||
|
templateRows: [], |
||||
|
measureRows: [], |
||||
|
detailMap: {}, |
||||
|
reportData: {}, |
||||
|
selectedTemplateCode: '', |
||||
|
selectedTemplateDesc: '', |
||||
|
templateDialogVisible: false, |
||||
|
selectedTemplateRow: null, |
||||
|
attributeTemplateList: [], |
||||
|
templateTotalPage: 0, |
||||
|
templateSearchData: { codeNo: '', codeDesc: '', page: 1, limit: 10 }, |
||||
|
selectDialogVisible: false, |
||||
|
selectedRow: null, |
||||
|
inspectionList: [], |
||||
|
totalPage: 0, |
||||
|
searchData: { |
||||
|
site: '', |
||||
|
userName: this.$store.state.user.name, |
||||
|
inspectionNo: '', |
||||
|
partNo: '', |
||||
|
partDesc: '', |
||||
|
page: 1, |
||||
|
limit: 10 |
||||
|
}, |
||||
|
itemDialogVisible: false, |
||||
|
currentMeasureRow: null, |
||||
|
selectedItemRow: null, |
||||
|
itemList: [], |
||||
|
itemTotalPage: 0, |
||||
|
itemSearchData: { itemDesc: '', page: 1, limit: 10 } |
||||
|
} |
||||
|
}, |
||||
|
mounted () { |
||||
|
this.measureDate = this.today() |
||||
|
}, |
||||
|
methods: { |
||||
|
today () { |
||||
|
const now = new Date() |
||||
|
const m = String(now.getMonth() + 1).padStart(2, '0') |
||||
|
const d = String(now.getDate()).padStart(2, '0') |
||||
|
return now.getFullYear() + '/' + m + '/' + d |
||||
|
}, |
||||
|
normName (value) { |
||||
|
return normName(value) |
||||
|
}, |
||||
|
blankMeasures () { |
||||
|
return ['', '', '', '', '', '', '', '', '', ''] |
||||
|
}, |
||||
|
newMeasureRow () { |
||||
|
return { |
||||
|
displayMode: '列转行', |
||||
|
itemNo: '', |
||||
|
itemDesc: '', |
||||
|
stdValue: '', |
||||
|
minValue: '', |
||||
|
maxValue: '', |
||||
|
itemResult: '', |
||||
|
subDetails: [], |
||||
|
measures: this.blankMeasures() |
||||
|
} |
||||
|
}, |
||||
|
addMeasureRow () { |
||||
|
this.measureRows.push(this.newMeasureRow()) |
||||
|
}, |
||||
|
deleteMeasureRow (index) { |
||||
|
this.measureRows.splice(index, 1) |
||||
|
}, |
||||
|
blankRows () { |
||||
|
const rows = [] |
||||
|
for (let i = 0; i < 14; i++) rows.push(this.newMeasureRow()) |
||||
|
return rows |
||||
|
}, |
||||
|
headerText (label) { |
||||
|
const value = this.headerValues[normName(label)] |
||||
|
return value == null ? '' : value |
||||
|
}, |
||||
|
feedBodyText () { |
||||
|
const value = this.headerText('Feed/Body Temp.') |
||||
|
return value || '/ / /' |
||||
|
}, |
||||
|
displayNum (value) { |
||||
|
return value == null || value === '' ? '' : value |
||||
|
}, |
||||
|
toggleMachine (name) { |
||||
|
const index = this.machines.indexOf(name) |
||||
|
if (index >= 0) this.machines.splice(index, 1) |
||||
|
else this.machines.push(name) |
||||
|
}, |
||||
|
openTemplateDialog () { |
||||
|
this.resetTemplateSearch() |
||||
|
this.templateDialogVisible = true |
||||
|
this.searchTemplateList() |
||||
|
}, |
||||
|
resetTemplateSearch () { |
||||
|
this.templateSearchData = { codeNo: '', codeDesc: '', page: 1, limit: 10 } |
||||
|
this.selectedTemplateRow = null |
||||
|
}, |
||||
|
searchTemplateList () { |
||||
|
getPropertiesModelList({ |
||||
|
codeNo: this.templateSearchData.codeNo || '', |
||||
|
codeDesc: this.templateSearchData.codeDesc || '', |
||||
|
page: this.templateSearchData.page, |
||||
|
limit: this.templateSearchData.limit |
||||
|
}).then(({data}) => { |
||||
|
if (data && data.code === 0) { |
||||
|
this.attributeTemplateList = (data.page && data.page.list) || [] |
||||
|
this.templateTotalPage = (data.page && data.page.totalCount) || 0 |
||||
|
} else { |
||||
|
this.attributeTemplateList = [] |
||||
|
this.templateTotalPage = 0 |
||||
|
this.$message.error((data && data.msg) || '属性模板查询失败') |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
handleTemplateRowDblClick (row) { |
||||
|
this.selectedTemplateRow = row |
||||
|
this.confirmTemplateSelection() |
||||
|
}, |
||||
|
confirmTemplateSelection () { |
||||
|
if (!this.selectedTemplateRow) return |
||||
|
this.selectedTemplateCode = this.selectedTemplateRow.codeNo |
||||
|
this.selectedTemplateDesc = this.selectedTemplateRow.codeDesc || '' |
||||
|
this.templateDialogVisible = false |
||||
|
this.reportData = {} |
||||
|
this.partType = '' |
||||
|
this.machines = [] |
||||
|
this.headerValues = {} |
||||
|
this.detailMap = {} |
||||
|
this.templateRows = [] |
||||
|
this.measureRows = this.blankRows() |
||||
|
this.loadTemplateDetail() |
||||
|
}, |
||||
|
loadTemplateDetail () { |
||||
|
getPropertiesModelDetail({ codeNo: this.selectedTemplateCode }).then(({data}) => { |
||||
|
if (data && data.code === 0) { |
||||
|
this.templateRows = data.rows || [] |
||||
|
} else { |
||||
|
this.templateRows = [] |
||||
|
this.$message.error((data && data.msg) || '属性模板明细查询失败') |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
openSelectDialog () { |
||||
|
if (!this.selectedTemplateCode) { |
||||
|
this.$message.warning('请先选择属性模板') |
||||
|
this.openTemplateDialog() |
||||
|
return |
||||
|
} |
||||
|
this.selectDialogVisible = true |
||||
|
this.resetSearch() |
||||
|
}, |
||||
|
resetSearch () { |
||||
|
this.searchData = { |
||||
|
site: '', |
||||
|
userName: this.$store.state.user.name, |
||||
|
inspectionNo: '', |
||||
|
partNo: '', |
||||
|
partDesc: '', |
||||
|
page: 1, |
||||
|
limit: 10 |
||||
|
} |
||||
|
this.inspectionList = [] |
||||
|
this.totalPage = 0 |
||||
|
this.selectedRow = null |
||||
|
}, |
||||
|
searchInspectionList () { |
||||
|
getIQCRecordList({ |
||||
|
site: this.searchData.site || '', |
||||
|
userName: this.searchData.userName || this.$store.state.user.name, |
||||
|
inspectionNo: this.searchData.inspectionNo || '', |
||||
|
partNo: this.searchData.partNo || '', |
||||
|
partDesc: this.searchData.partDesc || '', |
||||
|
page: this.searchData.page, |
||||
|
limit: this.searchData.limit |
||||
|
}).then(({data}) => { |
||||
|
if (data && data.code === 0) { |
||||
|
this.inspectionList = (data.page && data.page.list) || [] |
||||
|
this.totalPage = (data.page && data.page.totalCount) || 0 |
||||
|
} else { |
||||
|
this.$message.error((data && data.msg) || '查询失败') |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
handleRowDblClick (row) { |
||||
|
this.selectedRow = row |
||||
|
this.confirmInspection() |
||||
|
}, |
||||
|
confirmInspection () { |
||||
|
if (!this.selectedTemplateCode) { |
||||
|
this.$message.warning('请先选择属性模板') |
||||
|
return |
||||
|
} |
||||
|
if (!this.selectedRow) return |
||||
|
this.reportData = { ...this.selectedRow } |
||||
|
this.selectDialogVisible = false |
||||
|
this.headerValues = {} |
||||
|
this.detailMap = {} |
||||
|
this.measureRows = this.blankRows() |
||||
|
this.loadInspectionDetails() |
||||
|
}, |
||||
|
loadInspectionDetails () { |
||||
|
getIQCDetailedRecordList({ |
||||
|
site: this.reportData.site || '', |
||||
|
buNo: this.reportData.buNo || '', |
||||
|
inspectionNo: this.reportData.inspectionNo || '', |
||||
|
itemDesc: '', |
||||
|
page: 1, |
||||
|
limit: 9999 |
||||
|
}).then(({data}) => { |
||||
|
const details = (data && data.code === 0 && data.page && data.page.list) || [] |
||||
|
const map = {} |
||||
|
details.forEach(item => { |
||||
|
if (item.itemNo != null && map[item.itemNo] === undefined) map[item.itemNo] = item |
||||
|
}) |
||||
|
this.detailMap = map |
||||
|
this.fillHeader() |
||||
|
}) |
||||
|
}, |
||||
|
fillHeader () { |
||||
|
const values = {} |
||||
|
;(this.templateRows || []).forEach(row => { |
||||
|
const key = normName(row.itemDesc) |
||||
|
if (!HEADER_KEY_SET[key]) return |
||||
|
const detail = row.defaultValue != null && row.defaultValue !== '' ? this.detailMap[row.defaultValue] : null |
||||
|
if (detail) values[key] = detail.textValue || '' |
||||
|
}) |
||||
|
this.headerValues = values |
||||
|
}, |
||||
|
openItemDialog (row) { |
||||
|
if (!this.reportData.inspectionNo) { |
||||
|
this.$message.warning('请先选择检验单') |
||||
|
return |
||||
|
} |
||||
|
this.currentMeasureRow = row |
||||
|
this.selectedItemRow = null |
||||
|
this.itemSearchData = { itemDesc: '', page: 1, limit: 10 } |
||||
|
this.itemList = [] |
||||
|
this.itemTotalPage = 0 |
||||
|
this.itemDialogVisible = true |
||||
|
this.searchItemList() |
||||
|
}, |
||||
|
searchItemList () { |
||||
|
getIQCDetailedRecordList({ |
||||
|
site: this.reportData.site || '', |
||||
|
buNo: this.reportData.buNo || '', |
||||
|
inspectionNo: this.reportData.inspectionNo || '', |
||||
|
itemDesc: this.itemSearchData.itemDesc || '', |
||||
|
page: this.itemSearchData.page, |
||||
|
limit: this.itemSearchData.limit |
||||
|
}).then(({data}) => { |
||||
|
if (data && data.code === 0) { |
||||
|
this.itemList = (data.page && data.page.list) || [] |
||||
|
this.itemTotalPage = (data.page && data.page.totalCount) || 0 |
||||
|
} else { |
||||
|
this.itemList = [] |
||||
|
this.itemTotalPage = 0 |
||||
|
this.$message.error((data && data.msg) || '检验项目查询失败') |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
handleItemDblClick (row) { |
||||
|
this.selectedItemRow = row |
||||
|
this.confirmItem() |
||||
|
}, |
||||
|
confirmItem () { |
||||
|
if (!this.selectedItemRow || !this.currentMeasureRow) return |
||||
|
this.applyDetail(this.currentMeasureRow, this.selectedItemRow) |
||||
|
this.itemDialogVisible = false |
||||
|
}, |
||||
|
applyDetail (row, detail) { |
||||
|
this.$set(row, 'itemNo', detail.itemNo || '') |
||||
|
this.$set(row, 'itemDesc', detail.itemDesc || '') |
||||
|
this.$set(row, 'stdValue', detail.defaultValue != null ? detail.defaultValue : '') |
||||
|
this.$set(row, 'minValue', detail.minValue != null ? detail.minValue : '') |
||||
|
this.$set(row, 'maxValue', detail.maxValue != null ? detail.maxValue : '') |
||||
|
this.$set(row, 'itemResult', detail.itemResult || '') |
||||
|
this.loadSubDetails(row) |
||||
|
}, |
||||
|
loadSubDetails (row) { |
||||
|
selectIQCSubDetailedRecord({ |
||||
|
site: this.reportData.site || '', |
||||
|
buNo: this.reportData.buNo || '', |
||||
|
inspectionNo: this.reportData.inspectionNo || '', |
||||
|
itemNo: row.itemNo |
||||
|
}).then(({data}) => { |
||||
|
const list = ((data && data.rows) || []).slice().sort((a, b) => (a.num || 0) - (b.num || 0)) |
||||
|
this.$set(row, 'subDetails', list) |
||||
|
this.$set(row, 'measures', this.calcMeasures(row.displayMode, list)) |
||||
|
}) |
||||
|
}, |
||||
|
rebuildMeasures (row) { |
||||
|
this.$set(row, 'measures', this.calcMeasures(row.displayMode, row.subDetails || [])) |
||||
|
}, |
||||
|
textOf (value) { |
||||
|
return value == null ? '' : String(value).trim() |
||||
|
}, |
||||
|
calcMeasures (mode, subDetails) { |
||||
|
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(this.textOf(value))) |
||||
|
} else { |
||||
|
rows.forEach(item => raw.push(this.textOf(item.subDetailValue))) |
||||
|
if (raw.filter(value => value).length < 10) { |
||||
|
rows.forEach(item => raw.push(this.textOf(item.subDetailValueB))) |
||||
|
} |
||||
|
} |
||||
|
const out = raw.filter(value => value) |
||||
|
while (out.length < 10) out.push('') |
||||
|
return out.slice(0, 10) |
||||
|
}, |
||||
|
printReport () { |
||||
|
if (!this.selectedTemplateCode) { |
||||
|
this.$message.warning('请先选择属性模板') |
||||
|
return |
||||
|
} |
||||
|
if (!this.reportData.inspectionNo) { |
||||
|
this.$message.warning('请先选择检验单') |
||||
|
return |
||||
|
} |
||||
|
const reportContent = this.$el.querySelector('.report-content') |
||||
|
if (!reportContent) return |
||||
|
const liveImg = reportContent.querySelector('.logo') |
||||
|
const clone = reportContent.cloneNode(true) |
||||
|
Array.prototype.forEach.call(clone.querySelectorAll('.no-print'), function (el) { |
||||
|
if (el.parentNode) el.parentNode.removeChild(el) |
||||
|
}) |
||||
|
this.stripPrintColumns(clone) |
||||
|
let html = clone.innerHTML |
||||
|
if (liveImg && liveImg.src && liveImg.getAttribute('src') && liveImg.getAttribute('src') !== liveImg.src) { |
||||
|
html = html.split(liveImg.getAttribute('src')).join(liveImg.src) |
||||
|
} |
||||
|
const printWindow = window.open('', '_blank') |
||||
|
printWindow.document.write(`<!DOCTYPE html><html><head><title>产品尺寸测量报告</title><style>${this.printStyle()}</style></head><body>${html}</body></html>`) |
||||
|
printWindow.document.close() |
||||
|
printWindow.focus() |
||||
|
setTimeout(() => { |
||||
|
printWindow.print() |
||||
|
printWindow.close() |
||||
|
}, 300) |
||||
|
}, |
||||
|
printStyle () { |
||||
|
return ` |
||||
|
@page { size: A4 landscape; margin: 8mm; } |
||||
|
body { margin: 0; font-family: 'Times New Roman', '宋体', sans-serif; } |
||||
|
.dim-table { width: 100%; border-collapse: collapse; table-layout: fixed; } |
||||
|
.dim-table td { border: 1px solid #000; text-align: center; vertical-align: middle; font-size: 10px; padding: 2px; word-break: break-all; } |
||||
|
.head-row td { height: 36px; padding: 0 2px; } |
||||
|
.logo { height: 32px; width: auto; } |
||||
|
.logo-cell { border: none; text-align: left; } |
||||
|
.title-cell { border: none; font-family: 'Arial Black', sans-serif; font-size: 18px; font-weight: 700; line-height: 1.1; height: 36px; } |
||||
|
.label { font-family: 'STSong', '华文宋体', serif; font-weight: 700; } |
||||
|
.value, .left { text-align: center; } |
||||
|
.left { text-align: left; padding-left: 4px; } |
||||
|
.measure-title { font-family: 'Times New Roman', serif; font-size: 13px; font-weight: 700; } |
||||
|
.th td { font-weight: 700; } |
||||
|
.opt { margin-right: 8px; white-space: nowrap; } |
||||
|
.plain-input { border: none; width: 100%; text-align: center; font-size: 10px; background: transparent; } |
||||
|
.no-print { display: none !important; } |
||||
|
` |
||||
|
}, |
||||
|
stripPrintColumns (root) { |
||||
|
const hidden = { 2: true, 3: true } |
||||
|
Array.prototype.forEach.call(root.querySelectorAll('table'), function (table) { |
||||
|
Array.prototype.forEach.call(table.querySelectorAll('tr'), function (tr) { |
||||
|
let col = 1 |
||||
|
const cells = [] |
||||
|
Array.prototype.forEach.call(tr.children, function (el) { |
||||
|
if (el.tagName === 'TD' || el.tagName === 'TH') 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(table.querySelectorAll('col.c-b, col.c-c'), function (col) { |
||||
|
if (col.parentNode) col.parentNode.removeChild(col) |
||||
|
}) |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped> |
||||
|
.dimension-report-container { |
||||
|
padding: 0 12px 12px; |
||||
|
} |
||||
|
.toolbar { |
||||
|
margin-bottom: 8px; |
||||
|
text-align: right; |
||||
|
} |
||||
|
.picked-no { |
||||
|
margin-left: 12px; |
||||
|
font-size: 13px; |
||||
|
color: #606266; |
||||
|
} |
||||
|
.report-content { |
||||
|
background: #fff; |
||||
|
padding: 12px 12px 12px 36px; |
||||
|
overflow: auto; |
||||
|
} |
||||
|
.dim-table { |
||||
|
width: 100%; |
||||
|
min-width: 1280px; |
||||
|
border-collapse: collapse; |
||||
|
table-layout: fixed; |
||||
|
} |
||||
|
.dim-table td { |
||||
|
border: 1px solid #000; |
||||
|
text-align: center; |
||||
|
vertical-align: middle; |
||||
|
font-size: 12px; |
||||
|
height: 28px; |
||||
|
padding: 2px 4px; |
||||
|
} |
||||
|
.c-a { width: 36px; } |
||||
|
.c-b { width: 52px; } |
||||
|
.c-c { width: 72px; } |
||||
|
.c-d { width: 120px; } |
||||
|
.c-e { width: 72px; } |
||||
|
.c-f { width: 72px; } |
||||
|
.c-g { width: 52px; } |
||||
|
.c-h { width: 52px; } |
||||
|
.c-cav { width: 42px; } |
||||
|
.c-ok { width: 36px; } |
||||
|
.c-ng { width: 52px; } |
||||
|
.logo-cell, .title-cell { |
||||
|
border: none; |
||||
|
} |
||||
|
.head-row td { |
||||
|
height: 48px; |
||||
|
} |
||||
|
.logo { |
||||
|
height: 42px; |
||||
|
} |
||||
|
.title-cell { |
||||
|
font-family: 'Arial Black', 'Microsoft YaHei', sans-serif; |
||||
|
font-size: 22px; |
||||
|
font-weight: 700; |
||||
|
} |
||||
|
.label { |
||||
|
font-family: 'STSong', '华文宋体', 'SimSun', serif; |
||||
|
font-weight: 700; |
||||
|
} |
||||
|
.left { |
||||
|
text-align: left; |
||||
|
} |
||||
|
.measure-title { |
||||
|
font-family: 'Times New Roman', serif; |
||||
|
font-size: 15px; |
||||
|
font-weight: 700; |
||||
|
} |
||||
|
.th td { |
||||
|
font-weight: 700; |
||||
|
background: #f7f7f7; |
||||
|
} |
||||
|
.opt { |
||||
|
margin-right: 10px; |
||||
|
cursor: pointer; |
||||
|
white-space: nowrap; |
||||
|
} |
||||
|
.mode-select { |
||||
|
width: 68px; |
||||
|
height: 22px; |
||||
|
font-size: 12px; |
||||
|
} |
||||
|
.plain-input { |
||||
|
width: 100%; |
||||
|
border: none; |
||||
|
text-align: center; |
||||
|
background: transparent; |
||||
|
font-size: 12px; |
||||
|
} |
||||
|
.seq-cell { |
||||
|
position: relative; |
||||
|
} |
||||
|
.sign-btn { |
||||
|
width: 18px; |
||||
|
height: 18px; |
||||
|
padding: 0; |
||||
|
border: 1px solid #dcdfe6; |
||||
|
border-radius: 2px; |
||||
|
background: #fff; |
||||
|
line-height: 14px; |
||||
|
font-size: 14px; |
||||
|
font-weight: 700; |
||||
|
cursor: pointer; |
||||
|
} |
||||
|
.sign-btn.minus, |
||||
|
.sign-btn.plus { |
||||
|
position: absolute; |
||||
|
left: -26px; |
||||
|
top: 50%; |
||||
|
margin-top: -9px; |
||||
|
} |
||||
|
.sign-btn.minus { |
||||
|
color: #f56c6c; |
||||
|
border-color: #f56c6c; |
||||
|
} |
||||
|
.sign-btn.plus { |
||||
|
color: #409eff; |
||||
|
border-color: #409eff; |
||||
|
} |
||||
|
.empty-state { |
||||
|
text-align: center; |
||||
|
padding-top: 80px; |
||||
|
} |
||||
|
</style> |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue