mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2025-12-13 06:02:49 +00:00
优化
This commit is contained in:
parent
d31c65d4cb
commit
1cfac24175
@ -1,5 +1,5 @@
|
|||||||
import { defineComponent, h, nextTick, toRef, watch } from "vue";
|
import { defineComponent, h, nextTick, toRef, watch } from "vue";
|
||||||
import { cloneDeep, isBoolean } from "lodash-es";
|
import { cloneDeep, get, isBoolean } from "lodash-es";
|
||||||
import { useAction, useForm, usePlugins, useTabs } from "./helper";
|
import { useAction, useForm, usePlugins, useTabs } from "./helper";
|
||||||
import { useBrowser, useConfig, useElApi, useRefs } from "../../hooks";
|
import { useBrowser, useConfig, useElApi, useRefs } from "../../hooks";
|
||||||
import { getValue, merge } from "../../utils";
|
import { getValue, merge } from "../../utils";
|
||||||
@ -170,7 +170,7 @@ export default defineComponent({
|
|||||||
if (e.hook) {
|
if (e.hook) {
|
||||||
formHook.submit({
|
formHook.submit({
|
||||||
...e,
|
...e,
|
||||||
value: e.prop ? d[e.prop] : undefined,
|
value: e.prop ? get(d, e.prop) : undefined,
|
||||||
form: d
|
form: d
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -283,7 +283,7 @@ export default defineComponent({
|
|||||||
// hook 绑定值
|
// hook 绑定值
|
||||||
formHook.bind({
|
formHook.bind({
|
||||||
...e,
|
...e,
|
||||||
value: form[e.prop] !== undefined ? form[e.prop] : cloneDeep(e.value),
|
value: get(form, e.prop) !== undefined ? get(form, e.prop) : cloneDeep(e.value),
|
||||||
form
|
form
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
6925
pnpm-lock.yaml
generated
6925
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -115,6 +115,7 @@ import MenuImp from './components/imp.vue';
|
|||||||
import MenuExp from './components/exp.vue';
|
import MenuExp from './components/exp.vue';
|
||||||
import AutoMenu from '/$/helper/components/auto-menu/index.vue';
|
import AutoMenu from '/$/helper/components/auto-menu/index.vue';
|
||||||
import AutoPerms from '/$/helper/components/auto-perms/index.vue';
|
import AutoPerms from '/$/helper/components/auto-perms/index.vue';
|
||||||
|
import { reactive } from 'vue';
|
||||||
|
|
||||||
interface Item extends Eps.BaseSysMenuEntity {
|
interface Item extends Eps.BaseSysMenuEntity {
|
||||||
children?: Item[];
|
children?: Item[];
|
||||||
@ -125,6 +126,26 @@ interface Item extends Eps.BaseSysMenuEntity {
|
|||||||
const { service, mitt } = useCool();
|
const { service, mitt } = useCool();
|
||||||
const { menu } = useStore();
|
const { menu } = useStore();
|
||||||
|
|
||||||
|
const options = reactive({
|
||||||
|
type: [
|
||||||
|
{
|
||||||
|
label: '目录',
|
||||||
|
value: 0,
|
||||||
|
type: 'warning'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '菜单',
|
||||||
|
value: 1,
|
||||||
|
type: 'success'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '权限',
|
||||||
|
value: 2,
|
||||||
|
type: 'danger'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
// cl-table
|
// cl-table
|
||||||
const Table = useTable({
|
const Table = useTable({
|
||||||
contextMenu: [
|
contextMenu: [
|
||||||
@ -176,23 +197,7 @@ const Table = useTable({
|
|||||||
prop: 'type',
|
prop: 'type',
|
||||||
label: '类型',
|
label: '类型',
|
||||||
width: 100,
|
width: 100,
|
||||||
dict: [
|
dict: options.type
|
||||||
{
|
|
||||||
label: '目录',
|
|
||||||
value: 0,
|
|
||||||
type: 'warning'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '菜单',
|
|
||||||
value: 1,
|
|
||||||
type: 'success'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '权限',
|
|
||||||
value: 2,
|
|
||||||
type: 'danger'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'router',
|
prop: 'router',
|
||||||
@ -251,20 +256,7 @@ const Upsert = useUpsert({
|
|||||||
required: true,
|
required: true,
|
||||||
component: {
|
component: {
|
||||||
name: 'el-radio-group',
|
name: 'el-radio-group',
|
||||||
options: [
|
options: options.type
|
||||||
{
|
|
||||||
label: '目录',
|
|
||||||
value: 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '菜单',
|
|
||||||
value: 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '权限',
|
|
||||||
value: 2
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -266,11 +266,11 @@ const Upsert = useUpsert({
|
|||||||
name: 'el-radio-group',
|
name: 'el-radio-group',
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
label: '开启',
|
label: '启用',
|
||||||
value: 1
|
value: 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '关闭',
|
label: '禁用',
|
||||||
value: 0
|
value: 0
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@ -57,7 +57,21 @@
|
|||||||
<template #default="{ data }">
|
<template #default="{ data }">
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<component :is="data.icon" v-if="data.icon" />
|
<component :is="data.icon" v-if="data.icon" />
|
||||||
<span>{{ data[tree.props.label] }}</span>
|
|
||||||
|
<slot
|
||||||
|
name="item-name"
|
||||||
|
:item="data"
|
||||||
|
:selected="selected"
|
||||||
|
>
|
||||||
|
<el-text truncated>
|
||||||
|
{{ data[tree.props.label] }}
|
||||||
|
{{
|
||||||
|
isEmpty(data[tree.props.children])
|
||||||
|
? ``
|
||||||
|
: `(${data[tree.props.children]?.length})`
|
||||||
|
}}
|
||||||
|
</el-text>
|
||||||
|
</slot>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-tree>
|
</el-tree>
|
||||||
@ -551,7 +565,8 @@ defineExpose({
|
|||||||
.item {
|
.item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
line-height: 1;
|
flex: 1;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user