123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- <template>
- <el-dialog
- v-model="dialogFormVisible"
- title="导入记录"
- width="850px"
- @close="close"
- >
- <el-table
- ref="table"
- v-loading="listLoading"
- border
- :data="list"
- @selection-change="setSelectRows"
- @sort-change="onSortChange"
- >
- <el-table-column
- align="center"
- fixed="left"
- label="序号"
- type="index"
- width="55"
- />
- <el-table-column
- align="center"
- label="任务名称"
- min-width="200"
- prop="name"
- show-overflow-tooltip
- />
- <el-table-column
- align="center"
- label="操作时间"
- min-width="200"
- prop="created_at"
- show-overflow-tooltip
- />
- <el-table-column
- align="center"
- label="失败原因"
- min-width="100"
- prop="message"
- show-overflow-tooltip
- />
- <el-table-column
- align="center"
- label="执行结果"
- min-width="200"
- prop="result"
- show-overflow-tooltip
- />
- <el-table-column
- align="center"
- label="操作人员"
- min-width="100"
- prop="result"
- show-overflow-tooltip
- >
- <template #default="{ row }">
- {{ row.admin?.name }}
- </template>
- </el-table-column>
- <template #empty>
- <el-empty class="vab-data-empty" description="暂无数据" />
- </template>
- </el-table>
- <el-pagination
- background
- :current-page="queryForm.page"
- :layout="layout"
- :page-size="queryForm.per_page"
- :total="total"
- @current-change="handleCurrentChange"
- @size-change="handleSizeChange"
- />
- <template #footer>
- <el-button type="primary" @click="close">取 消</el-button>
- </template>
- </el-dialog>
- </template>
- <script>
- import { useUserStore } from '@/store/modules/user'
- import { getApi } from '@/api/api'
- export default defineComponent({
- name: 'RoleManagementEdit',
- emits: ['fetch-data'],
- setup(props, { emit }) {
- const state = reactive({
- formRef: null,
- title: '',
- list: [],
- listLoading: true,
- layout: 'total, sizes, prev, pager, next, jumper',
- total: 0,
- queryForm: {
- page: 1,
- per_page: 10,
- type: 'App\\\\Repositories\\\\Models\\\\Base\\\\Admin',
- },
- dialogFormVisible: false,
- })
- const showEdit = (type) => {
- state.queryForm.type = type
- getList()
- state.listLoading = false
- state.dialogFormVisible = true
- }
- const close = () => {
- state.dialogFormVisible = false
- }
- const userStore = useUserStore()
- const getList = async () => {
- state.queryForm.admin_id = userStore.id
- const {
- data: { data, meta },
- } = await getApi('/base/tasks', state.queryForm)
- state.list = data
- state.total = meta.pagination.total
- console.log('上传任务', data)
- }
- //切换当前页数据条数
- const handleSizeChange = (val) => {
- state.queryForm.per_page = val
- getList()
- }
- //切换页码
- const handleCurrentChange = (val) => {
- state.queryForm.page = val
- getList()
- }
- onMounted(() => {})
- return {
- ...toRefs(state),
- showEdit,
- getList,
- close,
- handleCurrentChange,
- handleSizeChange,
- }
- },
- })
- </script>
- <style lang="scss" scoped>
- .body {
- margin-bottom: 30px;
- }
- .title {
- font-size: 16px;
- font-weight: 550;
- color: #333333;
- margin-bottom: 10px;
- }
- .item {
- display: flex;
- padding: 7px 0;
- }
- .item-left {
- min-width: 100px;
- }
- </style>
|