| | |
| | | var stationTracePageVersion = "20260319_station_trace_layout_v2"; |
| | | |
| | | Vue.component("devp-card", { |
| | | template: ` |
| | | <div class="mc-root"> |
| | | <div class="mc-toolbar"> |
| | | <div class="mc-title">输送监控</div> |
| | | <div class="mc-search"> |
| | | <div v-if="!readOnly" class="mc-search"> |
| | | <input class="mc-input" v-model="searchStationId" placeholder="请输入站号" /> |
| | | <button type="button" class="mc-btn mc-btn-ghost" @click="getDevpStateInfo">查询</button> |
| | | </div> |
| | |
| | | <div class="mc-action-row"> |
| | | <button type="button" class="mc-btn" @click="controlCommand">下发</button> |
| | | <button type="button" class="mc-btn mc-btn-soft" @click="resetCommand">复位</button> |
| | | <button type="button" class="mc-btn mc-btn-ghost" @click="openStationTracePage">运行轨迹</button> |
| | | <button v-if="showFakeTraceEntry" type="button" class="mc-btn mc-btn-ghost" @click="openFakeTracePage">仿真轨迹</button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | <div v-if="displayStationList.length === 0" class="mc-empty">当前没有可展示的站点数据</div> |
| | | </div> |
| | | |
| | | <div class="mc-footer"> |
| | | <div v-if="!readOnly || totalPages > 1" class="mc-footer"> |
| | | <button type="button" class="mc-page-btn" :disabled="currentPage <= 1" @click="handlePageChange(currentPage - 1)">上一页</button> |
| | | <span>{{ currentPage }} / {{ totalPages }}</span> |
| | | <button type="button" class="mc-page-btn" :disabled="currentPage >= totalPages" @click="handlePageChange(currentPage + 1)">下一页</button> |
| | |
| | | targetStationId: "" |
| | | }, |
| | | barcodePreviewCache: {}, |
| | | pageSize: 12, |
| | | showFakeTraceEntry: false, |
| | | pageSize: this.readOnly ? 24 : 12, |
| | | currentPage: 1, |
| | | timer: null |
| | | }; |
| | |
| | | }, |
| | | created: function () { |
| | | MonitorCardKit.ensureStyles(); |
| | | this.loadFakeProcessStatus(); |
| | | if (this.autoRefresh) { |
| | | this.timer = setInterval(this.getDevpStateInfo, 1000); |
| | | } |
| | |
| | | this.afterDataRefresh(); |
| | | } |
| | | }, |
| | | loadFakeProcessStatus: function () { |
| | | if (this.readOnly || !window.$ || typeof baseUrl === "undefined") { |
| | | this.showFakeTraceEntry = false; |
| | | return; |
| | | } |
| | | $.ajax({ |
| | | url: baseUrl + "/openapi/getFakeSystemRunStatus", |
| | | method: "get", |
| | | success: function (res) { |
| | | var data = res && res.data ? res.data : null; |
| | | this.showFakeTraceEntry = !!(data && data.isFake); |
| | | }.bind(this), |
| | | error: function () { |
| | | this.showFakeTraceEntry = false; |
| | | }.bind(this) |
| | | }); |
| | | }, |
| | | openControl: function () { |
| | | this.showControl = !this.showControl; |
| | | }, |
| | | openFakeTracePage: function () { |
| | | if (!this.showFakeTraceEntry) { |
| | | return; |
| | | } |
| | | window.open(baseUrl + "/views/watch/fakeTrace.html", "_blank"); |
| | | }, |
| | | openStationTracePage: function () { |
| | | window.open(baseUrl + "/views/watch/stationTrace.html?v=" + stationTracePageVersion, "_blank"); |
| | | }, |
| | | buildDetailEntries: function (item) { |
| | | return [ |
| | |
| | | { label: "条码", value: this.orDash(item.barcode), code: true, type: "barcode" }, |
| | | { label: "重量", value: this.orDash(item.weight) }, |
| | | { label: "任务可写区", value: this.orDash(item.taskWriteIdx) }, |
| | | { label: "缓存区数据", value: this.formatTaskBufferItems(item.taskBufferItems), code: true }, |
| | | { label: "故障代码", value: this.orDash(item.error) }, |
| | | { label: "故障信息", value: this.orDash(item.errorMsg) }, |
| | | { label: "系统告警", value: this.orDash(item.systemWarning) }, |
| | | { label: "扩展数据", value: this.orDash(item.extend) } |
| | | ]; |
| | | }, |
| | | formatTaskBufferItems: function (items) { |
| | | if (!Array.isArray(items) || items.length === 0) { |
| | | return "--"; |
| | | } |
| | | return items.map(function (item) { |
| | | var slotIdx = item && item.slotIdx != null ? item.slotIdx : "?"; |
| | | var taskNo = item && item.taskNo != null ? item.taskNo : 0; |
| | | var targetStaNo = item && item.targetStaNo != null ? item.targetStaNo : 0; |
| | | if (!taskNo && !targetStaNo) { |
| | | return slotIdx + ": 空"; |
| | | } |
| | | return slotIdx + ": " + taskNo + " -> " + targetStaNo; |
| | | }).join(" | "); |
| | | }, |
| | | postControl: function (url, payload) { |
| | | $.ajax({ |
| | | url: baseUrl + url, |