WarningSettingDialog.vue
8.09 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="warn-dialog"
>
<template #header>
<div class="dialog-header">
<div class="header-left">
<span :class="['htab', { active: activeTab === 'trigger' }]" @click="activeTab = 'trigger'">触发器设置</span>
<span :class="['htab', { active: activeTab === 'config' }]" @click="activeTab = 'config'">配置</span>
</div>
<div class="header-right">
<span class="device-select">{{ device?.name || '能耗设备2' }} <el-icon><ArrowDown /></el-icon> 返回</span>
</div>
</div>
</template>
<div class="warn-body">
<!-- 触发器Tab -->
<div v-if="activeTab === 'trigger'" class="tab-content">
<div class="toolbar">
<div v-for="t in subTabs" :key="t" :class="['sub-tab', { active: activeSub === t }]"
@click="activeSub = t">{{ t }}</div>
<div style="flex:1"></div>
<el-input v-model="searchKey" placeholder="输入人/机料号" size="small" style="width:180px">
<template #prefix><el-icon><Search /></el-icon></template>
</el-input>
</div>
<div class="table-wrap">
<el-table :data="warningList" size="small" stripe border style="width:100%;font-size:12px;" empty-text="暂无数据">
<el-table-column prop="name" label="触发器名称" min-width="140">
<template #default="{ row }"><span class="link-text">{{ row.name }}</span></template>
</el-table-column>
<el-table-column prop="condition" label="触发条件" min-width="130" />
<el-table-column prop="threshold" label="值域间隔" width="90">
<template #default="{ row }">
{{ row.threshold }} <el-icon :size="12" color="#409eff" style="cursor:pointer;"><EditPen /></el-icon>
</template>
</el-table-column>
<el-table-column prop="duration" label="预警时间" width="110">
<template #default="{ row }">
<el-icon :size="12" color="#67c23a" style="margin-right:2px;"><Clock /></el-icon>{{ row.duration }}
</template>
</el-table-column>
<el-table-column prop="receiver" label="接收人岗" width="80">
<template #default="{ row }">
<el-icon :size="12" color="#409eff" style="margin-right:2px;"><User /></el-icon>{{ row.receiver }}
</template>
</el-table-column>
<el-table-column prop="sendTime" label="推送时间" width="110" />
<el-table-column prop="method" label="接收方式" width="90" />
<el-table-column prop="action" label="操作" width="70" align="center">
<template #default><el-icon :size="14" color="#409eff" style="cursor:pointer;"><Edit /></el-icon></template>
</el-table-column>
<el-table-column prop="group" label="联系组" width="110" />
<el-table-column prop="settings" label="设置" min-width="200">
<template #default="{ row }">
<span v-for="(s, i) in row.settings" :key="i" :class="'tag-'+s.color">{{ s.text }}</span>
</template>
</el-table-column>
</el-table>
<div class="pagination-footer">
<span>共 {{ warningList.length }} 条</span>
<el-pagination :current-page="1" :page-size="10" layout="prev, pager, next" :total="warningList.length" small />
</div>
</div>
</div>
<!-- 配置Tab -->
<div v-else class="tab-content config-view">
<p style="color:#999;padding:20px;text-align:center;">配置内容</p>
</div>
</div>
</el-dialog>
</template>
<script setup>
import { ref } from 'vue'
import { Search, ArrowDown, EditPen, Clock, User, Edit } from '@element-plus/icons-vue'
defineProps({ visible: Boolean, device: Object })
defineEmits(['update:visible'])
const activeTab = ref('trigger')
const activeSub = ref('全部')
const searchKey = ref('')
const subTabs = ['全部', '相电压', '线电压', '电流', '温度', '有功功率', '无功功率', '电能', '功率因数']
const warningList = ref([
{
name: 'C相电压区间报警',
condition: '>C相电压< 20A',
threshold: '0分',
duration: '00:00-24:00',
receiver: '',
sendTime: '',
method: '',
group: '',
settings: [
{ text: '启用', color: 'blue' }, { text: '禁用', color: 'gray' },
{ text: '解除', color: 'red' }, { text: '添加联系人', color: '' },
{ text: '编辑联系组', color: '' }
]
},
{
name: 'B相电压区间报警',
condition: '>B相电压< 20A',
threshold: '0分',
duration: '00:00-24:00',
receiver: '',
sendTime: '',
method: '',
group: '',
settings: [
{ text: '启用', color: 'blue' }, { text: '禁用', color: 'gray' },
{ text: '', color: '' },
{ text: '', color: '' },
{ text: '', color: '' }
]
},
{
name: 'A相电压区间报警',
condition: '>A相电压< 20A',
threshold: '0分',
duration: '00:00-24:00',
receiver: '',
sendTime: '',
method: '',
group: '',
settings: [
{ text: '启用', color: 'blue' }, { text: '禁用', color: 'gray' },
{ text: '解除', color: 'red' }, { text: '添加联系人', color: '' },
{ text: '编辑联系组', color: '' }
]
},
{
name: '总各功功率高',
condition: '>20kW',
threshold: '0分',
duration: '00:00-24:00',
receiver: '',
sendTime: '',
method: '',
group: '',
settings: [
{ text: '启用', color: 'blue' }, { text: '禁用', color: 'gray' },
{ text: '解除', color: 'red' }, { text: '添加联系人', color: '' },
{ text: '编辑联系组', color: '' }
]
},
{
name: 'A相电电流低',
condition: '<5A',
threshold: '0分',
duration: '00:00-24:00',
receiver: '',
sendTime: '',
method: '',
group: '',
settings: [
{ text: '启用', color: 'blue' }, { text: '禁用', color: 'gray' },
{ text: '解除', color: 'red' }, { text: '添加联系人', color: '' },
{ text: '编辑联系组', color: '' }
]
}
])
</script>
<style scoped>
.warn-dialog :deep(.el-dialog){max-height:92vh;display:flex;flex-direction:column;}
.warn-dialog :deep(.el-dialog__header){padding:8px 16px;border-bottom:1px solid #e8e8e8;margin:0;flex-shrink:0;}
.warn-dialog :deep(.el-dialog__body){overflow-y:auto;flex:1;padding:0;display:flex;flex-direction:column;}
.dialog-header{display:flex;align-items:center;justify-content:space-between;}
.header-left{display:flex;gap:4px;}
.htab{padding:6px 18px;font-size:13px;cursor:pointer;color:#666;border-bottom:2px solid transparent;}
.htab.active{color:#409eff;font-weight:bold;border-bottom-color:#409eff;}
.header-right{font-size:13px;color:#409eff;cursor:pointer;display:flex;align-items:center;gap:4px;}
.device-select{}
.warn-body{display:flex;flex-direction:column;flex:1;overflow:hidden;}
.tab-content{display:flex;flex-direction:column;flex:1;}
.toolbar{background:#fff;padding:10px 16px;display:flex;align-items:center;gap:6px;border-bottom:1px solid #eee;}
.sub-tab{padding:5px 14px;font-size:12px;cursor:pointer;color:#666;border-radius:3px;}
.sub-tab.active{background:#409eff;color:#fff;font-weight:bold;}
.table-wrap{flex:1;background:#fff;margin:12px 16px;border-radius:6px;overflow:hidden;}
.link-text{color:#409eff;cursor:pointer;}
.tag-blue{background:#ecf5ff;color:#409eff;padding:1px 6px;border-radius:2px;font-size:11px;margin:1px 2px;}
.tag-gray{background:#f4f4f5;color:#909399;padding:1px 6px;border-radius:2px;font-size:11px;margin:1px 2px;}
.tag-red{background:#fef0f0;color:#f56c6c;padding:1px 6px;border-radius:2px;font-size:11px;margin:1px 2px;}
.pagination-footer{padding:10px 16px;display:flex;justify-content:space-between;align-items:center;border-top:1px solid #f0f0f0;font-size:12px;color:#999;}
.config-view{background:#fff;margin:12px 16px;border-radius:6px;}
</style>