| | |
| | | <div class="mc-root"> |
| | | <div class="mc-toolbar"> |
| | | <div class="mc-title">输送监控</div> |
| | | <div v-if="!readOnly" class="mc-search"> |
| | | <div v-if="showSearch" class="mc-search"> |
| | | <input class="mc-input" v-model="searchStationId" placeholder="请输入站号" /> |
| | | <button type="button" class="mc-btn mc-btn-ghost" @click="getDevpStateInfo">查询</button> |
| | | <button type="button" class="mc-btn mc-btn-ghost" @click="handleSearch">查询</button> |
| | | </div> |
| | | </div> |
| | | |
| | |
| | | param: { type: Object, default: function () { return {}; } }, |
| | | items: { type: Array, default: null }, |
| | | autoRefresh: { type: Boolean, default: true }, |
| | | readOnly: { type: Boolean, default: false } |
| | | readOnly: { type: Boolean, default: false }, |
| | | showSearchInReadOnly: { type: Boolean, default: false } |
| | | }, |
| | | data: function () { |
| | | return { |
| | |
| | | }; |
| | | }, |
| | | computed: { |
| | | showSearch: function () { |
| | | return !this.readOnly || this.showSearchInReadOnly; |
| | | }, |
| | | sourceList: function () { |
| | | return Array.isArray(this.items) ? this.items : this.stationList; |
| | | }, |
| | |
| | | watch: { |
| | | items: function () { |
| | | this.afterDataRefresh(); |
| | | }, |
| | | searchStationId: function () { |
| | | this.applySearchFilter(); |
| | | }, |
| | | param: { |
| | | deep: true, |
| | |
| | | toggleItem: function (item) { |
| | | var next = String(item.stationId); |
| | | this.activeNames = this.activeNames === next ? "" : next; |
| | | this.$emit('item-select', this.activeNames ? (item || null) : null); |
| | | }, |
| | | focusStation: function (stationId) { |
| | | this.searchStationId = String(stationId); |
| | | var index = this.filteredStationList.findIndex(function (item) { |
| | | if (!this.readOnly) { |
| | | this.searchStationId = String(stationId); |
| | | } |
| | | var targetList = this.readOnly ? this.sourceList : this.filteredStationList; |
| | | var index = targetList.findIndex(function (item) { |
| | | return String(item.stationId) === String(stationId); |
| | | }); |
| | | this.currentPage = index >= 0 ? Math.floor(index / this.pageSize) + 1 : 1; |
| | |
| | | } |
| | | this.currentPage = page; |
| | | }, |
| | | applySearchFilter: function () { |
| | | this.currentPage = 1; |
| | | this.afterDataRefresh(); |
| | | }, |
| | | handleSearch: function () { |
| | | if (this.readOnly) { |
| | | this.applySearchFilter(); |
| | | return; |
| | | } |
| | | this.getDevpStateInfo(); |
| | | }, |
| | | getDevpStateInfo: function () { |
| | | if (this.$root && this.$root.sendWs) { |
| | | this.$root.sendWs(JSON.stringify({ |