| | |
| | | <div style="width: 100%;">堆垛机监控</div> |
| | | <div style="width: 100%;text-align: right;display: flex;"><el-input size="mini" v-model="searchCrnNo" placeholder="请输入堆垛机号"></el-input><el-button @click="getCrnStateInfo" size="mini">查询</el-button></div> |
| | | </div> |
| | | <div style="margin-bottom: 10px;"> |
| | | <div style="margin-bottom: 10px;" v-if="!readOnly"> |
| | | <div style="margin-bottom: 5px;"> |
| | | <el-button v-if="showControl" @click="openControl" size="mini">关闭控制中心</el-button> |
| | | <el-button v-else @click="openControl" size="mini">打开控制中心</el-button> |
| | |
| | | <el-descriptions-item label="升降距离(Km)">{{ item.ydistance }}</el-descriptions-item> |
| | | <el-descriptions-item label="走行时长(H)">{{ item.xDuration }}</el-descriptions-item> |
| | | <el-descriptions-item label="升降时长(H)">{{ item.yduration }}</el-descriptions-item> |
| | | <el-descriptions-item label="称重数据">{{ item.weight }}</el-descriptions-item> |
| | | <el-descriptions-item label="条码数据">{{ item.barcode }}</el-descriptions-item> |
| | | <el-descriptions-item label="故障代码">{{ item.warnCode }}</el-descriptions-item> |
| | | <el-descriptions-item label="故障描述">{{ item.alarm }}</el-descriptions-item> |
| | | <el-descriptions-item label="扩展数据">{{ item.extend }}</el-descriptions-item> |
| | | </el-descriptions> |
| | | </el-collapse-item> |
| | | </el-collapse> |
| | |
| | | </div> |
| | | </div> |
| | | `, |
| | | props: ["param"], |
| | | props: { |
| | | param: { |
| | | type: Object, |
| | | default: () => ({}) |
| | | }, |
| | | autoRefresh: { |
| | | type: Boolean, |
| | | default: true |
| | | }, |
| | | readOnly: { |
| | | type: Boolean, |
| | | default: false |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | crnList: [], |
| | |
| | | }, |
| | | pageSize: 25, |
| | | currentPage: 1, |
| | | timer: null |
| | | }; |
| | | }, |
| | | created() { |
| | | setInterval(() => { |
| | | this.getCrnStateInfo(); |
| | | }, 1000); |
| | | if (this.autoRefresh) { |
| | | this.timer = setInterval(() => { |
| | | this.getCrnStateInfo(); |
| | | }, 1000); |
| | | } |
| | | }, |
| | | beforeDestroy() { |
| | | if (this.timer) { |
| | | clearInterval(this.timer); |
| | | } |
| | | }, |
| | | computed: { |
| | | displayCrnList() { |
| | |
| | | watch: { |
| | | param: { |
| | | handler(newVal, oldVal) { |
| | | if (newVal.crnNo != 0) { |
| | | if (newVal && newVal.crnNo && newVal.crnNo != 0) { |
| | | this.activeNames = newVal.crnNo; |
| | | this.searchCrnNo = newVal.crnNo; |
| | | const idx = this.crnList.findIndex(i => i.crnNo == newVal.crnNo); |
| | | if (idx >= 0) { this.currentPage = Math.floor(idx / this.pageSize) + 1; } |
| | | } |
| | |
| | | this.currentPage = 1; |
| | | }, |
| | | getCrnStateInfo() { |
| | | if (this.$root.sendWs) { |
| | | this.$root.sendWs(JSON.stringify({ |
| | | "url": "/crn/table/crn/state", |
| | | "data": {} |
| | | })); |
| | | } |
| | | }, |
| | | setCrnList(res) { |
| | | let that = this; |
| | | $.ajax({ |
| | | url: baseUrl + "/crn/table/crn/state", |
| | | headers: { |
| | | token: localStorage.getItem("token"), |
| | | }, |
| | | method: "post", |
| | | success: (res) => { |
| | | // 堆垛机信息表获取 |
| | | if (res.code == 200) { |
| | | let list = res.data; |
| | | if (res.code == 200) { |
| | | let list = res.data; |
| | | |
| | | if (that.searchCrnNo == "") { |
| | | that.crnList = list; |
| | | } else { |
| | | let tmp = []; |
| | | list.forEach((item) => { |
| | | if (item.crnNo == that.searchCrnNo) { |
| | | tmp.push(item); |
| | | } |
| | | }); |
| | | that.crnList = tmp; |
| | | that.currentPage = 1; |
| | | if (that.searchCrnNo == "") { |
| | | that.crnList = list; |
| | | } else { |
| | | let tmp = []; |
| | | list.forEach((item) => { |
| | | if (item.crnNo == that.searchCrnNo) { |
| | | tmp.push(item); |
| | | } |
| | | } |
| | | }, |
| | | }); |
| | | }); |
| | | that.crnList = tmp; |
| | | that.currentPage = 1; |
| | | } |
| | | } |
| | | }, |
| | | openControl() { |
| | | this.showControl = !this.showControl; |