204 lines
4.6 KiB
Vue
204 lines
4.6 KiB
Vue
|
|
<!-- d:\wordpack\WholeProcessPlatform\frontend\src\views\system\map\components\StationManagement\index.vue -->
|
||
|
|
<template>
|
||
|
|
<div class="content">
|
||
|
|
<StationManagementSearch
|
||
|
|
ref="stationManagementSearch"
|
||
|
|
:handle-add="handleAdd"
|
||
|
|
@reset="handleReset"
|
||
|
|
@search-finish="onSearchFinish"
|
||
|
|
/>
|
||
|
|
<BasicTable
|
||
|
|
:columns="columns"
|
||
|
|
:data="dataSource"
|
||
|
|
:list-url="fetchStationData"
|
||
|
|
:search-params="searchParams"
|
||
|
|
:enable-row-selection="true"
|
||
|
|
@selection-change="handleSelectionChange"
|
||
|
|
>
|
||
|
|
<template #action="{ column, record }">
|
||
|
|
<a-space>
|
||
|
|
<a-button type="link" size="small" @click="handleEdit(record)"
|
||
|
|
>编辑</a-button
|
||
|
|
>
|
||
|
|
<a-button
|
||
|
|
type="link"
|
||
|
|
size="small"
|
||
|
|
danger
|
||
|
|
@click="handleDelete(record)"
|
||
|
|
>删除</a-button
|
||
|
|
>
|
||
|
|
</a-space>
|
||
|
|
</template>
|
||
|
|
<template #status="{ column, record }">
|
||
|
|
<a-tag :color="record.status === 'running' ? 'green' : 'red'">
|
||
|
|
{{ record.status === 'running' ? '运行中' : '停运' }}
|
||
|
|
</a-tag>
|
||
|
|
</template>
|
||
|
|
</BasicTable>
|
||
|
|
<StationManagementForm
|
||
|
|
ref="stationManagementForm"
|
||
|
|
v-model:visible="editModalVisible"
|
||
|
|
:initial-values="currentRecord"
|
||
|
|
@cancel="editModalCancel"
|
||
|
|
@ok="handleEditSubmit"
|
||
|
|
/>
|
||
|
|
</div>
|
||
|
|
</template>
|
||
|
|
|
||
|
|
<script setup lang="ts">
|
||
|
|
import { ref } from 'vue';
|
||
|
|
import BasicTable from '@/components/BasicTable/index.vue';
|
||
|
|
import StationManagementSearch from './StationManagementSearch.vue';
|
||
|
|
import StationManagementForm from './StationManagementForm.vue';
|
||
|
|
import { message } from 'ant-design-vue';
|
||
|
|
|
||
|
|
// 表格列配置
|
||
|
|
const columns = [
|
||
|
|
{
|
||
|
|
title: '电站名称',
|
||
|
|
dataIndex: 'stationName',
|
||
|
|
key: 'stationName',
|
||
|
|
width: 150
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: '所属流域',
|
||
|
|
dataIndex: 'basin',
|
||
|
|
key: 'basin',
|
||
|
|
width: 120
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: '装机容量(MW)',
|
||
|
|
dataIndex: 'capacity',
|
||
|
|
key: 'capacity',
|
||
|
|
width: 120
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: '状态',
|
||
|
|
key: 'status',
|
||
|
|
dataIndex: 'status',
|
||
|
|
width: 100,
|
||
|
|
slots: { customRender: 'status' }
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: '位置坐标',
|
||
|
|
dataIndex: 'coordinates',
|
||
|
|
key: 'coordinates',
|
||
|
|
ellipsis: true
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: '操作',
|
||
|
|
key: 'action',
|
||
|
|
width: 150,
|
||
|
|
fixed: 'right',
|
||
|
|
slots: { customRender: 'action' }
|
||
|
|
}
|
||
|
|
];
|
||
|
|
|
||
|
|
// 搜索参数
|
||
|
|
const searchParams = ref({});
|
||
|
|
// 编辑弹窗数据
|
||
|
|
const currentRecord = ref<any | null>(null);
|
||
|
|
const editModalVisible = ref(false);
|
||
|
|
|
||
|
|
// 数据源
|
||
|
|
const dataSource = ref([]);
|
||
|
|
|
||
|
|
// 模拟数据获取函数
|
||
|
|
const fetchStationData = (params: any) => {
|
||
|
|
return new Promise(resolve => {
|
||
|
|
setTimeout(() => {
|
||
|
|
resolve({
|
||
|
|
data: {
|
||
|
|
records: [
|
||
|
|
{
|
||
|
|
id: 1,
|
||
|
|
stationName: '三峡电站',
|
||
|
|
basin: '长江流域',
|
||
|
|
capacity: 22500,
|
||
|
|
status: 'running',
|
||
|
|
coordinates: '111.29,30.83'
|
||
|
|
},
|
||
|
|
{
|
||
|
|
id: 2,
|
||
|
|
stationName: '葛洲坝电站',
|
||
|
|
basin: '长江流域',
|
||
|
|
capacity: 2715,
|
||
|
|
status: 'running',
|
||
|
|
coordinates: '111.28,30.75'
|
||
|
|
},
|
||
|
|
{
|
||
|
|
id: 3,
|
||
|
|
stationName: '溪洛渡电站',
|
||
|
|
basin: '金沙江流域',
|
||
|
|
capacity: 13860,
|
||
|
|
status: 'stopped',
|
||
|
|
coordinates: '103.65,28.25'
|
||
|
|
}
|
||
|
|
],
|
||
|
|
total: 3
|
||
|
|
}
|
||
|
|
});
|
||
|
|
}, 500);
|
||
|
|
});
|
||
|
|
};
|
||
|
|
|
||
|
|
const handleAdd = () => {
|
||
|
|
currentRecord.value = null;
|
||
|
|
editModalVisible.value = true;
|
||
|
|
};
|
||
|
|
|
||
|
|
// 编辑处理
|
||
|
|
const handleEdit = (record: any) => {
|
||
|
|
currentRecord.value = { ...record };
|
||
|
|
editModalVisible.value = true;
|
||
|
|
};
|
||
|
|
|
||
|
|
// 删除处理
|
||
|
|
const handleDelete = (record: any) => {
|
||
|
|
message.warning(`删除电站: ${record.stationName}`);
|
||
|
|
};
|
||
|
|
|
||
|
|
// 搜索完成处理
|
||
|
|
const onSearchFinish = (values: any) => {
|
||
|
|
console.log(values);
|
||
|
|
};
|
||
|
|
|
||
|
|
// 重置
|
||
|
|
const handleReset = (params: any) => {};
|
||
|
|
|
||
|
|
// 选择变化处理
|
||
|
|
const handleSelectionChange = (selectedRows: any[]) => {
|
||
|
|
console.log('选中的行:', selectedRows);
|
||
|
|
};
|
||
|
|
|
||
|
|
// 表单取消
|
||
|
|
const editModalCancel = () => {
|
||
|
|
editModalVisible.value = false;
|
||
|
|
};
|
||
|
|
|
||
|
|
// 表单提交
|
||
|
|
const handleEditSubmit = (values: any) => {
|
||
|
|
console.log(values);
|
||
|
|
};
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<style scoped lang="scss">
|
||
|
|
.content {
|
||
|
|
position: relative;
|
||
|
|
z-index: 900;
|
||
|
|
pointer-events: all;
|
||
|
|
width: 100%;
|
||
|
|
height: 100%;
|
||
|
|
background-color: #ffffff;
|
||
|
|
display: flex;
|
||
|
|
flex-direction: column;
|
||
|
|
gap: 10px;
|
||
|
|
box-sizing: border-box;
|
||
|
|
overflow: hidden;
|
||
|
|
}
|
||
|
|
.station-management {
|
||
|
|
height: 100%;
|
||
|
|
padding: 16px;
|
||
|
|
}
|
||
|
|
</style>
|