故障查询调整

This commit is contained in:
joylink_zhaoerwei 2024-11-12 16:44:22 +08:00
parent cfcf0e06d1
commit 9ac2c2dc59
2 changed files with 122 additions and 107 deletions

View File

@ -3,11 +3,11 @@
seamless seamless
ref="dialogRef" ref="dialogRef"
@show="onDialogShow" @show="onDialogShow"
:title="props.dialogTitle" title="故障查询"
:width="990" :width="990"
:height="0" :height="580"
> >
<template v-slot:footer> <div class="dialogContainer">
<q-table <q-table
ref="tableRef" ref="tableRef"
row-key="id" row-key="id"
@ -17,22 +17,63 @@
:columns="columns" :columns="columns"
@request="onRequest" @request="onRequest"
:rows-per-page-options="[10, 20, 50, 100]" :rows-per-page-options="[10, 20, 50, 100]"
style="width: 500px; height: 580px"
> >
<template v-slot:body-cell="props"> <template v-slot:body="props">
<q-td :props="props" class="custom-column"> <q-tr
{{ props.value }} :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 <q-tooltip
anchor="bottom middle" anchor="bottom middle"
v-if="props.value && props.value.length > 20" v-if="props.value && props.value.length > 20"
> >
<div class="message-tip"> <div class="message-tip">
{{ props.value }} {{ col.value }}
</div> </div>
</q-tooltip> </q-tooltip>
</q-td> </q-td>
</q-tr>
</template> </template>
</q-table> </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"> 消息名称(故障现象)</span>{{
clickRowInfo.faultNameShower
}}
</div>
<q-card class="box-card">
<div class="head">司机处理结果(服务故障现象)</div>
<q-separator />
<div>
<div class="detail">{{ clickRowInfo.faultDriverShower }}</div>
</div>
</q-card>
<q-card class="box-card">
<div class="head">司机关键点(退出服务地点)</div>
<q-separator />
<div>
<div class="detail">{{ clickRowInfo.resultMsg }}</div>
</div>
</q-card>
</div>
</q-scroll-area>
</div>
<template v-slot:titleButton> <template v-slot:titleButton>
<q-btn <q-btn
square square
@ -58,7 +99,7 @@
/> />
<q-input <q-input
dense dense
:label="inputSearchName" label="故障现象(故障名称)"
v-model="filter.faultName" v-model="filter.faultName"
lazy-rules lazy-rules
/> />
@ -78,7 +119,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, reactive, ref, computed } from 'vue'; import { reactive, ref, computed } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import DraggableDialog from '../common/DraggableDialog.vue'; import DraggableDialog from '../common/DraggableDialog.vue';
import { QTable, useQuasar } from 'quasar'; import { QTable, useQuasar } from 'quasar';
@ -89,19 +130,9 @@ import {
FaultTypeItem, FaultTypeItem,
} from 'src/api/faultQuery'; } from 'src/api/faultQuery';
const props = defineProps<{
dialogTitle: string;
}>();
const $q = useQuasar(); const $q = useQuasar();
const lineId = useRoute().params.lineId as string; const lineId = useRoute().params.lineId as string;
const tableTitle = reactive({
faultNameShower: '',
faultDriverShower: '',
resultMsg: '',
});
const tableRef = ref<QTable>(); const tableRef = ref<QTable>();
const columns = computed(() => [ const columns = computed(() => [
{ {
@ -111,13 +142,6 @@ const columns = computed(() => [
required: true, required: true,
align: 'center', align: 'center',
}, },
{
name: 'lineId',
label: '线路',
field: 'lineId',
required: true,
align: 'center',
},
{ {
name: 'faultType', name: 'faultType',
label: '故障类型', label: '故障类型',
@ -130,25 +154,11 @@ const columns = computed(() => [
}, },
{ {
name: 'faultNameShower', name: 'faultNameShower',
label: tableTitle.faultNameShower, label: '消息名称(故障现象)',
field: 'faultNameShower', field: 'faultNameShower',
required: true, required: true,
align: 'center', 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 rows = reactive([]);
const loading = ref(false); const loading = ref(false);
@ -199,6 +209,21 @@ const onRequest: QTable['onRequest'] = async (props) => {
} }
}; };
const clickRowInfo = reactive({
id: 0,
faultType: '',
faultNameShower: '',
faultDriverShower: '',
resultMsg: '',
});
function handleRowClick(row: FaultQueryListItem) {
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() { async function queryAllFaultType() {
try { try {
allOptionsFaultType = await faultQueryType(); allOptionsFaultType = await faultQueryType();
@ -226,34 +251,14 @@ function getFaultTypeName(row: FaultQueryListItem) {
} }
const searchOptionsFaultType = ref([{ label: '全部', value: '' }]); const searchOptionsFaultType = ref([{ label: '全部', value: '' }]);
function handleSelectFaultType() { function handleSelectFaultType() {
let allType = ''; allOptionsFaultType.forEach((faultTypeOption) => {
for (let i = 0; i < allOptionsFaultType.length; i++) { faultTypeOption.fts.forEach((fault) =>
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'))
) {
searchOptionsFaultType.value.push({ searchOptionsFaultType.value.push({
label: item.typeName, label: fault.typeName,
value: item.faultType, value: fault.faultType,
})
);
}); });
if (allType == '') {
allType = item.faultType;
} else {
allType = allType + ',' + item.faultType;
}
}
});
filter.faultType = allType;
searchOptionsFaultType.value[0].value = allType;
break;
}
}
} }
function searchTable() { function searchTable() {
@ -272,26 +277,13 @@ const onDialogShow = () => {
tableRef.value?.requestServerInteraction(); tableRef.value?.requestServerInteraction();
}, 1000); }, 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> </script>
<style scoped> <style lang='scss' scoped>
.changeBackground {
background-color: orange; /* 浅蓝色 */
}
.custom-column { .custom-column {
max-width: 250px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
@ -308,4 +300,37 @@ onMounted(() => {
justify-content: center; justify-content: center;
margin-top: 10px; 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> </style>

View File

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