diff --git a/src/views/rule-engine/Alarm/Configuration/Save/Base/index.vue b/src/views/rule-engine/Alarm/Configuration/Save/Base/index.vue
index ede6e22c..f7941de7 100644
--- a/src/views/rule-engine/Alarm/Configuration/Save/Base/index.vue
+++ b/src/views/rule-engine/Alarm/Configuration/Save/Base/index.vue
@@ -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',
diff --git a/src/views/rule-engine/Alarm/Configuration/Save/Log/indev.vue b/src/views/rule-engine/Alarm/Configuration/Save/Log/indev.vue
index 15d197f3..80f3ed62 100644
--- a/src/views/rule-engine/Alarm/Configuration/Save/Log/indev.vue
+++ b/src/views/rule-engine/Alarm/Configuration/Save/Log/indev.vue
@@ -1,6 +1,6 @@
-
+
@@ -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'
+ }
+})
\ No newline at end of file
diff --git a/src/views/rule-engine/Alarm/Configuration/Save/index.vue b/src/views/rule-engine/Alarm/Configuration/Save/index.vue
index 011e2721..a011c493 100644
--- a/src/views/rule-engine/Alarm/Configuration/Save/index.vue
+++ b/src/views/rule-engine/Alarm/Configuration/Save/index.vue
@@ -3,13 +3,13 @@
-
+
-
+
@@ -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
+}
\ No newline at end of file
diff --git a/src/views/rule-engine/Alarm/Log/TabComponent/index.vue b/src/views/rule-engine/Alarm/Log/TabComponent/index.vue
index 6fd18e41..f45429f1 100644
--- a/src/views/rule-engine/Alarm/Log/TabComponent/index.vue
+++ b/src/views/rule-engine/Alarm/Log/TabComponent/index.vue
@@ -1,35 +1,11 @@
-
-
-
-
+
{
- 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 = new Map()
+
if (resp.status === 200) {
- return resp.result.data.map((item: any) => ({
- label: item.targetName,
- value: item.targetId,
- }));
+ 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' }],
diff --git a/src/views/rule-engine/Alarm/Log/TabComponent/util.ts b/src/views/rule-engine/Alarm/Log/TabComponent/util.ts
new file mode 100644
index 00000000..e69de29b