新增预警页面

This commit is contained in:
2025-12-10 22:37:23 +08:00
parent af34bfa2f0
commit abe7f9cbc1
19 changed files with 2182 additions and 64 deletions

View File

@@ -0,0 +1,60 @@
/**
* 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 BizCalendarSchedule extends BasicModel<BizCalendarSchedule> {
createTime?: string; // 记录时间
scheduleId?: string; // 主键标识
scheduleNo: string; // 日程编号
title: string; // 日程标题
content?: string; // 日程详情/备注
startTime: string; // 日程开始时间
endTime: string; // 日程结束时间
allDay: string; // 是否全天
location?: string; // 日程地点
priority: string; // 优先等级
ustatus: string; // 日程状态
remindTime?: string; // 提醒时间
creatorUser?: string; // 创建人账号
creatorName?: string; // 创建人名称
participantUser?: string; // 接收人账号
participantName?: string; // 接收人名称
updateTime?: string; // 更新时间
}
export const bizCalendarScheduleList = (params?: BizCalendarSchedule | any) =>
defHttp.get<BizCalendarSchedule>({ url: adminPath + '/biz/calendarSchedule/list', params });
export const bizCalendarScheduleListData = (params?: BizCalendarSchedule | any) =>
defHttp.post<Page<BizCalendarSchedule>>({ url: adminPath + '/biz/calendarSchedule/listData', params });
export const bizCalendarScheduleForm = (params?: BizCalendarSchedule | any) =>
defHttp.get<BizCalendarSchedule>({ url: adminPath + '/biz/calendarSchedule/form', params });
export const bizCalendarScheduleSave = (params?: any, data?: BizCalendarSchedule | any) =>
defHttp.postJson<BizCalendarSchedule>({ url: adminPath + '/biz/calendarSchedule/save', params, data });
export const bizCalendarScheduleImportData = (
params: UploadFileParams,
onUploadProgress: (progressEvent: AxiosProgressEvent) => void,
) =>
defHttp.uploadFile<UploadApiResult>(
{
url: ctxPath + adminPath + '/biz/calendarSchedule/importData',
onUploadProgress,
},
params,
);
export const bizCalendarScheduleDelete = (params?: BizCalendarSchedule | any) =>
defHttp.get<BizCalendarSchedule>({ url: adminPath + '/biz/calendarSchedule/delete', params });

View File

@@ -0,0 +1,188 @@
<!--
* 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:calendarSchedule: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="ViewsBizCalendarScheduleForm">
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 { BizCalendarSchedule, bizCalendarScheduleSave, bizCalendarScheduleForm } from '@jeesite/biz/api/biz/calendarSchedule';
const emit = defineEmits(['success', 'register']);
const { t } = useI18n('biz.calendarSchedule');
const { showMessage } = useMessage();
const { meta } = unref(router.currentRoute);
const record = ref<BizCalendarSchedule>({} as BizCalendarSchedule);
const getTitle = computed(() => ({
icon: meta.icon || 'i-ant-design:book-outlined',
value: record.value.isNewRecord ? t('新增日程信息') : t('编辑日程信息'),
}));
const inputFormSchemas: FormSchema<BizCalendarSchedule>[] = [
{
label: t('日程标题'),
field: 'title',
component: 'Input',
componentProps: {
maxlength: 255,
},
required: true,
colProps: { md: 24, lg: 24 },
},
{
label: t('日程编号'),
field: 'scheduleNo',
component: 'Input',
componentProps: {
maxlength: 64,
},
required: true,
},
{
label: t('通知人员'),
field: 'participantUser',
fieldLabel: 'participantName',
component: 'ListSelect',
componentProps: {
selectType: 'userSelect',
},
required: true,
},
{
label: t('日程内容'),
field: 'content',
component: 'InputTextArea',
colProps: { md: 24, lg: 24 },
},
{
label: t('开始时间'),
field: 'startTime',
component: 'DatePicker',
componentProps: {
format: 'YYYY-MM-DD HH:mm',
showTime: { format: 'HH:mm' },
},
required: true,
},
{
label: t('结束时间'),
field: 'endTime',
component: 'DatePicker',
componentProps: {
format: 'YYYY-MM-DD HH:mm',
showTime: { format: 'HH:mm' },
},
required: true,
},
{
label: t('是否全天'),
field: 'allDay',
component: 'Select',
componentProps: {
dictType: 'is_day',
allowClear: true,
},
required: true,
},
{
label: t('优先等级'),
field: 'priority',
component: 'Select',
componentProps: {
dictType: 'priority',
allowClear: true,
},
required: true,
},
{
label: t('提醒时间'),
field: 'remindTime',
component: 'DatePicker',
componentProps: {
format: 'YYYY-MM-DD HH:mm',
showTime: { format: 'HH:mm' },
},
},
{
label: t('日程状态'),
field: 'ustatus',
component: 'Select',
componentProps: {
dictType: 'todo_status',
allowClear: true,
},
required: true,
},
{
label: t('日程地点'),
field: 'location',
component: 'Input',
componentProps: {
maxlength: 512,
},
colProps: { md: 24, lg: 24 },
},
];
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm<BizCalendarSchedule>({
labelWidth: 120,
schemas: inputFormSchemas,
baseColProps: { md: 24, lg: 12 },
});
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
setDrawerProps({ loading: true });
await resetFields();
const res = await bizCalendarScheduleForm(data);
record.value = (res.bizCalendarSchedule || {}) as BizCalendarSchedule;
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,
scheduleId: record.value.scheduleId || data.scheduleId,
};
// console.log('submit', params, data, record);
const res = await bizCalendarScheduleSave(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 { bizCalendarScheduleImportData } from '@jeesite/biz/api/biz/calendarSchedule';
import { FileType } from 'ant-design-vue/es/upload/interface';
import { AxiosProgressEvent } from 'axios';
const emit = defineEmits(['success', 'register']);
const { t } = useI18n('biz.calendarSchedule');
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/calendarSchedule/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 bizCalendarScheduleImportData(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,311 @@
<!--
* 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:calendarSchedule:edit'">
<Icon icon="i-fluent:add-12-filled" /> {{ t('新增') }}
</a-button>
</template>
<template #slotBizKey="{ record }">
<a v-if="record.ustatus !== '9'" @click="handleForm({ scheduleId: record.scheduleId })" :title="record.title">
{{ record.title }}
</a>
</template>
</BasicTable>
<InputForm @register="registerDrawer" @success="handleSuccess" />
<FormImport @register="registerImportModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" setup name="ViewsBizCalendarScheduleList">
import { onMounted, ref, unref, computed } 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 { BizCalendarSchedule, bizCalendarScheduleList } from '@jeesite/biz/api/biz/calendarSchedule';
import { bizCalendarScheduleDelete, bizCalendarScheduleListData } from '@jeesite/biz/api/biz/calendarSchedule';
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';
import { useUserStore } from '@jeesite/core/store/modules/user';
const { t } = useI18n('biz.calendarSchedule');
const { showMessage } = useMessage();
const { meta } = unref(router.currentRoute);
const record = ref<BizCalendarSchedule>({} as BizCalendarSchedule);
const userStore = useUserStore();
const userinfo = computed(() => userStore.getUserInfo);
const getTitle = {
icon: meta.icon || 'i-ant-design:book-outlined',
value: meta.title || t('日程信息管理'),
};
const loading = ref(false);
const searchForm: FormProps<BizCalendarSchedule> = {
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: 'scheduleNo',
component: 'Input',
},
{
label: t('日程标题'),
field: 'title',
component: 'Input',
},
{
label: t('是否全天'),
field: 'allDay',
component: 'Select',
componentProps: {
dictType: 'is_day',
allowClear: true,
},
},
{
label: t('优先等级'),
field: 'priority',
component: 'Select',
componentProps: {
dictType: 'priority',
allowClear: true,
},
},
{
label: t('日程状态'),
field: 'ustatus',
component: 'Select',
componentProps: {
dictType: 'todo_status',
allowClear: true,
},
},
],
};
const tableColumns: BasicColumn<BizCalendarSchedule>[] = [
{
title: t('记录时间'),
dataIndex: 'createTime',
key: 'a.create_time',
sorter: true,
width: 180,
align: 'left',
fixed: 'left',
},
{
title: t('日程编号'),
dataIndex: 'scheduleNo',
key: 'a.schedule_no',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('日程标题'),
dataIndex: 'title',
key: 'a.title',
sorter: true,
width: 130,
align: 'left',
slot: 'slotBizKey',
},
{
title: t('开始时间'),
dataIndex: 'startTime',
key: 'a.start_time',
sorter: true,
width: 180,
align: 'center',
},
{
title: t('结束时间'),
dataIndex: 'endTime',
key: 'a.end_time',
sorter: true,
width: 180,
align: 'center',
},
{
title: t('是否全天'),
dataIndex: 'allDay',
key: 'a.all_day',
sorter: true,
width: 130,
align: 'left',
dictType: 'is_day',
},
{
title: t('日程地点'),
dataIndex: 'location',
key: 'a.location',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('通知人员'),
dataIndex: 'participantName',
key: 'a.participant_name',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('优先等级'),
dataIndex: 'priority',
key: 'a.priority',
sorter: true,
width: 130,
align: 'center',
dictType: 'priority',
},
{
title: t('日程状态'),
dataIndex: 'ustatus',
key: 'a.ustatus',
sorter: true,
width: 130,
align: 'center',
dictType: 'todo_status',
},
{
title: t('提醒时间'),
dataIndex: 'remindTime',
key: 'a.remind_time',
sorter: true,
width: 180,
align: 'center',
},
{
title: t('更新时间'),
dataIndex: 'updateTime',
key: 'a.update_time',
sorter: true,
width: 180,
align: 'center',
},
];
const actionColumn: BasicColumn<BizCalendarSchedule> = {
width: 160,
align: 'center',
actions: (record: BizCalendarSchedule) => [
{
icon: 'i-clarity:note-edit-line',
title: t('编辑'),
onClick: handleForm.bind(this, { scheduleId: record.scheduleId }),
auth: 'biz:calendarSchedule:edit',
ifShow: record.ustatus !== '9'
},
{
icon: 'i-ant-design:delete-outlined',
color: 'error',
title: t('删除'),
popConfirm: {
title: t('是否确认删除日程信息?'),
confirm: handleDelete.bind(this, record),
},
auth: 'biz:calendarSchedule:edit',
ifShow: record.ustatus == '0'
},
],
};
const [registerTable, { reload, getForm }] = useTable<BizCalendarSchedule>({
api: bizCalendarScheduleListData,
beforeFetch: (params) => {
return {
... params,
creatorUser: userinfo.value.loginCode ,
};
},
columns: tableColumns,
actionColumn: actionColumn,
formConfig: searchForm,
showTableSetting: true,
useSearchForm: true,
canResize: true,
});
onMounted(async () => {
const res = await bizCalendarScheduleList();
record.value = (res.bizCalendarSchedule || {}) as BizCalendarSchedule;
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/calendarSchedule/exportData',
params: {
... getForm().getFieldsValue(),
creatorUser: userinfo.value.loginCode,
},
});
loading.value = false;
}
const [registerImportModal, { openModal: importModal }] = useModal();
function handleImport() {
importModal(true, {});
}
async function handleDelete(record: Recordable) {
const params = { scheduleId: record.scheduleId };
const res = await bizCalendarScheduleDelete(params);
showMessage(res.message);
await handleSuccess(record);
}
async function handleSuccess(record: Recordable) {
await reload({ record });
}
</script>

View File

@@ -201,7 +201,7 @@ const processTableData = () => {
);
if (validData.length === 0) {
return { accountNames: [], series: [], bankDetailMap: {}, latestDate: '' };
return { accountNames: [], series: [], bankDetailMap: {}, latestDate: '', sortedDates: [] };
}
// 1. 获取所有日期并排序(支持季度/月份格式)
@@ -287,7 +287,7 @@ const processTableData = () => {
};
/**
* 初始化图表X轴为银行名称Tooltip展示月度明细
* 初始化图表X轴为银行名称Tooltip改为表格形式展示)
*/
const initChart = () => {
if (!chartDom.value) return;
@@ -319,53 +319,77 @@ const initChart = () => {
trigger: 'axis',
axisPointer: { type: 'shadow' },
textStyle: { fontSize: 12 },
padding: [10, 15],
padding: [12, 15],
// Tooltip重构为标题 + 明细表格 + 汇总行
formatter: function(params: any) {
if (!params || params.length === 0) return '';
// 获取当前银行名称
const bankName = params[0]?.axisValue || '';
const bankDetails = bankDetailMap[bankName] || {};
// 生成周期明细行
let cycleRows = '';
// 生成周期明细表格
let cycleTableRows = '';
let hasData = false;
sortedDates.forEach(date => {
const detail = bankDetails[date] || { income: 0, expense: 0 };
const incomeYuan = convertToYuan(detail.income);
const expenseYuan = convertToYuan(detail.expense);
if (incomeYuan > 0 || expenseYuan > 0) {
cycleRows += `
<div style="display: flex; justify-content: space-between; margin: 4px 0;">
<span style="display: flex; align-items: center;">
hasData = true;
cycleTableRows += `
<tr>
<td style="padding: 4px 8px; text-align: left;">
<span style="display: inline-block; width: 8px; height: 8px; background: ${incomeYuan > 0 ? '#52c41a' : '#f5222d'}; border-radius: 2px; margin-right: 6px;"></span>
${date}
</span>
<span style="display: flex; gap: 15px;">
<span style="color: #52c41a;">收入:${formatNumber(incomeYuan)} </span>
<span style="color: #f5222d;">支出:${formatNumber(expenseYuan)} </span>
</span>
</div>
</td>
<td style="padding: 4px 8px; text-align: right; color: #52c41a;">${formatNumber(incomeYuan)}</td>
<td style="padding: 4px 8px; text-align: right; color: #f5222d;">${formatNumber(expenseYuan)}</td>
</tr>
`;
}
});
// 空明细处理
if (!hasData) {
cycleTableRows = `
<tr>
<td colspan="3" style="padding: 8px; text-align: center; color: #999;">暂无周期明细数据</td>
</tr>
`;
}
// 计算最新周期汇总
const latestDetail = bankDetails[latestDate] || { income: 0, expense: 0 };
const latestIncome = convertToYuan(latestDetail.income);
const latestExpense = convertToYuan(latestDetail.expense);
const netIncome = latestIncome - latestExpense;
// 完整表格化Tooltip结构
return `
<div style="font-weight: 600; margin-bottom: 8px;">${bankName}</div>
${cycleRows}
<div style="border-top: 1px solid #eee; margin: 8px 0; padding-top: 8px; display: flex; justify-content: space-between; font-weight: 600;">
<span>本期总收入:</span>
<span style="display: flex; gap: 15px;">
<span style="color: #52c41a;">收入:${formatNumber(latestIncome)} 元</span>
<span style="color: #f5222d;">支出:${formatNumber(latestExpense)} 元</span>
</span>
<!-- 标题 -->
<div style="font-weight: 600; margin-bottom: 8px; text-align: center; font-size: 14px;">${bankName}</div>
<!-- 明细表格 -->
<table style="width: 100%; border-collapse: collapse; border: 1px solid #eee; margin-bottom: 8px;">
<thead>
<tr style="background: #f8f8f8;">
<th style="padding: 6px 8px; text-align: left; border: 1px solid #eee;">周期</th>
<th style="padding: 6px 8px; text-align: right; border: 1px solid #eee; color: #52c41a;">收入(元)</th>
<th style="padding: 6px 8px; text-align: right; border: 1px solid #eee; color: #f5222d;">支出(元)</th>
</tr>
</thead>
<tbody>
${cycleTableRows}
</tbody>
</table>
<!-- 汇总行 -->
<div style="border-top: 1px solid #eee; margin: 8px 0; padding-top: 8px;">
<div style="display: flex; justify-content: space-between; color: #333;">
<span style="color: #52c41a;">本期总收入:${formatNumber(latestIncome)} 元</span>
<span style="color: #f5222d;">本期总支出:${formatNumber(latestExpense)} 元</span>
</div>
</div>
<div style="text-align: left; color: #333; font-weight: 600;">
<div style="text-align: left; font-weight: 600; color: #333;">
本期净收入:${formatNumber(netIncome)}
</div>
`;
@@ -486,15 +510,16 @@ onUnmounted(() => {
border-radius: 4px; /* 图例也添加圆角,保持风格统一 */
}
/* Tooltip样式 */
/* Tooltip样式优化(适配表格) */
:deep(.echarts-tooltip) {
border-radius: 8px;
padding: 10px;
padding: 12px !important;
box-shadow: 0 2px 12px rgba(0,0,0,0.15);
border: none;
background: #fff;
z-index: 9999 !important;
max-width: 400px; /* 限制Tooltip宽度避免过宽 */
min-width: 450px; /* 保证表格有足够宽度 */
max-width: 500px; /* 限制最大宽度避免过宽 */
}
/* 优化标签显示效果 */
@@ -511,4 +536,15 @@ onUnmounted(() => {
word-break: keep-all;
white-space: nowrap;
}
</style>
/* Tooltip表格样式增强 */
:deep(.echarts-tooltip table) {
width: 100%;
border-collapse: collapse;
}
:deep(.echarts-tooltip th) {
font-weight: 600;
color: #666;
}
</style>

View File

@@ -216,8 +216,7 @@ const processTableData = () => {
data: dateList.map(date => incomeTotalMap[date]),
itemStyle: {
...baseBarConfig.itemStyle,
color: '#52c41a', // 收入绿色
// 可选:收入柱子添加渐变效果,增强视觉体验
// 收入柱子添加渐变效果,增强视觉体验
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: '#73d13d' },
{ offset: 1, color: '#52c41a' }
@@ -235,8 +234,7 @@ const processTableData = () => {
data: dateList.map(date => expenseTotalMap[date]),
itemStyle: {
...baseBarConfig.itemStyle,
color: '#f5222d', // 支出红色
// 可选:支出柱子添加渐变效果,增强视觉体验
// 支出柱子添加渐变效果,增强视觉体验
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: '#ff4d4f' },
{ offset: 1, color: '#f5222d' }
@@ -259,7 +257,7 @@ const processTableData = () => {
};
/**
* 初始化图表(改为总值显示,恢复原Tooltip式)
* 初始化图表改为总值显示Tooltip改为表格形式)
*/
const initChart = () => {
if (!chartDom.value) return;
@@ -292,6 +290,7 @@ const initChart = () => {
axisPointer: { type: 'shadow' },
textStyle: { fontSize: 12 },
padding: [10, 15],
// Tooltip改为表格形式展示
formatter: function(params: any) {
if (!params || params.length === 0) return '';
const date = params[0]?.axisValue || '';
@@ -301,11 +300,11 @@ const initChart = () => {
const expenseTotal = convertToYuan(expenseTotalMap[date] || 0);
const netIncome = incomeTotal - expenseTotal;
let accountRows = '';
const accountDetails = accountDetailMap[date] || {};
const accountNames = Object.keys(accountDetails).sort();
// 生成账户明细行(保持原格式)
// 生成账户明细表格
let accountTableRows = '';
accountNames.forEach(account => {
const detail = accountDetails[account];
if (detail.income > 0 || detail.expense > 0) {
@@ -313,32 +312,44 @@ const initChart = () => {
const incomeValue = convertToYuan(detail.income);
const expenseValue = convertToYuan(detail.expense);
accountRows += `
<div style="display: flex; justify-content: space-between; margin: 4px 0;">
<span style="display: flex; align-items: center;">
accountTableRows += `
<tr>
<td style="padding: 4px 8px; text-align: left;">
<span style="display: inline-block; width: 8px; height: 8px; background: ${detail.income > 0 ? '#52c41a' : '#f5222d'}; border-radius: 2px; margin-right: 6px;"></span>
${account}
</span>
<span style="display: flex; gap: 15px;">
<span style="color: #52c41a;">收入:${formatNumber(incomeValue)} </span>
<span style="color: #f5222d;">支出:${formatNumber(expenseValue)} </span>
</span>
</div>
</td>
<td style="padding: 4px 8px; text-align: right; color: #52c41a;">${formatNumber(incomeValue)}</td>
<td style="padding: 4px 8px; text-align: right; color: #f5222d;">${formatNumber(expenseValue)}</td>
</tr>
`;
}
});
// 保持原Tooltip的HTML结构
// 完整的表格结构Tooltip
return `
<div style="font-weight: 600; margin-bottom: 8px;">${date}</div>
${accountRows}
<div style="font-weight: 600; margin-bottom: 8px; text-align: center;">${date}</div>
<!-- 账户明细表格 -->
<table style="width: 100%; border-collapse: collapse; border: 1px solid #eee;">
<thead>
<tr style="background: #f8f8f8;">
<th style="padding: 6px 8px; text-align: left; border: 1px solid #eee;">账户名称</th>
<th style="padding: 6px 8px; text-align: right; border: 1px solid #eee; color: #52c41a;">收入(元)</th>
<th style="padding: 6px 8px; text-align: right; border: 1px solid #eee; color: #f5222d;">支出(元)</th>
</tr>
</thead>
<tbody>
${accountTableRows || '<tr><td colspan="3" style="padding: 8px; text-align: center; color: #999;">暂无明细数据</td></tr>'}
</tbody>
</table>
<!-- 汇总行 -->
<div style="border-top: 1px solid #eee; margin: 8px 0; padding-top: 8px; display: flex; justify-content: space-between; font-weight: 600;">
<span style="display: flex; gap: 15px;">
<span>总计</span>
<span style="display: flex; gap: 20px;">
<span style="color: #52c41a;">总收入:${formatNumber(incomeTotal)} 元</span>
<span style="color: #f5222d;">总支出:${formatNumber(expenseTotal)} 元</span>
</span>
</div>
<div style="text-align: left; color: #333; font-weight: 600;">
<div style="text-align: right; font-weight: 600; color: #333;">
净收入:${formatNumber(netIncome)}
</div>
`;
@@ -460,14 +471,15 @@ onUnmounted(() => {
border-radius: 4px; /* 图例也添加圆角,保持风格统一 */
}
/* Tooltip样式 */
/* Tooltip样式优化(适配表格) */
:deep(.echarts-tooltip) {
border-radius: 8px;
padding: 10px;
padding: 12px !important;
box-shadow: 0 2px 12px rgba(0,0,0,0.15);
border: none;
background: #fff;
z-index: 9999 !important;
min-width: 400px; /* 保证表格有足够宽度 */
}
/* 优化标签显示效果 */
@@ -484,4 +496,20 @@ onUnmounted(() => {
word-break: keep-all;
white-space: nowrap;
}
</style>
/* Tooltip表格样式优化 */
:deep(.echarts-tooltip table) {
width: 100%;
border-collapse: collapse;
margin: 4px 0;
}
:deep(.echarts-tooltip th) {
font-weight: 600;
color: #666;
}
:deep(.echarts-tooltip td, .echarts-tooltip th) {
border: 1px solid #eee;
}
</style>

View File

@@ -179,7 +179,7 @@
dataIndex: 'updateTime',
key: 'a.update_time',
sorter: true,
width: 130,
width: 180,
align: 'center',
},
{

View File

@@ -214,7 +214,7 @@
/* 样式部分保持不变 */
.card-container {
width: 100%;
height: 18vh;
height: 12vh;
min-height: 160px;
background-color: #e6f7ff;
padding: 10px 0;

View File

@@ -0,0 +1,189 @@
<!--
* 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"
:showFooter="true"
:okAuth="'biz:calendarSchedule: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" />
</BasicModal>
</template>
<script lang="ts" setup name="ViewsBizCalendarScheduleForm">
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 { BasicModal, useModalInner } from '@jeesite/core/components/Modal';
import { BizCalendarSchedule, bizCalendarScheduleSave, bizCalendarScheduleForm } from '@jeesite/biz/api/biz/calendarSchedule';
const emit = defineEmits(['success', 'register']);
const { t } = useI18n('biz.calendarSchedule');
const { showMessage } = useMessage();
const { meta } = unref(router.currentRoute);
const record = ref<BizCalendarSchedule>({} as BizCalendarSchedule);
const getTitle = computed(() => ({
icon: meta.icon || 'i-ant-design:book-outlined',
value: record.value.isNewRecord ? t('新增日程信息') : t('编辑日程信息'),
}));
const inputFormSchemas: FormSchema<BizCalendarSchedule>[] = [
{
label: t('日程标题'),
field: 'title',
component: 'Input',
componentProps: {
maxlength: 255,
},
required: true,
colProps: { md: 24, lg: 24 },
},
{
label: t('日程编号'),
field: 'scheduleNo',
component: 'Input',
componentProps: {
maxlength: 64,
},
required: true,
},
{
label: t('通知人员'),
field: 'participantUser',
fieldLabel: 'participantName',
component: 'ListSelect',
componentProps: {
selectType: 'userSelect',
},
required: true,
},
{
label: t('日程内容'),
field: 'content',
component: 'InputTextArea',
colProps: { md: 24, lg: 24 },
},
{
label: t('开始时间'),
field: 'startTime',
component: 'DatePicker',
componentProps: {
format: 'YYYY-MM-DD HH:mm',
showTime: { format: 'HH:mm' },
},
required: true,
},
{
label: t('结束时间'),
field: 'endTime',
component: 'DatePicker',
componentProps: {
format: 'YYYY-MM-DD HH:mm',
showTime: { format: 'HH:mm' },
},
required: true,
},
{
label: t('是否全天'),
field: 'allDay',
component: 'Select',
componentProps: {
dictType: 'is_day',
allowClear: true,
},
required: true,
},
{
label: t('优先等级'),
field: 'priority',
component: 'Select',
componentProps: {
dictType: 'priority',
allowClear: true,
},
required: true,
},
{
label: t('提醒时间'),
field: 'remindTime',
component: 'DatePicker',
componentProps: {
format: 'YYYY-MM-DD HH:mm',
showTime: { format: 'HH:mm' },
},
},
{
label: t('日程状态'),
field: 'ustatus',
component: 'Select',
componentProps: {
dictType: 'todo_status',
allowClear: true,
},
required: true,
},
{
label: t('日程地点'),
field: 'location',
component: 'Input',
componentProps: {
maxlength: 512,
},
colProps: { md: 24, lg: 24 },
},
];
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm<BizCalendarSchedule>({
labelWidth: 120,
schemas: inputFormSchemas,
baseColProps: { md: 24, lg: 12 },
});
const [registerDrawer, { setModalProps, closeModal }] = useModalInner(async (data) => {
setModalProps({ loading: true });
await resetFields();
const res = await bizCalendarScheduleForm(data);
record.value = (res.bizCalendarSchedule || {}) as BizCalendarSchedule;
record.value.__t = new Date().getTime();
await setFieldsValue(record.value);
setModalProps({ loading: false });
});
async function handleSubmit() {
try {
const data = await validate();
setModalProps({ confirmLoading: true });
const params: any = {
isNewRecord: record.value.isNewRecord,
scheduleId: record.value.scheduleId || data.scheduleId,
};
// console.log('submit', params, data, record);
const res = await bizCalendarScheduleSave(params, data);
showMessage(res.message);
setTimeout(closeModal);
emit('success', data);
} 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,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 { bizCalendarScheduleImportData } from '@jeesite/biz/api/biz/calendarSchedule';
import { FileType } from 'ant-design-vue/es/upload/interface';
import { AxiosProgressEvent } from 'axios';
const emit = defineEmits(['success', 'register']);
const { t } = useI18n('biz.calendarSchedule');
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/calendarSchedule/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 bizCalendarScheduleImportData(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,280 @@
<!--
* 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 #toolbar>
<a-button type="default" :loading="loading" @click="handleExport()">
<Icon icon="i-ant-design:download-outlined" /> {{ t('导出') }}
</a-button>
</template>
<template #slotBizKey="{ record }">
<a v-if="record.ustatus !== '9'" @click="handleForm({ scheduleId: record.scheduleId })" :title="record.title">
{{ record.title }}
</a>
</template>
</BasicTable>
<InputForm @register="registerDrawer" @success="handleSuccess" />
<FormImport @register="registerImportModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" setup name="ViewsBizCalendarScheduleList">
import { onMounted, ref, unref, computed } 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 { BizCalendarSchedule, bizCalendarScheduleList } from '@jeesite/biz/api/biz/calendarSchedule';
import { bizCalendarScheduleDelete, bizCalendarScheduleListData } from '@jeesite/biz/api/biz/calendarSchedule';
import { useModal } from '@jeesite/core/components/Modal';
import { FormProps } from '@jeesite/core/components/Form';
import InputForm from './form.vue';
import FormImport from './formImport.vue';
import { useUserStore } from '@jeesite/core/store/modules/user';
const { t } = useI18n('biz.calendarSchedule');
const { showMessage } = useMessage();
const { meta } = unref(router.currentRoute);
const record = ref<BizCalendarSchedule>({} as BizCalendarSchedule);
const userStore = useUserStore();
const userinfo = computed(() => userStore.getUserInfo);
const loading = ref(false);
const searchForm: FormProps<BizCalendarSchedule> = {
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: 'scheduleNo',
component: 'Input',
},
{
label: t('日程标题'),
field: 'title',
component: 'Input',
},
{
label: t('是否全天'),
field: 'allDay',
component: 'Select',
componentProps: {
dictType: 'is_day',
allowClear: true,
},
},
{
label: t('优先等级'),
field: 'priority',
component: 'Select',
componentProps: {
dictType: 'priority',
allowClear: true,
},
},
{
label: t('日程状态'),
field: 'ustatus',
component: 'Select',
componentProps: {
dictType: 'todo_status',
allowClear: true,
},
},
],
};
const tableColumns: BasicColumn<BizCalendarSchedule>[] = [
{
title: t('记录时间'),
dataIndex: 'createTime',
key: 'a.create_time',
sorter: true,
width: 180,
align: 'left',
fixed: 'left',
},
{
title: t('日程编号'),
dataIndex: 'scheduleNo',
key: 'a.schedule_no',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('日程标题'),
dataIndex: 'title',
key: 'a.title',
sorter: true,
width: 130,
align: 'left',
slot: 'slotBizKey',
},
{
title: t('开始时间'),
dataIndex: 'startTime',
key: 'a.start_time',
sorter: true,
width: 180,
align: 'center',
},
{
title: t('结束时间'),
dataIndex: 'endTime',
key: 'a.end_time',
sorter: true,
width: 180,
align: 'center',
},
{
title: t('是否全天'),
dataIndex: 'allDay',
key: 'a.all_day',
sorter: true,
width: 130,
align: 'left',
dictType: 'is_day',
},
{
title: t('日程地点'),
dataIndex: 'location',
key: 'a.location',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('优先等级'),
dataIndex: 'priority',
key: 'a.priority',
sorter: true,
width: 130,
align: 'center',
dictType: 'priority',
},
{
title: t('日程状态'),
dataIndex: 'ustatus',
key: 'a.ustatus',
sorter: true,
width: 130,
align: 'center',
dictType: 'todo_status',
},
{
title: t('提醒时间'),
dataIndex: 'remindTime',
key: 'a.remind_time',
sorter: true,
width: 180,
align: 'center',
},
{
title: t('更新时间'),
dataIndex: 'updateTime',
key: 'a.update_time',
sorter: true,
width: 180,
align: 'center',
},
];
const actionColumn: BasicColumn<BizCalendarSchedule> = {
width: 160,
align: 'center',
actions: (record: BizCalendarSchedule) => [
{
icon: 'i-clarity:note-edit-line',
title: t('编辑'),
onClick: handleForm.bind(this, { scheduleId: record.scheduleId }),
auth: 'biz:calendarSchedule:edit',
ifShow: record.ustatus !== '9'
},
],
};
const [registerTable, { reload, getForm }] = useTable<BizCalendarSchedule>({
api: bizCalendarScheduleListData,
beforeFetch: (params) => {
return {
... params,
participantUser: userinfo.value.loginCode ,
};
},
columns: tableColumns,
actionColumn: actionColumn,
formConfig: searchForm,
showTableSetting: true,
useSearchForm: true,
canResize: true,
});
onMounted(async () => {
const res = await bizCalendarScheduleList();
record.value = (res.bizCalendarSchedule || {}) as BizCalendarSchedule;
await getForm().setFieldsValue(record.value);
});
const [registerDrawer, { openModal }] = useModal();
function handleForm(record: Recordable) {
openModal(true, record);
}
async function handleExport() {
loading.value = true;
const { ctxAdminPath } = useGlobSetting();
await downloadByUrl({
url: ctxAdminPath + '/biz/calendarSchedule/exportData',
params: {
... getForm().getFieldsValue(),
participantUser: userinfo.value.loginCode,
},
});
loading.value = false;
}
const [registerImportModal, { openModal: importModal }] = useModal();
function handleImport() {
importModal(true, {});
}
async function handleDelete(record: Recordable) {
const params = { scheduleId: record.scheduleId };
const res = await bizCalendarScheduleDelete(params);
showMessage(res.message);
await handleSuccess(record);
}
async function handleSuccess(record: Recordable) {
await reload({ record });
}
</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 { 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,262 @@
<!--
* 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 #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 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: 180,
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

@@ -1,16 +1,22 @@
<template>
<PageWrapper title="数据看板">
<template #headerContent>
<MySchedule />
</template>
<div>
<Tabs v-model:activeKey="activeKey">
<TabPane key="1" tab="日程管理"></TabPane>
<TabPane key="2" tab="工单管理"></TabPane>
<TabPane key="3" tab="字典管理"></TabPane>
</Tabs>
<div class="web-page-container">
<PageWrapper title="数据看板">
<template #headerContent>
<MySchedule />
</template>
<div>
s
</div>
</PageWrapper>
<Tabs v-model:activeKey="activeKey">
<TabPane key="1" tab="日程管理">
<Calendar />
</TabPane>
<TabPane key="2" tab="字典管理">
<TableInfo />
</TabPane>
</Tabs>
</div>
</PageWrapper>
</template>
<script lang="ts" setup name="AboutPage">
import { h, ref } from 'vue';
@@ -18,7 +24,21 @@
import { PageWrapper } from '@jeesite/core/components/Page';
import MySchedule from './components/MySchedule.vue';
import Calendar from './components/calendar/list.vue';
import TableInfo from './components/tableInfo/list.vue';
const activeKey = ref('1');
</script>
<style scoped lang="less">
// 整体容器样式
.web-page-container {
width: 100%;
background-color: #e8f4f8;
display: flex;
flex-direction: column; // 垂直布局
overflow: hidden; // 防止内容溢出
}
</style>