<template>
|
<div class="mod-config">
|
<basic-container>
|
<el-row>
|
<el-col :span="9">
|
<el-tabs type="card">
|
<el-tab-pane label="检测汇报">
|
<ttable
|
:table="table"
|
@currentChange="handleCurrentChange"
|
:uploadInfo="uploadInfo"
|
:prelang="prelang"
|
:options="options"
|
:ajaxFun="ajaxFun"
|
:bottomOffset="80"
|
ref="reportTable"
|
>
|
<template #toolbar>
|
<el-dropdown @command="handleAuditCommand">
|
<el-button type="primary" class="report-dropdown-link">
|
审核<i class="el-icon-arrow-down el-icon--right"></i>
|
</el-button>
|
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-item command="submit" :disabled="isAudit"
|
>提交</el-dropdown-item
|
>
|
<el-dropdown-item
|
command="cancelSubmit"
|
divided
|
:disabled="!isAudit"
|
>撤销</el-dropdown-item
|
>
|
</el-dropdown-menu>
|
</el-dropdown>
|
</template>
|
</ttable>
|
</el-tab-pane>
|
</el-tabs>
|
</el-col>
|
<el-col :span="15" style="padding-left: 10px">
|
<el-tabs type="card">
|
<el-tab-pane label="检测汇报零件">
|
<ttable
|
:table="joinTable"
|
@handleSelectionChange="joinHandleSelectionChange"
|
:uploadInfo="joinUploadInfo"
|
:prelang="joinPrelang"
|
:options="joinOptions"
|
:ajaxFun="joinAjaxFun"
|
:paramObj="paramObj"
|
:bottomOffset="80"
|
ref="joinPartTable"
|
>
|
<template #toolbar>
|
<div style="display:flex;">
|
<div>
|
<span>SN码:</span>
|
</div>
|
<div class="l-mes">
|
<el-input
|
v-model="number"
|
ref="seach_input"
|
placeholder="SN码"
|
@keyup.enter.native="getRelateHandle()"
|
></el-input>
|
</div>
|
<el-button
|
style="margin-left: 10px"
|
@click="relateHandle"
|
type="primary"
|
>添加报检零件</el-button
|
>
|
<el-dropdown
|
@command="handleCommand"
|
style="margin: 0px 10px"
|
>
|
<el-button type="primary">
|
检测结果标记<i
|
class="el-icon-arrow-down el-icon--right"
|
></i>
|
</el-button>
|
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-item
|
:key="item"
|
:command="item.ref"
|
v-for="item in toolbarIsQualified"
|
:disabled="item.disabled"
|
v-show="item.isShow"
|
>{{ item.text }}
|
</el-dropdown-item>
|
</el-dropdown-menu>
|
</el-dropdown>
|
<el-button @click="unqualifiedReview" type="primary"
|
>不合格处理</el-button
|
>
|
<!--<el-dropdown
|
@command="handleCommand"
|
style="margin: 0px 10px"
|
>
|
<el-button type="primary">
|
使用状态标记<i
|
class="el-icon-arrow-down el-icon--right"
|
></i>
|
</el-button>
|
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-item
|
:command="item.ref"
|
v-for="item in toolbarIsUsed"
|
:disabled="item.disabled"
|
v-if="item.isShow"
|
>{{ item.text }}
|
</el-dropdown-item>
|
</el-dropdown-menu>
|
</el-dropdown>-->
|
</div>
|
</template>
|
</ttable>
|
</el-tab-pane>
|
<el-tab-pane label="检测汇报样品">
|
<el-row>
|
<el-col :span="24" style="height: 220px">
|
<el-table
|
stripe
|
ref="sampleList"
|
:data="sampleList"
|
height="100%"
|
highlight-current-row
|
@row-click="handleCurrentChangeSample"
|
:row-style="{ height: '26px' }"
|
:cell-style="{ padding: '0' }"
|
>
|
<el-table-column
|
label="SN号"
|
prop="outBatchNo"
|
align="center"
|
min-width="75px"
|
:show-overflow-tooltip="true"
|
/>
|
<el-table-column
|
label="零件编号"
|
prop="partNo"
|
align="center"
|
min-width="75px"
|
:show-overflow-tooltip="true"
|
/>
|
<el-table-column
|
label="零件名称"
|
prop="partName"
|
align="center"
|
min-width="75px"
|
:show-overflow-tooltip="true"
|
/>
|
|
<el-table-column
|
label="备注"
|
prop="remark"
|
align="center"
|
min-width="75px"
|
:show-overflow-tooltip="true"
|
>
|
<template scope="scope">
|
<el-input
|
size="small"
|
v-model="scope.row.remark"
|
placeholder=""
|
v-if="scope.row.isUpdate"
|
></el-input>
|
<template v-if="!scope.row.isUpdate"
|
>{{ scope.row.remark }}
|
</template>
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="检测标准编号"
|
prop="testStandardNo"
|
align="center"
|
min-width="100px"
|
:show-overflow-tooltip="true"
|
>
|
<template scope="scope">
|
<el-input
|
size="small"
|
v-model="scope.row.testStandardNo"
|
placeholder=""
|
v-if="scope.row.isUpdate"
|
>
|
<el-button
|
slot="append"
|
icon="el-icon-search"
|
@click="openTempalteDialog(scope.row)"
|
></el-button>
|
</el-input>
|
<template v-if="!scope.row.isUpdate"
|
>{{ scope.row.testStandardNo }}
|
</template>
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="是否合格"
|
prop="isQualified"
|
align="center"
|
min-width="75px"
|
:formatter="formatBoolean"
|
:show-overflow-tooltip="true"
|
/>
|
<el-table-column align="center" width="160px" fixed="right">
|
<template slot="header" slot-scope="scope">
|
<el-button
|
type="text"
|
@click="openSelectSample()"
|
class="commonButton"
|
>
|
添加样品
|
</el-button>
|
</template>
|
<template slot-scope="scope">
|
<el-button
|
type="text"
|
v-if="scope.row.isUpdate"
|
class="commonButton"
|
@click="saveSample(scope.$index, scope.row)"
|
>保存
|
</el-button>
|
<el-button
|
type="text"
|
v-if="!scope.row.isUpdate"
|
class="commonButton"
|
@click="editSample(scope.$index, scope.row)"
|
>编辑
|
</el-button>
|
<el-button
|
type="text"
|
@click="deleteSample(scope.row)"
|
class="commonButton"
|
>
|
删除
|
</el-button>
|
<el-button
|
type="text"
|
@click="autoJudgmentSample(scope.row)"
|
class="commonButton"
|
>
|
合格判定
|
</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</el-col>
|
|
<el-col :span="24">
|
<el-tabs type="card">
|
<el-tab-pane label="检测项目">
|
<el-col :span="24" style="height: 500px">
|
<el-table
|
stripe
|
ref="paramValues"
|
:data="paramValues"
|
height="100%"
|
:row-style="{ height: '26px' }"
|
:cell-style="{ padding: '0' }"
|
>
|
<el-table-column
|
prop="sort"
|
label="序号"
|
align="center"
|
min-width="45px"
|
/>
|
<el-table-column
|
prop="itemCode"
|
label="编号"
|
align="center"
|
min-width="75px"
|
/>
|
<el-table-column
|
prop="wireCore"
|
label="线芯"
|
align="center"
|
min-width="75px"
|
/>
|
<el-table-column
|
prop="itemName"
|
label="检测项目"
|
align="center"
|
min-width="75px"
|
/>
|
<el-table-column
|
prop="itemReference"
|
label="要求范围"
|
align="center"
|
min-width="75px"
|
/>
|
<el-table-column
|
prop="unit"
|
label="单位"
|
align="center"
|
min-width="75px"
|
/>
|
<el-table-column
|
prop="acqItemValue"
|
label="采集值"
|
align="center"
|
min-width="75px"
|
/>
|
<el-table-column
|
prop="calItemValue"
|
label="计算值"
|
align="center"
|
min-width="75px"
|
/>
|
<el-table-column
|
prop="itemValue"
|
label="值"
|
align="center"
|
min-width="75px"
|
>
|
<template slot-scope="scope">
|
<el-input
|
:id="'idReport_' + +scope.$index"
|
:ref="'reference_' + scope.$index"
|
v-if="itemUpdateFlag && scope.row.itemType != 2"
|
v-model="scope.row.itemValue"
|
placeholder="值"
|
@keyup.enter.native="nextFocus(scope.$index)"
|
@blur="checkItemValue(scope.row)"
|
></el-input>
|
<el-select
|
v-if="itemUpdateFlag && scope.row.itemType == 2"
|
:id="'idReport_' + +scope.$index"
|
:ref="'reference_' + scope.$index"
|
v-model="scope.row.itemValue"
|
style="width:100%"
|
@change="nextFocus(scope.$index)"
|
>
|
<el-option
|
v-for="item in scope.row.sysDictItemList"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
/>
|
</el-select>
|
<div
|
v-if="
|
!itemUpdateFlag && scope.row.itemType != 2
|
"
|
>
|
<span>{{ scope.row.itemValue }}</span>
|
</div>
|
<div
|
v-if="
|
!itemUpdateFlag && scope.row.itemType == 2
|
"
|
>
|
<span>{{
|
scope.row.sysDictItemList.find((el) => {
|
return el.value == scope.row.itemValue
|
})
|
? scope.row.sysDictItemList.find((el) => {
|
return el.value == scope.row.itemValue
|
}).label
|
: ''
|
}}</span>
|
</div>
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="isQualified"
|
label="合格"
|
align="center"
|
min-width="60px"
|
>
|
<template slot-scope="scope">
|
<el-select
|
v-model="scope.row.isQualified"
|
placeholder="请选择"
|
style="width: 100%"
|
v-show="itemUpdateFlag"
|
:class="[
|
scope.row.isQualified != null &&
|
!scope.row.isQualified
|
? 'redSelectBackGround'
|
: ''
|
]"
|
>
|
<el-option
|
v-for="item in booleanOptions"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
>
|
</el-option>
|
</el-select>
|
<div
|
v-show="!itemUpdateFlag"
|
:class="[
|
scope.row.isQualified != null &&
|
!scope.row.isQualified
|
? 'redDivBackGround'
|
: ''
|
]"
|
>
|
<span>
|
{{
|
scope.row.isQualified == false
|
? '否'
|
: scope.row.isQualified
|
? '是'
|
: ''
|
}}
|
</span>
|
</div>
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="remark"
|
label="备注"
|
align="center"
|
min-width="90px"
|
>
|
<template slot-scope="scope">
|
<el-input
|
v-model="scope.row.remark"
|
v-if="itemUpdateFlag"
|
></el-input>
|
<template v-if="!itemUpdateFlag">{{
|
scope.row.remark
|
}}</template>
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="aisle"
|
label="通道"
|
align="center"
|
min-width="50px"
|
/>
|
<el-table-column
|
prop="position"
|
label="部位"
|
align="center"
|
min-width="50px"
|
/>
|
<el-table-column
|
align="center"
|
width="160px"
|
fixed="right"
|
>
|
<template slot="header" slot-scope="scope">
|
<el-button
|
v-if="!itemUpdateFlag"
|
type="text"
|
@click="openQualityForm()"
|
class="commonButton"
|
>
|
质检表单
|
</el-button>
|
<el-button
|
v-if="
|
itemUpdateFlag &&
|
permissions.quality_report_big_table
|
"
|
type="text"
|
@click="gatherSampleItem()"
|
class="commonButton"
|
>
|
AESA大表
|
</el-button>
|
<el-button
|
v-if="
|
itemUpdateFlag &&
|
permissions.quality_report_network_analyzer
|
"
|
type="text"
|
@click="gatherNetworkAnalyzerSampleItem()"
|
class="commonButton"
|
>
|
网分仪
|
</el-button>
|
<el-button
|
v-if="itemUpdateFlag"
|
type="text"
|
@click="saveSampleItem()"
|
class="commonButton"
|
>
|
保存
|
</el-button>
|
<el-button
|
v-if="!itemUpdateFlag"
|
type="text"
|
@click="updateSampleItem()"
|
class="commonButton"
|
>
|
编辑
|
</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</el-col>
|
</el-tab-pane>
|
<el-tab-pane label="附件">
|
<el-col :span="24" style="height: 500px">
|
<el-upload
|
drag
|
ref="upload"
|
action="/mes/reportSample/upload"
|
:headers="headers"
|
:auto-upload="true"
|
:before-upload="submitUpload"
|
:on-success="uploadSuccess"
|
:data="paramData"
|
:file-list="fileList"
|
list-type="text"
|
:on-preview="handlePreview"
|
:with-credentials="true"
|
>
|
<i class="el-icon-upload"></i>
|
<div class="el-upload__text">
|
将文件拖到此处,或<em>点击上传</em>
|
</div>
|
<div slot="file" slot-scope="{ file }">
|
<span class="el-upload-list__item-actions">
|
<span>{{ file.name }}</span>
|
<span
|
style="position: absolute;right: 54px;font-size: 16px;color: #67c23a;cursor: pointer;"
|
>
|
<el-image
|
style="width: 16px; height: 16px;vertical-align:middle;"
|
src="/img/zoom.png"
|
:preview-src-list="[file.url]"
|
>
|
</el-image>
|
</span>
|
<span
|
style="position: absolute;right: 32px;font-size: 16px;color: #409eff;cursor: pointer;"
|
@click="handleDownload(file)"
|
>
|
<i
|
class="el-icon-download"
|
style="line-height:28px;"
|
></i>
|
</span>
|
<span
|
style="position: absolute;right: 10px;font-size: 16px;color: #f56c6c;cursor: pointer;"
|
@click="handleDelete(file)"
|
>
|
<i
|
class="el-icon-delete"
|
style="line-height:28px;"
|
></i>
|
</span>
|
</span>
|
</div>
|
</el-upload>
|
</el-col>
|
</el-tab-pane>
|
</el-tabs>
|
</el-col>
|
</el-row>
|
</el-tab-pane>
|
</el-tabs>
|
</el-col>
|
</el-row>
|
<!-- 弹窗, 申请新增 / 修改 -->
|
<reportForm
|
v-if="addOrUpdateVisible"
|
ref="addOrUpdate"
|
@refreshDataList="getData"
|
:reportTypeOptions="reportTypeOptions"
|
/>
|
<!-- 弹窗, 申请零件修改 -->
|
<applyPartForm
|
v-if="updateVisible"
|
ref="update"
|
@refreshDataList="getJoinData"
|
/>
|
<!-- 汇报关联申请零件 -->
|
<applyPartDialog
|
:currshowlist.sync="relateVisible"
|
:reportId="currentReportId"
|
:reportType="currentReportType"
|
:batchNo="number"
|
@handleSelectionChange="refreshJoinData"
|
:applyTypeOptions="reportTypeOptions"
|
/>
|
<!-- 汇报选择样品零件 -->
|
<reportSampleDialog
|
:currshowlist.sync="showSample"
|
:reportId="currentReportId"
|
@handleSelectionChange="getReportSampleData"
|
/>
|
<!-- 选择检测标准 -->
|
<TestStandardDialog
|
:currshowlist.sync="showTestStandard"
|
@listenToSelectTestStandardEvent="selectTestStandard"
|
/>
|
<!-- 弹窗, 不合格处理新增 -->
|
<unqualifiedProcessForm
|
v-if="unqualifiedProcessVisible"
|
ref="unqualifiedProcess"
|
@refreshDataList="getData"
|
:applyPartList="joinMultipleSelection"
|
/>
|
<!--质检表单-->
|
<previewLayout
|
:currshowlist.sync="showPreviewLayout"
|
:layOutJson="layOutJson"
|
:isEditCommit="isEditCommit"
|
@refreshParams="refreshParams"
|
/>
|
<!-- 不合格数量填写 -->
|
<arrivedEditDialog
|
:currshowlist.sync="showArrivedEdit"
|
:reportPartList="joinMultipleSelection"
|
@refreshReportPart="refreshJoinData"
|
/>
|
</basic-container>
|
</div>
|
</template>
|
|
<script>
|
import {
|
fetchListReport,
|
delReport,
|
listReportSample,
|
delReportSample,
|
getSampleItemsById,
|
putReportSampleItem,
|
putReportSample,
|
removeFile,
|
getReportSampleAttachment,
|
autoJudgmentSample,
|
putReportSubmit,
|
putReportCancelSubmit,
|
autoJudgmentSampleSingle,
|
dataAcquisition,
|
dataNetworkAnalyzer
|
} from '@/api/quality/report'
|
import {
|
fetchListApplyPart,
|
delApplyPartForReport,
|
batchUpdateApplyPart,
|
fetchListApplyPartForReport
|
} from '@/api/quality/apply'
|
import { batchUpdateResultBySystemNo } from '@/api/quality/result'
|
import { getTestStandardByNo } from '@/api/quality/teststandard'
|
import reportForm from './reportform'
|
import applyPartForm from '../apply/applypartform'
|
import { mapGetters } from 'vuex'
|
import ttable from '@/views/common/ztt-table.vue'
|
import applyPartDialog from './applypart'
|
import reportSampleDialog from './reportsample'
|
import TestStandardDialog from '@/views/common/teststandardradio'
|
import unqualifiedProcessForm from './unqualifiedprocessform'
|
import arrivedEditDialog from './arrivededit'
|
import previewLayout from '@/views/common/preview-layout.vue'
|
import { remote } from '@/api/admin/dict'
|
import { getStore } from '@/util/store.js'
|
|
export default {
|
data() {
|
return {
|
headers: {
|
Authorization: 'Bearer ' + getStore({ name: 'access_token' })
|
},
|
paramData: {
|
sampleId: null
|
},
|
fileList: [],
|
ajaxFun: fetchListReport,
|
addOrUpdateVisible: false,
|
currentReportId: 0,
|
currentReportType: null,
|
lastReportRow: null,
|
uploadInfo: {
|
// 是否展示上传EXCEL以及对应的url
|
isShow: false,
|
url: ''
|
},
|
prelang: 'operation',
|
options: {
|
height: 300, // 默认高度-为了表头固定
|
stripe: true, // 是否为斑马纹 table
|
highlightCurrentRow: false, // 是否要高亮当前行
|
border: true, // 是否有纵向边框
|
lazy: false, // 是否需要懒加载
|
fit: true, // 列的宽度是否自撑开
|
multiSelect: false, //
|
seqNo: true,
|
isRefresh: true, // 是否显示刷新按钮
|
isShowHide: true, // 是否显示显影按钮
|
isSearch: false, // 高级查询按钮
|
defaultOrderBy: { column: 'reportNo', direction: 'desc' }
|
},
|
table: {
|
total: 0,
|
currentPage: 1,
|
pageSize: 20,
|
data: [],
|
// 标题
|
column: [
|
{
|
width: '130',
|
minWidth: '130',
|
prop: 'reportNo',
|
label: '汇报编号',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text',
|
render: { fun: this.addOrUpdateHandle }
|
},
|
{
|
width: '100',
|
minWidth: '100',
|
prop: 'reportType',
|
label: '汇报类型',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'select',
|
formatter: this.formatReportType,
|
optList: () => {
|
return this.reportTypeOptions
|
}
|
},
|
{
|
width: '100',
|
minWidth: '100',
|
prop: 'reportPerson',
|
label: '汇报人员',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
width: '100',
|
minWidth: '100',
|
prop: 'checkState',
|
label: '检测状态',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'select',
|
formatter: (row, column, cellValue) => {
|
var formatVal
|
if (cellValue == '00uncheck') {
|
formatVal = '未检测'
|
} else if (cellValue == '01checked') {
|
formatVal = '已检测'
|
} else {
|
formatVal = ''
|
}
|
return formatVal
|
},
|
optList: () => {
|
return this.getCheckStateOptionList()
|
}
|
},
|
{
|
width: '100',
|
minWidth: '100',
|
prop: 'isSubmit',
|
label: '审核状态',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'select',
|
formatter: (row, column, cellValue) => {
|
var formatVal
|
if (cellValue != null) {
|
if (cellValue) {
|
formatVal = '已提交'
|
} else {
|
formatVal = '已撤销'
|
}
|
} else {
|
formatVal = ''
|
}
|
return formatVal
|
},
|
optList: () => {
|
return this.getSubmitOptionList()
|
}
|
},
|
{
|
width: '150',
|
minWidth: '150',
|
prop: 'remark',
|
label: '备注',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
}
|
],
|
toolbar: [
|
{
|
text: '新增',
|
type: 'primary',
|
fun: this.addOrUpdateHandle
|
}
|
],
|
operator: [
|
{
|
text: '删除',
|
type: 'text',
|
size: 'small',
|
fun: this.deleteHandle
|
}
|
],
|
operatorConfig: {
|
fixed: 'right',
|
label: '操作',
|
width: 60,
|
minWidth: 60
|
}
|
},
|
|
paramObj: { reportId: 0 },
|
joinAjaxFun: fetchListApplyPart,
|
updateVisible: false,
|
relateVisible: false,
|
joinMultipleSelection: [],
|
joinUploadInfo: {
|
// 是否展示上传EXCEL以及对应的url
|
isShow: false,
|
url: ''
|
},
|
joinPrelang: 'operation',
|
joinOptions: {
|
height: 300, // 默认高度-为了表头固定
|
stripe: true, // 是否为斑马纹 table
|
highlightCurrentRow: false, // 是否要高亮当前行
|
border: true, // 是否有纵向边框
|
lazy: false, // 是否需要懒加载
|
fit: true, // 列的宽度是否自撑开
|
multiSelect: true, //
|
seqNo: true,
|
isRefresh: true, // 是否显示刷新按钮
|
isShowHide: true, // 是否显示显影按钮
|
isSearch: false, // 高级查询按钮
|
defaultOrderBy: { column: 'systemNo', direction: 'desc' }
|
},
|
joinTable: {
|
total: 0,
|
currentPage: 1,
|
pageSize: 20,
|
data: [],
|
// 标题
|
column: [
|
{
|
width: '100',
|
minWidth: '100',
|
prop: 'systemNo',
|
label: '系统编号',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
width: '100',
|
minWidth: '100',
|
prop: 'operationName',
|
label: '工序',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
width: '100',
|
minWidth: '100',
|
prop: 'workstationNo',
|
label: '工作站',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
width: '100',
|
minWidth: '100',
|
prop: 'lotBatchNo',
|
label: 'SN号',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
width: '110',
|
minWidth: '110',
|
prop: 'partNo',
|
label: '零件编号',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text',
|
formatter: this.formatByQualified
|
},
|
{
|
width: '110',
|
minWidth: '110',
|
prop: 'partDesc',
|
label: '零件名称',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text',
|
formatter: this.formatByQualified
|
},
|
{
|
width: '110',
|
minWidth: '110',
|
prop: 'qtyArrived',
|
label: '合格数量',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'number'
|
},
|
{
|
width: '110',
|
minWidth: '110',
|
prop: 'unqualifiedArrived',
|
label: '不合格数量',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'number'
|
},
|
{
|
width: '80',
|
minWidth: '80',
|
prop: 'isQualified',
|
label: '检测合格',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'select',
|
formatter: this.formatQualified,
|
optList: () => {
|
return this.booleanOptions
|
}
|
},
|
{
|
width: '80',
|
minWidth: '80',
|
prop: 'isUsed',
|
label: '允许使用',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'select',
|
formatter: this.formatBoolean,
|
optList: () => {
|
return this.booleanOptions
|
}
|
},
|
{
|
width: '80',
|
minWidth: '80',
|
prop: 'isErp',
|
label: 'erp库存',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'select',
|
formatter: this.formatBoolean,
|
optList: () => {
|
return this.booleanOptions
|
}
|
},
|
{
|
width: '140',
|
minWidth: '140',
|
prop: 'remark',
|
label: '备注',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
width: '150',
|
minWidth: '150',
|
prop: 'testStandardNo',
|
label: '检测标准编号(计划)',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
width: '120',
|
minWidth: '120',
|
prop: 'applyNo',
|
label: '检测申请编号',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
}
|
],
|
toolbar: [],
|
operator: [
|
{
|
text: '删除',
|
type: 'text',
|
size: 'small',
|
fun: this.joinDeleteHandle
|
}
|
],
|
operatorConfig: {
|
fixed: 'right',
|
label: '操作',
|
width: 60,
|
minWidth: 60
|
}
|
},
|
toolbarIsQualified: [
|
{
|
text: '合格',
|
ref: 'qualifiedTrue',
|
type: 'primary',
|
disabled: false,
|
isShow: true
|
},
|
{
|
text: '不合格',
|
ref: 'qualifiedFalse',
|
type: 'primary',
|
disabled: false,
|
isShow: true
|
}
|
],
|
toolbarIsUsed: [
|
{
|
text: '允许',
|
ref: 'usedTrue',
|
type: 'primary',
|
disabled: false,
|
isShow: true
|
},
|
{
|
text: '不允许',
|
ref: 'usedFalse',
|
type: 'primary',
|
disabled: false,
|
isShow: true
|
}
|
],
|
booleanOptions: [
|
{ value: true, label: '是' },
|
{ value: false, label: '否' }
|
],
|
|
showSample: false,
|
sampleList: [],
|
paramValues: [],
|
itemUpdateFlag: false,
|
showTestStandard: false,
|
currentSample: null,
|
dialogSample: null,
|
unqualifiedProcessVisible: false,
|
reportTypeOptions: [],
|
checkStateOptionList: [
|
{
|
value: '00uncheck',
|
label: '未检测'
|
},
|
{
|
value: '01checked',
|
label: '已检测'
|
}
|
],
|
showPreviewLayout: false,
|
layOutJson: [],
|
isEditCommit: true,
|
showArrivedEdit: false,
|
dialogImageVisible: false,
|
dialogImageUrl: '',
|
testStandardParamObj: null,
|
isAudit: false,
|
submitOptionList: [
|
{
|
value: true,
|
label: '已提交'
|
},
|
{
|
value: false,
|
label: '已撤销'
|
}
|
],
|
number: null
|
}
|
},
|
components: {
|
reportForm,
|
ttable,
|
applyPartDialog,
|
reportSampleDialog,
|
applyPartForm,
|
TestStandardDialog,
|
unqualifiedProcessForm,
|
previewLayout,
|
arrivedEditDialog
|
},
|
computed: {
|
...mapGetters(['permissions'])
|
},
|
created() {
|
this.getReportTypeDict()
|
},
|
|
activated() {
|
const reportNo = sessionStorage.getItem('quality_report_index')
|
if (reportNo) {
|
this.$refs.reportTable.queryParam.reportNo = reportNo
|
sessionStorage.removeItem('quality_report_index')
|
}
|
|
this.getData()
|
},
|
methods: {
|
// 输入enter键,下一行自动聚焦
|
nextFocus(index) {
|
let nextRef
|
if (index + 1 >= this.paramValues.length) {
|
nextRef = 'idReport_0'
|
} else {
|
nextRef = 'idReport_' + (index + 1)
|
}
|
document.getElementById(nextRef).focus()
|
},
|
getReportTypeDict() {
|
remote('apply_report_type').then((response) => {
|
if (response.data.code === 0) {
|
this.reportTypeOptions = response.data.data
|
} else {
|
this.reportTypeOptions = []
|
}
|
})
|
},
|
// 汇报类型中文格式化
|
formatReportType(row, column, cellValue) {
|
this.reportTypeOptions.forEach((obj) => {
|
if (obj.value === cellValue) {
|
cellValue = obj.label
|
}
|
})
|
return cellValue
|
},
|
// 检测状态列表
|
getCheckStateOptionList() {
|
return this.checkStateOptionList
|
},
|
getSubmitOptionList() {
|
return this.submitOptionList
|
},
|
// 获取数据列表
|
getData() {
|
return this.$refs.reportTable.getDataList()
|
},
|
// 新增 / 修改
|
addOrUpdateHandle(row) {
|
this.addOrUpdateVisible = true
|
this.$nextTick(() => {
|
this.$refs.addOrUpdate.init(row == null ? null : row.id)
|
})
|
},
|
// 删除
|
deleteHandle(row) {
|
this.$confirm('是否确认删除汇报编号为:' + row.reportNo, '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
closeOnClickModal: false,
|
type: 'warning'
|
})
|
.then(function() {
|
return delReport(row.id)
|
})
|
.then((data) => {
|
this.$message.success('删除成功')
|
this.getData()
|
})
|
},
|
handleCurrentChange(row) {
|
if (row != null) {
|
this.lastReportRow = row
|
}
|
if (!row) {
|
this.isAudit = false
|
this.currentReportId = null
|
this.currentReportType = null
|
this.paramObj = { reportId: 0 }
|
} else if (!this.currentReportId || this.currentReportId != row.id) {
|
this.currentReportId = row.id
|
this.currentReportType = row.reportType
|
this.paramObj = { reportId: row.id }
|
// 设置审核按钮的禁用情况
|
if (row.isSubmit != null) {
|
if (row.isSubmit) {
|
this.isAudit = true
|
} else {
|
this.isAudit = false
|
}
|
} else {
|
this.isAudit = false
|
}
|
}
|
this.$nextTick(() => {
|
this.getJoinData()
|
this.getReportSampleData()
|
this.paramValues = []
|
this.fileList = []
|
})
|
},
|
getJoinData() {
|
this.$refs.joinPartTable.getDataList()
|
},
|
refreshJoinData() {
|
this.getData().then((message) => {
|
// 获取检查标准表格数据,并将第一条默认点击选中
|
this.$refs.reportTable.clickTable(this.lastReportRow)
|
})
|
},
|
relateHandle() {
|
if (this.currentReportId) {
|
this.number = null
|
this.relateVisible = true
|
} else {
|
this.$message.warning('请先选择一条检测汇报')
|
}
|
},
|
joinHandleSelectionChange(val) {
|
this.joinMultipleSelection = val
|
},
|
// boolean列中文格式化
|
formatBoolean(row, column, cellValue) {
|
if (cellValue == true) {
|
return '是'
|
}
|
if (cellValue == false) {
|
return '否'
|
} else {
|
return ''
|
}
|
},
|
// 格式化检测结果
|
formatQualified(row, column, cellValue) {
|
if (cellValue == true) {
|
return '<span>是</span>'
|
}
|
if (cellValue == false) {
|
return '<span style="color:red">否</span>'
|
} else {
|
return ''
|
}
|
},
|
// 根据检测结果进行格式化
|
formatByQualified(row, column, cellValue) {
|
if (row.isQualified == false) {
|
return '<span style="color:red">' + cellValue + '</span>'
|
} else {
|
return '<span>' + cellValue + '</span>'
|
}
|
},
|
// 删除
|
joinDeleteHandle(row) {
|
this.$confirm('是否确认删除零件批号为:' + row.lotBatchNo, '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
closeOnClickModal: false,
|
type: 'warning'
|
})
|
.then(function() {
|
return delApplyPartForReport(row.id)
|
})
|
.then((data) => {
|
this.$message.success('删除成功')
|
this.refreshJoinData()
|
})
|
},
|
// 修改
|
updateHandle(row) {
|
this.updateVisible = true
|
this.$nextTick(() => {
|
this.$refs.update.init(row.id)
|
})
|
},
|
// 标记检测结果状态
|
handleCommand(event) {
|
if (event === 'qualifiedTrue') {
|
this.batchUpdate(true, '合格')
|
} else if (event === 'qualifiedFalse') {
|
this.batchUpdate(false, '不合格')
|
} else if (event === 'usedTrue') {
|
this.batchUpdateResult(true, '允许使用')
|
} else if (event === 'usedFalse') {
|
this.batchUpdateResult(false, '不允许使用')
|
}
|
},
|
// 批量修改状态
|
batchUpdate(isQualified, msg) {
|
if (this.joinMultipleSelection && this.joinMultipleSelection.length > 0) {
|
// 判断选中的汇报零件中,是否已存在检测的,若存在,则不可进行检测结果标记 isQualified
|
let remindInfo = ''
|
let checkFlag = true
|
this.joinMultipleSelection.forEach((e) => {
|
if (e.isQualified != null) {
|
checkFlag = false
|
remindInfo = remindInfo + '系统编号:' + e.systemNo + ',已检测! '
|
}
|
})
|
if (checkFlag) {
|
if (isQualified) {
|
this.$confirm('是否标记' + msg, '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
closeOnClickModal: false,
|
type: 'warning'
|
})
|
.then(() => {
|
const applyPartList = []
|
this.joinMultipleSelection.forEach((e) => {
|
applyPartList.push(
|
Object.assign({
|
id: e.id,
|
isQualified: isQualified,
|
systemNo: e.systemNo,
|
lotBatchNo: e.lotBatchNo
|
})
|
)
|
})
|
batchUpdateApplyPart(applyPartList, 1).then((data) => {
|
// debugger;
|
this.$message.success('标记成功 ' + data.data.msg)
|
this.refreshJoinData()
|
})
|
})
|
.catch(() => {})
|
} else {
|
// 标记不合格时,弹出数量填写dialog
|
this.showArrivedEdit = true
|
}
|
} else {
|
this.$message.error(remindInfo)
|
}
|
} else {
|
this.$message.warning('请选择汇报零件')
|
}
|
},
|
// 批量修改检测结果的使用状态
|
batchUpdateResult(isUsed, msg) {
|
if (this.joinMultipleSelection && this.joinMultipleSelection.length > 0) {
|
this.$confirm('是否标记' + msg, '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
closeOnClickModal: false,
|
type: 'warning'
|
})
|
.then(() => {
|
const resultList = []
|
this.joinMultipleSelection.forEach((e) => {
|
resultList.push(
|
Object.assign({
|
isUsed: isUsed,
|
systemNo: e.systemNo,
|
id: e.resultId
|
})
|
)
|
})
|
batchUpdateResultBySystemNo(resultList).then((data) => {
|
this.$message.success('标记成功')
|
this.getJoinData()
|
})
|
})
|
.catch(() => {})
|
} else {
|
this.$message.warning('请选择汇报零件')
|
}
|
},
|
// 不合格处理
|
unqualifiedReview() {
|
if (this.joinMultipleSelection && this.joinMultipleSelection.length > 0) {
|
this.unqualifiedProcessVisible = true
|
this.$nextTick(() => {
|
this.$refs.unqualifiedProcess.init()
|
})
|
} else {
|
this.$message.warning('请选择汇报零件')
|
}
|
},
|
|
// 打开选择样品页面
|
openSelectSample() {
|
if (this.currentReportId) {
|
this.showSample = true
|
} else {
|
this.$message.warning('请先选择一条检测汇报')
|
}
|
},
|
// 获取样品信息
|
getReportSampleData() {
|
if (this.currentReportId != null) {
|
listReportSample(
|
Object.assign({ reportId: this.currentReportId })
|
).then((response) => {
|
this.sampleList = response.data.data
|
})
|
} else {
|
this.sampleList = []
|
}
|
},
|
// 修改保存样品
|
saveSample(index, row) {
|
putReportSample(row).then((response) => {
|
this.$message.success('样品编辑成功')
|
this.$set(row, 'isUpdate', false)
|
this.$set(row, 'isMoTestStandard', response.data.data.isMoTestStandard)
|
this.$set(row, 'testStandardId', response.data.data.testStandardId)
|
this.getSampleItems()
|
})
|
},
|
editSample(index, row) {
|
this.$set(row, 'isUpdate', true)
|
},
|
// 删除样品
|
deleteSample(row) {
|
this.$confirm('是否确认删除样品号为:' + row.partNo, '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
closeOnClickModal: false,
|
type: 'warning'
|
})
|
.then(function() {
|
return delReportSample(row.id)
|
})
|
.then((data) => {
|
this.$message.success('删除成功')
|
this.getReportSampleData()
|
this.currentSample = null
|
this.paramValues = []
|
this.fileList = []
|
})
|
},
|
// 自动判定样品是否合格
|
autoJudgmentSample(row) {
|
autoJudgmentSample(row).then((response) => {
|
this.$set(row, 'isQualified', response.data.data.isQualified)
|
// 刷新检测项结果
|
this.getSampleItems()
|
this.$message.success('判定完成')
|
})
|
},
|
// 选择样品
|
handleCurrentChangeSample(row) {
|
this.currentSample = row
|
this.getSampleItems()
|
this.getFileList()
|
},
|
getSampleItems() {
|
getSampleItemsById(this.currentSample).then((response) => {
|
if (response.data.code === 0) {
|
this.paramValues = response.data.data
|
} else {
|
this.paramValues = []
|
}
|
})
|
},
|
// 检验检测值是否合格
|
checkItemValue(row) {
|
autoJudgmentSampleSingle(row).then((response) => {
|
const resData = response.data.data
|
const resCode = response.data.code
|
if (resCode === 0) {
|
row.isQualified = resData.isQualified
|
}
|
})
|
},
|
// 保存检测标准参数
|
saveSampleItem() {
|
putReportSampleItem(this.paramValues).then((response) => {
|
this.$message.success('样品检测参数保存成功')
|
this.itemUpdateFlag = false
|
})
|
},
|
// 采集参数值
|
gatherSampleItem() {
|
if (this.currentSample != null) {
|
dataAcquisition({
|
id: this.currentSample.id,
|
sn: this.currentSample.outBatchNo
|
}).then((response) => {
|
const resData = response.data.data
|
this.paramValues.forEach((item) => {
|
const exsitData = resData.find((ele) => {
|
return ele.itemCode == item.itemCode
|
})
|
if (exsitData) {
|
item.itemValue = exsitData.itemValue
|
item.isQualified = exsitData.isQualified
|
}
|
})
|
})
|
} else {
|
this.$message.error('请选择检测汇报样品')
|
}
|
},
|
// 采集网分仪
|
gatherNetworkAnalyzerSampleItem() {
|
// 传参数
|
// 生成请求信息
|
//
|
const preStr =
|
'<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><CalValue xmlns="zhrf_CollectData"><dataGridView>'
|
const ednStr = '</dataGridView></CalValue></soap:Body></soap:Envelope>'
|
let requireData = ''
|
if (this.paramValues.length > 0) {
|
const tempertureItem = this.paramValues.find((ele) => {
|
return ele.itemName == '温度' // TODO
|
})
|
const electricItem = this.paramValues.find((ele) => {
|
return ele.itemName == '电容标准'
|
})
|
const dataArr = []
|
let dataItem
|
let flag = true
|
let flagMsg = ''
|
const cd =
|
this.currentSample == null ? null : this.currentSample.stockQuantity
|
console.log('cd', cd)
|
if (cd && cd != null) {
|
this.paramValues.forEach((item) => {
|
if (
|
item.itemName.indexOf('衰减') > -1 &&
|
(item.paramType != null && item.paramType == '采集项')
|
) {
|
dataItem = {
|
Column1: item.itemName,
|
TD: item.aisle == null ? '0' : item.aisle,
|
BW: item.position == null ? '0' : item.position,
|
temperture: tempertureItem ? tempertureItem.itemValue : '0',
|
cd: cd == null ? 1 : cd
|
}
|
dataArr.push(dataItem)
|
// 判断是否有部位、通道
|
if (item.aisle == null || item.aisle == '') {
|
flag = false
|
flagMsg = flagMsg + item.itemName + ',通道值为空;'
|
}
|
if (item.position == null || item.position == '') {
|
flag = false
|
flagMsg = flagMsg + item.itemName + ',部位值为空;'
|
}
|
} else if (
|
item.itemName.indexOf('驻波比') > -1 &&
|
(item.paramType != null && item.paramType == '采集项')
|
) {
|
dataItem = {
|
Column1: item.itemName,
|
TD: item.aisle == null ? '0' : item.aisle,
|
BW: item.position == null ? '0' : item.position
|
}
|
dataArr.push(dataItem)
|
// 判断是否有部位、通道
|
if (item.aisle == null || item.aisle == '') {
|
flag = false
|
flagMsg = flagMsg + item.itemName + ',通道值为空;'
|
}
|
if (item.position == null || item.position == '') {
|
flag = false
|
flagMsg = flagMsg + item.itemName + ',部位值为空;'
|
}
|
} else if (
|
item.itemName.indexOf('相位差') > -1 &&
|
(item.paramType != null && item.paramType == '采集项')
|
) {
|
dataItem = {
|
Column1: item.itemName,
|
Column2: item.itemReference,
|
TD: item.aisle == null ? '0' : item.aisle,
|
BW: item.position == null ? '0' : item.position
|
}
|
dataArr.push(dataItem)
|
// 判断是否有部位、通道
|
if (item.aisle == null || item.aisle == '') {
|
flag = false
|
flagMsg = flagMsg + item.itemName + ',通道值为空;'
|
}
|
if (item.position == null || item.position == '') {
|
flag = false
|
flagMsg = flagMsg + item.itemName + ',部位值为空;'
|
}
|
} else if (
|
item.itemName.indexOf('特性阻抗') > -1 &&
|
(item.paramType != null && item.paramType == '采集项')
|
) {
|
dataItem = {
|
Column1: item.itemName,
|
TD: item.aisle == null ? '0' : item.aisle,
|
BW: item.position == null ? '0' : item.position,
|
DR: electricItem ? electricItem.itemValue : '0'
|
}
|
dataArr.push(dataItem)
|
// 判断是否有部位、通道
|
if (item.aisle == null || item.aisle == '') {
|
flag = false
|
flagMsg = flagMsg + item.itemName + ',通道值为空;'
|
}
|
if (item.position == null || item.position == '') {
|
flag = false
|
flagMsg = flagMsg + item.itemName + ',部位值为空;'
|
}
|
}
|
})
|
const _that = this
|
if (dataArr.length > 0) {
|
// if (true) {
|
const dataArrStr = JSON.stringify(dataArr)
|
requireData = preStr + dataArrStr + ednStr
|
$.ajax({
|
type: 'post',
|
url: 'http://127.0.0.1:8089/zhrf_CollectData.asmx?op=CalValue',
|
headers: {
|
'Content-Type': 'text/xml;charset=utf-8'
|
},
|
data: requireData,
|
success: function(response) {
|
console.log('response', response)
|
const resJson = JSON.parse(
|
response
|
.replace(/\r/g, '')
|
.replace(/\n/g, '')
|
.replace(/\s*/g, '')
|
)
|
console.log('resJson', resJson)
|
// TODO
|
if (resJson.message) {
|
const resData = resJson.data
|
if (resData.length > 0) {
|
resData.forEach((resDataEle) => {
|
const paramItem = _that.paramValues.find((ele) => {
|
return ele.itemName == resDataEle.Column1
|
})
|
if (paramItem) {
|
paramItem.acqItemValue = resDataEle.Column3
|
paramItem.calItemValue = resDataEle.Column4
|
paramItem.itemValue = resDataEle.Column5
|
}
|
})
|
}
|
} else {
|
console.log('获取网分仪数据失败')
|
}
|
}
|
})
|
// } else {
|
// this.$message.error(flagMsg)
|
// }
|
} else {
|
this.$message.error('无检测项目需进行采集')
|
}
|
} else {
|
this.$message.error('长度不能为空')
|
}
|
} else {
|
this.$message.error('无检测项目')
|
}
|
},
|
updateSampleItem() {
|
this.itemUpdateFlag = true
|
},
|
// 打开参数模板选择页面
|
openTempalteDialog(row) {
|
this.testStandardParamObj = { inspectionType: this.currentReportType }
|
this.showTestStandard = true
|
this.dialogSample = row
|
},
|
selectTestStandard(param) {
|
if (param) {
|
this.$set(this.dialogSample, 'testStandardNo', param.standardNo)
|
}
|
},
|
// 附件上传下载
|
submitUpload() {
|
if (this.currentSample && this.currentSample.id) {
|
this.paramData.sampleId = this.currentSample.id
|
} else {
|
this.$message.error('请先选择样品')
|
return false
|
}
|
},
|
getFileList() {
|
this.fileList = []
|
if (this.currentSample && this.currentSample.id) {
|
getReportSampleAttachment(this.currentSample.id).then((response) => {
|
var attachments = response.data.data
|
// 渲染附件
|
if (attachments != null && attachments.length > 0) {
|
var attachment
|
var fileEl
|
for (var i = 0; i < attachments.length; i++) {
|
attachment = attachments[i]
|
fileEl = {}
|
fileEl.name = attachment.original
|
fileEl.url = attachment.path
|
fileEl.id = attachment.id
|
fileEl.fileName = attachment.fileName
|
this.fileList.push(fileEl)
|
}
|
}
|
})
|
}
|
},
|
// 上传成功给newFileList
|
uploadSuccess(response, file, fileList) {
|
this.getFileList()
|
},
|
handleRemove(file, fileList) {
|
removeFile(
|
Object.assign({
|
fileName: file.fileName
|
})
|
).then((response) => {})
|
},
|
handlePreview(file) {
|
window.open(file.url)
|
},
|
// 附件预览
|
handlePictureCardPreview(file) {
|
console.log(file)
|
this.dialogImageUrl = file.url
|
this.dialogImageVisible = true
|
},
|
// 附件下载
|
handleDownload(file) {
|
window.open(file.url)
|
},
|
// 删除附件
|
handleDelete(file) {
|
removeFile(
|
Object.assign({
|
fileName: file.fileName
|
})
|
).then((response) => {
|
this.getFileList()
|
})
|
},
|
// 打开质检表单
|
openQualityForm() {
|
this.layOutJson = []
|
// 1.根据检测标准编号,查询出标准的布局,
|
// 2.将布局中的检测项跟当前检测项进行对比,若布局中没有当前检测项,则将当前检测项加入到布局的最后,加入时,需考虑是否满行24,满行需新加行。若布局中的检测项不在当前检测项中,则删除布局中的检测项,删除时,需考虑项删除后行是否为空,若为空,则需删除行,分组group情况特殊,需考虑是否要删除分组行
|
// 3.生成了新的布局json,进行应用
|
if (this.currentSample != null) {
|
getTestStandardByNo(this.currentSample.testStandardNo).then((res) => {
|
if (
|
res.data.data.layoutJson != null &&
|
res.data.data.layoutJson !== ''
|
) {
|
this.showPreviewLayout = true
|
const layOutItems = JSON.parse(res.data.data.layoutJson)
|
const params = this.paramValues.slice(0)
|
let layOutItem
|
let cols
|
let col
|
let childs
|
let child
|
let unFindCols = []
|
let findCol
|
for (let i = 0; i < layOutItems.length; i++) {
|
layOutItem = layOutItems[i]
|
cols = layOutItem.cols
|
if (cols.length > 0) {
|
col = cols[0]
|
if (col.type === 'group') {
|
// 该行是分组
|
childs = col.children
|
for (let j = 0; j < childs.length; j++) {
|
child = childs[j]
|
cols = child.cols
|
unFindCols = []
|
for (let k = 0; k < cols.length; k++) {
|
col = cols[k]
|
if (params.length > 0) {
|
findCol = params.find((item) => {
|
return item.itemCode === col.code
|
})
|
if (findCol) {
|
// 布局中的检测项,存在于params中,则进行相应的赋值,并且删除params中的该项
|
col.referenceValue = findCol.itemReference
|
col.itemValue = findCol.itemValue
|
col.isQualified = findCol.isQualified
|
col.id = findCol.id
|
const findColIndex = params.indexOf(findCol)
|
params.splice(findColIndex, 1)
|
} else {
|
// 布局中的检测项,不存在于params中,则先将该列保存在unFindCols,后面批量删除
|
unFindCols.push(col)
|
}
|
} else {
|
unFindCols.push(col)
|
}
|
}
|
// 批量删除unFindCols
|
if (unFindCols.length > 0) {
|
let unFindColIndex
|
for (let m = 0; m < unFindCols.length; m++) {
|
unFindColIndex = cols.indexOf(unFindCols[m])
|
cols.splice(unFindColIndex, 1)
|
}
|
}
|
}
|
} else {
|
// 该行是普通行
|
unFindCols = []
|
for (let j = 0; j < cols.length; j++) {
|
col = cols[j]
|
if (params.length > 0) {
|
findCol = params.find((item) => {
|
return item.itemCode === col.code
|
})
|
|
if (findCol) {
|
// 布局中的检测项,存在于params中,则进行相应的赋值,并且删除params中的该项
|
col.referenceValue = findCol.itemReference
|
col.itemValue = findCol.itemValue
|
col.isQualified = findCol.isQualified
|
col.id = findCol.id
|
const findColIndex = params.indexOf(findCol)
|
params.splice(findColIndex, 1)
|
} else {
|
// 布局中的检测项,不存在于params中,则先将该列保存在unFindCols,后面批量删除
|
unFindCols.push(col)
|
}
|
} else {
|
unFindCols.push(col)
|
}
|
}
|
// 批量删除unFindCols
|
if (unFindCols.length > 0) {
|
let unFindColIndex
|
for (let k = 0; k < unFindCols.length; k++) {
|
unFindColIndex = cols.indexOf(unFindCols[k])
|
cols.splice(unFindColIndex, 1)
|
}
|
}
|
}
|
}
|
}
|
// 删除layOutItems中的所有空cols为空的行
|
let firstCols
|
let firstCol
|
for (let i = 0; i < layOutItems.length; i++) {
|
layOutItem = layOutItems[i]
|
firstCols = layOutItem.cols
|
if (firstCols.length > 0) {
|
// 判断是是否为分组
|
firstCol = firstCols[0]
|
if (firstCol.type === 'item') {
|
// 普通列
|
this.layOutJson.push(layOutItem)
|
} else {
|
const copyChildren = []
|
const copyLayOutItem = {
|
id: layOutItem.id,
|
label: layOutItem.label,
|
uniqueId: layOutItem.uniqueId,
|
minHeight: layOutItem.minHeight,
|
cols: [
|
{
|
id: firstCol.id,
|
uniqueId: firstCol.uniqueId,
|
label: firstCol.label,
|
span: firstCol.span,
|
isSelect: firstCol.isSelect,
|
type: firstCol.type,
|
children: copyChildren
|
}
|
]
|
}
|
// 分组列
|
childs = firstCol.children
|
if (childs.length > 0) {
|
for (let j = 0; j < childs.length; j++) {
|
child = childs[j]
|
if (child.cols.length > 0) {
|
copyChildren.push(child)
|
}
|
}
|
}
|
if (copyChildren.length > 0) {
|
copyLayOutItem.minHeight = 40 + copyChildren.length * 60
|
this.layOutJson.push(copyLayOutItem)
|
}
|
}
|
}
|
}
|
// 若params还有剩余的项,则将这些项默认宽度为4列,即每行24列,可放置8项,将生成的行,放置在layOutJson最后
|
if (params.length > 0) {
|
let param
|
let layOut
|
const colUniqueId = new Date().getTime()
|
for (let n = 0; n < params.length; n++) {
|
param = params[n]
|
if (n % 8 === 0) {
|
layOut = {
|
id: null,
|
label: '',
|
uniqueId: colUniqueId + n,
|
minHeight: 60,
|
cols: [
|
{
|
id: param.id,
|
uniqueId: colUniqueId + n + 1,
|
label: param.itemName,
|
type: 'item',
|
referenceValue: param.itemReference,
|
span: 4,
|
isSelect: false,
|
code: param.itemCode,
|
itemValue: param.itemValue,
|
isQualified: param.isQualified
|
}
|
]
|
}
|
this.layOutJson.push(layOut)
|
} else {
|
layOut.cols.push({
|
id: param.id,
|
uniqueId: colUniqueId + n + 1,
|
label: param.itemName,
|
type: 'item',
|
referenceValue: param.itemReference,
|
span: 4,
|
isSelect: false,
|
code: param.itemCode,
|
itemValue: param.itemValue,
|
isQualified: param.isQualified
|
})
|
}
|
}
|
}
|
} else {
|
this.$message.warning('未进行表单布局')
|
}
|
})
|
} else {
|
this.$message.warning('未选中汇报样品')
|
}
|
},
|
// 刷新检测项
|
refreshParams() {
|
this.getSampleItems()
|
},
|
handleAuditCommand(event) {
|
if (this.currentReportId) {
|
if (event === 'submit') {
|
putReportSubmit({}, this.currentReportId).then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
this.refreshJoinData()
|
this.$message.success('检测汇报提交成功!')
|
} else {
|
this.$message.error('检测汇报提交失败!')
|
}
|
})
|
} else if (event === 'cancelSubmit') {
|
putReportCancelSubmit({}, this.currentReportId).then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
this.refreshJoinData()
|
this.$message.success('检测汇报撤销成功!')
|
} else {
|
this.$message.error('检测汇报撤销失败!')
|
}
|
})
|
}
|
} else {
|
this.$message.error('请选择检测汇报!')
|
}
|
},
|
getRelateHandle() {
|
if (this.currentReportId) {
|
if (this.number != null) {
|
fetchListApplyPartForReport(
|
Object.assign(
|
{
|
current: 1,
|
size: 20
|
},
|
{
|
applyType: this.currentReportType,
|
lotBatchNo: this.number
|
}
|
)
|
).then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
if (resData.data.records.length > 0) {
|
if (resData.data.records.length === 1) {
|
const applyPart = resData.data.records[0]
|
const applyPartList = []
|
applyPartList.push(
|
Object.assign({
|
id: applyPart.id,
|
reportId: this.currentReportId,
|
systemNo: applyPart.systemNo
|
})
|
)
|
batchUpdateApplyPart(applyPartList, 2)
|
.then((response) => {
|
if (response.data.code === 0) {
|
this.refreshJoinData()
|
this.$message.success('检测汇报零件添加成功')
|
} else {
|
this.$message.error('检测汇报零件添加失败')
|
}
|
this.$nextTick(() => {
|
this.$refs.seach_input.focus()
|
})
|
})
|
.catch(() => {
|
this.$refs.seach_input.focus()
|
})
|
this.number = null
|
} else {
|
this.relateVisible = true
|
}
|
} else {
|
this.$message.error('未查找到申请零件!')
|
}
|
} else {
|
this.$message.error('查找申请零件失败!')
|
}
|
})
|
} else {
|
this.$message.error('SN码不能为空')
|
}
|
} else {
|
this.$message.warning('请先选择一条检测汇报')
|
}
|
}
|
}
|
}
|
</script>
|
<style>
|
.report-dropdown-link {
|
padding: 9px 10px 9px 15px !important;
|
}
|
.redSelectBackGround .el-input__inner {
|
background-color: #f56c6c;
|
}
|
.redDivBackGround {
|
background-color: #f56c6c;
|
}
|
</style>
|