fix: 搜索换成pro-search

This commit is contained in:
100011797 2023-03-13 15:52:25 +08:00
parent f693ba926e
commit 9e7e82b358
9 changed files with 179 additions and 18 deletions

View File

@ -23,4 +23,6 @@ export const _execute = (id: string) => server.post(`/scene/${id}/_execute`);
// 内置参数
export const queryBuiltInParams = (data: any, params?: any) => server.post(`/scene/parse-variables`, data, params);
export const getParseTerm = (data: Record<string, any>) => server.post(`/scene/parse-term-column`, data)
export const getParseTerm = (data: Record<string, any>) => server.post(`/scene/parse-term-column`, data)
export const queryAlarmList = (data: Record<string, any>) => server.post(`/alarm/config/_query/`, data)

View File

@ -1,6 +1,6 @@
<template>
<page-container>
<j-advanced-search
<pro-search
:columns="columns"
target="northbound-aliyun"
@search="handleSearch"
@ -50,13 +50,17 @@
<div class="card-item-content-text">
网桥产品
</div>
<div>{{ slotProps?.bridgeProductName }}</div>
<Ellipsis>
<div>{{ slotProps?.bridgeProductName }}</div>
</Ellipsis>
</j-col>
<j-col :span="12">
<div class="card-item-content-text">
<label>说明</label>
</div>
<div>{{ slotProps?.description }}</div>
<Ellipsis>
<div>{{ slotProps?.description }}</div>
</Ellipsis>
</j-col>
</j-row>
</template>

View File

@ -1,6 +1,6 @@
<template>
<page-container>
<j-advanced-search
<pro-search
:columns="columns"
target="northbound-dueros"
@search="handleSearch"
@ -48,13 +48,17 @@
<j-row>
<j-col :span="12">
<div class="card-item-content-text">产品</div>
<div>{{ slotProps?.productName }}</div>
<Ellipsis>
<div>{{ slotProps?.productName }}</div>
</Ellipsis>
</j-col>
<j-col :span="12">
<div class="card-item-content-text">
设备类型
</div>
<div>{{ slotProps?.applianceType?.text }}</div>
<Ellipsis>
<div>{{ slotProps?.applianceType?.text }}</div>
</Ellipsis>
</j-col>
</j-row>
</template>

View File

@ -1,6 +1,6 @@
<template>
<j-card>
<j-advanced-search
<pro-search
:columns="columns"
target="device-instance-log"
@search="handleSearch"

View File

@ -1,5 +1,5 @@
<template>
<j-advanced-search class="search" type="simple" :columns="columns" target="device-instance-running-events" @search="handleSearch" />
<pro-search class="search" type="simple" :columns="columns" target="device-instance-running-events" @search="handleSearch" />
<JProTable
ref="eventsRef"
:columns="columns"

View File

