From c892d0ffb5b79c4a01c2ecd0b41fe79c43432434 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=83=E6=B0=94=E6=BB=A1=E6=BB=A1=28jgy=29?= Date: Wed, 8 Jan 2025 17:58:51 +0800 Subject: [PATCH] =?UTF-8?q?2024-01-8=20MES-=E5=AE=8C=E4=BA=A7=E6=B8=85?= =?UTF-8?q?=E7=BA=BF=E7=82=B9=E6=A3=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/mes/selfMutualInspection.js | 20 +- src/views/mes/pointInspection/index.vue | 340 ++++++++++++++++-------- 2 files changed, 242 insertions(+), 118 deletions(-) diff --git a/src/api/mes/selfMutualInspection.js b/src/api/mes/selfMutualInspection.js index daecbde..ccd3fa9 100644 --- a/src/api/mes/selfMutualInspection.js +++ b/src/api/mes/selfMutualInspection.js @@ -37,7 +37,7 @@ export function getProductList(query) { }); } -// 修改表头表尾部记录 +// 修改 export function updateTable(data) { return request({ url: '/mes/inspectionReport/updateTable', @@ -46,8 +46,15 @@ export function updateTable(data) { }); } +// 修改点检 +export function updatePointInspectionTable(data) { + return request({ + url: '/mes/inspectionReport/updatePointInspectionTable', + method: 'put', + data: data + }); +} -// 查询组线列表 export function getWorkList(query) { return request({ url: '/mes/inspectionReport/getWorkList', @@ -83,12 +90,3 @@ export function listPointInspection(query) { params: query }) } - -// 查询点检listCheckBox -export function listCheckBox(query) { - return request({ - url: '/mes/inspectionReport/listCheckBox', - method: 'get', - params: query - }) -} diff --git a/src/views/mes/pointInspection/index.vue b/src/views/mes/pointInspection/index.vue index 606da1f..ddf712a 100644 --- a/src/views/mes/pointInspection/index.vue +++ b/src/views/mes/pointInspection/index.vue @@ -19,7 +19,7 @@
表单编号:08GL05C001-014A

