音乐替换-范围管理和决策信息管理优化添加查询条件
This commit is contained in:
parent
65b70debed
commit
238edf7869
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,13 +13,15 @@ export async function getDeviceAreaList({
|
||||
deviceType,
|
||||
current,
|
||||
size,
|
||||
areaName,
|
||||
}: {
|
||||
lineId?: string;
|
||||
deviceType?: string;
|
||||
areaName?: string;
|
||||
} & PageQueryDto) {
|
||||
const resp = await api.get<PageDto<IAreaConfigListItem>>(
|
||||
'/api/config/device/area/page',
|
||||
{ params: { current, size, lineId, deviceType } }
|
||||
`/api/config/device/area/page/${lineId}`,
|
||||
{ params: { current, size, deviceType, areaName } }
|
||||
);
|
||||
if (resp.status === 200) {
|
||||
return resp.data;
|
||||
@ -61,10 +63,3 @@ export function queryDeviceRangeById(
|
||||
interface IAreaConfig<T = unknown> {
|
||||
data: T;
|
||||
}
|
||||
|
||||
export async function getAllDeviceArea() {
|
||||
return await api.get<PageDto<IAreaConfigListItem>>(
|
||||
'/api/config/device/area/page',
|
||||
{ params: { current: 1, size: 50 } }
|
||||
);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { api } from 'src/boot/axios';
|
||||
import { PageDto, PageQueryDto } from './ApiCommon';
|
||||
|
||||
const DraftUriBase = '/api/alertTip';
|
||||
const AlertTipUriBase = '/api/alertTip';
|
||||
|
||||
interface AlarmInfoCreateParams {
|
||||
alertType: string;
|
||||
@ -18,12 +18,13 @@ export interface AlarmInfoListItem {
|
||||
areaConfigId: number;
|
||||
drivingInfo: string;
|
||||
submissionInfo: string;
|
||||
areaConfigName?: string;
|
||||
}
|
||||
|
||||
export class PagingQueryParams extends PageQueryDto {
|
||||
alertType?: string;
|
||||
timeType?: string;
|
||||
areaConfigId?: number;
|
||||
areaConfigName?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -34,7 +35,7 @@ export class PagingQueryParams extends PageQueryDto {
|
||||
export async function alarmInfoPageQuery(
|
||||
params: PagingQueryParams
|
||||
): Promise<PageDto<AlarmInfoListItem>> {
|
||||
const response = await api.get(`${DraftUriBase}/page`, {
|
||||
const response = await api.get(`${AlertTipUriBase}/page`, {
|
||||
params: params,
|
||||
});
|
||||
return response.data;
|
||||
@ -47,7 +48,7 @@ export async function alarmInfoPageQuery(
|
||||
export function queryAlarmInfoById(
|
||||
id: number
|
||||
): Promise<AlarmInfo<AlarmInfoListItem>> {
|
||||
return api.get(`${DraftUriBase}/id/${id}`);
|
||||
return api.get(`${AlertTipUriBase}/id/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -57,7 +58,7 @@ export function queryAlarmInfoById(
|
||||
export function queryAlarmInfoByType(
|
||||
type: string
|
||||
): Promise<AlarmInfo<AlarmInfoListItem>> {
|
||||
return api.get(`${DraftUriBase}/type/${type}`);
|
||||
return api.get(`${AlertTipUriBase}/type/${type}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -66,7 +67,7 @@ export function queryAlarmInfoByType(
|
||||
* @returns
|
||||
*/
|
||||
export function createAlarmInfo(draftData: AlarmInfoCreateParams) {
|
||||
return api.post(`${DraftUriBase}`, draftData);
|
||||
return api.post(`${AlertTipUriBase}`, draftData);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -74,7 +75,7 @@ export function createAlarmInfo(draftData: AlarmInfoCreateParams) {
|
||||
* @param id 草稿id
|
||||
*/
|
||||
export function deleteAlarmInfo(id: number) {
|
||||
return api.delete(`${DraftUriBase}/id/${id}`);
|
||||
return api.delete(`${AlertTipUriBase}/id/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -83,7 +84,7 @@ export function deleteAlarmInfo(id: number) {
|
||||
* @returns
|
||||
*/
|
||||
export function updataAlarmInfo(id: number, data: AlarmInfoListItem) {
|
||||
return api.put(`${DraftUriBase}/id`, data);
|
||||
return api.put(`${AlertTipUriBase}/id`, data);
|
||||
}
|
||||
|
||||
export interface AlarmInfo<T = unknown> {
|
||||
@ -100,7 +101,7 @@ export async function getDeviceAreaByAlarmType(
|
||||
alertType: string
|
||||
): Promise<AreaConfigItem[]> {
|
||||
const response = await api.post(
|
||||
`${DraftUriBase}/find/type/${id}/${alertType}`,
|
||||
`${AlertTipUriBase}/find/type/${id}/${alertType}`,
|
||||
{}
|
||||
);
|
||||
return response.data;
|
||||
|
@ -1,3 +1,47 @@
|
||||
<template>
|
||||
<q-dialog
|
||||
ref="dialogRef"
|
||||
@hide="onHide"
|
||||
v-bind="$attrs"
|
||||
@show="emit('show')"
|
||||
transitionShow="jump-up"
|
||||
transitionHide="jump-down"
|
||||
class="column"
|
||||
>
|
||||
<q-card
|
||||
:style="{
|
||||
transform: `translate3d(${offset.x}px, ${offset.y}px, 1px)`,
|
||||
background: `${props.bgColor}`,
|
||||
}"
|
||||
style="max-width: 2000px"
|
||||
>
|
||||
<q-bar
|
||||
ref="headerRef"
|
||||
class="non-selectable q-gutter-l"
|
||||
style="cursor: move"
|
||||
:style="`height: ${props.titleHeight}px;background: ${props.titleColor}`"
|
||||
>
|
||||
<div
|
||||
:style="`color:${props.fontColor};font-size: ${props.fontSize}px;`"
|
||||
>
|
||||
{{ props.title }}
|
||||
</div>
|
||||
<q-space />
|
||||
<div style="margin-right: 10px"><slot name="titleButton"></slot></div>
|
||||
<q-btn dense flat icon="sym_o_close" v-close-popup></q-btn>
|
||||
</q-bar>
|
||||
<q-scroll-area
|
||||
:style="`width: ${props.width}px; height: ${props.height}px;`"
|
||||
>
|
||||
<slot></slot>
|
||||
</q-scroll-area>
|
||||
<div :style="`width: ${props.width}px`">
|
||||
<slot name="footer"></slot>
|
||||
</div>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { QBar, useDialogPluginComponent } from 'quasar';
|
||||
import { ref, onMounted, onUnmounted, reactive } from 'vue';
|
||||
@ -67,46 +111,3 @@ function onHide() {
|
||||
onDialogHide();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<q-dialog
|
||||
ref="dialogRef"
|
||||
@hide="onHide"
|
||||
v-bind="$attrs"
|
||||
@show="emit('show')"
|
||||
transitionShow="jump-up"
|
||||
transitionHide="jump-down"
|
||||
class="column"
|
||||
>
|
||||
<q-card
|
||||
:style="{
|
||||
transform: `translate3d(${offset.x}px, ${offset.y}px, 1px)`,
|
||||
background: `${props.bgColor}`,
|
||||
}"
|
||||
style="max-width: 2000px"
|
||||
>
|
||||
<q-bar
|
||||
ref="headerRef"
|
||||
class="non-selectable q-gutter-l"
|
||||
style="cursor: move"
|
||||
:style="`height: ${props.titleHeight}px;background: ${props.titleColor}`"
|
||||
>
|
||||
<div
|
||||
:style="`color:${props.fontColor};font-size: ${props.fontSize}px;`"
|
||||
>
|
||||
{{ props.title }}
|
||||
</div>
|
||||
<q-space />
|
||||
<q-btn dense flat icon="sym_o_close" v-close-popup></q-btn>
|
||||
</q-bar>
|
||||
<q-scroll-area
|
||||
:style="`width: ${props.width}px; height: ${props.height}px;`"
|
||||
>
|
||||
<slot></slot>
|
||||
</q-scroll-area>
|
||||
<div :style="`width: ${props.width}px`">
|
||||
<slot name="footer"></slot>
|
||||
</div>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
</template>
|
||||
|
@ -120,8 +120,9 @@ const optionsAlertType = [
|
||||
'整侧站台门无关闭锁紧信号',
|
||||
'整侧站台门无法打开',
|
||||
'整侧站台门无法关闭',
|
||||
'道岔失表',
|
||||
'道岔均失表',
|
||||
'道岔定位失表',
|
||||
'道岔反位失表',
|
||||
'计轴红光带',
|
||||
'计轴大面积红光带',
|
||||
'计轴橙光带',
|
||||
|
@ -4,7 +4,7 @@ import {
|
||||
getDeviceAreaList,
|
||||
deleteDeviceArea,
|
||||
} from 'src/api/ConfigApi';
|
||||
import { ref } from 'vue';
|
||||
import { ref, watch } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import DraggableDialog from '../common/DraggableDialog.vue';
|
||||
import { QTable, useQuasar } from 'quasar';
|
||||
@ -41,15 +41,33 @@ const pagination = ref({
|
||||
rowsNumber: 10,
|
||||
});
|
||||
|
||||
const searchAreaName = ref('');
|
||||
watch(
|
||||
() => searchAreaName.value,
|
||||
() => {
|
||||
tableRef.value?.requestServerInteraction();
|
||||
}
|
||||
);
|
||||
|
||||
const onRequest: QTable['onRequest'] = async (props) => {
|
||||
const { page, rowsPerPage } = props.pagination;
|
||||
loading.value = true;
|
||||
const resp = await getDeviceAreaList({
|
||||
lineId,
|
||||
current: page,
|
||||
size: rowsPerPage,
|
||||
});
|
||||
|
||||
let resp;
|
||||
try {
|
||||
resp = await getDeviceAreaList({
|
||||
lineId,
|
||||
current: page,
|
||||
size: rowsPerPage,
|
||||
areaName: searchAreaName.value,
|
||||
});
|
||||
} catch (error) {
|
||||
errorNotify('没有所查区域名称', '');
|
||||
resp = await getDeviceAreaList({
|
||||
lineId,
|
||||
current: page,
|
||||
size: rowsPerPage,
|
||||
});
|
||||
}
|
||||
pagination.value.page = resp.current;
|
||||
pagination.value.rowsNumber = resp.total;
|
||||
pagination.value.rowsPerPage = resp.size;
|
||||
@ -113,5 +131,29 @@ function deleteData(row: IAreaConfigListItem) {
|
||||
</template>
|
||||
</q-table>
|
||||
</template>
|
||||
<template v-slot:titleButton>
|
||||
<q-btn square color="purple" style="margin-right: 10px" icon="search">
|
||||
<q-popup-edit
|
||||
ref="popupEdit"
|
||||
v-model="searchAreaName"
|
||||
:cover="false"
|
||||
:offset="[0, 10]"
|
||||
v-slot="scope"
|
||||
>
|
||||
<q-input
|
||||
color="accent"
|
||||
v-model="scope.value"
|
||||
label="区域名称"
|
||||
dense
|
||||
autofocus
|
||||
@keyup.enter="scope.set"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="search" color="accent" />
|
||||
</template>
|
||||
</q-input>
|
||||
</q-popup-edit>
|
||||
</q-btn>
|
||||
</template>
|
||||
</draggable-dialog>
|
||||
</template>
|
||||
|
@ -10,7 +10,6 @@
|
||||
v-model:pagination="pagination"
|
||||
:rows-per-page-options="[10, 20, 50, 100]"
|
||||
:loading="loading"
|
||||
:filter="filter"
|
||||
binary-state-sort
|
||||
@request="onRequest"
|
||||
>
|
||||
@ -28,13 +27,12 @@
|
||||
</q-td>
|
||||
</template>
|
||||
<template v-slot:top-right>
|
||||
<q-input
|
||||
dense
|
||||
debounce="1000"
|
||||
v-model="filter.alertType"
|
||||
label="故障类型"
|
||||
></q-input>
|
||||
<q-btn flat round color="primary" icon="search" />
|
||||
<q-btn
|
||||
class="q-mr-md"
|
||||
color="primary"
|
||||
label="查询"
|
||||
@click="searchDialog = true"
|
||||
/>
|
||||
<q-btn color="primary" label="新建" @click="createFormShow = true" />
|
||||
</template>
|
||||
|
||||
@ -118,6 +116,38 @@
|
||||
</q-form>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
|
||||
<q-dialog
|
||||
v-model="searchDialog"
|
||||
persistent
|
||||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
>
|
||||
<q-card style="width: 300px">
|
||||
<q-card-section>
|
||||
<div class="text-h6">查询决策信息</div>
|
||||
</q-card-section>
|
||||
<q-card-section>
|
||||
<q-select
|
||||
outlined
|
||||
label="故障类型"
|
||||
v-model="filter.alertType"
|
||||
:options="optionsAlertType"
|
||||
class="q-mb-md"
|
||||
/>
|
||||
<q-input
|
||||
outlined
|
||||
v-model="filter.areaConfigName"
|
||||
label="区域名称"
|
||||
></q-input>
|
||||
</q-card-section>
|
||||
|
||||
<q-card-actions align="right">
|
||||
<q-btn color="primary" label="确定" @click="searchDecisionInfo()" />
|
||||
<q-btn label="取消" v-close-popup />
|
||||
</q-card-actions>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -131,12 +161,12 @@ import {
|
||||
updataAlarmInfo,
|
||||
AlarmInfoListItem,
|
||||
getDeviceAreaByAlarmType,
|
||||
AreaConfigItem,
|
||||
} from '../api/DecisionInfo';
|
||||
import {
|
||||
showAlertTypeData,
|
||||
saveAlertTypeData,
|
||||
} from 'src/components/alarm/alarmInfoEnum';
|
||||
import { getAllDeviceArea, IAreaConfigListItem } from 'src/api/ConfigApi';
|
||||
|
||||
const $q = useQuasar();
|
||||
|
||||
@ -151,11 +181,6 @@ const tableHeight = computed(() => {
|
||||
return props.sizeHeight - 32;
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
tableRef.value.requestServerInteraction();
|
||||
searchAllLocationType();
|
||||
});
|
||||
|
||||
const columnDefs: QTableColumn[] = [
|
||||
{
|
||||
name: 'id',
|
||||
@ -183,18 +208,7 @@ const columnDefs: QTableColumn[] = [
|
||||
{
|
||||
name: 'areaConfigId',
|
||||
label: '地点定义类型',
|
||||
field: (row) => {
|
||||
if (row.areaConfigId) {
|
||||
let areaConfigareaName;
|
||||
for (let i = 0; i < optionsLocationList.length; i++) {
|
||||
if (optionsLocationList[i].id == row.areaConfigId) {
|
||||
areaConfigareaName = optionsLocationList[i].areaName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return areaConfigareaName;
|
||||
}
|
||||
},
|
||||
field: 'areaConfigName',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
@ -223,8 +237,9 @@ const columnDefs: QTableColumn[] = [
|
||||
const operateDisabled = ref(false);
|
||||
const tableRef = ref();
|
||||
const rows = reactive([]);
|
||||
const filter = reactive({
|
||||
const filter = ref({
|
||||
alertType: '',
|
||||
areaConfigName: '',
|
||||
});
|
||||
const loading = ref(false);
|
||||
const pagination = ref({
|
||||
@ -237,13 +252,13 @@ const pagination = ref({
|
||||
|
||||
const onRequest: QTable['onRequest'] = async (props) => {
|
||||
const { page, rowsPerPage, sortBy, descending } = props.pagination;
|
||||
const filter = props.filter;
|
||||
loading.value = true;
|
||||
try {
|
||||
let response = await alarmInfoPageQuery({
|
||||
current: page,
|
||||
size: rowsPerPage,
|
||||
alertType: (saveAlertTypeData as never)[filter.alertType],
|
||||
alertType: (saveAlertTypeData as never)[filter.value.alertType],
|
||||
areaConfigName: filter.value.areaConfigName,
|
||||
});
|
||||
const pageData = response;
|
||||
pagination.value.rowsNumber = pageData.total;
|
||||
@ -262,6 +277,24 @@ const onRequest: QTable['onRequest'] = async (props) => {
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
setTimeout(() => {
|
||||
tableRef.value.requestServerInteraction();
|
||||
});
|
||||
});
|
||||
|
||||
const searchDialog = ref(false);
|
||||
function searchDecisionInfo() {
|
||||
searchDialog.value = false;
|
||||
try {
|
||||
tableRef.value.requestServerInteraction();
|
||||
} finally {
|
||||
setTimeout(() => {
|
||||
filter.value = { alertType: '', areaConfigId: '' };
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const createFormShow = ref(false);
|
||||
const myForm = ref<QForm | null>(null);
|
||||
const creatForm = reactive({
|
||||
@ -304,11 +337,14 @@ function onReset() {
|
||||
myForm.value?.resetValidation();
|
||||
}
|
||||
|
||||
let optionsLocationList: AreaConfigItem[] = [];
|
||||
async function searchLocationType() {
|
||||
try {
|
||||
const alertType = (saveAlertTypeData as never)[creatForm.alertType];
|
||||
const res = await getDeviceAreaByAlarmType(3, alertType);
|
||||
optionsLocationType.value = res.map((item) => item.areaName);
|
||||
optionsLocationList = await getDeviceAreaByAlarmType(3, alertType);
|
||||
optionsLocationType.value = optionsLocationList.map(
|
||||
(item) => item.areaName
|
||||
);
|
||||
optionsLocationType.value.push('无');
|
||||
} catch (err) {
|
||||
$q.notify({
|
||||
@ -318,19 +354,6 @@ async function searchLocationType() {
|
||||
}
|
||||
}
|
||||
|
||||
let optionsLocationList: IAreaConfigListItem[] = [];
|
||||
async function searchAllLocationType() {
|
||||
try {
|
||||
const resp = await getAllDeviceArea();
|
||||
optionsLocationList = resp.data.records;
|
||||
} catch (err) {
|
||||
$q.notify({
|
||||
type: 'negative',
|
||||
message: '无法获取范围配置列表',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function onCreate() {
|
||||
myForm.value?.validate().then(async (res) => {
|
||||
if (res) {
|
||||
@ -381,13 +404,7 @@ function editData(row: AlarmInfoListItem) {
|
||||
creatForm.id = row.id + '';
|
||||
creatForm.alertType = (showAlertTypeData as never)[row.alertType + ''];
|
||||
creatForm.timeType = row.timeType || '';
|
||||
creatForm.areaConfigId = (showAlertTypeData as never)[row.areaConfigId + ''];
|
||||
for (let i = 0; i < optionsLocationList.length; i++) {
|
||||
if (optionsLocationList[i].id == row.areaConfigId) {
|
||||
creatForm.areaConfigId = optionsLocationList[i].areaName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
creatForm.areaConfigId = row.areaConfigName as string;
|
||||
creatForm.drivingInfo = row.drivingInfo ? JSON.parse(row.drivingInfo) : '';
|
||||
creatForm.submissionInfo = row.submissionInfo
|
||||
? JSON.parse(row.submissionInfo)
|
||||
|
Loading…
Reference in New Issue
Block a user