From cdc594d12e46b7dd2e37c7a2071c133f8404f9be Mon Sep 17 00:00:00 2001 From: ZengTao <2773468879@qq.com> Date: 星期二, 12 九月 2023 18:25:55 +0800 Subject: [PATCH] 测试代码,部分代码进行优化 --- CanadaMes-ui/src/views/home/index.vue | 62 ++++++++++++++----------------- 1 files changed, 28 insertions(+), 34 deletions(-) diff --git a/CanadaMes-ui/src/views/home/index.vue b/CanadaMes-ui/src/views/home/index.vue index 4fcd763..f76e51d 100644 --- a/CanadaMes-ui/src/views/home/index.vue +++ b/CanadaMes-ui/src/views/home/index.vue @@ -164,8 +164,11 @@ <el-table-column prop="lengthWidth" label="Length and width"></el-table-column> <el-table-column prop="coating" label="coating"></el-table-column> <el-table-column label="Operate"> - <el-button type="primary" style="padding: 4px 10px;font-size: 12px;" @click="endtask(0)">end - task</el-button> + <template slot-scope='scope'> + <el-button type="primary" style="padding: 4px 10px;font-size: 12px;" + @click="endtask(0, scope.row.glassId, scope.row.cell)">end + task</el-button> + </template> </el-table-column> </el-table> <el-table :data="this.tasklist2" border style="width: 100%"> @@ -175,8 +178,11 @@ <el-table-column prop="lengthWidth" label="Length and width"></el-table-column> <el-table-column prop="coating" label="coating"></el-table-column> <el-table-column label="Operate"> - <el-button type="primary" style="padding: 4px 10px;font-size: 12px;" @click="endtask(1)">end - task</el-button> + <template slot-scope='scope'> + <el-button type="primary" style="padding: 4px 10px;font-size: 12px;" + @click="endtask(1, scope.row.glassId, scope.row.cell)">end + task</el-button> + </template> </el-table-column> </el-table> </div> @@ -262,7 +268,7 @@ <el-table-column prop="endTime" label="endTime"></el-table-column> </el-table> </el-dialog> - <el-dialog :visible.sync="dialogFormVisible3" title="Ordering Information"> + <el-dialog :visible.sync="dialogFormVisible3" title="Cage Details"> <el-table :data="this.cageinfo" border style="width: 100%;height: 700px;overflow: auto;"> <el-table-column :width="150" prop="cage" label="the grille number"></el-table-column> <el-table-column prop="cell" label="cell"></el-table-column> @@ -276,7 +282,7 @@ <el-button type="primary" style="padding: 4px 10px;font-size: 12px;" @click="deleteglass(scope.row.glassId, scope.row.state)">delete</el-button> <el-button type="primary" style="padding: 4px 10px;font-size: 12px;" - @click="outglass(scope.row.glassId,scope.row.state)">out</el-button> + @click="outglass(scope.row.glassId, scope.row.state)">out</el-button> </template> </el-table-column> </el-table> @@ -324,8 +330,6 @@ url: "../../img/bigcar01.png", car1: 150, car2: 242, - incell: "", - outcell: "", cageinfo: [], cage: 0 }; @@ -362,7 +366,6 @@ this.car1 = 150 + 24.6 * obj.params[0][0]; this.car2 = 242 + 24.6 * obj.params[0][1]; } - this.tableData = obj.tableData[0]; this.cagelist1 = obj.cagelist1[0]; this.cagelist2 = obj.cagelist2[0]; @@ -370,12 +373,6 @@ this.cagelist4 = obj.cagelist4[0]; this.tasklist1 = obj.tasklist1[0]; this.tasklist2 = obj.tasklist2[0]; - if (this.tasklist1.length > 0) { - this.incell = this.tasklist1[0]['cell']; - } - if (this.tasklist1.length > 0) { - this.outcell = this.tasklist2[0]['cell']; - } this.alarm = obj.alarmmg[0]; SelectCageInfo(this.cage).then(res => { @@ -461,8 +458,14 @@ if (res.data.message2 == 200) { this.$message.success("Operation successful"); this.cancal(); - } else { + } else if(res.data.message2 == 500) { this.$message.success("There are currently tasks"); + } + else if(res.data.message2 == 300) { + this.$message.success("There is no such grid"); + } + else if(res.data.message2 == 400) { + this.$message.success("There is no such grid"); } }); } @@ -499,21 +502,12 @@ this.dialogFormVisible1 = false; this.form1 = {}; }, - endtask(type) { - if (type == 0) { - UpdateTask(type, this.incell).then(res => { - if (res.data.message3 == 200) { - this.$message.success("Operation successful"); - } - }); - } else { - UpdateTask(type, this.outcell).then(res => { - if (res.data.message3 == 200) { - this.$message.success("Operation successful"); - } - }); - } - + endtask(type, glassid, cell) { + UpdateTask(type, glassid, cell).then(res => { + if (res.data.message3 == 200) { + this.$message.success("Operation successful"); + } + }); }, showcageinfo(cage) { this.cage = cage; @@ -524,7 +518,7 @@ }, deleteglass(glassid, state) { if (state == 1) { - DeleteByGlassID(glassid).then(res=>{ + DeleteByGlassID(glassid).then(res => { if (res.data.message3 == 200) { this.$message.success("Operation successful"); } @@ -533,9 +527,9 @@ this.$message.success("No out allowed"); } }, - outglass(glassid,state){ + outglass(glassid, state) { if (state == 1) { - OutByGlassID(glassid).then(res=>{ + OutByGlassID(glassid).then(res => { if (res.data.message3 == 200) { this.$message.success("Operation successful"); } -- Gitblit v1.8.0