| | |
| | | <basic-container> |
| | | <el-form ref="queryParamsRef" :model="searchParams" class="gd-search-form"> |
| | | <el-form-item label="所属区划" prop="areaCode"> |
| | | <el-tree-select |
| | | class="gd-select gray" |
| | | popper-class="gd-tree-select-popper" |
| | | v-model="searchParams.areaCode" |
| | | node-key="id" |
| | | :props="treeSelectProps" |
| | | placeholder="请选择" |
| | | clearable |
| | | filterable |
| | | @change="handleSearch" |
| | | :check-strictly="true" |
| | | lazy |
| | | :load="loadRegionNode" |
| | | :render-after-expand="false" |
| | | /> |
| | | </el-form-item> |
| | | <RegionSelect |
| | | class="gd-select gray" |
| | | v-model="searchParams.areaCode" |
| | | placeholder="请选择" |
| | | @change="handleSearch" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="实施清单名称" prop="implementName"> |
| | | <el-input |
| | | class="gd-input gray" |
| | |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | <div class="gd-table-toolbar"> |
| | | <el-button :icon="Plus" color="#4C34FF" type="primary" @click="openForm('add')">新增</el-button> |
| | | </div> |
| | | |
| | | <div class="gd-table-container" v-loading="loading"> |
| | | <div class="gd-table-toolbar"> |
| | | <el-button :icon="Plus" color="#4C34FF" type="primary" @click="openForm('add')">新增</el-button> |
| | | </div> |
| | | |
| | | <div class="gd-table-content gd-table-content-bg"> |
| | | <el-table class="gd-table" :data="list"> |
| | | <el-table-column label="序号" width="80"> |
| | |
| | | <el-table-column prop="matterName" show-overflow-tooltip label="事项名称" /> |
| | | <el-table-column prop="catalogCode" show-overflow-tooltip label="目录编码" /> |
| | | <el-table-column prop="orgName" show-overflow-tooltip label="所属机构" /> |
| | | <el-table-column label="操作" class-name="operation-btns" width="250"> |
| | | <el-table-column label="操作" class-name="operation-btns" width="250" fixed="right"> |
| | | <template v-slot="{ row }"> |
| | | <el-link type="primary" @click="openForm('view', row)">查看</el-link> |
| | | <el-link type="primary" @click="openForm('edit', row)">编辑</el-link> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { getDictionaryByCode } from '@/api/system/dictbiz' |
| | | import { getDictLabel } from '@ztzf/utils' |
| | | import { Search, RefreshRight, Plus } from '@element-plus/icons-vue' |
| | | import { onMounted, ref, provide, nextTick } from 'vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import FormDiaLog from './FormDiaLog.vue' |
| | | import ConfigDiaLog from './ConfigDiaLog.vue' |
| | | import { inventoryPageApi, inventoryRemoveApi, regionLazyTreeApi, deptTreeApi } from './inventoryApi' |
| | | import { inventoryPageApi, inventoryRemoveApi, deptTreeApi } from './inventoryApi' |
| | | import RegionSelect from '@/components/RegionSelect/main.vue' |
| | | |
| | | // 初始化查询参数 |
| | | const initSearchParams = () => ({ |
| | |
| | | const dictObj = ref({}) // 字典对象 |
| | | const deptTree = ref([]) // 部门树数据 |
| | | |
| | | // 树形选择器配置 |
| | | const treeSelectProps = { |
| | | value: 'id', |
| | | label: 'name', |
| | | children: 'children', |
| | | // 添加isLeaf配置,告诉组件如何判断叶子节点 |
| | | isLeaf: (data, node) => { |
| | | return data.leaf === true |
| | | }, |
| | | } |
| | | |
| | | // 部门树配置 |
| | | const treeProps = { |
| | | value: 'id', |
| | |
| | | provide('deptTree', deptTree) |
| | | provide('treeProps', treeProps) |
| | | |
| | | // 懒加载获取区域节点数据 |
| | | async function loadRegionNode(node, resolve) { |
| | | try { |
| | | // 限制只加载两级,当前节点 level >= 1 时不加载子节点 |
| | | if (node.level >= 2) { |
| | | resolve([]) |
| | | return |
| | | } |
| | | |
| | | // 初始化加载时传递 code 参数,加载子节点时传递 parentCode 参数 |
| | | const params = node.data?.id ? { parentCode: node.data.id } : { code: '360800000000' } |
| | | const res = await regionLazyTreeApi(params) |
| | | const nodes = res?.data?.data || [] |
| | | |
| | | // 处理返回的节点数据 |
| | | const processedNodes = nodes.map(item => { |
| | | // 判断是否为叶子节点:如果是第二级(node.level === 1)则为叶子节点 |
| | | const isLeaf = node.level === 1 |
| | | |
| | | return { |
| | | id: item.id || item.value, |
| | | name: item.name || item.title || item.label, |
| | | hasChildren: item.hasChildren || false, |
| | | // 关键:设置leaf属性,告知Tree组件该节点是否为叶子节点 |
| | | leaf: isLeaf, |
| | | } |
| | | }) |
| | | |
| | | resolve(processedNodes) |
| | | } catch (error) { |
| | | console.error('获取区域数据失败:', error) |
| | | resolve([]) |
| | | } |
| | | // 获取字典 |
| | | function getDictList() { |
| | | return getDictionaryByCode('resultConfig').then(res => { |
| | | dictObj.value = res.data.data |
| | | }) |
| | | } |
| | | |
| | | // 获取部门树数据 |
| | |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getDictList() |
| | | getDeptTree() |
| | | getList() |
| | | }) |