初始化项目

This commit is contained in:
2026-03-24 22:06:31 +08:00
parent 80e3cb1b58
commit 52618d491b
18 changed files with 1643 additions and 397 deletions

View File

@@ -0,0 +1,74 @@
/**
* Copyright (c) 2013-Now https://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 MyNoticeTodo extends BasicModel<MyNoticeTodo> {
createTime?: string; // 记录时间
avatar?: string; // 头像图标
title: string; // 通知标题
titleDelete?: string; // 删除线
datetime?: string; // 到期时间
type?: string; // 消息类型
readFlag?: string; // 是否已读
description?: string; // 描述信息
clickClose?: string; // 是否关闭
extra?: string; // 额外信息
extraDesc?: string; // 待办意见
color?: string; // 颜色值
ustatus?: string; // 发布状态
updateTime?: string; // 更新时间
bizCode?: string; // 业务编号
userName?: string; // 接收姓名
createUser?: string; // 创建用户
loginUser?: string; // 接收用户
}
export interface TabItem {
key: string;
name: string;
count?: number;
btnHref?: string;
btnText?: string;
list: MyNoticeTodo[];
unreadlist?: MyNoticeTodo[];
}
export const tabListDataAll = (params?: MyNoticeTodo | any) =>
defHttp.get<TabItem[]>({ url: adminPath + '/biz/myNoticeTodo/tabListData', params});
export const myNoticeTodoList = (params?: MyNoticeTodo | any) =>
defHttp.get<MyNoticeTodo>({ url: adminPath + '/biz/myNoticeTodo/list', params });
export const myNoticeTodoListData = (params?: MyNoticeTodo | any) =>
defHttp.post<Page<MyNoticeTodo>>({ url: adminPath + '/biz/myNoticeTodo/listData', params });
export const myNoticeTodoForm = (params?: MyNoticeTodo | any) =>
defHttp.get<MyNoticeTodo>({ url: adminPath + '/biz/myNoticeTodo/form', params });
export const myNoticeTodoSave = (params?: any, data?: MyNoticeTodo | any) =>
defHttp.postJson<MyNoticeTodo>({ url: adminPath + '/biz/myNoticeTodo/save', params, data });
export const myNoticeTodoImportData = (
params: UploadFileParams,
onUploadProgress: (progressEvent: AxiosProgressEvent) => void,
) =>
defHttp.uploadFile<UploadApiResult>(
{
url: ctxPath + adminPath + '/biz/myNoticeTodo/importData',
onUploadProgress,
},
params,
);
export const myNoticeTodoDelete = (params?: MyNoticeTodo | any) =>
defHttp.get<MyNoticeTodo>({ url: adminPath + '/biz/myNoticeTodo/delete', params });

View File

@@ -160,6 +160,7 @@
}
data[record.value.isNewRecord ? 'createTime' : 'updateTime'] = formatToDateTime(new Date());
// console.log('submit', params, data, record);
const res = await myNotesSave(params, data);
showMessage(res.message);

View File

@@ -0,0 +1,182 @@
<!--
* Copyright (c) 2013-Now https://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:myNoticeTodo: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="ViewsBizMyNoticeTodoForm">
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 { MyNoticeTodo, myNoticeTodoSave, myNoticeTodoForm } from '@jeesite/biz/api/biz/myNoticeTodo';
import { formatToDateTime } from '@jeesite/core/utils/dateUtil';
const emit = defineEmits(['success', 'register']);
const { t } = useI18n('biz.myNoticeTodo');
const { showMessage } = useMessage();
const { meta } = unref(router.currentRoute);
const record = ref<MyNoticeTodo>({} as MyNoticeTodo);
const getTitle = computed(() => ({
icon: meta.icon || 'i-ant-design:book-outlined',
value: record.value.isNewRecord ? t('新增消息') : t('编辑消息'),
}));
const inputFormSchemas: FormSchema<MyNoticeTodo>[] = [
{
label: t('基本信息'),
field: 'basicInfo',
component: 'FormGroup',
colProps: { md: 24, lg: 24 },
},
{
label: t('通知标题'),
field: 'title',
component: 'Input',
componentProps: {
maxlength: 512,
},
required: true,
},
{
label: t('到期时间'),
field: 'datetime',
component: 'Input',
componentProps: {
maxlength: 32,
},
},
{
label: t('消息类型'),
field: 'type',
component: 'Input',
componentProps: {
maxlength: 32,
},
},
{
label: t('描述信息'),
field: 'description',
component: 'Input',
},
{
label: t('是否关闭'),
field: 'clickClose',
component: 'Input',
componentProps: {
maxlength: 12,
},
},
{
label: t('额外信息'),
field: 'extra',
component: 'Input',
componentProps: {
maxlength: 64,
},
},
{
label: t('待办意见'),
field: 'extraDesc',
component: 'Input',
},
{
label: t('颜色值'),
field: 'color',
component: 'Input',
componentProps: {
maxlength: 32,
},
},
{
label: t('发布状态'),
field: 'ustatus',
component: 'Input',
componentProps: {
maxlength: 12,
},
},
{
label: t('接收用户'),
field: 'loginUser',
component: 'Input',
componentProps: {
maxlength: 52,
},
},
{
label: t('附件上传'),
field: 'dataMap',
component: 'Upload',
componentProps: {
loadTime: computed(() => record.value.__t),
bizKey: computed(() => record.value.id),
bizType: 'myNoticeTodo_file',
uploadType: 'all',
},
colProps: { md: 24, lg: 24 },
},
];
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm<MyNoticeTodo>({
labelWidth: 120,
schemas: inputFormSchemas,
baseColProps: { md: 24, lg: 12 },
});
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
setDrawerProps({ loading: true });
await resetFields();
const res = await myNoticeTodoForm(data);
record.value = (res.myNoticeTodo || {}) as MyNoticeTodo;
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,
};
data[record.value.isNewRecord ? 'createTime' : 'updateTime'] = formatToDateTime(new Date());
// console.log('submit', params, data, record);
const res = await myNoticeTodoSave(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,267 @@
<!--
* Copyright (c) 2013-Now https://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:myNoticeTodo:edit'">
<Icon icon="i-fluent:add-12-filled" /> {{ t('新增') }}
</a-button>
</template>
<template #bizScopeKey="{ record, text, value }">
<a @click="handleForm({ id: record.id })" :title="value">
{{ text }}
</a>
</template>
</BasicTable>
<InputForm @register="registerDrawer" @success="handleSuccess" />
</div>
</template>
<script lang="ts" setup name="ViewsBizMyNoticeTodoList">
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 { MyNoticeTodo, myNoticeTodoList } from '@jeesite/biz/api/biz/myNoticeTodo';
import { myNoticeTodoDelete, myNoticeTodoListData } from '@jeesite/biz/api/biz/myNoticeTodo';
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';
const { t } = useI18n('biz.myNoticeTodo');
const { showMessage } = useMessage();
const { meta } = unref(router.currentRoute);
const record = ref<MyNoticeTodo>({} as MyNoticeTodo);
const getTitle = {
icon: meta.icon || 'i-ant-design:book-outlined',
value: meta.title || t('消息管理'),
};
const loading = ref(false);
const searchForm: FormProps<MyNoticeTodo> = {
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: 'title',
component: 'Input',
},
{
label: t('消息类型'),
field: 'type',
component: 'Input',
},
{
label: t('是否已读'),
field: 'readFlag',
component: 'Input',
},
{
label: t('是否关闭'),
field: 'clickClose',
component: 'Input',
},
{
label: t('发布状态'),
field: 'ustatus',
component: 'Input',
},
],
};
const tableColumns: BasicColumn<MyNoticeTodo>[] = [
{
title: t('记录时间'),
dataIndex: 'createTime',
key: 'a.create_time',
sorter: true,
width: 150,
align: 'center',
fixed: 'left',
},
{
title: t('通知标题'),
dataIndex: 'title',
key: 'a.title',
sorter: true,
width: 130,
align: 'left',
slot: 'bizScopeKey',
},
{
title: t('到期时间'),
dataIndex: 'datetime',
key: 'a.datetime',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('消息类型'),
dataIndex: 'type',
key: 'a.type',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('是否已读'),
dataIndex: 'readFlag',
key: 'a.read_flag',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('是否关闭'),
dataIndex: 'clickClose',
key: 'a.click_close',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('额外信息'),
dataIndex: 'extra',
key: 'a.extra',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('待办意见'),
dataIndex: 'extraDesc',
key: 'a.extra_desc',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('颜色值'),
dataIndex: 'color',
key: 'a.color',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('发布状态'),
dataIndex: 'ustatus',
key: 'a.ustatus',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('更新时间'),
dataIndex: 'updateTime',
key: 'a.update_time',
sorter: true,
width: 150,
align: 'center',
},
];
const actionColumn: BasicColumn<MyNoticeTodo> = {
width: 160,
actions: (record: MyNoticeTodo) => [
{
icon: 'i-clarity:note-edit-line',
title: t('编辑'),
onClick: handleForm.bind(this, { id: record.id }),
auth: 'biz:myNoticeTodo:edit',
},
{
icon: 'i-ant-design:delete-outlined',
color: 'error',
title: t('删除'),
popConfirm: {
title: t('是否确认删除消息?'),
confirm: handleDelete.bind(this, record),
},
auth: 'biz:myNoticeTodo:edit',
},
],
};
const [registerTable, { reload, getForm }] = useTable<MyNoticeTodo>({
api: myNoticeTodoListData,
beforeFetch: (params) => {
return params;
},
columns: tableColumns,
actionColumn: actionColumn,
formConfig: searchForm,
showTableSetting: true,
useSearchForm: true,
canResize: true,
});
onMounted(async () => {
const res = await myNoticeTodoList();
record.value = (res.myNoticeTodo || {}) as MyNoticeTodo;
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/myNoticeTodo/exportData',
params: getForm().getFieldsValue(),
});
loading.value = false;
}
async function handleDelete(record: Recordable) {
const params = { id: record.id };
const res = await myNoticeTodoDelete(params);
showMessage(res.message);
await handleSuccess(record);
}
async function handleSuccess(record: Recordable) {
await reload({ record });
}
</script>

View File

@@ -0,0 +1,226 @@
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
import { BasicColumn, BasicTableProps, FormProps } from '@jeesite/core/components/Table';
import { myNoticeTodoListData } from '@jeesite/biz/api/biz/myNoticeTodo';
const { t } = useI18n('biz.myNoticeTodo');
const modalProps = {
title: t('消息选择'),
};
const searchForm: FormProps<MyNoticeTodo> = {
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: 'title',
component: 'Input',
},
{
label: t('消息类型'),
field: 'type',
component: 'Input',
},
{
label: t('是否已读'),
field: 'readFlag',
component: 'Input',
},
{
label: t('是否关闭'),
field: 'clickClose',
component: 'Input',
},
{
label: t('发布状态'),
field: 'ustatus',
component: 'Input',
},
],
};
const tableColumns: BasicColumn<MyNoticeTodo>[] = [
{
title: t('记录时间'),
dataIndex: 'createTime',
key: 'a.create_time',
sorter: true,
width: 230,
align: 'left',
slot: 'firstColumn',
},
{
title: t('头像图标'),
dataIndex: 'avatar',
key: 'a.avatar',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('通知标题'),
dataIndex: 'title',
key: 'a.title',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('删除线'),
dataIndex: 'titleDelete',
key: 'a.title_delete',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('到期时间'),
dataIndex: 'datetime',
key: 'a.datetime',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('消息类型'),
dataIndex: 'type',
key: 'a.type',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('是否已读'),
dataIndex: 'readFlag',
key: 'a.read_flag',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('描述信息'),
dataIndex: 'description',
key: 'a.description',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('是否关闭'),
dataIndex: 'clickClose',
key: 'a.click_close',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('额外信息'),
dataIndex: 'extra',
key: 'a.extra',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('待办意见'),
dataIndex: 'extraDesc',
key: 'a.extra_desc',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('颜色值'),
dataIndex: 'color',
key: 'a.color',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('发布状态'),
dataIndex: 'ustatus',
key: 'a.ustatus',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('更新时间'),
dataIndex: 'updateTime',
key: 'a.update_time',
sorter: true,
width: 130,
align: 'center',
},
{
title: t('业务编号'),
dataIndex: 'bizCode',
key: 'a.biz_code',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('接收姓名'),
dataIndex: 'userName',
key: 'a.user_name',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('创建用户'),
dataIndex: 'createUser',
key: 'a.create_user',
sorter: true,
width: 130,
align: 'left',
},
{
title: t('接收用户'),
dataIndex: 'loginUser',
key: 'a.login_user',
sorter: true,
width: 130,
align: 'left',
},
];
const tableProps: BasicTableProps = {
api: myNoticeTodoListData,
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

@@ -1,8 +1,150 @@
<template>
<div class="my-screen-page">
<header class="my-screen-top">顶部区域</header>
<section class="my-screen-bottom">
<div class="my-screen-left">
<section class="my-screen-panel my-screen-left-top">左上区域</section>
<section class="my-screen-left-middle">
<div class="my-screen-panel">左中左区域</div>
<div class="my-screen-panel">左中右区域</div>
</section>
<section class="my-screen-left-bottom">
<div class="my-screen-panel">左下左区域</div>
<div class="my-screen-panel">左下右区域</div>
</section>
</div>
<aside class="my-screen-right">
<section class="my-screen-panel my-screen-right-top">右上区域</section>
<section class="my-screen-panel my-screen-right-middle">右中区域</section>
<section class="my-screen-panel my-screen-right-bottom">右下区域</section>
</aside>
</section>
</div>
</template>
<script>
</script>
<script lang="ts" setup name="BizMyScreen"></script>
<style>
</style>
<style lang="less" scoped>
@dark-bg: #141414;
.my-screen-page {
width: 100%;
height: 100%;
min-height: 0;
display: flex;
flex-direction: column;
gap: 12px;
padding: 4px;
box-sizing: border-box;
overflow: hidden;
background: transparent;
border-radius: 10px;
}
.my-screen-top,
.my-screen-panel {
min-height: 0;
border-radius: 10px;
border: 1px solid rgb(226 232 240);
background: rgb(248 250 252);
box-shadow: 0 1px 3px rgb(15 23 42 / 0.06);
display: flex;
align-items: center;
justify-content: center;
color: rgb(71 85 105);
font-size: 16px;
}
.my-screen-top {
flex: 0 0 10%;
}
.my-screen-bottom {
flex: 1 1 90%;
min-height: 0;
display: flex;
gap: 12px;
background: transparent;
}
.my-screen-left {
flex: 0 0 70%;
min-width: 0;
min-height: 0;
display: flex;
flex-direction: column;
gap: 12px;
}
.my-screen-right {
flex: 0 0 calc(30% - 12px);
min-width: 0;
min-height: 0;
display: flex;
flex-direction: column;
gap: 12px;
}
.my-screen-left-top {
flex: 0 0 10%;
}
.my-screen-left-middle,
.my-screen-left-bottom {
flex: 1 1 0;
min-height: 0;
display: flex;
gap: 12px;
}
.my-screen-left-middle .my-screen-panel,
.my-screen-left-bottom .my-screen-panel {
flex: 1 1 0;
}
.my-screen-right-top,
.my-screen-right-middle,
.my-screen-right-bottom {
flex: 1 1 0;
}
html[data-theme='dark'] .my-screen-page,
html[data-theme='dark'] .my-screen-bottom {
background: @dark-bg !important;
}
html[data-theme='dark'] .my-screen-top,
html[data-theme='dark'] .my-screen-panel {
border-color: rgb(51 65 85);
background: @dark-bg !important;
color: rgb(203 213 225);
box-shadow: none;
}
@media (max-width: 768px) {
.my-screen-page {
height: auto;
min-height: 100%;
}
.my-screen-top {
flex-basis: 72px;
}
.my-screen-bottom {
flex-direction: column;
}
.my-screen-left,
.my-screen-right {
flex: 1 1 auto;
width: 100%;
min-height: 360px;
}
.my-screen-left-middle,
.my-screen-left-bottom {
flex-direction: column;
}
}
</style>