|
@@ -2,19 +2,29 @@
|
|
|
<PageWrapper dense contentFullHeight fixedHeight contentClass="flex">
|
|
|
<BasicTable @register="registerTable">
|
|
|
<template #toolbar>
|
|
|
- <a-button type="primary" @click="handleEdit({}, false)">新增</a-button>
|
|
|
+ <a-button type="primary" @click="handleEdit({}, false)" v-auth="'00014:add'">
|
|
|
+ 新增
|
|
|
+ </a-button>
|
|
|
+ <ExportTool
|
|
|
+ v-auth="'00014:export'"
|
|
|
+ ref="exportToolRef"
|
|
|
+ type="class"
|
|
|
+ @click="handelExportClick"
|
|
|
+ />
|
|
|
</template>
|
|
|
<template #action="{ record }">
|
|
|
- <div style="display: flex; justify-content: center;">
|
|
|
+ <div style="display: flex; justify-content: center">
|
|
|
<TableAction
|
|
|
:actions="[
|
|
|
{
|
|
|
label: '编辑',
|
|
|
+ auth: '00014:edit',
|
|
|
onClick: handleEdit.bind(null, record, true),
|
|
|
},
|
|
|
{
|
|
|
label: '删除',
|
|
|
color: 'error',
|
|
|
+ auth: '00014:delete',
|
|
|
onClick: handleDelete.bind(null, record),
|
|
|
},
|
|
|
]"
|
|
@@ -27,7 +37,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
- import { onMounted } from 'vue';
|
|
|
+ import { onMounted, ref } from 'vue';
|
|
|
import { PageWrapper } from '/@/components/Page';
|
|
|
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
|
|
import { tableColumns, searchFormSchema } from './data.config';
|
|
@@ -35,10 +45,13 @@
|
|
|
import { useModal } from '/@/components/Modal';
|
|
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
import FormEdit from './edit.vue';
|
|
|
+ import ExportTool from '/@/views/export/template/components/tool.vue';
|
|
|
+
|
|
|
+ const exportToolRef = ref<ElRef>(null);
|
|
|
|
|
|
const [registerModal, { openModal }] = useModal();
|
|
|
|
|
|
- const [registerTable, { reload }] = useTable({
|
|
|
+ const [registerTable, { reload, getForm, getSelectRowKeys }] = useTable({
|
|
|
api: getBaseClassPage,
|
|
|
title: '班级列表',
|
|
|
rowKey: 'id',
|
|
@@ -59,6 +72,9 @@
|
|
|
slots: { customRender: 'action' },
|
|
|
fixed: 'right',
|
|
|
},
|
|
|
+ rowSelection: {
|
|
|
+ type: 'checkbox',
|
|
|
+ },
|
|
|
});
|
|
|
const { createConfirm, createMessage } = useMessage();
|
|
|
|
|
@@ -95,6 +111,28 @@
|
|
|
};
|
|
|
|
|
|
onMounted(async () => {});
|
|
|
+
|
|
|
+ const handelExportClick = (type) => {
|
|
|
+ const data: Recordable = {
|
|
|
+ conditions: [],
|
|
|
+ ids: [],
|
|
|
+ };
|
|
|
+ if (type === 'all') {
|
|
|
+ const formData = getForm().getFieldsValue();
|
|
|
+ for (const key in formData) {
|
|
|
+ data.conditions.push({ keyName: key, keyValue: formData[key], keyType: '1' });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ const selectKeys = getSelectRowKeys();
|
|
|
+ if (selectKeys.length === 0) {
|
|
|
+ createMessage.warning('请选择需要导入的数据');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ data.ids = selectKeys;
|
|
|
+ }
|
|
|
+
|
|
|
+ exportToolRef.value?.open(data);
|
|
|
+ };
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="less"></style>
|