<template>
|
<div class="mod-config">
|
<basic-container>
|
<div style="margin-left: 15px;">
|
<el-form :inline="true">
|
<el-row>
|
<el-col :span="5">
|
<el-form-item label="检验标准">
|
<el-input
|
v-model="partNoTest"
|
placeholder="检验标准"
|
readonly
|
clearable
|
@clear="getDataList"
|
style="width: 100%"
|
>
|
<el-button
|
slot="append"
|
icon="el-icon-search"
|
@click="openPartsDialog()"
|
></el-button>
|
</el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="5">
|
<el-form-item label="SN号">
|
<el-input
|
v-model="lotBatchNo"
|
placeholder="SN号"
|
clearable
|
@clear="getDataList"
|
@keyup.enter.native="getDataList"
|
style="width: 100%"
|
>
|
</el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="4">
|
<el-form-item label="状态">
|
<el-select
|
v-model="isQualified"
|
filterable
|
@clear="getDataList"
|
@change="getDataList"
|
clearable
|
placeholder="请选择状态"
|
style="width:100%"
|
>
|
<el-option
|
v-for="(item, index) in this.stateTagArr"
|
:label="item.label"
|
:value="item.value"
|
:key="index"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="6">
|
<el-form-item label="时间">
|
<el-date-picker
|
clearable
|
v-model="requiredDate"
|
type="datetimerange"
|
start-placeholder="开始"
|
end-placeholder="结束"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
@change="feedDateChange($event)"
|
style="width:300px"
|
>
|
</el-date-picker>
|
</el-form-item>
|
</el-col>
|
<el-col :span="3">
|
<el-tooltip content="导出" placement="top">
|
<!-- jipf 新增导出 以复用 -->
|
<el-button type="primary" @click="exportPage()">导出</el-button>
|
</el-tooltip>
|
</el-col>
|
</el-row>
|
</el-form>
|
<el-table
|
:data="dataList"
|
border
|
class="test_result_table"
|
ref=" resultTable"
|
height="620"
|
:row-style="{ height: '26px' }"
|
v-loading="dataListLoading"
|
>
|
<el-table-column
|
prop="partNo"
|
width="150"
|
header-align="center"
|
align="center"
|
label="零件编号"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="lotBatchNo"
|
width="150"
|
header-align="center"
|
align="center"
|
label="SN号"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="partDesc"
|
width="150"
|
header-align="center"
|
align="center"
|
label="零件名称"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="createTime"
|
width="150"
|
header-align="center"
|
align="center"
|
label="检测时间"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="isQualified"
|
header-align="center"
|
align="center"
|
:formatter="formatState"
|
label="结论"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="reportPerson"
|
header-align="center"
|
align="center"
|
label="检测人"
|
>
|
</el-table-column>
|
<el-table-column
|
v-if="titleList != null"
|
v-for="item in titleList"
|
:property="item"
|
:label="item"
|
>
|
</el-table-column>
|
</el-table>
|
<div class="avue-crud__pagination">
|
<el-pagination
|
@size-change="sizeChangeHandle"
|
@current-change="currentChangeHandle"
|
:current-page="pageIndex"
|
:page-sizes="[10, 20, 50, 100]"
|
:page-size="pageSize"
|
:total="totalPage"
|
background
|
layout="total, sizes, prev, pager, next, jumper"
|
>
|
</el-pagination>
|
</div>
|
<Parts
|
:currshowlist.sync="showParts"
|
@listenToPartsEvent="selectParts"
|
/>
|
</div>
|
</basic-container>
|
</div>
|
</template>
|
|
<script>
|
import { mapGetters } from 'vuex'
|
import { dateFormat } from '../../../store/modules/logs'
|
import Parts from '@/views/quality/testresult/parts.vue'
|
import { transform } from '@/util/fileTransform'
|
import { getExcel, getTestResult } from '../../../api/quality/report'
|
import { value2label } from '../../../util/formatUtil'
|
export default {
|
data() {
|
return {
|
stateTagArr: [
|
{
|
value: true,
|
label: '合格'
|
},
|
{
|
value: false,
|
label: '不合格'
|
}
|
],
|
lotBatchNo: null,
|
isQualified: null,
|
requiredDate: null,
|
screenHeight: `${document.documentElement.clientHeight}` - 300,
|
paramObject: {},
|
partNoTest: null,
|
moId: null,
|
dataForm: {
|
key: ''
|
},
|
showParts: false,
|
newReportList: {},
|
partList: [],
|
ChartsTabData: [],
|
dataList: [],
|
titleList: [],
|
pageIndex: 1,
|
pageSize: 20,
|
totalPage: 0,
|
dataListLoading: false,
|
addOrUpdateVisible: false
|
}
|
},
|
components: {
|
Parts
|
},
|
computed: {
|
...mapGetters(['permissions'])
|
},
|
watch: {
|
partNoTest: {
|
handler(newValue, oldValue) {
|
if (newValue != null && newValue != undefined) {
|
this.getDataList()
|
} else {
|
this.titleList = []
|
}
|
},
|
deep: true,
|
immediate: true
|
},
|
requiredDate: {
|
handler(newValue, oldValue) {
|
if (newValue != null && newValue != undefined) {
|
this.getDataList()
|
} else {
|
this.titleList = []
|
}
|
},
|
deep: true,
|
immediate: true
|
}
|
},
|
methods: {
|
// 获取数据列表
|
getDataList() {
|
this.dataListLoading = true
|
this.newReportList.testStandardNo = this.partNoTest
|
this.newReportList.moId = this.moId
|
if (this.isQualified == null) {
|
this.newReportList.isQualified = null
|
} else {
|
this.newReportList.isQualified = this.isQualified
|
}
|
if (this.lotBatchNo == null) {
|
this.newReportList.lotBatchNo = null
|
} else {
|
this.newReportList.lotBatchNo = this.lotBatchNo
|
}
|
|
// this.newReportList.requireTime = this.requiredDate
|
if (this.requiredDate && this.requiredDate.length > 0) {
|
this.newReportList.startTime = this.requiredDate[0]
|
this.newReportList.endTime = this.requiredDate[1]
|
} else {
|
this.newReportList.startTime = null
|
this.newReportList.endTime = null
|
}
|
getTestResult(
|
Object.assign(
|
{
|
current: this.pageIndex,
|
size: this.pageSize
|
},
|
this.newReportList
|
)
|
).then((response) => {
|
this.titleList = response.data.data.itemNameList
|
this.dataList = response.data.data.reportList.records
|
this.totalPage = response.data.data.reportList.total
|
})
|
this.dataListLoading = false
|
},
|
formatState(row, column, cellValue) {
|
return value2label(cellValue, this.stateTagArr)
|
},
|
feedDateChange(val) {
|
if (val != null) {
|
this.requiredDate = val
|
} else {
|
this.requiredDate = null
|
}
|
this.getDataList()
|
},
|
exportPage() {
|
if (this.partNoTest) {
|
this.newReportList.testStandardNo = this.partNoTest
|
this.newReportList.moId = this.moId
|
if (this.isQualified == null) {
|
this.newReportList.isQualified = null
|
} else {
|
this.newReportList.isQualified = this.isQualified
|
}
|
if (this.lotBatchNo == null) {
|
this.newReportList.lotBatchNo = null
|
} else {
|
this.newReportList.lotBatchNo = this.lotBatchNo
|
}
|
// this.newReportList.requireTime = this.requiredDate
|
if (this.requiredDate && this.requiredDate.length > 0) {
|
this.newReportList.startTime = this.requiredDate[0]
|
this.newReportList.endTime = this.requiredDate[1]
|
} else {
|
this.newReportList.startTime = null
|
this.newReportList.endTime = null
|
}
|
getExcel(this.newReportList).then((response) => {
|
transform(response)
|
})
|
} else {
|
this.$message.warning('请先选择检测标准')
|
}
|
},
|
openPartsDialog() {
|
this.showParts = true
|
},
|
selectParts(param) {
|
if (param != null) {
|
this.partNoTest = param.standardNo
|
this.moId = param.moId
|
} else {
|
this.partNoTest = null
|
this.moId = null
|
}
|
},
|
// 每页数
|
sizeChangeHandle(val) {
|
this.pageSize = val
|
this.pageIndex = 1
|
this.getDataList()
|
},
|
// 当前页
|
currentChangeHandle(val) {
|
this.pageIndex = val
|
this.getDataList()
|
}
|
}
|
}
|
</script>
|
<style lang="scss"></style>
|