|
@@ -1,19 +1,71 @@
|
|
|
<template>
|
|
|
- <div class="app-container" style="width: 100%;">
|
|
|
+ <div class="app-container" style="width: 100%">
|
|
|
<!--表格-->
|
|
|
<el-table
|
|
|
:data="tableData"
|
|
|
ref="tableRef"
|
|
|
- :span-method="spanMethod2">
|
|
|
- <el-table-column prop="machineId" fixed label="机台号" header-align="center" align="center" width="111px" ></el-table-column>
|
|
|
- <el-table-column prop="productType" fixed label="产品类别" header-align="center" align="center" width="111.2px"></el-table-column>
|
|
|
- <el-table-column label="在机产品" header-align="center" >
|
|
|
- <el-table-column prop="currentColorCode" label="色号" header-align="center" width="90px" align="center"></el-table-column>
|
|
|
- <el-table-column prop="currentSpecification" label="规格" header-align="center" width="90px" align="center"></el-table-column>
|
|
|
- <el-table-column prop="currentLotNumber" label="批号" header-align="center" width="90px" align="center"></el-table-column>
|
|
|
- <el-table-column prop="currentSpindleCount" label="锭数" header-align="center" width="90px" align="center"></el-table-column>
|
|
|
- <el-table-column prop="startTime" label="上机时间" header-align="center" width="90px" align="center"></el-table-column>
|
|
|
- <el-table-column prop="plannedEndTime" label="下机时间" header-align="center" width="90px" align="center"></el-table-column>
|
|
|
+ :span-method="spanMethod2"
|
|
|
+ :height="table_height"
|
|
|
+ >
|
|
|
+ <el-table-column
|
|
|
+ prop="machineId"
|
|
|
+ fixed
|
|
|
+ label="机台号"
|
|
|
+ header-align="center"
|
|
|
+ align="center"
|
|
|
+ width="111px"
|
|
|
+ ></el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="productType"
|
|
|
+ fixed
|
|
|
+ label="产品类别"
|
|
|
+ header-align="center"
|
|
|
+ align="center"
|
|
|
+ width="111.2px"
|
|
|
+ ></el-table-column>
|
|
|
+ <el-table-column label="在机产品" header-align="center">
|
|
|
+ <el-table-column
|
|
|
+ prop="currentColorCode"
|
|
|
+ label="色号"
|
|
|
+ header-align="center"
|
|
|
+ width="90px"
|
|
|
+ align="center"
|
|
|
+ ></el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="currentSpecification"
|
|
|
+ label="规格"
|
|
|
+ header-align="center"
|
|
|
+ width="90px"
|
|
|
+ align="center"
|
|
|
+ ></el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="currentLotNumber"
|
|
|
+ label="批号"
|
|
|
+ header-align="center"
|
|
|
+ width="90px"
|
|
|
+ align="center"
|
|
|
+ ></el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="currentSpindleCount"
|
|
|
+ label="锭数"
|
|
|
+ header-align="center"
|
|
|
+ width="90px"
|
|
|
+ align="center"
|
|
|
+ ></el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="startTime"
|
|
|
+ label="上机时间"
|
|
|
+ header-align="center"
|
|
|
+ width="90px"
|
|
|
+ align="center"
|
|
|
+ ></el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="plannedEndTime"
|
|
|
+ label="下机时间"
|
|
|
+ header-align="center"
|
|
|
+ width="90px"
|
|
|
+ align="center"
|
|
|
+ ></el-table-column>
|
|
|
</el-table-column>
|
|
|
<!-- <el-table-column label="待上机产品" header-align="center" align="center">-->
|
|
|
<!-- <el-table-column prop="djCurrentColorCode" label="色号" header-align="center" align="center"></el-table-column>-->
|
|
@@ -21,30 +73,46 @@
|
|
|
<!-- <el-table-column prop="djNumber" label="数量" header-align="center" align="center"></el-table-column>-->
|
|
|
<!-- <el-table-column prop="djCurrentLotNumber" label="原丝批号" header-align="center" align="center"></el-table-column>-->
|
|
|
<!-- </el-table-column>-->
|
|
|
- <el-table-column prop="listOfPendingProduction" label="待生产产品列表" header-align="center" align="center" >
|
|
|
+ <el-table-column
|
|
|
+ prop="listOfPendingProduction"
|
|
|
+ label="待生产产品列表"
|
|
|
+ header-align="center"
|
|
|
+ align="center"
|
|
|
+ >
|
|
|
<template slot-scope="scope">
|
|
|
<div v-if="scope.row.listOfPendingProduction">
|
|
|
- <span v-for="(item, index) in scope.row.listOfPendingProduction.split(',')">
|
|
|
+ <span
|
|
|
+ v-for="(item, index) in scope.row.listOfPendingProduction.split(
|
|
|
+ ','
|
|
|
+ )"
|
|
|
+ :key="index"
|
|
|
+ >
|
|
|
{{ item }},
|
|
|
- <br v-if="(index + 1) % 5 === 0 && index !== scope.row.listOfPendingProduction.split(',').length - 1" />
|
|
|
+ <br
|
|
|
+ v-if="
|
|
|
+ (index + 1) % 5 === 0 &&
|
|
|
+ index !==
|
|
|
+ scope.row.listOfPendingProduction.split(',').length - 1
|
|
|
+ "
|
|
|
+ />
|
|
|
</span>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
-<!-- <el-table-column fixed="right" label="操作" header-align="center" align="center" width="150px" >-->
|
|
|
-<!-- <template slot-scope="scope">-->
|
|
|
-<!-- <el-dropdown>-->
|
|
|
-<!-- <el-button type="primary">-->
|
|
|
-<!-- 操作-->
|
|
|
-<!-- <i class="el-icon-arrow-down el-icon--right"></i>-->
|
|
|
-<!-- </el-button>-->
|
|
|
-<!-- <el-dropdown-menu slot="dropdown">-->
|
|
|
-<!-- <el-dropdown-item @click.native.prevent="handleAddPlan(scope.row)">新增计划</el-dropdown-item>-->
|
|
|
-<!-- <el-dropdown-item @click.native.prevent="handleEditPlan(scope.row)">修改计划</el-dropdown-item>-->
|
|
|
-<!-- </el-dropdown-menu>-->
|
|
|
-<!-- </el-dropdown>-->
|
|
|
-<!-- </template>-->
|
|
|
-<!-- </el-table-column>-->
|
|
|
+ <!-- <el-table-column fixed="right" label="操作" header-align="center" align="center" width="150px" >-->
|
|
|
+ <!-- <template slot-scope="scope">-->
|
|
|
+ <!-- <el-dropdown>-->
|
|
|
+ <!-- <el-button type="primary">-->
|
|
|
+ <!-- 操作-->
|
|
|
+ <!-- <i class="el-icon-arrow-down el-icon--right"></i>-->
|
|
|
+ <!-- </el-button>-->
|
|
|
+ <!-- <el-dropdown-menu slot="dropdown">-->
|
|
|
+ <!-- <el-dropdown-item @click.native.prevent="handleAddPlan(scope.row)">新增计划</el-dropdown-item>-->
|
|
|
+ <!-- <el-dropdown-item @click.native.prevent="handleEditPlan(scope.row)">修改计划</el-dropdown-item>-->
|
|
|
+ <!-- </el-dropdown-menu>-->
|
|
|
+ <!-- </el-dropdown>-->
|
|
|
+ <!-- </template>-->
|
|
|
+ <!-- </el-table-column>-->
|
|
|
</el-table>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -56,86 +124,133 @@ import {
|
|
|
addMaterielInfo,
|
|
|
getSalesman,
|
|
|
getAllPlanListByMachineId,
|
|
|
- getAllPlanListByProductTypeAndStatus, updatePlanOne
|
|
|
+ getAllPlanListByProductTypeAndStatus,
|
|
|
+ updatePlanOne,
|
|
|
} from "@/api/plan/paln.js";
|
|
|
-import {getDicts} from "@/api/system/dict/data";
|
|
|
+import { getDicts } from "@/api/system/dict/data";
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ // 表格滑动相关
|
|
|
+ scrollTimer: null,
|
|
|
+ table_height: 0,
|
|
|
+ timerId: null,
|
|
|
//选中的是那个车间
|
|
|
- selectedWorkshop:"南车间",
|
|
|
- tableData:[],
|
|
|
- isDisabled:true,
|
|
|
+ selectedWorkshop: "南车间",
|
|
|
+ tableData: [],
|
|
|
+ isDisabled: true,
|
|
|
form: {
|
|
|
- product:"",
|
|
|
+ product: "",
|
|
|
},
|
|
|
previousMachineId: undefined,
|
|
|
currentRowspan: 1,
|
|
|
prevRow: {},
|
|
|
tableData2: [],
|
|
|
- nanInsertDialogTableVisible:false,
|
|
|
- nanUpdateDialogTableVisible:false,
|
|
|
- beiInsertDialogTableVisible:false,
|
|
|
- beiUpdateDialogTableVisible:false,
|
|
|
+ nanInsertDialogTableVisible: false,
|
|
|
+ nanUpdateDialogTableVisible: false,
|
|
|
+ beiInsertDialogTableVisible: false,
|
|
|
+ beiUpdateDialogTableVisible: false,
|
|
|
editingRowIndex: -1,
|
|
|
- lastEditLine:0,
|
|
|
- queryParams:{ productionLineDepartment:"加弹部",
|
|
|
- productionLineWorkshop:"南车间"},
|
|
|
- isEditLine:false,
|
|
|
- productsInfo:[],
|
|
|
- salesmanInfo:[],
|
|
|
- product:{},
|
|
|
- materiel:{},
|
|
|
+ lastEditLine: 0,
|
|
|
+ queryParams: {
|
|
|
+ productionLineDepartment: "加弹部",
|
|
|
+ productionLineWorkshop: "南车间",
|
|
|
+ },
|
|
|
+ isEditLine: false,
|
|
|
+ productsInfo: [],
|
|
|
+ salesmanInfo: [],
|
|
|
+ product: {},
|
|
|
+ materiel: {},
|
|
|
// 机台号
|
|
|
- machineId:"",
|
|
|
+ machineId: "",
|
|
|
// 待机/上机/停产
|
|
|
- stateList0:[
|
|
|
- {"id":0,"name":"待机"},
|
|
|
- {"id":1,"name":"上机"},
|
|
|
+ stateList0: [
|
|
|
+ { id: 0, name: "待机" },
|
|
|
+ { id: 1, name: "上机" },
|
|
|
],
|
|
|
- stateList1:[
|
|
|
- {"id":0,"name":"待机"},
|
|
|
- {"id":2,"name":"停机"},
|
|
|
- {"id":1,"name":"上机"},
|
|
|
- {"id":3,"name":"已完成"},
|
|
|
+ stateList1: [
|
|
|
+ { id: 0, name: "待机" },
|
|
|
+ { id: 2, name: "停机" },
|
|
|
+ { id: 1, name: "上机" },
|
|
|
+ { id: 3, name: "已完成" },
|
|
|
],
|
|
|
- stateList2:[
|
|
|
- {"id":0,"name":"待机"},
|
|
|
- {"id":2,"name":"停机"},
|
|
|
- {"id":1,"name":"上机"},
|
|
|
+ stateList2: [
|
|
|
+ { id: 0, name: "待机" },
|
|
|
+ { id: 2, name: "停机" },
|
|
|
+ { id: 1, name: "上机" },
|
|
|
],
|
|
|
- formData:{
|
|
|
- updateSelectedProductCategory:"",
|
|
|
- updateSelectedProductState:""
|
|
|
+ formData: {
|
|
|
+ updateSelectedProductCategory: "",
|
|
|
+ updateSelectedProductState: "",
|
|
|
},
|
|
|
// 产品类别
|
|
|
- productTypeList:[{value:"A面",lable:"A面"},{value:"B面",lable:"B面"}],
|
|
|
- }
|
|
|
+ productTypeList: [
|
|
|
+ { value: "A面", lable: "A面" },
|
|
|
+ { value: "B面", lable: "B面" },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ // 初始化数据
|
|
|
+ this.initSize();
|
|
|
},
|
|
|
mounted() {
|
|
|
+ // 初始化滚动数据
|
|
|
+ this.initScroll();
|
|
|
// 得到排产计划信息
|
|
|
this.getAmmunitionPlanInfo();
|
|
|
// 得到业务员信息
|
|
|
// this.getSalesman();
|
|
|
this.getProductsInfo();
|
|
|
//查询字典信息
|
|
|
- getDicts("dpsx").then(res=>{
|
|
|
+ getDicts("dpsx").then((res) => {
|
|
|
//制定周期跑一次定时任务
|
|
|
- console.log(res.data[0].dictValue)
|
|
|
+ console.log(res.data[0].dictValue);
|
|
|
this.timerId = setInterval(() => {
|
|
|
this.counter++;
|
|
|
- console.log(`计数器:`,this.counter);
|
|
|
+ console.log(`计数器:`, this.counter);
|
|
|
// 注意:适时清理定时器,例如在组件销毁时
|
|
|
// 得到排产计划信息
|
|
|
this.getAmmunitionPlanInfo();
|
|
|
}, res.data[0].dictValue);
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 初始化尺寸
|
|
|
+ initSize() {
|
|
|
+ this.table_height = window.innerHeight - 40;
|
|
|
+ console.log("table_height:", this.table_height);
|
|
|
+ },
|
|
|
+ async initScroll() {
|
|
|
+ let time = await getDicts("scroll_speed");
|
|
|
+ console.log(time);
|
|
|
+ if (time.code == 200) {
|
|
|
+ time = Number(time.data[0].dictValue);
|
|
|
+ } else {
|
|
|
+ time = 180;
|
|
|
+ }
|
|
|
+ // 拿到表格挂载后的真实DOM
|
|
|
+ const table = this.$refs.tableRef;
|
|
|
+ // 拿到表格中承载数据的div元素
|
|
|
+ const divData = table.bodyWrapper;
|
|
|
+ // 拿到元素后,对元素进行定时增加距离顶部距离,实现滚动效果(此配置为每100毫秒移动1像素)
|
|
|
+ this.scrollTimer = setInterval(() => {
|
|
|
+ // 元素自增距离顶部1像素
|
|
|
+ divData.scrollTop += 1;
|
|
|
+ // 判断元素是否滚动到底部(可视高度+距离顶部=整个高度)
|
|
|
+ if (
|
|
|
+ divData.clientHeight + divData.scrollTop + 1 >=
|
|
|
+ divData.scrollHeight
|
|
|
+ ) {
|
|
|
+ // 重置table距离顶部距离
|
|
|
+ divData.scrollTop = 0;
|
|
|
+ }
|
|
|
+ }, time); // 滚动速度
|
|
|
+ },
|
|
|
// 查询排产信息
|
|
|
getAmmunitionPlanInfo() {
|
|
|
ammunitionPlanInfo(this.queryParams).then((response) => {
|
|
|
- this.tableData = response.data
|
|
|
+ this.tableData = response.data;
|
|
|
});
|
|
|
},
|
|
|
|
|
@@ -143,7 +258,7 @@ export default {
|
|
|
spanMethod2({ row, column, rowIndex, columnIndex }) {
|
|
|
//第二列合并
|
|
|
if (columnIndex === 1) {
|
|
|
- if(row.productType == null) {
|
|
|
+ if (row.productType == null) {
|
|
|
return;
|
|
|
}
|
|
|
const prevRow2 = this.tableData[rowIndex - 1]; // 上一行数据
|
|
@@ -163,7 +278,7 @@ export default {
|
|
|
nextRow2 &&
|
|
|
nextRow2.machineId === row.machineId &&
|
|
|
nextRow2.productType === row.productType
|
|
|
- ) {
|
|
|
+ ) {
|
|
|
nextRow2 = this.tableData[++countRowspan2 + rowIndex];
|
|
|
}
|
|
|
if (countRowspan2 > 1) {
|
|
@@ -173,37 +288,45 @@ export default {
|
|
|
}
|
|
|
//待生产列表
|
|
|
if (columnIndex === 8) {
|
|
|
- const prevRow2 = this.tableData[rowIndex - 1] //上一行数据
|
|
|
- let nextRow2 = this.tableData[rowIndex + 1] //下一行数据
|
|
|
+ const prevRow2 = this.tableData[rowIndex - 1]; //上一行数据
|
|
|
+ let nextRow2 = this.tableData[rowIndex + 1]; //下一行数据
|
|
|
// 当上一行的数据等于当前行数据时,当前行单元格隐藏
|
|
|
|
|
|
// console.log(row.listOfPendingProduction)
|
|
|
- if(row.listOfPendingProduction==null||row.listOfPendingProduction==undefined|| row.listOfPendingProduction==""){
|
|
|
+ if (
|
|
|
+ row.listOfPendingProduction == null ||
|
|
|
+ row.listOfPendingProduction == undefined ||
|
|
|
+ row.listOfPendingProduction == ""
|
|
|
+ ) {
|
|
|
return;
|
|
|
}
|
|
|
- if (prevRow2 &&
|
|
|
+ if (
|
|
|
+ prevRow2 &&
|
|
|
prevRow2.machineId === row.machineId &&
|
|
|
prevRow2.productType === row.productType
|
|
|
) {
|
|
|
- return { rowspan: 0, colspan: 0 }
|
|
|
+ return { rowspan: 0, colspan: 0 };
|
|
|
} else {
|
|
|
// 反之,则循环判断若下一行数据等于当前行数据,则当前行开始进行合并单元格
|
|
|
- let countRowspan2 = 1 //用于合并计数多少单元格
|
|
|
- while (nextRow2 &&
|
|
|
- nextRow2.listOfPendingProduction === row.listOfPendingProduction&&
|
|
|
+ let countRowspan2 = 1; //用于合并计数多少单元格
|
|
|
+ while (
|
|
|
+ nextRow2 &&
|
|
|
+ nextRow2.listOfPendingProduction === row.listOfPendingProduction &&
|
|
|
nextRow2.machineId === row.machineId &&
|
|
|
nextRow2.productType === row.productType
|
|
|
- ) {
|
|
|
- nextRow2 = this.tableData[++countRowspan2 + rowIndex]
|
|
|
+ ) {
|
|
|
+ nextRow2 = this.tableData[++countRowspan2 + rowIndex];
|
|
|
}
|
|
|
if (countRowspan2 > 1) {
|
|
|
- return { rowspan: countRowspan2, colspan: 1 }
|
|
|
+ return { rowspan: countRowspan2, colspan: 1 };
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//合并最后一列操作列
|
|
|
- const lastColumnIndex = this.$refs.tableRef.store.states.columns.length - 1; // 获取表格最后一列的索引
|
|
|
- if (columnIndex === lastColumnIndex && column.label === '操作') { // 判断是否为最后一列且标签为'操作'
|
|
|
+ const lastColumnIndex =
|
|
|
+ this.$refs.tableRef.store.states.columns.length - 1; // 获取表格最后一列的索引
|
|
|
+ if (columnIndex === lastColumnIndex && column.label === "操作") {
|
|
|
+ // 判断是否为最后一列且标签为'操作'
|
|
|
const machineIdColumnIndex = 0; // 机台号列的索引假定为0
|
|
|
const currentMachineId = row.machineId;
|
|
|
|
|
@@ -215,10 +338,7 @@ export default {
|
|
|
} else {
|
|
|
let nextRow = this.tableData[rowIndex + 1];
|
|
|
|
|
|
- while (
|
|
|
- nextRow &&
|
|
|
- nextRow.machineId === currentMachineId
|
|
|
- ) {
|
|
|
+ while (nextRow && nextRow.machineId === currentMachineId) {
|
|
|
nextRow = this.tableData[++countRowspan + rowIndex];
|
|
|
}
|
|
|
|
|
@@ -230,25 +350,25 @@ export default {
|
|
|
//第一列机台号合并
|
|
|
if (columnIndex === 0) {
|
|
|
//定义需要合并的列字段,有哪些列需要合并,就自定义添加字段即可
|
|
|
- const fields = ['machineId']
|
|
|
+ const fields = ["machineId"];
|
|
|
// 当前行的数据
|
|
|
- const cellValue = row[column.property]
|
|
|
- let countRowspan = 1 //用于合并计数多少单元格
|
|
|
+ const cellValue = row[column.property];
|
|
|
+ let countRowspan = 1; //用于合并计数多少单元格
|
|
|
// 判断只合并定义字段的列数据
|
|
|
if (cellValue && fields.includes(column.property)) {
|
|
|
- const prevRow = this.tableData[rowIndex - 1] //上一行数据
|
|
|
- let nextRow = this.tableData[rowIndex + 1] //下一行数据
|
|
|
+ const prevRow = this.tableData[rowIndex - 1]; //上一行数据
|
|
|
+ let nextRow = this.tableData[rowIndex + 1]; //下一行数据
|
|
|
// 当上一行的数据等于当前行数据时,当前行单元格隐藏
|
|
|
if (prevRow && prevRow[column.property] === cellValue) {
|
|
|
- return { rowspan: 0, colspan: 0 }
|
|
|
+ return { rowspan: 0, colspan: 0 };
|
|
|
} else {
|
|
|
// 反之,则循环判断若下一行数据等于当前行数据,则当前行开始进行合并单元格
|
|
|
- let countRowspan = 1 //用于合并计数多少单元格
|
|
|
+ let countRowspan = 1; //用于合并计数多少单元格
|
|
|
while (nextRow && nextRow[column.property] === cellValue) {
|
|
|
- nextRow = this.tableData[++countRowspan + rowIndex]
|
|
|
+ nextRow = this.tableData[++countRowspan + rowIndex];
|
|
|
}
|
|
|
if (countRowspan > 1) {
|
|
|
- return { rowspan: countRowspan, colspan: 1 }
|
|
|
+ return { rowspan: countRowspan, colspan: 1 };
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -276,52 +396,62 @@ export default {
|
|
|
getProductsInfo() {
|
|
|
getProductsInfo().then((response) => {
|
|
|
this.productsInfo = response.data;
|
|
|
- this.productsInfo.forEach(item => {
|
|
|
- item.productName = item.productName+"—"+item.materieEncoding+item.materieColorNumber
|
|
|
+ this.productsInfo.forEach((item) => {
|
|
|
+ item.productName =
|
|
|
+ item.productName +
|
|
|
+ "—" +
|
|
|
+ item.materieEncoding +
|
|
|
+ item.materieColorNumber;
|
|
|
});
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
// 下拉框数据改变查询色号批号信息
|
|
|
- selectedChangeDate(row,selectedProduct) {
|
|
|
+ selectedChangeDate(row, selectedProduct) {
|
|
|
//选择的那个销售产品
|
|
|
- this.product = this.productsInfo.find(product => product.id === selectedProduct);
|
|
|
- this.form.product=selectedProduct;
|
|
|
+ this.product = this.productsInfo.find(
|
|
|
+ (product) => product.id === selectedProduct
|
|
|
+ );
|
|
|
+ this.form.product = selectedProduct;
|
|
|
//通过母粒编码查询到对应的母粒信息
|
|
|
let queryParams = {
|
|
|
- "materielCode": this.product.colourNumber
|
|
|
- }
|
|
|
+ materielCode: this.product.colourNumber,
|
|
|
+ };
|
|
|
//得到对应的母粒信息
|
|
|
getMaterielInfo(queryParams).then((response) => {
|
|
|
- if (response.data!=null) {
|
|
|
+ if (response.data != null) {
|
|
|
this.materiel = response.data;
|
|
|
//色号 母粒编码+色号
|
|
|
- row.currentColorCode = this.materiel.materieEncoding+"("+this.materiel.materieColorNumber+")";
|
|
|
+ row.currentColorCode =
|
|
|
+ this.materiel.materieEncoding +
|
|
|
+ "(" +
|
|
|
+ this.materiel.materieColorNumber +
|
|
|
+ ")";
|
|
|
}
|
|
|
});
|
|
|
//isDisabled(有批号就用,没批号就自己输入)
|
|
|
- if(this.product.lotNumber!=undefined&&this.product.lotNumber!=""){
|
|
|
- row.currentLotNumber=this.product.lotNumber;
|
|
|
- this.isDisabled=true;
|
|
|
- }else {
|
|
|
- this.isDisabled=false;
|
|
|
+ if (this.product.lotNumber != undefined && this.product.lotNumber != "") {
|
|
|
+ row.currentLotNumber = this.product.lotNumber;
|
|
|
+ this.isDisabled = true;
|
|
|
+ } else {
|
|
|
+ this.isDisabled = false;
|
|
|
}
|
|
|
//产品规格
|
|
|
- row.currentSpecification= this.product.productSpecifications;
|
|
|
+ row.currentSpecification = this.product.productSpecifications;
|
|
|
//销售单编号(以前打算存的是业务员信息后来存的是销售单编号)
|
|
|
- row.salesmanId=this.product.saleOrderNo;
|
|
|
+ row.salesmanId = this.product.saleOrderNo;
|
|
|
},
|
|
|
// 新增计划产品信息
|
|
|
handleAddPlan(row) {
|
|
|
- if(this.selectedWorkshop=="南车间"){
|
|
|
- this.nanInsertDialogTableVisible = true
|
|
|
- }else{
|
|
|
- this.beiInsertDialogTableVisible = true
|
|
|
+ if (this.selectedWorkshop == "南车间") {
|
|
|
+ this.nanInsertDialogTableVisible = true;
|
|
|
+ } else {
|
|
|
+ this.beiInsertDialogTableVisible = true;
|
|
|
}
|
|
|
- this.tableData2=[]
|
|
|
+ this.tableData2 = [];
|
|
|
//先清空
|
|
|
- this.machineId=""
|
|
|
+ this.machineId = "";
|
|
|
//当前操作机台号
|
|
|
- this.machineId=row.machineId;
|
|
|
+ this.machineId = row.machineId;
|
|
|
},
|
|
|
|
|
|
// tab栏点击切换
|
|
@@ -347,13 +477,15 @@ export default {
|
|
|
//找到当前行的编辑索引
|
|
|
var rowIndex = this.tableData2.indexOf(row);
|
|
|
|
|
|
- if (this.lastEditLine != 0 &&
|
|
|
+ if (
|
|
|
+ this.lastEditLine != 0 &&
|
|
|
this.editingRowIndex !== rowIndex &&
|
|
|
this.editingRowIndex !== -1 &&
|
|
|
- !this.isRowFilled(this.tableData2[this.lastEditLine])) {
|
|
|
+ !this.isRowFilled(this.tableData2[this.lastEditLine])
|
|
|
+ ) {
|
|
|
this.$message({
|
|
|
- message: '请先完成上一条数据的填写',
|
|
|
- type: 'warning'
|
|
|
+ message: "请先完成上一条数据的填写",
|
|
|
+ type: "warning",
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
@@ -368,7 +500,6 @@ export default {
|
|
|
row.isEditing = true;
|
|
|
this.editingRowIndex = rowIndex;
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
// 光标失去焦点变成不可编辑
|
|
|
handleInputBlur(row) {
|
|
@@ -386,155 +517,166 @@ export default {
|
|
|
},
|
|
|
// 检查行是否填写完毕的示例方法
|
|
|
isRowFilled(row) {
|
|
|
- return row.currentSpecification && row.currentSpindleCount && row.number && row.startTime && row.plannedEndTime;
|
|
|
+ return (
|
|
|
+ row.currentSpecification &&
|
|
|
+ row.currentSpindleCount &&
|
|
|
+ row.number &&
|
|
|
+ row.startTime &&
|
|
|
+ row.plannedEndTime
|
|
|
+ );
|
|
|
},
|
|
|
// 新增一行标记为可编辑
|
|
|
addEditableRow() {
|
|
|
// 检查当前编辑行是否已填写完毕
|
|
|
- if(this.tableData2.length!=0){
|
|
|
- if (this.editingRowIndex !== -1 && !this.isRowFilled(this.tableData2[this.editingRowIndex])) {
|
|
|
+ if (this.tableData2.length != 0) {
|
|
|
+ if (
|
|
|
+ this.editingRowIndex !== -1 &&
|
|
|
+ !this.isRowFilled(this.tableData2[this.editingRowIndex])
|
|
|
+ ) {
|
|
|
this.$message({
|
|
|
- message: '请先完成上一条数据的填写',
|
|
|
- type: 'warning'
|
|
|
+ message: "请先完成上一条数据的填写",
|
|
|
+ type: "warning",
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
//新增行之前先让以前的行不能编辑
|
|
|
- this.tableData2.forEach(item => {
|
|
|
+ this.tableData2.forEach((item) => {
|
|
|
item.isEditing = false;
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
this.tableData2.push({
|
|
|
- currentColorCode: '',
|
|
|
- currentSpecification: '',
|
|
|
- currentLotNumber: '',
|
|
|
- currentSpindleCount: '',
|
|
|
- number: '',
|
|
|
- startTime: '',
|
|
|
- plannedEndTime:'',
|
|
|
- planStatus:0,
|
|
|
- productId:'',
|
|
|
- salesmanId:'',
|
|
|
- isEditing: true // 标记为正在编辑状态
|
|
|
+ currentColorCode: "",
|
|
|
+ currentSpecification: "",
|
|
|
+ currentLotNumber: "",
|
|
|
+ currentSpindleCount: "",
|
|
|
+ number: "",
|
|
|
+ startTime: "",
|
|
|
+ plannedEndTime: "",
|
|
|
+ planStatus: 0,
|
|
|
+ productId: "",
|
|
|
+ salesmanId: "",
|
|
|
+ isEditing: true, // 标记为正在编辑状态
|
|
|
});
|
|
|
this.editingRowIndex = this.tableData2.length - 1; // 更新当前编辑的行索引
|
|
|
- this.lastEditLine = this.tableData2.length - 1
|
|
|
+ this.lastEditLine = this.tableData2.length - 1;
|
|
|
},
|
|
|
// 添加计划
|
|
|
- addPlanInfo(){
|
|
|
- const datatime=Date.now()+this.machineId;
|
|
|
+ addPlanInfo() {
|
|
|
+ const datatime = Date.now() + this.machineId;
|
|
|
//处理表格数据
|
|
|
- this.tableData2.forEach(item=>{
|
|
|
- item.timestampRandomCode=datatime;
|
|
|
- item.machineId=this.machineId;
|
|
|
- })
|
|
|
+ this.tableData2.forEach((item) => {
|
|
|
+ item.timestampRandomCode = datatime;
|
|
|
+ item.machineId = this.machineId;
|
|
|
+ });
|
|
|
//时间戳
|
|
|
- let data={
|
|
|
+ let data = {
|
|
|
//机台号
|
|
|
machineId: this.machineId,
|
|
|
- timestampRandomCode:datatime,
|
|
|
+ timestampRandomCode: datatime,
|
|
|
//计划信息
|
|
|
- detailsOfTheRefuelingPlans: this.tableData2
|
|
|
- }
|
|
|
+ detailsOfTheRefuelingPlans: this.tableData2,
|
|
|
+ };
|
|
|
//添加计划信息
|
|
|
- addMaterielInfo(data).then(response => {
|
|
|
+ addMaterielInfo(data).then((response) => {
|
|
|
if (response.code == 200) {
|
|
|
this.$message({
|
|
|
- message: '添加成功',
|
|
|
- type: 'success'
|
|
|
+ message: "添加成功",
|
|
|
+ type: "success",
|
|
|
});
|
|
|
this.getAmmunitionPlanInfo();
|
|
|
//最后把弹窗关掉
|
|
|
- this.nanInsertDialogTableVisible=false
|
|
|
+ this.nanInsertDialogTableVisible = false;
|
|
|
//更改订单投产信息的批号,
|
|
|
} else {
|
|
|
this.$message({
|
|
|
- message: '添加失败',
|
|
|
- type: 'error'
|
|
|
+ message: "添加失败",
|
|
|
+ type: "error",
|
|
|
});
|
|
|
//最后把弹窗关掉
|
|
|
- this.nanInsertDialogTableVisible=false
|
|
|
+ this.nanInsertDialogTableVisible = false;
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
},
|
|
|
// 修改产品计划
|
|
|
handleEditPlan(row) {
|
|
|
- this.tableData2=[];
|
|
|
+ this.tableData2 = [];
|
|
|
//弹窗
|
|
|
- if(this.selectedWorkshop=="南车间"){
|
|
|
- this.nanUpdateDialogTableVisible = true
|
|
|
- }else{
|
|
|
- this.beiUpdateDialogTableVisible = true
|
|
|
+ if (this.selectedWorkshop == "南车间") {
|
|
|
+ this.nanUpdateDialogTableVisible = true;
|
|
|
+ } else {
|
|
|
+ this.beiUpdateDialogTableVisible = true;
|
|
|
}
|
|
|
- this.tableData2=[];
|
|
|
+ this.tableData2 = [];
|
|
|
getAllPlanListByMachineId(row.machineId).then((response) => {
|
|
|
//得到生产中,停产的,待产的
|
|
|
- response.data.forEach(item => {
|
|
|
- item.isEditing=false;
|
|
|
- item.planStatus=parseInt(item.planStatus);
|
|
|
- item.productId=parseInt(item.productId)
|
|
|
- })
|
|
|
- this.tableData2=response.data;
|
|
|
- console.log( this.tableData2)
|
|
|
+ response.data.forEach((item) => {
|
|
|
+ item.isEditing = false;
|
|
|
+ item.planStatus = parseInt(item.planStatus);
|
|
|
+ item.productId = parseInt(item.productId);
|
|
|
+ });
|
|
|
+ this.tableData2 = response.data;
|
|
|
+ console.log(this.tableData2);
|
|
|
// 在数据加载完成后,手动触发每个行的第一个下拉框的 change 事件
|
|
|
this.$nextTick(() => {
|
|
|
// 获取第一个业务员选择框(假设表格只有一行)
|
|
|
for (let i = 0; i < this.tableData2.length; i++) {
|
|
|
- const firstSalesmanSelect = this.$refs['salesmanSelect'+i];
|
|
|
+ const firstSalesmanSelect = this.$refs["salesmanSelect" + i];
|
|
|
// console.log(firstSalesmanSelect,11111111)
|
|
|
// 触发 change 事件
|
|
|
if (firstSalesmanSelect) {
|
|
|
- firstSalesmanSelect.$emit('change', {
|
|
|
- target: {value: "ddd"},
|
|
|
+ firstSalesmanSelect.$emit("change", {
|
|
|
+ target: { value: "ddd" },
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
});
|
|
|
- })
|
|
|
-
|
|
|
-
|
|
|
+ });
|
|
|
},
|
|
|
//弹窗里边的点击查询
|
|
|
- onSubmit(){
|
|
|
- this.formData.machineId=this.machineId;
|
|
|
- getAllPlanListByProductTypeAndStatus(this.formData).then(response => {
|
|
|
+ onSubmit() {
|
|
|
+ this.formData.machineId = this.machineId;
|
|
|
+ getAllPlanListByProductTypeAndStatus(this.formData).then((response) => {
|
|
|
//得到生产中,停产的,待产的
|
|
|
- response.data.forEach(item => {
|
|
|
- item.isEditing=false;
|
|
|
- item.planStatus=parseInt(item.planStatus);
|
|
|
- })
|
|
|
- this.tableData2=response.data;
|
|
|
+ response.data.forEach((item) => {
|
|
|
+ item.isEditing = false;
|
|
|
+ item.planStatus = parseInt(item.planStatus);
|
|
|
+ });
|
|
|
+ this.tableData2 = response.data;
|
|
|
});
|
|
|
},
|
|
|
//更新状态
|
|
|
- updateStatus(ind, row){
|
|
|
+ updateStatus(ind, row) {
|
|
|
console.log(row);
|
|
|
- updatePlanOne(row).then(response=>{
|
|
|
+ updatePlanOne(row).then((response) => {
|
|
|
if (response.code == 200) {
|
|
|
this.$message({
|
|
|
- message: '修改成功',
|
|
|
- type: 'success'
|
|
|
+ message: "修改成功",
|
|
|
+ type: "success",
|
|
|
});
|
|
|
this.getAmmunitionPlanInfo();
|
|
|
//最后把弹窗关掉
|
|
|
- this.nanInsertDialogTableVisible=false
|
|
|
+ this.nanInsertDialogTableVisible = false;
|
|
|
} else {
|
|
|
this.$message({
|
|
|
- message: '修改失败',
|
|
|
- type: 'error'
|
|
|
+ message: "修改失败",
|
|
|
+ type: "error",
|
|
|
});
|
|
|
//最后把弹窗关掉
|
|
|
- this.nanInsertDialogTableVisible=false
|
|
|
+ this.nanInsertDialogTableVisible = false;
|
|
|
}
|
|
|
- })
|
|
|
- }
|
|
|
+ });
|
|
|
+ },
|
|
|
},
|
|
|
- computed: {
|
|
|
-
|
|
|
+ beforeDestroy() {
|
|
|
+ if (this.timerId) {
|
|
|
+ clearInterval(this.timerId);
|
|
|
+ }
|
|
|
+ if (this.scrollTimer) {
|
|
|
+ clearInterval(this.scrollTimer);
|
|
|
+ }
|
|
|
},
|
|
|
-}
|
|
|
+ computed: {},
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|