报警弹框操作增加禁用逻辑和禁选逻辑
This commit is contained in:
parent
330f7cc809
commit
3ecc0558b1
@ -63,6 +63,8 @@ export interface Item {
|
||||
drivingInfo: string;
|
||||
submissionInfo: string;
|
||||
alarmStatus: number;
|
||||
lineId: number;
|
||||
lineType: string;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -49,11 +49,22 @@
|
||||
/>
|
||||
<q-card-actions align="left">
|
||||
<div class="q-gutter-md">
|
||||
<q-btn color="primary" label="确认" type="submit" />
|
||||
<q-btn color="red" label="误报" @click="falseAlarm" />
|
||||
<q-btn
|
||||
color="primary"
|
||||
label="确认"
|
||||
:disable="operateDisabled"
|
||||
type="submit"
|
||||
/>
|
||||
<q-btn
|
||||
color="red"
|
||||
label="误报"
|
||||
:disable="operateDisabled"
|
||||
@click="falseAlarm"
|
||||
/>
|
||||
<q-btn
|
||||
color="primary"
|
||||
label="人工接警"
|
||||
:disable="operateDisabled"
|
||||
@click="manualAlarm"
|
||||
/>
|
||||
</div>
|
||||
@ -88,7 +99,7 @@
|
||||
<script setup lang="ts">
|
||||
import DraggableDialog from '../common/DraggableDialog.vue';
|
||||
import { useLineNetStore, AlarmInfo } from 'src/stores/line-net-store';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { QForm, useQuasar } from 'quasar';
|
||||
import { saveAlertTypeData, showAlertTypeData } from './alarmInfoEnum';
|
||||
import {
|
||||
@ -97,6 +108,8 @@ import {
|
||||
recordManualAlarmInfoById,
|
||||
} from 'src/api/AlertMock';
|
||||
import { queryAlarmInfoById } from 'src/api/DecisionInfo';
|
||||
import { useUserStore } from 'src/stores/user-store';
|
||||
import { getMonitorPath } from 'src/router/routes';
|
||||
|
||||
const props = defineProps<{
|
||||
alarmMeaasge?: AlarmInfo;
|
||||
@ -124,6 +137,7 @@ const alarmInfo = ref({
|
||||
level: '',
|
||||
time: '',
|
||||
lineId: '',
|
||||
lineType: '',
|
||||
alertObject: '',
|
||||
alertType: '',
|
||||
locator_device_id: '',
|
||||
@ -203,6 +217,7 @@ function updata() {
|
||||
];
|
||||
alarmInfo.value.alertObject = messageUse.alert_object.replace(/\[|]/g, '');
|
||||
alarmInfo.value.lineId = messageUse.line_id;
|
||||
alarmInfo.value.lineType = messageUse.line_type;
|
||||
}
|
||||
|
||||
async function searchByTipType() {
|
||||
@ -237,6 +252,15 @@ async function searchById() {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const userStore = useUserStore();
|
||||
const operateDisabled = computed(() => {
|
||||
const config = getMonitorPath(userStore.roles);
|
||||
const disabled =
|
||||
config.lineType == alarmInfo.value.lineType &&
|
||||
config.lineIds.includes(+alarmInfo.value.lineId);
|
||||
return !disabled;
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
|
@ -274,6 +274,13 @@ const columnDefs: QTableColumn[] = [
|
||||
field: 'lineId',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
name: 'lineType',
|
||||
label: '线路类型',
|
||||
field: 'lineType',
|
||||
required: true,
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
name: 'alertObject',
|
||||
label: '设备',
|
||||
@ -392,8 +399,12 @@ watch(
|
||||
);
|
||||
|
||||
function updateSelect() {
|
||||
const config = getMonitorPath(userStore.roles);
|
||||
for (let i = 0; i < selected.value.length; i++) {
|
||||
if (selected.value[i].alarmStatus !== -1) {
|
||||
const canSelect =
|
||||
config.lineType == selected.value[i].lineType &&
|
||||
config.lineIds.includes(+selected.value[i].lineId);
|
||||
if (selected.value[i].alarmStatus !== -1 || !canSelect) {
|
||||
selected.value.splice(i, 1);
|
||||
i--;
|
||||
}
|
||||
@ -538,6 +549,7 @@ function openAlarmDialog(row: any) {
|
||||
row.alert_time = row.alertTime;
|
||||
row.alert_type = row.alertType;
|
||||
row.line_id = row.lineId;
|
||||
row.line_type = row.lineType;
|
||||
row.alert_object = row.alertObject;
|
||||
row.alert_tip_id = row.alertTipId;
|
||||
row.alert_location_id = row.alertLocationId;
|
||||
|
@ -87,6 +87,7 @@ export namespace alert {
|
||||
locator_device_id?: string;
|
||||
alert_location_id?: number;
|
||||
mock?: boolean;
|
||||
line_type?: string;
|
||||
}) {
|
||||
super();
|
||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
||||
@ -121,6 +122,9 @@ export namespace alert {
|
||||
if ("mock" in data && data.mock != undefined) {
|
||||
this.mock = data.mock;
|
||||
}
|
||||
if ("line_type" in data && data.line_type != undefined) {
|
||||
this.line_type = data.line_type;
|
||||
}
|
||||
}
|
||||
}
|
||||
get id() {
|
||||
@ -183,6 +187,12 @@ export namespace alert {
|
||||
set mock(value: boolean) {
|
||||
pb_1.Message.setField(this, 10, value);
|
||||
}
|
||||
get line_type() {
|
||||
return pb_1.Message.getFieldWithDefault(this, 11, "") as string;
|
||||
}
|
||||
set line_type(value: string) {
|
||||
pb_1.Message.setField(this, 11, value);
|
||||
}
|
||||
static fromObject(data: {
|
||||
id?: string;
|
||||
level?: string;
|
||||
@ -194,6 +204,7 @@ export namespace alert {
|
||||
locator_device_id?: string;
|
||||
alert_location_id?: number;
|
||||
mock?: boolean;
|
||||
line_type?: string;
|
||||
}): Message {
|
||||
const message = new Message({});
|
||||
if (data.id != null) {
|
||||
@ -226,6 +237,9 @@ export namespace alert {
|
||||
if (data.mock != null) {
|
||||
message.mock = data.mock;
|
||||
}
|
||||
if (data.line_type != null) {
|
||||
message.line_type = data.line_type;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
toObject() {
|
||||
@ -240,6 +254,7 @@ export namespace alert {
|
||||
locator_device_id?: string;
|
||||
alert_location_id?: number;
|
||||
mock?: boolean;
|
||||
line_type?: string;
|
||||
} = {};
|
||||
if (this.id != null) {
|
||||
data.id = this.id;
|
||||
@ -271,6 +286,9 @@ export namespace alert {
|
||||
if (this.mock != null) {
|
||||
data.mock = this.mock;
|
||||
}
|
||||
if (this.line_type != null) {
|
||||
data.line_type = this.line_type;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
serialize(): Uint8Array;
|
||||
@ -297,6 +315,8 @@ export namespace alert {
|
||||
writer.writeInt64(9, this.alert_location_id);
|
||||
if (this.mock != false)
|
||||
writer.writeBool(10, this.mock);
|
||||
if (this.line_type.length)
|
||||
writer.writeString(11, this.line_type);
|
||||
if (!w)
|
||||
return writer.getResultBuffer();
|
||||
}
|
||||
@ -336,6 +356,9 @@ export namespace alert {
|
||||
case 10:
|
||||
message.mock = reader.readBool();
|
||||
break;
|
||||
case 11:
|
||||
message.line_type = reader.readString();
|
||||
break;
|
||||
default: reader.skipField();
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ export interface AlarmInfo {
|
||||
alert_time: string;
|
||||
alert_tip_id: number;
|
||||
line_id: string;
|
||||
line_type: string;
|
||||
alert_object: string;
|
||||
alert_type: number;
|
||||
locator_device_id: string;
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit c20feed4b6ae3bdd02cb21b4cc5af03c55be869b
|
||||
Subproject commit 4f9012b0795f62bf352b078ebbc1b1fffa86849d
|
Loading…
Reference in New Issue
Block a user