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