Introducing new features. 修改树形选择组件默认加载不显示的节点,修复代码生成器预览左侧的树形组件展示不正确问题

This commit is contained in:
aeizzz 2023-02-24 09:29:50 +08:00
parent 60d376bc9a
commit 62296e732b
3 changed files with 13 additions and 6 deletions

View File

@ -7,8 +7,7 @@
<el-form-item :label="$t('sysdept.parentId')" prop="parentId">
<el-tree-select v-model="dataForm.parentId" :data="parentData"
:props="{ value: 'id', label: 'name', children: 'children' }" class="w100" clearable check-strictly
default-expand-all
:placeholder="$t('sysdept.inputparentIdTip')"/>
:render-after-expand="false" :placeholder="$t('sysdept.inputparentIdTip')"/>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">

View File

@ -13,7 +13,7 @@
</el-col>
<el-col :span="12" class="mb20">
<el-form-item :label="$t('sysmenu.parentId')" prop="parentId">
<el-tree-select v-model="state.ruleForm.parentId" :data="state.parentData" default-expand-all
<el-tree-select v-model="state.ruleForm.parentId" :data="state.parentData" :render-after-expand="false"
:props="{ value: 'id', label: 'name', children: 'children' }" class="w100" clearable check-strictly
:placeholder="$t('sysmenu.inputParentIdTip')">
</el-tree-select>
@ -115,7 +115,9 @@ const state = reactive({
//
const getMenuData = () => {
state.parentData = []
pageList().then(res => {
pageList({
type: '0'
}).then(res => {
let menu = {
createBy: "",
createTime: "",

View File

@ -2,7 +2,7 @@
<el-dialog title="代码预览" v-model="visible" width="90%" top="3vh" append-to-body :close-on-click-modal="false">
<el-row :gutter="20">
<el-col :span="6">
<el-card :gutter="12" shadow="hover">
<el-card :gutter="12" shadow="hover" v-loading="loading">
<el-scrollbar height="calc(100vh - 300px)">
<el-tree ref="treeRef" node-key="id" :data="preview.fileTree" :expand-on-click-node="false"
highlight-current @node-click="handleNodeClick" />
@ -24,6 +24,7 @@
<script setup lang="ts" name="preview">
import { useGeneratorPreviewApi } from '/@/api/gen/table';
import { handleTree } from '/@/utils/other';
import {validatePhone} from "/@/api/admin/user";
const visible = ref(false)
// ======== ========
@ -42,17 +43,22 @@ const openDialog = async (id: string) => {
visible.value = true
}
const loading = ref(false)
const getGenCodeFile = (id: string) => {
loading.value = true
fileTreeOriginal.value = []
useGeneratorPreviewApi(id).then((res: any) => {
previewCodegen.value = res
for (let index in res) {
fileTreeOriginal.value.push(res[index].codePath)
}
//
preview.activeName = res[0].codePath
const files = handleFiles(fileTreeOriginal)
preview.fileTree = handleTree(files, 'id', 'parentId', 'children', '/')
}).finally(() => {
loading.value = false
})
}