mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2025-12-15 15:42:50 +00:00
解决 el-cascader 文本不显示问题
This commit is contained in:
parent
628650ce7c
commit
ae0be71e9c
@ -18,7 +18,7 @@
|
|||||||
"codemirror": "^6.0.1",
|
"codemirror": "^6.0.1",
|
||||||
"core-js": "^3.23.5",
|
"core-js": "^3.23.5",
|
||||||
"echarts": "^5.3.3",
|
"echarts": "^5.3.3",
|
||||||
"element-plus": "^2.2.11",
|
"element-plus": "^2.2.12",
|
||||||
"file-saver": "^2.0.5",
|
"file-saver": "^2.0.5",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"mitt": "^3.0.0",
|
"mitt": "^3.0.0",
|
||||||
|
|||||||
@ -1,6 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-button type="success" @click="create">快速创建</el-button>
|
<el-button type="success" @click="create">快速创建</el-button>
|
||||||
<cl-form ref="Form" />
|
<cl-form ref="Form">
|
||||||
|
<template #slot-entity="{ scope }">
|
||||||
|
<el-cascader
|
||||||
|
v-model="scope.entity"
|
||||||
|
filterable
|
||||||
|
separator="-"
|
||||||
|
:options="tree"
|
||||||
|
@change="onEntityChange"
|
||||||
|
></el-cascader>
|
||||||
|
</template>
|
||||||
|
</cl-form>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" name="menu-create" setup>
|
<script lang="ts" name="menu-create" setup>
|
||||||
@ -11,10 +21,17 @@ import { useForm } from "@cool-vue/crud";
|
|||||||
import MenuSelect from "./select.vue";
|
import MenuSelect from "./select.vue";
|
||||||
import IconSelect from "./icon.vue";
|
import IconSelect from "./icon.vue";
|
||||||
import { deepPaths } from "/@/cool/utils";
|
import { deepPaths } from "/@/cool/utils";
|
||||||
|
import { ref } from "vue";
|
||||||
|
|
||||||
const { service } = useCool();
|
const { service } = useCool();
|
||||||
const Form = useForm();
|
const Form = useForm();
|
||||||
|
|
||||||
|
// 实体列表
|
||||||
|
const list: any[] = [];
|
||||||
|
|
||||||
|
// 实体树形列表
|
||||||
|
const tree = ref();
|
||||||
|
|
||||||
// 快速创建
|
// 快速创建
|
||||||
async function create() {
|
async function create() {
|
||||||
// 模块列表
|
// 模块列表
|
||||||
@ -26,9 +43,6 @@ async function create() {
|
|||||||
// 数据结构列表
|
// 数据结构列表
|
||||||
const eps: any[][] = await service.base.open.eps();
|
const eps: any[][] = await service.base.open.eps();
|
||||||
|
|
||||||
// 实体列表
|
|
||||||
const list: any[] = [];
|
|
||||||
|
|
||||||
for (const i in eps) {
|
for (const i in eps) {
|
||||||
eps[i].forEach((e) => {
|
eps[i].forEach((e) => {
|
||||||
if (!isEmpty(e.columns)) {
|
if (!isEmpty(e.columns)) {
|
||||||
@ -40,6 +54,9 @@ async function create() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 实体树形列表
|
||||||
|
tree.value = deepPaths(list.map((e) => e.value));
|
||||||
|
|
||||||
// 打开
|
// 打开
|
||||||
Form.value?.open({
|
Form.value?.open({
|
||||||
title: "快速创建",
|
title: "快速创建",
|
||||||
@ -70,19 +87,7 @@ async function create() {
|
|||||||
label: "数据结构",
|
label: "数据结构",
|
||||||
span: 14,
|
span: 14,
|
||||||
component: {
|
component: {
|
||||||
name: "el-cascader",
|
name: "slot-entity"
|
||||||
props: {
|
|
||||||
filterable: true,
|
|
||||||
separator: "-",
|
|
||||||
options: deepPaths(list.map((e) => e.value)),
|
|
||||||
onChange(arr: string[]) {
|
|
||||||
const item = list.find((e) => e.value == arr.join("/"));
|
|
||||||
|
|
||||||
if (item) {
|
|
||||||
Form.value?.setForm("router", `/${item.value}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
@ -233,4 +238,13 @@ async function create() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 实体切换
|
||||||
|
function onEntityChange(arr: string[]) {
|
||||||
|
const item = list.find((e) => e.value == arr.join("/"));
|
||||||
|
|
||||||
|
if (item) {
|
||||||
|
Form.value?.setForm("router", `/${item.value}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
21
yarn.lock
21
yarn.lock
@ -2446,27 +2446,6 @@ electron-to-chromium@^1.4.202:
|
|||||||
resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.206.tgz#580ff85b54d7ec0c05f20b1e37ea0becdd7b0ee4"
|
resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.206.tgz#580ff85b54d7ec0c05f20b1e37ea0becdd7b0ee4"
|
||||||
integrity sha512-h+Fadt1gIaQ06JaIiyqPsBjJ08fV5Q7md+V8bUvQW/9OvXfL2LRICTz2EcnnCP7QzrFTS6/27MRV6Bl9Yn97zA==
|
integrity sha512-h+Fadt1gIaQ06JaIiyqPsBjJ08fV5Q7md+V8bUvQW/9OvXfL2LRICTz2EcnnCP7QzrFTS6/27MRV6Bl9Yn97zA==
|
||||||
|
|
||||||
element-plus@^2.2.11:
|
|
||||||
version "2.2.11"
|
|
||||||
resolved "https://registry.npmjs.org/element-plus/-/element-plus-2.2.11.tgz#c242bd5ff10aea02cfc70c0b8c54cbc9b732e7ba"
|
|
||||||
integrity sha512-JjOvz5DLBc4Jp9OHKXNcK/Cys4NX5/vxpZ+gYmH2V+pLkwJnyIOrNZ3QxfdyG6yE4+NkpoA6koEgUB7T+0Z5vQ==
|
|
||||||
dependencies:
|
|
||||||
"@ctrl/tinycolor" "^3.4.1"
|
|
||||||
"@element-plus/icons-vue" "^2.0.6"
|
|
||||||
"@floating-ui/dom" "^0.5.4"
|
|
||||||
"@popperjs/core" "npm:@sxzz/popperjs-es@^2.11.7"
|
|
||||||
"@types/lodash" "^4.14.182"
|
|
||||||
"@types/lodash-es" "^4.17.6"
|
|
||||||
"@vueuse/core" "^8.7.5"
|
|
||||||
async-validator "^4.2.5"
|
|
||||||
dayjs "^1.11.3"
|
|
||||||
escape-html "^1.0.3"
|
|
||||||
lodash "^4.17.21"
|
|
||||||
lodash-es "^4.17.21"
|
|
||||||
lodash-unified "^1.0.2"
|
|
||||||
memoize-one "^6.0.0"
|
|
||||||
normalize-wheel-es "^1.2.0"
|
|
||||||
|
|
||||||
element-plus@^2.2.12:
|
element-plus@^2.2.12:
|
||||||
version "2.2.12"
|
version "2.2.12"
|
||||||
resolved "https://registry.npmjs.org/element-plus/-/element-plus-2.2.12.tgz#b6c4e298e02ba9b904d70daa54def27b2de8c43c"
|
resolved "https://registry.npmjs.org/element-plus/-/element-plus-2.2.12.tgz#b6c4e298e02ba9b904d70daa54def27b2de8c43c"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user