yudao-dev/src/views/quality/monitoring/originalGlassRetrace/index.vue
2024-04-26 10:16:07 +08:00

416 lines
12 KiB
Vue

<!--
* @Author: zwq
* @Date: 2023-08-01 14:55:51
* @LastEditors: DY
* @LastEditTime: 2024-04-26 09:58:51
* @Description:
-->
<template>
<div class="app-container">
<!-- <search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" /> -->
<el-form
:inline="true"
:model="listQuery"
class="blueTip">
<el-form-item label="合格证号" prop="certificateNumber">
<el-input size="small" v-model="listQuery.certificateNumber" clearable placeholder="合格证号" @blur="countTimes(1)" @clear="countArray[0] = false"></el-input>
</el-form-item>
<el-form-item label="成品周转编号" prop="packagingCode">
<el-input size="small" v-model="listQuery.packagingCode" clearable placeholder="成品周转编号" @blur="countTimes(2)" @clear="countArray[1] = false"></el-input>
</el-form-item>
<el-form-item label="原片周转编号" prop="glassCode">
<el-input size="small" v-model="listQuery.glassCode" clearable placeholder="原片周转编号" @blur="countTimes(3)" @clear="countArray[2] = false"></el-input>
</el-form-item>
<el-form-item label="包装全检时间及产线" prop="val">
<el-date-picker
v-model="listQuery.packTime"
value-format="timestamp"
type="datetime"
size="small"
clearable
placeholder="包装全检时间"
@change="countTimes('timestamp3')"
/>
<el-select v-model="listQuery.lineName" size="small" clearable filterable placeholder="产线" @change="countTimes('timestamp3')" style="margin-left: 5px">
<el-option v-for="(item, index) in lineOptions" :key="index" :label="item.name" :value="item.name"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button
v-if="this.$auth.hasPermi('monitoring:rawMaterial-traceability:query')"
type="primary"
size="small"
@click="getList">
查询
</el-button>
</el-form-item>
</el-form>
<!-- <base-table :max-height="tableH" :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize"
:table-data="list"> -->
<base-table :max-height="tableH" :table-props="tableProps"
:table-data="list">
<method-btn v-if="tableBtn.length" slot="handleBtn" :width="220" label="缺陷操作" :method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<!-- <pagination :limit.sync="listQuery.pageSize" :page.sync="listQuery.pageNo" :total="listQuery.total"
@pagination="getList" /> -->
<!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" /> -->
</div>
</template>
<script>
// import AddOrUpdate from './add-or-updata';
// import unitDict from './unitDict';
// import basicPage from '../mixins/basic-page';
// import { publicFormatter } from '@/utils/dict';
import { parseTime } from '../mixins/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import { getCorePLList } from '@/api/base/coreProductionLine';
import { getOriginalGlassRetrace } from '@/api/quality/rawMaterialTraceability';
const tableProps = [
{
prop: 'certificateNumber',
label: '合格证号',
minWidth: 120,
showOverflowtooltip: true,
filter: (val) => val ? val : '--'
},
{
prop: 'boxNumber',
label: '箱号',
minWidth: 150,
showOverflowtooltip: true,
filter: (val) => val ? val : '--'
},
{
prop: 'packagingCode',
label: '成品周转编号',
minWidth: 180,
showOverflowtooltip: true,
filter: (val) => val ? val : '--'
},
{
prop: 'deepProcessingLineName',
label: '深加工产线',
minWidth: 120,
showOverflowtooltip: true,
filter: (val) => val ? val : '--'
},
{
prop: 'deepProcessingInputTime',
label: '深加工上片时间',
// filter: (val) => parseTime(val) ? parseTime(val) : '--',
filter: parseTime,
minWidth: 180,
showOverflowtooltip: true
},
{
prop: 'deepProcessingOutputTime',
label: '深加工下片时间',
filter: parseTime,
minWidth: 180,
showOverflowtooltip: true
},
{
prop: 'glassCode',
label: '原片周转编码',
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'originalGlassLineName',
label: '原片产线',
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'originalGlassOutputTime',
label: '原片下片时间',
filter: parseTime,
minWidth: 180,
showOverflowtooltip: true
}
// {
// prop: 'scrapDetail',
// label: '详情',
// filter: parseTime
// }
];
export default {
// mixins: [basicPage],
mixins: [tableHeightMixin],
data() {
return {
lineOptions: [],
tableProps,
tableBtn: [
// this.$auth.hasPermi(`base:packaging-print-log:update`)
// ?
{
type: 'detail0',
btnName: '成品缺陷详情',
},
// : undefined,
// this.$auth.hasPermi(`base:packaging-print-log:delete`)
// ?
{
type: 'detail1',
btnName: '原片缺陷详情',
}
// : undefined,
].filter((v) => v),
list: [],
listQuery: {
// pageSize: 10,
// pageNo: 1,
// total: 0,
certificateNumber: undefined,
packagingCode: undefined,
packTime: null,
lineName: null,
glassCode: undefined
},
useTime: false,
countArray: [false, false, false, false],
// tableH: this.tableHeight(260),
formConfig: [
// {
// type: 'select',
// label: '工单',
// selectOptions: [],
// labelField: 'name',
// valueField: 'name',
// param: 'workOrderName',
// filterable: true
// },
{
type: 'input',
label: '合格证号',
placeholder: '合格证号',
param: 'certificateNumber',
},
{
type: 'input',
label: '成品周转编号',
placeholder: '成品周转编号',
param: 'packagingCode'
},
{
type: 'datePicker',
label: '包装全检时间及产线',
dateType: 'datetimerange',
format: 'timestamp',
valueFormat: "timestamp",
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'timeVal',
defaultSelect: [],
width: 250
},
{
type: 'select',
label: '',
selectOptions: [],
labelField: 'name',
valueField: 'name',
param: 'lineName',
filterable: true
},
{
type: 'input',
label: '原片周转编号',
placeholder: '原片周转编号',
param: 'glassCode'
},
{
type: this.$auth.hasPermi('monitoring:rawMaterial-traceability:query') ? 'button' : '',
btnName: '查询',
name: 'search',
color: 'primary',
},
// {
// type: 'separate',
// },
// {
// type: 'button',
// btnName: '重置',
// name: 'reset',
// },
// {
// type: 'separate',
// },
// {
// type: this.$auth.hasPermi('base:packaging-print-log:create') ? 'button' : '',
// btnName: '新增',
// name: 'add',
// color: 'success',
// plain: true,
// },
// {
// type: 'separate',
// type: this.$auth.hasPermi('base:product:create') ? 'separate' : '',
// },
// {
// type: this.$auth.hasPermi('monitoring:materiel-date-from:export') ? 'button' : '',
// btnName: '导出',
// name: 'export',
// color: 'warning',
// },
],
};
},
components: {
// AddOrUpdate,
},
created() {
// window.addEventListener('resize', () => {
// this.tableH = this.tableHeight(260)
// })
countArray: [false, false, false, false],
this.useTime = false
// this.getList()
this.getDict()
},
methods: {
handleClick(raw) {
if (raw.type === 'detail1') {
// 原片缺陷
this.$router.push({
path: '/quality/base/quality-isra',
query: {
// deepProcessingLineId: raw.data.deepProcessingLineId,
lineName: raw.data.deepProcessingLineName,
originalGlassOutputTime: raw.data.originalGlassOutputTime
},
});
} else {
// 成品缺陷
this.$router.push({
path: '/quality/base/quality-inspection-data/detection-information/statistical-data',
query: {
startTime: raw.data.deepProcessingInputTime,
endTime: raw.data.deepProcessingOutputTime
},
});
}
},
countTimes(val) {
if (val === 1) {
this.countArray[0] = this.listQuery.certificateNumber !== '' && this.listQuery.certificateNumber !== undefined
}
if (val === 2) {
this.countArray[1] = this.listQuery?.packagingCode !== '' && this.listQuery?.packagingCode !== undefined
}
if (val === 3) {
this.countArray[2] = this.listQuery?.glassCode !== '' && this.listQuery?.glassCode !== undefined
}
if (val === 'timestamp3') {
if ((this.listQuery.packTime !== '' && this.listQuery.packTime !== null) || (this.listQuery?.lineName !== '' && this.listQuery.lineName !== null)) {
this.useTime = true
this.countArray[3] = true
} else {
this.useTime = false
this.countArray[3] = true
}
}
},
getList() {
let trueArray = this.countArray.filter(val => val === true)
if (trueArray.length !== 1) {
this.$message.error('请选择一个条件进行查询!')
} else {
if (this.useTime === true) {
if (this.listQuery.packTime !== null && this.listQuery.packTime !== '' && this.listQuery.lineName !== null && this.listQuery.lineName !== '') {
getOriginalGlassRetrace({ ...this.listQuery }).then(res => {
console.log(res);
this.list = res.data || []
console.log(this.list);
// this.listQuery.total = res.data.total || 0
})
} else {
this.$message.error('选择包装全检时,时间和产线均为必填!')
}
} else {
getOriginalGlassRetrace({ ...this.listQuery }).then(res => {
console.log(res);
this.list = res.data || []
console.log(this.list);
})
}
}
},
getDict() {
// 获取产线
getCorePLList().then((res) => {
console.log(res);
this.lineOptions = res.data;
})
},
// handleExport() {
// // 处理查询参数
// let params = { ...this.listQuery };
// params.pageNo = undefined;
// params.pageSize = undefined;
// this.$modal.confirm('是否确认导出所有数据项?').then(() => {
// this.exportLoading = true;
// return exportEnergyPlcExcel(params);
// }).then(response => {
// this.$download.excel(response, '物料信息追溯 ');
// this.exportLoading = false;
// }).catch(() => { });
// },
buttonClick(val) {
console.log(val)
if (val.btnName === 'search') {
this.listQuery.certificateNumber = val.certificateNumber ? val.certificateNumber :undefined
// this.queryParams.status = val.status
// if (val.timeVal && val.timeVal.length != 0 ) {
// this.listQuery.startTime = val.timeVal[0] + ' 00:00:00'
// this.listQuery.endTime = val.timeVal[1] + ' 23:59:59'
// } else {
// this.listQuery.startTime = undefined
// this.listQuery.endTime = undefined
// }
this.getList()
} else {
// this.handleExport()
// this.addOrEditTitle = '新增'
// this.centervisible = true
// this.$nextTick(() => {
// this.$refs.orderAdd.init()
// })
}
},
otherMethods(val) {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '详情';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id, true);
});
},
},
};
</script>
<style scoped>
.blueTip::before {
display: inline-block;
content: '';
width: 4px;
height: 18px;
background: #0b58ff;
border-radius: 1px;
margin-right: 8px;
margin-top: 8px;
margin-left: 16px;
}
</style>