This commit is contained in:
2025-12-01 22:37:00 +08:00
parent 25ed2391e9
commit 6fe44b3c81
44 changed files with 2934 additions and 339 deletions

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 BizDbConfig extends BasicModel<BizDbConfig> {
createTime?: string; // 创建时间
dbType: string; // 数据库类型
dbName: string; // 数据库名称
dbIp: string; // 数据库IP
dbPort: number; // 数据库端口
dbUsername: string; // 数据库账号
dbPassword: string; // 数据库密码
description?: string; // 数据库描述
isEnabled: number; // 是否启用
dbSchemaName?: string; // schema名称
updateTime?: string; // 更新时间
ftenantId?: string; // 租户id
fflowId?: string; // 流程id
fflowTaskId?: string; // 流程任务主键
fflowState?: number; // 流程任务状态
}
export const bizDbConfigList = (params?: BizDbConfig | any) =>
defHttp.get<BizDbConfig>({ url: adminPath + '/biz/dbConfig/list', params });
export const bizDbConfigListData = (params?: BizDbConfig | any) =>
defHttp.post<Page<BizDbConfig>>({ url: adminPath + '/biz/dbConfig/listData', params });
export const bizDbConfigForm = (params?: BizDbConfig | any) =>
defHttp.get<BizDbConfig>({ url: adminPath + '/biz/dbConfig/form', params });
export const bizDbConfigSave = (params?: any, data?: BizDbConfig | any) =>
defHttp.postJson<BizDbConfig>({ url: adminPath + '/biz/dbConfig/save', params, data });
export const bizDbConfigImportData = (
params: UploadFileParams,
onUploadProgress: (progressEvent: AxiosProgressEvent) => void,
) =>
defHttp.uploadFile<UploadApiResult>(
{
url: ctxPath + adminPath + '/biz/dbConfig/importData',
onUploadProgress,
},
params,
);
export const bizDbConfigDelete = (params?: BizDbConfig | any) =>
defHttp.get<BizDbConfig>({ url: adminPath + '/biz/dbConfig/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 BizTableInfo extends BasicModel<BizTableInfo> {
createTime?: string; // 创建时间
tableId?: string; // 唯一标识
dataName: string; // 数据表名称
tableComment: string; // 数据表描述
tableSize?: number; // 数据表大小
dataSource?: string; // 数据来源
creator?: string; // 创建人员
dataRows?: number; // 记录条数
updateTime?: string; // 更新时间
dbId?: string; // 数据标识
ds?: string; // 分区日期
ftenantId?: string; // 租户id
fflowId?: string; // 流程id
fflowTaskId?: string; // 流程任务主键
fflowState?: number; // 流程任务状态
}
export const bizTableInfoList = (params?: BizTableInfo | any) =>
defHttp.get<BizTableInfo>({ url: adminPath + '/biz/tableInfo/list', params });
export const bizTableInfoListData = (params?: BizTableInfo | any) =>
defHttp.post<Page<BizTableInfo>>({ url: adminPath + '/biz/tableInfo/listData', params });
export const bizTableInfoForm = (params?: BizTableInfo | any) =>
defHttp.get<BizTableInfo>({ url: adminPath + '/biz/tableInfo/form', params });
export const bizTableInfoSave = (params?: any, data?: BizTableInfo | any) =>
defHttp.postJson<BizTableInfo>({ url: adminPath + '/biz/tableInfo/save', params, data });
export const bizTableInfoImportData = (
params: UploadFileParams,
onUploadProgress: (progressEvent: AxiosProgressEvent) => void,
) =>
defHttp.uploadFile<UploadApiResult>(
{
url: ctxPath + adminPath + '/biz/tableInfo/importData',
onUploadProgress,
},
params,
);
export const bizTableInfoDelete = (params?: BizTableInfo | any) =>
defHttp.get<BizTableInfo>({ url: adminPath + '/biz/tableInfo/delete', params });

View File

@@ -0,0 +1,164 @@
<!--
* 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:dbConfig: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="ViewsBizDbConfigForm">
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 { BizDbConfig, bizDbConfigSave, bizDbConfigForm } from '@jeesite/biz/api/biz/dbConfig';
const emit = defineEmits(['success', 'register']);
const { t } = useI18n('biz.dbConfig');
const { showMessage } = useMessage();
const { meta } = unref(router.currentRoute);
const record = ref<BizDbConfig>({} as BizDbConfig);
const getTitle = computed(() => ({
icon: meta.icon || 'i-ant-design:book-outlined',
value: record.value.isNewRecord ? t('新增连接信息') : t('编辑连接信息'),
}));
const inputFormSchemas: FormSchema<BizDbConfig>[] = [
{
label: t('数据库名称'),
field: 'dbName',
component: 'Input',
componentProps: {
maxlength: 128,
},
required: true,
},
{
label: t('数据库类型'),
field: 'dbType',
component: 'Select',
componentProps: {
dictType: 'db_type',
allowClear: true,
},
required: true,
},
{
label: t('数据库IP'),
field: 'dbIp',
component: 'Input',
componentProps: {
maxlength: 64,
},
required: true,
},
{
label: t('数据库端口'),
field: 'dbPort',
component: 'InputNumber',
componentProps: {
maxlength: 10,
},
required: true,
},
{
label: t('数据库账号'),
field: 'dbUsername',
component: 'Input',
componentProps: {
maxlength: 128,
},
required: true,
},
{
label: t('数据库密码'),
field: 'dbPassword',
component: 'Input',
componentProps: {
maxlength: 256,
},
required: true,
},
{
label: t('数据库描述'),
field: 'description',
component: 'InputTextArea',
colProps: { md: 24, lg: 24 },
},
{
label: t('是否启用'),
field: 'isEnabled',
component: 'Select',
componentProps: {
dictType: 'is_active',
allowClear: true,
},
required: true,
},
{
label: t('schema名称'),
field: 'dbSchemaName',
component: 'Input',
componentProps: {
maxlength: 52,
},
},
];
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm<BizDbConfig>({
labelWidth: 120,
schemas: inputFormSchemas,
baseColProps: { md: 24, lg: 12 },
});
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
setDrawerProps({ loading: true });
await resetFields();
const res = await bizDbConfigForm(data);
record.value = (res.bizDbConfig || {}) as BizDbConfig;
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,
id: record.value.id || data.id,
};
// console.log('submit', params, data, record);
const res = await bizDbConfigSave(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 { bizDbConfigImportData } from '@jeesite/biz/api/biz/dbConfig';
import { FileType } from 'ant-design-vue/es/upload/interface';
import { AxiosProgressEvent } from 'axios';
const emit = defineEmits(['success', 'register']);
const { t } = useI18n('biz.dbConfig');
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/dbConfig/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 bizDbConfigImportData(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,286 @@
<!--
* 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:dbConfig:edit'">
<Icon icon="i-fluent:add-12-filled" /> {{ t('新增') }}
</a-button>
</template>
<template #slotBizKey="{ record }">
<a @click="handleForm({ id: record.id })" :title="record.dbName">
{{ record.dbName }}
</a>
</template>
</BasicTable>
<InputForm @register="registerDrawer" @success="handleSuccess" />
<FormImport @register="registerImportModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" setup name="ViewsBizDbConfigList">
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 { BizDbConfig, bizDbConfigList } from '@jeesite/biz/api/biz/dbConfig';
import { bizDbConfigDelete, bizDbConfigListData } from '@jeesite/biz/api/biz/dbConfig';
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.dbConfig');
const { showMessage } = useMessage();
const { meta } = unref(router.currentRoute);
const record = ref<BizDbConfig>({} as BizDbConfig);
const getTitle = {
icon: meta.icon || 'i-ant-design:book-outlined',
value: meta.title || t('连接信息管理'),
};
const loading = ref(false);
const searchForm: FormProps<BizDbConfig> = {
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: 'dbType',
component: 'Select',
componentProps: {
dictType: 'db_type',
allowClear: true,
},
},
{
label: t('数据库名称'),
field: 'dbName',
component: 'Input',
},
{
label: t('数据库IP'),
field: 'dbIp',
component: 'Input',
},
{
label: t('数据库描述'),
field: 'description',
component: 'Input',
},
{
label: t('是否启用'),
field: 'isEnabled',
component: 'Select',
componentProps: {
dictType: 'is_active',
allowClear: true,
},
},
],
};
const tableColumns: BasicColumn<BizDbConfig>[] = [
{
title: t('创建时间'),
dataIndex: 'createTime',
key: 'a.create_time',
sorter: true,
width: 180,
align: 'left',
},
{
title: t('数据库类型'),
dataIndex: 'dbType',
key: 'a.db_type',
sorter: true,
width: 130,
align: 'left',
dictType: 'db_type',
},
{
title: t('数据库名称'),
dataIndex: 'dbName',
key: 'a.db_name',
sorter: true,
width: 130,
align: 'left',
slot: 'slotBizKey',
},
{
title: t('数据库IP'),
dataIndex: 'dbIp',
key: 'a.db_ip',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('数据库端口'),
dataIndex: 'dbPort',
key: 'a.db_port',
sorter: true,
width: 130,
align: 'center',
},
{
title: t('数据库账号'),
dataIndex: 'dbUsername',
key: 'a.db_username',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('数据库密码'),
dataIndex: 'dbPassword',
key: 'a.db_password',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('数据库描述'),
dataIndex: 'description',
key: 'a.description',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('是否启用'),
dataIndex: 'isEnabled',
key: 'a.is_enabled',
sorter: true,
width: 130,
align: 'center',
dictType: 'is_active',
},
{
title: t('schema名称'),
dataIndex: 'dbSchemaName',
key: 'a.db_schema_name',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('更新时间'),
dataIndex: 'updateTime',
key: 'a.update_time',
sorter: true,
width: 180,
align: 'center',
},
];
const actionColumn: BasicColumn<BizDbConfig> = {
width: 160,
align: 'center',
actions: (record: BizDbConfig) => [
{
icon: 'i-clarity:note-edit-line',
title: t('编辑'),
onClick: handleForm.bind(this, { id: record.id }),
auth: 'biz:dbConfig:edit',
},
{
icon: 'i-ant-design:delete-outlined',
color: 'error',
title: t('删除'),
popConfirm: {
title: t('是否确认删除连接信息?'),
confirm: handleDelete.bind(this, record),
},
auth: 'biz:dbConfig:edit',
ifShow: record.isEnabled == '0'
},
],
};
const [registerTable, { reload, getForm }] = useTable<BizDbConfig>({
api: bizDbConfigListData,
beforeFetch: (params) => {
return params;
},
columns: tableColumns,
actionColumn: actionColumn,
formConfig: searchForm,
showTableSetting: true,
useSearchForm: true,
canResize: true,
});
onMounted(async () => {
const res = await bizDbConfigList();
record.value = (res.bizDbConfig || {}) as BizDbConfig;
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/dbConfig/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 bizDbConfigDelete(params);
showMessage(res.message);
await handleSuccess(record);
}
async function handleSuccess(record: Recordable) {
await reload({ record });
}
</script>

View File

@@ -0,0 +1,172 @@
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
import { BasicColumn, BasicTableProps, FormProps } from '@jeesite/core/components/Table';
import { BizDbConfig, bizDbConfigListData } from '@jeesite/biz/api/biz/dbConfig';
const { t } = useI18n('biz.dbConfig');
const modalProps = {
title: t('连接信息选择'),
};
const searchForm: FormProps<BizDbConfig> = {
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: 'dbType',
component: 'Select',
componentProps: {
dictType: 'db_type',
allowClear: true,
},
},
{
label: t('数据库名称'),
field: 'dbName',
component: 'Input',
},
{
label: t('数据库IP'),
field: 'dbIp',
component: 'Input',
},
{
label: t('数据库描述'),
field: 'description',
component: 'Input',
},
{
label: t('是否启用'),
field: 'isEnabled',
component: 'Select',
componentProps: {
dictType: 'is_active',
allowClear: true,
},
},
],
};
const tableColumns: BasicColumn<BizDbConfig>[] = [
{
title: t('创建时间'),
dataIndex: 'createTime',
key: 'a.create_time',
sorter: true,
width: 180,
align: 'left',
fixed: 'left'
},
{
title: t('数据库类型'),
dataIndex: 'dbType',
key: 'a.db_type',
sorter: true,
width: 130,
align: 'left',
dictType: 'db_type',
},
{
title: t('数据库名称'),
dataIndex: 'dbName',
key: 'a.db_name',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('数据库IP'),
dataIndex: 'dbIp',
key: 'a.db_ip',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('数据库端口'),
dataIndex: 'dbPort',
key: 'a.db_port',
sorter: true,
width: 130,
align: 'center',
},
{
title: t('数据库账号'),
dataIndex: 'dbUsername',
key: 'a.db_username',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('数据库描述'),
dataIndex: 'description',
key: 'a.description',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('是否启用'),
dataIndex: 'isEnabled',
key: 'a.is_enabled',
sorter: true,
width: 130,
align: 'center',
dictType: 'is_active',
},
{
title: t('schema名称'),
dataIndex: 'dbSchemaName',
key: 'a.db_schema_name',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('更新时间'),
dataIndex: 'updateTime',
key: 'a.update_time',
sorter: true,
width: 180,
align: 'center',
},
];
const tableProps: BasicTableProps = {
api: bizDbConfigListData,
beforeFetch: (params) => {
params['isAll'] = true;
return params;
},
columns: tableColumns,
formConfig: searchForm,
rowKey: 'id',
};
export default {
modalProps,
tableProps,
itemCode: 'id',
itemName: 'dbName',
isShowCode: true,
};

