Merge branch 'dev' of github.com:jetlinks/jetlinks-ui-vue into dev
This commit is contained in:
commit
0148179444
|
@ -0,0 +1,5 @@
|
||||||
|
import server from '@/utils/request';
|
||||||
|
/**
|
||||||
|
* 查询等级
|
||||||
|
*/
|
||||||
|
export const queryLevel = () => server.get('/alarm/config/default/level');
|
|
@ -1,6 +1,7 @@
|
||||||
import { ProductItem } from "@/views/device/Product/typings";
|
import { ProductItem } from "@/views/device/Product/typings";
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { detail} from '@/api/device/product'
|
import { detail , getDeviceNumber} from '@/api/device/product'
|
||||||
|
import encodeQuery from "@/utils/encodeQuery";
|
||||||
|
|
||||||
export const useProductStore = defineStore({
|
export const useProductStore = defineStore({
|
||||||
id: 'product',
|
id: 'product',
|
||||||
|
@ -16,9 +17,13 @@ export const useProductStore = defineStore({
|
||||||
},
|
},
|
||||||
async refresh(id: string) {
|
async refresh(id: string) {
|
||||||
const resp = await detail(id)
|
const resp = await detail(id)
|
||||||
|
const res = await getDeviceNumber(encodeQuery({ terms: { productId: id } }))
|
||||||
if(resp.status === 200){
|
if(resp.status === 200){
|
||||||
this.current = resp.result
|
this.current = resp.result
|
||||||
this.detail = resp.result
|
this.detail = resp.result
|
||||||
|
if(res.status === 200){
|
||||||
|
this.current.count = res.result
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setTabActiveKey(key: string) {
|
setTabActiveKey(key: string) {
|
||||||
|
|
|
@ -29,10 +29,10 @@
|
||||||
}}</a-button>
|
}}</a-button>
|
||||||
</a-descriptions-item>
|
</a-descriptions-item>
|
||||||
<a-descriptions-item label="创建时间">{{
|
<a-descriptions-item label="创建时间">{{
|
||||||
productStore.current.createTime
|
moment(productStore.current.createTime).format('YYYY-MM-DD HH:mm:ss')
|
||||||
}}</a-descriptions-item>
|
}}</a-descriptions-item>
|
||||||
<a-descriptions-item label="更新时间">{{
|
<a-descriptions-item label="更新时间">{{
|
||||||
productStore.current.modifyTime
|
moment(productStore.current.modifyTime).format('YYYY-MM-DD HH:mm:ss')
|
||||||
}}</a-descriptions-item>
|
}}</a-descriptions-item>
|
||||||
|
|
||||||
<a-descriptions-item label="说明" :span="3">
|
<a-descriptions-item label="说明" :span="3">
|
||||||
|
@ -47,6 +47,7 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { useProductStore } from '@/store/product';
|
import { useProductStore } from '@/store/product';
|
||||||
import Save from '../../Save/index.vue';
|
import Save from '../../Save/index.vue';
|
||||||
|
import moment from 'moment';
|
||||||
import {
|
import {
|
||||||
EditOutlined,
|
EditOutlined,
|
||||||
DeleteOutlined,
|
DeleteOutlined,
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
<!-- 显示md文件内容 -->
|
<!-- 显示md文件内容 -->
|
||||||
<div
|
<div
|
||||||
v-if="config?.document"
|
v-if="config?.document"
|
||||||
v-html="config?.document"
|
v-html="markdownToHtml"
|
||||||
></div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="item-style">
|
<div class="item-style">
|
||||||
|
@ -385,10 +385,11 @@ const simpleImage = ref(Empty.PRESENTED_IMAGE_SIMPLE);
|
||||||
const visible = ref<boolean>(false);
|
const visible = ref<boolean>(false);
|
||||||
const listData = ref<string[]>([]);
|
const listData = ref<string[]>([]);
|
||||||
const access = ref({});
|
const access = ref({});
|
||||||
const config = ref({});
|
const config = ref<any>({});
|
||||||
const metadata = ref<ConfigMetadata[]>([]);
|
const metadata = ref<ConfigMetadata[]>([]);
|
||||||
const dataSource = ref<string[]>([]);
|
const dataSource = ref<string[]>([]);
|
||||||
const storageList = ref<any[]>([]);
|
const storageList = ref<any[]>([]);
|
||||||
|
const markdownToHtml = shallowRef('');
|
||||||
const current = ref({
|
const current = ref({
|
||||||
id: productStore.current?.accessId,
|
id: productStore.current?.accessId,
|
||||||
name: productStore.current?.accessName,
|
name: productStore.current?.accessName,
|
||||||
|
@ -805,6 +806,9 @@ const getConfigDetail = async (
|
||||||
(resp) => {
|
(resp) => {
|
||||||
if (resp.status === 200) {
|
if (resp.status === 200) {
|
||||||
config.value = resp.result;
|
config.value = resp.result;
|
||||||
|
if (config.value?.document) {
|
||||||
|
markdownToHtml.value = marked(config.value.document);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
|
@ -129,6 +129,7 @@ watch(
|
||||||
() => route.params.id,
|
() => route.params.id,
|
||||||
(newId) => {
|
(newId) => {
|
||||||
if (newId) {
|
if (newId) {
|
||||||
|
console.log(newId);
|
||||||
productStore.tabActiveKey = 'Info';
|
productStore.tabActiveKey = 'Info';
|
||||||
productStore.refresh(newId as string);
|
productStore.refresh(newId as string);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,91 @@
|
||||||
|
<template>
|
||||||
|
<page-container :tabList="list" @tabChange="onTabChange">
|
||||||
|
<div v-if="true">
|
||||||
|
<a-row :gutter="24">
|
||||||
|
<a-col :span="14">
|
||||||
|
<div class="alarm-level">
|
||||||
|
<a-card :headStyle="{ borderBottom: 'none' }" :bodyStyle="{paddingTop:0}">
|
||||||
|
<template #title>
|
||||||
|
<div class="alarmLevelTitle">告警级别配置</div>
|
||||||
|
</template>
|
||||||
|
<div
|
||||||
|
v-for="(item, i) in levels"
|
||||||
|
:key="i"
|
||||||
|
class="alarmInputItem"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<img
|
||||||
|
:src="
|
||||||
|
getImage(`/alarm/alarm${i + 1}.png`)
|
||||||
|
"
|
||||||
|
alt=""
|
||||||
|
/>
|
||||||
|
<span>{{ `级别${i + 1}` }}</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a-input type="text" v-model:value="item.title" :maxlength=64></a-input>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a-card>
|
||||||
|
</div>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="10">123</a-col>
|
||||||
|
</a-row>
|
||||||
|
</div>
|
||||||
|
</page-container>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { getImage } from '@/utils/comm';
|
||||||
|
import { queryLevel } from '@/api/rule-engine/config';
|
||||||
|
const list = ref([
|
||||||
|
{
|
||||||
|
key: 'config',
|
||||||
|
tab: '告警级别',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'io',
|
||||||
|
tab: '数据流转',
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
interface levelsObj {
|
||||||
|
level: number;
|
||||||
|
title?: string;
|
||||||
|
}
|
||||||
|
let levels = ref<levelsObj[]>([]);
|
||||||
|
const getAlarmLevel = () => {
|
||||||
|
queryLevel().then((res: any) => {
|
||||||
|
if (res.status == 200) {
|
||||||
|
levels.value = res.result.levels;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
getAlarmLevel();
|
||||||
|
const onTabChange = (e: string) => {};
|
||||||
|
</script>
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.alarm-level {
|
||||||
|
padding: 24px;
|
||||||
|
}
|
||||||
|
.alarmLevelTitle {
|
||||||
|
position: relative;
|
||||||
|
padding-left: 10px;
|
||||||
|
color: rgba(0, 0, 0, 0.8);
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 1;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
.alarmLevelTitle::before {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 4px;
|
||||||
|
height: 100%;
|
||||||
|
background-color: #1d39c4;
|
||||||
|
border-radius: 0 3px 3px 0;
|
||||||
|
content: ' ';
|
||||||
|
}
|
||||||
|
.alarmInputItem {
|
||||||
|
margin-bottom: 22px;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,26 @@
|
||||||
|
import { BaseItem } from '@/utils/typings';
|
||||||
|
|
||||||
|
type LevelItem = {
|
||||||
|
level: number;
|
||||||
|
title: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type IOConfigItem = {
|
||||||
|
id?: string;
|
||||||
|
address: string;
|
||||||
|
topic: string;
|
||||||
|
username: string;
|
||||||
|
password: string;
|
||||||
|
};
|
||||||
|
type IOItem = {
|
||||||
|
alarmConfigId: string;
|
||||||
|
sourceType: string;
|
||||||
|
config: Partial<{
|
||||||
|
type: string;
|
||||||
|
dataSourceId: string;
|
||||||
|
config: Partial<IOConfigItem>;
|
||||||
|
}>;
|
||||||
|
exchangeType: 'consume' | 'producer'; //订阅|推送
|
||||||
|
state: 'disable' | 'enabled'; //禁用|正常
|
||||||
|
description: string;
|
||||||
|
} & BaseItem;
|
Loading…
Reference in New Issue