|
|
@@ -1,66 +1,151 @@
|
|
|
+<!-- eslint-disable vue/multi-word-component-names -->
|
|
|
<template>
|
|
|
- <div id="map3dContainer"></div>
|
|
|
- <!-- 操作按钮面板 -->
|
|
|
- <div class="map-operation-panel">
|
|
|
- <button @click="drawerVisible = true" class="btn">密闭列表</button>
|
|
|
- </div>
|
|
|
+ <BasicTable @register="registerMapTable" :rowSelection="rowSelection" >
|
|
|
+ <template #resetBefore>
|
|
|
+ <a-button type="default" class="ml-8px" preIcon="mdi:download" @click="onExportXls"> 下载 </a-button>
|
|
|
+ </template>
|
|
|
+ <template #action="{ record }">
|
|
|
+ <button @click="handleGoToPageQuery(record, `/manage/mapView`)" class="action-btn" title="">
|
|
|
+ 布点
|
|
|
+ </button>
|
|
|
+ <button @click="handleOpenModal(record)" class="action-btn" title="修改">
|
|
|
+ <SvgIcon name="edit" />
|
|
|
+ </button>
|
|
|
+ <!-- 删除按钮 -->
|
|
|
+ <Popconfirm
|
|
|
+ title="删除确认"
|
|
|
+ description="是否确认删除?"
|
|
|
+ okText="确认"
|
|
|
+ cancelText="取消"
|
|
|
+ @confirm="handleDeleteRecord(record)"
|
|
|
+ @cancel="handleCancel"
|
|
|
+ placement="top"
|
|
|
+ >
|
|
|
+ <button class="action-btn" title="删除">
|
|
|
+ <SvgIcon name="delete" />
|
|
|
+ </button>
|
|
|
+ </Popconfirm>
|
|
|
+ </template>
|
|
|
+ </BasicTable>
|
|
|
|
|
|
- <SideDrawer v-model:visible="drawerVisible" />
|
|
|
+ <!-- 注册编辑弹框组件 -->
|
|
|
+ <MapEditModal @register="registerModal" @success="handleModalSuccess" />
|
|
|
</template>
|
|
|
|
|
|
-<script lang="ts" setup>
|
|
|
-import { nextTick, onMounted,ref } from 'vue';
|
|
|
-// 直接导入app.ts中导出的方法
|
|
|
-import { initMap2d } from './app';
|
|
|
-import { message } from 'ant-design-vue';
|
|
|
-// 导入侧边弹框组件
|
|
|
-import SideDrawer from '../cadFile/components/SideDrawer.vue';
|
|
|
+<script setup lang="ts">
|
|
|
+ import { ref, nextTick, computed, onMounted } from 'vue';
|
|
|
+ import { useRouter } from 'vue-router';
|
|
|
+ import { BasicTable } from '/@/components/Table';
|
|
|
+ import { SvgIcon } from '/@/components/Icon';
|
|
|
+ import { message, Popconfirm } from 'ant-design-vue';
|
|
|
+ // 引入动态列/表单配置函数 + 类型
|
|
|
+ import { getColumns, getSearchFormSchema, mockData} from './cad.data';
|
|
|
+ // import { getMineData } from '../basicInfo.api';
|
|
|
+ import { useListPage } from '/@/hooks/system/useListPage';
|
|
|
+ import { useIntervalFn } from '@vueuse/core';
|
|
|
+ import { useModal } from '/@/components/Modal';
|
|
|
+ import MineCascader from '/@/components/Form/src/jeecg/components/MineCascader/MineCascader.vue';
|
|
|
+ import MapEditModal from './components/MapEditModal.vue';
|
|
|
|
|
|
-// 定义弹框显隐状态
|
|
|
-const drawerVisible = ref(false);
|
|
|
+ // 路由实例
|
|
|
+ const router = useRouter();
|
|
|
+ // 弹框注册
|
|
|
+ const [registerModal, { openModal }] = useModal();
|
|
|
|
|
|
-// 初始化地图(确保先加载地图,再调用其他方法)
|
|
|
-onMounted(() => {
|
|
|
- nextTick(async () => {
|
|
|
- await initMap2d();
|
|
|
- message.success("地图初始化完成!");
|
|
|
+ // 生成动态列和搜索表单(computed响应式更新)
|
|
|
+ const columns = computed(() => getColumns());
|
|
|
+ const searchFormSchema = computed(() => getSearchFormSchema());
|
|
|
+ // ========== 表格注册 ==========
|
|
|
+ const { tableContext: mapManageTable, onExportXls } = useListPage({
|
|
|
+ tableProps: {
|
|
|
+ // api: getMineData, // 数据统计接口
|
|
|
+ dataSource: mockData,
|
|
|
+ columns, // 绑定动态列
|
|
|
+ rowKey: 'mineCode',
|
|
|
+ rowSelection: {
|
|
|
+ type: 'checkbox' ,
|
|
|
+ onChange: (selectedRowKeys, selectedRows) => {
|
|
|
+ console.log('选中了:', selectedRowKeys, selectedRows);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ formConfig: {
|
|
|
+ labelWidth: 120,
|
|
|
+ schemas: searchFormSchema.value, // 绑定动态搜索表单
|
|
|
+ showAdvancedButton: false,
|
|
|
+ schemaGroupNames: ['常规查询'],
|
|
|
+ },
|
|
|
+ showIndexColumn: false,
|
|
|
+ scroll: { x: 'max-content' },
|
|
|
+ },
|
|
|
+ exportConfig: {
|
|
|
+ url: '/ventanaly-province/province/mineData/exportMineData',
|
|
|
+ name: '矿山信息',
|
|
|
+ params: {},
|
|
|
+ },
|
|
|
});
|
|
|
-});
|
|
|
+ const [registerMapTable, mapTable, {rowSelection} ] = mapManageTable;
|
|
|
+ const { pause, resume } = useIntervalFn(() => mapTable.reload({ silence: true }), 10000);
|
|
|
|
|
|
+ /**
|
|
|
+ * 打开弹框函数
|
|
|
+ * @param result 弹框数据
|
|
|
+ */
|
|
|
+ function handleOpenModal(record: any) {
|
|
|
+ openModal(true, { ...record });
|
|
|
+ }
|
|
|
|
|
|
-</script>
|
|
|
+ /**
|
|
|
+ * 弹框结果处理函数
|
|
|
+ * @param result 弹框数据
|
|
|
+ */
|
|
|
+ async function handleModalSuccess(result: any) {
|
|
|
+ if (result) {
|
|
|
+ message.success('操作成功!');
|
|
|
+ mapTable.reload();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 删除记录方法
|
|
|
+ * @param record 当前行数据
|
|
|
+ */
|
|
|
+ async function handleDeleteRecord(record: any) {
|
|
|
+ try {
|
|
|
+ // await deleteDataQuaQue({ id: record.id });
|
|
|
+ await nextTick();
|
|
|
+ } catch (error) {
|
|
|
+ console.error('删除失败:', error);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
-<style scoped>
|
|
|
-#map3dContainer {
|
|
|
- position: absolute;
|
|
|
- background: transparent;
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- top: 0;
|
|
|
- left: 0;
|
|
|
-}
|
|
|
+ function handleGoToPageQuery(record: any, path: string) {
|
|
|
+ const mineCode = record.mineCode;
|
|
|
+ router.push({
|
|
|
+ path,
|
|
|
+ state: { mineCode },
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
-/* 操作面板样式 */
|
|
|
-.map-operation-panel {
|
|
|
- position: absolute;
|
|
|
- top: 20px;
|
|
|
- left: 20px;
|
|
|
- z-index: 999;
|
|
|
- display: flex;
|
|
|
- gap: 8px;
|
|
|
-}
|
|
|
+ /**
|
|
|
+ * 气泡取消按钮通用回调
|
|
|
+ */
|
|
|
+ function handleCancel() {
|
|
|
+ // 取消操作,无逻辑(仅关闭气泡)
|
|
|
+ }
|
|
|
+ // ========== 初始化 ==========
|
|
|
+ onMounted(async () => {
|
|
|
+
|
|
|
+ });
|
|
|
+</script>
|
|
|
|
|
|
-.btn {
|
|
|
- padding: 8px 12px;
|
|
|
- background: #409eff;
|
|
|
- color: #fff;
|
|
|
- border: none;
|
|
|
- border-radius: 4px;
|
|
|
- cursor: pointer;
|
|
|
- transition: background 0.2s;
|
|
|
-}
|
|
|
+<style lang="less" scoped>
|
|
|
+ .action-btn {
|
|
|
+ height: 30px;
|
|
|
+ cursor: pointer;
|
|
|
+ margin-right: 10px;
|
|
|
+ background: none;
|
|
|
|
|
|
-.btn:hover {
|
|
|
- background: #66b1ff;
|
|
|
-}
|
|
|
-</style>
|
|
|
+ &:last-child {
|
|
|
+ margin-right: 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+</style>
|