View File

@@ -16,7 +16,6 @@
</a-button>
</template>
</BasicTable>
<InputForm @register="registerDrawer" @success="handleSuccess" />
<FormImport @register="registerImportModal" @success="handleSuccess" />
</div>
</template>

View File

@@ -1,126 +0,0 @@
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

@@ -16,7 +16,6 @@
</a-button>
</template>
</BasicTable>
<InputForm @register="registerDrawer" @success="handleSuccess" />
<FormImport @register="registerImportModal" @success="handleSuccess" />
</div>
</template>

View File

@@ -1,178 +0,0 @@
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,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 { bizTableInfoImportData } from '@jeesite/biz/api/biz/tableInfo';
import { FileType } from 'ant-design-vue/es/upload/interface';
import { AxiosProgressEvent } from 'axios';
const emit = defineEmits(['success', 'register']);
const { t } = useI18n('biz.tableInfo');
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/tableInfo/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 bizTableInfoImportData(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,271 @@
<!--
* 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="ViewsBizTableInfoList">
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 { BizTableInfo, bizTableInfoList } from '@jeesite/biz/api/biz/tableInfo';
import { bizTableInfoDelete, bizTableInfoListData } from '@jeesite/biz/api/biz/tableInfo';
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.tableInfo');
const { showMessage } = useMessage();
const { meta } = unref(router.currentRoute);
const record = ref<BizTableInfo>({} as BizTableInfo);
const getTitle = {
icon: meta.icon || 'i-ant-design:book-outlined',
value: meta.title || t('数据信息管理'),
};
const loading = ref(false);
const searchForm: FormProps<BizTableInfo> = {
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: 'dataName',
component: 'Input',
},
{
label: t('数据表描述'),
field: 'tableComment',
component: 'Input',
},
{
label: t('数据库名称'),
field: 'dbId',
fieldLabel: 'dbName',
component: 'ListSelect',
componentProps: {
selectType: 'bizDbSelect',
},
},
{
label: t('数据来源'),
field: 'dataSource',
component: 'Input',
},
{
label: t('备注信息'),
field: 'remarks',
component: 'Input',
},
],
};
const tableColumns: BasicColumn<BizTableInfo>[] = [
{
title: t('创建时间'),
dataIndex: 'createTime',
key: 'a.create_time',
sorter: true,
width: 180,
align: 'left',
fixed: 'left',
},
{
title: t('数据库名称'),
dataIndex: 'dbName',
key: 'b.db_name',
sorter: true,
width: 200,
align: 'left',
},
{
title: t('数据库IP'),
dataIndex: 'dbIp',
key: 'b.db_ip',
sorter: true,
width: 200,
align: 'left',
},
{
title: t('数据表名称'),
dataIndex: 'dataName',
key: 'a.data_name',
sorter: true,
width: 200,
align: 'left',
},
{
title: t('数据表描述'),
dataIndex: 'tableComment',
key: 'a.table_comment',
sorter: true,
width: 225,
align: 'left',
},
{
title: t('数据表大小'),
dataIndex: 'tableSize',
key: 'a.table_size',
sorter: true,
width: 130,
align: 'right',
},
{
title: t('数据来源'),
dataIndex: 'dataSource',
key: 'a.data_source',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('创建人员'),
dataIndex: 'creator',
key: 'a.creator',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('记录条数'),
dataIndex: 'dataRows',
key: 'a.data_rows',
sorter: true,
width: 130,
align: 'center',
},
{
title: t('更新时间'),
dataIndex: 'updateTime',
key: 'a.update_time',
sorter: true,
width: 130,
align: 'center',
},
{
title: t('备注信息'),
dataIndex: 'remarks',
key: 'a.remarks',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('分区日期'),
dataIndex: 'ds',
key: 'a.ds',
sorter: true,
width: 130,
align: 'left',
},
];
const actionColumn: BasicColumn<BizTableInfo> = {
width: 160,
align: 'center',
actions: (record: BizTableInfo) => [
{
icon: 'i-ant-design:delete-outlined',
color: 'error',
title: t('删除'),
popConfirm: {
title: t('是否确认删除数据信息?'),
confirm: handleDelete.bind(this, record),
},
auth: 'biz:tableInfo:edit',
},
],
};
const [registerTable, { reload, getForm }] = useTable<BizTableInfo>({
api: bizTableInfoListData,
beforeFetch: (params) => {
return params;
},
columns: tableColumns,
actionColumn: actionColumn,
formConfig: searchForm,
showTableSetting: true,
useSearchForm: true,
canResize: true,
});
onMounted(async () => {
const res = await bizTableInfoList();
record.value = (res.bizTableInfo || {}) as BizTableInfo;
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/tableInfo/exportData',
params: getForm().getFieldsValue(),
});
loading.value = false;
}
const [registerImportModal, { openModal: importModal }] = useModal();
function handleImport() {
importModal(true, {});
}
async function handleDelete(record: Recordable) {
const params = { tableId: record.tableId };
const res = await bizTableInfoDelete(params);
showMessage(res.message);
await handleSuccess(record);
}
async function handleSuccess(record: Recordable) {
await reload({ record });
}
</script>

