Merge branch 'dev' of github.com:jetlinks/jetlinks-ui-vue into dev
This commit is contained in:
commit
cb314ecad8
|
@ -104,7 +104,7 @@
|
|||
</div>
|
||||
</template>
|
||||
<script setup lang="ts" name="Debug">
|
||||
import { PropType } from 'vue';
|
||||
import {PropType, Ref} from 'vue';
|
||||
import { useProductStore } from '@/store/product';
|
||||
import { useRuleEditorStore } from '@/store/ruleEditor';
|
||||
import moment from 'moment';
|
||||
|
@ -160,7 +160,7 @@ const deleteItem = (index: number) => {
|
|||
const ws = ref();
|
||||
|
||||
const virtualIdRef = ref(new Date().getTime());
|
||||
|
||||
const medataSource = inject<Ref<any[]>>('_dataSource')
|
||||
const productStore = useProductStore();
|
||||
const ruleEditorStore = useRuleEditorStore();
|
||||
const runScript = () => {
|
||||
|
@ -254,9 +254,9 @@ onUnmounted(() => {
|
|||
const options = ref<{ text: string; value: string }[]>([]);
|
||||
|
||||
const getProperty = () => {
|
||||
const metadata = productStore.current.metadata || '{}';
|
||||
const _p: PropertyMetadata[] = JSON.parse(metadata).properties || [];
|
||||
options.value = _p
|
||||
// const metadata = productStore.current.metadata || '{}';
|
||||
// const _p: PropertyMetadata[] = JSON.parse(metadata).properties || [];
|
||||
options.value = (medataSource.value || [])
|
||||
.filter((p) => p.id !== props.id)
|
||||
.map((item) => ({
|
||||
text: item.name,
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
:visible="true"
|
||||
width="700px"
|
||||
@cancel="handleCancel"
|
||||
:destroyOnClose="true"
|
||||
>
|
||||
<div class="sizeText">
|
||||
将批量修改
|
||||
|
@ -86,7 +87,6 @@
|
|||
<script lang="ts" setup>
|
||||
import type { FormInstance } from 'ant-design-vue';
|
||||
import { savePointBatch } from '@/api/data-collect/collector';
|
||||
import { Rule } from 'ant-design-vue/lib/form';
|
||||
import { cloneDeep, isObject } from 'lodash';
|
||||
import { regOnlyNumber } from '../../../data';
|
||||
|
||||
|
@ -107,15 +107,6 @@ const formData = ref({
|
|||
features: [],
|
||||
});
|
||||
|
||||
const checkLength = (_rule: Rule, value: string): Promise<any> =>
|
||||
new Promise(async (resolve, reject) => {
|
||||
if (value) {
|
||||
return String(value).length > 64
|
||||
? reject('最多可输入64个字符')
|
||||
: resolve('');
|
||||
}
|
||||
});
|
||||
|
||||
const handleOk = async () => {
|
||||
const data = cloneDeep(formData.value);
|
||||
const { accessModes, features, interval } = data;
|
||||
|
@ -136,7 +127,11 @@ const handleOk = async () => {
|
|||
);
|
||||
}
|
||||
}
|
||||
features.length !== 0 && (i.features = data.features);
|
||||
if(features.length !== 0) {
|
||||
i.features = data.features
|
||||
} else {
|
||||
i.features = i.features.map((it: any) =>it.value)
|
||||
}
|
||||
if (!!interval || Number(interval) === 0) {
|
||||
i.interval = data.interval;
|
||||
i.configuration = {
|
||||
|
@ -157,10 +152,6 @@ const handleOk = async () => {
|
|||
const handleCancel = () => {
|
||||
emit('change', false);
|
||||
};
|
||||
|
||||
const filterOption = (input: string, option: any) => {
|
||||
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
}"
|
||||
serial
|
||||
@editStatus="editStatusChange"
|
||||
@change="(data) => dataSourceCache = data"
|
||||
>
|
||||
<template #expand>
|
||||
<PermissionButton
|
||||
|
@ -249,8 +250,9 @@ const detailData = reactive({
|
|||
const showSave = ref(metadata.value.length !== 0)
|
||||
|
||||
const showLastDelete = ref(false)
|
||||
const dataSourceCache = ref<any[]>([])
|
||||
|
||||
provide('_dataSource', dataSource.value)
|
||||
provide('_dataSource', dataSourceCache)
|
||||
|
||||
const showDetail = (data: any) => {
|
||||
detailData.data = data
|
||||
|
|
|
@ -38,6 +38,10 @@ const type = {
|
|||
};
|
||||
|
||||
export const validatorConfig = (value: any, isObject: boolean = false) => {
|
||||
if (!value) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
if (value.type === 'enum' && !value.elements?.length) {
|
||||
return Promise.reject('请添加枚举项')
|
||||
}
|
||||
|
|
|
@ -75,6 +75,7 @@
|
|||
]"
|
||||
show-search
|
||||
placeholder="请选择窗口类型"
|
||||
@select="windowTypeChange"
|
||||
/>
|
||||
</j-form-item>
|
||||
<template
|
||||
|
@ -159,7 +160,7 @@ import {
|
|||
} from '@/api/device/product';
|
||||
import { useInstanceStore } from '@/store/instance';
|
||||
import { useProductStore } from '@/store/product';
|
||||
import { PropType } from 'vue';
|
||||
import {PropType, Ref} from 'vue';
|
||||
import { ReadType } from '@/components/Metadata/components';
|
||||
|
||||
type SourceType = 'device' | 'manual' | 'rule';
|
||||
|
@ -224,7 +225,14 @@ const formData = reactive<{
|
|||
virtualRule: undefined,
|
||||
});
|
||||
|
||||
const dataSource = inject<any[]>('_dataSource')
|
||||
const dataSource = inject<Ref<any[]>>('_dataSource')
|
||||
|
||||
const windowTypeChange = () => {
|
||||
formData.virtualRule!.rule.window = {
|
||||
span: undefined,
|
||||
every: undefined
|
||||
}
|
||||
}
|
||||
|
||||
const typeOptions = computed(() => {
|
||||
if (props.source === 'manual') {
|
||||
|
@ -241,7 +249,7 @@ const typeOptions = computed(() => {
|
|||
});
|
||||
|
||||
const options = computed(() => {
|
||||
return dataSource?.filter((item: any) => item?.id !== props.value?.id);
|
||||
return (dataSource?.value || []).filter((item: any) => item?.id !== props.value?.id);
|
||||
});
|
||||
|
||||
const handleSearch = async () => {
|
||||
|
|
|
@ -90,10 +90,14 @@ const route = useRoute();
|
|||
let selectDisable = ref(false);
|
||||
const alarmConfigurationStore = useAlarmConfigurationStore();
|
||||
let { configurationData } = storeToRefs(alarmConfigurationStore);
|
||||
|
||||
const emit = defineEmits(['change'])
|
||||
|
||||
const queryData = () => {
|
||||
if (route.query?.id) {
|
||||
detail(route.query?.id).then((res) => {
|
||||
if (res.status === 200) {
|
||||
emit('change', res?.result?.targetType)
|
||||
form.value = res?.result;
|
||||
// form.level = res?.result?.level;
|
||||
// form.name = res?.result?.name;
|
||||
|
@ -205,6 +209,7 @@ const handleSave = async () => {
|
|||
if (res.status === 200) {
|
||||
onlyMessage('操作成功,请配置关联的场景联动');
|
||||
loading.value = false;
|
||||
emit('change', form.value.targetType)
|
||||
if (res.result?.id) {
|
||||
menuStory.jumpPage(
|
||||
'rule-engine/Alarm/Configuration/Save',
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div>
|
||||
<TabComponent type="detail" :id="id"/>
|
||||
<TabComponent :id="id" :type="type"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -9,6 +9,13 @@ import TabComponent from '@/views/rule-engine/Alarm/Log/TabComponent/index.vue'
|
|||
import { useRoute } from 'vue-router';
|
||||
const route = useRoute();
|
||||
const id = route.query?.id
|
||||
|
||||
const props = defineProps({
|
||||
type: {
|
||||
type: String,
|
||||
default: 'detail'
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
</style>
|
|
@ -3,13 +3,13 @@
|
|||
<j-card>
|
||||
<j-tabs :activeKey="activeKey" @change="changeTabs">
|
||||
<j-tab-pane key="1" tab="基础配置">
|
||||
<Base v-if="activeKey === '1'" />
|
||||
<Base v-if="activeKey === '1'" @change="typeChange" />
|
||||
</j-tab-pane>
|
||||
<j-tab-pane key="2" tab="关联场景联动">
|
||||
<Scene></Scene>
|
||||
</j-tab-pane>
|
||||
<j-tab-pane key="3" tab="告警记录">
|
||||
<Log v-if="activeKey === '3'" />
|
||||
<Log v-if="activeKey === '3'" :type="type" />
|
||||
</j-tab-pane>
|
||||
</j-tabs>
|
||||
</j-card>
|
||||
|
@ -31,6 +31,12 @@ const changeTabs = (e: any) => {
|
|||
}
|
||||
};
|
||||
const activeKey = ref('1');
|
||||
const type = ref('detail')
|
||||
|
||||
const typeChange = (_type: string) => {
|
||||
console.log(_type)
|
||||
type.value = _type
|
||||
}
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
</style>
|
|
@ -1,35 +1,11 @@
|
|||
<template>
|
||||
<div class="alarm-log-card">
|
||||
<pro-search
|
||||
:columns="columns"
|
||||
:columns="newColumns"
|
||||
:target="`alarm-log-${props.type}`"
|
||||
v-if="['all', 'detail'].includes(props.type)"
|
||||
@search="search"
|
||||
/>
|
||||
<pro-search
|
||||
:columns="productCol"
|
||||
:target="`alarm-log-${props.type}`"
|
||||
v-else-if="props.type === 'product'"
|
||||
@search="search"
|
||||
/>
|
||||
<pro-search
|
||||
:columns="deviceCol"
|
||||
target="alarm-log-device"
|
||||
v-else-if="props.type === 'device'"
|
||||
@search="search"
|
||||
/>
|
||||
<pro-search
|
||||
:columns="orgCol"
|
||||
target="alarm-log-org"
|
||||
v-else-if="props.type === 'org'"
|
||||
@search="search"
|
||||
/>
|
||||
<pro-search
|
||||
:columns="otherCol"
|
||||
:target="`alarm-log-${props.type}`"
|
||||
v-else-if="props.type === 'other'"
|
||||
@search="search"
|
||||
/>
|
||||
|
||||
<FullPage>
|
||||
<JProTable
|
||||
:columns="columns"
|
||||
|
@ -246,123 +222,76 @@ const columns = [
|
|||
},
|
||||
},
|
||||
];
|
||||
const productCol = [
|
||||
...columns,
|
||||
{
|
||||
title: '产品名称',
|
||||
dataIndex: 'sourceId',
|
||||
key: 'sourceId',
|
||||
search: {
|
||||
type: 'select',
|
||||
options: async () => {
|
||||
const resp = await handleSearch({
|
||||
sorts: [{ name: 'alarmTime', order: 'desc' }],
|
||||
terms: [{
|
||||
column: "targetType",
|
||||
termType: "eq",
|
||||
type: "and",
|
||||
value: "product",
|
||||
}]
|
||||
});
|
||||
if (resp.status === 200) {
|
||||
return resp.result.data.map((item: any) => ({
|
||||
label: item.sourceName,
|
||||
value: item.sourceId,
|
||||
}));
|
||||
}
|
||||
return [];
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
const deviceCol = [
|
||||
...columns,
|
||||
{
|
||||
title: '设备名称',
|
||||
dataIndex: 'sourceId',
|
||||
key: 'sourceId',
|
||||
search: {
|
||||
type: 'select',
|
||||
options: async () => {
|
||||
const resp = await handleSearch({
|
||||
sorts: [{ name: 'alarmTime', order: 'desc' }],
|
||||
terms: [{
|
||||
column: "targetType",
|
||||
termType: "eq",
|
||||
type: "and",
|
||||
value: "device",
|
||||
}]
|
||||
});
|
||||
if (resp.status === 200) {
|
||||
return resp.result.data.map((item: any) => ({
|
||||
label: item.sourceName,
|
||||
value: item.sourceId,
|
||||
}));
|
||||
}
|
||||
return [];
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
const orgCol = [
|
||||
...columns,
|
||||
{
|
||||
title: '组织名称',
|
||||
dataIndex: 'sourceId',
|
||||
key: 'sourceId',
|
||||
search: {
|
||||
type: 'select',
|
||||
options: async () => {
|
||||
const resp = await handleSearch({
|
||||
sorts: [{ name: 'alarmTime', order: 'desc' }],
|
||||
terms: [{
|
||||
column: "targetType",
|
||||
termType: "eq",
|
||||
type: "and",
|
||||
value: "org",
|
||||
}]
|
||||
});
|
||||
if (resp.status === 200) {
|
||||
return resp.result.data.map((item: any) => ({
|
||||
label: item.sourceName,
|
||||
value: item.sourceId,
|
||||
}));
|
||||
}
|
||||
return [];
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const otherCol = [
|
||||
...columns,
|
||||
{
|
||||
title: '场景名称',
|
||||
const newColumns = computed(() => {
|
||||
|
||||
const otherColumns = {
|
||||
title: '产品名称',
|
||||
dataIndex: 'targetId',
|
||||
key: 'targetId',
|
||||
search: {
|
||||
type: 'select',
|
||||
options: async () => {
|
||||
const resp = await handleSearch({
|
||||
sorts: [{ name: 'alarmTime', order: 'desc' }],
|
||||
terms: [{
|
||||
const termType = [
|
||||
{
|
||||
column: "targetType",
|
||||
termType: "eq",
|
||||
type: "and",
|
||||
value: "other",
|
||||
}]
|
||||
value: props.type,
|
||||
}
|
||||
]
|
||||
|
||||
if (props.id) {
|
||||
termType.push({
|
||||
termType: 'eq',
|
||||
column: 'alarmConfigId',
|
||||
value: props.id,
|
||||
type: 'and',
|
||||
},)
|
||||
}
|
||||
|
||||
const resp: any = await handleSearch({
|
||||
sorts: [{ name: 'alarmTime', order: 'desc' }],
|
||||
terms: termType
|
||||
});
|
||||
const listMap: Map<string, any> = new Map()
|
||||
|
||||
if (resp.status === 200) {
|
||||
return resp.result.data.map((item: any) => ({
|
||||
resp.result.data.forEach(item => {
|
||||
if (item.targetId) {
|
||||
listMap.set(item.targetId, {
|
||||
label: item.targetName,
|
||||
value: item.targetId,
|
||||
}));
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
return [...listMap.values()]
|
||||
|
||||
}
|
||||
return [];
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
switch(props.type) {
|
||||
case 'device':
|
||||
otherColumns.title = '设备名称'
|
||||
break;
|
||||
case 'org':
|
||||
otherColumns.title = '组织名称'
|
||||
break;
|
||||
case 'other':
|
||||
otherColumns.title = '场景名称'
|
||||
break;
|
||||
}
|
||||
|
||||
return ['all', 'detail'].includes(props.type) ? columns : [
|
||||
otherColumns,
|
||||
...columns,
|
||||
]
|
||||
})
|
||||
|
||||
let params: any = ref({
|
||||
sorts: [{ name: 'alarmTime', order: 'desc' }],
|
||||
|
|
|
@ -3837,8 +3837,8 @@ jetlinks-ui-components@^1.0.23:
|
|||
|
||||
jetlinks-ui-components@^1.0.24:
|
||||
version "1.0.24"
|
||||
resolved "http://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.24.tgz#e973e030eb62714f7ec22202a984fa1d5e6ef451"
|
||||
integrity sha512-/3bcz76Fq7MDVHI6GKxcIPLzhPRxY0aSUowH91+SuJzkOqCRcUXhBSfVyEL6mTjg/yi8fvb4Pglfkj2fomFKFw==
|
||||
resolved "http://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.24.tgz#c912a709e666fd088d66a19bbc9cb0e9dc618355"
|
||||
integrity sha512-NTnPoAhmvT4/C+uapN/W5R9CFe3YTs3mYN9ZA7wi8ShzQHovhoJFihaOv7WWXwhcqCFPS4EjViJ1S5HPP2P2Cw==
|
||||
dependencies:
|
||||
"@vueuse/core" "^9.12.0"
|
||||
"@vueuse/router" "^9.13.0"
|
||||
|
|
Loading…
Reference in New Issue