| | |
| | | <script setup> |
| | | import { getCurrentInstance, ref, computed, reactive, onMounted } from 'vue'; |
| | | import { get, post } from '@/utils/request.js' |
| | | import { get, post, postBlob } from '@/utils/request.js' |
| | | import * as Icons from "@ant-design/icons-vue"; |
| | | import EditView from './edit.vue' |
| | | import { message, Modal } from 'ant-design-vue'; |
| | |
| | | |
| | | const searchInput = ref("") |
| | | const editChild = ref(null) |
| | | |
| | | const state = reactive({ |
| | | selectedRowKeys: [], |
| | | loading: false, |
| | | }); |
| | | |
| | | let tableData = ref([]); |
| | | getPage(); |
| | |
| | | }, |
| | | }; |
| | | |
| | | const state = reactive({ |
| | | selectedRowKeys: [], |
| | | loading: false, |
| | | }); |
| | | const hasSelected = computed(() => state.selectedRowKeys.length > 0); |
| | | const start = () => { |
| | | state.loading = true; |
| | |
| | | }; |
| | | |
| | | function getPage() { |
| | | state.loading = true; |
| | | post('/api/menu/tree', {}).then((result) => { |
| | | if (result.data.code == 200) { |
| | | let data = result.data.data; |
| | |
| | | name: '根目录', |
| | | children: data |
| | | }]; |
| | | |
| | | state.loading = false; |
| | | } else if (result.code === 401) { |
| | | message.error(result.msg); |
| | | logout() |
| | |
| | | } |
| | | |
| | | const handleExport = async (intl) => { |
| | | post('/api/menu/export', {}).then(result => { |
| | | postBlob('/api/menu/export', {}).then(result => { |
| | | const blob = new Blob([result.data], { type: 'application/vnd.ms-excel' }); |
| | | window.location.href = window.URL.createObjectURL(blob); |
| | | return true; |
| | |
| | | </div> |
| | | </div> |
| | | <a-table :row-selection="{ selectedRowKeys: state.selectedRowKeys, onChange: onSelectChange }" |
| | | :data-source="tableData" :defaultExpandAllRows="false" key="menu" rowKey="id"> |
| | | :data-source="tableData" :defaultExpandAllRows="false" key="menu" rowKey="id" :loading="state.loading" :scroll="{ y: 780 }"> |
| | | <a-table-column :title="formatMessage('db.sys_menu.name', '菜单名称')" key="name" data-index="name" /> |
| | | <a-table-column :title="formatMessage('db.sys_menu.route', '路由地址')" key="route" data-index="route" /> |
| | | <a-table-column :title="formatMessage('db.sys_menu.type', '类型')" key="type" data-index="type$"> |
| | |
| | | <component :is="components[ref(record.icon).value]" /> |
| | | </template> |
| | | </a-table-column> |
| | | <a-table-column :title="formatMessage('db.sys_menu.language_id', '国际化ID')" key="languageId" data-index="languageId" /> |
| | | <a-table-column :title="formatMessage('db.sys_menu.language_id', '国际化ID')" key="languageId" |
| | | data-index="languageId" /> |
| | | <a-table-column :title="formatMessage('db.sys_menu.sort', '排序')" key="sort" data-index="sort" /> |
| | | <a-table-column :title="formatMessage('db.sys_menu.status', '状态')" key="status$" data-index="status$" /> |
| | | <a-table-column :title="formatMessage('db.sys_menu.update_time', '修改时间')" key="updateTime$" data-index="updateTime$" /> |
| | | <a-table-column :title="formatMessage('db.sys_menu.update_time', '修改时间')" key="updateTime$" |
| | | data-index="updateTime$" /> |
| | | <a-table-column :title="formatMessage('common.operation', '操作')" key="oper" data-index="oper"> |
| | | <template #default="{ record }"> |
| | | <div style="display: flex;justify-content: space-evenly;"> |