|
@@ -1,17 +1,29 @@
|
|
|
<template>
|
|
<template>
|
|
|
<!-- 自定义左侧抽屉-->
|
|
<!-- 自定义左侧抽屉-->
|
|
|
- <div class="custom-drawer" :class="{ 'custom-drawer-open': visible }">
|
|
|
|
|
|
|
+ <Drawer
|
|
|
|
|
+ class="custom-drawer"
|
|
|
|
|
+ :open="open"
|
|
|
|
|
+ :closable="false"
|
|
|
|
|
+ :mask="true"
|
|
|
|
|
+ :maskClosable="false"
|
|
|
|
|
+ :maskStyle="{ background: 'transparent', pointerEvents: 'none' }"
|
|
|
|
|
+ placement="left"
|
|
|
|
|
+ :width="400"
|
|
|
|
|
+ :get-container="getContainer"
|
|
|
|
|
+ @update:open="emit('update:open', $event)"
|
|
|
|
|
+ >
|
|
|
<!-- 抽屉头部:标题 + 关闭按钮 -->
|
|
<!-- 抽屉头部:标题 + 关闭按钮 -->
|
|
|
- <div class="custom-drawer-header">
|
|
|
|
|
- <span class="custom-drawer-title">老空区永久密闭管理</span>
|
|
|
|
|
- <div @click="handleClose" class="close-btn"> X </div>
|
|
|
|
|
- </div>
|
|
|
|
|
-
|
|
|
|
|
- <!-- 抽屉内容区 -->
|
|
|
|
|
- <div class="custom-drawer-body" v-if="visible">
|
|
|
|
|
- <div class="drawer-content">
|
|
|
|
|
- <!-- 搜索区域 -->
|
|
|
|
|
- <!-- <div class="search-section">
|
|
|
|
|
|
|
+ <template #title>
|
|
|
|
|
+ 老空区永久密闭管理
|
|
|
|
|
+ <!-- <span class="custom-drawer-title"></span> -->
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template #extra>
|
|
|
|
|
+ <CloseOutlined class="cursor-pointer" @click="emit('update:open', false)" />
|
|
|
|
|
+ </template>
|
|
|
|
|
+
|
|
|
|
|
+ <div class="h-full">
|
|
|
|
|
+ <!-- 搜索区域 -->
|
|
|
|
|
+ <!-- <div class="search-section">
|
|
|
<MineCascader
|
|
<MineCascader
|
|
|
v-model:value="selectedMineId"
|
|
v-model:value="selectedMineId"
|
|
|
placeholder="请选择煤矿"
|
|
placeholder="请选择煤矿"
|
|
@@ -29,63 +41,64 @@
|
|
|
刷新
|
|
刷新
|
|
|
</a-button>
|
|
</a-button>
|
|
|
</div> -->
|
|
</div> -->
|
|
|
- <div class="search-section">
|
|
|
|
|
- <a-input v-model:value="searchValue" placeholder="密闭位置" style="width: 60%; margin-right: 8px" />
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <div class="mb-5px">
|
|
|
|
|
+ <a-input v-model:value="searchValue" placeholder="密闭位置" style="width: 60%; margin-right: 8px" />
|
|
|
|
|
+ </div>
|
|
|
|
|
|
|
|
- <!-- 传感器数据表格 -->
|
|
|
|
|
- <div class="table-section">
|
|
|
|
|
- <a-table
|
|
|
|
|
- :columns="columns"
|
|
|
|
|
- :data-source="filteredDataWithStatus"
|
|
|
|
|
- :pagination="pagination"
|
|
|
|
|
- :row-key="(record) => record.id"
|
|
|
|
|
- @change="handleTableChange"
|
|
|
|
|
- :scroll="{ y: 'calc(100vh - 320px)' }"
|
|
|
|
|
- size="middle"
|
|
|
|
|
- >
|
|
|
|
|
- <!-- 操作列自定义渲染 -->
|
|
|
|
|
- <template #operation="{ record }">
|
|
|
|
|
- <a-space>
|
|
|
|
|
- <a-button v-if="!record.isPlaced" size="small" @click="handleDeploy(record)"> 布点 </a-button>
|
|
|
|
|
- <a-button v-else size="small" danger @click="handleRemove(record)"> 移除 </a-button>
|
|
|
|
|
- </a-space>
|
|
|
|
|
- </template>
|
|
|
|
|
- </a-table>
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <!-- 传感器数据表格 -->
|
|
|
|
|
+ <div class="table-section">
|
|
|
|
|
+ <BasicTable
|
|
|
|
|
+ :columns="columns"
|
|
|
|
|
+ :data-source="filteredDataWithStatus"
|
|
|
|
|
+ :pagination="true"
|
|
|
|
|
+ :row-key="(record) => record.id"
|
|
|
|
|
+ :scroll="{ y: 'calc(100vh - 320px)' }"
|
|
|
|
|
+ size="middle"
|
|
|
|
|
+ >
|
|
|
|
|
+ <!-- 操作列自定义渲染 -->
|
|
|
|
|
+ <template #operation="{ record }">
|
|
|
|
|
+ <a-space>
|
|
|
|
|
+ <a-button v-if="!record.isPlaced" size="small" @click="handleDeploy(record)"> 布点 </a-button>
|
|
|
|
|
+ <a-button v-else size="small" danger @click="handleRemove(record)"> 移除 </a-button>
|
|
|
|
|
+ </a-space>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </BasicTable>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- </div>
|
|
|
|
|
|
|
+ </Drawer>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
|
- import { ref, computed, onMounted, watch } from 'vue';
|
|
|
|
|
- import { message } from 'ant-design-vue';
|
|
|
|
|
|
|
+ import { ref, computed, watch } from 'vue';
|
|
|
|
|
+ import { Drawer, message } from 'ant-design-vue';
|
|
|
|
|
+ import { BasicColumn, BasicTable } from '/@/components/Table';
|
|
|
import { bindPosition, removePosition, getMarkerStatusList, renderGoafMarkers } from '../app';
|
|
import { bindPosition, removePosition, getMarkerStatusList, renderGoafMarkers } from '../app';
|
|
|
import { getGoafList } from '../cad.api';
|
|
import { getGoafList } from '../cad.api';
|
|
|
|
|
+ import { CloseOutlined } from '@ant-design/icons-vue';
|
|
|
|
|
|
|
|
- interface Props {
|
|
|
|
|
- visible: boolean;
|
|
|
|
|
|
|
+ const props = defineProps<{
|
|
|
|
|
+ open: boolean;
|
|
|
mineCode: string;
|
|
mineCode: string;
|
|
|
- }
|
|
|
|
|
- const props = defineProps<Props>();
|
|
|
|
|
|
|
+ getContainer?: any;
|
|
|
|
|
+ }>();
|
|
|
|
|
+
|
|
|
const emit = defineEmits<{
|
|
const emit = defineEmits<{
|
|
|
- (e: 'update:visible', value: boolean): void;
|
|
|
|
|
|
|
+ (e: 'update:open', value: boolean): void;
|
|
|
}>();
|
|
}>();
|
|
|
|
|
|
|
|
// 响应式数据
|
|
// 响应式数据
|
|
|
const searchValue = ref('');
|
|
const searchValue = ref('');
|
|
|
- const pagination = ref({
|
|
|
|
|
- current: 1,
|
|
|
|
|
- pageSize: 10,
|
|
|
|
|
- total: 0, // 初始化为0,由接口数据决定
|
|
|
|
|
- });
|
|
|
|
|
- const selectedMineId = ref('');
|
|
|
|
|
|
|
+ // const pagination = ref({
|
|
|
|
|
+ // current: 1,
|
|
|
|
|
+ // pageSize: 10,
|
|
|
|
|
+ // total: 0, // 初始化为0,由接口数据决定
|
|
|
|
|
+ // });
|
|
|
|
|
+ const selectedMineId = ref(props.mineCode);
|
|
|
// 新增:存储接口返回的密闭数据
|
|
// 新增:存储接口返回的密闭数据
|
|
|
const goafList = ref<any[]>([]);
|
|
const goafList = ref<any[]>([]);
|
|
|
|
|
|
|
|
// 表格列配置 - 修复字段拼写错误(devicePos → devicePos)
|
|
// 表格列配置 - 修复字段拼写错误(devicePos → devicePos)
|
|
|
- const columns = [
|
|
|
|
|
|
|
+ const columns: BasicColumn[] = [
|
|
|
{
|
|
{
|
|
|
title: '操作',
|
|
title: '操作',
|
|
|
key: 'operation',
|
|
key: 'operation',
|
|
@@ -98,7 +111,7 @@
|
|
|
dataIndex: 'devicePos', // 修正拼写错误
|
|
dataIndex: 'devicePos', // 修正拼写错误
|
|
|
key: 'devicePos',
|
|
key: 'devicePos',
|
|
|
ellipsis: true,
|
|
ellipsis: true,
|
|
|
- tooltip: true,
|
|
|
|
|
|
|
+ // tooltip: true,
|
|
|
},
|
|
},
|
|
|
];
|
|
];
|
|
|
|
|
|
|
@@ -129,15 +142,13 @@
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
// 分页逻辑
|
|
// 分页逻辑
|
|
|
- const start = (pagination.value.current - 1) * pagination.value.pageSize;
|
|
|
|
|
- const end = start + pagination.value.pageSize;
|
|
|
|
|
- pagination.value.total = filteredData.length;
|
|
|
|
|
- return dataWithStatus.slice(start, end);
|
|
|
|
|
|
|
+ // const start = (pagination.value.current - 1) * pagination.value.pageSize;
|
|
|
|
|
+ // const end = start + pagination.value.pageSize;
|
|
|
|
|
+ // pagination.value.total = filteredData.length;
|
|
|
|
|
+ // return dataWithStatus.slice(start, end);
|
|
|
|
|
+ return dataWithStatus;
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- // 关闭抽屉
|
|
|
|
|
- const handleClose = () => emit('update:visible', false);
|
|
|
|
|
-
|
|
|
|
|
// 搜索方法
|
|
// 搜索方法
|
|
|
const handleGoafSearch = async () => {
|
|
const handleGoafSearch = async () => {
|
|
|
// 校验:必须选择煤矿
|
|
// 校验:必须选择煤矿
|
|
@@ -153,7 +164,7 @@
|
|
|
mineCode: selectedMineId.value,
|
|
mineCode: selectedMineId.value,
|
|
|
});
|
|
});
|
|
|
goafList.value = res || [];
|
|
goafList.value = res || [];
|
|
|
- pagination.value.current = 1; // 搜索后重置页码到第一页
|
|
|
|
|
|
|
+ // pagination.value.current = 1; // 搜索后重置页码到第一页
|
|
|
renderGoafMarkers(goafList.value); // 渲染标记
|
|
renderGoafMarkers(goafList.value); // 渲染标记
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
goafList.value = [];
|
|
goafList.value = [];
|
|
@@ -165,8 +176,8 @@
|
|
|
// 刷新方法 - 优化:强制重新请求接口
|
|
// 刷新方法 - 优化:强制重新请求接口
|
|
|
const handleRefresh = async () => {
|
|
const handleRefresh = async () => {
|
|
|
searchValue.value = '';
|
|
searchValue.value = '';
|
|
|
- pagination.value.current = 1;
|
|
|
|
|
- pagination.value = { ...pagination.value }; // 触发响应式更新
|
|
|
|
|
|
|
+ // pagination.value.current = 1;
|
|
|
|
|
+ // pagination.value = { ...pagination.value }; // 触发响应式更新
|
|
|
|
|
|
|
|
// 如果已选择煤矿,刷新时重新请求接口(保证数据最新)
|
|
// 如果已选择煤矿,刷新时重新请求接口(保证数据最新)
|
|
|
if (selectedMineId.value) {
|
|
if (selectedMineId.value) {
|
|
@@ -177,9 +188,9 @@
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
// 表格分页变化
|
|
// 表格分页变化
|
|
|
- const handleTableChange = (pag: any) => {
|
|
|
|
|
- pagination.value = { ...pagination.value, ...pag };
|
|
|
|
|
- };
|
|
|
|
|
|
|
+ // const handleTableChange = (pag: any) => {
|
|
|
|
|
+ // pagination.value = { ...pagination.value, ...pag };
|
|
|
|
|
+ // };
|
|
|
|
|
|
|
|
// 布点方法 - 优化:布点后主动刷新接口数据
|
|
// 布点方法 - 优化:布点后主动刷新接口数据
|
|
|
const handleDeploy = async (record: any) => {
|
|
const handleDeploy = async (record: any) => {
|
|
@@ -215,149 +226,33 @@
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
// 煤矿选择变化
|
|
// 煤矿选择变化
|
|
|
- const handleMineChange = (mineId: string) => {
|
|
|
|
|
- selectedMineId.value = mineId;
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- watch(
|
|
|
|
|
- () => props.mineCode,
|
|
|
|
|
- (newVal) => {
|
|
|
|
|
- if (newVal) {
|
|
|
|
|
- selectedMineId.value = newVal;
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- { immediate: true }
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ // const handleMineChange = (mineId: string) => {
|
|
|
|
|
+ // selectedMineId.value = mineId;
|
|
|
|
|
+ // };
|
|
|
|
|
+
|
|
|
|
|
+ // watch(
|
|
|
|
|
+ // () => props.mineCode,
|
|
|
|
|
+ // (newVal) => {
|
|
|
|
|
+ // if (newVal) {
|
|
|
|
|
+ // selectedMineId.value = newVal;
|
|
|
|
|
+ // }
|
|
|
|
|
+ // },
|
|
|
|
|
+ // { immediate: true }
|
|
|
|
|
+ // );
|
|
|
|
|
|
|
|
// 监听抽屉显隐:打开时刷新数据
|
|
// 监听抽屉显隐:打开时刷新数据
|
|
|
watch(
|
|
watch(
|
|
|
- () => props.visible,
|
|
|
|
|
- async (isVisible) => {
|
|
|
|
|
- if (isVisible) await handleRefresh(); // 异步数据加载
|
|
|
|
|
|
|
+ () => props.open,
|
|
|
|
|
+ (v) => {
|
|
|
|
|
+ v && handleRefresh(); // 异步数据加载
|
|
|
},
|
|
},
|
|
|
{ immediate: true }
|
|
{ immediate: true }
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
// 初始化:分页总数同步为接口数据量
|
|
// 初始化:分页总数同步为接口数据量
|
|
|
- onMounted(() => {
|
|
|
|
|
- pagination.value.total = goafList.value.length;
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ // onMounted(() => {
|
|
|
|
|
+ // pagination.value.total = goafList.value.length;
|
|
|
|
|
+ // });
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
-<style scoped>
|
|
|
|
|
- /* 自定义抽屉核心容器 */
|
|
|
|
|
- .custom-drawer {
|
|
|
|
|
- position: fixed;
|
|
|
|
|
- top: 50px;
|
|
|
|
|
- left: 0;
|
|
|
|
|
- z-index: 999;
|
|
|
|
|
- width: 450px;
|
|
|
|
|
- height: calc(100vh - 50px);
|
|
|
|
|
- background: #ffffff;
|
|
|
|
|
- box-shadow: 2px 0 12px rgba(0, 0, 0, 0.1);
|
|
|
|
|
- transform: translateX(-100%);
|
|
|
|
|
- transition: transform 0.3s cubic-bezier(0.2, 0, 0, 1);
|
|
|
|
|
- display: flex;
|
|
|
|
|
- flex-direction: column;
|
|
|
|
|
- overflow: hidden;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /* 抽屉打开状态 - 滑入动画 */
|
|
|
|
|
- .custom-drawer-open {
|
|
|
|
|
- transform: translateX(0);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /* 抽屉头部 */
|
|
|
|
|
- .custom-drawer-header {
|
|
|
|
|
- display: flex;
|
|
|
|
|
- align-items: center;
|
|
|
|
|
- justify-content: space-between;
|
|
|
|
|
- color: #ffffff;
|
|
|
|
|
- background-color: #2d4f82;
|
|
|
|
|
- padding: 14px 20px;
|
|
|
|
|
- flex-shrink: 0;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- .custom-drawer-title {
|
|
|
|
|
- font-size: 16px;
|
|
|
|
|
- font-weight: 600;
|
|
|
|
|
- color: #ffffff;
|
|
|
|
|
- line-height: 1.5;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- .close-btn {
|
|
|
|
|
- font-size: 20px;
|
|
|
|
|
- padding: 0;
|
|
|
|
|
- height: 20px;
|
|
|
|
|
- width: 20px;
|
|
|
|
|
- margin-top: -10px;
|
|
|
|
|
- cursor: pointer;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /* 抽屉内容区 */
|
|
|
|
|
- .custom-drawer-body {
|
|
|
|
|
- flex: 1;
|
|
|
|
|
- overflow-y: auto;
|
|
|
|
|
- padding: 0;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- .drawer-content {
|
|
|
|
|
- padding: 16px 20px;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /* 搜索区域布局 */
|
|
|
|
|
- .search-section {
|
|
|
|
|
- display: flex;
|
|
|
|
|
- align-items: center;
|
|
|
|
|
- margin-bottom: 16px;
|
|
|
|
|
- width: 100%;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /* 下拉选择区域间距 */
|
|
|
|
|
- .select-section {
|
|
|
|
|
- margin-bottom: 16px;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /* 表格区域宽度适配 */
|
|
|
|
|
- .table-section {
|
|
|
|
|
- width: 100%;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /* 表格样式 */
|
|
|
|
|
- :deep(.ant-table) {
|
|
|
|
|
- font-size: 14px;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- :deep(.ant-table-thead > tr > th) {
|
|
|
|
|
- background: #fafafa;
|
|
|
|
|
- font-weight: 600;
|
|
|
|
|
- color: #000;
|
|
|
|
|
- padding: 10px 12px;
|
|
|
|
|
- border-bottom: 1px solid #f0f0f0;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- :deep(.ant-table-tbody > tr > td) {
|
|
|
|
|
- color: #000 !important;
|
|
|
|
|
- font-family: Source Han Sans SC !important;
|
|
|
|
|
- font-size: 16px !important;
|
|
|
|
|
- font-weight: 400 !important;
|
|
|
|
|
- letter-spacing: 0 !important;
|
|
|
|
|
- }
|
|
|
|
|
- :deep(.ant-table-tbody > .ant-table-row) {
|
|
|
|
|
- &:hover {
|
|
|
|
|
- background-color: #a4d3ee !important;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- :deep(.ant-table-tbody > .ant-table-row > td) {
|
|
|
|
|
- background-color: unset !important;
|
|
|
|
|
- &:hover {
|
|
|
|
|
- background-color: unset !important;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /* 分页样式 */
|
|
|
|
|
- :deep(.ant-pagination) {
|
|
|
|
|
- margin: 16px 0 0 0;
|
|
|
|
|
- text-align: right;
|
|
|
|
|
- }
|
|
|
|
|
-</style>
|
|
|
|
|
|
|
+<style scoped></style>
|