add
吴健
9 天以前 f48c38125956578611832f6017b0cb2ffdbe3725
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<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>