View File

@@ -70,7 +70,7 @@ const tableColumns: BasicColumn<BizCompany>[] = [
sorter: true,
width: 180,
align: 'left',
slot: 'firstColumn',
fixed: 'left',
},
{
title: t('公司名称'),

View File

@@ -0,0 +1,172 @@
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
import { BasicColumn, BasicTableProps, FormProps } from '@jeesite/core/components/Table';
import { BizDbConfig, bizDbConfigListData } from '@jeesite/biz/api/biz/dbConfig';
const { t } = useI18n('biz.dbConfig');
const modalProps = {
title: t('连接信息选择'),
};
const searchForm: FormProps<BizDbConfig> = {
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: 'dbType',
component: 'Select',
componentProps: {
dictType: 'db_type',
allowClear: true,
},
},
{
label: t('数据库名称'),
field: 'dbName',
component: 'Input',
},
{
label: t('数据库IP'),
field: 'dbIp',
component: 'Input',
},
{
label: t('数据库描述'),
field: 'description',
component: 'Input',
},
{
label: t('是否启用'),
field: 'isEnabled',
component: 'Select',
componentProps: {
dictType: 'is_active',
allowClear: true,
},
},
],
};
const tableColumns: BasicColumn<BizDbConfig>[] = [
{
title: t('创建时间'),
dataIndex: 'createTime',
key: 'a.create_time',
sorter: true,
width: 180,
align: 'left',
fixed: 'left'
},
{
title: t('数据库类型'),
dataIndex: 'dbType',
key: 'a.db_type',
sorter: true,
width: 130,
align: 'left',
dictType: 'db_type',
},
{
title: t('数据库名称'),
dataIndex: 'dbName',
key: 'a.db_name',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('数据库IP'),
dataIndex: 'dbIp',
key: 'a.db_ip',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('数据库端口'),
dataIndex: 'dbPort',
key: 'a.db_port',
sorter: true,
width: 130,
align: 'center',
},
{
title: t('数据库账号'),
dataIndex: 'dbUsername',
key: 'a.db_username',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('数据库描述'),
dataIndex: 'description',
key: 'a.description',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('是否启用'),
dataIndex: 'isEnabled',
key: 'a.is_enabled',
sorter: true,
width: 130,
align: 'center',
dictType: 'is_active',
},
{
title: t('schema名称'),
dataIndex: 'dbSchemaName',
key: 'a.db_schema_name',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('更新时间'),
dataIndex: 'updateTime',
key: 'a.update_time',
sorter: true,
width: 180,
align: 'center',
},
];
const tableProps: BasicTableProps = {
api: bizDbConfigListData,
beforeFetch: (params) => {
params['isAll'] = true;
return params;
},
columns: tableColumns,
formConfig: searchForm,
rowKey: 'id',
};
export default {
modalProps,
tableProps,
itemCode: 'id',
itemName: 'dbName',
isShowCode: true,
};

