<template>
|
<div class="app-container home">
|
<el-row>
|
<el-col :span="24">
|
<div class="grid-content bg-purple-dark"
|
style="font-size: 50px; font-weight: bolder; align-content: center">
|
<div style="width:100%; margin-left: 300px">
|
<span style="text-align: center">德玛智控-箱体刻码</span>
|
</div>
|
</div>
|
</el-col>
|
</el-row>
|
<el-row :gutter="20" style="margin-top: 50px">
|
<el-input
|
class="myinput"
|
placeholder="请输入序列号"
|
v-model="sfcCode"
|
clearable
|
style="width: 60%; height: 50px; font-size: 34px">
|
</el-input>
|
<el-button type="primary" style=" margin-left: 20px; width: 12%; height: 50px; font-size: 28px; " @click="carveMethod()">确认</el-button>
|
<el-button type="success" style=" margin-left: 20px; width: 12%; height: 50px; font-size: 28px;" @click="flushMethod()">刷新</el-button>
|
</el-row>
|
<el-divider />
|
<el-row :gutter="20">
|
</el-row>
|
|
<div>
|
<el-table
|
:data="tableData"
|
border
|
style="width: 750px; font-size: x-large; font-weight: bolder">
|
<el-table-column
|
class="fontHead"
|
fixed
|
prop="sfcCode"
|
label="等待打标信息"
|
width="550"
|
>
|
</el-table-column>
|
|
<el-table-column
|
fixed="right"
|
label="操作"
|
width="200"
|
>
|
<template slot-scope="scope">
|
<el-button @click="deleteRow(scope.row)" type="text" size="small">删除</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
</div>
|
|
</template>
|
|
<script>
|
import {crave, reCrave, printList, delStationCollection} from "../api/main/da/stationCollection";
|
|
export default {
|
name: "Index",
|
data() {
|
return {
|
// 版本号
|
version: "3.8.8",
|
sfcCode: '',
|
tableData: [],
|
};
|
},
|
methods: {
|
|
//关于此页面还需要验证,
|
//如果打标软件能够执行两条sql语句,第二条sql语句为达标完成的标识修改,此时页面可显示多条待打标数据,此时可以有删除按钮
|
//如果不支持多条sql语句,不需要删除操作,逻辑为输入一条打一条
|
deleteRow(row){
|
delStationCollection(row.id).then(res => {
|
console.log("res",res)
|
this.flushMethod()
|
})
|
},
|
open() {
|
this.$confirm('此序列号已刻码,是否需要重新刻码?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
console.log('111111')
|
reCrave({sfcCode:this.sfcCode}).then(res => {
|
console.log('res',res)
|
this.flushMethod()
|
})
|
this.$message({
|
type: 'success',
|
message: '确认重新刻码!'
|
});
|
}).catch(() => {
|
console.log('222222')
|
this.$message({
|
type: 'info',
|
message: '已取消'
|
});
|
});
|
},
|
carveMethod(){
|
crave({sfcCode:this.sfcCode}).then(res => {
|
console.log('res',res)
|
if (res.code === 200) {
|
if (res.data === 200){
|
this.$message({
|
message: '刻码信息发送成功',
|
type: 'success'
|
});
|
this.flushMethod()
|
} else if (res.data === 303){
|
this.open()
|
}
|
}
|
})
|
},
|
flushMethod(){
|
printList().then(res => {
|
console.log(res)
|
if (res.code === 200){
|
this.tableData = res.data
|
} else {
|
this.$message({
|
message: '查询失败,请联系管理员',
|
type: 'info'
|
});
|
}
|
|
})
|
},
|
|
|
},
|
mounted(){
|
this.interval = setInterval(() => {
|
this.flushMethod()
|
}, 3000);
|
},
|
beforeDestroy() {
|
clearInterval(this.interval); // 清除定时器,防止内存泄漏
|
}
|
};
|
</script>
|
|
<style scoped lang="scss">
|
::v-deep .el-input__inner{
|
height: 50px;
|
}
|
//::v-deep .el-table--border .el-table__cell:first-child .cell{
|
// font-size: x-large;
|
//}
|
.home {
|
blockquote {
|
padding: 10px 20px;
|
margin: 0 0 20px;
|
font-size: 17.5px;
|
border-left: 5px solid #eee;
|
}
|
hr {
|
margin-top: 20px;
|
margin-bottom: 20px;
|
border: 0;
|
border-top: 1px solid #eee;
|
}
|
.col-item {
|
margin-bottom: 20px;
|
}
|
|
ul {
|
padding: 0;
|
margin: 0;
|
}
|
|
font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
font-size: 13px;
|
color: #676a6c;
|
overflow-x: hidden;
|
|
ul {
|
list-style-type: none;
|
}
|
|
h4 {
|
margin-top: 0px;
|
}
|
|
h2 {
|
margin-top: 10px;
|
font-size: 26px;
|
font-weight: 100;
|
}
|
|
p {
|
margin-top: 10px;
|
|
b {
|
font-weight: 700;
|
}
|
}
|
|
.update-log {
|
ol {
|
display: block;
|
list-style-type: decimal;
|
margin-block-start: 1em;
|
margin-block-end: 1em;
|
margin-inline-start: 0;
|
margin-inline-end: 0;
|
padding-inline-start: 40px;
|
}
|
}
|
}
|
</style>
|