67 lines
1.9 KiB
Vue
Raw Normal View History

2022-11-04 16:43:11 +08:00
<template>
<ContentWrap>
<!-- 列表 -->
2023-01-03 11:21:27 +08:00
<XTable @register="registerTable">
2022-11-04 16:43:11 +08:00
<template #toolbar_buttons>
2022-11-16 09:52:23 +08:00
<!-- 操作新增 -->
2022-11-04 18:01:46 +08:00
<XButton
2022-11-04 18:19:11 +08:00
type="primary"
2022-11-04 18:01:46 +08:00
preIcon="ep:zoom-in"
2022-11-04 18:19:11 +08:00
:title="t('action.add')"
2022-11-04 18:01:46 +08:00
v-hasPermi="['system:post:create']"
2023-02-01 16:45:37 +08:00
@click="openModal('create')"
2022-11-04 18:01:46 +08:00
/>
2022-11-16 09:52:23 +08:00
<!-- 操作导出 -->
2022-11-13 13:16:11 +08:00
<XButton
2022-11-13 15:13:38 +08:00
type="warning"
2022-11-13 13:16:11 +08:00
preIcon="ep:download"
:title="t('action.export')"
v-hasPermi="['system:post:export']"
2023-01-04 16:33:51 +08:00
@click="exportList('岗位列表.xls')"
2022-11-13 13:16:11 +08:00
/>
2022-11-04 16:43:11 +08:00
</template>
2022-11-12 15:52:43 +08:00
<template #actionbtns_default="{ row }">
<!-- 操作修改 -->
2022-11-09 16:31:37 +08:00
<XTextButton
2022-11-04 18:01:46 +08:00
preIcon="ep:edit"
2022-11-04 16:43:11 +08:00
v-hasPermi="['system:post:update']"
2023-02-01 16:45:37 +08:00
@click="openModal('update', row.id)"
2022-11-04 18:01:46 +08:00
/>
<!-- 操作详情 -->
2022-11-09 16:31:37 +08:00
<XTextButton
2022-11-04 18:01:46 +08:00
preIcon="ep:view"
2022-11-16 10:07:24 +08:00
v-hasPermi="['system:post:query']"
2023-02-01 16:45:37 +08:00
@click="openModal('detail', row.id)"
2022-11-04 18:01:46 +08:00
/>
<!-- 操作删除 -->
2022-11-09 16:31:37 +08:00
<XTextButton
2022-11-04 18:01:46 +08:00
preIcon="ep:delete"
2022-11-04 16:43:11 +08:00
v-hasPermi="['system:post:delete']"
2023-01-04 16:33:51 +08:00
@click="deleteData(row.id)"
2022-11-04 18:01:46 +08:00
/>
2022-11-04 16:43:11 +08:00
</template>
2023-01-03 11:21:27 +08:00
</XTable>
2022-11-04 16:43:11 +08:00
</ContentWrap>
2023-02-02 10:55:24 +08:00
<PostForm ref="modalRef" @success="reload()" />
2022-11-04 16:43:11 +08:00
</template>
2022-11-23 22:26:25 +08:00
<script setup lang="ts" name="Post">
// 业务相关的 import
import * as PostApi from '@/api/system/post'
2023-02-01 16:45:37 +08:00
import { allSchemas } from './post.data'
2023-02-02 10:55:24 +08:00
import PostForm from './PostForm.vue'
2022-07-18 19:06:37 +08:00
2022-11-01 14:36:18 +08:00
const { t } = useI18n() // 国际化
2023-02-01 16:45:37 +08:00
const modalRef = ref()
// 列表相关的变量
2023-01-03 11:21:27 +08:00
const [registerTable, { reload, deleteData, exportList }] = useXTable({
allSchemas: allSchemas,
getListApi: PostApi.getPostPageApi,
2022-11-16 10:28:28 +08:00
deleteApi: PostApi.deletePostApi,
2022-11-15 14:51:39 +08:00
exportListApi: PostApi.exportPostApi
})
2022-07-18 19:06:37 +08:00
2023-02-01 16:45:37 +08:00
const openModal = (type: string, rowId?: number) => {
modalRef.value.openModal(type, rowId)
2022-11-12 23:33:29 +08:00
}
2022-07-18 19:06:37 +08:00
</script>