类型修改,去any

This commit is contained in:
joylink_zhaoerwei 2023-08-23 16:54:15 +08:00
parent e46997271a
commit 9901c2334f
2 changed files with 18 additions and 13 deletions

View File

@ -3,7 +3,7 @@ import { PageDto, PageQueryDto } from './ApiCommon';
const DraftUriBase = '/api/alertTip';
export interface createParams {
interface AlarmInfoCreateParams {
alertType: string;
timeType: string;
areaConfigId: number;
@ -11,7 +11,7 @@ export interface createParams {
submissionInfo: string;
}
interface Item {
export interface AlarmInfoListItem {
id: number;
alertType: string;
timeType: string;
@ -33,7 +33,7 @@ export class PagingQueryParams extends PageQueryDto {
*/
export async function alarmInfoPageQuery(
params: PagingQueryParams
): Promise<PageDto<Item>> {
): Promise<PageDto<AlarmInfoListItem>> {
const response = await api.get(`${DraftUriBase}/page`, {
params: params,
});
@ -44,7 +44,9 @@ export async function alarmInfoPageQuery(
* id获取决策信息
* @param id 稿id
*/
export function queryAlarmInfoById(id: number): Promise<AlarmInfo<Item>> {
export function queryAlarmInfoById(
id: number
): Promise<AlarmInfo<AlarmInfoListItem>> {
return api.get(`${DraftUriBase}/id/${id}`);
}
@ -52,7 +54,9 @@ export function queryAlarmInfoById(id: number): Promise<AlarmInfo<Item>> {
*
* @param type 稿type
*/
export function queryAlarmInfoByType(type: string): Promise<AlarmInfo<Item>> {
export function queryAlarmInfoByType(
type: string
): Promise<AlarmInfo<AlarmInfoListItem>> {
return api.get(`${DraftUriBase}/type/${type}`);
}
@ -61,7 +65,7 @@ export function queryAlarmInfoByType(type: string): Promise<AlarmInfo<Item>> {
* @param params
* @returns
*/
export function createAlarmInfo(draftData: createParams) {
export function createAlarmInfo(draftData: AlarmInfoCreateParams) {
return api.post(`${DraftUriBase}`, draftData);
}
@ -78,7 +82,7 @@ export function deleteAlarmInfo(id: number) {
* @param data
* @returns
*/
export function updataAlarmInfo(id: number, data: Item) {
export function updataAlarmInfo(id: number, data: AlarmInfoListItem) {
return api.put(`${DraftUriBase}/id`, data);
}

View File

@ -122,12 +122,13 @@
<script setup lang="ts">
import { ref, reactive, onMounted, computed } from 'vue';
import { useQuasar, type QTableColumn, QForm } from 'quasar';
import { useQuasar, type QTableColumn, QForm, QTable } from 'quasar';
import {
alarmInfoPageQuery,
deleteAlarmInfo,
createAlarmInfo,
updataAlarmInfo,
AlarmInfoListItem,
} from '../api/DecisionInfo';
import {
showAlertTypeData,
@ -232,7 +233,7 @@ const pagination = ref({
rowsNumber: 10,
});
async function onRequest(props: any) {
const onRequest: QTable['onRequest'] = async (props) => {
const { page, rowsPerPage, sortBy, descending } = props.pagination;
const filter = props.filter;
loading.value = true;
@ -257,7 +258,7 @@ async function onRequest(props: any) {
} finally {
loading.value = false;
}
}
};
const createFormShow = ref(false);
const myForm = ref<QForm | null>(null);
@ -359,8 +360,8 @@ function onCreate() {
});
}
function editData(row: any) {
creatForm.id = row.id;
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 + ''];
@ -377,7 +378,7 @@ function editData(row: any) {
createFormShow.value = true;
}
async function deleteData(row: any) {
async function deleteData(row: AlarmInfoListItem) {
operateDisabled.value = true;
$q.dialog({
title: '确认',