This commit is contained in:
2025-11-30 18:38:38 +08:00
parent edf26b0b18
commit 71cc66ea9b
61 changed files with 5547 additions and 45 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 644 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

View File

@@ -0,0 +1,51 @@
/**
* 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 BizDeviceInfo extends BasicModel<BizDeviceInfo> {
createTime?: string; // 记录时间
device: string; // 设备名称
mountPoint: string; // 挂载点
totalSize: string; // 总容量
usedSize: string; // 已使用容量
usageRate: number; // 使用率(%)
lastOnlineTime: string; // 最后一次检测时间
hostId: string; // 主机标识
}
export const bizDeviceInfoList = (params?: BizDeviceInfo | any) =>
defHttp.get<BizDeviceInfo>({ url: adminPath + '/biz/deviceInfo/list', params });
export const bizDeviceInfoListData = (params?: BizDeviceInfo | any) =>
defHttp.post<Page<BizDeviceInfo>>({ url: adminPath + '/biz/deviceInfo/listData', params });
export const bizDeviceInfoForm = (params?: BizDeviceInfo | any) =>
defHttp.get<BizDeviceInfo>({ url: adminPath + '/biz/deviceInfo/form', params });
export const bizDeviceInfoSave = (params?: any, data?: BizDeviceInfo | any) =>
defHttp.postJson<BizDeviceInfo>({ url: adminPath + '/biz/deviceInfo/save', params, data });
export const bizDeviceInfoImportData = (
params: UploadFileParams,
onUploadProgress: (progressEvent: AxiosProgressEvent) => void,
) =>
defHttp.uploadFile<UploadApiResult>(
{
url: ctxPath + adminPath + '/biz/deviceInfo/importData',
onUploadProgress,
},
params,
);
export const bizDeviceInfoDelete = (params?: BizDeviceInfo | any) =>
defHttp.get<BizDeviceInfo>({ url: adminPath + '/biz/deviceInfo/delete', params });

View File

@@ -0,0 +1,58 @@
/**
* 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 BizMonitorAccount extends BasicModel<BizMonitorAccount> {
createTime?: string; // 记录时间
accountId?: string; // 唯一标识
hostId: string; // 主机标识
sshUsername: string; // 登录账号
sshPassword: string; // 登录密码
sshPort: number; // 登录端口
initialPath: string; // 初始目录
timeoutSeconds: number; // 超时时间
ustatus: string; // 账号状态
remark?: string; // 备注信息
updateTime?: string; // 更新时间
ftenantId?: string; // 租户id
fflowId?: string; // 流程id
fflowTaskId?: string; // 流程任务主键
fflowState?: number; // 流程任务状态
}
export const bizMonitorAccountList = (params?: BizMonitorAccount | any) =>
defHttp.get<BizMonitorAccount>({ url: adminPath + '/biz/monitorAccount/list', params });
export const bizMonitorAccountListData = (params?: BizMonitorAccount | any) =>
defHttp.post<Page<BizMonitorAccount>>({ url: adminPath + '/biz/monitorAccount/listData', params });
export const bizMonitorAccountForm = (params?: BizMonitorAccount | any) =>
defHttp.get<BizMonitorAccount>({ url: adminPath + '/biz/monitorAccount/form', params });
export const bizMonitorAccountSave = (params?: any, data?: BizMonitorAccount | any) =>
defHttp.postJson<BizMonitorAccount>({ url: adminPath + '/biz/monitorAccount/save', params, data });
export const bizMonitorAccountImportData = (
params: UploadFileParams,
onUploadProgress: (progressEvent: AxiosProgressEvent) => void,
) =>
defHttp.uploadFile<UploadApiResult>(
{
url: ctxPath + adminPath + '/biz/monitorAccount/importData',
onUploadProgress,
},
params,
);
export const bizMonitorAccountDelete = (params?: BizMonitorAccount | any) =>
defHttp.get<BizMonitorAccount>({ url: adminPath + '/biz/monitorAccount/delete', params });

View File

@@ -0,0 +1,62 @@
/**
* 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 BizMonitorHost extends BasicModel<BizMonitorHost> {
createTime?: string; // 记录时间
hostId?: string; // 唯一标识
hostname: string; // 主机名称
ipAddress: string; // IP地址
hostType: string; // 主机类型
hostOs: string; // 操作系统
ustatus: string; // 主机状态
lastOnlineTime?: string; // 监测运行时间
locationName: string; // 物理位置
locationType: string; // 地址类型
adminUser: string; // 管理人员
otherContact: string; // 联系方式
remark?: string; // 备注信息
updateTime?: string; // 更新时间
expiryDate: string; // 失效日期
ftenantId?: string; // 租户id
fflowId?: string; // 流程id
fflowTaskId?: string; // 流程任务主键
fflowState?: number; // 流程任务状态
}
export const bizMonitorHostList = (params?: BizMonitorHost | any) =>
defHttp.get<BizMonitorHost>({ url: adminPath + '/biz/monitorHost/list', params });
export const bizMonitorHostListData = (params?: BizMonitorHost | any) =>
defHttp.post<Page<BizMonitorHost>>({ url: adminPath + '/biz/monitorHost/listData', params });
export const bizMonitorHostForm = (params?: BizMonitorHost | any) =>
defHttp.get<BizMonitorHost>({ url: adminPath + '/biz/monitorHost/form', params });
export const bizMonitorHostSave = (params?: any, data?: BizMonitorHost | any) =>
defHttp.postJson<BizMonitorHost>({ url: adminPath + '/biz/monitorHost/save', params, data });
export const bizMonitorHostImportData = (
params: UploadFileParams,
onUploadProgress: (progressEvent: AxiosProgressEvent) => void,
) =>
defHttp.uploadFile<UploadApiResult>(
{
url: ctxPath + adminPath + '/biz/monitorHost/importData',
onUploadProgress,
},
params,
);
export const bizMonitorHostDelete = (params?: BizMonitorHost | any) =>
defHttp.get<BizMonitorHost>({ url: adminPath + '/biz/monitorHost/delete', params });

View File

@@ -0,0 +1,55 @@
/**
* 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 BizServerInfo extends BasicModel<BizServerInfo> {
createTime?: string; // 记录时间
uptime: string; // 主机运行时间
os: string; // 操作系统
kernelVersion: string; // 内核版本
hostname: string; // 主机名称
ipAddress: string; // 主机地址
cpuModel: string; // CPU型号
memoryTotal: string; // 内存总量
cpuUsage: number; // CPU使用率(%)
memoryUsage: number; // 内存使用率(%)
lastOnlineTime: string; // 最后一次检测时间
hostId: string; // 主机标识
}
export const bizServerInfoList = (params?: BizServerInfo | any) =>
defHttp.get<BizServerInfo>({ url: adminPath + '/biz/serverInfo/list', params });
export const bizServerInfoListData = (params?: BizServerInfo | any) =>
defHttp.post<Page<BizServerInfo>>({ url: adminPath + '/biz/serverInfo/listData', params });
export const bizServerInfoForm = (params?: BizServerInfo | any) =>
defHttp.get<BizServerInfo>({ url: adminPath + '/biz/serverInfo/form', params });
export const bizServerInfoSave = (params?: any, data?: BizServerInfo | any) =>
defHttp.postJson<BizServerInfo>({ url: adminPath + '/biz/serverInfo/save', params, data });
export const bizServerInfoImportData = (
params: UploadFileParams,
onUploadProgress: (progressEvent: AxiosProgressEvent) => void,
) =>
defHttp.uploadFile<UploadApiResult>(
{
url: ctxPath + adminPath + '/biz/serverInfo/importData',
onUploadProgress,
},
params,
);
export const bizServerInfoDelete = (params?: BizServerInfo | any) =>
defHttp.get<BizServerInfo>({ url: adminPath + '/biz/serverInfo/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 { bizDeviceInfoImportData } from '@jeesite/biz/api/biz/deviceInfo';
import { FileType } from 'ant-design-vue/es/upload/interface';
import { AxiosProgressEvent } from 'axios';
const emit = defineEmits(['success', 'register']);
const { t } = useI18n('biz.deviceInfo');
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/deviceInfo/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 bizDeviceInfoImportData(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,228 @@
<!--
* 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>
<InputForm @register="registerDrawer" @success="handleSuccess" />
<FormImport @register="registerImportModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" setup name="ViewsBizDeviceInfoList">
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 { BizDeviceInfo, bizDeviceInfoList } from '@jeesite/biz/api/biz/deviceInfo';
import { bizDeviceInfoDelete, bizDeviceInfoListData } from '@jeesite/biz/api/biz/deviceInfo';
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.deviceInfo');
const { showMessage } = useMessage();
const { meta } = unref(router.currentRoute);
const record = ref<BizDeviceInfo>({} as BizDeviceInfo);
const getTitle = {
icon: meta.icon || 'i-ant-design:book-outlined',
value: meta.title || t('磁盘信息管理'),
};
const loading = ref(false);
const searchForm: FormProps<BizDeviceInfo> = {
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: 'hostId',
fieldLabel: 'hostname',
component: 'ListSelect',
componentProps: {
selectType: 'bizHostSelect',
},
},
],
};
const tableColumns: BasicColumn<BizDeviceInfo>[] = [
{
title: t('记录时间'),
dataIndex: 'createTime',
key: 'a.create_time',
sorter: true,
width: 180,
align: 'left',
},
{
title: t('主机名称'),
dataIndex: 'hostname',
key: 'b.hostname',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('主机IP'),
dataIndex: 'ipAddress',
key: 'b.ip_address',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('设备名称'),
dataIndex: 'device',
key: 'a.device',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('挂载点'),
dataIndex: 'mountPoint',
key: 'a.mount_point',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('总容量'),
dataIndex: 'totalSize',
key: 'a.total_size',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('已使用容量'),
dataIndex: 'usedSize',
key: 'a.used_size',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('使用率'),
dataIndex: 'usageRate',
key: 'a.usage_rate',
sorter: true,
width: 130,
align: 'right',
},
{
title: t('最后一次检测时间'),
dataIndex: 'lastOnlineTime',
key: 'a.last_online_time',
sorter: true,
width: 180,
align: 'center',
},
];
const actionColumn: BasicColumn<BizDeviceInfo> = {
width: 160,
align: 'center',
actions: (record: BizDeviceInfo) => [
{
icon: 'i-ant-design:delete-outlined',
color: 'error',
title: t('删除'),
popConfirm: {
title: t('是否确认删除磁盘信息?'),
confirm: handleDelete.bind(this, record),
},
auth: 'biz:deviceInfo:edit',
ifShow: record.ustatus == '0'
},
],
};
const [registerTable, { reload, getForm }] = useTable<BizDeviceInfo>({
api: bizDeviceInfoListData,
beforeFetch: (params) => {
return params;
},
columns: tableColumns,
actionColumn: actionColumn,
formConfig: searchForm,
showTableSetting: true,
useSearchForm: true,
canResize: true,
});
onMounted(async () => {
const res = await bizDeviceInfoList();
record.value = (res.bizDeviceInfo || {}) as BizDeviceInfo;
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/deviceInfo/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 bizDeviceInfoDelete(params);
showMessage(res.message);
await handleSuccess(record);
}
async function handleSuccess(record: Recordable) {
await reload({ record });
}
</script>

View File

@@ -0,0 +1,126 @@
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
import { BasicColumn, BasicTableProps, FormProps } from '@jeesite/core/components/Table';
import { bizDeviceInfoListData } from '@jeesite/biz/api/biz/deviceInfo';
const { t } = useI18n('biz.deviceInfo');
const modalProps = {
title: t('磁盘信息选择'),
};
const searchForm: FormProps<BizDeviceInfo> = {
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: 'hostId',
component: 'Input',
},
],
};
const tableColumns: BasicColumn<BizDeviceInfo>[] = [
{
title: t('记录时间'),
dataIndex: 'createTime',
key: 'a.create_time',
sorter: true,
width: 230,
align: 'left',
slot: 'firstColumn',
},
{
title: t('设备名称'),
dataIndex: 'device',
key: 'a.device',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('挂载点'),
dataIndex: 'mountPoint',
key: 'a.mount_point',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('总容量'),
dataIndex: 'totalSize',
key: 'a.total_size',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('已使用容量'),
dataIndex: 'usedSize',
key: 'a.used_size',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('使用率'),
dataIndex: 'usageRate',
key: 'a.usage_rate',
sorter: true,
width: 130,
align: 'right',
},
{
title: t('最后一次检测时间'),
dataIndex: 'lastOnlineTime',
key: 'a.last_online_time',
sorter: true,
width: 130,
align: 'center',
},
{
title: t('主机标识'),
dataIndex: 'hostId',
key: 'a.host_id',
sorter: true,
width: 130,
align: 'left',
},
];
const tableProps: BasicTableProps = {
api: bizDeviceInfoListData,
beforeFetch: (params) => {
params['isAll'] = true;
return params;
},
columns: tableColumns,
formConfig: searchForm,
rowKey: 'id',
};
export default {
modalProps,
tableProps,
itemCode: 'id',
itemName: 'id',
isShowCode: false,
};

View File

@@ -0,0 +1,157 @@
<!--
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
* No deletion without permission, or be held responsible to law.
* @author gaoxq
-->
<template>
<BasicDrawer
v-bind="$attrs"
:showFooter="true"
:okAuth="'biz:monitorAccount:edit'"
@register="registerDrawer"
@ok="handleSubmit"
width="70%"
>
<template #title>
<Icon :icon="getTitle.icon" class="m-1 pr-1" />
<span> {{ getTitle.value }} </span>
</template>
<BasicForm @register="registerForm" />
</BasicDrawer>
</template>
<script lang="ts" setup name="ViewsBizMonitorAccountForm">
import { ref, unref, computed } from 'vue';
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
import { router } from '@jeesite/core/router';
import { Icon } from '@jeesite/core/components/Icon';
import { BasicForm, FormSchema, useForm } from '@jeesite/core/components/Form';
import { BasicDrawer, useDrawerInner } from '@jeesite/core/components/Drawer';
import { BizMonitorAccount, bizMonitorAccountSave, bizMonitorAccountForm } from '@jeesite/biz/api/biz/monitorAccount';
const emit = defineEmits(['success', 'register']);
const { t } = useI18n('biz.monitorAccount');
const { showMessage } = useMessage();
const { meta } = unref(router.currentRoute);
const record = ref<BizMonitorAccount>({} as BizMonitorAccount);
const getTitle = computed(() => ({
icon: meta.icon || 'i-ant-design:book-outlined',
value: record.value.isNewRecord ? t('新增账号信息') : t('编辑账号信息'),
}));
const inputFormSchemas: FormSchema<BizMonitorAccount>[] = [
{
label: t('主机名称'),
field: 'hostId',
fieldLabel: 'hostname',
component: 'ListSelect',
componentProps: {
selectType: 'bizHostSelect',
},
required: true,
colProps: { md: 24, lg: 24 },
},
{
label: t('登录账号'),
field: 'sshUsername',
component: 'Input',
componentProps: {
maxlength: 50,
},
required: true,
},
{
label: t('登录密码'),
field: 'sshPassword',
component: 'Input',
componentProps: {
maxlength: 255,
},
required: true,
},
{
label: t('登录端口'),
field: 'sshPort',
component: 'InputNumber',
componentProps: {
maxlength: 9,
},
required: true,
},
{
label: t('初始目录'),
field: 'initialPath',
component: 'Input',
componentProps: {
maxlength: 500,
},
required: true,
},
{
label: t('超时时间'),
field: 'timeoutSeconds',
component: 'InputNumber',
componentProps: {
maxlength: 9,
},
required: true,
},
{
label: t('账号状态'),
field: 'ustatus',
component: 'Select',
componentProps: {
dictType: 'ustatus ',
allowClear: true,
},
required: true,
},
{
label: t('备注信息'),
field: 'remark',
component: 'InputTextArea',
colProps: { md: 24, lg: 24 },
},
];
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm<BizMonitorAccount>({
labelWidth: 120,
schemas: inputFormSchemas,
baseColProps: { md: 24, lg: 12 },
});
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
setDrawerProps({ loading: true });
await resetFields();
const res = await bizMonitorAccountForm(data);
record.value = (res.bizMonitorAccount || {}) as BizMonitorAccount;
record.value.__t = new Date().getTime();
await setFieldsValue(record.value);
setDrawerProps({ loading: false });
});
async function handleSubmit() {
try {
const data = await validate();
setDrawerProps({ confirmLoading: true });
const params: any = {
isNewRecord: record.value.isNewRecord,
accountId: record.value.accountId || data.accountId,
};
// console.log('submit', params, data, record);
const res = await bizMonitorAccountSave(params, data);
showMessage(res.message);
setTimeout(closeDrawer);
emit('success', data);
} catch (error: any) {
if (error && error.errorFields) {
showMessage(error.message || t('common.validateError'));
}
console.log('error', error);
} finally {
setDrawerProps({ confirmLoading: false });
}
}
</script>

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 { bizMonitorAccountImportData } from '@jeesite/biz/api/biz/monitorAccount';
import { FileType } from 'ant-design-vue/es/upload/interface';
import { AxiosProgressEvent } from 'axios';
const emit = defineEmits(['success', 'register']);
const { t } = useI18n('biz.monitorAccount');
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/monitorAccount/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 bizMonitorAccountImportData(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,277 @@
<!--
* 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>
<a-button type="primary" @click="handleForm({})" v-auth="'biz:monitorAccount:edit'">
<Icon icon="i-fluent:add-12-filled" /> {{ t('新增') }}
</a-button>
</template>
<template #slotBizKey="{ record }">
<a @click="handleForm({ accountId: record.accountId })" :title="record.sshUsername">
{{ record.sshUsername }}
</a>
</template>
</BasicTable>
<InputForm @register="registerDrawer" @success="handleSuccess" />
<FormImport @register="registerImportModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" setup name="ViewsBizMonitorAccountList">
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 { BizMonitorAccount, bizMonitorAccountList } from '@jeesite/biz/api/biz/monitorAccount';
import { bizMonitorAccountDelete, bizMonitorAccountListData } from '@jeesite/biz/api/biz/monitorAccount';
import { useDrawer } from '@jeesite/core/components/Drawer';
import { useModal } from '@jeesite/core/components/Modal';
import { FormProps } from '@jeesite/core/components/Form';
import InputForm from './form.vue';
import FormImport from './formImport.vue';
const { t } = useI18n('biz.monitorAccount');
const { showMessage } = useMessage();
const { meta } = unref(router.currentRoute);
const record = ref<BizMonitorAccount>({} as BizMonitorAccount);
const getTitle = {
icon: meta.icon || 'i-ant-design:book-outlined',
value: meta.title || t('账号信息管理'),
};
const loading = ref(false);
const searchForm: FormProps<BizMonitorAccount> = {
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: 'hostId',
fieldLabel: 'hostname',
component: 'ListSelect',
componentProps: {
selectType: 'bizHostSelect',
},
},
{
label: t('登录账号'),
field: 'sshUsername',
component: 'Input',
},
{
label: t('初始目录'),
field: 'initialPath',
component: 'Input',
},
{
label: t('备注信息'),
field: 'remark',
component: 'Input',
},
{
label: t('账号状态'),
field: 'ustatus',
component: 'Select',
componentProps: {
dictType: 'ustatus ',
allowClear: true,
},
},
],
};
const tableColumns: BasicColumn<BizMonitorAccount>[] = [
{
title: t('记录时间'),
dataIndex: 'createTime',
key: 'a.create_time',
sorter: true,
width: 230,
align: 'left',
},
{
title: t('主机名称'),
dataIndex: 'hostname',
key: 'b.hostname',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('主机IP'),
dataIndex: 'ipAddress',
key: 'b.ip_address',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('登录账号'),
dataIndex: 'sshUsername',
key: 'a.ssh_username',
sorter: true,
width: 130,
align: 'left',
slot: 'slotBizKey',
},
{
title: t('登录端口'),
dataIndex: 'sshPort',
key: 'a.ssh_port',
sorter: true,
width: 130,
align: 'center',
},
{
title: t('初始目录'),
dataIndex: 'initialPath',
key: 'a.initial_path',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('超时时间'),
dataIndex: 'timeoutSeconds',
key: 'a.timeout_seconds',
sorter: true,
width: 180,
align: 'center',
},
{
title: t('备注信息'),
dataIndex: 'remark',
key: 'a.remark',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('更新时间'),
dataIndex: 'updateTime',
key: 'a.update_time',
sorter: true,
width: 180,
align: 'center',
},
{
title: t('账号状态'),
dataIndex: 'ustatus',
key: 'a.ustatus',
sorter: true,
width: 130,
align: 'left',
dictType: 'ustatus'
},
];
const actionColumn: BasicColumn<BizMonitorAccount> = {
width: 160,
align: 'center',
actions: (record: BizMonitorAccount) => [
{
icon: 'i-clarity:note-edit-line',
title: t('编辑'),
onClick: handleForm.bind(this, { accountId: record.accountId }),
auth: 'biz:monitorAccount:edit',
},
{
icon: 'i-ant-design:delete-outlined',
color: 'error',
title: t('删除'),
popConfirm: {
title: t('是否确认删除账号信息?'),
confirm: handleDelete.bind(this, record),
},
auth: 'biz:monitorAccount:edit',
ifShow: record.ustatus == '0'
},
],
};
const [registerTable, { reload, getForm }] = useTable<BizMonitorAccount>({
api: bizMonitorAccountListData,
beforeFetch: (params) => {
return params;
},
columns: tableColumns,
actionColumn: actionColumn,
formConfig: searchForm,
showTableSetting: true,
useSearchForm: true,
canResize: true,
});
onMounted(async () => {
const res = await bizMonitorAccountList();
record.value = (res.bizMonitorAccount || {}) as BizMonitorAccount;
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/monitorAccount/exportData',
params: getForm().getFieldsValue(),
});
loading.value = false;
}
const [registerImportModal, { openModal: importModal }] = useModal();
function handleImport() {
importModal(true, {});
}
async function handleDelete(record: Recordable) {
const params = { accountId: record.accountId };
const res = await bizMonitorAccountDelete(params);
showMessage(res.message);
await handleSuccess(record);
}
async function handleSuccess(record: Recordable) {
await reload({ record });
}
</script>

View File

@@ -0,0 +1,162 @@
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
import { BasicColumn, BasicTableProps, FormProps } from '@jeesite/core/components/Table';
import { bizMonitorAccountListData } from '@jeesite/biz/api/biz/monitorAccount';
const { t } = useI18n('biz.monitorAccount');
const modalProps = {
title: t('账号信息选择'),
};
const searchForm: FormProps<BizMonitorAccount> = {
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: 'hostId',
component: 'Input',
},
{
label: t('登录账号'),
field: 'sshUsername',
component: 'Input',
},
{
label: t('初始目录'),
field: 'initialPath',
component: 'Input',
},
{
label: t('账号状态'),
field: 'ustatus',
component: 'Input',
},
{
label: t('备注信息'),
field: 'remark',
component: 'Input',
},
],
};
const tableColumns: BasicColumn<BizMonitorAccount>[] = [
{
title: t('记录时间'),
dataIndex: 'createTime',
key: 'a.create_time',
sorter: true,
width: 230,
align: 'left',
slot: 'firstColumn',
},
{
title: t('主机标识'),
dataIndex: 'hostId',
key: 'a.host_id',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('登录账号'),
dataIndex: 'sshUsername',
key: 'a.ssh_username',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('登录密码'),
dataIndex: 'sshPassword',
key: 'a.ssh_password',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('登录端口'),
dataIndex: 'sshPort',
key: 'a.ssh_port',
sorter: true,
width: 130,
align: 'center',
},
{
title: t('初始目录'),
dataIndex: 'initialPath',
key: 'a.initial_path',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('超时时间'),
dataIndex: 'timeoutSeconds',
key: 'a.timeout_seconds',
sorter: true,
width: 130,
align: 'center',
},
{
title: t('账号状态'),
dataIndex: 'ustatus',
key: 'a.ustatus',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('备注信息'),
dataIndex: 'remark',
key: 'a.remark',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('更新时间'),
dataIndex: 'updateTime',
key: 'a.update_time',
sorter: true,
width: 130,
align: 'center',
},
];
const tableProps: BasicTableProps = {
api: bizMonitorAccountListData,
beforeFetch: (params) => {
params['isAll'] = true;
return params;
},
columns: tableColumns,
formConfig: searchForm,
rowKey: 'accountId',
};
export default {
modalProps,
tableProps,
itemCode: 'accountId',
itemName: 'accountId',
isShowCode: false,
};

View File

@@ -0,0 +1,187 @@
<!--
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
* No deletion without permission, or be held responsible to law.
* @author gaoxq
-->
<template>
<BasicDrawer
v-bind="$attrs"
:showFooter="true"
:okAuth="'biz:monitorHost:edit'"
@register="registerDrawer"
@ok="handleSubmit"
width="70%"
>
<template #title>
<Icon :icon="getTitle.icon" class="m-1 pr-1" />
<span> {{ getTitle.value }} </span>
</template>
<BasicForm @register="registerForm" />
</BasicDrawer>
</template>
<script lang="ts" setup name="ViewsBizMonitorHostForm">
import { ref, unref, computed } from 'vue';
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
import { router } from '@jeesite/core/router';
import { Icon } from '@jeesite/core/components/Icon';
import { BasicForm, FormSchema, useForm } from '@jeesite/core/components/Form';
import { BasicDrawer, useDrawerInner } from '@jeesite/core/components/Drawer';
import { BizMonitorHost, bizMonitorHostSave, bizMonitorHostForm } from '@jeesite/biz/api/biz/monitorHost';
const emit = defineEmits(['success', 'register']);
const { t } = useI18n('biz.monitorHost');
const { showMessage } = useMessage();
const { meta } = unref(router.currentRoute);
const record = ref<BizMonitorHost>({} as BizMonitorHost);
const getTitle = computed(() => ({
icon: meta.icon || 'i-ant-design:book-outlined',
value: record.value.isNewRecord ? t('新增主机信息') : t('编辑主机信息'),
}));
const inputFormSchemas: FormSchema<BizMonitorHost>[] = [
{
label: t('主机名称'),
field: 'hostname',
component: 'Input',
componentProps: {
maxlength: 100,
},
required: true,
},
{
label: t('IP地址'),
field: 'ipAddress',
component: 'Input',
componentProps: {
maxlength: 45,
},
required: true,
},
{
label: t('主机类型'),
field: 'hostType',
component: 'Select',
componentProps: {
dictType: 'host_type',
allowClear: true,
},
required: true,
},
{
label: t('操作系统'),
field: 'hostOs',
component: 'Select',
componentProps: {
dictType: 'host_os',
allowClear: true,
},
required: true,
},
{
label: t('运行状态'),
field: 'ustatus',
component: 'Select',
componentProps: {
dictType: 'host_status',
allowClear: true,
},
required: true,
},
{
label: t('物理位置'),
field: 'locationName',
component: 'Input',
componentProps: {
maxlength: 200,
},
required: true,
},
{
label: t('地址类型'),
field: 'locationType',
component: 'Select',
componentProps: {
dictType: 'location_type',
allowClear: true,
},
required: true,
},
{
label: t('管理人员'),
field: 'adminUser',
fieldLabel: 'employeeName',
component: 'ListSelect',
componentProps: {
selectType: 'bizEmpSelect',
},
required: true,
},
{
label: t('联系方式'),
field: 'otherContact',
component: 'Input',
componentProps: {
maxlength: 100,
},
required: true,
},
{
label: t('失效日期'),
field: 'expiryDate',
component: 'DatePicker',
componentProps: {
format: 'YYYY-MM-DD HH:mm',
showTime: { format: 'HH:mm' },
},
required: true,
},
{
label: t('备注信息'),
field: 'remark',
component: 'InputTextArea',
colProps: { md: 24, lg: 24 },
},
];
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm<BizMonitorHost>({
labelWidth: 120,
schemas: inputFormSchemas,
baseColProps: { md: 24, lg: 12 },
});
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
setDrawerProps({ loading: true });
await resetFields();
const res = await bizMonitorHostForm(data);
record.value = (res.bizMonitorHost || {}) as BizMonitorHost;
record.value.__t = new Date().getTime();
await setFieldsValue(record.value);
setDrawerProps({ loading: false });
});
async function handleSubmit() {
try {
const data = await validate();
setDrawerProps({ confirmLoading: true });
const params: any = {
isNewRecord: record.value.isNewRecord,
hostId: record.value.hostId || data.hostId,
};
// console.log('submit', params, data, record);
const res = await bizMonitorHostSave(params, data);
showMessage(res.message);
setTimeout(closeDrawer);
emit('success', data);
} catch (error: any) {
if (error && error.errorFields) {
showMessage(error.message || t('common.validateError'));
}
console.log('error', error);
} finally {
setDrawerProps({ confirmLoading: false });
}
}
</script>

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 { bizMonitorHostImportData } from '@jeesite/biz/api/biz/monitorHost';
import { FileType } from 'ant-design-vue/es/upload/interface';
import { AxiosProgressEvent } from 'axios';
const emit = defineEmits(['success', 'register']);
const { t } = useI18n('biz.monitorHost');
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/monitorHost/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 bizMonitorHostImportData(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,345 @@
<!--
* 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>
<a-button type="primary" @click="handleForm({})" v-auth="'biz:monitorHost:edit'">
<Icon icon="i-fluent:add-12-filled" /> {{ t('新增') }}
</a-button>
</template>
<template #slotBizKey="{ record }">
<a @click="handleForm({ hostId: record.hostId })" :title="record.hostname">
{{ record.hostname }}
</a>
</template>
</BasicTable>
<InputForm @register="registerDrawer" @success="handleSuccess" />
<FormImport @register="registerImportModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" setup name="ViewsBizMonitorHostList">
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 { BizMonitorHost, bizMonitorHostList } from '@jeesite/biz/api/biz/monitorHost';
import { bizMonitorHostDelete, bizMonitorHostListData } from '@jeesite/biz/api/biz/monitorHost';
import { useDrawer } from '@jeesite/core/components/Drawer';
import { useModal } from '@jeesite/core/components/Modal';
import { FormProps } from '@jeesite/core/components/Form';
import InputForm from './form.vue';
import FormImport from './formImport.vue';
const { t } = useI18n('biz.monitorHost');
const { showMessage } = useMessage();
const { meta } = unref(router.currentRoute);
const record = ref<BizMonitorHost>({} as BizMonitorHost);
const getTitle = {
icon: meta.icon || 'i-ant-design:book-outlined',
value: meta.title || t('主机信息管理'),
};
const loading = ref(false);
const searchForm: FormProps<BizMonitorHost> = {
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: 'hostname',
component: 'Input',
},
{
label: t('IP地址'),
field: 'ipAddress',
component: 'Input',
},
{
label: t('主机类型'),
field: 'hostType',
component: 'Select',
componentProps: {
dictType: 'host_type',
allowClear: true,
},
},
{
label: t('操作系统'),
field: 'hostOs',
component: 'Select',
componentProps: {
dictType: 'host_os',
allowClear: true,
},
},
{
label: t('运行状态'),
field: 'ustatus',
component: 'Select',
componentProps: {
dictType: 'host_status',
allowClear: true,
},
},
{
label: t('物理位置'),
field: 'locationName',
component: 'Input',
},
{
label: t('地址类型'),
field: 'locationType',
component: 'Select',
componentProps: {
dictType: 'location_type',
allowClear: true,
},
},
{
label: t('管理人员'),
field: 'adminUser',
fieldLabel: 'employeeName',
component: 'ListSelect',
componentProps: {
selectType: 'bizEmpSelect',
},
},
{
label: t('备注信息'),
field: 'remark',
component: 'Input',
},
],
};
const tableColumns: BasicColumn<BizMonitorHost>[] = [
{
title: t('记录时间'),
dataIndex: 'createTime',
key: 'a.create_time',
sorter: true,
width: 180,
align: 'left',
fixed: 'left'
},
{
title: t('主机名称'),
dataIndex: 'hostname',
key: 'a.hostname',
sorter: true,
width: 200,
align: 'left',
slot: 'slotBizKey'
},
{
title: t('IP地址'),
dataIndex: 'ipAddress',
key: 'a.ip_address',
sorter: true,
width: 200,
align: 'left',
},
{
title: t('主机类型'),
dataIndex: 'hostType',
key: 'a.host_type',
sorter: true,
width: 130,
align: 'left',
dictType: 'host_type',
},
{
title: t('操作系统'),
dataIndex: 'hostOs',
key: 'a.host_os',
sorter: true,
width: 130,
align: 'left',
dictType: 'host_os',
},
{
title: t('运行状态'),
dataIndex: 'ustatus',
key: 'a.ustatus',
sorter: true,
width: 130,
align: 'left',
dictType: 'host_status',
},
{
title: t('监测运行时间'),
dataIndex: 'lastOnlineTime',
key: 'a.last_online_time',
sorter: true,
width: 180,
align: 'center',
},
{
title: t('物理位置'),
dataIndex: 'locationName',
key: 'a.location_name',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('地址类型'),
dataIndex: 'locationType',
key: 'a.location_type',
sorter: true,
width: 130,
align: 'left',
dictType: 'location_type',
},
{
title: t('管理人员'),
dataIndex: 'employeeName',
key: 'b.employee_name',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('联系方式'),
dataIndex: 'otherContact',
key: 'a.other_contact',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('备注信息'),
dataIndex: 'remark',
key: 'a.remark',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('更新时间'),
dataIndex: 'updateTime',
key: 'a.update_time',
sorter: true,
width: 180,
align: 'center',
},
{
title: t('失效日期'),
dataIndex: 'expiryDate',
key: 'a.expiry_date',
sorter: true,
width: 180,
align: 'center',
},
];
const actionColumn: BasicColumn<BizMonitorHost> = {
width: 160,
align: 'center',
actions: (record: BizMonitorHost) => [
{
icon: 'i-clarity:note-edit-line',
title: t('编辑'),
onClick: handleForm.bind(this, { hostId: record.hostId }),
auth: 'biz:monitorHost:edit',
},
{
icon: 'i-ant-design:delete-outlined',
color: 'error',
title: t('删除'),
popConfirm: {
title: t('是否确认删除主机信息?'),
confirm: handleDelete.bind(this, record),
},
auth: 'biz:monitorHost:edit',
ifShow: record.ustatus == '0'
},
],
};
const [registerTable, { reload, getForm }] = useTable<BizMonitorHost>({
api: bizMonitorHostListData,
beforeFetch: (params) => {
return params;
},
columns: tableColumns,
actionColumn: actionColumn,
formConfig: searchForm,
showTableSetting: true,
useSearchForm: true,
canResize: true,
});
onMounted(async () => {
const res = await bizMonitorHostList();
record.value = (res.bizMonitorHost || {}) as BizMonitorHost;
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/monitorHost/exportData',
params: getForm().getFieldsValue(),
});
loading.value = false;
}
const [registerImportModal, { openModal: importModal }] = useModal();
function handleImport() {
importModal(true, {});
}
async function handleDelete(record: Recordable) {
const params = { hostId: record.hostId };
const res = await bizMonitorHostDelete(params);
showMessage(res.message);
await handleSuccess(record);
}
async function handleSuccess(record: Recordable) {
await reload({ record });
}
</script>

View File

@@ -0,0 +1,197 @@
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
import { BasicColumn, BasicTableProps, FormProps } from '@jeesite/core/components/Table';
import { BizMonitorHost, bizMonitorHostListData } from '@jeesite/biz/api/biz/monitorHost';
const { t } = useI18n('biz.monitorHost');
const modalProps = {
title: t('主机信息选择'),
};
const searchForm: FormProps<BizMonitorHost> = {
baseColProps: { md: 8, lg: 6 },
labelWidth: 90,
schemas: [
{
label: t('主机名称'),
field: 'hostname',
component: 'Input',
},
{
label: t('IP地址'),
field: 'ipAddress',
component: 'Input',
},
{
label: t('主机类型'),
field: 'hostType',
component: 'Select',
componentProps: {
dictType: 'host_type',
allowClear: true,
},
},
{
label: t('操作系统'),
field: 'hostOs',
component: 'Select',
componentProps: {
dictType: 'host_os',
allowClear: true,
},
},
{
label: t('主机状态'),
field: 'ustatus',
component: 'Select',
componentProps: {
dictType: 'host_status',
allowClear: true,
},
},
{
label: t('物理位置'),
field: 'locationName',
component: 'Input',
},
{
label: t('地址类型'),
field: 'locationType',
component: 'Select',
componentProps: {
dictType: 'location_type',
allowClear: true,
},
},
],
};
const tableColumns: BasicColumn<BizMonitorHost>[] = [
{
title: t('记录时间'),
dataIndex: 'createTime',
key: 'a.create_time',
sorter: true,
width: 180,
align: 'left',
},
{
title: t('主机名称'),
dataIndex: 'hostname',
key: 'a.hostname',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('IP地址'),
dataIndex: 'ipAddress',
key: 'a.ip_address',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('主机类型'),
dataIndex: 'hostType',
key: 'a.host_type',
sorter: true,
width: 130,
align: 'left',
dictType: 'host_type',
},
{
title: t('操作系统'),
dataIndex: 'hostOs',
key: 'a.host_os',
sorter: true,
width: 130,
align: 'left',
dictType: 'host_os',
},
{
title: t('主机状态'),
dataIndex: 'ustatus',
key: 'a.ustatus',
sorter: true,
width: 130,
align: 'left',
dictType: 'host_status',
},
{
title: t('监测运行时间'),
dataIndex: 'lastOnlineTime',
key: 'a.last_online_time',
sorter: true,
width: 180,
align: 'center',
},
{
title: t('物理位置'),
dataIndex: 'locationName',
key: 'a.location_name',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('地址类型'),
dataIndex: 'locationType',
key: 'a.location_type',
sorter: true,
width: 130,
align: 'left',
dictType: 'location_type',
},
{
title: t('联系方式'),
dataIndex: 'otherContact',
key: 'a.other_contact',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('备注信息'),
dataIndex: 'remark',
key: 'a.remark',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('更新时间'),
dataIndex: 'updateTime',
key: 'a.update_time',
sorter: true,
width: 180,
align: 'center',
},
{
title: t('失效日期'),
dataIndex: 'expiryDate',
key: 'a.expiry_date',
sorter: true,
width: 180,
align: 'center',
},
];
const tableProps: BasicTableProps = {
api: bizMonitorHostListData,
beforeFetch: (params) => {
params['isAll'] = true;
return params;
},
columns: tableColumns,
formConfig: searchForm,
rowKey: 'hostId',
};
export default {
modalProps,
tableProps,
itemCode: 'hostId',
itemName: 'hostId',
isShowCode: false,
};

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 { bizServerInfoImportData } from '@jeesite/biz/api/biz/serverInfo';
import { FileType } from 'ant-design-vue/es/upload/interface';
import { AxiosProgressEvent } from 'axios';
const emit = defineEmits(['success', 'register']);
const { t } = useI18n('biz.serverInfo');
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/serverInfo/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 bizServerInfoImportData(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,272 @@
<!--
* 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>
<InputForm @register="registerDrawer" @success="handleSuccess" />
<FormImport @register="registerImportModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" setup name="ViewsBizServerInfoList">
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 { BizServerInfo, bizServerInfoList } from '@jeesite/biz/api/biz/serverInfo';
import { bizServerInfoDelete, bizServerInfoListData } from '@jeesite/biz/api/biz/serverInfo';
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.serverInfo');
const { showMessage } = useMessage();
const { meta } = unref(router.currentRoute);
const record = ref<BizServerInfo>({} as BizServerInfo);
const getTitle = {
icon: meta.icon || 'i-ant-design:book-outlined',
value: meta.title || t('运行信息管理'),
};
const loading = ref(false);
const searchForm: FormProps<BizServerInfo> = {
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: 'hostId',
fieldLabel: 'sysHostname',
component: 'ListSelect',
componentProps: {
selectType: 'bizHostSelect',
},
},
{
label: t('内核版本'),
field: 'kernelVersion',
component: 'Input',
},
{
label: t('系统名称'),
field: 'hostname',
component: 'Input',
},
{
label: t('主机地址'),
field: 'ipAddress',
component: 'Input',
},
{
label: t('CPU型号'),
field: 'cpuModel',
component: 'Input',
},
],
};
const tableColumns: BasicColumn<BizServerInfo>[] = [
{
title: t('记录时间'),
dataIndex: 'createTime',
key: 'a.create_time',
sorter: true,
width: 180,
align: 'left',
},
{
title: t('运行时长'),
dataIndex: 'uptime',
key: 'a.uptime',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('操作系统'),
dataIndex: 'os',
key: 'a.os',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('内核版本'),
dataIndex: 'kernelVersion',
key: 'a.kernel_version',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('系统名称'),
dataIndex: 'hostname',
key: 'a.hostname',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('主机名称'),
dataIndex: 'sysHostname',
key: 'b.hostname',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('主机地址'),
dataIndex: 'ipAddress',
key: 'a.ip_address',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('CPU型号'),
dataIndex: 'cpuModel',
key: 'a.cpu_model',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('内存总量'),
dataIndex: 'memoryTotal',
key: 'a.memory_total',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('CPU使用率'),
dataIndex: 'cpuUsage',
key: 'a.cpu_usage',
sorter: true,
width: 130,
align: 'right',
},
{
title: t('内存使用率'),
dataIndex: 'memoryUsage',
key: 'a.memory_usage',
sorter: true,
width: 130,
align: 'right',
},
{
title: t('最后一次检测时间'),
dataIndex: 'lastOnlineTime',
key: 'a.last_online_time',
sorter: true,
width: 180,
align: 'center',
},
];
const actionColumn: BasicColumn<BizServerInfo> = {
width: 160,
align: 'center',
actions: (record: BizServerInfo) => [
{
icon: 'i-ant-design:delete-outlined',
color: 'error',
title: t('删除'),
popConfirm: {
title: t('是否确认删除运行信息?'),
confirm: handleDelete.bind(this, record),
},
auth: 'biz:serverInfo:edit',
ifShow: record.ustatus == '0'
},
],
};
const [registerTable, { reload, getForm }] = useTable<BizServerInfo>({
api: bizServerInfoListData,
beforeFetch: (params) => {
return params;
},
columns: tableColumns,
actionColumn: actionColumn,
formConfig: searchForm,
showTableSetting: true,
useSearchForm: true,
canResize: true,
});
onMounted(async () => {
const res = await bizServerInfoList();
record.value = (res.bizServerInfo || {}) as BizServerInfo;
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/serverInfo/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 bizServerInfoDelete(params);
showMessage(res.message);
await handleSuccess(record);
}
async function handleSuccess(record: Recordable) {
await reload({ record });
}
</script>

View File

@@ -0,0 +1,178 @@
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
import { BasicColumn, BasicTableProps, FormProps } from '@jeesite/core/components/Table';
import { bizServerInfoListData } from '@jeesite/biz/api/biz/serverInfo';
const { t } = useI18n('biz.serverInfo');
const modalProps = {
title: t('运行信息选择'),
};
const searchForm: FormProps<BizServerInfo> = {
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: 'kernelVersion',
component: 'Input',
},
{
label: t('主机名称'),
field: 'hostname',
component: 'Input',
},
{
label: t('主机地址'),
field: 'ipAddress',
component: 'Input',
},
{
label: t('CPU型号'),
field: 'cpuModel',
component: 'Input',
},
{
label: t('主机标识'),
field: 'hostId',
component: 'Input',
},
],
};
const tableColumns: BasicColumn<BizServerInfo>[] = [
{
title: t('记录时间'),
dataIndex: 'createTime',
key: 'a.create_time',
sorter: true,
width: 230,
align: 'left',
slot: 'firstColumn',
},
{
title: t('主机运行时间'),
dataIndex: 'uptime',
key: 'a.uptime',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('操作系统'),
dataIndex: 'os',
key: 'a.os',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('内核版本'),
dataIndex: 'kernelVersion',
key: 'a.kernel_version',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('主机名称'),
dataIndex: 'hostname',
key: 'a.hostname',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('主机地址'),
dataIndex: 'ipAddress',
key: 'a.ip_address',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('CPU型号'),
dataIndex: 'cpuModel',
key: 'a.cpu_model',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('内存总量'),
dataIndex: 'memoryTotal',
key: 'a.memory_total',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('CPU使用率'),
dataIndex: 'cpuUsage',
key: 'a.cpu_usage',
sorter: true,
width: 130,
align: 'right',
},
{
title: t('内存使用率'),
dataIndex: 'memoryUsage',
key: 'a.memory_usage',
sorter: true,
width: 130,
align: 'right',
},
{
title: t('最后一次检测时间'),
dataIndex: 'lastOnlineTime',
key: 'a.last_online_time',
sorter: true,
width: 130,
align: 'center',
},
{
title: t('主机标识'),
dataIndex: 'hostId',
key: 'a.host_id',
sorter: true,
width: 130,
align: 'left',
},
];
const tableProps: BasicTableProps = {
api: bizServerInfoListData,
beforeFetch: (params) => {
params['isAll'] = true;
return params;
},
columns: tableColumns,
formConfig: searchForm,
rowKey: 'id',
};
export default {
modalProps,
tableProps,
itemCode: 'id',
itemName: 'id',
isShowCode: false,
};

View File

@@ -0,0 +1,197 @@
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
import { BasicColumn, BasicTableProps, FormProps } from '@jeesite/core/components/Table';
import { BizMonitorHost, bizMonitorHostListData } from '@jeesite/biz/api/biz/monitorHost';
const { t } = useI18n('biz.monitorHost');
const modalProps = {
title: t('主机信息选择'),
};
const searchForm: FormProps<BizMonitorHost> = {
baseColProps: { md: 8, lg: 6 },
labelWidth: 90,
schemas: [
{
label: t('主机名称'),
field: 'hostname',
component: 'Input',
},
{
label: t('IP地址'),
field: 'ipAddress',
component: 'Input',
},
{
label: t('主机类型'),
field: 'hostType',
component: 'Select',
componentProps: {
dictType: 'host_type',
allowClear: true,
},
},
{
label: t('操作系统'),
field: 'hostOs',
component: 'Select',
componentProps: {
dictType: 'host_os',
allowClear: true,
},
},
{
label: t('主机状态'),
field: 'ustatus',
component: 'Select',
componentProps: {
dictType: 'host_status',
allowClear: true,
},
},
{
label: t('物理位置'),
field: 'locationName',
component: 'Input',
},
{
label: t('地址类型'),
field: 'locationType',
component: 'Select',
componentProps: {
dictType: 'location_type',
allowClear: true,
},
},
],
};
const tableColumns: BasicColumn<BizMonitorHost>[] = [
{
title: t('记录时间'),
dataIndex: 'createTime',
key: 'a.create_time',
sorter: true,
width: 180,
align: 'left',
},
{
title: t('主机名称'),
dataIndex: 'hostname',
key: 'a.hostname',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('IP地址'),
dataIndex: 'ipAddress',
key: 'a.ip_address',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('主机类型'),
dataIndex: 'hostType',
key: 'a.host_type',
sorter: true,
width: 130,
align: 'left',
dictType: 'host_type',
},
{
title: t('操作系统'),
dataIndex: 'hostOs',
key: 'a.host_os',
sorter: true,
width: 130,
align: 'left',
dictType: 'host_os',
},
{
title: t('主机状态'),
dataIndex: 'ustatus',
key: 'a.ustatus',
sorter: true,
width: 130,
align: 'left',
dictType: 'host_status',
},
{
title: t('监测运行时间'),
dataIndex: 'lastOnlineTime',
key: 'a.last_online_time',
sorter: true,
width: 180,
align: 'center',
},
{
title: t('物理位置'),
dataIndex: 'locationName',
key: 'a.location_name',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('地址类型'),
dataIndex: 'locationType',
key: 'a.location_type',
sorter: true,
width: 130,
align: 'left',
dictType: 'location_type',
},
{
title: t('联系方式'),
dataIndex: 'otherContact',
key: 'a.other_contact',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('备注信息'),
dataIndex: 'remark',
key: 'a.remark',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('更新时间'),
dataIndex: 'updateTime',
key: 'a.update_time',
sorter: true,
width: 180,
align: 'center',
},
{
title: t('失效日期'),
dataIndex: 'expiryDate',
key: 'a.expiry_date',
sorter: true,
width: 180,
align: 'center',
},
];
const tableProps: BasicTableProps = {
api: bizMonitorHostListData,
beforeFetch: (params) => {
params['isAll'] = true;
return params;
},
columns: tableColumns,
formConfig: searchForm,
rowKey: 'hostId',
};
export default {
modalProps,
tableProps,
itemCode: 'hostId',
itemName: 'hostname',
isShowCode: true,
};

View File

@@ -25,7 +25,7 @@
<div class="h-full w-full flex overflow-auto py-5 lg:my-0 lg:h-auto lg:w-11/24 lg:py-0">
<div
:class="`${prefixCls}-form`"
class="enter-x relative mx-auto my-auto w-full rounded-xl px-5 py-8 shadow-md lg:ml-16 lg:w-2/4 lg:w-auto sm:w-3/4 lg:px-10 lg:py-9 sm:px-8"
class="enter-x form-container-bg relative mx-auto my-auto w-full rounded-xl px-5 py-8 shadow-md lg:ml-16 lg:w-2/4 lg:w-auto sm:w-3/4 lg:px-10 lg:py-9 sm:px-8"
>
<LoginForm @demo-mode="demoMode = $event" />
<ForgetPasswordForm :demoMode="demoMode" />
@@ -63,6 +63,10 @@
@logo-prefix-cls: ~'jeesite-app-logo';
@countdown-prefix-cls: ~'jeesite-countdown-input';
@dark-bg: #293146;
// 淡白色主色(柔和不刺眼,带轻微蓝调的白)
@light-white-bg: #f8fafc;
// 深色模式下表单背景(适配深色主题的暗白色)
@dark-light-white-bg: rgba(41, 49, 70, 0.95);
html[data-theme='dark'] {
.@{prefix-cls} {
@@ -82,8 +86,8 @@
}
&-form {
background: transparent !important;
box-shadow: none;
background: @dark-light-white-bg !important;
box-shadow: 0 0 12px rgba(0, 0, 0, 0.2);
}
.@{logo-prefix-cls} {
@@ -95,6 +99,10 @@
.jeesite-icon {
color: #fff;
}
.form-container-bg {
background: @dark-light-white-bg !important;
}
}
input.fix-auto-fill,
@@ -107,11 +115,8 @@
.@{prefix-cls} {
min-height: 100%;
overflow: hidden;
//background-color: #f2fafd;
@media (max-width: @screen-lg) {
//background-color: #3f60b5;
.@{prefix-cls}-form {
box-shadow: none;
}
@@ -120,14 +125,24 @@
&-form {
top: -20px;
margin: auto;
background-color: #fff;
box-shadow: 0 0 8px #ddd;
// 淡白色背景(核心修改)
background-color: @light-white-bg;
box-shadow: 0 0 8px rgba(248, 250, 252, 0.8);
background-clip: padding-box;
.ant-form-item {
margin-bottom: 15px;
}
}
// 表单容器专属样式
.form-container-bg {
background-color: @light-white-bg;
// 轻量阴影增强层次
box-shadow: 0 4px 12px rgba(240, 248, 255, 0.5);
border-radius: 12px;
}
&::before {
position: absolute;
top: 0;
@@ -147,10 +162,6 @@
}
.@{logo-prefix-cls} {
// position: absolute;
// top: 12px;
// height: 30px;
&.logo {
margin-top: -110px;
padding-bottom: 80px;
@@ -230,4 +241,4 @@
color: @text-color-secondary;
}
}
</style>
</style>

View File

@@ -30,19 +30,6 @@
<ValidCode size="large" v-model:value="formData.validCode" :refreshTime="validCodeRefreshTime" />
</FormItem>
<div class="gp" v-if="demoMode">
💡提示当前您连接的后端服务可能是
<a href="https://vue.jeesite.com" target="_blank">vue.jeesite.com</a><br />
&nbsp; &nbsp; 的演示服务器请进入文档
<a
href="https://jeesite.com/docs/vue-install-deploy/#%E9%85%8D%E7%BD%AE%E5%90%8E%E7%AB%AF%E6%8E%A5%E5%8F%A3"
target="_blank"
>
配置服务端接口
</a>
</div>
<ARow class="enter-x">
<ACol :span="12">
<FormItem>
@@ -108,7 +95,7 @@
const emit = defineEmits(['demoMode']);
const formData = reactive({
account: 'system',
account: '',
password: '',
validCode: '',
});
@@ -185,11 +172,6 @@
loading.value = false;
}
}
function handleOauth2(event: Event) {
window.location.href = 'https://vue.jeesite.com/js/oauth2/login/gitee?state=vue';
event.preventDefault();
}
</script>
<style>
.gp {