Merge remote-tracking branch 'origin/develop' into local-test
All checks were successful
local-test分支构建发布 / Docker-Build (push) Successful in 1m50s

# Conflicts:
#	src/drawApp/lineNetApp.ts
This commit is contained in:
joylink_fanyuhong 2024-11-12 18:02:55 +08:00
commit 1f8b5552c7
4 changed files with 175 additions and 109 deletions

View File

@ -3,11 +3,11 @@
seamless
ref="dialogRef"
@show="onDialogShow"
:title="props.dialogTitle"
title="故障查询"
:width="990"
:height="0"
:height="580"
>
<template v-slot:footer>
<div class="dialogContainer">
<q-table
ref="tableRef"
row-key="id"
@ -17,22 +17,62 @@
:columns="columns"
@request="onRequest"
:rows-per-page-options="[10, 20, 50, 100]"
style="width: 500px; height: 580px"
>
<template v-slot:body-cell="props">
<q-td :props="props" class="custom-column">
{{ props.value }}
<template v-slot:body="props">
<q-tr
:props="props"
:class="{ changeBackground: props.row.id === clickRowInfo.id }"
@click="handleRowClick(props.row)"
>
<q-td
v-for="col in props.cols"
:key="col.name"
:props="props"
class="custom-column"
>
{{ col.value }}
<q-tooltip
anchor="bottom middle"
v-if="props.value && props.value.length > 20"
>
<div class="message-tip">
{{ props.value }}
{{ col.value }}
</div>
</q-tooltip>
</q-td>
</q-tr>
</template>
</q-table>
</template>
<q-scroll-area style="width: 490px; height: 560px">
<div class="detaiRow">
<div class="text">
<span class="textHead">故障类型</span> {{
clickRowInfo.faultType
}}
</div>
<div class="text">
<span class="textHead"> {{ showTitle.faultNameShower }}</span
>{{ clickRowInfo.faultNameShower }}
</div>
<q-card class="box-card">
<div class="head">{{ showTitle.faultDriverShower }}</div>
<q-separator />
<div>
<div class="detail">{{ clickRowInfo.faultDriverShower }}</div>
</div>
</q-card>
<q-card class="box-card">
<div class="head">{{ showTitle.resultMsg }}</div>
<q-separator />
<div>
<div class="detail">{{ clickRowInfo.resultMsg }}</div>
</div>
</q-card>
</div>
</q-scroll-area>
</div>
<template v-slot:titleButton>
<q-btn
square
@ -58,7 +98,7 @@
/>
<q-input
dense
:label="inputSearchName"
label="故障现象(故障名称)"
v-model="filter.faultName"
lazy-rules
/>
@ -78,7 +118,7 @@
</template>
<script setup lang="ts">
import { onMounted, reactive, ref, computed } from 'vue';
import { reactive, ref, computed } from 'vue';
import { useRoute } from 'vue-router';
import DraggableDialog from '../common/DraggableDialog.vue';
import { QTable, useQuasar } from 'quasar';
@ -89,19 +129,9 @@ import {
FaultTypeItem,
} from 'src/api/faultQuery';
const props = defineProps<{
dialogTitle: string;
}>();
const $q = useQuasar();
const lineId = useRoute().params.lineId as string;
const tableTitle = reactive({
faultNameShower: '',
faultDriverShower: '',
resultMsg: '',
});
const tableRef = ref<QTable>();
const columns = computed(() => [
{
@ -111,13 +141,6 @@ const columns = computed(() => [
required: true,
align: 'center',
},
{
name: 'lineId',
label: '线路',
field: 'lineId',
required: true,
align: 'center',
},
{
name: 'faultType',
label: '故障类型',
@ -130,25 +153,11 @@ const columns = computed(() => [
},
{
name: 'faultNameShower',
label: tableTitle.faultNameShower,
label: '消息名称(故障现象)',
field: 'faultNameShower',
required: true,
align: 'center',
},
{
name: 'faultDriverShower',
label: tableTitle.faultDriverShower,
field: 'faultDriverShower',
required: true,
align: 'center',
},
{
name: 'resultMsg',
label: tableTitle.resultMsg,
field: 'resultMsg',
required: true,
align: 'center',
},
]);
const rows = reactive([]);
const loading = ref(false);
@ -189,6 +198,7 @@ const onRequest: QTable['onRequest'] = async (props) => {
pagination.value.rowsNumber = resp.total;
pagination.value.rowsPerPage = resp.size;
rows.splice(0, rows.length, ...(resp.records as []));
handleRowClick(rows[0]);
} catch (err) {
$q.notify({
type: 'negative',
@ -199,6 +209,35 @@ const onRequest: QTable['onRequest'] = async (props) => {
}
};
const clickRowInfo = reactive({
id: 0,
faultType: '',
faultNameShower: '',
faultDriverShower: '',
resultMsg: '',
});
const showTitle = reactive({
faultNameShower: '',
faultDriverShower: '',
resultMsg: '',
});
function handleRowClick(row: FaultQueryListItem) {
if (row.faultType.includes('FAULT_EMERGENCY_GUIDE')) {
showTitle.faultNameShower = '故障现象';
showTitle.faultDriverShower = '司机处理结果';
showTitle.resultMsg = '行调提醒司机关键点';
} else {
showTitle.faultNameShower = '故障名称';
showTitle.faultDriverShower = '故障现象';
showTitle.resultMsg = '退出服务地点';
}
clickRowInfo.id = row?.id as number;
clickRowInfo.faultType = getFaultTypeName(row) as string;
clickRowInfo.faultNameShower = row.faultNameShower;
clickRowInfo.faultDriverShower = row.faultDriverShower;
clickRowInfo.resultMsg = row.resultMsg;
}
async function queryAllFaultType() {
try {
allOptionsFaultType = await faultQueryType();
@ -226,34 +265,14 @@ function getFaultTypeName(row: FaultQueryListItem) {
}
const searchOptionsFaultType = ref([{ label: '全部', value: '' }]);
function handleSelectFaultType() {
let allType = '';
for (let i = 0; i < allOptionsFaultType.length; i++) {
if (allOptionsFaultType[i].lineId == +lineId) {
allOptionsFaultType[i].fts.forEach((item) => {
if (
(props.dialogTitle == '故障指导' &&
item.faultType.includes('FAULT_EMERGENCY_GUIDE')) ||
(props.dialogTitle == '退出服务' &&
item.faultType.includes('FAULT_EXIT_SERVICE'))
) {
allOptionsFaultType.forEach((faultTypeOption) => {
faultTypeOption.fts.forEach((fault) =>
searchOptionsFaultType.value.push({
label: item.typeName,
value: item.faultType,
label: fault.typeName,
value: fault.faultType,
})
);
});
if (allType == '') {
allType = item.faultType;
} else {
allType = allType + ',' + item.faultType;
}
}
});
filter.faultType = allType;
searchOptionsFaultType.value[0].value = allType;
break;
}
}
}
function searchTable() {
@ -272,26 +291,13 @@ const onDialogShow = () => {
tableRef.value?.requestServerInteraction();
}, 1000);
};
const inputSearchName = ref('');
onMounted(() => {
if (props.dialogTitle == '故障指导') {
inputSearchName.value = '故障现象';
tableTitle.faultNameShower = '故障现象';
tableTitle.faultDriverShower = '司机处理结果';
tableTitle.resultMsg = '行调提醒司机关键点';
} else {
inputSearchName.value = '故障名称';
tableTitle.faultNameShower = '故障名称';
tableTitle.faultDriverShower = '故障现象';
tableTitle.resultMsg = '退出服务地点';
}
});
</script>
<style scoped>
<style lang='scss' scoped>
.changeBackground {
background-color: #31ccec;
}
.custom-column {
max-width: 250px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
@ -308,4 +314,37 @@ onMounted(() => {
justify-content: center;
margin-top: 10px;
}
.dialogContainer {
display: flex;
.detaiRow {
margin: 10px 0 0 20px;
.text {
width: 450px;
word-wrap: break-word;
margin-bottom: 10px;
font-size: 18px;
.textHead {
font-weight: 600;
}
}
.box-card {
width: 450px;
height: 225px;
margin-bottom: 10px;
padding: 0 5px;
.head {
padding: 5px 5px;
font-size: 20px;
font-weight: 600;
}
.detail {
margin-bottom: 10px;
padding: 5px 5px;
line-height: 28px;
white-space: pre-wrap;
font-size: 20px;
}
}
}
}
</style>

View File

@ -157,7 +157,7 @@ export function cancelSubscribe(lineNetApp: IGraphicApp) {
}
let monitorDestinations: string[] = [];
export function handleSubscribe(lineNetApp: IGraphicApp) {
function handleSubscribe(lineNetApp: IGraphicApp) {
const lineNetStore = useLineNetStore();
lineNetApp.enableWsMassaging({
wsUrl: `${getWebsocketUrl()}`,

View File

@ -18,16 +18,9 @@
<q-btn
v-show="route.path.includes('line/monitor')"
color="info"
label="故障指导"
label="故障查询"
class="q-mr-sm"
@click="openFaultQueryDialog('故障指导')"
/>
<q-btn
v-show="route.path.includes('line/monitor')"
color="info"
label="退出服务"
class="q-mr-sm"
@click="openFaultQueryDialog('退出服务')"
@click="openFaultQueryDialog()"
/>
<q-btn
v-show="route.path.includes('line/monitor')"
@ -194,12 +187,9 @@ onMounted(() => {
socket = webSocketConnect(destination, handler);
});
function openFaultQueryDialog(dialogTitle: string) {
function openFaultQueryDialog() {
$q.dialog({
component: FaultQueryDialog,
componentProps: {
dialogTitle,
},
});
}

View File

@ -7,7 +7,7 @@ import {
cancelSubscribe,
} from 'src/drawApp/lineNetApp';
import { markRaw } from 'vue';
import { QTable } from 'quasar';
import { Notify, QTable } from 'quasar';
import { state } from 'src/protos/system_warn_message';
export interface AlarmInfo {
id: string;
@ -91,6 +91,43 @@ export const useLineNetStore = defineStore('lineNet', {
});
},
setConnectInfo(data: state.WarnLineMessage) {
let tip = '';
data.msgs.forEach((item: state.WarnMessage) => {
if (this.connectInfo) {
this.connectInfo.msgs.forEach((elem) => {
if (elem.lineId === item.lineId) {
if (elem.occRealConned && !item.occRealConned) {
tip =
tip +
`<div>${elem.lineId}号线路与卡斯柯的实时连接已断开;</div>`;
}
if (elem.occUnrealConned && !item.occUnrealConned) {
tip =
tip +
`<div>${elem.lineId}号线路与卡斯柯的非实时连接已断开</div>`;
}
}
});
}
});
if (tip) {
const msgNotify = Notify.create({
type: 'negative',
timeout: 0,
position: 'top',
html: true,
message: tip,
actions: [
{
icon: 'close',
color: 'white',
handler: () => {
msgNotify();
},
},
],
});
}
this.connectInfo = data;
const allConnectAmount = data.msgs.reduce((pre, cur) => {
let addValue = 0;