summaryrefslogtreecommitdiff
path: root/src/views/SILA/AnalyticalPanel/AnalyticalPanelPage.vue
blob: 8506f14389dbd99b27e681a0db2519c27dbcf4b9 (plain)
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
<template>
  <b-container fluid="xxl pt-0 m-0">
    <page-title />
    <div class="tables-container">
      <div class="server-table">
        <span class="semi-bold-16px">{{
          $t('global.status.serverStatus')
        }}</span>
        <b-table
          show-empty
          responsive="md"
          class="bootstrap-analytical-table"
          :items="serverItems"
          :fields="server_fields"
        >
          <template #cell(value)="{ value }">
            <b-col v-if="value">
              <img
                src="@/assets/images/icon-ok.svg"
                class="system-network-table__icon"
              />
            </b-col>
            <b-col v-else>
              <img
                src="@/assets/images/icon-no.svg"
                class="system-network-table__icon"
              />
            </b-col>
          </template>
        </b-table>
      </div>
      <div class="events-table">
        <span class="semi-bold-16px">{{ $t('global.action.events') }}</span>
        <div id="events-table-wrapper">
          <b-table
            show-empty
            :sticky-header="stickyHeader"
            responsive="md"
            class="bootstrap-analytical-table"
            :no-border-collapse="true"
            :items="eventsItems"
            :fields="events_fields"
          >
            <template #cell(date)="{ value }">
              <img
                src="@/assets/images/event-logs/time.svg"
                class="sourse__img"
              />
              <span class="regular-12px quaternary"> {{ value }} </span>
            </template>
            <template #cell(type)="{ value }">
              <span
                v-if="value === 'Критические'"
                class="bold-12px__caps errors"
                >{{ value }}</span
              >
              <span
                v-else-if="value === 'Предупреждения'"
                class="bold-12px__caps warning"
              >
                {{ value }}
              </span>
              <span v-else class="bold-12px__caps information">{{
                value
              }}</span>
            </template>
            <template #cell(description)="data">
              <b-row class="semi-bold-16px tretiatry">
                {{ data.item.description.name }}
              </b-row>
              <b-row
                class="regular-12px tretiatry pointer"
                @click="toggleRowDetails(data)"
              >
                {{ data.item.description.description }}</b-row
              >
            </template>
            <template #row-details="{ index }">
              <b-container fluid>
                <b-col class="mt-1 mb-2 regular-12px tretiatry">
                  <span class="row-details">
                    {{
                      `Краткое описание ошибки или сообщение которое состоит из текста указывающего на предмет ошибки.Краткое описание ошибки или сообщение которое состоит из текста указывающего на предмет ошибки.
                   Краткое описание ошибки или сообщение которое состоит из текста указывающего на предмет ошибки.Краткое описание ошибки или сообщение которое состоит из текста указывающего на предмет ошибки.`
                    }}
                    {{ $t(eventsItems[index].description.description) }}
                  </span>
                </b-col>
              </b-container>
            </template>
          </b-table>
        </div>
      </div>
    </div>
    <div class="indicators-container">
      <span class="bold-16px">{{ $t('global.status.indicators') }}</span>
      <span class="indicators-units regular-12px tretiatry">
        {{ $t('global.units.unit') }}</span
      >
      <b-button id="popover-choice-1" variant="unstiled">
        <span class="regular-12px units-label">
          {{
            $t(`global.units.${unit === 'Ампераж' ? 'amper' : 'volt'}`)
          }}</span
        >
        <img class="units__icon" src="@/assets/images/icon-chevron-red.svg" />
      </b-button>
    </div>
    <two-chioce-popover
      :id="1"
      fitst-option="Ампераж"
      second-option="Вольтаж"
      :chosen-option="unit"
      :first-action="selectAmper"
      :second-action="selectVolt"
    />
    <!-- <unit-popover
        :select-amper="selectAmper"
        :select-volt="selectVolt"
        :unit="unit"
      /> -->
    <date-switch :switch-time-scale="switchTimeScale" :time-scale="timeScale" />
    <accessory-table :records="accessoryData.power" />
    <power-table :time-scale="timeScale" />
    <div class="tables-container">
      <span class="semi-bold-16px">Управление</span>
    </div>
    <control-system />
  </b-container>
</template>

