2025-01-07 MES-自检互检记录表

master
元气满满(jgy) 6 months ago
parent 18114bbc46
commit cbe4394c3c

@ -28,6 +28,35 @@ export function getLineCodeList(query) {
});
}
// 查询组线列表
export function getProductList(query) {
return request({
url: '/mes/inspectionReport/getProductList',
method: 'get',
params: query
});
}
// 修改表头表尾部记录
export function updateTable(data) {
return request({
url: '/mes/inspectionReport/updateTable',
method: 'put',
data: data
});
}
// 查询组线列表
export function getWorkList(query) {
return request({
url: '/mes/inspectionReport/getWorkList',
method: 'get',
params: query
});
}
// 查询首检左侧
export function listFirstInspectionLeft(query) {
return request({

@ -16,21 +16,13 @@
<span>自检互检记录表</span>
</el-col>
</el-row>
<br>
<br />
<el-row>
<el-col :span="10">
<el-col :span="8">
<div>生产车间:黑蚊香车间</div>
<br />
</el-col>
<el-col :span="9">
<div>产品名称: {{ headerParameters.productName }}</div>
<br />
</el-col>
<el-col :span="5">
<div>检查人: {{ headerParameters.checkPeople }}</div>
<br />
</el-col>
<el-col :span="10">
<el-col :span="8">
<div>
生产产线:
<el-select
@ -38,6 +30,7 @@
filterable
placeholder="请选择产线"
style="width: 160px"
@change="handleSelectLineChange"
>
<el-option
v-for="item in lineCodeOption"
@ -50,11 +43,12 @@
</div>
<br />
</el-col>
<el-col :span="9">
<el-col :span="8">
<div>
检查日期:
<el-date-picker
clearable
style="width: 160px"
v-model="headerParameters.checkDate"
type="date"
value-format="yyyy-MM-dd"
@ -62,8 +56,59 @@
>
</el-date-picker>
</div>
<br />
</el-col>
<el-col :span="5">
<el-col :span="8">
<div>
产品名称:
<el-select
v-model="headerParameters.id"
filterable
placeholder="请选择产品"
style="width: 250px"
@change="handleSelectProductChange"
>
<el-option
v-for="item in productCodeOption"
:key="item.id"
:label="'【' + item.productName + '】表id' + item.id"
:value="item.id"
>
</el-option>
</el-select>
</div>
<br />
</el-col>
<!-- <el-col :span="7">
<div>工单号:
<el-select
v-model="headerParameters.workorderId"
filterable
placeholder="请选择工单"
style="width: 250px"
@change="handleSelectWorkChange"
>
<el-option
v-for="item in workCodeOption"
:key="item.workorderId"
:label="item.workorderName"
:value="item.workorderId"
>
</el-option>
</el-select>
</div>
<br />
</el-col> -->
<el-col :span="8">
<div>
:
<el-input
v-model="headerParameters.createBy"
style="width: 160px"
/>
</div>
</el-col>
<el-col :span="8">
<el-button
type="primary"
icon="el-icon-search"
@ -82,6 +127,22 @@
@click="handlePrintPre"
>打印
</el-button>
<el-button
type="primary"
plain
icon="el-icon-check"
size="mini"
@click="handleSubmit"
>提交
</el-button>
<el-button
type="primary"
plain
icon="el-icon-check"
size="mini"
@click="AddNewColumn"
>新增一列
</el-button>
</el-col>
</el-row>
</el-form>
@ -89,40 +150,112 @@
<div>
<table class="bordered-table">
<tr>
<th v-for="item in tableTittle0" style="width:300px" :key="item.key">
<th
v-for="item in tableTittle0"
style="width: 300px"
:key="item.key"
>
{{ item.label }}
</th>
<!-- 动态渲染列名 -->
<th v-for="item in tableTittle" :key="item.key" :width = tableTittleWidth >
<th
v-for="item in tableTittle"
:key="item.key"
:width="tableTittleWidth"
>
{{ item.label }}
</th>
</tr>
<tr>
<!-- 动态渲染列名 -->
<th v-for="(index, key) in tableData[0]" :key="key">{{ key }}</th>
<th v-for="(item, key, index) in tableData[0]" :key="key">
<template v-if="key === '开始-结束'">{{ key }}</template>
<template v-else>
<el-time-select
v-model="item.checkTimeS"
style="width: 100px"
:picker-options="{
start: '00:00',
step: '00:30',
end: '23:30',
}"
format="HH:mm"
@change="handleStartTimeChange(key, $event)"
>
</el-time-select
>-
<el-time-select
v-model="item.checkTimeE"
style="width: 100px"
:picker-options="{
start: '00:00',
step: '00:30',
end: '23:30',
}"
format="HH:mm"
@change="handleEndTimeChange(key, $event)"
>
</el-time-select>
</template>
</th>
</tr>
<tr v-for="item in tableData" :key="item.id">
<!-- 动态渲染列值 -->
<td columnspan="1" v-for="(value, key) in item" :key="key">
{{ value }}
<template v-if="key === '开始-结束'">{{ value.data }}</template>
<template
v-if="key != '开始-结束' && value.type === 'rightWrong'"
>
<el-select v-model="value.data">
<el-option label="√" value="√"></el-option>
<el-option label="×" value="×"></el-option>
</el-select>
</template>
<template v-if="key != '开始-结束' && value.type === 'dataCode'">
<el-select
v-model="value.data"
filterable
placeholder="请选择日期码"
>
<el-option
v-for="item in dataCodeOption"
:key="item.batchCode"
:label="item.batchCode"
:value="item.batchCode"
/>
</el-select>
</template>
<template
v-if="key != '开始-结束' && value.type === 'sprayAmount'"
>
<el-input v-model="value.data" placeholder="请输入"> </el-input>
</template>
</td>
</tr>
<tr>
<td colspan = "1">异常处理</td>
<td :colspan = propertyNum>{{ headerParameters.bz }}</td>
<td colspan="1">异常处理</td>
<td :colspan="propertyNum">
<el-input
type="text"
style="width: 1000px"
v-model="headerParameters.bz"
placeholder="请输入异常处理内容"
/>
</td>
</tr>
<!-- <tr>
<td colspan = "1">备注</td>
<td :colspan = propertyNum>{{ headerParameters.remark }}</td>
</tr> -->
</table>
</div>
<br />
<div>
备注:{{ headerParameters.remark }}
备注:
<el-input
type="text"
style="width: 1250px"
v-model="headerParameters.remark"
placeholder="请输入备注"
/>
</div>
</div>
@ -159,9 +292,7 @@
<br />
</el-col>
<el-col :span="4">
<div class="text-print">
检查人: {{ headerParameters.checkPeople }}
</div>
<div class="text-print">检查人: {{ headerParameters.createBy }}</div>
<br />
</el-col>
<el-col :span="20">
@ -177,15 +308,23 @@
<br />
</el-col>
</el-row>
<row>
<el-row>
<el-col :span="24">
<table class="bordered-table-print" border="1">
<tr>
<th v-for="item in tableTittle0" style="width:300px" :key="item.key">
<th
v-for="item in tableTittle0"
style="width: 300px"
:key="item.key"
>
{{ item.label }}
</th>
<!-- 动态渲染列名 -->
<th v-for="item in tableTittle" :key="item.key" :width = tableTittleWidth >
<th
v-for="item in tableTittle"
:key="item.key"
:width="tableTittleWidth"
>
{{ item.label }}
</th>
</tr>
@ -197,12 +336,12 @@
</tr>
<tr v-for="item in tableData" :key="item.id">
<td v-for="(value, key) in item" :key="key">{{ value }}</td>
<td v-for="(value, key) in item" :key="key">{{ value.data }}</td>
</tr>
<tr>
<td colspan = "1">异常处理</td>
<td :colspan = propertyNum>{{ headerParameters.bz }}</td>
<td colspan="1">异常处理</td>
<td :colspan="propertyNum">{{ headerParameters.bz }}</td>
</tr>
<!-- <tr>
<td colspan = "1">备注</td>
@ -210,10 +349,8 @@
</tr> -->
</table>
</el-col>
</row>
<div class="bottom-remark">
备注:{{ headerParameters.remark }}
</div>
</el-row>
<div class="bottom-remark">备注:{{ headerParameters.remark }}</div>
</div>
<!-- <el-table :data="tableData">
@ -233,6 +370,9 @@ import {
listSelfMutualInspection,
getSelfMutualInspectionData,
getLineCodeList,
getProductList,
updateTable,
getWorkList,
} from "@/api/mes/selfMutualInspection";
export default {
@ -247,6 +387,10 @@ export default {
showPrintPage: false,
showTable: false,
lineCodeOption: [],
dataCodeOption: [],
productCodeOption: [],
workCodeOption: [],
processedTableData: [],
propertyNum: null,
tableTittle0: [],
tableTittle: [],
@ -272,15 +416,19 @@ export default {
queryParams: {},
//
headerParameters: {
id: null, //ID
workorderId: null, //id
reportName: "ConversionReport", //
productionWorkshop: null, //
lineCode: null, //线
lineName: null, //线
checkPeople: null, //
createBy: null, //
productName: null, //
dateCode: null, //
checkDate: null, //
bz: null, //
remark: null, //
belongTo: null, //id
},
//
form: {},
@ -289,21 +437,77 @@ export default {
};
},
created() {
// this.getDate();
this.getLineCode();
this.getList();
},
watch: {
// lineCodecheckDate
headerParameters: {
handler(newVal) {
if (newVal.lineCode && newVal.checkDate) {
this.getProductList(); //
}
},
deep: true,
},
},
methods: {
dynamicWidthStyle(){
return { width: `${1000 / this.propertyNum }px`}
//线线
handleSelectLineChange(value) {
const selectedOption = this.lineCodeOption.find(
(option) => option.equipmentCode === value
);
if (selectedOption) {
this.headerParameters.lineName = selectedOption.equipmentName;
}
},
//
handleSelectProductChange(value) {
const selectedOption = this.productCodeOption.find(
(option) => option.id === value
);
if (selectedOption) {
this.headerParameters.productName = selectedOption.productName;
this.headerParameters.productCode = selectedOption.productCode;
this.headerParameters.workorderId = selectedOption.workorderId;
}
},
handleSelectWorkChange(value) {
const selectedOption = this.workCodeOption.find(
(option) => option.id === value
);
if (selectedOption) {
this.headerParameters.workorderId = selectedOption.workorderId;
}
},
dynamicWidthStyle() {
return { width: `${1000 / this.propertyNum}px` };
},
//
handlePrintPre() {
this.showTable = false; //
this.showPrintPage = true; //
this.$confirm("是否确定提交当前页面信息并进行打印操作?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
//
this.showTable = false;
this.showPrintPage = true;
this.$nextTick(() => {
this.handlePrint();
this.handleSubmit(); //
this.handlePrint(); //
});
})
.catch(() => {
//
console.log("用户取消了打印预处理操作");
});
},
@ -339,6 +543,8 @@ export default {
this.$modal.msg("您没有选择生产产线,请选择!");
} else if (this.headerParameters.checkDate == null) {
this.$modal.msg("您没有选择检查时间,请选择!");
} else if (this.headerParameters.id == null) {
this.$modal.msg("您没有选择检查产品,请选择!");
} else {
this.getList();
}
@ -350,55 +556,50 @@ export default {
});
},
/**获取默认查询时间段**/
// getDate() {
// let start = this.Fungetdate (0)
// this.headerParameters.checkDate = start;
// },
// Fungetdate (num) {
// var dd = new Date();
// dd.setDate(dd.getDate() + num);
// var y = dd.getFullYear();
// var m = dd.getMonth() + 1;//
// var d = dd.getDate();
// return y + "-" + m +"-"+d;
// },
getProductList() {
getProductList(this.headerParameters).then((response) => {
this.productCodeOption = response;
});
},
getWorkList() {
getWorkList(this.headerParameters).then((response) => {
this.workCodeOption = response;
});
},
/** 重置按钮操作 */
resetQuery() {
(this.headerParameters.productionWorkshop = null), //
(this.headerParameters.lineCode = null), //线
(this.headerParameters.lineName = null), //线
(this.headerParameters.checkPeople = null), //
(this.headerParameters.createBy = null), //
(this.headerParameters.productName = null), //
(this.headerParameters.checkDate = null), //
(this.headerParameters.bz = null), //
(this.headerParameters.remark = null), //
// this.getDate();
this.getList();
},
/** 查询检查项维护列表 */
getList() {
this.showTable = true;//
this.showPrintPage = false;//
this.showTable = true; //
this.showPrintPage = false; //
this.tableData = [];
this.tableTittle = [];
this.tableTittle0 = [];
this.propertyNum = null;
this.loading = true;
getSelfMutualInspectionData(this.headerParameters).then((response) => {
this.headerParameters.checkPeople = response.createBy; //
this.headerParameters.productName = response.productName; //
this.headerParameters.createBy = response.createBy; //
this.headerParameters.remark = response.remark; //
this.headerParameters.bz = response.bz; //
this.headerParameters.lineName = response.lineName;
//this.headerParameters.checkDate = response.checkDate
//线
this.dataCodeOption = response.dateCodeList;
});
listSelfMutualInspection(this.headerParameters).then((response) => {
this.tableData = response;
console.log("this.tableData", this.tableData);
this.propertyNum = Object.keys(this.tableData[0]).length - 1; //
this.tableTittle0.push({
label: "项目",
@ -410,8 +611,165 @@ export default {
key: i + 1,
});
}
this.tableTittleWidth = 1000 / this.propertyNum + "px";
});
},
this.tableTittleWidth = (1000 / (this.propertyNum)) + 'px';
AddNewColumn() {
//
this.tableTittle.push({
label: "检查时间",
key: this.propertyNum + 1,
});
this.propertyNum = this.propertyNum + 1;
this.tableTittleWidth = 1000 / this.propertyNum + "px";
//
this.tableData.forEach((item) => {
Object.keys(item).forEach((key) => {
if (key == "开始-结束") {
//
let endTimes = [];
Object.keys(item).forEach((key) => {
if (key != "开始-结束") {
let [start, end] = key.split("-");
endTimes.push(end);
}
});
//
let timesInMinutes = endTimes.map((time) => {
let [hour, minute] = time.split(":").map(Number);
return hour * 60 + minute;
});
//
let maxEndTimeInMinutes = Math.max(...timesInMinutes);
let newEndTime = null;
let maxEndTime = null;
if (Number.isNaN(maxEndTimeInMinutes)) {
maxEndTime = "00:00";
newEndTime = "00:30";
console.log("maxEndTimeInMinutes", maxEndTimeInMinutes);
} else {
//
let maxHour = Math.floor(maxEndTimeInMinutes / 60);
let maxMinute = maxEndTimeInMinutes % 60;
maxEndTime =
maxHour.toString().padStart(2, "0") +
":" +
maxMinute.toString().padStart(2, "0");
//
maxMinute += 30;
if (maxMinute >= 60) {
maxHour += 1;
maxMinute -= 60;
}
//
newEndTime =
maxHour.toString().padStart(2, "0") +
":" +
maxMinute.toString().padStart(2, "0");
}
var dynamicPropertyName = maxEndTime + "-" + newEndTime;
let newProperty = {};
newProperty.productCode = this.headerParameters.productCode;
newProperty.productName = this.headerParameters.productName;
newProperty.tableLine = this.propertyNum;
newProperty.infoName = item[key].projectName;
newProperty.timeArray = maxEndTime + "-" + newEndTime;
newProperty.checkTimeS = maxEndTime;
newProperty.checkTimeE = newEndTime;
if (
item[key].projectName == "日期码" ||
item[key].projectName == "生产批号"
) {
newProperty.checkResult = "";
newProperty.data = "";
newProperty.type = "dataCode";
} else if (item[key].projectName == "灌装量/净含量/喷药量") {
newProperty.checkResult = "";
newProperty.data = "";
newProperty.type = "sprayAmount";
} else {
newProperty.checkResult = "√";
newProperty.data = "√";
newProperty.type = "rightWrong";
}
this.$set(item, dynamicPropertyName, newProperty);
}
});
});
console.log("this.tableData", this.tableData);
},
handleSubmit() {
//
if (this.tableData && this.tableData[0]) {
const firstObject = this.tableData[0];
for (let key in firstObject) {
if (
firstObject.hasOwnProperty(key) &&
firstObject[key].hasOwnProperty("checkTimeS")
) {
const checkTimeS = firstObject[key].checkTimeS;
if (
typeof checkTimeS === "undefined" ||
checkTimeS === null ||
checkTimeS === ""
) {
this.$modal.msg("您填入的检查时间存在开始时间为空的情况,请再次进行填写!");
return;
}
}
}
}
this.headerParameters.tableData = this.tableData;
updateTable(this.headerParameters).then((response) => {
this.$modal.msgSuccess("提交成功");
if (response.code == 200) {
this.headerParameters.tableData = null;
this.getList();
}
});
},
handleStartTimeChange(transKey, newTime) {
// checkTime
this.tableData.forEach((item) => {
Object.keys(item).forEach((key) => {
if (key == transKey) {
const originalTime = item[key].checkTimeS;
item[key].checkTimeS = newTime;
console.log(
key + "原来的结束时间:",
originalTime + "现在的结束时间:",
item[key].checkTimeS
);
}
});
});
},
handleEndTimeChange(transKey, newTime) {
// checkTime
this.tableData.forEach((item) => {
Object.keys(item).forEach((key) => {
if (key == transKey) {
const originalTime = item[key].checkTimeE;
item[key].checkTimeE = newTime;
console.log(
key + "原来的结束时间:",
originalTime + "现在的结束时间:",
item[key].checkTimeE
);
}
});
});
},
},
@ -438,7 +796,6 @@ export default {
}
.bordered-table th,
.bordered-table td {
border: 1px solid #ddd; /* 边框样式 */
padding: 8px; /* 单元格内边距 */
@ -446,9 +803,9 @@ export default {
}
.bordered-table tr {
word-break:break-all;
word-wrap:break-word;
border-collapse:collapse
word-break: break-all;
word-wrap: break-word;
border-collapse: collapse;
}
.bordered-table-bottom {
@ -508,8 +865,13 @@ export default {
}
.bordered-table-print tr {
word-break:break-all;
word-wrap:break-word;
border-collapse:collapse
word-break: break-all;
word-wrap: break-word;
border-collapse: collapse;
}
.time-range {
border: 1px solid black;
padding: 2px;
}
</style>
Loading…
Cancel
Save