故障指导与退出服务
This commit is contained in:
parent
50b80fef68
commit
a57d89a7f3
@ -18,7 +18,7 @@ export interface FaultQueryInfo<T = unknown> {
|
||||
|
||||
export class PagingQueryParams extends PageQueryDto {
|
||||
lineId?: string;
|
||||
faultType?: string;
|
||||
faultType?: string[];
|
||||
faultName?: string;
|
||||
}
|
||||
|
||||
|
@ -34,44 +34,30 @@
|
||||
</q-table>
|
||||
</template>
|
||||
<template v-slot:titleButton>
|
||||
<div>
|
||||
<q-select
|
||||
outlined
|
||||
label="故障类型"
|
||||
v-model="creatForm.alertType"
|
||||
:options="optionsFaultType"
|
||||
emit-value
|
||||
map-options
|
||||
:rules="[(val) => val.length > 0 || '请选择故障类型!']"
|
||||
/>
|
||||
<q-input
|
||||
outlined
|
||||
label="消息名称"
|
||||
type="textarea"
|
||||
v-model="creatForm.faultNameShower"
|
||||
lazy-rules
|
||||
/>
|
||||
</div>
|
||||
<q-btn square color="purple" style="margin-right: 10px" icon="search">
|
||||
<q-btn
|
||||
square
|
||||
color="purple"
|
||||
style="margin-right: 10px"
|
||||
icon="search"
|
||||
@click="reset"
|
||||
>
|
||||
<q-popup-edit
|
||||
ref="popupEdit"
|
||||
v-model="searchAreaName"
|
||||
v-model="noUse"
|
||||
:cover="false"
|
||||
:offset="[0, 10]"
|
||||
v-slot="scope"
|
||||
>
|
||||
<q-input
|
||||
color="accent"
|
||||
v-model="scope.value"
|
||||
label="区域名称"
|
||||
<q-select
|
||||
dense
|
||||
autofocus
|
||||
@keyup.enter="scope.set"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="search" color="accent" />
|
||||
</template>
|
||||
</q-input>
|
||||
label="故障类型"
|
||||
multiple
|
||||
v-model="filter.faultTypes"
|
||||
emit-value
|
||||
map-options
|
||||
:options="searchOptionsFaultType"
|
||||
@update:model-value="searchTable"
|
||||
style="min-width: 130px"
|
||||
/>
|
||||
</q-popup-edit>
|
||||
</q-btn>
|
||||
</template>
|
||||
@ -79,12 +65,16 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { IAreaConfigListItem, getDeviceAreaList } from 'src/api/ConfigApi';
|
||||
import { ref, watch } from 'vue';
|
||||
import { reactive, ref } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import DraggableDialog from '../common/DraggableDialog.vue';
|
||||
import { QTable, useQuasar } from 'quasar';
|
||||
import { deviceTypeMap } from 'src/api/TrainApi';
|
||||
import {
|
||||
FaultQueryListItem,
|
||||
faultQueryPageQuery,
|
||||
faultQueryType,
|
||||
FaultTypeItem,
|
||||
} from 'src/api/faultQuery';
|
||||
|
||||
const props = defineProps<{
|
||||
dialogTitle: string;
|
||||
@ -92,25 +82,57 @@ const props = defineProps<{
|
||||
|
||||
const $q = useQuasar();
|
||||
const lineId = useRoute().params.lineId as string;
|
||||
let faultName = ref('');
|
||||
|
||||
const tableRef = ref<QTable>();
|
||||
const columns: QTable['columns'] = [
|
||||
{ name: 'id', label: 'ID', field: 'id', align: 'center' },
|
||||
{ name: 'lineId', label: '线路ID', field: 'lineId', align: 'center' },
|
||||
{
|
||||
name: 'areaName',
|
||||
label: '名称',
|
||||
field: 'areaName',
|
||||
name: 'id',
|
||||
label: '编号',
|
||||
field: 'id',
|
||||
required: true,
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
name: 'deviceType',
|
||||
label: '设备类型',
|
||||
field: (row) => deviceTypeMap[row.deviceType as keyof typeof deviceTypeMap],
|
||||
name: 'lineId',
|
||||
label: '线路',
|
||||
field: 'lineId',
|
||||
required: true,
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
name: 'faultType',
|
||||
label: '故障类型',
|
||||
field: (row) => {
|
||||
if (row.faultType) {
|
||||
return getFaultTypeName(row);
|
||||
}
|
||||
},
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
name: 'faultNameShower',
|
||||
label: '消息名称',
|
||||
field: 'faultNameShower',
|
||||
required: true,
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
name: 'faultDriverShower',
|
||||
label: '司机处理结果',
|
||||
field: 'faultDriverShower',
|
||||
required: true,
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
name: 'resultMsg',
|
||||
label: '司机关键点',
|
||||
field: 'resultMsg',
|
||||
required: true,
|
||||
align: 'center',
|
||||
},
|
||||
];
|
||||
const rows = ref<IAreaConfigListItem[]>([]);
|
||||
const rows = reactive([]);
|
||||
const loading = ref(false);
|
||||
const pagination = ref({
|
||||
sortBy: 'desc',
|
||||
@ -120,28 +142,30 @@ const pagination = ref({
|
||||
rowsNumber: 10,
|
||||
});
|
||||
|
||||
const searchAreaName = ref('');
|
||||
watch(
|
||||
() => searchAreaName.value,
|
||||
() => {
|
||||
tableRef.value?.requestServerInteraction();
|
||||
}
|
||||
);
|
||||
const filter = reactive({
|
||||
faultTypes: [],
|
||||
});
|
||||
|
||||
const onRequest: QTable['onRequest'] = async (props) => {
|
||||
const { page, rowsPerPage } = props.pagination;
|
||||
loading.value = true;
|
||||
try {
|
||||
const resp = await getDeviceAreaList({
|
||||
lineId,
|
||||
const params = {
|
||||
current: page,
|
||||
size: rowsPerPage,
|
||||
areaName: searchAreaName.value,
|
||||
});
|
||||
lineId,
|
||||
faultName: faultName.value,
|
||||
};
|
||||
if (filter.faultTypes.length) {
|
||||
Object.assign(params, {
|
||||
faultType: filter.faultTypes,
|
||||
});
|
||||
}
|
||||
let resp = await faultQueryPageQuery(params);
|
||||
pagination.value.page = resp.current;
|
||||
pagination.value.rowsNumber = resp.total;
|
||||
pagination.value.rowsPerPage = resp.size;
|
||||
rows.value = resp.records;
|
||||
rows.splice(0, rows.length, ...(resp.records as []));
|
||||
} catch (err) {
|
||||
$q.notify({
|
||||
type: 'negative',
|
||||
@ -152,7 +176,70 @@ const onRequest: QTable['onRequest'] = async (props) => {
|
||||
}
|
||||
};
|
||||
|
||||
async function queryAllFaultType() {
|
||||
try {
|
||||
allOptionsFaultType = await faultQueryType();
|
||||
handleSelectFaultType();
|
||||
} catch (err) {
|
||||
$q.notify({
|
||||
type: 'negative',
|
||||
message: '无法获取指定线路的故障类型配置',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
let allOptionsFaultType: FaultTypeItem[] = [];
|
||||
function getFaultTypeName(row: FaultQueryListItem) {
|
||||
for (let i = 0; i < allOptionsFaultType.length; i++) {
|
||||
if (allOptionsFaultType[i].lineId == row.lineId) {
|
||||
const fts = allOptionsFaultType[i].fts;
|
||||
for (let j = 0; i < fts.length; j++) {
|
||||
if (fts[j].faultType == row.faultType) {
|
||||
return fts[j].typeName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const searchOptionsFaultType = ref([{ label: '全部', value: '' }]);
|
||||
function handleSelectFaultType() {
|
||||
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'))
|
||||
) {
|
||||
searchOptionsFaultType.value.push({
|
||||
label: item.typeName,
|
||||
value: item.faultType,
|
||||
});
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function searchTable() {
|
||||
tableRef.value?.requestServerInteraction();
|
||||
}
|
||||
|
||||
const noUse = ref('');
|
||||
function reset() {
|
||||
filter.faultTypes = [];
|
||||
}
|
||||
|
||||
const onDialogShow = () => {
|
||||
if (props.dialogTitle == '故障指导') {
|
||||
faultName.value = '指导关键点';
|
||||
} else {
|
||||
faultName.value = '退出服务';
|
||||
}
|
||||
|
||||
queryAllFaultType();
|
||||
tableRef.value?.requestServerInteraction();
|
||||
};
|
||||
</script>
|
||||
@ -171,4 +258,9 @@ const onDialogShow = () => {
|
||||
white-space: pre-wrap;
|
||||
font-size: 14px;
|
||||
}
|
||||
.button-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-top: 10px;
|
||||
}
|
||||
</style>
|
||||
|
@ -45,6 +45,7 @@
|
||||
/>
|
||||
<q-select
|
||||
dense
|
||||
multiple
|
||||
label="故障类型"
|
||||
v-model="filter.faultType"
|
||||
emit-value
|
||||
@ -243,7 +244,7 @@ const pagination = ref({
|
||||
});
|
||||
|
||||
const filter = ref({
|
||||
faultType: '',
|
||||
faultType: [],
|
||||
lineId: 0,
|
||||
});
|
||||
|
||||
@ -260,7 +261,7 @@ const onRequest: QTable['onRequest'] = async (props) => {
|
||||
lineId: filter.value.lineId,
|
||||
});
|
||||
}
|
||||
if (filter.value.faultType !== '') {
|
||||
if (filter.value.faultType.length) {
|
||||
Object.assign(params, {
|
||||
faultType: filter.value.faultType,
|
||||
});
|
||||
@ -376,7 +377,7 @@ const searchOptionsFaultType = ref<{ label: string; value: string }[]>([
|
||||
{ label: '全部', value: '' },
|
||||
]);
|
||||
function handleSelectSearchLineId() {
|
||||
filter.value.faultType = '';
|
||||
filter.value.faultType = [];
|
||||
searchOptionsFaultType.value = [{ label: '全部', value: '' }];
|
||||
if (filter.value.lineId == 0) {
|
||||
handleSelectAllFaultType();
|
||||
|
Loading…
Reference in New Issue
Block a user