hldy_vue/src/views/admin/institution/index.vue

64 lines
1.8 KiB
Vue
Raw Normal View History

2025-03-27 18:04:17 +08:00
<template>
<a-row class="p-2" type="flex" :gutter="10">
<a-col :xl="12" :lg="24" :md="24" style="margin-bottom: 10px">
<InstitutionAreaLeftTree ref="leftTree" @select="onTreeSelect" @rootTreeData="onRootTreeData" />
</a-col>
<a-col :xl="12" :lg="24" :md="24" style="margin-bottom: 10px">
<div style="height: 100%;" class="form-content">
<a-tabs v-show="nodeData != null" defaultActiveKey="base-info">
<a-tab-pane tab="基本信息" key="base-info" forceRender style="position: relative">
<div style="padding: 20px">
<InstitutionAreaForm :data="nodeData" :rootTreeData="rootTreeData" @success="onSuccess" />
</div>
</a-tab-pane>
</a-tabs>
<div v-show="nodeData == null" style="padding-top: 40px">
<a-empty description="请选择区域" />
</div>
</div>
</a-col>
</a-row>
</template>
<script lang="ts" name="iot-nuIotRegionInfo" setup>
import { ref } from 'vue';
import { useDesign } from '/@/hooks/web/useDesign';
import InstitutionAreaLeftTree from './components/InstitutionAreaLeftTree.vue'
import InstitutionAreaForm from './components/InstitutionAreaForm.vue';
// 给子组件定义一个ref变量
const leftTree = ref();
// 当前选中的区域信息
const nodeData = ref({});
const rootTreeData = ref<any[]>([]);
// 左侧树选择后触发
function onTreeSelect(data) {
nodeData.value = data;
}
// 左侧树rootTreeData触发
function onRootTreeData(data) {
rootTreeData.value = data;
}
function onSuccess() {
leftTree.value.loadRootTreeData();
}
</script>
<style lang="less" scoped>
.p-2{
height: calc(100vh - 120px);
}
.form-content{
background-color: #ffffff;
height: 100%;
}
:deep(.ant-tabs-nav ){
padding: 0 20px;
}
</style>