故障查询相关调整

This commit is contained in:
joylink_zhaoerwei 2024-11-08 17:47:19 +08:00
parent 4adeedb4d5
commit 7971887d2c
3 changed files with 71 additions and 35 deletions

View File

@ -18,7 +18,7 @@ export interface FaultQueryInfo<T = unknown> {
export class PagingQueryParams extends PageQueryDto {
lineId?: string;
faultType?: string[];
faultType?: string;
faultName?: string;
}

View File

@ -4,7 +4,7 @@
ref="dialogRef"
@show="onDialogShow"
:title="props.dialogTitle"
:width="800"
:width="990"
:height="0"
>
<template v-slot:footer>
@ -50,14 +50,22 @@
<q-select
dense
label="故障类型"
multiple
v-model="filter.faultTypes"
v-model="filter.faultType"
emit-value
map-options
:options="searchOptionsFaultType"
@update:model-value="searchTable"
style="min-width: 130px"
/>
<q-input label="故障内容" v-model="filter.faultName" lazy-rules />
<div class="button-container">
<q-btn
color="primary"
label="查询"
type="submit"
style="margin-top: 10px"
@click="searchTable"
/>
</div>
</q-popup-edit>
</q-btn>
</template>
@ -65,7 +73,7 @@
</template>
<script setup lang="ts">
import { reactive, ref } from 'vue';
import { onMounted, reactive, ref,computed } from 'vue';
import { useRoute } from 'vue-router';
import DraggableDialog from '../common/DraggableDialog.vue';
import { QTable, useQuasar } from 'quasar';
@ -82,10 +90,15 @@ const props = defineProps<{
const $q = useQuasar();
const lineId = useRoute().params.lineId as string;
let faultName = ref('');
const tableTitle = reactive({
faultNameShower: '',
faultDriverShower: '',
resultMsg: '',
});
const tableRef = ref<QTable>();
const columns: QTable['columns'] = [
const columns =computed(()=> [
{
name: 'id',
label: '编号',
@ -103,7 +116,7 @@ const columns: QTable['columns'] = [
{
name: 'faultType',
label: '故障类型',
field: (row) => {
field: (row:FaultQueryListItem) => {
if (row.faultType) {
return getFaultTypeName(row);
}
@ -112,26 +125,26 @@ const columns: QTable['columns'] = [
},
{
name: 'faultNameShower',
label: '消息名称',
label: tableTitle.faultNameShower,
field: 'faultNameShower',
required: true,
align: 'center',
},
{
name: 'faultDriverShower',
label: '司机处理结果',
label: tableTitle.faultDriverShower,
field: 'faultDriverShower',
required: true,
align: 'center',
},
{
name: 'resultMsg',
label: '司机关键点',
label: tableTitle.resultMsg,
field: 'resultMsg',
required: true,
align: 'center',
},
];
])
const rows = reactive([]);
const loading = ref(false);
const pagination = ref({
@ -143,7 +156,8 @@ const pagination = ref({
});
const filter = reactive({
faultTypes: [],
faultType: '',
faultName: '',
});
const onRequest: QTable['onRequest'] = async (props) => {
@ -154,11 +168,15 @@ const onRequest: QTable['onRequest'] = async (props) => {
current: page,
size: rowsPerPage,
lineId,
faultName: faultName.value,
};
if (filter.faultTypes.length) {
if (filter.faultType !== '') {
Object.assign(params, {
faultType: filter.faultTypes,
faultType: filter.faultType,
});
}
if (filter.faultName !== '') {
Object.assign(params, {
faultName: filter.faultName,
});
}
let resp = await faultQueryPageQuery(params);
@ -203,6 +221,7 @@ 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) => {
@ -216,8 +235,17 @@ function handleSelectFaultType() {
label: item.typeName,
value: item.faultType,
});
if (allType == '') {
allType = item.faultType;
} else {
allType = allType + ',' + item.faultType;
}
}
});
filter.faultType = allType;
searchOptionsFaultType.value[0].value = allType;
break;
}
}
@ -229,19 +257,28 @@ function searchTable() {
const noUse = ref('');
function reset() {
filter.faultTypes = [];
filter.faultType = '';
filter.faultName = '';
}
const onDialogShow = () => {
if (props.dialogTitle == '故障指导') {
faultName.value = '指导关键点';
} else {
faultName.value = '退出服务';
}
queryAllFaultType();
setTimeout(() => {
tableRef.value?.requestServerInteraction();
}, 1000);
};
onMounted(() => {
if (props.dialogTitle == '故障指导') {
tableTitle.faultNameShower = '故障现象';
tableTitle.faultDriverShower = '司机处理结果';
tableTitle.resultMsg = '行调提醒司机关键点';
} else {
tableTitle.faultNameShower = '故障名称';
tableTitle.faultDriverShower = '故障现象';
tableTitle.resultMsg = '退出服务地点';
}
});
</script>
<style scoped>

View File

@ -45,7 +45,6 @@
/>
<q-select
dense
multiple
label="故障类型"
v-model="filter.faultType"
emit-value
@ -122,7 +121,7 @@
/>
<q-input
outlined
label="消息名称"
label="消息名称(故障现象)"
v-model="creatForm.faultNameShower"
lazy-rules
:rules="[(val) => val.length > 0 || '请输入消息名称!']"
@ -130,7 +129,7 @@
<q-input
outlined
type="textarea"
label="司机处理结果"
label="司机处理结果(服务故障现象)"
v-model="creatForm.faultDriverShower"
lazy-rules
:rules="[(val) => val.length > 0 || '请输入司机处理结果!']"
@ -138,7 +137,7 @@
<q-input
outlined
type="textarea"
label="司机关键点"
label="司机关键点(退出服务地点)"
v-model="creatForm.resultMsg"
lazy-rules
:rules="[(val) => val.length > 0 || '请输入司机关键点!']"
@ -209,21 +208,21 @@ const columnDefs: QTableColumn[] = [
},
{
name: 'faultNameShower',
label: '消息名称',
label: '消息名称(故障现象)',
field: 'faultNameShower',
required: true,
align: 'center',
},
{
name: 'faultDriverShower',
label: '司机处理结果',
label: '司机处理结果(服务故障现象)',
field: 'faultDriverShower',
required: true,
align: 'center',
},
{
name: 'resultMsg',
label: '司机关键点',
label: '司机关键点(退出服务地点)',
field: 'resultMsg',
required: true,
align: 'center',
@ -244,7 +243,7 @@ const pagination = ref({
});
const filter = ref({
faultType: [],
faultType: '',
lineId: 0,
});
@ -261,7 +260,7 @@ const onRequest: QTable['onRequest'] = async (props) => {
lineId: filter.value.lineId,
});
}
if (filter.value.faultType.length) {
if (filter.value.faultType!=='') {
Object.assign(params, {
faultType: filter.value.faultType,
});
@ -377,7 +376,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();