SettingDialog.vue
5.4 KB
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
<template>
<el-dialog
:model-value="visible"
@update:model-value="$emit('update:visible', $event)"
title=""
width="calc(100vw - 40px)"
:style="{ maxWidth: '1400px' }"
top="3vh"
destroy-on-close
class="setting-dialog"
>
<template #header>
<div class="dialog-header">
<div class="left-tabs">
<span :class="['tab-item', { active: activeTab === 'trigger' }]" @click="activeTab = 'trigger'">触发器设置</span>
<span :class="['tab-item', { active: activeTab === 'history' }]" @click="activeTab = 'history'">原因列表查看</span>
<span :class="['tab-item', { active: activeTab === 'setting' }]" @click="activeTab = 'setting'">设置</span>
</div>
<div class="header-right">
<span class="device-name">中速纸杯机24号机</span>
</div>
</div>
</template>
<div class="setting-body">
<div class="sub-tabs">
<span
v-for="st in subTabs" :key="st.key"
:class="['sub-tab', { active: activeSub === st.key }]"
@click="activeSub = st.key"
>{{ st.label }}</span>
<el-button size="small" type="primary" plain class="add-trigger-btn">添加触发条件</el-button>
</div>
<el-table :data="triggerTableData" size="small" stripe border style="width: 100%; font-size: 12px;">
<el-table-column prop="name" label="触发器名称" min-width="120" fixed>
<template #default="{ row }">
<span class="link-text">{{ row.name }}</span>
</template>
</el-table-column>
<el-table-column prop="condition" label="触发条件" min-width="100" />
<el-table-column prop="threshold" label="静默阈值" min-width="100" />
<el-table-column prop="duration" label="累管时间" min-width="110">
<template #default="{ row }">
<span class="link-text">{{ row.duration }}</span>
</template>
</el-table-column>
<el-table-column prop="operator" label="接收人员" min-width="100" />
<el-table-column prop="alertTime" label="触发时间" min-width="110">
<template #default="{ row }">
<span class="link-text">{{ row.alertTime }}</span>
</template>
</el-table-column>
<el-table-column prop="receiveMethod" label="接收方式" min-width="90" />
<el-table-column prop="part" label="部件" min-width="80" />
<el-table-column prop="contactGroup" label="联系组" min-width="90" />
<el-table-column prop="config" label="配置" min-width="200" />
</el-table>
<div class="footer-bar">
<span>共 1 条</span>
<el-pagination layout="prev, pager, next" :total="1" :page-size="10" small />
<span>前往 <el-input-number :min="1" :max="1" :controls="false" size="small" style="width: 46px;" /> 页</span>
</div>
</div>
</el-dialog>
</template>
<script setup>
import { ref } from 'vue'
defineProps({
visible: Boolean,
device: Object
})
defineEmits(['update:visible'])
const activeTab = ref('trigger')
const activeSub = ref('light')
const subTabs = [
{ key: 'light', label: '绿灯' },
{ key: 'yellow', label: '黄灯' },
{ key: 'offline', label: '离线' },
{ key: 'lightOff', label: '灭灯' },
{ key: 'counter', label: '计数' },
{ key: 'blue', label: '蓝灯' },
{ key: 'reason', label: '原因码' },
{ key: 'safe', label: '安灯' },
]
const triggerTableData = [
{ name: '红灯即时', condition: '>6秒', threshold: '0分', duration: '00:00:24:00', operator: '', alertTime: '', receiveMethod: '', part: '', contactGroup: '', config: '启用 / 禁用 / 删除 / 添加联系人 / 编辑联系组' }
]
</script>
<style scoped>
.setting-dialog :deep(.el-dialog) {
max-height: 92vh;
display: flex;
flex-direction: column;
}
.setting-dialog :deep(.el-dialog__header) {
padding: 0;
margin: 0;
border-bottom: 1px solid #e8e8e8;
flex-shrink: 0;
}
.setting-dialog :deep(.el-dialog__body) {
overflow-y: auto;
flex: 1;
}
.dialog-header {
display: flex;
justify-content: space-between;
align-items: center;
height: 48px;
padding: 0 20px;
}
.left-tabs {
display: flex;
gap: 0;
height: 100%;
align-items: center;
}
.tab-item {
padding: 0 18px;
height: 100%;
display: flex;
align-items: center;
font-size: 13px;
color: #666;
cursor: pointer;
border-bottom: 2px solid transparent;
transition: all 0.2s;
}
.tab-item.active {
color: #409eff;
font-weight: bold;
border-bottom-color: #409eff;
}
.header-right {
display: flex;
align-items: center;
gap: 12px;
}
.device-name {
font-size: 13px;
color: #333;
font-weight: 500;
}
.setting-body {
padding: 0;
}
.sub-tabs {
display: flex;
align-items: center;
gap: 4px;
padding: 12px 20px;
border-bottom: 1px solid #e8e8e8;
background: #fafafa;
}
.sub-tab {
padding: 6px 18px;
font-size: 13px;
color: #333;
cursor: pointer;
border-radius: 4px;
transition: all 0.2s;
}
.sub-tab:hover {
color: #409eff;
}
.sub-tab.active {
background: #409eff;
color: #fff;
font-weight: bold;
}
.add-trigger-btn {
margin-left: auto;
}
.link-text {
color: #409eff;
cursor: pointer;
}
.link-text:hover {
text-decoration: underline;
}
.footer-bar {
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px 20px;
border-top: 1px solid #e8e8e8;
background: #fafafa;
font-size: 12px;
color: #999;
gap: 16px;
}
</style>