| | |
| | | <script setup lang="tsx"> |
| | | import type { DataTableColumns } from 'naive-ui' |
| | | import { useBoolean } from '@/hooks' |
| | | import { copyFence, exportFenceExcel, getFenceList } from '@/service/api/operations' |
| | | import { copyFence, getFenceList } from '@/service/api/operations' |
| | | import { NButton, NSpace, NTag, NTooltip } from 'naive-ui' |
| | | import SearchPanel from '@/components/custom/SearchPanel.vue' |
| | | import OperationLogModal from '@/components/custom/OperationLogModal.vue' |
| | | import { downloadFile } from '@/utils/common' |
| | | import { useRouter } from 'vue-router' |
| | | import sortDefault from '@/assets/geofence/sort1.png' |
| | | import sortAsc from '@/assets/geofence/sort2.png' |
| | |
| | | } |
| | | |
| | | const columns = computed<DataTableColumns<any>>(() => [ |
| | | { |
| | | type: 'selection', |
| | | width: 48, |
| | | align: 'center', |
| | | fixed: 'left', |
| | | }, |
| | | { |
| | | title: '围栏ID', |
| | | key: 'electronicNumber', |
| | |
| | | |
| | | const highlightedRowId = ref<string | null>(null) |
| | | const showOperationLogModal = ref(false) |
| | | const checkedRowKeys = ref<Array<string | number>>([]) |
| | | |
| | | function handleCheck(rowKeys: Array<string | number>) { |
| | | checkedRowKeys.value = rowKeys |
| | | } |
| | | |
| | | async function handleBatchExport() { |
| | | if (checkedRowKeys.value.length === 0) { |
| | | message.warning('请先选择记录') |
| | | return |
| | | } |
| | | try { |
| | | const res = await exportFenceExcel({ electronicIds: checkedRowKeys.value }) |
| | | if (res instanceof Blob) { |
| | | downloadFile(res, `RT运营管理系统-{围栏列表}_${dayjs().format('YYYY-MM-DD')}.xls`) |
| | | message.success('导出成功') |
| | | } |
| | | else { |
| | | message.error('导出失败') |
| | | } |
| | | } |
| | | catch { |
| | | message.error('导出失败') |
| | | } |
| | | } |
| | | |
| | | // 高亮指定行 |
| | | function highlightRow(id: string) { |
| | |
| | | |
| | | <n-card class="flex-1 robotaxi-table-card"> |
| | | <template #header> |
| | | <n-flex justify="space-between" align="center"> |
| | | <n-flex align="center"> |
| | | <NButton v-permission="4021" @click="handleOpenOperationLog"> |
| | | 操作日志 |
| | | </NButton> |
| | | <span v-if="checkedRowKeys.length > 0" style="color: rgba(23, 31, 38, 0.6);font-weight: 400;">已选择{{ checkedRowKeys.length }}条记录</span> |
| | | <NButton :disabled="checkedRowKeys.length === 0" @click="handleBatchExport"> |
| | | 批量导出 |
| | | </NButton> |
| | | </n-flex> |
| | | <n-flex justify="space-between"> |
| | | <NButton v-permission="4021" @click="handleOpenOperationLog"> |
| | | 操作日志 |
| | | </NButton> |
| | | <n-flex v-permission="404" justify="flex-end"> |
| | | <NButton type="primary" secondary @click="handleToDetail({}, 'add')"> |
| | | 新建围栏 |
| | |
| | | <div class="flex-1 flex flex-col h-full"> |
| | | <n-data-table |
| | | class="flex-1" :columns="columns" :data="listData" :row-class-name="getRowClass" |
| | | :loading="loading" flex-height :scroll-x="1278" :bordered="false" :header-height="18" :row-height="18" |
| | | :row-key="(row) => row.id" |
| | | :loading="loading" flex-height :scroll-x="1230" :bordered="false" :header-height="18" :row-height="18" |
| | | @update:sorter="handleSorterChange" |
| | | @update:checked-row-keys="handleCheck" |
| | | > |
| | | <template #empty> |
| | | <div class="flex-center"> |