Files
FLX_MES_Manage_View/src/views/QualityAssurance/MaterialDataQuery/index.vue
2026-05-28 17:25:15 +08:00

531 lines
23 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div class="app-container">
<el-card class="topCard">
<div class="topDiv">
<div>
<span style="margin-left: 10px;margin-right: 1px;letter-spacing: 3px">{{ $t('materialDataQuery.stationNumberLabel') }}</span>
<el-select
v-model="stationNumberValue"
clearable
filterable
:placeholder="$t('materialDataQuery.selectStationNumber')"
size="small"
style="width: 250px">
<el-option
v-for="item in stationNumber"
:key="item.value"
:label="item.label"
:value="item.value"
size="mini"/>
</el-select>
<span style="margin-left: 10px;letter-spacing: 3px">{{ $t('materialDataQuery.orderNumberLabel') }}</span>
<el-input v-model="orderNumberValue" :placeholder="$t('materialDataQuery.orderNumber')" clearable size="small" style="width: 250px;"/>
<span style="margin-left: 10px;">{{ $t('materialDataQuery.productModelLabel') }}</span>
<el-select
v-model="engineTypeValue"
clearable
filterable
:placeholder="$t('materialDataQuery.selectProductModel')"
size="small"
style="width: 250px">
<el-option
v-for="item in engineType"
:key="item.value"
:label="item.label"
:value="item.value"
size="mini"/>
</el-select>
<!-- <span style="margin-left: 10px">产品编号</span>-->
<!-- <el-select-->
<!-- v-model="assemblyNumberValue"-->
<!-- allow-create-->
<!-- clearable-->
<!-- filterable-->
<!-- placeholder="请选择产品编号"-->
<!-- size="small"-->
<!-- style="width: 240px">-->
<!-- <el-option-->
<!-- v-for="item in assemblyNumber"-->
<!-- :key="item.value"-->
<!-- :label="item.label"-->
<!-- :value="item.value"-->
<!-- size="mini"/>-->
<!-- </el-select>-->
<!-- <el-select v-model="traceabilityCode" placeholder="请选择精确追溯码" filterable clearable size="small" style="width: 200px">-->
<!-- <el-option-->
<!-- v-for="item in traceabilityCodeArr"-->
<!-- :key="item.ID"-->
<!-- :label="item.label"-->
<!-- :value="item.value"-->
<!-- size="mini"/>-->
<!-- </el-select>-->
</div>
<div style="margin-top: 10px">
<span style="margin-left: 10px">{{ $t('materialDataQuery.materialBarcodeLabel') }}</span>
<el-input
v-model="traceabilityCode"
clearable
:placeholder="$t('materialDataQuery.enterMaterialBarcode')"
size="small"
style="width: 250px;"/>
<!-- <span style="margin-left: 10px">零件名称</span>-->
<!-- <el-select v-model="partNameValue" placeholder="请选择零件名称" filterable clearable size="small" style="width: 200px;">-->
<!-- <el-option-->
<!-- v-for="item in partName"-->
<!-- :key="item.ID"-->
<!-- :label="item.label"-->
<!-- :value="item.value"-->
<!-- size="mini"/>-->
<!-- </el-select>-->
<span style="margin-left: 10px">{{ $t('materialDataQuery.productionTimeLabel') }}</span>
<el-date-picker
v-model="dateTime"
:clearable="false"
align="center"
:end-placeholder="$t('materialDataQuery.endDate')"
format="yyyy-MM-dd"
:range-separator="$t('materialDataQuery.dateRangeSeparator')"
size="small"
:start-placeholder="$t('materialDataQuery.startDate')"
style="width: 250px;"
type="daterange"
value-format="yyyy-MM-dd"/>
<el-button
icon="el-icon-search"
plain
size="small"
style="margin-left: 5px"
type="primary"
@click="pageCurrent = 1;selectDate()">{{ $t('materialDataQuery.search') }}
</el-button>
<el-button icon="el-icon-download" size="small" type="info" @click="exportExcel()">Excel</el-button>
<!-- <span style="margin-left: 10px">批次条码</span>-->
<!-- <el-input v-model="batchBarcodeValue" placeholder="请输入批次条码" clearable size="small" style="width: 200px; margin-left: 13px"/>-->
<!-- <el-select v-model="batchBarcodeValue" placeholder="请选择批次条码" clearable filterable size="small" style="width: 200px;margin-left: 13px">-->
<!-- <el-option-->
<!-- v-for="item in batchBarcode"-->
<!-- :key="item.value"-->
<!-- :label="item.label"-->
<!-- :value="item.value"-->
<!-- size="mini"/>-->
<!-- </el-select>-->
</div>
<el-table
v-loading="loading"
ref="multipleTable"
:cell-class-name="tableRowClassName"
:data="tableData"
:header-cell-style="{background:'#eef1f6',color:'#606266'}"
border
class="main"
element-loading-background="rgba(0, 0, 0, 0.2)"
element-loading-spinner="el-icon-loading"
:element-loading-text="$t('materialDataQuery.loadingData')"
height="560px"
size="mini"
style="width: 100%"
tooltip-effect="dark">
<!-- <el-table-column :selectable="selectable" type="selection" width="45" align="center"/>-->
<el-table-column align="center" :label="$t('materialDataQuery.sequence')" type="index" width="60"/>
<el-table-column align="center" :label="$t('materialDataQuery.orderNumber')" width="120px">
<template slot-scope="scope">
{{ scope.row.订单号 }}
</template>
</el-table-column>
<el-table-column align="center" :label="$t('materialDataQuery.stationNumber')" width="100px">
<template slot-scope="scope">
{{ scope.row.工位号 }}
</template>
</el-table-column>
<el-table-column align="center" :label="$t('materialDataQuery.productNumber')">
<template slot-scope="scope">
{{ scope.row.发动机号 }}
</template>
</el-table-column>
<el-table-column align="center" :label="$t('materialDataQuery.productModel')" width="120px">
<template slot-scope="scope">
{{ scope.row.发动机型号 }}
</template>
</el-table-column>
<!-- <el-table-column align="center" label="工位名称">-->
<!-- <template slot-scope="scope">-->
<!-- {{ scope.row.工序名称 }}-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column align="center" width="150px" label="零件图号">-->
<!-- <template slot-scope="scope">-->
<!-- {{ scope.row.零件图号 }}-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column align="center" :label="$t('materialDataQuery.materialNumber')" width="150px">
<template slot-scope="scope">
{{ scope.row.物料号 }}
</template>
</el-table-column>
<el-table-column align="center" :label="$t('materialDataQuery.partQuantity')" width="100px">
<template slot-scope="scope">
{{ scope.row.零件数量 }}
</template>
</el-table-column>
<el-table-column align="center" :label="$t('materialDataQuery.partName')" min-width="150px">
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
</el-table-column>
<!-- <el-table-column align="center" label="生产厂家">-->
<!-- <template slot-scope="scope">-->
<!-- {{ scope.row.生产厂家 }}-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column align="center" min-width="150px" :label="$t('materialDataQuery.materialBarcode')">
<template slot-scope="scope">
{{ scope.row.物料条码 }}
</template>
</el-table-column>
<!-- <el-table-column align="center" label="物料条码批次">-->
<!-- <template slot-scope="scope">-->
<!-- {{ scope.row.物料条码批次 }}-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column align="center" :label="$t('materialDataQuery.operationTime')" width="150px">
<template slot-scope="scope">
{{ scope.row.操作时间 }}
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
v-if="!loading"
:current-page="pageCurrent"
:page-size="pageSize"
:page-sizes="[15, 30, 40]"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</div>
</el-card>
</div>
</template>
<script>
import { getNowShotTime } from '../../../utils/tool'
export default {
data() {
return {
traceabilityCodeArr: [], // 精确追溯码数组
traceabilityCode: '', // 精确追溯码
assemblyNumber: [], // 总成编号
assemblyNumberValue: '', // 总成编号
orderNumberValue: '', // 订单号
orderNumber: [], // 订单号
stationNumberValue: '', // 工位号
stationNumber: [], // 工位号
measuringPosition: [], // 测量位置
measuringPositionValue: '', // 测量位置
measuringProject: [], // 测量项目
measuringProjectValue: '', // 测量项目
engineTypeValue: '', // 机型
engineType: [], // 机型
batchBarcode: [], // 批次条码
batchBarcodeValue: '', // 批次条码
partName: [], // 零件名称
partNameValue: '', // 零件名称
isQualified: [
{
label: '合格',
value: 1
}, {
label: '不合格',
value: 2
}, {
label: '全部',
value: 0
}
], // 是否合格
isQualifiedValue: 1, // 是否合格
dateTime: [], // 时间
loading: false, // 时间
tableData: [], // 时间
date: new Date(),
timer: '',
total: 0, // 总条数
pageList: 30, // 每页显示条数
pageSize: 30, // 每页显示条数
pageCurrent: 1 // 后台获取页
}
},
created() {
this.dateTime = [getNowShotTime(), getNowShotTime()]
this.getStationNumber()
this.getEngineType()
},
mounted() {
this.getTraceabilityCode()
this.getAssemblyNumber()
setTimeout(() => {
this.getPartName()
}, 200)
},
methods: {
// 表格颜色变化
tableRowClassName({ row, rowIndex }) {
// console.log(row, rowIndex)
if (rowIndex % 2 === 0) {
return 'black'
} else {
return 'red'
}
},
// 工位号
getStationNumber() {
this.stationNumber = []
var param = []
var Data = this.CreateData('11', 'MES_计划BOM_工位与名称_查询', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.stationNumber.push({
label: `${response.data[i].工位号}${response.data[i].工位名称}`,
value: response.data[i].工位号
})
}
}).then(() => {
this.getBatchBarcode()
this.getMeasuringPosition()
})
},
// 机型
getEngineType() {
this.engineType = []
var param = []
var Data = this.CreateData('11', 'MES_基本变量_机型代码_查询 ', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.engineType.push({
label: response.data[i].发动机型号,
value: response.data[i].发动机型号
})
}
})
},
// 零件名称
getPartName() {
this.partName = []
var param = []
param[0] = ['发动机型号', this.engineTypeValue]
param[1] = ['工位号', this.stationNumberValue]
var Data = this.CreateData('11', '电子看板装配零件_零件名称_初始化查询 ', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.partName.push({
label: response.data[i].零件名称,
value: response.data[i].零件名称,
ID: response.data[i].ID
})
}
})
},
// 追溯
getTraceabilityCode() {
this.traceabilityCodeArr = []
var engineTypeValue_check, stationNumberValue_check
this.engineTypeValue ? engineTypeValue_check = 1 : engineTypeValue_check = 0
this.stationNumberValue ? stationNumberValue_check = 1 : stationNumberValue_check = 0
var param = []
param[0] = ['开始时间', this.dateTime[0] + ' ' + '00:00:00']
param[1] = ['结束时间', this.dateTime[1] + ' ' + '23:59:59']
// param[0] = ['开始时间', this.dateTime[0]]
// param[1] = ['结束时间', this.dateTime[1]]
param[2] = ['发动机型号_ischeck', engineTypeValue_check]
param[3] = ['发动机型号', this.engineTypeValue]
param[4] = ['工位号_ischeck', stationNumberValue_check]
param[5] = ['工位号', this.stationNumberValue]
param[6] = ['分线总线', 1]
var Data = this.CreateData('11', '初始化二维码_查询 ', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.traceabilityCodeArr.push({
label: response.data[i].物料条码,
value: response.data[i].物料条码,
ID: response.data[i].ID
})
}
})
},
getAssemblyNumber() {
this.assemblyNumber = []
var engineTypeValue_check, stationNumberValue_check
this.engineTypeValue ? engineTypeValue_check = 1 : engineTypeValue_check = 0
this.stationNumberValue ? stationNumberValue_check = 1 : stationNumberValue_check = 0
var param = []
param[0] = ['开始时间', this.dateTime[0] + ' ' + '00:00:00']
param[1] = ['结束时间', this.dateTime[1] + ' ' + '23:59:59']
// param[0] = ['开始时间', this.dateTime[0]]
// param[1] = ['结束时间', this.dateTime[1]]
param[2] = ['发动机型号_ischeck', engineTypeValue_check]
param[3] = ['发动机型号', this.engineTypeValue]
param[4] = ['工位号_ischeck', stationNumberValue_check]
param[5] = ['工位号', this.stationNumberValue]
param[6] = ['分线总线', 1]
var Data = this.CreateData('11', '测量数据合格索引_发动机号_发动机型号_查询 ', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.assemblyNumber.push({
label: response.data[i].发动机号,
value: response.data[i].发动机号
})
}
})
},
getBatchBarcode() {
this.batchBarcode = []
var param = []
param[0] = ['开始时间', this.dateTime[0] + ' ' + '00:00:00']
param[1] = ['结束时间', this.dateTime[1] + ' ' + '23:59:59']
// param[0] = ['开始时间', this.dateTime[0]]
// param[1] = ['结束时间', this.dateTime[1]]
param[2] = ['工位号', this.stationNumberValue]
var Data = this.CreateData('11', '物料数据_视图_物料条码批次号_查询 ', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.batchBarcode.push({
label: response.data[i].物料条码,
value: response.data[i].物料条码
})
}
})
},
getMeasuringPosition() {
this.measuringPosition = []
var param = []
param[0] = ['工位号', this.stationNumberValue]
var Data = this.CreateData('11', '质量数据查询_测量位置 ', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.measuringPosition.push({
label: response.data[i].测量位置,
value: response.data[i].测量位置
})
}
}).then(() => {
this.getMeasuringProject()
})
},
getMeasuringProject() {
this.measuringProject = []
var param = []
param[0] = ['工位号', this.stationNumberValue]
param[1] = ['测量位置', this.measuringPositionValue]
var Data = this.CreateData('11', '质量数据查询_测量项目 ', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.measuringProject.push({
label: response.data[i].测量项目,
value: response.data[i].测量项目
})
}
})
},
selectDate() {
this.tableData = []
let engineTypeValue_check, assemblyNumberValue_check, stationNumberValue_check, partNameValue_check,
traceabilityCode_check, batchBarcodeValue_check
this.engineTypeValue ? engineTypeValue_check = 1 : (engineTypeValue_check = 0, this.engineTypeValue = '')
this.assemblyNumberValue ? assemblyNumberValue_check = 1 : (assemblyNumberValue_check = 0, this.assemblyNumberValue = '')
this.stationNumberValue ? stationNumberValue_check = 1 : (stationNumberValue_check = 0, this.stationNumberValue = '')
this.partNameValue ? partNameValue_check = 1 : (partNameValue_check = 0, this.partNameValue = '')
this.traceabilityCode ? traceabilityCode_check = 1 : (traceabilityCode_check = 0, this.traceabilityCode = '')
this.batchBarcodeValue ? batchBarcodeValue_check = 1 : (batchBarcodeValue_check = 0, this.batchBarcodeValue = '')
var param = []
param[0] = ['开始时间', this.dateTime[0] + ' ' + '00:00:00']
param[1] = ['结束时间', this.dateTime[1] + ' ' + '23:59:59']
// param[0] = ['开始时间', this.dateTime[0]]
// param[1] = ['结束时间', this.dateTime[1]]
param[2] = ['发动机型号_ischeck', engineTypeValue_check]
param[3] = ['发动机型号', this.engineTypeValue]
param[4] = ['发动机号_ischeck', assemblyNumberValue_check]
param[5] = ['发动机号', this.assemblyNumberValue]
param[6] = ['工位号_ischeck', stationNumberValue_check]
param[7] = ['工位号', this.stationNumberValue]
param[8] = ['零件名称_ischeck', partNameValue_check]
param[9] = ['零件名称', this.partNameValue]
param[10] = ['二维码_ischeck', traceabilityCode_check]
param[11] = ['二维码', this.traceabilityCode]
param[12] = ['物料条码批次_ischeck', batchBarcodeValue_check]
param[13] = ['物料条码批次', this.batchBarcodeValue]
param[14] = ['PageCurrent', this.pageCurrent]
param[15] = ['PageSize', this.pageSize]
param[16] = ['PageCount', '1111', 'int', '1']
param[17] = ['ItemCount', '1111', 'int', '1']
var Data = this.CreateData('11', '物料数据_视图_查询', param)
this.ExecDatabase(Data).then(response => {
console.log(response, 66)
if (response.data.result.length !== 0) {
this.tableData = response.data.result
}
this.total = parseInt(response.data.output[0].ItemCount)
this.loading = false
})
},
exportExcel() {
if (this.tableData.length !== 0) {
let engineTypeValue_check, assemblyNumberValue_check, stationNumberValue_check, partNameValue_check,
traceabilityCode_check, batchBarcodeValue_check
this.engineTypeValue ? engineTypeValue_check = 1 : (engineTypeValue_check = 0, this.engineTypeValue = '')
this.assemblyNumberValue ? assemblyNumberValue_check = 1 : (assemblyNumberValue_check = 0, this.assemblyNumberValue = '')
this.stationNumberValue ? stationNumberValue_check = 1 : (stationNumberValue_check = 0, this.stationNumberValue = '')
this.partNameValue ? partNameValue_check = 1 : (partNameValue_check = 0, this.partNameValue = '')
this.traceabilityCode ? traceabilityCode_check = 1 : (traceabilityCode_check = 0, this.traceabilityCode = '')
this.batchBarcodeValue ? batchBarcodeValue_check = 1 : (batchBarcodeValue_check = 0, this.batchBarcodeValue = '')
var param = []
param[0] = ['开始时间', this.dateTime[0] + ' ' + '00:00:00']
param[1] = ['结束时间', this.dateTime[1] + ' ' + '23:59:59']
// param[0] = ['开始时间', this.dateTime[0]]
// param[1] = ['结束时间', this.dateTime[1]]
param[2] = ['发动机型号_ischeck', engineTypeValue_check]
param[3] = ['发动机型号', this.engineTypeValue]
param[4] = ['发动机号_ischeck', assemblyNumberValue_check]
param[5] = ['发动机号', this.assemblyNumberValue]
param[6] = ['工位号_ischeck', stationNumberValue_check]
param[7] = ['工位号', this.stationNumberValue]
param[8] = ['零件名称_ischeck', partNameValue_check]
param[9] = ['零件名称', this.partNameValue]
param[10] = ['二维码_ischeck', traceabilityCode_check]
param[11] = ['二维码', this.traceabilityCode]
param[12] = ['物料条码批次_ischeck', batchBarcodeValue_check]
param[13] = ['物料条码批次', this.batchBarcodeValue]
var Data = this.CreateData('2001', '物料数据查询_报表新', param)
this.exportExcel_NPOI(Data)
} else {
this.$message.warning(this.$t('materialDataQuery.noData'))
}
},
// 分页
handleSizeChange(val) {
this.pageCurrent = 1
this.pageSize = val
this.selectDate()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.selectDate()
}
}
}
</script>
<style scoped>
.topCard {
margin: 5px;
}
.topDiv {
margin-bottom: 10px;
}
</style>