fix: bug#16279
This commit is contained in:
parent
f7310c0e9e
commit
37267ae6d4
|
@ -42,7 +42,7 @@
|
|||
: !editStatus ? '暂无改动数据': '保存',
|
||||
placement: hasOperate('add', type) ? 'topRight' : 'top',
|
||||
}"
|
||||
@click="handleSaveClick"
|
||||
@click="handleSaveClick()"
|
||||
>
|
||||
保存
|
||||
</PermissionButton>
|
||||
|
|
|
@ -210,6 +210,17 @@ export const useColumns = (type?: MetadataType, target?: 'device' | 'product', n
|
|||
title: '配置参数',
|
||||
dataIndex: 'properties',
|
||||
width: 100,
|
||||
form: {
|
||||
required: true,
|
||||
rules: [{
|
||||
validator(_: any, value: any) {
|
||||
// if (!value?.type) {
|
||||
return Promise.reject('请选择数据类型')
|
||||
// }
|
||||
// return Promise.resolve()
|
||||
}
|
||||
}]
|
||||
},
|
||||
control(newValue, oldValue) {
|
||||
if (newValue && !oldValue) {
|
||||
return true
|
||||
|
|
|
@ -84,12 +84,24 @@ const columns = [
|
|||
}]
|
||||
},
|
||||
control(newValue: any, oldValue: any) {
|
||||
return oldValue.valueType.type !== oldValue?.valueType?.type
|
||||
return newValue.valueType?.type !== oldValue?.valueType?.type
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '其他配置',
|
||||
dataIndex: 'config',
|
||||
form: {
|
||||
required: true,
|
||||
rules: [{
|
||||
validator(_: any, value: any) {
|
||||
console.log(value)
|
||||
// if (!value?.type) {
|
||||
return Promise.reject('请选择数据类型')
|
||||
// }
|
||||
// return Promise.resolve()
|
||||
}
|
||||
}]
|
||||
},
|
||||
control(newValue: any, oldValue: any) {
|
||||
if (newValue && !oldValue) {
|
||||
return true
|
||||
|
|
|
@ -90,11 +90,38 @@ import { _execute } from '@/api/rule-engine/configuration';
|
|||
|
||||
const columns = [
|
||||
{
|
||||
title: '名称',
|
||||
title: '场景名称',
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
search: {
|
||||
type: 'string',
|
||||
type: 'select',
|
||||
options: async () => {
|
||||
const res = await query(
|
||||
{
|
||||
sorts: [
|
||||
{
|
||||
name: 'createTime',
|
||||
order: 'desc',
|
||||
},
|
||||
],
|
||||
terms: [
|
||||
{
|
||||
column: 'id',
|
||||
termType: 'alarm-bind-rule$not',
|
||||
value: props.data?.id,
|
||||
},
|
||||
{ column: 'triggerType', termType: 'eq', value: 'manual' }
|
||||
]
|
||||
}
|
||||
);
|
||||
if (res.status === 200) {
|
||||
return res.result.data.map((item: any) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
}
|
||||
return []
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -133,7 +160,7 @@ const terms = [
|
|||
terms: [
|
||||
{
|
||||
column: 'id',
|
||||
termType: 'alarm-bind-rule',
|
||||
termType: 'alarm-bind-rule$not',
|
||||
value: props.data?.id,
|
||||
},
|
||||
{
|
||||
|
|
|
@ -91,7 +91,39 @@ const columns = [
|
|||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
search: {
|
||||
type: 'string',
|
||||
type: 'select',
|
||||
options: async () => {
|
||||
const res = await query(
|
||||
{
|
||||
sorts: [
|
||||
{
|
||||
name: 'createTime',
|
||||
order: 'desc',
|
||||
},
|
||||
],
|
||||
terms: [
|
||||
{
|
||||
column: 'id',
|
||||
termType: 'alarm-bind-rule$not',
|
||||
value: props.id,
|
||||
type: 'and',
|
||||
},
|
||||
{
|
||||
column: 'triggerType',
|
||||
termType: 'eq',
|
||||
value: props.type === 'other' ? undefined : 'device',
|
||||
},
|
||||
]
|
||||
}
|
||||
);
|
||||
if (res.status === 200) {
|
||||
return res.result.data.map((item: any) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
}
|
||||
return []
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
@ -210,7 +210,7 @@ const tableRef = ref<Record<string, any>>({});
|
|||
const menuStory = useMenuStore();
|
||||
const columns = [
|
||||
{
|
||||
title: '名称',
|
||||
title: '配置名称',
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
search: {
|
||||
|
@ -279,17 +279,33 @@ const columns = [
|
|||
type: 'select',
|
||||
// defaultTermType: 'rule-bind-alarm',
|
||||
options: async () => {
|
||||
const res = await getScene(
|
||||
encodeQuery({
|
||||
sorts: { createTime: 'desc' },
|
||||
}),
|
||||
);
|
||||
if (res.status === 200) {
|
||||
return res.result.map((item: any) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
const allData = await queryList({paging: false, sorts: [{ name: 'createTime', order: 'desc' }]})
|
||||
const result = allData.result?.data as any[]
|
||||
if (allData.success && result && result.length) {
|
||||
const sceneDataMap = new Map() // 用于去重
|
||||
result.forEach(item => {
|
||||
item.scene.forEach((a: any) => {
|
||||
sceneDataMap.set(a.id, {
|
||||
label: a.name,
|
||||
value: a.id
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
return [...sceneDataMap.values()]
|
||||
}
|
||||
|
||||
// const res = await getScene(
|
||||
// encodeQuery({
|
||||
// sorts: { createTime: 'desc' },
|
||||
// }),
|
||||
// );
|
||||
// if (res.status === 200) {
|
||||
// return res.result.map((item: any) => ({
|
||||
// label: item.name,
|
||||
// value: item.id,
|
||||
// }));
|
||||
// }
|
||||
return [];
|
||||
},
|
||||
},
|
||||
|
|
|
@ -7,21 +7,27 @@
|
|||
@search="search"
|
||||
/>
|
||||
<pro-search
|
||||
:columns="produtCol"
|
||||
:columns="productCol"
|
||||
:target="`alarm-log-${props.type}`"
|
||||
v-if="['product', 'other'].includes(props.type)"
|
||||
v-else-if="props.type === 'product'"
|
||||
@search="search"
|
||||
/>
|
||||
<pro-search
|
||||
:columns="deviceCol"
|
||||
target="alarm-log-device"
|
||||
v-if="props.type === 'device'"
|
||||
v-else-if="props.type === 'device'"
|
||||
@search="search"
|
||||
/>
|
||||
<pro-search
|
||||
:columns="orgCol"
|
||||
target="alarm-log-org"
|
||||
v-if="props.type === '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>
|
||||
|
@ -194,11 +200,23 @@ titleMap.set('other', '其他');
|
|||
titleMap.set('org', '组织');
|
||||
const columns = [
|
||||
{
|
||||
title: '名称',
|
||||
dataIndex: 'alarmName',
|
||||
key: 'alarmName',
|
||||
title: '告警级别',
|
||||
dataIndex: 'level',
|
||||
key: 'level',
|
||||
search: {
|
||||
type: 'string',
|
||||
type: 'select',
|
||||
options: async () => {
|
||||
const res = await queryLevel()
|
||||
if (res.success && res.result?.levels) {
|
||||
return (res.result.levels as any[]).map((item: any) => {
|
||||
return {
|
||||
label: item.title,
|
||||
value: item.level
|
||||
}
|
||||
})
|
||||
}
|
||||
return []
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -228,20 +246,28 @@ const columns = [
|
|||
},
|
||||
},
|
||||
];
|
||||
const produtCol = [
|
||||
const productCol = [
|
||||
...columns,
|
||||
{
|
||||
title: '产品名称',
|
||||
dataIndex: 'targetName',
|
||||
key: 'targetName',
|
||||
dataIndex: 'sourceId',
|
||||
key: 'sourceId',
|
||||
search: {
|
||||
type: 'select',
|
||||
options: async () => {
|
||||
const resq = await getProductList();
|
||||
if (resq.status === 200) {
|
||||
return resq.result.map((item: any) => ({
|
||||
label: item.name,
|
||||
value: item.name,
|
||||
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 [];
|
||||
|
@ -253,16 +279,24 @@ const deviceCol = [
|
|||
...columns,
|
||||
{
|
||||
title: '设备名称',
|
||||
dataIndex: 'targetName',
|
||||
key: 'targetName',
|
||||
dataIndex: 'sourceId',
|
||||
key: 'sourceId',
|
||||
search: {
|
||||
type: 'select',
|
||||
options: async () => {
|
||||
const res = await getDeviceList();
|
||||
if (res.status === 200) {
|
||||
return res.result.map((item: any) => ({
|
||||
label: item.name,
|
||||
value: item.name,
|
||||
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 [];
|
||||
|
@ -274,16 +308,24 @@ const orgCol = [
|
|||
...columns,
|
||||
{
|
||||
title: '组织名称',
|
||||
dataIndex: 'targetName',
|
||||
key: 'targetName',
|
||||
dataIndex: 'sourceId',
|
||||
key: 'sourceId',
|
||||
search: {
|
||||
type: 'select',
|
||||
options: async () => {
|
||||
const res = await getOrgList();
|
||||
if (res.status === 200) {
|
||||
return res.result.map((item: any) => ({
|
||||
label: item.name,
|
||||
value: item.name,
|
||||
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 [];
|
||||
|
@ -292,6 +334,36 @@ const orgCol = [
|
|||
},
|
||||
];
|
||||
|
||||
const otherCol = [
|
||||
...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: "other",
|
||||
}]
|
||||
});
|
||||
if (resp.status === 200) {
|
||||
return resp.result.data.map((item: any) => ({
|
||||
label: item.sourceName,
|
||||
value: item.sourceId,
|
||||
}));
|
||||
}
|
||||
return [];
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
let params: any = ref({
|
||||
sorts: [{ name: 'alarmTime', order: 'desc' }],
|
||||
terms: [],
|
||||
|
|
|
@ -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#969a901be0214d3e631f02e537c56e0abc2e48ab"
|
||||
integrity sha512-t0XkbxldcKjXW/xPYYbBU8YEfK+RK01LYqS/n+wfMq3pPRksegBOt7gnsvJD6kgEpSNf/uzlnV9MWFOgQJFphg==
|
||||
resolved "http://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.24.tgz#4163dab623d0b51e9280195f69b3eef8f039a637"
|
||||
integrity sha512-hecgnwgrtPMwa08kYTQQuFrRajSGi6R0mJiFRpyPY0481C7AllhbHDdLscVSxsS7vuielznelUN6bWsonVuK9w==
|
||||
dependencies:
|
||||
"@vueuse/core" "^9.12.0"
|
||||
"@vueuse/router" "^9.13.0"
|
||||
|
|
Loading…
Reference in New Issue