|
@@ -402,48 +402,48 @@ export default {
|
|
|
},
|
|
|
// 点击编辑行
|
|
|
handleRowClick(row) {
|
|
|
- this.isEditLine = true;
|
|
|
- //找到当前行的编辑索引
|
|
|
- var rowIndex = this.tableData2.indexOf(row);
|
|
|
- console.log(rowIndex)
|
|
|
- if (this.lastEditLine != 0 &&
|
|
|
- this.editingRowIndex !== rowIndex &&
|
|
|
- this.editingRowIndex !== -1 &&
|
|
|
- !this.isRowFilled(this.tableData2[this.lastEditLine])) {
|
|
|
- this.$message({
|
|
|
- message: '请先完成上一条数据的填写',
|
|
|
- type: 'warning'
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- //编辑索引不等于当前编辑行索引
|
|
|
- if (this.editingRowIndex !== rowIndex) {
|
|
|
- // alert(this.editingRowIndex);
|
|
|
- if (this.editingRowIndex !== -1) {
|
|
|
- //把当前行变成不可编辑的
|
|
|
- this.tableData2[this.editingRowIndex].isEditing = false;
|
|
|
- }
|
|
|
- //把当前行变成可编辑的
|
|
|
- row.isEditing = true;
|
|
|
- this.editingRowIndex = rowIndex;
|
|
|
- }else {
|
|
|
- //把当前行变成可编辑的
|
|
|
- row.isEditing = true;
|
|
|
- this.editingRowIndex = rowIndex;
|
|
|
- }
|
|
|
+ // this.isEditLine = true;
|
|
|
+ // //找到当前行的编辑索引
|
|
|
+ // var rowIndex = this.tableData2.indexOf(row);
|
|
|
+ // console.log(rowIndex)
|
|
|
+ // if (this.lastEditLine != 0 &&
|
|
|
+ // this.editingRowIndex !== rowIndex &&
|
|
|
+ // this.editingRowIndex !== -1 &&
|
|
|
+ // !this.isRowFilled(this.tableData2[this.lastEditLine])) {
|
|
|
+ // this.$message({
|
|
|
+ // message: '请先完成上一条数据的填写',
|
|
|
+ // type: 'warning'
|
|
|
+ // });
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // //编辑索引不等于当前编辑行索引
|
|
|
+ // if (this.editingRowIndex !== rowIndex) {
|
|
|
+ // // alert(this.editingRowIndex);
|
|
|
+ // if (this.editingRowIndex !== -1) {
|
|
|
+ // //把当前行变成不可编辑的
|
|
|
+ // this.tableData2[this.editingRowIndex].isEditing = false;
|
|
|
+ // }
|
|
|
+ // //把当前行变成可编辑的
|
|
|
+ // row.isEditing = true;
|
|
|
+ // this.editingRowIndex = rowIndex;
|
|
|
+ // }else {
|
|
|
+ // //把当前行变成可编辑的
|
|
|
+ // row.isEditing = true;
|
|
|
+ // this.editingRowIndex = rowIndex;
|
|
|
+ // }
|
|
|
|
|
|
},
|
|
|
// 光标失去焦点变成不可编辑
|
|
|
handleInputBlur(row) {
|
|
|
- let rowIndex = this.tableData2.indexOf(row);
|
|
|
- //编辑索引不等于当前编辑行索引
|
|
|
- if(row.isEditing="true"){
|
|
|
- row.isEditing = false;
|
|
|
- //对于整个表格来说
|
|
|
- this.isEditLine = false;
|
|
|
- //当前编辑行置为-1
|
|
|
- this.editingRowIndex = -1;
|
|
|
- }
|
|
|
+ // let rowIndex = this.tableData2.indexOf(row);
|
|
|
+ // //编辑索引不等于当前编辑行索引
|
|
|
+ // if(row.isEditing="true"){
|
|
|
+ // row.isEditing = false;
|
|
|
+ // //对于整个表格来说
|
|
|
+ // this.isEditLine = false;
|
|
|
+ // //当前编辑行置为-1
|
|
|
+ // this.editingRowIndex = -1;
|
|
|
+ // }
|
|
|
// if (this.editingRowIndex !== rowIndex) {
|
|
|
// if (this.isRowFilled(row)) {
|
|
|
// row.isEditing = false;
|
|
@@ -476,10 +476,10 @@ export default {
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
- //新增行之前先让以前的行不能编辑
|
|
|
- this.tableData2.forEach(item => {
|
|
|
- item.isEditing = false;
|
|
|
- })
|
|
|
+ // //新增行之前先让以前的行不能编辑
|
|
|
+ // this.tableData2.forEach(item => {
|
|
|
+ // item.isEditing = false;
|
|
|
+ // })
|
|
|
}
|
|
|
this.tableData2.push({
|
|
|
currentColorCode: '',
|
|
@@ -514,21 +514,28 @@ export default {
|
|
|
return ;
|
|
|
}
|
|
|
const datatime=Date.now()+this.machineId;
|
|
|
+ let i=0
|
|
|
+ //处理表格数据
|
|
|
+ this.tableData2.forEach(item=>{
|
|
|
+ item.timestampRandomCode=datatime;
|
|
|
+ item.macId=this.macId;
|
|
|
+ item.machineId=this.machineId;
|
|
|
+ if(item.planStatus==1){
|
|
|
+ i++
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if(i>=2){
|
|
|
+ this.$message({
|
|
|
+ message: '不能同时添加俩上机计划',
|
|
|
+ type: 'warning'
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
//先查询计划表中有没有正在上机的
|
|
|
getPlanSpinningInfo({"machineId":this.machineId,"macId":this.macId,"planStatus":1}).then(response => {
|
|
|
- let i=0
|
|
|
- //处理表格数据
|
|
|
- this.tableData2.forEach(item=>{
|
|
|
- item.timestampRandomCode=datatime;
|
|
|
- item.macId=this.macId;
|
|
|
- item.machineId=this.machineId;
|
|
|
- if(item.planStatus==1){
|
|
|
- i++
|
|
|
- }
|
|
|
- })
|
|
|
if(i>=1&&response.data.length>0){
|
|
|
this.$message({
|
|
|
- message: '只能有一个产品的状态为上机',
|
|
|
+ message: '当前产线已有上机产品',
|
|
|
type: 'warning'
|
|
|
});
|
|
|
return;
|
|
@@ -607,20 +614,60 @@ export default {
|
|
|
// 更新状态
|
|
|
updateStatus(ind, row){
|
|
|
row.planType="纺丝计划"
|
|
|
- console.log(row,"当前行数据---------------------------")
|
|
|
if(!this.isRowFilled(row)){
|
|
|
this.$message({message: '请完善当前行数据', type: 'warning'});
|
|
|
return;
|
|
|
}
|
|
|
- // if(row.planType="")
|
|
|
+ if(row.planStatus=="2"){
|
|
|
+ //如果说我要去停机一个产品我只需要去鉴别你这个产线上有没有停机或者上其他上机的产品
|
|
|
+ getCurrentProductionLineSuperior({"id":row.id,"macId":row.macId,"planStatus":row.planStatus}).then(response => {
|
|
|
+ if(response.data.length>0) {
|
|
|
+ this.$message({message: '已有停机产品不能在停机', type: 'warning'});
|
|
|
+ return;//证明有在上级的产品--zhi能有一个上级产品
|
|
|
+ }else {
|
|
|
+ getCurrentProductionLineSuperior({"id":row.id,"macId":row.macId,"planStatus":"1"}).then(response => {
|
|
|
+ if(response.data.length>0){
|
|
|
+ this.$message({message: '已有一个其他产品正在上机,不能在停机,如需要停机,请停机在机产品', type: 'warning'});
|
|
|
+ return;//证明有在上级的产品--zhi能有一个上级产品
|
|
|
+ }else {
|
|
|
+ updateSpinningInfoPlanOne(row).then(response=>{
|
|
|
+ if (response.code == 200) {
|
|
|
+ this.$message({
|
|
|
+ message: '修改成功',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ this.getSpinningPlanList();
|
|
|
+ //最后把弹窗关掉
|
|
|
+ this.nanInsertDialogTableVisible=false
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: '修改失败',
|
|
|
+ type: 'error'
|
|
|
+ });
|
|
|
+ //最后把弹窗关掉
|
|
|
+ this.nanInsertDialogTableVisible=false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
//判断当前计划是否已经投产
|
|
|
getIsTheOrderProductProduced({"id":row.id}).then(resp=>{
|
|
|
if(resp.data.length>0){
|
|
|
this.$message({message: '当前计划订单产品在生产中已经不能修改', type: 'warning'});
|
|
|
+
|
|
|
return;//证明有在上级的产品--zhi能有一个上级产品
|
|
|
}
|
|
|
//不等于0待机才去校验是否重复
|
|
|
- if(row.planStatus!=0){
|
|
|
+ if(row.planStatus!=0){//上机/停机校验是否重复
|
|
|
+ if(resp.data.length>0){
|
|
|
+ this.$message({message: '当前计划订单产品在生产中已经不能修改', type: 'warning'});
|
|
|
+ return;//证明有在上级的产品--zhi能有一个上级产品
|
|
|
+ }
|
|
|
//先查询计划表中有没有正在上机的或者停机的
|
|
|
getCurrentProductionLineSuperior({"id":row.id,"macId":row.macId,"planStatus":row.planStatus}).then(response => {
|
|
|
if(response.data.length>0){
|
|
@@ -628,7 +675,7 @@ export default {
|
|
|
this.$message({message: '只能有一个产品的状态为上机', type: 'warning'});
|
|
|
return;//证明有在上级的产品--zhi能有一个上级产品
|
|
|
}else {
|
|
|
- this.$message({message: '已停机不能在停机', type: 'warning'});
|
|
|
+ this.$message({message: '已有停机产品不能在停机', type: 'warning'});
|
|
|
return;//证明有在上级的产品--zhi能有一个上级产品
|
|
|
}
|
|
|
}else {
|
|
@@ -638,7 +685,6 @@ export default {
|
|
|
this.$message({message: '已停机,请先处理停机产品,然后上机', type: 'warning'});
|
|
|
return;//证明有在上级的产品--zhi能有一个上级产品
|
|
|
}else {
|
|
|
- row.playType="纺丝计划"
|
|
|
updateSpinningInfoPlanOne(row).then(response=>{
|
|
|
if (response.code == 200) {
|
|
|
this.$message({
|
|
@@ -710,8 +756,8 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
})
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|