@ -191,15 +191,17 @@ watch(
() => route.params.id,
(newId) => {
if (newId) {
instanceStore.tabActiveKey = 'Info';
instanceStore.refresh(newId as string);
instanceStore.refresh(String(newId));
getStatus(String(newId));
}
},
{ immediate: true, deep: true },
);
onMounted(() => {
instanceStore.tabActiveKey = history.state?.params?.tab || 'Info'
})
const onBack = () => {
menuStory.jumpPage('device/Instance');
};
@ -282,7 +284,7 @@ watchEffect(() => {
tab: 'OPC UA',
});
}
if (instanceStore.current.deviceType?.value === 'gateway') {
if (instanceStore.current.deviceType?.value === 'gateway' && !keys.includes('ChildDevice')) {
//
list.value.push({
key: 'ChildDevice',

View File

@ -1,6 +1,6 @@
<template>
<page-container>
<j-advanced-search
<pro-search
:columns="columns"
target="device-instance"
@search="handleSearch"
@ -289,6 +289,7 @@ import { queryTree } from '@/api/device/category';
import { useMenuStore } from '@/store/menu';
import type { ActionsType } from './typings';
import dayjs from 'dayjs';
import { throttle } from 'lodash-es';
const instanceRef = ref<Record<string, any>>({});
const params = ref<Record<string, any>>({});
@ -315,7 +316,7 @@ const columns = [
key: 'id',
search: {
type: 'string',
defaultTermType: 'eq'
defaultTermType: 'eq',
},
},
{
@ -324,7 +325,7 @@ const columns = [
key: 'name',
search: {
type: 'string',
first: true
first: true,
},
},
{
@ -524,6 +525,12 @@ const paramsFormat = (
}
};
onMounted(() => {
if(history.state?.params?.type === 'add'){
handleAdd()
}
})
const handleParams = (config: Record<string, any>) => {
const _terms: Record<string, any> = {};
paramsFormat(config, _terms);

View File

@ -343,6 +343,11 @@
@cancel="onPropsCancel"
/>
</template>
<TriggerAlarm
:id="_data.id"
v-if="triggerVisible"
@close="triggerVisible = false"
/>
</div>
</template>
@ -353,6 +358,12 @@ import { PropType } from 'vue';
import { ActionsType, ParallelType } from '../../../typings';
import Modal from '../Modal/index.vue';
import ActionTypeComponent from '../Modal/ActionTypeComponent.vue';
import TriggerAlarm from '../TriggerAlarm/index.vue';
import { useSceneStore } from '@/store/scene';
import { storeToRefs } from 'pinia';
const sceneStore = useSceneStore();
const { data: _data } = storeToRefs(sceneStore);
const props = defineProps({
branchesName: {
@ -438,8 +449,8 @@ const onAdd = () => {
};
const onType = (_type: string) => {
actionType.value = _type
}
actionType.value = _type;
};
const onPropsOk = (data: ActionsType, options?: any) => {
emit('update', data, options);

View File

@ -0,0 +1,131 @@
<template>
<j-modal
:width="1000"
@cancel="emit('close')"
@ok="emit('close')"
visible
title="关联此场景的告警"
>
<div style="margin-bottom: 24px">关联告警数量{{ count }}</div>
<JProTable
:columns="columns"
:request="queryAlarmList"
model="TABLE"
:bodyStyle="{ padding: 0 }"
:defaultParams="{
sorts: [{ name: 'createTime', order: 'desc' }],
terms: [
{
terms: [
{
column: 'id',
value: id,
termType: 'rule-bind-alarm',
},
],
},
],
}"
>
<template #level="slotProps">
{{ levelList.find(i => slotProps.level === i.level)?.title || '' }}
</template>
<template #targetType="slotProps">
{{ map[slotProps.targetType] }}
</template>
<template #state="slotProps">
<j-badge
:text="slotProps.state?.text"
:status="
slotProps.state?.value === 'disabled'
? 'error'
: 'success'
"
/>
</template>
</JProTable>
</j-modal>
</template>
<script setup lang="ts">
import { queryAlarmList } from '@/api/rule-engine/scene';
import {
getAlarmLevel,
getAlarmConfigCount,
} from '@/api/rule-engine/dashboard';
const props = defineProps({
id: {
type: String,
default: '',
},
});
const emit = defineEmits(['close']);
const count = ref<number>(0);
const levelList = ref<any[]>([]);
const map = {
product: '产品',
device: '设备',
org: '组织',
other: '其他',
};
const columns = [
{
dataIndex: 'name',
fixed: 'left',
ellipsis: true,
title: '名称',
},
{
dataIndex: 'targetType',
title: '类型',
scopedSlots: true,
},
{
dataIndex: 'level',
title: '告警级别',
scopedSlots: true,
},
{
dataIndex: 'state',
title: '状态',
scopedSlots: true,
},
{
dataIndex: 'description',
title: '说明',
ellipsis: true,
},
];
watch(
() => props.id,
(newId) => {
if (newId) {
getAlarmConfigCount({
terms: [
{
column: 'id$rule-bind-alarm',
value: newId,
},
],
}).then((resp) => {
if (resp.status === 200) {
count.value = (resp.result || 0) as number;
}
});
}
},
{ immediate: true },
);
onMounted(() => {
getAlarmLevel().then((resp) => {
if (resp.status === 200) {
levelList.value = resp.result?.levels || []
}
});
});
</script>