表单优化

This commit is contained in:
Xubx 2025-03-04 14:32:56 +08:00
parent 34f7309717
commit 0e890d96c5
5 changed files with 411 additions and 363 deletions

View File

@ -5,27 +5,17 @@ import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
{
title: '用户id',
align: 'center',
dataIndex: 'userId',
},
{
title: '用户名',
title: '姓名',
align: 'center',
dataIndex: 'userName',
},
{
title: '专业id,0表示未选择',
title: '用户ID',
align: 'center',
dataIndex: 'majorId',
dataIndex: 'userId',
},
{
title: '用户专业id',
align: 'center',
dataIndex: 'userMajorId',
},
{
title: '用户专业id',
title: '工号',
align: 'center',
dataIndex: 'teacherId',
},
@ -35,20 +25,33 @@ export const columns: BasicColumn[] = [
dataIndex: 'phone',
},
{
title: '组id',
title: '学科',
align: 'center',
dataIndex: 'majorId',
},
{
title: '所属分组',
align: 'center',
dataIndex: 'groupId',
},
{
title: '使用次数',
align: 'center',
dataIndex: 'numberuse',
},
{
title: '状态',
title: '是否第一次阅卷',
align: 'center',
dataIndex: 'status',
},
//{
// title: '用户专业id',
// align: 'center',
// dataIndex: 'userMajorId',
//},
//{
// title: '使用次数',
// align: 'center',
// dataIndex: 'numberuse',
//},
];
//查询数据
export const searchFormSchema: FormSchema[] = [
@ -78,11 +81,11 @@ export const formSchema: FormSchema[] = [
},
},
{
label: '专业id,0表示未选择',
label: '学科',
field: 'majorId',
component: 'InputNumber',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入专业id,0表示未选择!' }];
return [{ required: true, message: '请输入学科!' }];
},
},
{
@ -94,11 +97,11 @@ export const formSchema: FormSchema[] = [
},
},
{
label: '用户专业id',
label: '工号',
field: 'teacherId',
component: 'Input',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入用户专业id!' }];
return [{ required: true, message: '请输入工号!' }];
},
},
{
@ -110,11 +113,11 @@ export const formSchema: FormSchema[] = [
},
},
{
label: 'id',
label: '所属分组',
field: 'groupId',
component: 'InputNumber',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入id!' }];
return [{ required: true, message: '请输入所属分组!' }];
},
},
{
@ -126,17 +129,17 @@ export const formSchema: FormSchema[] = [
},
},
{
label: '状态',
label: '是否第一次阅卷',
field: 'status',
component: 'RadioGroup',
componentProps: {
options: [
{ label: '正常', value: 0 },
{ label: '禁用', value: 1 },
{ label: '', value: 0 },
{ label: '', value: 1 },
],
},
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请选择状态' }];
return [{ required: true, message: '请选择是否第一次阅卷' }];
},
},
// TODO 主键隐藏字段目前写死为ID
@ -152,11 +155,11 @@ export const formSchema: FormSchema[] = [
export const superQuerySchema = {
userId: { title: '用户id', order: 0, view: 'text', type: 'string' },
userName: { title: '用户名', order: 1, view: 'text', type: 'string' },
majorId: { title: '专业id,0表示未选择', order: 2, view: 'number', type: 'number' },
majorId: { title: '学科', order: 2, view: 'number', type: 'number' },
userMajorId: { title: '用户专业id', order: 3, view: 'text', type: 'string' },
teacherId: { title: '用户专业id', order: 4, view: 'text', type: 'string' },
phone: { title: '手机号', order: 5, view: 'text', type: 'string' },
groupId: { title: 'id', order: 6, view: 'number', type: 'number' },
groupId: { title: '所属分组', order: 6, view: 'number', type: 'number' },
numberuse: { title: '使用次数', order: 7, view: 'number', type: 'number' },
status: { title: '状态0正常 1禁用', order: 8, view: 'number', type: 'number' },
};

View File

@ -16,8 +16,7 @@
</a-menu-item>
</a-menu>
</template>
<a-button
>批量操作
<a-button>批量操作
<Icon icon="mdi:chevron-down" />
</a-button>
</a-dropdown>
@ -31,8 +30,8 @@
<!--字段回显插槽-->
<template #bodyCell="{ column, record, index, text }">
<span v-if="column.dataIndex === 'status'">
<a-tag v-if="record.status === 0" color="green">正常</a-tag>
<a-tag v-else-if="record.status !== 0" color="red">禁用</a-tag>
<a-tag v-if="record.status === 0" color="green"></a-tag>
<a-tag v-else-if="record.status !== 0" color="red"></a-tag>
</span>
</template>
</BasicTable>
@ -42,145 +41,145 @@
</template>
<script lang="ts" name="CEES-ceesLocalTeacher" setup>
import { ref, reactive, computed, unref } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import CeesLocalTeacherModal from './components/CeesLocalTeacherModal.vue';
import { columns, searchFormSchema, superQuerySchema } from './CeesLocalTeacher.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './CeesLocalTeacher.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import { useUserStore } from '/@/store/modules/user';
const queryParam = reactive<any>({});
const checkedKeys = ref<Array<string | number>>([]);
const userStore = useUserStore();
//model
const [registerModal, { openModal }] = useModal();
//table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
title: '本校教师表',
api: list,
columns,
canResize: false,
formConfig: {
//labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter: true,
showAdvancedButton: true,
fieldMapToNumber: [],
fieldMapToTime: [],
},
actionColumn: {
width: 120,
fixed: 'right',
},
beforeFetch: (params) => {
return Object.assign(params, queryParam);
},
import { ref, reactive, computed, unref } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import CeesLocalTeacherModal from './components/CeesLocalTeacherModal.vue';
import { columns, searchFormSchema, superQuerySchema } from './CeesLocalTeacher.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './CeesLocalTeacher.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import { useUserStore } from '/@/store/modules/user';
const queryParam = reactive<any>({});
const checkedKeys = ref<Array<string | number>>([]);
const userStore = useUserStore();
//model
const [registerModal, { openModal }] = useModal();
//table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
title: '本校教师表',
api: list,
columns,
canResize: false,
formConfig: {
//labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter: true,
showAdvancedButton: true,
fieldMapToNumber: [],
fieldMapToTime: [],
},
exportConfig: {
name: '本校教师表',
url: getExportUrl,
params: queryParam,
actionColumn: {
width: 120,
fixed: 'right',
},
importConfig: {
url: getImportUrl,
success: handleSuccess,
beforeFetch: (params) => {
return Object.assign(params, queryParam);
},
},
exportConfig: {
name: '本校教师表',
url: getExportUrl,
params: queryParam,
},
importConfig: {
url: getImportUrl,
success: handleSuccess,
},
});
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
//
const superQueryConfig = reactive(superQuerySchema);
/**
* 高级查询事件
*/
function handleSuperQuery(params) {
Object.keys(params).map((k) => {
queryParam[k] = params[k];
});
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
//
const superQueryConfig = reactive(superQuerySchema);
/**
* 高级查询事件
*/
function handleSuperQuery(params) {
Object.keys(params).map((k) => {
queryParam[k] = params[k];
});
reload();
}
/**
* 新增事件
*/
function handleAdd() {
openModal(true, {
isUpdate: false,
showFooter: true,
});
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: true,
});
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: false,
});
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({ id: record.id }, handleSuccess);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 操作栏
*/
function getTableAction(record) {
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
reload();
}
/**
* 新增事件
*/
function handleAdd() {
openModal(true, {
isUpdate: false,
showFooter: true,
});
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: true,
});
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: false,
});
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({ id: record.id }, handleSuccess);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 操作栏
*/
function getTableAction(record) {
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
},
];
}
/**
* 下拉操作栏
*/
function getDropDownAction(record) {
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
},
{
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
},
];
}
/**
* 下拉操作栏
*/
function getDropDownAction(record) {
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
},
{
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
},
},
];
}
},
];
}
</script>
<style scoped></style>