- +
生产产线:
- +
检查日期:
- + 打印 + 提交 + + 新增一列 + @@ -81,18 +98,27 @@ 车间 黑蚊香 产线:{{ headerParameters.lineName }} + - + @@ -100,21 +126,37 @@ 清换线 - + 日期:{{ headerParameters.checkDate }} - {{ value }} + + 班次: + @@ -155,12 +197,24 @@ - {{ value }} + +
-
+
填写要求: 1.产线组长在开线、品种转换时填写该表。 @@ -207,17 +261,18 @@ 产线:{{ headerParameters.lineName }} - + @@ -225,21 +280,26 @@ 清换线 - + 日期:{{ headerParameters.checkDate }} + - {{ value }} + 班次:{{ item.remark }} @@ -280,14 +340,23 @@ - {{ value }} + + -
-
+
+
填写要求: 1.产线组长在开线、品种转换时填写该表。 @@ -304,7 +373,7 @@ import { listPointInspection, getSelfMutualInspectionData, getLineCodeList, - listCheckBox, + updatePointInspectionTable, } from "@/api/mes/selfMutualInspection"; export default { @@ -326,7 +395,6 @@ export default { tableTittle2: [], tableTittleWidth: null, tableData: [], - checkBoxData: [], // 遮罩层 loading: true, // 选中数组 @@ -347,14 +415,14 @@ export default { queryParams: {}, //表头参数 headerParameters: { - reportName: "ConversionReport", //表类型 + reportName: "CheckReport", //表类型 productionWorkshop: null, //生产车间 lineCode: null, //生产产线编码 lineName: null, //生产产线名称 createBy: null, //检查人 productName: null, //产品名称 checkDate: null, //检查日期 - bz: null, //异常处理 + whetherOpenLine: null, //异常处理 remark: null, //备注 }, // 表单参数 @@ -369,16 +437,72 @@ export default { this.getList(); }, methods: { + handleCheckboxChange(item, checkboxType, transKey, newBz) { + if (checkboxType === "openLine") { + this.$set(item, "whetherOpenLine", true); + } else { + this.$set(item, "whetherOpenLine", false); + } + + this.tableData.forEach((dataItem) => { + Object.keys(dataItem).forEach((key) => { + if (key === transKey) { + this.$set(dataItem[transKey], "whetherOpenLine", newBz); + } + }); + }); + + // this.tableData.forEach((dataItem) => { + // if (dataItem.hasOwnProperty(transKey)) { + // dataItem[transKey][whetherOpenLine] = newBz; + // } + // }); + }, + + //在选择产线时候,存产线名称 + handleSelectLineChange(value) { + const selectedOption = this.lineCodeOption.find( + (option) => option.equipmentCode === value + ); + if (selectedOption) { + this.headerParameters.lineName = selectedOption.equipmentName; + } + }, + dynamicWidthStyle() { return { width: `${1000 / this.propertyNum}px` }; }, //预处理 handlePrintPre() { - this.showTable = false; //页面上的表格不显示 - this.showPrintPage = true; //打印的表格显示 - this.$nextTick(() => { - this.handlePrint(); + this.$confirm("是否确定提交当前页面信息并进行打印操作?", "提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + }) + .then(() => { + // 用户点击确定后执行的逻辑 + this.showTable = false; + this.showPrintPage = true; + this.$nextTick(() => { + this.handleSubmit(); //提交 + this.handlePrint(); //打印 + }); + }) + .catch(() => { + // 用户点击取消后执行的逻辑,这里简单打印提示信息,可按需调整 + console.log("用户取消了打印预处理操作"); + }); + }, + + handleSubmit() { + this.headerParameters.tableData = this.tableData; + updatePointInspectionTable(this.headerParameters).then((response) => { + this.$modal.msgSuccess("提交成功"); + if (response.code == 200) { + this.headerParameters.tableData = null; + this.getList(); + } }); }, @@ -425,20 +549,6 @@ 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; - // }, - /** 重置按钮操作 */ resetQuery() { (this.headerParameters.productionWorkshop = null), //生产车间 @@ -447,38 +557,61 @@ export default { (this.headerParameters.createBy = null), //检查人 (this.headerParameters.productName = null), //产品名称 (this.headerParameters.checkDate = null), //检查日期 - (this.headerParameters.bz = null), //异常处理 + (this.headerParameters.whetherOpenLine = null), //异常处理 (this.headerParameters.remark = null), //备注 // this.getDate(); this.getList(); }, - // objectSpanMethod({ row, column, rowIndex, columnIndex }) { - // if (columnIndex === 1) { - // // 获取当前单元格的值 - // const currentValue = row[column.property]; - // // 获取上一行相同列的值 - // const preRow = this.tableData[rowIndex - 1]; - // const preValue = preRow ? preRow[column.property] : null; - // // 如果当前值和上一行的值相同,则将当前单元格隐藏 - // if (currentValue === preValue) { - // return { rowspan: 0, colspan: 0 }; - // } else { - // // 否则计算当前单元格应该跨越多少行 - // let rowspan = 1; - // for (let i = rowIndex + 1; i < this.detailList.length; i++) { - // const nextRow = this.tableData[i]; - // const nextValue = nextRow[column.property]; - // if (nextValue === currentValue) { - // rowspan++; - // } else { - // break; - // } - // } - // return { rowspan, colspan: 1 }; - // } - // } - // }, + handleRemarkChange(transKey, newRemark) { + // 遍历表格数据,更新该列所有对象的checkTime属性 + this.tableData.forEach((item) => { + Object.keys(item).forEach((key) => { + if (key == transKey) { + const originalRemark = item[key].remark; + item[key].remark = newRemark; + console.log( + key + "原来的班组:", + originalRemark + "现在的班组:", + item[key].remark + ); + } + }); + }); + }, + + AddNewColumn() { + this.propertyNum = Object.keys(this.tableData[0]).length - 3 + 1; //属性个数 + this.tableTittle.push({ + label: "点检结果", + key: this.propertyNum + 3, + }); + this.tableTittleWidth = 880 / this.propertyNum + "px"; + //前端直接构建 + let tableLines = []; + for (let key in table[0]) { + if (key !== "序号" && key !== "点检项目" && key !== "点检内容") { + Object.keys(item).forEach((key) => { + if (key === "tableLine") { + tableLines.push(item[key]); + } + }); + } + } + let maxEndTimeInMinutes = Math.max(...tableLines); + console.log("maxEndTimeInMinutes", maxEndTimeInMinutes); + + //前端直接构建 + this.tableData.forEach((item) => { + var dynamicPropertyName = "第" + this.propertyNum + "列"; + let newProperty = {}; + newProperty.productCode = this.headerParameters.productCode; + newProperty.productName = this.headerParameters.productName; + newProperty.tableLine = this.propertyNum; + newProperty.remark = ""; + this.$set(item, dynamicPropertyName, newProperty); + }); + }, /** 查询检查项维护列表 */ getList() { @@ -492,45 +625,38 @@ export default { this.propertyNum = null; this.loading = true; - //查询上方 - listCheckBox(this.headerParameters).then((response) => { - this.checkBoxData = response; - }); - getSelfMutualInspectionData(this.headerParameters).then((response) => { this.headerParameters.createBy = response.createBy; //检查人 this.headerParameters.productName = response.productName; //产品名称 this.headerParameters.remark = response.remark; //备注 - this.headerParameters.bz = response.bz; //异常处理 - this.headerParameters.lineName = response.lineName; - //this.headerParameters.checkDate = response.checkDate 检查日期 - //生产产线 - }); + this.headerParameters.whetherOpenLine = response.whetherOpenLine; //异常处理 + this.headerParameters.id = response.id; //主表id - listPointInspection(this.headerParameters).then((response) => { - this.tableData = response; - console.log("this.tableData", this.tableData); - this.propertyNum = Object.keys(this.tableData[0]).length - 3; //属性个数 - this.tableTittle0.push({ - label: "序号", - key: 0, - }); - this.tableTittle1.push({ - label: "点检项目", - key: 1, - }); - this.tableTittle2.push({ - label: "点检内容", - key: 2, - }); - for (let i = 0; i < this.propertyNum; i++) { - this.tableTittle.push({ - label: "点检结果", - key: i + 3, + listPointInspection(this.headerParameters).then((response) => { + this.tableData = response; + + this.propertyNum = Object.keys(this.tableData[0]).length - 3; //属性个数 + this.tableTittle0.push({ + label: "序号", + key: 0, }); - } + this.tableTittle1.push({ + label: "点检项目", + key: 1, + }); + this.tableTittle2.push({ + label: "点检内容", + key: 2, + }); + for (let i = 0; i < this.propertyNum; i++) { + this.tableTittle.push({ + label: "点检结果", + key: i + 3, + }); + } - this.tableTittleWidth = 880 / this.propertyNum + "px"; + this.tableTittleWidth = 880 / this.propertyNum + "px"; + }); }); }, },