<template>
|
<div
|
class="productoutput-div"
|
style="padding:0px 14px;height: 100%;overflow: auto;"
|
>
|
<div class="product-output-header">
|
<div style="height:28px;line-height:28px;">
|
<el-divider class="pane-divider" direction="vertical"></el-divider
|
><span style="font-size:14px;font-weight:bold">产出记录列表</span>
|
</div>
|
</div>
|
<ttable
|
:table="table"
|
@handleSelectionChange="handleSelectionChange"
|
@currentChange="handleCurrentChange"
|
:uploadInfo="uploadInfo"
|
:prelang="prelang"
|
:options="options"
|
:ajaxFun="ajaxFun"
|
:paramObj="paramObj"
|
ref="productOutputForCheckTable"
|
>
|
<template #toolbar></template>
|
</ttable>
|
|
<!--<div class="product-output-header">
|
<div style="height:28px;line-height:28px;">
|
<el-divider class="pane-divider" direction="vertical"></el-divider
|
><span style="font-size:14px;font-weight:bold">自检数据</span>
|
<span style="font-size:14px;margin-left: 20px;color: #2783ff"
|
>零件批号:{{ reportSample.outBatchNo }}</span
|
>
|
<span style="font-size:14px;margin-left: 20px;color: #2783ff"
|
>检测标准编号:</span
|
>
|
<el-select
|
v-model="reportSample.testStandardId"
|
filterable
|
size="mini"
|
style="width: 150px"
|
>
|
<el-option
|
v-for="item in testStandardList"
|
:key="item.id"
|
:label="item.standardNo"
|
:value="item.id"
|
/>
|
</el-select>
|
</div>
|
<div>
|
<el-button
|
class="auto-judgment-btn"
|
type="primary"
|
@click="autoJudgmentSelf()"
|
>自动判定</el-button
|
>
|
</div>
|
</div> -->
|
<!-- <el-row>
|
<el-col :span="24" style="height: 350px">
|
<el-table
|
stripe
|
ref="reportSampleItemList"
|
:data="reportSample.reportSampleItemList"
|
height="100%"
|
:row-style="{ height: '26px' }"
|
:cell-style="{ padding: '0' }"
|
>
|
<el-table-column
|
prop="sort"
|
label="序号"
|
align="center"
|
min-width="75px"
|
/>
|
<el-table-column
|
prop="itemCode"
|
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="itemValue"
|
label="值"
|
align="center"
|
min-width="75px"
|
>
|
<template slot-scope="scope">
|
<el-input
|
v-if="itemUpdateFlag"
|
v-model="scope.row.itemValue"
|
placeholder="值"
|
></el-input>
|
<template v-if="!itemUpdateFlag">{{
|
scope.row.itemValue
|
}}</template>
|
</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-if="itemUpdateFlag"
|
>
|
<el-option
|
v-for="item in booleanOptions"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
>
|
</el-option>
|
</el-select>
|
<template v-if="!itemUpdateFlag">
|
{{
|
scope.row.isQualified == false
|
? '否'
|
: scope.row.isQualified
|
? '是'
|
: ''
|
}}
|
</template>
|
</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 align="center" width="60px" fixed="right">
|
<template slot="header" slot-scope="scope">
|
<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-row> -->
|
<!-- 弹窗, 手动报检 -->
|
<qualityTestApplyForm
|
v-if="qualityTestApplyVisible"
|
ref="qualityTestApply"
|
@refreshDataList="getData"
|
:applyPartList="multipleSelection"
|
/>
|
</div>
|
</template>
|
<style lang="scss" scoped>
|
.product-output-header {
|
margin-top: 20px;
|
margin-bottom: 14px;
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
}
|
.pane-divider {
|
width: 4px;
|
background-color: #4283ee;
|
}
|
.productoutput-div >>> .inspection-btn {
|
background-image: -webkit-linear-gradient(139deg, #5f6eef 0%, #2783ff 100%);
|
background-image: -moz-linear-gradient(139deg, #5f6eef 0%, #2783ff 100%);
|
background-image: linear-gradient(139deg, #5f6eef 0%, #2783ff 100%);
|
color: #fff;
|
border-color: #fbecec;
|
border-radius: 15px;
|
padding: 6px 15px;
|
}
|
.productoutput-div >>> .inspection-btn span {
|
margin-left: 3px;
|
}
|
.productoutput-div >>> .commonTable .el-table__header th {
|
background: #599ef4 !important;
|
color: #fff !important;
|
border: 0px !important;
|
}
|
.productoutput-div >>> .feed-btn-return {
|
background: url('/img/workbench/icon_bj.png') center center no-repeat;
|
background-size: cover;
|
font-size: 14px;
|
}
|
|
.productoutput-div >>> .feed-btn-return:before {
|
content: '报';
|
font-size: 14px;
|
visibility: hidden;
|
}
|
.productoutput-div >>> .common-table-div {
|
margin: 0px 20px 0px !important;
|
}
|
|
.auto-judgment-btn {
|
background-image: -webkit-linear-gradient(139deg, #ff3f20 0%, #f77339 100%);
|
background-image: -moz-linear-gradient(139deg, #ff3f20 0%, #f77339 100%);
|
background-image: linear-gradient(139deg, #ff3f20 0%, #f77339 100%);
|
color: #fff;
|
border-color: #fbecec;
|
border-radius: 15px;
|
padding: 6px 15px;
|
}
|
.auto-judgment-btn >>> span {
|
margin-left: 3px;
|
}
|
</style>
|
<script>
|
import {
|
fetchOutputList,
|
findTestStandardNoBySystemNo
|
} from '@/api/quality/apply'
|
import {
|
getByMoTestStandardId,
|
saveSelfSampleItem,
|
getReportSampleForSelf,
|
putReportSampleItem,
|
autoJudgmentSelf
|
} from '@/api/quality/report'
|
import ttable from '@/views/common/ztt-table'
|
import qualityTestApplyForm from './qualitytestapply-form'
|
|
export default {
|
props: {
|
workstationId: {
|
type: Number
|
},
|
currentDutyRecord: {
|
type: Object,
|
default: () => {
|
return {}
|
}
|
},
|
currItem: {
|
type: String,
|
default: null
|
}
|
},
|
data() {
|
return {
|
paramObj: { workstationId: 0 },
|
ajaxFun: fetchOutputList,
|
addOrUpdateVisible: false,
|
currentRow: null,
|
multipleSelection: [],
|
uploadInfo: {
|
// 是否展示上传EXCEL以及对应的url
|
isShow: false
|
},
|
prelang: 'operation',
|
options: {
|
height: 300, // 默认高度-为了表头固定
|
stripe: true, // 是否为斑马纹 table
|
highlightCurrentRow: false, // 是否要高亮当前行
|
border: true, // 是否有纵向边框
|
lazy: false, // 是否需要懒加载
|
fit: true, // 列的宽度是否自撑开
|
multiSelect: true, //
|
seqNo: true,
|
isRefresh: true, // 是否显示刷新按钮
|
isShowHide: true, // 是否显示显影按钮
|
isSearch: false, // 高级查询按钮
|
cancelRunCreated: true,
|
defaultOrderBy: { column: 'id', direction: 'desc' },
|
zttDisbaled: true // 临时处理方法,如果为true,id为null的禁选
|
},
|
table: {
|
total: 0,
|
currentPage: 1,
|
pageSize: 20,
|
data: [],
|
// 标题
|
column: [
|
{
|
minWidth: '160',
|
prop: 'optaskNo',
|
label: '工单号',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
minWidth: '160',
|
prop: 'systemNo',
|
label: '系统编号',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
minWidth: '160',
|
prop: 'reelNumber',
|
label: '载具编号',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
minWidth: '160',
|
prop: 'outBatchNo',
|
label: 'SN号',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
minWidth: '160',
|
prop: 'partNo',
|
label: '零件编号',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
minWidth: '160',
|
prop: 'partName',
|
label: '零件名称',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
minWidth: '160',
|
prop: 'staffName',
|
label: '生产人员',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text',
|
formatter: (row, column, cellValue) => {
|
return cellValue.substring(1, cellValue.length - 2)
|
}
|
},
|
{
|
minWidth: '160',
|
prop: 'productNo',
|
label: '报工单号',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
minWidth: '160',
|
prop: 'createTime',
|
label: '创建时间',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'datetimerange'
|
},
|
{
|
minWidth: '160',
|
prop: 'startMeterMark',
|
label: '起始米标',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
minWidth: '160',
|
prop: 'endMeterMark',
|
label: '截止米标',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
minWidth: '100',
|
prop: 'productQty',
|
label: '生产数量',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
minWidth: '80',
|
prop: 'unit',
|
label: '单位',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
minWidth: '100',
|
prop: 'checkStatus',
|
label: '检测状态',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'select',
|
formatter: (row, column, cellValue) => {
|
for (
|
let i = 0, len = this.checkStatusOptions.length;
|
i < len;
|
i++
|
) {
|
if (cellValue === this.checkStatusOptions[i].value) {
|
return this.checkStatusOptions[i].label
|
}
|
}
|
},
|
optList: () => {
|
return this.checkStatusOptions
|
}
|
},
|
{
|
minWidth: '140',
|
prop: 'isQualified',
|
label: '检测是否合格',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'select',
|
formatter: (row, column, cellValue) => {
|
var formatVal
|
if (cellValue && cellValue == true) {
|
formatVal = '<span>是</span>'
|
} else if (cellValue == false) {
|
formatVal = '<span style="color:red">否</span>'
|
} else {
|
formatVal = '<span></span>'
|
}
|
return formatVal
|
},
|
optList: () => {
|
return this.booleanOptions
|
}
|
},
|
{
|
minWidth: '140',
|
prop: 'isUsed',
|
label: '是否允许使用',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'select',
|
formatter: (row, column, cellValue) => {
|
var formatVal
|
if (cellValue && cellValue == true) {
|
formatVal = '<span>是</span>'
|
} else if (cellValue == false) {
|
formatVal = '<span style="color:red">否</span>'
|
} else {
|
formatVal = '<span></span>'
|
}
|
return formatVal
|
},
|
optList: () => {
|
return this.booleanOptions
|
}
|
},
|
{
|
minWidth: '140',
|
prop: 'isSelfQualified',
|
label: '自检是否合格',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'select',
|
formatter: (row, column, cellValue) => {
|
var formatVal
|
if (cellValue && cellValue == true) {
|
formatVal = '<span>是</span>'
|
} else if (cellValue == false) {
|
formatVal = '<span style="color:red">否</span>'
|
} else {
|
formatVal = '<span></span>'
|
}
|
return formatVal
|
},
|
optList: () => {
|
return this.booleanOptions
|
}
|
},
|
{
|
minWidth: '140',
|
prop: 'remark',
|
label: '备注',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
}
|
// ],
|
// toolbar: [
|
// {
|
// text: '报检',
|
// type: 'primary',
|
// cls: 'inspection-btn',
|
// icon: 'feed-btn-return',
|
// fun: this.qualityApply
|
// }
|
]
|
},
|
booleanOptions: [
|
{ value: true, label: '是' },
|
{ value: false, label: '否' }
|
],
|
checkStatusOptions: [
|
{ value: '01untested', label: '待检测' },
|
{ value: '02testing', label: '检测中' },
|
{ value: '03tested', label: '已检测' },
|
{ value: '04noTest', label: '不检测' }
|
],
|
qualityTestApplyVisible: false,
|
|
itemUpdateFlag: false,
|
testStandardList: [],
|
reportSample: {
|
id: 0,
|
outBatchNo: '',
|
partId: '',
|
partName: '',
|
partNo: '',
|
qtyArrived: '',
|
testStandardId: null,
|
isMoTestStandard: true,
|
testStandardNo: '',
|
reportSampleItemList: []
|
}
|
}
|
},
|
components: {
|
ttable,
|
qualityTestApplyForm
|
},
|
watch: {
|
workstationId: {
|
handler: function(newVal, oldVal) {
|
this.createdData()
|
}
|
},
|
'reportSample.testStandardId': {
|
handler(newValue, oldValue) {
|
// 是否已存在自检数据
|
getReportSampleForSelf(
|
Object.assign({
|
systemNo: this.reportSample.systemNo,
|
testStandardId: newValue || 0
|
})
|
).then((resp) => {
|
if (resp.data.data) {
|
this.reportSample.id = resp.data.data.id
|
this.reportSample.reportSampleItemList =
|
resp.data.data.reportSampleItemList
|
} else {
|
this.reportSample.id = 0
|
// 不存在,再去根据制造订单检测标准获取检测项目
|
getByMoTestStandardId(newValue || 0).then((response) => {
|
if (response.data.data && response.data.data.length > 0) {
|
this.reportSample.reportSampleItemList = response.data.data
|
} else {
|
this.reportSample.reportSampleItemList = []
|
}
|
})
|
}
|
})
|
},
|
immediate: true,
|
deep: true
|
},
|
currentDutyRecord: {
|
handler(newValue, oldValue) {
|
this.$nextTick(() => {
|
if (this.currItem != null && this.currItem === 'productOut') {
|
if (newValue.id) {
|
const queryParam = []
|
queryParam.push(
|
Object.assign({
|
prop: 'createTime',
|
searchInfoType: 'datetimerange',
|
propVal: [
|
this.currentDutyRecord.startTime,
|
this.currentDutyRecord.endTime
|
]
|
})
|
)
|
this.$refs.productOutputForCheckTable.setQueryParam(queryParam)
|
this.getData()
|
} else {
|
this.getData()
|
}
|
}
|
})
|
},
|
immediate: true,
|
deep: true
|
}
|
},
|
created() {
|
this.createdData()
|
},
|
methods: {
|
// 获取数据列表
|
getData() {
|
this.$refs.productOutputForCheckTable.getDataList()
|
},
|
createdData() {
|
if (this.workstationId) {
|
this.paramObj = { workstationId: this.workstationId }
|
} else {
|
this.paramObj = { workstationId: 0 }
|
}
|
this.$nextTick(() => {
|
if (this.currItem != null && this.currItem === 'productOut') {
|
this.getData()
|
}
|
})
|
},
|
handleSelectionChange(val) {
|
console.log(val, 'ASSSS')
|
this.multipleSelection = val
|
},
|
handleCurrentChange(val) {
|
/* this.clearApplyPart()
|
if (val) {
|
this.currentRow = val
|
this.reportSample.outBatchNo = val.outBatchNo
|
this.reportSample.systemNo = val.systemNo
|
this.reportSample.partId = val.partId
|
this.reportSample.partNo = val.partNo
|
this.reportSample.partName = val.partName
|
this.reportSample.qtyArrived = val.productQty
|
// 获取产出对应工序的检测标准
|
findTestStandardNoBySystemNo(val.systemNo).then((response) => {
|
if (response.data.data && response.data.data.length > 0) {
|
this.testStandardList = response.data.data
|
// 把第一条检测标准默认上去
|
this.reportSample.testStandardId = this.testStandardList[0].id
|
} else {
|
this.$message.error('该产出对应制造订单工序没有配置检测标准')
|
}
|
})
|
} */
|
},
|
clearApplyPart() {
|
this.testStandardList = []
|
this.reportSample.testStandardId = null
|
},
|
qualityApply() {
|
if (this.multipleSelection && this.multipleSelection.length > 0) {
|
this.qualityTestApplyVisible = true
|
this.$nextTick(() => {
|
this.$refs.qualityTestApply.init()
|
})
|
} else {
|
this.$message.warning('请先选择产出零件')
|
}
|
},
|
|
// 保存检测标准参数
|
saveSampleItem() {
|
const moTestStandard = this.testStandardList.find(
|
(item) => item.id === this.reportSample.testStandardId
|
)
|
if (moTestStandard) {
|
this.reportSample.testStandardNo = moTestStandard.standardNo
|
}
|
if (this.reportSample.id) {
|
putReportSampleItem(this.reportSample.reportSampleItemList).then(
|
(response) => {
|
this.$message.success('自检修改成功')
|
this.itemUpdateFlag = false
|
}
|
)
|
} else {
|
saveSelfSampleItem(this.reportSample)
|
.then((response) => {
|
const sample = response.data.data
|
this.$message.success('自检保存成功')
|
this.itemUpdateFlag = false
|
this.reportSample.id = sample.id
|
this.reportSample.reportSampleItemList = sample.reportSampleItemList
|
this.$set(this.currentRow, 'checkStatus', sample.checkStatus)
|
this.$set(this.currentRow, 'isUsed', sample.isUsed)
|
})
|
.catch(() => {
|
this.itemUpdateFlag = false
|
})
|
}
|
},
|
updateSampleItem() {
|
this.itemUpdateFlag = true
|
},
|
// 自动判定
|
autoJudgmentSelf() {
|
if (this.reportSample.id) {
|
autoJudgmentSelf(this.reportSample).then((response) => {
|
const sample = response.data.data
|
this.$message.success('自动判定成功')
|
this.reportSample.reportSampleItemList = sample.reportSampleItemList
|
this.$set(this.currentRow, 'checkStatus', sample.checkStatus)
|
this.$set(this.currentRow, 'isUsed', sample.isUsed)
|
this.$set(this.currentRow, 'isSelfQualified', sample.isSelfQualified)
|
})
|
} else {
|
this.$message.warning('请先填入并保存自检数据')
|
}
|
},
|
// 刷新产出列表的数据
|
refreshAllData() {
|
if (this.workstationId) {
|
this.getData()
|
} else {
|
this.$message.warning('请先选择工作站')
|
}
|
}
|
}
|
}
|
</script>
|