index.vue
2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<template>
<div >
<BasicTable style="flex: auto" @register="registerTable">
<template #toolbar>
<Authority value="api:yt:equip:post">
<Button type="primary" @click="handleCreate">
{{ t('spare.equip.createCategoryText') }}
</Button>
</Authority>
</template>
<template #action="{ record }">
<TableAction
:actions="[
{
label: t('common.detailText'),
icon: 'ant-design:eye-outlined',
auth: 'api:yt:equip:get',
onClick: handleDetail.bind(null, record),
},
{
label: t('common.editText'),
auth: 'api:yt:equip:update',
icon: 'clarity:note-edit-line',
onClick: handleEdit.bind(null, record),
},
{
label: t('common.delText'),
auth: 'api:yt:equip:delete',
icon: 'ant-design:delete-outlined',
color: 'error',
popConfirm: {
title: t('common.deleteConfirmText'),
confirm: handleDelete.bind(null, record),
},
},
]"
/>
</template>
</BasicTable>
<EquipModal @register="registerModal" />
</div>
</template>
<script setup lang="ts">
import {BasicTable, TableAction, useTable} from "/@/components/Table";
import {getPlanList} from "/@/api/equipment/chenkPlan";
import {columns, searchFormSchema} from "/@/views/spare/equip/index";
import {useI18n} from "/@/hooks/web/useI18n";
import {Button} from "ant-design-vue";
import {Authority} from "/@/components/Authority";
import {useModal} from "/@/components/Modal";
import { EquipModal } from './components/index'
const [registerModal, { openModal }] = useModal();
const { t } = useI18n();
const [
registerTable,
{ reload, setLoading, setSelectedRowKeys },
] = useTable({
title: t('spare.equip.listText'),
api: getPlanList,
columns,
formConfig: {
labelWidth: 100,
schemas: searchFormSchema,
},
immediate: true,
useSearchForm: true,
showTableSetting: true,
bordered: true,
showIndexColumn: false,
clickToRowSelect: false,
rowKey: 'id',
actionColumn: {
width: 230,
title: t('common.actionText'),
slots: { customRender: 'action' },
fixed: 'right',
},
});
// 新增
const handleCreate = () => {
openModal(true, {
isUpdate: false,
});
};
</script>