feat(api): 添加百色中学和诊所相关API接口
- 新增百色中学报名记录相关接口和数据模型 - 新增百色中学分部、班级、年代、年级管理接口 - 新增百色中学捐款记录和排行相关接口 - 新增诊所挂号和医生入驻申请接口 - 添加相应的数据传输对象和搜索参数模型 - 实现分页查询、增删改查等基础操作接口 - 集成请求处理和错误处理机制
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
import { ref } from 'vue';
|
||||
import { message } from 'ant-design-vue/es';
|
||||
import { CloudUploadOutlined } from '@ant-design/icons-vue';
|
||||
import {importArticles} from "@/api/cms/cmsArticle";
|
||||
import { importArticles } from '@/api/cms/cmsArticle';
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
<template>
|
||||
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
||||
<template #extra>
|
||||
<Extra/>
|
||||
</template>
|
||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
@@ -64,6 +67,7 @@
|
||||
import { pageCmsDesign, removeCmsDesign, removeBatchCmsDesign } from '@/api/cms/cmsDesign';
|
||||
import type { CmsDesign, CmsDesignParam } from '@/api/cms/cmsDesign/model';
|
||||
import {getPageTitle} from "@/utils/common";
|
||||
import Extra from "@/views/bszx/extra.vue";
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
80
src/views/cms/cmsNavigation/components/Import.vue
Normal file
80
src/views/cms/cmsNavigation/components/Import.vue
Normal file
@@ -0,0 +1,80 @@
|
||||
<!-- 导航导入弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="520"
|
||||
:footer="null"
|
||||
title="导入备份"
|
||||
:visible="visible"
|
||||
@update:visible="updateVisible"
|
||||
>
|
||||
<a-spin :spinning="loading">
|
||||
<a-upload-dragger
|
||||
accept=".xls,.xlsx"
|
||||
:show-upload-list="false"
|
||||
:customRequest="doUpload"
|
||||
style="padding: 24px 0; margin-bottom: 16px"
|
||||
>
|
||||
<p class="ant-upload-drag-icon">
|
||||
<cloud-upload-outlined />
|
||||
</p>
|
||||
<p class="ant-upload-hint">将文件拖到此处,或点击上传</p>
|
||||
</a-upload-dragger>
|
||||
</a-spin>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { message } from 'ant-design-vue/es';
|
||||
import { CloudUploadOutlined } from '@ant-design/icons-vue';
|
||||
import { importCmsNavigation } from '@/api/cms/cmsNavigation';
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
defineProps<{
|
||||
// 是否打开弹窗
|
||||
visible: boolean;
|
||||
}>();
|
||||
|
||||
// 导入请求状态
|
||||
const loading = ref(false);
|
||||
|
||||
/* 上传 */
|
||||
const doUpload = ({ file }) => {
|
||||
if (
|
||||
![
|
||||
'application/vnd.ms-excel',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||
].includes(file.type)
|
||||
) {
|
||||
message.error('只能选择 excel 文件');
|
||||
return false;
|
||||
}
|
||||
if (file.size / 1024 / 1024 > 10) {
|
||||
message.error('大小不能超过 10MB');
|
||||
return false;
|
||||
}
|
||||
loading.value = true;
|
||||
importCmsNavigation(file)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
return false;
|
||||
};
|
||||
|
||||
/* 更新 visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -3,22 +3,32 @@
|
||||
<a-space :size="10" style="flex-wrap: wrap">
|
||||
<a-button type="primary" class="ele-btn-icon" @click="emit('add')">
|
||||
<template #icon>
|
||||
<plus-outlined/>
|
||||
<plus-outlined />
|
||||
</template>
|
||||
<span>新建</span>
|
||||
</a-button>
|
||||
<a-button type="dashed" :disabled="!hasRole('superAdmin')" @click="handleExport">备份</a-button>
|
||||
<a-button type="dashed" :disabled="!hasRole('superAdmin')" @click="openImport">恢复</a-button>
|
||||
<a-button
|
||||
type="dashed"
|
||||
:disabled="!hasRole('superAdmin')"
|
||||
@click="handleExport"
|
||||
>备份</a-button
|
||||
>
|
||||
<a-button
|
||||
type="dashed"
|
||||
:disabled="!hasRole('superAdmin')"
|
||||
@click="openImport"
|
||||
>恢复</a-button
|
||||
>
|
||||
<a-button type="dashed" @click="openUrl('/website/model')"
|
||||
>模型管理
|
||||
>模型管理
|
||||
</a-button>
|
||||
<a-divider type="vertical"/>
|
||||
<a-divider type="vertical" />
|
||||
<a-radio-group v-model:value="position" @change="reload">
|
||||
<a-radio-button :value="1">顶部</a-radio-button>
|
||||
<a-radio-button :value="2">底部</a-radio-button>
|
||||
<a-radio-button :value="0">不限</a-radio-button>
|
||||
</a-radio-group>
|
||||
<a-divider type="vertical"/>
|
||||
<a-divider type="vertical" />
|
||||
<a-select
|
||||
v-model:value="where.model"
|
||||
style="width: 150px"
|
||||
@@ -42,98 +52,114 @@
|
||||
/>
|
||||
</a-space>
|
||||
<!-- 导入弹窗 -->
|
||||
<import v-model:visible="showImport" @done="reload"/>
|
||||
<import v-model:visible="showImport" @done="reload" />
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {PlusOutlined} from '@ant-design/icons-vue';
|
||||
import type {GradeParam} from '@/api/user/grade/model';
|
||||
import {watch, ref} from 'vue';
|
||||
import {openUrl} from "@/utils/common";
|
||||
import {hasRole} from "@/utils/permission";
|
||||
import {utils, writeFile} from 'xlsx';
|
||||
import {message} from 'ant-design-vue';
|
||||
import {listCmsNavigation} from "@/api/cms/cmsNavigation";
|
||||
import {getTenantId} from "@/utils/domain";
|
||||
import Import from "./Import.vue";
|
||||
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||
import type { GradeParam } from '@/api/user/grade/model';
|
||||
import { watch, ref } from 'vue';
|
||||
import { openUrl } from '@/utils/common';
|
||||
import { hasRole } from '@/utils/permission';
|
||||
import { utils, writeFile } from 'xlsx';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { listCmsNavigation } from '@/api/cms/cmsNavigation';
|
||||
import { getTenantId } from '@/utils/domain';
|
||||
import Import from './Import.vue';
|
||||
|
||||
// 是否显示导入弹窗
|
||||
const showImport = ref(false);
|
||||
const searchText = ref('');
|
||||
// 是否显示导入弹窗
|
||||
const showImport = ref(false);
|
||||
const searchText = ref('');
|
||||
// 导出请求状态
|
||||
const loading = ref(false);
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的角色
|
||||
selection?: [];
|
||||
}>(),
|
||||
{}
|
||||
);
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的角色
|
||||
selection?: [];
|
||||
}>(),
|
||||
{}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: GradeParam): void;
|
||||
(e: 'add'): void;
|
||||
}>();
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: GradeParam): void;
|
||||
(e: 'add'): void;
|
||||
}>();
|
||||
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {
|
||||
}
|
||||
);
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {}
|
||||
);
|
||||
|
||||
// 表单数据
|
||||
const where = ref({
|
||||
keywords: '',
|
||||
model: '',
|
||||
position: 0
|
||||
});
|
||||
// 表单数据
|
||||
const where = ref({
|
||||
keywords: '',
|
||||
model: '',
|
||||
position: 0
|
||||
});
|
||||
|
||||
const position = ref(0);
|
||||
const position = ref(0);
|
||||
|
||||
const reload = () => {
|
||||
// 更新搜索关键词
|
||||
where.value.keywords = searchText.value;
|
||||
emit('search', where.value);
|
||||
};
|
||||
const reload = () => {
|
||||
// 更新搜索关键词
|
||||
where.value.keywords = searchText.value;
|
||||
emit('search', where.value);
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openImport = () => {
|
||||
showImport.value = true;
|
||||
};
|
||||
/* 打开编辑弹窗 */
|
||||
const openImport = () => {
|
||||
showImport.value = true;
|
||||
};
|
||||
|
||||
// 导出
|
||||
const handleExport = async () => {
|
||||
const array: (string | number)[][] = [
|
||||
[
|
||||
'上级id',
|
||||
'菜单名称',
|
||||
'模型',
|
||||
'标识',
|
||||
'菜单路由地址',
|
||||
'菜单组件地址',
|
||||
'打开位置',
|
||||
'菜单图标',
|
||||
'banner图片',
|
||||
'图标颜色',
|
||||
'是否隐藏',
|
||||
'可见类型',
|
||||
'访问密码',
|
||||
'位置',
|
||||
'仅在顶部显示',
|
||||
'仅在底部显示',
|
||||
'菜单侧栏选中的path',
|
||||
'其它路由元信息',
|
||||
'css样式',
|
||||
'是否推荐',
|
||||
'排序',
|
||||
'备注',
|
||||
'状态'
|
||||
]
|
||||
];
|
||||
// 导出
|
||||
const handleExport = async () => {
|
||||
if (loading.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 按搜索结果导出
|
||||
await listCmsNavigation(where.value)
|
||||
.then((list) => {
|
||||
list?.forEach((d) => {
|
||||
loading.value = true;
|
||||
const array: (string | number)[][] = [
|
||||
[
|
||||
'上级id',
|
||||
'菜单名称',
|
||||
'模型',
|
||||
'标识',
|
||||
'菜单路由地址',
|
||||
'菜单组件地址',
|
||||
'打开位置',
|
||||
'菜单图标',
|
||||
'banner图片',
|
||||
'图标颜色',
|
||||
'是否隐藏',
|
||||
'可见类型',
|
||||
'访问密码',
|
||||
'位置',
|
||||
'仅在顶部显示',
|
||||
'仅在底部显示',
|
||||
'菜单侧栏选中的path',
|
||||
'其它路由元信息',
|
||||
'css样式',
|
||||
'是否推荐',
|
||||
'排序',
|
||||
'备注',
|
||||
'状态'
|
||||
]
|
||||
];
|
||||
|
||||
// 按搜索结果导出
|
||||
message.loading('正在准备导出数据...', 0);
|
||||
|
||||
try {
|
||||
const list = await listCmsNavigation(where.value);
|
||||
|
||||
if (!list || list.length === 0) {
|
||||
message.destroy();
|
||||
message.warning('没有数据可以导出');
|
||||
loading.value = false;
|
||||
return;
|
||||
}
|
||||
|
||||
list.forEach((d) => {
|
||||
array.push([
|
||||
`${d.parentId || ''}`,
|
||||
`${d.title || ''}`,
|
||||
@@ -160,6 +186,7 @@ const handleExport = async () => {
|
||||
`${d.status || 0}`
|
||||
]);
|
||||
});
|
||||
|
||||
const sheetName = `bak_navigation_${getTenantId()}`;
|
||||
const workbook = {
|
||||
SheetNames: [sheetName],
|
||||
@@ -167,18 +194,47 @@ const handleExport = async () => {
|
||||
};
|
||||
const sheet = utils.aoa_to_sheet(array);
|
||||
workbook.Sheets[sheetName] = sheet;
|
||||
|
||||
// 设置列宽
|
||||
sheet['!cols'] = [];
|
||||
message.loading('正在导出...');
|
||||
sheet['!cols'] = [
|
||||
{ wch: 10 }, // 上级id
|
||||
{ wch: 20 }, // 菜单名称
|
||||
{ wch: 10 }, // 模型
|
||||
{ wch: 20 }, // 标识
|
||||
{ wch: 30 }, // 菜单路由地址
|
||||
{ wch: 30 }, // 菜单组件地址
|
||||
{ wch: 10 }, // 打开位置
|
||||
{ wch: 18 }, // 菜单图标
|
||||
{ wch: 24 }, // banner图片
|
||||
{ wch: 12 }, // 图标颜色
|
||||
{ wch: 10 }, // 是否隐藏
|
||||
{ wch: 10 }, // 可见类型
|
||||
{ wch: 16 }, // 访问密码
|
||||
{ wch: 10 }, // 位置
|
||||
{ wch: 12 }, // 仅在顶部显示
|
||||
{ wch: 12 }, // 仅在底部显示
|
||||
{ wch: 26 }, // 菜单侧栏选中的path
|
||||
{ wch: 20 }, // 其它路由元信息
|
||||
{ wch: 20 }, // css样式
|
||||
{ wch: 10 }, // 是否推荐
|
||||
{ wch: 10 }, // 排序
|
||||
{ wch: 20 }, // 备注
|
||||
{ wch: 10 } // 状态
|
||||
];
|
||||
|
||||
message.destroy();
|
||||
message.loading('正在生成Excel文件...', 0);
|
||||
|
||||
setTimeout(() => {
|
||||
writeFile(
|
||||
workbook,
|
||||
`${sheetName}.xlsx`
|
||||
);
|
||||
writeFile(workbook, `${sheetName}.xlsx`);
|
||||
loading.value = false;
|
||||
message.destroy();
|
||||
message.success(`成功导出 ${list.length} 条记录`);
|
||||
}, 1000);
|
||||
})
|
||||
.catch((msg) => {
|
||||
message.error(msg);
|
||||
});
|
||||
};
|
||||
</script>
|
||||
} catch (e: any) {
|
||||
loading.value = false;
|
||||
message.destroy();
|
||||
message.error(e.message || '导出失败,请重试');
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user