<script>
import PageTitle from '@/components/Global/PageTitle';
import TableRowExpandMixin from '@/components/Mixins/TableRowExpandMixin';
import DateSwitch from '@/components/Global/SilaComponents/DateSwitch';
import AccessoryTable from '@/components/Global/SilaComponents/Tables/AccessoryTableWithLabel';
import ControlSystem from '@/components/Global/SilaComponents/InventoryControlSystem';
import TwoChiocePopover from '@/components/Global/SilaComponents/TwoChiocePopover';

import PowerTable from './PowerTable';
import { AccessoryData, ServerItems, EventsItems } from './helpers';
export default {
  components: {
    PageTitle,
    DateSwitch,
    AccessoryTable,
    PowerTable,
    ControlSystem,
    TwoChiocePopover,
  },
  mixins: [TableRowExpandMixin],
  data() {
    return {
      unit: 'Ампераж',
      isActive: false,
      timeScale: 'hour',
      stickyHeader: '511px',
      accessoryData: AccessoryData,
      serverItems: ServerItems,
      eventsItems: EventsItems,
      server_fields: [
        {
          key: 'param',
          label: 'Раздел',
          formatter: this.dataFormatter,
          thClass: 'semi-bold-12px__caps bootstrap-analytical-th',
          class: 'bootstrap-analytical-table__column-first',
          tdClass: 'regular-12px bootstrap-analytical-table__td',
        },
        {
          key: 'value',
          label: 'Статус',
          formatter: this.dataFormatter,
          thClass: 'semi-bold-12px__caps bootstrap-analytical-th',
          class:
            'bootstrap-rounded-table__column-last analytical-table__status',
          tdClass: 'regular-12px bootstrap-analytical-table__td',
        },
      ],
      events_fields: [
        {
          key: 'date',
          label: 'Время',
          formatter: this.dataFormatter,
          thClass: 'semi-bold-12px__caps bootstrap-analytical-th',
          class: 'bootstrap-analytical-table__column-first',
          tdClass: 'regular-12px bootstrap-analytical-table__td',
        },
        {
          key: 'type',
          label: 'Тип события',
          formatter: this.dataFormatter,
          thClass: 'semi-bold-12px__caps bootstrap-analytical-th',
          class: 'bootstrap-analytical-table__column-center',
          tdClass: 'regular-12px bootstrap-analytical-table__td',
        },
        {
          key: 'description',
          label: 'О событии',
          formatter: this.dataFormatter,
          thClass: 'semi-bold-12px__caps bootstrap-analytical-th',
          class: 'bootstrap-analytical-table__column-last',
          tdClass: 'regular-12px bootstrap-analytical-table__td',
        },
      ],
    };
  },
  methods: {
    switchTimeScale(period) {
      this.timeScale = period;
    },
    selectAmper() {
      this.unit = 'Ампераж';
    },
    selectVolt() {
      this.unit = 'Вольтаж';
    },
  },
};
</script>
<style lang="scss">
.analytical-table__status {
  width: 10%;
}

#popover-unit-ractive {
  padding-left: 5px;
}

#popover-unit-ampere {
  width: 89px;
  height: 28px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 12px;
}

#popover-unit-volt {
  width: 89px;
  height: 28px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 12px;
  // color: $red-brand-primary;
}
</style>
<style lang="scss" scoped>
.tables-container {
  display: flex;
  flex-flow: row nowrap;
  margin: 16px 32px;
  gap: 24px;
}

.server-table {
  width: 35%;
}

.events-table {
  width: 65%;
}

#events-table-wrapper div {
  overflow-y: overlay;
  overflow-x: hidden;
  &::-webkit-scrollbar {
    position: absolute;
    width: 10px;
  }
  &::-webkit-scrollbar-thumb {
    border: 4px solid transparent;
    border-top: 43px solid transparent;
    background: $faint-secondary-primary-20;
    border-radius: 16px;
    background-clip: content-box;
  }
}

.row-details {
  display: block;
  height: auto;
  width: 30vw;
}

.errors {
  color: $indicators-errors !important;
}

.warning {
  color: $indicators-warning !important;
}

.information {
  color: $indicators-complementary !important;
}

.indicators-container {
  margin-left: 2rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.indicators-units {
  margin-left: auto;
}

.units__icon {
  margin: 0 32px 0 5px;
  cursor: pointer;
}

.units-label {
  cursor: pointer;
  color: $red-brand-primary;
}
</style>