增加故障查询
This commit is contained in:
parent
fbb08bb9e3
commit
0ecd9aac7c
@ -4,7 +4,7 @@ import { PageDto, PageQueryDto } from './ApiCommon';
|
|||||||
const faultQueryUriBase = '/api/fault/query';
|
const faultQueryUriBase = '/api/fault/query';
|
||||||
|
|
||||||
export interface FaultQueryListItem {
|
export interface FaultQueryListItem {
|
||||||
id: number;
|
id?: number;
|
||||||
lineId: number;
|
lineId: number;
|
||||||
faultType: string;
|
faultType: string;
|
||||||
faultNameShower: string;
|
faultNameShower: string;
|
||||||
@ -64,13 +64,14 @@ export function faultQueryById(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface FaultTypeItem {
|
export interface FaultTypeItem {
|
||||||
faultType: string;
|
fts: { faultType: string; typeName: string }[];
|
||||||
typeName: string;
|
lineId: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取故障类型
|
* 获取故障类型
|
||||||
*/
|
*/
|
||||||
export function faultQueryType() {
|
export async function faultQueryType(): Promise<Array<FaultTypeItem>> {
|
||||||
return api.get(`${faultQueryUriBase}/type`);
|
const response = await api.get(`${faultQueryUriBase}/type`);
|
||||||
|
return response.data;
|
||||||
}
|
}
|
||||||
|
@ -40,14 +40,17 @@
|
|||||||
style="width: 75px"
|
style="width: 75px"
|
||||||
no-error-icon
|
no-error-icon
|
||||||
lazy-rules
|
lazy-rules
|
||||||
|
@update:model-value="handleSelectSearchLineId"
|
||||||
:rules="[(val) => val >= 0 || '请选择线路ID!']"
|
:rules="[(val) => val >= 0 || '请选择线路ID!']"
|
||||||
/>
|
/>
|
||||||
<q-select
|
<q-select
|
||||||
dense
|
dense
|
||||||
label="故障类型"
|
label="故障类型"
|
||||||
v-model="filter.alertType"
|
v-model="filter.faultType"
|
||||||
|
emit-value
|
||||||
|
map-options
|
||||||
:options="searchOptionsFaultType"
|
:options="searchOptionsFaultType"
|
||||||
style="width: 130px"
|
style="min-width: 130px"
|
||||||
/>
|
/>
|
||||||
<q-btn color="primary" label="查询" type="submit" />
|
<q-btn color="primary" label="查询" type="submit" />
|
||||||
<q-btn
|
<q-btn
|
||||||
@ -104,13 +107,13 @@
|
|||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
lazy-rules
|
lazy-rules
|
||||||
|
@update:model-value="handleSelectLineId"
|
||||||
:rules="[(val) => val > 0 || '请选择线路ID!']"
|
:rules="[(val) => val > 0 || '请选择线路ID!']"
|
||||||
@blur="handleSelectLineId"
|
|
||||||
/>
|
/>
|
||||||
<q-select
|
<q-select
|
||||||
outlined
|
outlined
|
||||||
label="故障类型"
|
label="故障类型"
|
||||||
v-model="creatForm.alertType"
|
v-model="creatForm.faultType"
|
||||||
:options="optionsFaultType"
|
:options="optionsFaultType"
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
@ -121,6 +124,7 @@
|
|||||||
label="消息名称"
|
label="消息名称"
|
||||||
v-model="creatForm.faultNameShower"
|
v-model="creatForm.faultNameShower"
|
||||||
lazy-rules
|
lazy-rules
|
||||||
|
:rules="[(val) => val.length > 0 || '请输入消息名称!']"
|
||||||
/>
|
/>
|
||||||
<q-input
|
<q-input
|
||||||
outlined
|
outlined
|
||||||
@ -128,6 +132,7 @@
|
|||||||
label="司机处理结果"
|
label="司机处理结果"
|
||||||
v-model="creatForm.faultDriverShower"
|
v-model="creatForm.faultDriverShower"
|
||||||
lazy-rules
|
lazy-rules
|
||||||
|
:rules="[(val) => val.length > 0 || '请输入司机处理结果!']"
|
||||||
/>
|
/>
|
||||||
<q-input
|
<q-input
|
||||||
outlined
|
outlined
|
||||||
@ -135,6 +140,7 @@
|
|||||||
label="司机关键点"
|
label="司机关键点"
|
||||||
v-model="creatForm.resultMsg"
|
v-model="creatForm.resultMsg"
|
||||||
lazy-rules
|
lazy-rules
|
||||||
|
:rules="[(val) => val.length > 0 || '请输入司机关键点!']"
|
||||||
/>
|
/>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
|
|
||||||
@ -157,11 +163,8 @@ import {
|
|||||||
createFaultQuery,
|
createFaultQuery,
|
||||||
FaultQueryListItem,
|
FaultQueryListItem,
|
||||||
faultQueryType,
|
faultQueryType,
|
||||||
|
FaultTypeItem,
|
||||||
} from '../api/faultQuery';
|
} from '../api/faultQuery';
|
||||||
import {
|
|
||||||
showAlertTypeData,
|
|
||||||
saveAlertTypeData,
|
|
||||||
} from 'src/components/alarm/alarmInfoEnum';
|
|
||||||
import { ApiError } from 'src/boot/axios';
|
import { ApiError } from 'src/boot/axios';
|
||||||
import { pageQuery } from 'src/api/LineInfoApi';
|
import { pageQuery } from 'src/api/LineInfoApi';
|
||||||
|
|
||||||
@ -198,7 +201,7 @@ const columnDefs: QTableColumn[] = [
|
|||||||
label: '故障类型',
|
label: '故障类型',
|
||||||
field: (row) => {
|
field: (row) => {
|
||||||
if (row.faultType) {
|
if (row.faultType) {
|
||||||
return (showAlertTypeData as never)[row.faultType + ''];
|
return getFaultTypeName(row);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
align: 'center',
|
align: 'center',
|
||||||
@ -240,10 +243,8 @@ const pagination = ref({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const filter = ref({
|
const filter = ref({
|
||||||
alertType: '全部',
|
faultType: '全部',
|
||||||
areaConfigName: '',
|
|
||||||
lineId: 0,
|
lineId: 0,
|
||||||
lineType: '全部',
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const onRequest: QTable['onRequest'] = async (props) => {
|
const onRequest: QTable['onRequest'] = async (props) => {
|
||||||
@ -259,9 +260,9 @@ const onRequest: QTable['onRequest'] = async (props) => {
|
|||||||
lineId: filter.value.lineId,
|
lineId: filter.value.lineId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (filter.value.alertType !== '全部') {
|
if (filter.value.faultType !== '全部') {
|
||||||
Object.assign(params, {
|
Object.assign(params, {
|
||||||
alertType: (saveAlertTypeData as never)[filter.value.alertType],
|
faultType: filter.value.faultType,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
let response = await faultQueryPageQuery(params);
|
let response = await faultQueryPageQuery(params);
|
||||||
@ -284,6 +285,7 @@ const onRequest: QTable['onRequest'] = async (props) => {
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
queryLineInfo();
|
queryLineInfo();
|
||||||
|
queryAllFaultType();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
tableRef.value.requestServerInteraction();
|
tableRef.value.requestServerInteraction();
|
||||||
});
|
});
|
||||||
@ -327,13 +329,11 @@ async function queryLineInfo() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let optionsFaultType = ref<{ label: string; value: number }[]>([]);
|
let allOptionsFaultType: FaultTypeItem[] = [];
|
||||||
const searchOptionsFaultType = ['全部', ...optionsFaultType.value];
|
let optionsFaultType = ref<{ label: string; value: string }[]>([]);
|
||||||
async function handleSelectLineId() {
|
async function queryAllFaultType() {
|
||||||
try {
|
try {
|
||||||
const res = await faultQueryType();
|
allOptionsFaultType = await faultQueryType();
|
||||||
console.log(res.data, 111);
|
|
||||||
console.log(typeof res.data, 4444);
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
$q.notify({
|
$q.notify({
|
||||||
type: 'negative',
|
type: 'negative',
|
||||||
@ -342,19 +342,71 @@ async function handleSelectLineId() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleSelectLineId() {
|
||||||
|
optionsFaultType.value = [];
|
||||||
|
creatForm.faultType = '';
|
||||||
|
for (let i = 0; i < allOptionsFaultType.length; i++) {
|
||||||
|
if (allOptionsFaultType[i].lineId == +creatForm.lineId) {
|
||||||
|
allOptionsFaultType[i].fts.forEach((item) => {
|
||||||
|
optionsFaultType.value.push({
|
||||||
|
label: item.typeName,
|
||||||
|
value: item.faultType,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const searchOptionsFaultType = ref<{ label: string; value: string }[]>([
|
||||||
|
{ label: '全部', value: '全部' },
|
||||||
|
]);
|
||||||
|
function handleSelectSearchLineId() {
|
||||||
|
filter.value.faultType = '全部';
|
||||||
|
searchOptionsFaultType.value = [{ label: '全部', value: '' }];
|
||||||
|
for (let i = 0; i < allOptionsFaultType.length; i++) {
|
||||||
|
if (allOptionsFaultType[i].lineId == +filter.value.lineId) {
|
||||||
|
allOptionsFaultType[i].fts.forEach((item) => {
|
||||||
|
searchOptionsFaultType.value.push({
|
||||||
|
label: item.typeName,
|
||||||
|
value: item.faultType,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function onCreate() {
|
function onCreate() {
|
||||||
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 = {
|
const params = {
|
||||||
id: +creatForm.id,
|
|
||||||
lineId: +creatForm.lineId,
|
lineId: +creatForm.lineId,
|
||||||
faultType: creatForm.faultType,
|
faultType: creatForm.faultType,
|
||||||
faultNameShower: creatForm.faultNameShower,
|
faultNameShower: creatForm.faultNameShower,
|
||||||
faultDriverShower: creatForm.faultDriverShower,
|
faultDriverShower: creatForm.faultDriverShower,
|
||||||
resultMsg: creatForm.resultMsg,
|
resultMsg: creatForm.resultMsg,
|
||||||
};
|
};
|
||||||
|
if (creatForm.id !== '') {
|
||||||
|
Object.assign(params, {
|
||||||
|
id: +creatForm.id,
|
||||||
|
});
|
||||||
|
}
|
||||||
await createFaultQuery(params);
|
await createFaultQuery(params);
|
||||||
onReset();
|
onReset();
|
||||||
createFormShow.value = false;
|
createFormShow.value = false;
|
||||||
@ -391,7 +443,7 @@ async function deleteData(row: FaultQueryListItem) {
|
|||||||
})
|
})
|
||||||
.onOk(async () => {
|
.onOk(async () => {
|
||||||
try {
|
try {
|
||||||
await deleteFaultQueryById(row.id);
|
await deleteFaultQueryById(row.id as number);
|
||||||
tableRef.value.requestServerInteraction(); // 刷新列表
|
tableRef.value.requestServerInteraction(); // 刷新列表
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
$q.notify({
|
$q.notify({
|
||||||
|
Loading…
Reference in New Issue
Block a user