Compare commits
17 Commits
c4ee11a520
...
40d57a3fc8
Author | SHA1 | Date | |
---|---|---|---|
|
40d57a3fc8 | ||
|
c5cee6ee5c | ||
|
3ecc0558b1 | ||
|
330f7cc809 | ||
|
2a7cf2e186 | ||
|
fb18c04248 | ||
|
b6d345426f | ||
|
b8d08b40bb | ||
|
2676d4d1d8 | ||
|
5044db830b | ||
|
31ae2f378d | ||
|
c7d5464276 | ||
|
c77612e4dc | ||
|
199e775f81 | ||
|
e90c25523e | ||
|
00da31059b | ||
|
012340628a |
@ -63,6 +63,8 @@ export interface Item {
|
|||||||
drivingInfo: string;
|
drivingInfo: string;
|
||||||
submissionInfo: string;
|
submissionInfo: string;
|
||||||
alarmStatus: number;
|
alarmStatus: number;
|
||||||
|
lineId: number;
|
||||||
|
lineType: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,6 +25,7 @@ export interface RoleInfo {
|
|||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
resList: number[];
|
resList: number[];
|
||||||
|
roleConfigStr: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -77,6 +78,19 @@ export async function getRoleInfo(id: number): Promise<RoleInfo> {
|
|||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色配置
|
||||||
|
* @param id 角色id
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
export function roleConfig(id: number, data: string) {
|
||||||
|
return api.post(`${AuthBase}/config/${id}`, data, {
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'text/plain',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
interface LinkRole {
|
interface LinkRole {
|
||||||
id: number;
|
id: number;
|
||||||
roleList: number[];
|
roleList: number[];
|
||||||
|
@ -47,7 +47,7 @@ const userStore = useUserStore();
|
|||||||
const list = reactive([
|
const list = reactive([
|
||||||
{
|
{
|
||||||
show: true,
|
show: true,
|
||||||
path: getMonitorPath(userStore.roles),
|
path: getMonitorPath(userStore.roles).monitorPath,
|
||||||
label: '监控',
|
label: '监控',
|
||||||
icon: 'computer',
|
icon: 'computer',
|
||||||
},
|
},
|
||||||
|
@ -49,11 +49,22 @@
|
|||||||
/>
|
/>
|
||||||
<q-card-actions align="left">
|
<q-card-actions align="left">
|
||||||
<div class="q-gutter-md">
|
<div class="q-gutter-md">
|
||||||
<q-btn color="primary" label="确认" type="submit" />
|
<q-btn
|
||||||
<q-btn color="red" label="误报" @click="falseAlarm" />
|
color="primary"
|
||||||
|
label="确认"
|
||||||
|
:disable="operateDisabled"
|
||||||
|
type="submit"
|
||||||
|
/>
|
||||||
|
<q-btn
|
||||||
|
color="red"
|
||||||
|
label="误报"
|
||||||
|
:disable="operateDisabled"
|
||||||
|
@click="falseAlarm"
|
||||||
|
/>
|
||||||
<q-btn
|
<q-btn
|
||||||
color="primary"
|
color="primary"
|
||||||
label="人工接警"
|
label="人工接警"
|
||||||
|
:disable="operateDisabled"
|
||||||
@click="manualAlarm"
|
@click="manualAlarm"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -88,7 +99,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import DraggableDialog from '../common/DraggableDialog.vue';
|
import DraggableDialog from '../common/DraggableDialog.vue';
|
||||||
import { useLineNetStore, AlarmInfo } from 'src/stores/line-net-store';
|
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 { QForm, useQuasar } from 'quasar';
|
||||||
import { saveAlertTypeData, showAlertTypeData } from './alarmInfoEnum';
|
import { saveAlertTypeData, showAlertTypeData } from './alarmInfoEnum';
|
||||||
import {
|
import {
|
||||||
@ -97,6 +108,8 @@ import {
|
|||||||
recordManualAlarmInfoById,
|
recordManualAlarmInfoById,
|
||||||
} from 'src/api/AlertMock';
|
} from 'src/api/AlertMock';
|
||||||
import { queryAlarmInfoById } from 'src/api/DecisionInfo';
|
import { queryAlarmInfoById } from 'src/api/DecisionInfo';
|
||||||
|
import { useUserStore } from 'src/stores/user-store';
|
||||||
|
import { getMonitorPath } from 'src/router/routes';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
alarmMeaasge?: AlarmInfo;
|
alarmMeaasge?: AlarmInfo;
|
||||||
@ -124,6 +137,7 @@ const alarmInfo = ref({
|
|||||||
level: '',
|
level: '',
|
||||||
time: '',
|
time: '',
|
||||||
lineId: '',
|
lineId: '',
|
||||||
|
lineType: '',
|
||||||
alertObject: '',
|
alertObject: '',
|
||||||
alertType: '',
|
alertType: '',
|
||||||
locator_device_id: '',
|
locator_device_id: '',
|
||||||
@ -203,6 +217,7 @@ function updata() {
|
|||||||
];
|
];
|
||||||
alarmInfo.value.alertObject = messageUse.alert_object.replace(/\[|]/g, '');
|
alarmInfo.value.alertObject = messageUse.alert_object.replace(/\[|]/g, '');
|
||||||
alarmInfo.value.lineId = messageUse.line_id;
|
alarmInfo.value.lineId = messageUse.line_id;
|
||||||
|
alarmInfo.value.lineType = messageUse.line_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function searchByTipType() {
|
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>
|
</script>
|
||||||
|
|
||||||
<style lang='scss' scoped>
|
<style lang='scss' scoped>
|
||||||
|
@ -73,6 +73,8 @@ import {
|
|||||||
import { Notify, QNotifyUpdateOptions } from 'quasar';
|
import { Notify, QNotifyUpdateOptions } from 'quasar';
|
||||||
import { useLineNetStore } from 'src/stores/line-net-store';
|
import { useLineNetStore } from 'src/stores/line-net-store';
|
||||||
import { alert } from 'src/protos/alertInfo';
|
import { alert } from 'src/protos/alertInfo';
|
||||||
|
import { useUserStore } from 'src/stores/user-store';
|
||||||
|
import { getMonitorPath } from 'src/router/routes';
|
||||||
|
|
||||||
let lineApp: IGraphicApp | null = null;
|
let lineApp: IGraphicApp | null = null;
|
||||||
|
|
||||||
@ -304,11 +306,14 @@ function handleSubscribe(lineApp: IGraphicApp) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
const lineNetStore = useLineNetStore();
|
const lineNetStore = useLineNetStore();
|
||||||
|
const userStore = useUserStore();
|
||||||
|
getMonitorPath(userStore.roles).destinations.forEach((destination) => {
|
||||||
lineApp.subscribe({
|
lineApp.subscribe({
|
||||||
destination: '/queue/xian/ncc/alert',
|
destination,
|
||||||
messageHandle: (message: Uint8Array) => {
|
messageHandle: (message: Uint8Array) => {
|
||||||
const storage = alert.NccAlertInfoMessage.deserialize(message);
|
const storage = alert.NccAlertInfoMessage.deserialize(message);
|
||||||
lineNetStore.setAlarmInfo(storage.messages as []);
|
lineNetStore.setAlarmInfo(storage.messages as []);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,8 @@ import { getWebsocketUrl } from 'src/configs/UrlManage';
|
|||||||
import { getJwtToken } from 'src/configs/TokenManage';
|
import { getJwtToken } from 'src/configs/TokenManage';
|
||||||
import { alert } from 'src/protos/alertInfo';
|
import { alert } from 'src/protos/alertInfo';
|
||||||
import { Notify } from 'quasar';
|
import { Notify } from 'quasar';
|
||||||
|
import { useUserStore } from 'src/stores/user-store';
|
||||||
|
import { getMonitorPath } from 'src/router/routes';
|
||||||
|
|
||||||
let lineNetApp: IGraphicApp | null = null;
|
let lineNetApp: IGraphicApp | null = null;
|
||||||
|
|
||||||
@ -161,11 +163,14 @@ function handleSubscribe(lineNetApp: IGraphicApp) {
|
|||||||
return states;
|
return states;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
const userStore = useUserStore();
|
||||||
|
getMonitorPath(userStore.roles).destinations.forEach((destination) => {
|
||||||
lineNetApp.subscribe({
|
lineNetApp.subscribe({
|
||||||
destination: '/queue/xian/ncc/alert',
|
destination,
|
||||||
messageHandle: (message: Uint8Array) => {
|
messageHandle: (message: Uint8Array) => {
|
||||||
const storage = alert.NccAlertInfoMessage.deserialize(message);
|
const storage = alert.NccAlertInfoMessage.deserialize(message);
|
||||||
lineNetStore.setAlarmInfo(storage.messages as []);
|
lineNetStore.setAlarmInfo(storage.messages as []);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,7 @@ const showBackMonitor = computed(() => {
|
|||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const isShow =
|
const isShow =
|
||||||
route.path.includes('line/monitor/') &&
|
route.path.includes('line/monitor/') &&
|
||||||
getMonitorPath(userStore.roles) == '/monitor';
|
getMonitorPath(userStore.roles).lineType == 'NCC';
|
||||||
return isShow;
|
return isShow;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -237,6 +237,8 @@ import {
|
|||||||
webSocketConnect,
|
webSocketConnect,
|
||||||
closeWebSocketConnect,
|
closeWebSocketConnect,
|
||||||
} from 'src/components/webSocketConnect';
|
} from 'src/components/webSocketConnect';
|
||||||
|
import { getMonitorPath } from 'src/router/routes';
|
||||||
|
import { useUserStore } from 'src/stores/user-store';
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const lineNetStore = useLineNetStore();
|
const lineNetStore = useLineNetStore();
|
||||||
@ -246,6 +248,7 @@ const props = withDefaults(
|
|||||||
}>(),
|
}>(),
|
||||||
{ sizeHeight: 500 }
|
{ sizeHeight: 500 }
|
||||||
);
|
);
|
||||||
|
const userStore = useUserStore();
|
||||||
|
|
||||||
const tableHeight = computed(() => {
|
const tableHeight = computed(() => {
|
||||||
return props.sizeHeight - 32;
|
return props.sizeHeight - 32;
|
||||||
@ -271,6 +274,13 @@ const columnDefs: QTableColumn[] = [
|
|||||||
field: 'lineId',
|
field: 'lineId',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'lineType',
|
||||||
|
label: '线路类型',
|
||||||
|
field: 'lineType',
|
||||||
|
required: true,
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'alertObject',
|
name: 'alertObject',
|
||||||
label: '设备',
|
label: '设备',
|
||||||
@ -369,12 +379,15 @@ async function onRequest(props: any) {
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
queryLineInfo();
|
queryLineInfo();
|
||||||
|
destinations = getMonitorPath(userStore.roles).destinations;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
tableRef.value.requestServerInteraction();
|
tableRef.value.requestServerInteraction();
|
||||||
lineNetStore.alarmInfoListTable = tableRef.value;
|
lineNetStore.alarmInfoListTable = tableRef.value;
|
||||||
|
destinations.forEach((destination) => {
|
||||||
socket = webSocketConnect(destination, handler);
|
socket = webSocketConnect(destination, handler);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
const selected = ref<Item[]>([]);
|
const selected = ref<Item[]>([]);
|
||||||
watch(
|
watch(
|
||||||
@ -386,8 +399,12 @@ watch(
|
|||||||
);
|
);
|
||||||
|
|
||||||
function updateSelect() {
|
function updateSelect() {
|
||||||
|
const config = getMonitorPath(userStore.roles);
|
||||||
for (let i = 0; i < selected.value.length; i++) {
|
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);
|
selected.value.splice(i, 1);
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
@ -532,6 +549,7 @@ function openAlarmDialog(row: any) {
|
|||||||
row.alert_time = row.alertTime;
|
row.alert_time = row.alertTime;
|
||||||
row.alert_type = row.alertType;
|
row.alert_type = row.alertType;
|
||||||
row.line_id = row.lineId;
|
row.line_id = row.lineId;
|
||||||
|
row.line_type = row.lineType;
|
||||||
row.alert_object = row.alertObject;
|
row.alert_object = row.alertObject;
|
||||||
row.alert_tip_id = row.alertTipId;
|
row.alert_tip_id = row.alertTipId;
|
||||||
row.alert_location_id = row.alertLocationId;
|
row.alert_location_id = row.alertLocationId;
|
||||||
@ -552,15 +570,17 @@ function openAlarmDialog(row: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let socket: StompMessagingClient | null = null;
|
let socket: StompMessagingClient | null = null;
|
||||||
const destination = '/queue/xian/ncc/alert';
|
let destinations: string[] = [];
|
||||||
function handler(message: Uint8Array) {
|
function handler(message: Uint8Array) {
|
||||||
const storage = alert.NccAlertInfoMessage.deserialize(message);
|
const storage = alert.NccAlertInfoMessage.deserialize(message);
|
||||||
lineNetStore.setAlarmInfo(storage.messages as []);
|
lineNetStore.setAlarmInfo(storage.messages as []);
|
||||||
}
|
}
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
|
destinations.forEach((destination) => {
|
||||||
closeWebSocketConnect(socket, destination);
|
closeWebSocketConnect(socket, destination);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
//报警统计
|
//报警统计
|
||||||
const alarmStatisticsDialog = ref();
|
const alarmStatisticsDialog = ref();
|
||||||
|
@ -15,35 +15,21 @@
|
|||||||
binary-state-sort
|
binary-state-sort
|
||||||
@request="onRequest"
|
@request="onRequest"
|
||||||
>
|
>
|
||||||
<!-- <template v-slot:top-right>
|
<template
|
||||||
<q-input
|
v-if="userStore.defaultRole == 'ADMIN'"
|
||||||
dense
|
v-slot:body-cell-operations="props"
|
||||||
debounce="1000"
|
>
|
||||||
v-model="filter.name"
|
|
||||||
label="名称"
|
|
||||||
></q-input>
|
|
||||||
<q-btn flat round color="primary" icon="search" />
|
|
||||||
<q-btn color="primary" label="新建" @click="editFormShow = true" />
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-slot:body-cell-operations="props">
|
|
||||||
<q-td :props="props">
|
<q-td :props="props">
|
||||||
<div class="q-gutter-sm row justify-center">
|
<div class="q-gutter-sm row justify-center">
|
||||||
<q-btn
|
<q-btn
|
||||||
|
:disable="operateDisabled"
|
||||||
color="primary"
|
color="primary"
|
||||||
label="编辑"
|
label="配置"
|
||||||
@click="edieRoleData(props.row)"
|
@click="edieRoleData(props.row)"
|
||||||
:disable="props.row.id == 1"
|
|
||||||
/>
|
|
||||||
<q-btn
|
|
||||||
color="red"
|
|
||||||
:disable="operateDisabled || [1, 2].includes(props.row.id)"
|
|
||||||
label="删除"
|
|
||||||
@click="deleteRoleData(props.row)"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</q-td>
|
</q-td>
|
||||||
</template> -->
|
</template>
|
||||||
</q-table>
|
</q-table>
|
||||||
|
|
||||||
<q-dialog
|
<q-dialog
|
||||||
@ -52,37 +38,31 @@
|
|||||||
transition-show="scale"
|
transition-show="scale"
|
||||||
transition-hide="scale"
|
transition-hide="scale"
|
||||||
>
|
>
|
||||||
<q-card style="width: 1400px; max-width: 80vw">
|
</q-dialog>
|
||||||
|
<q-dialog
|
||||||
|
v-model="editFormShow"
|
||||||
|
persistent
|
||||||
|
transition-show="scale"
|
||||||
|
transition-hide="scale"
|
||||||
|
>
|
||||||
|
<q-card style="width: 300px">
|
||||||
|
<q-card-section>
|
||||||
<q-form
|
<q-form
|
||||||
ref="myForm"
|
ref="myForm"
|
||||||
@submit="edieRolePath"
|
@submit="roleConfigFn"
|
||||||
@reset="onReset"
|
@reset="onReset"
|
||||||
class="q-gutter-md"
|
class="q-gutter-md"
|
||||||
>
|
>
|
||||||
<q-card-section>
|
<div class="text-h6">配置角色信息</div>
|
||||||
<div class="text-h5">{{ roleInfo.id ? '编辑' : '新建' }}</div>
|
<q-input outlined disable label="角色" v-model="roleInfo.name" />
|
||||||
<div class="q-pa-md">
|
<q-input outlined label="配置" v-model="roleInfo.config" />
|
||||||
<q-input
|
|
||||||
outlined
|
|
||||||
dense
|
|
||||||
label="角色名称"
|
|
||||||
v-model="roleInfo.name"
|
|
||||||
lazy-rules
|
|
||||||
:rules="[(val) => val.length > 0 || '请输入角色名称!']"
|
|
||||||
style="width: 300px"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<AuthPathManage
|
|
||||||
:sizeHeight="600"
|
|
||||||
:selects="roleInfo.editPaths || []"
|
|
||||||
@selectsed="pathSelectsed"
|
|
||||||
/>
|
|
||||||
<q-card-actions align="right">
|
<q-card-actions align="right">
|
||||||
<q-btn color="primary" label="保存" type="submit" />
|
<q-btn color="primary" label="保存" type="submit" />
|
||||||
<q-btn label="取消" type="reset" v-close-popup />
|
<q-btn label="取消" type="reset" v-close-popup />
|
||||||
</q-card-actions>
|
</q-card-actions>
|
||||||
</q-card-section>
|
|
||||||
</q-form>
|
</q-form>
|
||||||
|
</q-card-section>
|
||||||
</q-card>
|
</q-card>
|
||||||
</q-dialog>
|
</q-dialog>
|
||||||
</div>
|
</div>
|
||||||
@ -91,18 +71,10 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, onMounted, computed } from 'vue';
|
import { ref, reactive, onMounted, computed } from 'vue';
|
||||||
import { useQuasar, type QTableColumn, QForm } from 'quasar';
|
import { useQuasar, type QTableColumn, QForm } from 'quasar';
|
||||||
import {
|
import { pageQueryRole, roleConfig, RoleInfo } from 'src/api/AuthApi';
|
||||||
PathItem,
|
|
||||||
RoleInfo,
|
|
||||||
createRole,
|
|
||||||
createRoleParams,
|
|
||||||
deleteRole,
|
|
||||||
pageQueryRole,
|
|
||||||
saveRoleData,
|
|
||||||
} from 'src/api/AuthApi';
|
|
||||||
import { ApiError } from 'src/boot/axios';
|
import { ApiError } from 'src/boot/axios';
|
||||||
import { successNotify } from 'src/utils/CommonNotify';
|
import { successNotify } from 'src/utils/CommonNotify';
|
||||||
import AuthPathManage from './AuthPathManage.vue';
|
import { useUserStore } from 'src/stores/user-store';
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
@ -114,8 +86,17 @@ const props = withDefaults(
|
|||||||
const tableHeight = computed(() => {
|
const tableHeight = computed(() => {
|
||||||
return props.sizeHeight - 32;
|
return props.sizeHeight - 32;
|
||||||
});
|
});
|
||||||
|
const userStore = useUserStore();
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
if (userStore.defaultRole == 'ADMIN') {
|
||||||
|
columnDefs.push({
|
||||||
|
name: 'operations',
|
||||||
|
label: '操作',
|
||||||
|
field: 'operations',
|
||||||
|
align: 'center',
|
||||||
|
});
|
||||||
|
}
|
||||||
tableRef.value.requestServerInteraction();
|
tableRef.value.requestServerInteraction();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -130,8 +111,6 @@ const columnDefs: QTableColumn[] = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const operateDisabled = ref(false);
|
|
||||||
|
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const rows = reactive([]);
|
const rows = reactive([]);
|
||||||
const filter = reactive({
|
const filter = reactive({
|
||||||
@ -176,53 +155,37 @@ async function onRequest(props: any) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const editFormShow = ref(false);
|
//提交编辑用户
|
||||||
|
|
||||||
interface RoleItemInfo extends Omit<RoleInfo, 'id'> {
|
interface RoleItemInfo extends Omit<RoleInfo, 'id'> {
|
||||||
id: string;
|
id: string;
|
||||||
editPaths: { id: number }[];
|
editPaths: { id: number }[];
|
||||||
|
roleConfigStr: string;
|
||||||
}
|
}
|
||||||
const roleInfo = reactive<RoleItemInfo>({
|
const roleInfo = reactive<RoleItemInfo>({
|
||||||
id: '',
|
id: '',
|
||||||
editPaths: [],
|
editPaths: [],
|
||||||
name: '',
|
name: '',
|
||||||
resList: [],
|
resList: [],
|
||||||
|
roleConfigStr: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
//编辑
|
|
||||||
function edieRoleData(row: RoleInfo) {
|
function edieRoleData(row: RoleInfo) {
|
||||||
roleInfo.id = row.id + '';
|
roleInfo.id = row.id + '';
|
||||||
roleInfo.name = row.name;
|
roleInfo.name = row.name;
|
||||||
const list = row.resList || [];
|
roleInfo.roleConfigStr=row.roleConfigStr
|
||||||
roleInfo.resList = list;
|
|
||||||
roleInfo.editPaths = list.map((item) => {
|
|
||||||
return { id: item };
|
|
||||||
});
|
|
||||||
editFormShow.value = true;
|
editFormShow.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const operateDisabled = ref(false);
|
||||||
const myForm = ref<QForm | null>(null);
|
const myForm = ref<QForm | null>(null);
|
||||||
|
const editFormShow = ref(false);
|
||||||
//提交编辑
|
function roleConfigFn() {
|
||||||
async function edieRolePath() {
|
|
||||||
myForm.value?.validate().then(async (res) => {
|
myForm.value?.validate().then(async (res) => {
|
||||||
if (res) {
|
if (res) {
|
||||||
operateDisabled.value = true;
|
operateDisabled.value = true;
|
||||||
try {
|
try {
|
||||||
const params: createRoleParams = {
|
await roleConfig(+roleInfo.id, roleInfo.roleConfigStr);
|
||||||
name: roleInfo.name,
|
|
||||||
resList: roleInfo.resList,
|
|
||||||
};
|
|
||||||
if (roleInfo.id) {
|
|
||||||
const cloneParams = Object.assign(params, { id: +roleInfo.id });
|
|
||||||
await saveRoleData(cloneParams);
|
|
||||||
} else {
|
|
||||||
await createRole(params);
|
|
||||||
}
|
|
||||||
onReset();
|
|
||||||
tableRef.value.requestServerInteraction(); // 刷新列表
|
|
||||||
editFormShow.value = false;
|
editFormShow.value = false;
|
||||||
successNotify('保存成功!');
|
successNotify('修改成功');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const error = err as ApiError;
|
const error = err as ApiError;
|
||||||
$q.notify({
|
$q.notify({
|
||||||
@ -236,39 +199,10 @@ async function edieRolePath() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteRoleData(row: RoleInfo) {
|
|
||||||
operateDisabled.value = true;
|
|
||||||
$q.dialog({
|
|
||||||
title: '确认',
|
|
||||||
message: `确认删除角色 "${row.name}" 吗?`,
|
|
||||||
cancel: true,
|
|
||||||
})
|
|
||||||
.onOk(async () => {
|
|
||||||
try {
|
|
||||||
await deleteRole(row.id);
|
|
||||||
tableRef.value.requestServerInteraction(); // 刷新列表
|
|
||||||
} catch (err) {
|
|
||||||
const error = err as ApiError;
|
|
||||||
$q.notify({
|
|
||||||
type: 'negative',
|
|
||||||
message: error.title,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.onDismiss(() => {
|
|
||||||
operateDisabled.value = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function onReset() {
|
function onReset() {
|
||||||
roleInfo.id = '';
|
roleInfo.id = '';
|
||||||
roleInfo.name = '';
|
roleInfo.name = '';
|
||||||
roleInfo.editPaths = [];
|
roleInfo.roleConfigStr = '';
|
||||||
roleInfo.resList = [];
|
|
||||||
myForm.value?.resetValidation();
|
myForm.value?.resetValidation();
|
||||||
}
|
}
|
||||||
|
|
||||||
function pathSelectsed(val: PathItem[]) {
|
|
||||||
roleInfo.resList = val.map((item) => item.id);
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -86,7 +86,7 @@ async function doLogin() {
|
|||||||
() => handleRefreshToken(),
|
() => handleRefreshToken(),
|
||||||
userInfo.remainingSecond * 1000 - 10000
|
userInfo.remainingSecond * 1000 - 10000
|
||||||
);
|
);
|
||||||
router.replace(getMonitorPath(userInfo.roles));
|
router.replace(getMonitorPath(userInfo.roles).monitorPath);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
const apiErr = err as ApiError;
|
const apiErr = err as ApiError;
|
||||||
|
@ -239,10 +239,15 @@ function edieUserData(row: User) {
|
|||||||
userInfo.name = row.name;
|
userInfo.name = row.name;
|
||||||
userInfo.mobile = row.mobile;
|
userInfo.mobile = row.mobile;
|
||||||
userInfo.registerTime = row.registerTime;
|
userInfo.registerTime = row.registerTime;
|
||||||
|
if (row?.roleList) {
|
||||||
userInfo.roleList = row.roleList;
|
userInfo.roleList = row.roleList;
|
||||||
userInfo.Rids = row.roleList.map((item) => {
|
userInfo.Rids = row.roleList.map((item) => {
|
||||||
return item.roleId;
|
return item.roleId;
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
userInfo.roleList = [];
|
||||||
|
userInfo.Rids = [];
|
||||||
|
}
|
||||||
editFormShow.value = true;
|
editFormShow.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,6 +87,7 @@ export namespace alert {
|
|||||||
locator_device_id?: string;
|
locator_device_id?: string;
|
||||||
alert_location_id?: number;
|
alert_location_id?: number;
|
||||||
mock?: boolean;
|
mock?: boolean;
|
||||||
|
line_type?: string;
|
||||||
}) {
|
}) {
|
||||||
super();
|
super();
|
||||||
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
|
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) {
|
if ("mock" in data && data.mock != undefined) {
|
||||||
this.mock = data.mock;
|
this.mock = data.mock;
|
||||||
}
|
}
|
||||||
|
if ("line_type" in data && data.line_type != undefined) {
|
||||||
|
this.line_type = data.line_type;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
get id() {
|
get id() {
|
||||||
@ -183,6 +187,12 @@ export namespace alert {
|
|||||||
set mock(value: boolean) {
|
set mock(value: boolean) {
|
||||||
pb_1.Message.setField(this, 10, value);
|
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: {
|
static fromObject(data: {
|
||||||
id?: string;
|
id?: string;
|
||||||
level?: string;
|
level?: string;
|
||||||
@ -194,6 +204,7 @@ export namespace alert {
|
|||||||
locator_device_id?: string;
|
locator_device_id?: string;
|
||||||
alert_location_id?: number;
|
alert_location_id?: number;
|
||||||
mock?: boolean;
|
mock?: boolean;
|
||||||
|
line_type?: string;
|
||||||
}): Message {
|
}): Message {
|
||||||
const message = new Message({});
|
const message = new Message({});
|
||||||
if (data.id != null) {
|
if (data.id != null) {
|
||||||
@ -226,6 +237,9 @@ export namespace alert {
|
|||||||
if (data.mock != null) {
|
if (data.mock != null) {
|
||||||
message.mock = data.mock;
|
message.mock = data.mock;
|
||||||
}
|
}
|
||||||
|
if (data.line_type != null) {
|
||||||
|
message.line_type = data.line_type;
|
||||||
|
}
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
toObject() {
|
toObject() {
|
||||||
@ -240,6 +254,7 @@ export namespace alert {
|
|||||||
locator_device_id?: string;
|
locator_device_id?: string;
|
||||||
alert_location_id?: number;
|
alert_location_id?: number;
|
||||||
mock?: boolean;
|
mock?: boolean;
|
||||||
|
line_type?: string;
|
||||||
} = {};
|
} = {};
|
||||||
if (this.id != null) {
|
if (this.id != null) {
|
||||||
data.id = this.id;
|
data.id = this.id;
|
||||||
@ -271,6 +286,9 @@ export namespace alert {
|
|||||||
if (this.mock != null) {
|
if (this.mock != null) {
|
||||||
data.mock = this.mock;
|
data.mock = this.mock;
|
||||||
}
|
}
|
||||||
|
if (this.line_type != null) {
|
||||||
|
data.line_type = this.line_type;
|
||||||
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
serialize(): Uint8Array;
|
serialize(): Uint8Array;
|
||||||
@ -297,6 +315,8 @@ export namespace alert {
|
|||||||
writer.writeInt64(9, this.alert_location_id);
|
writer.writeInt64(9, this.alert_location_id);
|
||||||
if (this.mock != false)
|
if (this.mock != false)
|
||||||
writer.writeBool(10, this.mock);
|
writer.writeBool(10, this.mock);
|
||||||
|
if (this.line_type.length)
|
||||||
|
writer.writeString(11, this.line_type);
|
||||||
if (!w)
|
if (!w)
|
||||||
return writer.getResultBuffer();
|
return writer.getResultBuffer();
|
||||||
}
|
}
|
||||||
@ -336,6 +356,9 @@ export namespace alert {
|
|||||||
case 10:
|
case 10:
|
||||||
message.mock = reader.readBool();
|
message.mock = reader.readBool();
|
||||||
break;
|
break;
|
||||||
|
case 11:
|
||||||
|
message.line_type = reader.readString();
|
||||||
|
break;
|
||||||
default: reader.skipField();
|
default: reader.skipField();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,20 +170,43 @@ const routes: RouteRecordRaw[] = [
|
|||||||
export default routes;
|
export default routes;
|
||||||
|
|
||||||
export function getMonitorPath(roles: role[]) {
|
export function getMonitorPath(roles: role[]) {
|
||||||
let monitorPath = '';
|
const configInfo: {
|
||||||
const allOCCLineIds: number[] = [];
|
monitorPath: string;
|
||||||
|
lineIds: number[];
|
||||||
|
lineType: string;
|
||||||
|
destinations: string[];
|
||||||
|
} = {
|
||||||
|
monitorPath: '',
|
||||||
|
lineIds: [],
|
||||||
|
lineType: '',
|
||||||
|
destinations: [],
|
||||||
|
};
|
||||||
|
let allOCCLineIds: number[] = [];
|
||||||
for (let i = 0; i < roles.length; i++) {
|
for (let i = 0; i < roles.length; i++) {
|
||||||
const roleConfig = roles[i].roleConfig;
|
const roleConfig = roles[i].roleConfig;
|
||||||
for (let j = 0; j < roleConfig.length; j++) {
|
for (let j = 0; j < roleConfig.length; j++) {
|
||||||
if (roleConfig[j].lineType == 'NCC') {
|
if (roleConfig[j].lineType == 'NCC') {
|
||||||
monitorPath = '/monitor';
|
configInfo.monitorPath = '/monitor';
|
||||||
return monitorPath;
|
configInfo.lineIds = roleConfig.map((config) => {
|
||||||
|
configInfo.destinations.push(
|
||||||
|
`/queue/xian/NCC/${config.lineId}/alert`
|
||||||
|
);
|
||||||
|
return config.lineId;
|
||||||
|
});
|
||||||
|
configInfo.lineType = 'NCC';
|
||||||
|
return configInfo;
|
||||||
} else {
|
} else {
|
||||||
allOCCLineIds.push(roleConfig[j].lineId);
|
allOCCLineIds.push(roleConfig[j].lineId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
allOCCLineIds = [...new Set(allOCCLineIds)];
|
||||||
const minId = Math.min(...allOCCLineIds);
|
const minId = Math.min(...allOCCLineIds);
|
||||||
monitorPath = `/line/monitor/${minId}`;
|
configInfo.monitorPath = `/line/monitor/${minId}`;
|
||||||
return monitorPath;
|
configInfo.lineIds = allOCCLineIds;
|
||||||
|
configInfo.lineType = 'OCC';
|
||||||
|
allOCCLineIds.forEach((lineId) => {
|
||||||
|
configInfo.destinations.push(`/queue/xian/OCC/${lineId}/alert`);
|
||||||
|
});
|
||||||
|
return configInfo;
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ export interface AlarmInfo {
|
|||||||
alert_time: string;
|
alert_time: string;
|
||||||
alert_tip_id: number;
|
alert_tip_id: number;
|
||||||
line_id: string;
|
line_id: string;
|
||||||
|
line_type: string;
|
||||||
alert_object: string;
|
alert_object: string;
|
||||||
alert_type: number;
|
alert_type: number;
|
||||||
locator_device_id: string;
|
locator_device_id: string;
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit c20feed4b6ae3bdd02cb21b4cc5af03c55be869b
|
Subproject commit 4f9012b0795f62bf352b078ebbc1b1fffa86849d
|
Loading…
Reference in New Issue
Block a user