fix: 状态组件替换告警中心优化

This commit is contained in:
leiqiaochu 2023-03-20 15:05:34 +08:00
parent 30e98f69af
commit 14aeec4178
8 changed files with 50 additions and 33 deletions

View File

@ -4,7 +4,13 @@ const color = {
'error': '229, 0, 18',
'success': '36, 178, 118',
'warning': '255, 144, 0',
'default': '102, 102, 102'
'default': '102, 102, 102',
//告警颜色
'level1': '229, 0, 18',
'level2': '255, 148, 87',
'level3': '250, 189, 71',
'level4': '153, 153, 153',
'level5': '196, 196, 196'
}
export const getHexColor = (code: string, pe: number = 0.1) => {
const _color = color[code] || color.default

View File

@ -317,7 +317,7 @@
:status="slotProps.state.value"
:statusText="slotProps.state.text"
:statusNames="{
enabled: 'success',
enabled: 'processing',
disabled: 'error',
}"
>
@ -1009,6 +1009,7 @@ const submitDevice = async () => {
});
if (resp.status === 200) {
message.success('操作成功!');
productStore.current!.storePolicy = storePolicy
if ((window as any).onTabSaveSuccess) {
if (resp.result) {
(window as any).onTabSaveSuccess(resp);

View File

@ -266,7 +266,7 @@ onMounted(() => {
cursor: not-allowed;
}
.productDetailHead {
width: 50%;
max-width: 50%;
overflow: hidden;
white-space: nowrap;
overflow: hidden;

View File

@ -48,7 +48,7 @@
:status="slotProps.state"
:statusText="slotProps.state === 1 ? '正常' : '禁用'"
:statusNames="{
1: 'success',
1: 'processing',
0: 'error',
}"
>
@ -118,9 +118,13 @@
</CardBox>
</template>
<template #state="slotProps">
<j-badge
<BadgeStatus
:text="slotProps.state === 1 ? '正常' : '禁用'"
:status="statusMap.get(slotProps.state)"
:status="slotProps.state"
:statusNames="{
1: 'processing',
0: 'error',
}"
/>
</template>
<template #action="slotProps">
@ -189,9 +193,6 @@ const menuStory = useMenuStore();
const isAdd = ref<number>(0);
const title = ref<string>('');
const params = ref<Record<string, any>>({});
const statusMap = new Map();
statusMap.set(1, 'success');
statusMap.set(0, 'error');
const columns = [
{
title: 'ID',

View File

@ -44,7 +44,7 @@
</j-radio-group>
</j-form-item>
<j-form-item label="说明" name="description">
<j-textarea v-model:value="form.description"></j-textarea>
<j-textarea v-model:value="form.description" showCount :maxlength="200"></j-textarea>
</j-form-item>
<PermissionButton type="primary" @click="handleSave" :hasPermission="['rule-engine/Alarm/Configuration:add','rule-engine/Alarm/Configuration:update']">保存</PermissionButton>
</j-form>

View File

@ -37,7 +37,7 @@
:active="_selectedRowKeys.includes(slotProps.id)"
@click="handleClick"
:statusNames="{
started: 'success',
started: 'processing',
disable: 'error',
}"
>

View File

@ -39,7 +39,7 @@
:status="slotProps.state?.value"
:statusText="slotProps.state?.text"
:statusNames="{
enabled: 'success',
enabled: 'processing',
disabled: 'error',
}"
>
@ -122,17 +122,17 @@
>
</template>
<template #state="slotProps">
<j-badge
<BadgeStatus
:text="
slotProps.state?.value === 'enabled'
? '正常'
: '禁用'
"
:status="
slotProps.state?.value === 'enabled'
? 'success'
: 'error'
"
:status="slotProps.state?.value"
:statusNames="{
enabled: 'processing',
disabled: 'error',
}"
/>
</template>
<template #action="slotProps">
@ -196,6 +196,8 @@ const columns = [
search: {
type: 'string',
},
width: 220,
ellipsis: true,
},
{
title: '类型',
@ -223,6 +225,7 @@ const columns = [
},
],
},
width: 100,
},
{
title: '告警级别',
@ -244,6 +247,8 @@ const columns = [
return [];
},
},
width: 200,
ellipsis: true,
},
{
title: '关联场景联动',
@ -267,6 +272,8 @@ const columns = [
return [];
},
},
width: 220,
ellipsis: true,
},
{
title: '状态',
@ -286,6 +293,7 @@ const columns = [
},
],
},
width: 90,
},
{
title: '说明',
@ -294,6 +302,7 @@ const columns = [
search: {
type: 'string',
},
ellipsis: true,
},
{
title: '操作',

View File

@ -43,6 +43,14 @@
(i) => i.level === slotProps.level,
)?.title || slotProps.level
"
:status="slotProps.level"
:statusNames="{
1: 'level1',
2: 'level2',
3: 'level3',
4: 'level4',
5: 'level5',
}"
>
<template #img>
<img :src="imgMap.get(slotProps.targetType)" alt="" />
@ -80,14 +88,14 @@
</j-col>
<j-col :span="8">
<div class="content-des-title">状态</div>
<j-badge
:status="
slotProps.state.value === 'warning'
? 'error'
: 'default'
"
<BadgeStatus
:status="slotProps.state.value"
:statusName="{
warning: 'warning',
normal: 'default',
}"
>
</j-badge
</BadgeStatus
><span
:style="
slotProps.state.value === 'warning'
@ -184,14 +192,6 @@ titleMap.set('product', '产品');
titleMap.set('device', '设备');
titleMap.set('other', '其他');
titleMap.set('org', '组织');
const colorMap = new Map();
colorMap.set(1, '#E50012');
colorMap.set(2, '#FF9457');
colorMap.set(3, '#FABD47');
colorMap.set(4, '#999999');
colorMap.set(5, '#C4C4C4');
const columns = [
{
title: '名称',