View File

@@ -73,7 +73,7 @@ const tableColumns: BasicColumn<BizResumeEmployee>[] = [
sorter: true,
width: 180,
align: 'left',
slot: 'firstColumn',
fixed: 'left',
},
{
title: t('员工姓名'),

View File

@@ -74,6 +74,7 @@ const tableColumns: BasicColumn<BizMonitorHost>[] = [
sorter: true,
width: 180,
align: 'left',
fixed: 'left',
},
{
title: t('主机名称'),

View File

@@ -42,7 +42,7 @@ const tableColumns: BasicColumn<BizProjectInfo>[] = [
sorter: true,
width: 180,
align: 'left',
slot: 'firstColumn',
fixed: 'left',
},
{
title: t('项目编码'),

View File

@@ -42,6 +42,7 @@ const tableColumns: BasicColumn<BizProvince>[] = [
sorter: true,
width: 180,
align: 'left',
fixed: 'left',
},
{
title: t('省份名称'),

View File

@@ -82,7 +82,7 @@ const tableColumns: BasicColumn[] = [
key: 'a.login_code',
sorter: true,
width: 100,
slot: 'firstColumn',
fixed: 'left',
},
{
title: t('用户昵称'),

View File

@@ -42,6 +42,7 @@ const tableColumns: BasicColumn<ErpAccount>[] = [
sorter: true,
width: 180,
align: 'left',
fixed: 'left',
},
{
title: t('账户名称'),

View File

@@ -46,6 +46,7 @@ const tableColumns: BasicColumn<ErpCategory>[] = [
sorter: true,
width: 180,
align: 'left',
fixed: 'left',
},
{
title: t('分类名称'),

View File

@@ -46,7 +46,7 @@ const tableColumns: BasicColumn<ErpTransactionFlow>[] = [
sorter: true,
width: 180,
align: 'left',
slot: 'firstColumn',
fixed: 'left',
},
{
title: t('交易名称'),

View File

@@ -60,7 +60,7 @@ const tableColumns: BasicColumn[] = [
key: 'a.login_code',
sorter: true,
width: 100,
slot: 'firstColumn',
fixed: 'left',
},
{
title: t('用户昵称'),