懒羊羊
2024-01-09 5a6d6b9f3bb00b93e70d316c0fafcb34ddd0c510
提交 | 用户 | 时间
b0742c 1 <template>
C 2   <div class="app-container">
589dc7 3    <el-row :gutter="5">
4      <el-col :span="6">
49ac5c 5        <el-card shadow="never">
6          <span class="head-font">工位编号 : {{headContent.processesCode}}</span>
589dc7 7        </el-card>
8      </el-col>
9      <el-col :span="6">
49ac5c 10        <el-card shadow="never">
11          <span class="head-font">工位名称 : {{headContent.processesName}}</span>
589dc7 12        </el-card>
13      </el-col>
8586e1 14      <el-col :span="12">
49ac5c 15        <el-card shadow="never">
16          <span class="head-font">总成编码 : {{headContent.sfcCode}}</span>
5a6d6b 17          <el-input v-model="content" style="float: right;width: 150px;" placeholder="请输入内容"></el-input>
49ac5c 18          <el-button @click="scanCompleted" style="float: right" type="primary">扫码完成</el-button>
19          <el-button @click="clearClick" style="float: right" type="danger">清除</el-button>
589dc7 20        </el-card>
21      </el-col>
8586e1 22
589dc7 23    </el-row>
24    <el-row :gutter="5" style="margin-top: 5px">
25      <el-col :span="6" >
26        <el-card class="bottom-card">
27          <div slot="header" class="clearfix">
49ac5c 28            <i class="el-icon-tickets"></i>
29            <span style="font-weight: bold">当前工件信息</span>
589dc7 30          </div>
49ac5c 31          <el-descriptions :column="1" :label-style="{'font-size': '15px'}" border :content-style="{'min-width': '150px'}">
32            <el-descriptions-item label="工单编号">
33                <span>{{workpieceInformation.workOrderCode}}</span>
589dc7 34            </el-descriptions-item>
49ac5c 35            <el-descriptions-item label="产品编号">
36              <span>{{workpieceInformation.productCode}}</span>
589dc7 37            </el-descriptions-item>
49ac5c 38            <el-descriptions-item label="产品型号">
39              <span>{{workpieceInformation.productModel}}</span>
589dc7 40            </el-descriptions-item>
49ac5c 41            <el-descriptions-item label="产品名称">
42              <span>{{workpieceInformation.productName}}</span>
589dc7 43            </el-descriptions-item>
49ac5c 44            <el-descriptions-item label="节拍">
45              <span>{{workpieceInformation.beat}}</span>
589dc7 46            </el-descriptions-item>
47          </el-descriptions>
48          <el-divider></el-divider>
49          <el-row>
50            <el-col :span="12">
49ac5c 51              <el-button class="circle-button" :class="cakeLamp.plcState ? 'circle-green-animate':'circle-red'" circle></el-button>
52              <span style="display: none">{{cakeLamp.plcState}}</span>
8586e1 53              <span>&nbsp;PLC状态</span>
589dc7 54            </el-col>
55            <el-col :span="12">
49ac5c 56              <el-button class="circle-button" :class="cakeLamp.scannerState ? 'circle-green-animate':'circle-red'" circle></el-button>
57              <span style="display: none">{{cakeLamp.scannerState}}</span>
8586e1 58              <span>&nbsp;扫码枪状态</span>
589dc7 59            </el-col>
60          </el-row>
61          <el-row style="margin-top: 20px">
62            <el-col :span="12">
49ac5c 63              <el-button class="circle-button" :class="cakeLamp.InPlace ? 'circle-green':'circle-red'" circle></el-button>
64              <span style="display: none">{{cakeLamp.InPlace}}</span>
8586e1 65              <span>&nbsp;工件到位</span>
589dc7 66            </el-col>
67            <el-col :span="12">
49ac5c 68              <el-button class="circle-button" :class="cakeLamp.scanFinish ? 'circle-green':'circle-red'" circle></el-button>
69              <span style="display: none">{{cakeLamp.scanFinish}}</span>
8586e1 70              <span>&nbsp;扫码完成</span>
589dc7 71            </el-col>
72          </el-row>
73          <el-row style="margin-top: 20px">
74            <el-col :span="12">
49ac5c 75              <el-button class="circle-button" :class="cakeLamp.startWork ? 'circle-green':'circle-red'" circle></el-button>
76              <span style="display: none">{{cakeLamp.startWork}}</span>
8586e1 77              <span>&nbsp;开始作业</span>
589dc7 78            </el-col>
79            <el-col :span="12">
49ac5c 80              <el-button class="circle-button" :class="cakeLamp.release ? 'circle-green':'circle-red'" circle></el-button>
81              <span style="display: none">{{cakeLamp.release}}</span>
8586e1 82              <span>&nbsp;允许放行</span>
589dc7 83            </el-col>
84          </el-row>
85        </el-card>
b0742c 86
589dc7 87      </el-col>
88      <el-col :span="18">
5a6d6b 89        <el-tabs type="border-card"  style="height: 600px" v-model="activeName" @tab-click="changeMenu">
90          <el-tab-pane name="first">
589dc7 91            <span slot="label"> <a class="el-icon-date"></a>首页</span>
92            <el-col :span="8">
93              <el-table>
8586e1 94                <el-table-column label="序号" align="center" prop="repairIdentification" width="50px"/>
A 95                <el-table-column label="操作内容" align="center" prop="boxCode"  width="300px"/>
589dc7 96              </el-table>
97            </el-col>
98            <el-col :span="16">
99              <el-image style="height: 520px;width: 100%" :src="imgSrc"></el-image>
100            </el-col>
101          </el-tab-pane>
5a6d6b 102          <el-tab-pane name="second">
589dc7 103            <span slot="label"> <b class="el-icon-date"></b>物料BOM</span>
5a6d6b 104            <el-empty>
589dc7 105              <span slot="description">暂无数据</span>
106            </el-empty>
107          </el-tab-pane>
5a6d6b 108          <el-tab-pane name="third">
109            <span slot="label"> <b class="el-icon-date"></b>采集清单</span>
110            <el-empty>
589dc7 111              <span slot="description">暂无数据</span>
112            </el-empty>
113          </el-tab-pane>
5a6d6b 114          <el-tab-pane name="fourth">
115            <span slot="label"> <b class="el-icon-date"></b>安灯状态</span>
116            <el-empty>
589dc7 117              <span slot="description">暂无数据</span>
118            </el-empty>
119          </el-tab-pane>
5a6d6b 120          <el-tab-pane name="fifth">
121            <span slot="label"> <b class="el-icon-date"></b>工艺配方</span>
122            <el-empty>
589dc7 123              <span slot="description">暂无数据</span>
124            </el-empty>
125          </el-tab-pane>
126        </el-tabs>
127      </el-col>
128    </el-row>
b0742c 129   </div>
C 130 </template>
131 <script>
49ac5c 132 import {listWorkReport} from "@/api/main/om/workReport/workReport";
133 import {listStationConf,getIpv4} from "@/api/main/sc/stationConf";
134
b0742c 135 export default {
49ac5c 136   name: "stationTerminal",
b0742c 137   data() {
C 138     return {
49ac5c 139       ipAddress: '',
589dc7 140       imgSrc: '',
49ac5c 141       headContent: {
142         processesCode: 'OP1010',
143         processesName: '贴标机-贴码',
144         sfcCode: '1000000000000001',
145       },
146       workpieceInformation: {
147         workOrderCode: null,
148         productCode: null,
149         productModel: null,
150         productName: null,
151         beat: null,
152       },
153       // 查询参数
154       queryParams: {
155         pageNum: 1,
156         pageSize: 10,
157         sfcCode: null,
158       },
159       cakeLamp: {
160         plcState: 1, //plc
161         scannerState: 1, //扫码枪
162         InPlace: 0, //工件到位
163         scanFinish: 0,
164         startWork: 0,
165         release: 0 //允许放行
5a6d6b 166       },
167       content: '',
168       activeName: 'first'
b0742c 169     }
C 170   },
49ac5c 171   created() {
172     this.getStationConfList();
173   },
174   methods: {
5a6d6b 175     changeMenu(tab, event) {
176       console.log(tab, event);
177     },
49ac5c 178     clearClick(){
179       this.$message('这是一条清除消息提示');
180       this.headContent.sfcCode = null
181     },
182     scanCompleted(){
5a6d6b 183       this.$message('扫码完成'+this.content);
184       this.headContent.sfcCode = this.content
185       this.queryParams.sfcCode = this.content
49ac5c 186       this.getList()
187       this.cakeLamp.scanFinish = 1
188     },
189     /** 查询报工记录 表列表 */
190     getList() {
191       listWorkReport(this.queryParams).then(response => {
192         let rowsData = response.rows[0];
193         this.workpieceInformation.workOrderCode = rowsData.workOrderCode;
194         this.workpieceInformation.productCode = rowsData.productCode;
195         this.workpieceInformation.productModel = rowsData.productModel;
196         this.workpieceInformation.productName = rowsData.productName;
197         this.timer = setInterval(() => {
198           this.workpieceInformation.beat++;
199         }, 1000);
200       });
201     },
202     allowRelease(){
203       clearInterval(this.timer);
204       this.$message('保存节拍为'+this.workpieceInformation.beat+'秒');
205     },
206     /** 查询工位终端配置列表 */
207     getStationConfList() {
208       let queryParams = {
209         ipAddress: null,
210       }
211       getIpv4().then(response => {
212         queryParams.ipAddress = response.msg
213       });
214       listStationConf(queryParams).then(response => {
215         let rows = response.rows[0]
5a6d6b 216         if(response.rows.length===0){
217           this.$message('改ip沒有配置工序工位,請重試!');
218           return
219         }
49ac5c 220         this.headContent.processesName = rows.processesName
221         this.headContent.processesCode = rows.processesCode
222       });
223     },
224   }
b0742c 225 }
C 226
227 </script>
589dc7 228 <style scoped>
229 .bottom-card{
230   height: 600px;
b0742c 231 }
589dc7 232 .circle-button{
8586e1 233   height: 30px;
A 234   width: 30px;
235 }
49ac5c 236 .circle-red {
237   background-color: #e01a4f;
238 }
239 .circle-green {
240   background-color: green;
241 }
242 .circle-green-animate {
243   background-color: green;
244   animation: circle-green-animate 2s infinite;
245 }
246   @keyframes circle-green-animate {
247     50% {
248       opacity: 0.6;
249     }
250     0% {
251       opacity: 0.2;
252     }
253   }
254 .head-font{
255   font-weight: bold;
256   font-size: 25px;
257 }
8586e1 258 span{
A 259   font-size: 15px;
b0742c 260 }
C 261 </style>
5a6d6b 262 <!--<template>-->
263 <!--  <div>-->
264 <!--    <el-input v-model="url" type="text" style="width: 20%" /> &nbsp; &nbsp;-->
265 <!--    <el-button @click="join" type="primary">连接</el-button>-->
266 <!--    <el-button @click="exit" type="danger">断开</el-button>-->
267
268 <!--    <br />-->
269 <!--    <el-input type="textarea" v-model="message" :rows="9" />-->
270 <!--    <el-button type="info" @click="send">发送消息</el-button>-->
271 <!--    <br />-->
272 <!--    <br />-->
273 <!--    <el-input type="textarea" v-model="text_content" :rows="9" /> 返回内容-->
274 <!--    <br />-->
275 <!--    <br />-->
276 <!--  </div>-->
277 <!--</template>-->
278
279 <!--<script>-->
280 <!--export default {-->
281 <!--  data() {-->
282 <!--    return {-->
283 <!--      url: "ws://127.0.0.1:8081/websocket/message",-->
284 <!--      message: "",-->
285 <!--      text_content: "",-->
286 <!--      ws: null,-->
287 <!--    };-->
288 <!--  },-->
289 <!--  methods: {-->
290 <!--    join() {-->
291 <!--      const wsuri = this.url;-->
292 <!--      this.ws = new WebSocket(wsuri);-->
293 <!--      const self = this;-->
294 <!--      this.ws.onopen = function (event) {-->
295 <!--        self.text_content = self.text_content + "已经打开连接!" + "\n";-->
296 <!--      };-->
297 <!--      this.ws.onmessage = function (event) {-->
298 <!--        console.log("后端发过来的消息"+event.data)-->
299 <!--        self.text_content = event.data + "\n";-->
300 <!--      };-->
301 <!--      this.ws.onclose = function (event) {-->
302 <!--        self.text_content = self.text_content + "已经关闭连接!" + "\n";-->
303 <!--      };-->
304 <!--    },-->
305 <!--    exit() {-->
306 <!--      if (this.ws) {-->
307 <!--        this.ws.close();-->
308 <!--        this.ws = null;-->
309 <!--      }-->
310 <!--    },-->
311 <!--    send() {-->
312 <!--      if (this.ws) {-->
313 <!--        this.ws.send(this.message);-->
314 <!--      } else {-->
315 <!--        alert("未连接到服务器");-->
316 <!--      }-->
317 <!--    },-->
318 <!--  },-->
319 <!--};-->
320 <!--</script>-->
321