feat(payment): 添加统一下单接口并修复类型引用
- 添加 create 和 createWithOrder 两个统一下单接口 - 将 Order 类型替换为 ShopOrder 类型 - 修复 getNativeCode 函数的参数类型引用 - 修复 importArticles 导入语句的格式问题 feat(navigation): 实现导航管理导入导出功能 - 添加导航导入弹窗组件 Import.vue - 实现导航数据导出功能,支持按搜索结果导出 - 优化导出数据的列宽设置 - 添加导出加载状态和错误处理 - 修复组件格式化问题 refactor(led): 重构LED显示页面实现自动轮播 - 重命名组件名称为 LedIndex - 添加两个表格实例引用用于独立控制 - 实现页面自动轮播功能,设置10秒间隔 - 隐藏表格分页组件 - 优化页面加载和卸载逻辑 style(components): 统一组件代码格式化 - 修复多个组件中的格式化问题 - 统一 import 语句的格式 - 修复组件标签闭合问题 - 优化代码缩进和换行 chore(env): 更新开发环境配置注释 - 注释掉 VITE_API_URL 配置项 - 保持其他环境配置不变
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
VITE_APP_NAME=后台管理(开发环境)
|
||||
VITE_API_URL=http://127.0.0.1:9200/api
|
||||
#VITE_API_URL=http://127.0.0.1:9200/api
|
||||
#VITE_SERVER_API_URL=http://127.0.0.1:8000/api
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { Payment, PaymentParam } from './model';
|
||||
import { SERVER_API_URL } from '@/config/setting';
|
||||
import type { Order } from '@/api/shop/order/model';
|
||||
import type { ShopOrder } from '@/api/shop/shopOrder/model';
|
||||
|
||||
/**
|
||||
* 分页查询支付方式
|
||||
@@ -50,6 +50,34 @@ export async function addPayment(data: Payment) {
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一下单订单接口
|
||||
*/
|
||||
export async function create(data: Payment) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/payment/create',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一下单订单接口(包含订单信息)
|
||||
*/
|
||||
export async function createWithOrder(data: Payment) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/payment/create-with-order',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改支付方式
|
||||
*/
|
||||
@@ -109,7 +137,7 @@ export async function getPayment(id: number) {
|
||||
/**
|
||||
* 生成支付二维码(微信native)
|
||||
*/
|
||||
export async function getNativeCode(data: Order) {
|
||||
export async function getNativeCode(data: ShopOrder) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/wx-native-pay/codeUrl',
|
||||
data
|
||||
|
||||
@@ -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;
|
||||
|
||||
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,66 +52,72 @@
|
||||
/>
|
||||
</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(
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的角色
|
||||
selection?: [];
|
||||
}>(),
|
||||
{}
|
||||
);
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: GradeParam): void;
|
||||
(e: 'add'): void;
|
||||
}>();
|
||||
}>();
|
||||
|
||||
watch(
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {
|
||||
}
|
||||
);
|
||||
() => {}
|
||||
);
|
||||
|
||||
// 表单数据
|
||||
const where = ref({
|
||||
// 表单数据
|
||||
const where = ref({
|
||||
keywords: '',
|
||||
model: '',
|
||||
position: 0
|
||||
});
|
||||
});
|
||||
|
||||
const position = ref(0);
|
||||
const position = ref(0);
|
||||
|
||||
const reload = () => {
|
||||
const reload = () => {
|
||||
// 更新搜索关键词
|
||||
where.value.keywords = searchText.value;
|
||||
emit('search', where.value);
|
||||
};
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openImport = () => {
|
||||
/* 打开编辑弹窗 */
|
||||
const openImport = () => {
|
||||
showImport.value = true;
|
||||
};
|
||||
};
|
||||
|
||||
// 导出
|
||||
const handleExport = async () => {
|
||||
// 导出
|
||||
const handleExport = async () => {
|
||||
if (loading.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
loading.value = true;
|
||||
const array: (string | number)[][] = [
|
||||
[
|
||||
'上级id',
|
||||
@@ -131,9 +147,19 @@ const handleExport = async () => {
|
||||
];
|
||||
|
||||
// 按搜索结果导出
|
||||
await listCmsNavigation(where.value)
|
||||
.then((list) => {
|
||||
list?.forEach((d) => {
|
||||
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);
|
||||
});
|
||||
};
|
||||
} catch (e: any) {
|
||||
loading.value = false;
|
||||
message.destroy();
|
||||
message.error(e.message || '导出失败,请重试');
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -4,61 +4,60 @@
|
||||
<div class="text-4xl font-bold">广西医科大学第一附属医院</div>
|
||||
<div class="text-2xl my-5">门诊医生一周内停替诊公布</div>
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
ref="stopTableRef"
|
||||
row-key="id"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
:customRow="customRow"
|
||||
:toolkit="[]"
|
||||
:toolbar="false"
|
||||
:page-size="pageSize"
|
||||
tool-class="ele-toolbar-form"
|
||||
class="sys-org-table"
|
||||
class="sys-org-table led-table"
|
||||
@done="onStopDone"
|
||||
/>
|
||||
<div class="text-2xl my-5">门诊医生当天剩余号源公布</div>
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
ref="numberTableRef"
|
||||
row-key="id"
|
||||
:columns="columns2"
|
||||
:datasource="datasource2"
|
||||
:customRow="customRow"
|
||||
:toolkit="[]"
|
||||
:toolbar="false"
|
||||
:page-size="pageSize"
|
||||
tool-class="ele-toolbar-form"
|
||||
class="sys-org-table"
|
||||
class="sys-org-table led-table"
|
||||
@done="onNumberDone"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { createVNode, ref } from 'vue';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
import { onBeforeUnmount, onMounted, ref } from 'vue';
|
||||
import type { EleProTable } from 'ele-admin-pro';
|
||||
import { toTreeData } from 'ele-admin-pro';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import type {
|
||||
DatasourceFunction,
|
||||
ColumnItem
|
||||
ColumnItem,
|
||||
EleProTableDone
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import { pageCmsAd, removeCmsAd, removeBatchCmsAd } from '@/api/cms/cmsAd';
|
||||
import type { CmsAd, CmsAdParam } from '@/api/cms/cmsAd/model';
|
||||
import { CmsNavigation } from '@/api/cms/cmsNavigation/model';
|
||||
import { listCmsNavigation } from '@/api/cms/cmsNavigation';
|
||||
import { numberReplace, stopReplace } from '@/api/led';
|
||||
|
||||
const pageSize = 10;
|
||||
const rotateIntervalMs = 10000;
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
// 国际化
|
||||
const { locale } = useI18n();
|
||||
// 表格选中数据
|
||||
const selection = ref<CmsAd[]>([]);
|
||||
// 当前编辑数据
|
||||
const current = ref<CmsAd | null>(null);
|
||||
// 是否显示编辑弹窗
|
||||
const showEdit = ref(false);
|
||||
// 是否显示批量移动弹窗
|
||||
const showMove = ref(false);
|
||||
// 栏目数据
|
||||
const navigationList = ref<CmsNavigation[]>();
|
||||
// 加载状态
|
||||
const loading = ref(true);
|
||||
const stopTableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
const numberTableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
const stopPageCount = ref(1);
|
||||
const numberPageCount = ref(1);
|
||||
const stopCurrPage = ref(1);
|
||||
const numberCurrPage = ref(1);
|
||||
|
||||
let stopTimer: number | undefined;
|
||||
let numberTimer: number | undefined;
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
|
||||
@@ -191,107 +190,70 @@
|
||||
});
|
||||
};
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: CmsAdParam) => {
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where: where });
|
||||
const onStopDone: EleProTableDone<any> = (_res, curr, count) => {
|
||||
stopCurrPage.value = curr;
|
||||
stopPageCount.value = count || 1;
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: CmsAd) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
const onNumberDone: EleProTableDone<any> = (_res, curr, count) => {
|
||||
numberCurrPage.value = curr;
|
||||
numberPageCount.value = count || 1;
|
||||
};
|
||||
|
||||
/* 打开批量移动弹窗 */
|
||||
const openMove = () => {
|
||||
showMove.value = true;
|
||||
const nextStopPage = () => {
|
||||
if (stopPageCount.value <= 1) return;
|
||||
stopCurrPage.value =
|
||||
stopCurrPage.value >= stopPageCount.value ? 1 : stopCurrPage.value + 1;
|
||||
stopTableRef.value?.reload({ page: stopCurrPage.value, limit: pageSize });
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: CmsAd) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeCmsAd(row.adId)
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
const nextNumberPage = () => {
|
||||
if (numberPageCount.value <= 1) return;
|
||||
numberCurrPage.value =
|
||||
numberCurrPage.value >= numberPageCount.value
|
||||
? 1
|
||||
: numberCurrPage.value + 1;
|
||||
numberTableRef.value?.reload({
|
||||
page: numberCurrPage.value,
|
||||
limit: pageSize
|
||||
});
|
||||
};
|
||||
|
||||
/* 批量删除 */
|
||||
const removeBatch = () => {
|
||||
if (!selection.value.length) {
|
||||
message.error('请至少选择一条数据');
|
||||
return;
|
||||
}
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
content: '确定要删除选中的记录吗?',
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
maskClosable: true,
|
||||
onOk: () => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeBatchCmsAd(selection.value.map((d) => d.adId))
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/* 查询 */
|
||||
const query = () => {
|
||||
loading.value = true;
|
||||
// 加载栏目数据
|
||||
if (!navigationList.value) {
|
||||
listCmsNavigation({}).then((res) => {
|
||||
navigationList.value = toTreeData({
|
||||
data: res?.map((d) => {
|
||||
d.value = d.navigationId;
|
||||
d.label = d.title;
|
||||
if (!d.component) {
|
||||
d.disabled = true;
|
||||
}
|
||||
return d;
|
||||
}),
|
||||
idField: 'navigationId',
|
||||
parentIdField: 'parentId'
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/* 自定义行属性 */
|
||||
const customRow = (record: CmsAd) => {
|
||||
const customRow = (_record: any) => {
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
// console.log(record);
|
||||
//
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
// openEdit(record);
|
||||
//
|
||||
}
|
||||
};
|
||||
};
|
||||
query();
|
||||
|
||||
onMounted(() => {
|
||||
stopTimer = window.setInterval(nextStopPage, rotateIntervalMs);
|
||||
numberTimer = window.setInterval(nextNumberPage, rotateIntervalMs);
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
if (stopTimer) window.clearInterval(stopTimer);
|
||||
if (numberTimer) window.clearInterval(numberTimer);
|
||||
});
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'CmsAd'
|
||||
name: 'LedIndex'
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
<style lang="less" scoped>
|
||||
.led-table {
|
||||
:deep(.ant-pagination) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -14,59 +14,59 @@
|
||||
</a-space>
|
||||
|
||||
<!-- 导入弹窗 -->
|
||||
<import v-model:visible="showImport" @done="reload"/>
|
||||
<import v-model:visible="showImport" @done="reload" />
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { utils, writeFile } from 'xlsx';
|
||||
import { listMenus } from '@/api/system/menu';
|
||||
import type { Menu, MenuParam } from '@/api/system/menu/model';
|
||||
import useSearch from '@/utils/use-search';
|
||||
import Import from "./Import.vue";
|
||||
import {getTenantId} from "@/utils/domain";
|
||||
import { ref } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { utils, writeFile } from 'xlsx';
|
||||
import { listMenus } from '@/api/system/menu';
|
||||
import type { Menu, MenuParam } from '@/api/system/menu/model';
|
||||
import useSearch from '@/utils/use-search';
|
||||
import Import from './Import.vue';
|
||||
import { getTenantId } from '@/utils/domain';
|
||||
|
||||
// 定义包含关键词的参数类型
|
||||
interface MenuSearchParam extends MenuParam {
|
||||
// 定义包含关键词的参数类型
|
||||
interface MenuSearchParam extends MenuParam {
|
||||
keywords?: string;
|
||||
}
|
||||
}
|
||||
|
||||
const props = withDefaults(
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的数据
|
||||
selection?: Menu[];
|
||||
}>(),
|
||||
{}
|
||||
);
|
||||
);
|
||||
|
||||
// 请求状态
|
||||
const loading = ref(false);
|
||||
const menuList = ref<Menu[]>([]);
|
||||
// 是否显示导入弹窗
|
||||
const showImport = ref(false);
|
||||
// 请求状态
|
||||
const loading = ref(false);
|
||||
const menuList = ref<Menu[]>([]);
|
||||
// 是否显示导入弹窗
|
||||
const showImport = ref(false);
|
||||
|
||||
// 表单数据
|
||||
const { where, resetFields } = useSearch<MenuSearchParam>({
|
||||
// 表单数据
|
||||
const { where, resetFields } = useSearch<MenuSearchParam>({
|
||||
keywords: ''
|
||||
});
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: MenuSearchParam): void;
|
||||
(e: 'add'): void;
|
||||
}>();
|
||||
}>();
|
||||
|
||||
// 新增
|
||||
const add = () => {
|
||||
// 新增
|
||||
const add = () => {
|
||||
emit('add');
|
||||
};
|
||||
};
|
||||
|
||||
const reload = () => {
|
||||
const reload = () => {
|
||||
emit('search', where);
|
||||
};
|
||||
};
|
||||
|
||||
// 导出
|
||||
const handleExport = async () => {
|
||||
// 导出
|
||||
const handleExport = async () => {
|
||||
if (loading.value) {
|
||||
return;
|
||||
}
|
||||
@@ -153,22 +153,21 @@ const handleExport = async () => {
|
||||
message.destroy();
|
||||
message.success(`成功导出 ${list.length} 条记录`);
|
||||
}, 1000);
|
||||
|
||||
} catch (error: any) {
|
||||
loading.value = false;
|
||||
message.destroy();
|
||||
message.error(error.message || '导出失败,请重试');
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/* 打开导入弹窗 */
|
||||
const openImport = () => {
|
||||
/* 打开导入弹窗 */
|
||||
const openImport = () => {
|
||||
showImport.value = true;
|
||||
};
|
||||
};
|
||||
|
||||
/* 重置 */
|
||||
const reset = () => {
|
||||
/* 重置 */
|
||||
const reset = () => {
|
||||
resetFields();
|
||||
reload();
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user