View File

@ -5,25 +5,30 @@ import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
{
title: '用户id',
title: '姓名',
align: 'center',
dataIndex: 'userName',
},
{
title: '用户ID',
align: 'center',
dataIndex: 'userId',
},
{
title: '专业id',
title: '年龄',
align: 'center',
dataIndex: 'age',
},
{
title: '性别',
align: 'center',
dataIndex: 'sex',
},
{
title: '学科',
align: 'center',
dataIndex: 'majorId',
},
{
title: '用户专业id',
align: 'center',
dataIndex: 'userMajorId',
},
{
title: '用户名',
align: 'center',
dataIndex: 'userName',
},
{
title: '手机号',
align: 'center',
@ -34,6 +39,27 @@ export const columns: BasicColumn[] = [
align: 'center',
dataIndex: 'jobTitle',
},
{
title: '职务',
align: 'center',
dataIndex: 'office',
},
{
title: '所属分组',
align: 'center',
dataIndex: 'groupId',
},
{
title: '住宿信息',
align: 'center',
dataIndex: 'dormitory',
},
{
title: '用户专业id',
align: 'center',
dataIndex: 'userMajorId',
},
{
title: '银行卡号',
align: 'center',
@ -44,11 +70,7 @@ export const columns: BasicColumn[] = [
align: 'center',
dataIndex: 'mealCard',
},
{
title: '办公位',
align: 'center',
dataIndex: 'office',
},
{
title: '工作名称',
align: 'center',
@ -69,26 +91,11 @@ export const columns: BasicColumn[] = [
align: 'center',
dataIndex: 'carNumber',
},
{
title: '性别',
align: 'center',
dataIndex: 'sex',
},
{
title: '年龄',
align: 'center',
dataIndex: 'age',
},
{
title: '车辆是否入校',
align: 'center',
dataIndex: 'carStatus',
},
{
title: '宿舍信息',
align: 'center',
dataIndex: 'dormitory',
},
{
title: '是否住宿',
align: 'center',
@ -104,11 +111,6 @@ export const columns: BasicColumn[] = [
align: 'center',
dataIndex: 'bankName',
},
{
title: '组id',
align: 'center',
dataIndex: 'groupId',
},
{
title: '使用次数',
align: 'center',
@ -123,13 +125,13 @@ export const columns: BasicColumn[] = [
//查询数据
export const searchFormSchema: FormSchema[] = [
{
label: '专业id',
label: '学科',
field: 'majorId',
component: 'JRangeNumber',
//colProps: {span: 6},
},
{
label: '用户名',
label: '名',
field: 'userName',
component: 'Input',
//colProps: {span: 6},
@ -138,15 +140,15 @@ export const searchFormSchema: FormSchema[] = [
//表单数据
export const formSchema: FormSchema[] = [
{
label: '用户id',
label: '用户ID',
field: 'userId',
component: 'Input',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入用户id!' }];
return [{ required: true, message: '请输入用户ID!' }];
},
},
{
label: '专业id',
label: '学科',
field: 'majorId',
component: 'InputNumber',
dynamicRules: ({ model, schema }) => {
@ -162,11 +164,11 @@ export const formSchema: FormSchema[] = [
},
},
{
label: '用户名',
label: '名',
field: 'userName',
component: 'Input',
dynamicRules: ({ model, schema }) => {
return [{ required: true, message: '请输入用户名!' }];
return [{ required: true, message: '请输入名!' }];
},
},
{
@ -202,7 +204,7 @@ export const formSchema: FormSchema[] = [
},
},
{
label: '办公位',
label: '职务',
field: 'office',
component: 'Input',
dynamicRules: ({ model, schema }) => {
@ -272,7 +274,7 @@ export const formSchema: FormSchema[] = [
},
},
{
label: '宿信息',
label: '宿信息',
field: 'dormitory',
component: 'Input',
dynamicRules: ({ model, schema }) => {
@ -310,7 +312,7 @@ export const formSchema: FormSchema[] = [
},
},
{
label: 'id',
label: '所属分组',
field: 'groupId',
component: 'InputNumber',
dynamicRules: ({ model, schema }) => {
@ -350,15 +352,15 @@ export const formSchema: FormSchema[] = [
// 高级查询数据
export const superQuerySchema = {
userId: { title: '用户id', order: 0, view: 'text', type: 'string' },
majorId: { title: '专业id', order: 1, view: 'number', type: 'number' },
userId: { title: '用户ID', order: 0, view: 'text', type: 'string' },
majorId: { title: '学科', order: 1, view: 'number', type: 'number' },
userMajorId: { title: '用户专业id', order: 2, view: 'text', type: 'string' },
userName: { title: '用户名', order: 3, view: 'text', type: 'string' },
userName: { title: '名', order: 3, view: 'text', type: 'string' },
phone: { title: '手机号', order: 4, view: 'text', type: 'string' },
jobTitle: { title: '职称', order: 5, view: 'text', type: 'string' },
pyCard: { title: '银行卡号', order: 6, view: 'text', type: 'string' },
mealCard: { title: '饭卡', order: 7, view: 'text', type: 'string' },
office: { title: '办公位', order: 8, view: 'text', type: 'string' },
office: { title: '职务', order: 8, view: 'text', type: 'string' },
workName: { title: '工作名称', order: 9, view: 'text', type: 'string' },
workPhone: { title: '固定电话', order: 10, view: 'text', type: 'string' },
identityId: { title: '身份证', order: 11, view: 'text', type: 'string' },
@ -366,11 +368,11 @@ export const superQuerySchema = {
sex: { title: '性别', order: 13, view: 'text', type: 'string' },
age: { title: '年龄', order: 14, view: 'number', type: 'number' },
carStatus: { title: '车辆是否入校', order: 15, view: 'number', type: 'number' },
dormitory: { title: '宿信息', order: 16, view: 'text', type: 'string' },
dormitory: { title: '宿信息', order: 16, view: 'text', type: 'string' },
dormitoryStatus: { title: '是否住宿', order: 17, view: 'text', type: 'string' },
bankAddress: { title: '开户所在地', order: 18, view: 'text', type: 'string' },
bankName: { title: '开户行', order: 19, view: 'text', type: 'string' },
groupId: { title: 'id', order: 20, view: 'number', type: 'number' },
groupId: { title: '所属分组', order: 20, view: 'number', type: 'number' },
numberuse: { title: '使用次数', order: 21, view: 'number', type: 'number' },
status: { title: '状态0已报道 1未报到', order: 22, view: 'number', type: 'number' },
};

View File

@ -1,7 +1,8 @@
<template>
<div>
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<BasicTable @register="registerTable" :rowSelection="rowSelection" :expanded-row-keys="expandedRowKeys"
:expandable="expandable" @expanded-rows-change="handleExpand">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
@ -16,14 +17,41 @@
</a-menu-item>
</a-menu>
</template>
<a-button
>批量操作
<a-button>批量操作
<Icon icon="mdi:chevron-down" />
</a-button>
</a-dropdown>
<!-- 高级查询 -->
<super-query :config="superQueryConfig" @search="handleSuperQuery" />
</template>
<template #expand="{ record }">
<a-descriptions bordered :column="2">
<a-descriptions-item label="身份证号">
{{ record.identityId }}
</a-descriptions-item>
<a-descriptions-item label="银行卡号">
{{ record.pyCard }}
</a-descriptions-item>
<a-descriptions-item label="工作单位">
{{ record.workName }}
</a-descriptions-item>
<a-descriptions-item label="开户所在地">
{{ record.bankAddress }}
</a-descriptions-item>
<a-descriptions-item label="单位电话">
{{ record.workPhone }}
</a-descriptions-item>
<a-descriptions-item label="开户行">
{{ record.bankName }}
</a-descriptions-item>
<a-descriptions-item label="车牌号">
{{ record.carNumber }}
</a-descriptions-item>
<a-descriptions-item label="饭卡号">
{{ record.mealCard }}
</a-descriptions-item>
</a-descriptions>
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
@ -54,145 +82,161 @@
</template>
<script lang="ts" name="cees-ceesWaiTeacher" setup>
import { ref, reactive, computed, unref } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import CeesWaiTeacherModal from './components/CeesWaiTeacherModal.vue';
import { columns, searchFormSchema, superQuerySchema } from './CeesWaiTeacher.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './CeesWaiTeacher.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import { useUserStore } from '/@/store/modules/user';
const queryParam = reactive<any>({});
const checkedKeys = ref<Array<string | number>>([]);
const userStore = useUserStore();
//model
const [registerModal, { openModal }] = useModal();
//table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
title: '外校老师管理',
api: list,
columns,
canResize: false,
formConfig: {
//labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter: true,
showAdvancedButton: true,
fieldMapToNumber: [['majorId', ['majorId_begin', 'majorId_end']]],
fieldMapToTime: [],
},
actionColumn: {
width: 120,
fixed: 'right',
},
beforeFetch: (params) => {
return Object.assign(params, queryParam);
},
import { ref, reactive, computed, unref } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import CeesWaiTeacherModal from './components/CeesWaiTeacherModal.vue';
import { columns, searchFormSchema, superQuerySchema } from './CeesWaiTeacher.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './CeesWaiTeacher.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import { useUserStore } from '/@/store/modules/user';
const queryParam = reactive<any>({});
const checkedKeys = ref<Array<string | number>>([]);
const userStore = useUserStore();
//model
const [registerModal, { openModal }] = useModal();
//table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
title: '外校老师管理',
api: list,
columns,
canResize: false,
formConfig: {
//labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter: true,
showAdvancedButton: true,
fieldMapToNumber: [['majorId', ['majorId_begin', 'majorId_end']]],
fieldMapToTime: [],
},
exportConfig: {
name: '外校老师管理',
url: getExportUrl,
params: queryParam,
actionColumn: {
width: 120,
fixed: 'right',
},
importConfig: {
url: getImportUrl,
success: handleSuccess,
beforeFetch: (params) => {
return Object.assign(params, queryParam);
},
},
exportConfig: {
name: '外校老师管理',
url: getExportUrl,
params: queryParam,
},
importConfig: {
url: getImportUrl,
success: handleSuccess,
},
});
//
const expandedRowKeys = ref<string[]>(["0"]);
const expandable = {
expandedRowKeys,
expandedRowRender: (record) => (
1111
),
};
//
const handleExpand = (expanded, record) => {
console.log(expanded, record, 'expand');
if (expanded) {
expandedRowKeys.value = [record.id]; //
} else {
expandedRowKeys.value = []; //
}
};
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
//
const superQueryConfig = reactive(superQuerySchema);
/**
* 高级查询事件
*/
function handleSuperQuery(params) {
Object.keys(params).map((k) => {
queryParam[k] = params[k];
});
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
//
const superQueryConfig = reactive(superQuerySchema);
/**
* 高级查询事件
*/
function handleSuperQuery(params) {
Object.keys(params).map((k) => {
queryParam[k] = params[k];
});
reload();
}
/**
* 新增事件
*/
function handleAdd() {
openModal(true, {
isUpdate: false,
showFooter: true,
});
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: true,
});
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: false,
});
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({ id: record.id }, handleSuccess);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 操作栏
*/
function getTableAction(record) {
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
reload();
}
/**
* 新增事件
*/
function handleAdd() {
openModal(true, {
isUpdate: false,
showFooter: true,
});
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: true,
});
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: false,
});
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({ id: record.id }, handleSuccess);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 操作栏
*/
function getTableAction(record) {
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
},
];
}
/**
* 下拉操作栏
*/
function getDropDownAction(record) {
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
},
{
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
},
];
}
/**
* 下拉操作栏
*/
function getDropDownAction(record) {
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
},
{
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
},
},
];
}
},
];
}
</script>
<style scoped></style>