This commit is contained in:
2025-12-07 18:58:41 +08:00
parent 221ecbf05a
commit e388613fc8
26 changed files with 3368 additions and 722 deletions

View File

@@ -25,6 +25,9 @@ export interface BizDeviceInfo extends BasicModel<BizDeviceInfo> {
export const bizDeviceInfoList = (params?: BizDeviceInfo | any) =>
defHttp.get<BizDeviceInfo>({ url: adminPath + '/biz/deviceInfo/list', params });
export const bizDeviceInfoListAll = (params?: BizDeviceInfo | any) =>
defHttp.get<BizDeviceInfo[]>({ url: adminPath + '/biz/deviceInfo/listAll', params });
export const bizDeviceInfoListData = (params?: BizDeviceInfo | any) =>
defHttp.post<Page<BizDeviceInfo>>({ url: adminPath + '/biz/deviceInfo/listData', params });

View File

@@ -29,6 +29,9 @@ export interface BizServerInfo extends BasicModel<BizServerInfo> {
export const bizServerInfoList = (params?: BizServerInfo | any) =>
defHttp.get<BizServerInfo>({ url: adminPath + '/biz/serverInfo/list', params });
export const bizServerInfoListAll = (params?: BizServerInfo | any) =>
defHttp.get<BizServerInfo[]>({ url: adminPath + '/biz/serverInfo/listAll', params });
export const bizServerInfoListData = (params?: BizServerInfo | any) =>
defHttp.post<Page<BizServerInfo>>({ url: adminPath + '/biz/serverInfo/listData', params });

View File

@@ -0,0 +1,59 @@
/**
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
* No deletion without permission, or be held responsible to law.
* @author gaoxq
*/
import { defHttp } from '@jeesite/core/utils/http/axios';
import { useGlobSetting } from '@jeesite/core/hooks/setting';
import { BasicModel, Page } from '@jeesite/core/api/model/baseModel';
import { UploadApiResult } from '@jeesite/core/api/sys/upload';
import { UploadFileParams } from '@jeesite/types/axios';
import { AxiosProgressEvent } from 'axios';
const { ctxPath, adminPath } = useGlobSetting();
export interface BizWarningAlert extends BasicModel<BizWarningAlert> {
createTime: string; // 创建时间
alertCode: string; // 预警编码
alertType: string; // 预警类型
alertLevel: number; // 预警级别
alertTitle: string; // 预警标题
alertContent: string; // 预警详细内容
triggerTime: string; // 预警触发时间
sourceSystem?: string; // 来源系统
alertStatus: string; // 预警状态
handlerUser?: string; // 处理人员
handleTime: string; // 处理时间
handleNote: string; // 处理备注
updateTime?: string; // 更新时间
}
export const bizWarningAlertList = (params?: BizWarningAlert | any) =>
defHttp.get<BizWarningAlert>({ url: adminPath + '/biz/warningAlert/list', params });
export const bizWarningAlertListAll = (params?: BizWarningAlert | any) =>
defHttp.get<BizWarningAlert[]>({ url: adminPath + '/biz/warningAlert/listAll', params });
export const bizWarningAlertListData = (params?: BizWarningAlert | any) =>
defHttp.post<Page<BizWarningAlert>>({ url: adminPath + '/biz/warningAlert/listData', params });
export const bizWarningAlertForm = (params?: BizWarningAlert | any) =>
defHttp.get<BizWarningAlert>({ url: adminPath + '/biz/warningAlert/form', params });
export const bizWarningAlertSave = (params?: any, data?: BizWarningAlert | any) =>
defHttp.postJson<BizWarningAlert>({ url: adminPath + '/biz/warningAlert/save', params, data });
export const bizWarningAlertImportData = (
params: UploadFileParams,
onUploadProgress: (progressEvent: AxiosProgressEvent) => void,
) =>
defHttp.uploadFile<UploadApiResult>(
{
url: ctxPath + adminPath + '/biz/warningAlert/importData',
onUploadProgress,
},
params,
);
export const bizWarningAlertDelete = (params?: BizWarningAlert | any) =>
defHttp.get<BizWarningAlert>({ url: adminPath + '/biz/warningAlert/delete', params });

View File

@@ -0,0 +1,103 @@
<!--
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
* No deletion without permission, or be held responsible to law.
* @author gaoxq
-->
<template>
<BasicModal
v-bind="$attrs"
:title="t('导入预警信息')"
:okText="t('导入')"
@register="registerModal"
@ok="handleSubmit"
:minHeight="120"
:width="400"
>
<Upload accept=".xls,.xlsx" :file-list="fileList" :before-upload="beforeUpload" @remove="handleRemove">
<a-button> <Icon icon="ant-design:upload-outlined" /> {{ t('选择文件') }} </a-button>
<span class="ml-4">{{ uploadInfo }}</span>
</Upload>
<div class="ml-4 mt-4">
{{ t('提示仅允许导入“xls”或“xlsx”格式文件') }}
</div>
<div class="mt-4">
<a-button @click="handleDownloadTemplate()" type="text">
<Icon icon="i-fa:file-excel-o" />
{{ t('下载模板') }}
</a-button>
</div>
</BasicModal>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import { Upload } from 'ant-design-vue';
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
import { useGlobSetting } from '@jeesite/core/hooks/setting';
import { downloadByUrl } from '@jeesite/core/utils/file/download';
import { Icon } from '@jeesite/core/components/Icon';
import { BasicModal, useModalInner } from '@jeesite/core/components/Modal';
import { bizWarningAlertImportData } from '@jeesite/biz/api/biz/warningAlert';
import { FileType } from 'ant-design-vue/es/upload/interface';
import { AxiosProgressEvent } from 'axios';
const emit = defineEmits(['success', 'register']);
const { t } = useI18n('biz.warningAlert');
const { showMessage, showMessageModal } = useMessage();
const fileList = ref<FileType[]>([]);
const uploadInfo = ref('');
const beforeUpload = (file: FileType) => {
fileList.value = [file];
return false;
};
const handleRemove = () => {
fileList.value = [];
};
const [registerModal, { setModalProps, closeModal }] = useModalInner(() => {
fileList.value = [];
uploadInfo.value = '';
});
async function handleDownloadTemplate() {
const { ctxAdminPath } = useGlobSetting();
downloadByUrl({ url: ctxAdminPath + '/biz/warningAlert/importTemplate' });
}
function onUploadProgress(progressEvent: AxiosProgressEvent) {
const complete = ((progressEvent.loaded / (progressEvent.total || 1)) * 100) | 0;
if (complete != 100) {
uploadInfo.value = t('正在导入,请稍候') + ' ' + complete + '%...';
} else {
uploadInfo.value = '';
}
}
async function handleSubmit() {
try {
if (fileList.value.length == 0) {
showMessage(t('请选择要导入的数据文件'));
return;
}
setModalProps({ confirmLoading: true });
const params = {
file: fileList.value[0],
};
const { data } = await bizWarningAlertImportData(params, onUploadProgress);
showMessageModal({ content: data.message });
setTimeout(closeModal);
emit('success');
} catch (error: any) {
if (error && error.errorFields) {
showMessage(error.message || t('common.validateError'));
}
console.log('error', error);
} finally {
setModalProps({ confirmLoading: false });
}
}
</script>

View File

@@ -0,0 +1,285 @@
<!--
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
* No deletion without permission, or be held responsible to law.
* @author gaoxq
-->
<template>
<div>
<BasicTable @register="registerTable">
<template #tableTitle>
<Icon :icon="getTitle.icon" class="m-1 pr-1" />
<span> {{ getTitle.value }} </span>
</template>
<template #toolbar>
<a-button type="default" :loading="loading" @click="handleExport()">
<Icon icon="i-ant-design:download-outlined" /> {{ t('导出') }}
</a-button>
</template>
</BasicTable>
<FormImport @register="registerImportModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" setup name="ViewsBizWarningAlertList">
import { onMounted, ref, unref } from 'vue';
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
import { useGlobSetting } from '@jeesite/core/hooks/setting';
import { downloadByUrl } from '@jeesite/core/utils/file/download';
import { router } from '@jeesite/core/router';
import { Icon } from '@jeesite/core/components/Icon';
import { BasicTable, BasicColumn, useTable } from '@jeesite/core/components/Table';
import { BizWarningAlert, bizWarningAlertList } from '@jeesite/biz/api/biz/warningAlert';
import { bizWarningAlertDelete, bizWarningAlertListData } from '@jeesite/biz/api/biz/warningAlert';
import { useDrawer } from '@jeesite/core/components/Drawer';
import { useModal } from '@jeesite/core/components/Modal';
import { FormProps } from '@jeesite/core/components/Form';
import FormImport from './formImport.vue';
const { t } = useI18n('biz.warningAlert');
const { showMessage } = useMessage();
const { meta } = unref(router.currentRoute);
const record = ref<BizWarningAlert>({} as BizWarningAlert);
const getTitle = {
icon: meta.icon || 'i-ant-design:book-outlined',
value: meta.title || t('预警信息管理'),
};
const loading = ref(false);
const searchForm: FormProps<BizWarningAlert> = {
baseColProps: { md: 8, lg: 6 },
labelWidth: 90,
schemas: [
{
label: t('记录时间起'),
field: 'createTime_gte',
component: 'DatePicker',
componentProps: {
format: 'YYYY-MM-DD HH:mm',
showTime: { format: 'HH:mm' },
},
},
{
label: t('记录时间止'),
field: 'createTime_lte',
component: 'DatePicker',
componentProps: {
format: 'YYYY-MM-DD HH:mm',
showTime: { format: 'HH:mm' },
},
},
{
label: t('预警编码'),
field: 'alertCode',
component: 'Input',
},
{
label: t('预警级别'),
field: 'alertLevel',
component: 'Select',
componentProps: {
dictType: '',
allowClear: true,
},
},
{
label: t('预警标题'),
field: 'alertTitle',
component: 'Input',
},
{
label: t('来源系统'),
field: 'sourceSystem',
component: 'Input',
},
{
label: t('预警状态'),
field: 'alertStatus',
component: 'Select',
componentProps: {
dictType: '',
allowClear: true,
},
},
],
};
const tableColumns: BasicColumn<BizWarningAlert>[] = [
{
title: t('记录时间'),
dataIndex: 'createTime',
key: 'a.create_time',
sorter: true,
width: 180,
align: 'left',
},
{
title: t('预警编码'),
dataIndex: 'alertCode',
key: 'a.alert_code',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('预警类型'),
dataIndex: 'alertType',
key: 'a.alert_type',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('预警级别'),
dataIndex: 'alertLevel',
key: 'a.alert_level',
sorter: true,
width: 130,
align: 'center',
dictType: 'alert_level',
},
{
title: t('预警标题'),
dataIndex: 'alertTitle',
key: 'a.alert_title',
sorter: true,
width: 165,
align: 'left',
},
{
title: t('预警内容'),
dataIndex: 'alertContent',
key: 'a.alert_content',
sorter: true,
width: 225,
align: 'left',
},
{
title: t('预警时间'),
dataIndex: 'triggerTime',
key: 'a.trigger_time',
sorter: true,
width: 180,
align: 'center',
},
{
title: t('来源系统'),
dataIndex: 'sourceSystem',
key: 'a.source_system',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('预警状态'),
dataIndex: 'alertStatus',
key: 'a.alert_status',
sorter: true,
width: 130,
align: 'left',
dictType: 'alert_status',
},
{
title: t('处理时间'),
dataIndex: 'handleTime',
key: 'a.handle_time',
sorter: true,
width: 180,
align: 'center',
},
{
title: t('处理备注'),
dataIndex: 'handleNote',
key: 'a.handle_note',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('处理人员'),
dataIndex: 'handlerUser',
key: 'a.handler_user',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('更新时间'),
dataIndex: 'updateTime',
key: 'a.update_time',
sorter: true,
width: 180,
align: 'center',
},
];
const actionColumn: BasicColumn<BizWarningAlert> = {
width: 160,
align: 'center',
actions: (record: BizWarningAlert) => [
{
icon: 'i-ant-design:delete-outlined',
color: 'error',
title: t('删除'),
popConfirm: {
title: t('是否确认删除预警信息?'),
confirm: handleDelete.bind(this, record),
},
auth: 'biz:warningAlert:edit',
ifShow: record.alertStatus == '4'
},
],
};
const [registerTable, { reload, getForm }] = useTable<BizWarningAlert>({
api: bizWarningAlertListData,
beforeFetch: (params) => {
return params;
},
columns: tableColumns,
actionColumn: actionColumn,
formConfig: searchForm,
showTableSetting: true,
useSearchForm: true,
canResize: true,
});
onMounted(async () => {
const res = await bizWarningAlertList();
record.value = (res.bizWarningAlert || {}) as BizWarningAlert;
await getForm().setFieldsValue(record.value);
});
const [registerDrawer, { openDrawer }] = useDrawer();
function handleForm(record: Recordable) {
openDrawer(true, record);
}
async function handleExport() {
loading.value = true;
const { ctxAdminPath } = useGlobSetting();
await downloadByUrl({
url: ctxAdminPath + '/biz/warningAlert/exportData',
params: getForm().getFieldsValue(),
});
loading.value = false;
}
const [registerImportModal, { openModal: importModal }] = useModal();
function handleImport() {
importModal(true, {});
}
async function handleDelete(record: Recordable) {
const params = { id: record.id };
const res = await bizWarningAlertDelete(params);
showMessage(res.message);
await handleSuccess(record);
}
async function handleSuccess(record: Recordable) {
await reload({ record });
}
</script>