Merge branch 'dev' of https://gitee.com/dapppp/ruoyi-plus-vben5 into warmflow
This commit is contained in:
@@ -48,7 +48,12 @@ async function setupMenuSelect() {
|
||||
item.menuName = $t(item.menuName);
|
||||
});
|
||||
// const folderArray = menuArray.filter((item) => item.menuType === 'M');
|
||||
const menuTree = listToTree(menuArray, { id: 'menuId', pid: 'parentId' });
|
||||
/**
|
||||
* 这里需要过滤掉按钮类型
|
||||
* 不允许在按钮下添加数据
|
||||
*/
|
||||
const filteredList = menuArray.filter((item) => item.menuType !== 'F');
|
||||
const menuTree = listToTree(filteredList, { id: 'menuId', pid: 'parentId' });
|
||||
const fullMenuTree = [
|
||||
{
|
||||
menuId: 0,
|
||||
|
@@ -128,6 +128,12 @@ export const drawerSchema: FormSchemaGetter = () => [
|
||||
fieldName: 'domain',
|
||||
label: '自定义域名',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'tip',
|
||||
label: '占位作为提示使用',
|
||||
hideLabel: true,
|
||||
},
|
||||
{
|
||||
component: 'Divider',
|
||||
componentProps: {
|
||||
|
@@ -5,6 +5,8 @@ import { useVbenDrawer } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
|
||||
import { Alert } from 'ant-design-vue';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import {
|
||||
ossConfigAdd,
|
||||
@@ -79,7 +81,17 @@ async function handleCancel() {
|
||||
|
||||
<template>
|
||||
<BasicDrawer :close-on-click-modal="false" :title="title" class="w-[650px]">
|
||||
<BasicForm />
|
||||
<BasicForm>
|
||||
<template #tip>
|
||||
<div class="ml-7 w-full">
|
||||
<Alert
|
||||
message="私有桶使用自定义域名无法预览, 但可以正常上传/下载"
|
||||
show-icon
|
||||
type="warning"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</BasicForm>
|
||||
</BasicDrawer>
|
||||
</template>
|
||||
|
||||
|
@@ -19,10 +19,10 @@ import {
|
||||
} from 'ant-design-vue';
|
||||
|
||||
import {
|
||||
addSortParams,
|
||||
useVbenVxeGrid,
|
||||
vxeCheckboxChecked,
|
||||
type VxeGridProps,
|
||||
vxeSortEvent,
|
||||
} from '#/adapter/vxe-table';
|
||||
import { configInfoByKey } from '#/api/system/config';
|
||||
import { ossDownload, ossList, ossRemove } from '#/api/system/oss';
|
||||
@@ -66,12 +66,14 @@ const gridOptions: VxeGridProps = {
|
||||
pagerConfig: {},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues = {}) => {
|
||||
query: async ({ page, sorts }, formValues = {}) => {
|
||||
const params: any = {
|
||||
pageNum: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
};
|
||||
// 添加排序参数
|
||||
addSortParams(params, sorts);
|
||||
return await ossList(params);
|
||||
},
|
||||
},
|
||||
@@ -94,7 +96,8 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
gridEvents: {
|
||||
sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams),
|
||||
// 排序 重新请求接口
|
||||
sortChange: () => tableApi.query(),
|
||||
},
|
||||
});
|
||||
|
||||
@@ -134,8 +137,8 @@ function handleToSettings() {
|
||||
|
||||
const preview = ref(false);
|
||||
onMounted(async () => {
|
||||
const resp = await configInfoByKey('sys.oss.previewListResource');
|
||||
preview.value = Boolean(resp);
|
||||
const previewStr = await configInfoByKey('sys.oss.previewListResource');
|
||||
preview.value = previewStr === 'true';
|
||||
});
|
||||
|
||||
function isImageFile(ext: string) {
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import type { FormSchemaGetter } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import { DictEnum } from '@vben/constants';
|
||||
@@ -5,7 +6,6 @@ import { getPopupContainer } from '@vben/utils';
|
||||
|
||||
import { Tag } from 'ant-design-vue';
|
||||
|
||||
import { type FormSchemaGetter } from '#/adapter/form';
|
||||
import { getDictOptions } from '#/utils/dict';
|
||||
|
||||
/**
|
||||
@@ -17,6 +17,7 @@ export const authScopeOptions = [
|
||||
{ color: 'orange', label: '本部门数据权限', value: '3' },
|
||||
{ color: 'cyan', label: '本部门及以下数据权限', value: '4' },
|
||||
{ color: 'error', label: '仅本人数据权限', value: '5' },
|
||||
{ color: 'default', label: '部门及以下或本人数据权限', value: '6' },
|
||||
];
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
|
@@ -1,16 +1,14 @@
|
||||
<script setup lang="ts">
|
||||
import type { VbenFormProps } from '@vben/common-ui';
|
||||
import type { Recordable } from '@vben/types';
|
||||
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import { computed } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import { useAccess } from '@vben/access';
|
||||
import {
|
||||
Page,
|
||||
useVbenDrawer,
|
||||
useVbenModal,
|
||||
type VbenFormProps,
|
||||
} from '@vben/common-ui';
|
||||
import { Page, useVbenDrawer, useVbenModal } from '@vben/common-ui';
|
||||
import { getVxePopupContainer } from '@vben/utils';
|
||||
|
||||
import {
|
||||
@@ -22,11 +20,7 @@ import {
|
||||
Space,
|
||||
} from 'ant-design-vue';
|
||||
|
||||
import {
|
||||
useVbenVxeGrid,
|
||||
vxeCheckboxChecked,
|
||||
type VxeGridProps,
|
||||
} from '#/adapter/vxe-table';
|
||||
import { useVbenVxeGrid, vxeCheckboxChecked } from '#/adapter/vxe-table';
|
||||
import {
|
||||
roleChangeStatus,
|
||||
roleExport,
|
||||
|
@@ -1,5 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
import type { MenuOption } from '#/api/system/menu/model';
|
||||
|
||||
import { computed, nextTick, ref } from 'vue';
|
||||
|
||||
import { useVbenDrawer } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
@@ -8,7 +10,7 @@ import { cloneDeep, eachTree } from '@vben/utils';
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { menuTreeSelect, roleMenuTreeSelect } from '#/api/system/menu';
|
||||
import { roleAdd, roleInfo, roleUpdate } from '#/api/system/role';
|
||||
import { TreeSelectPanel } from '#/components/tree';
|
||||
import { MenuSelectTable } from '#/components/tree';
|
||||
|
||||
import { drawerSchema } from './data';
|
||||
|
||||
@@ -32,11 +34,10 @@ const [BasicForm, formApi] = useVbenForm({
|
||||
wrapperClass: 'grid-cols-2 gap-x-4',
|
||||
});
|
||||
|
||||
const menuTree = ref<any[]>([]);
|
||||
const menuTree = ref<MenuOption[]>([]);
|
||||
async function setupMenuTree(id?: number | string) {
|
||||
if (id) {
|
||||
const resp = await roleMenuTreeSelect(id);
|
||||
formApi.setFieldValue('menuIds', resp.checkedKeys);
|
||||
const menus = resp.menus;
|
||||
// i18n处理
|
||||
eachTree(menus, (node) => {
|
||||
@@ -44,15 +45,20 @@ async function setupMenuTree(id?: number | string) {
|
||||
});
|
||||
// 设置菜单信息
|
||||
menuTree.value = resp.menus;
|
||||
// keys依赖于menu 需要先加载menu
|
||||
await nextTick();
|
||||
await formApi.setFieldValue('menuIds', resp.checkedKeys);
|
||||
} else {
|
||||
const resp = await menuTreeSelect();
|
||||
formApi.setFieldValue('menuIds', []);
|
||||
// i18n处理
|
||||
eachTree(resp, (node) => {
|
||||
node.label = $t(node.label);
|
||||
});
|
||||
// 设置菜单信息
|
||||
menuTree.value = resp;
|
||||
// keys依赖于menu 需要先加载menu
|
||||
await nextTick();
|
||||
await formApi.setFieldValue('menuIds', []);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,11 +84,7 @@ const [BasicDrawer, drawerApi] = useVbenDrawer({
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* 这里拿到的是一个数组ref
|
||||
*/
|
||||
const menuSelectRef = ref();
|
||||
|
||||
const menuSelectRef = ref<InstanceType<typeof MenuSelectTable>>();
|
||||
async function handleConfirm() {
|
||||
try {
|
||||
drawerApi.drawerLoading(true);
|
||||
@@ -91,7 +93,7 @@ async function handleConfirm() {
|
||||
return;
|
||||
}
|
||||
// 这个用于提交
|
||||
const menuIds = menuSelectRef.value?.[0]?.getCheckedKeys() ?? [];
|
||||
const menuIds = menuSelectRef.value?.getCheckedKeys?.() ?? [];
|
||||
// formApi.getValues拿到的是一个readonly对象,不能直接修改,需要cloneDeep
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
data.menuIds = menuIds;
|
||||
@@ -120,17 +122,19 @@ function handleMenuCheckStrictlyChange(value: boolean) {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BasicDrawer :close-on-click-modal="false" :title="title" class="w-[600px]">
|
||||
<BasicDrawer :close-on-click-modal="false" :title="title" class="w-[800px]">
|
||||
<BasicForm>
|
||||
<template #menuIds="slotProps">
|
||||
<!-- check-strictly为readonly 不能通过v-model绑定 -->
|
||||
<TreeSelectPanel
|
||||
ref="menuSelectRef"
|
||||
v-bind="slotProps"
|
||||
:check-strictly="formApi.form.values.menuCheckStrictly"
|
||||
:tree-data="menuTree"
|
||||
@check-strictly-change="handleMenuCheckStrictlyChange"
|
||||
/>
|
||||
<div class="h-[600px] w-full">
|
||||
<!-- association为readonly 不能通过v-model绑定 -->
|
||||
<MenuSelectTable
|
||||
ref="menuSelectRef"
|
||||
:checked-keys="slotProps.value"
|
||||
:association="formApi.form.values.menuCheckStrictly"
|
||||
:menus="menuTree"
|
||||
@update:association="handleMenuCheckStrictlyChange"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</BasicForm>
|
||||
</BasicDrawer>
|
||||
|
@@ -1,23 +1,24 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
import type { MenuOption } from '#/api/system/menu/model';
|
||||
|
||||
import { computed, nextTick, ref } from 'vue';
|
||||
|
||||
import { useVbenDrawer } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep, eachTree, listToTree } from '@vben/utils';
|
||||
import { cloneDeep, eachTree } from '@vben/utils';
|
||||
|
||||
import { omit } from 'lodash-es';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { menuList, tenantPackageMenuTreeSelect } from '#/api/system/menu';
|
||||
import { menuTreeSelect, tenantPackageMenuTreeSelect } from '#/api/system/menu';
|
||||
import {
|
||||
packageAdd,
|
||||
packageInfo,
|
||||
packageUpdate,
|
||||
} from '#/api/system/tenant-package';
|
||||
import { TreeSelectPanel } from '#/components/tree';
|
||||
import { MenuSelectTable } from '#/components/tree';
|
||||
|
||||
import { drawerSchema } from './data';
|
||||
import TreeItem from './tree-item';
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
@@ -36,25 +37,34 @@ const [BasicForm, formApi] = useVbenForm({
|
||||
wrapperClass: 'grid-cols-2',
|
||||
});
|
||||
|
||||
async function setupMenuTreeSelect(id?: number | string) {
|
||||
const menuTree = ref<MenuOption[]>([]);
|
||||
async function setupMenuTree(id?: number | string) {
|
||||
if (id) {
|
||||
const resp = await tenantPackageMenuTreeSelect(id);
|
||||
const menus = resp.menus;
|
||||
// i18n处理
|
||||
eachTree(menus, (node) => {
|
||||
node.label = $t(node.label);
|
||||
});
|
||||
// 设置菜单信息
|
||||
menuTree.value = resp.menus;
|
||||
// keys依赖于menu 需要先加载menu
|
||||
await nextTick();
|
||||
await formApi.setFieldValue('menuIds', resp.checkedKeys);
|
||||
} else {
|
||||
const resp = await menuTreeSelect();
|
||||
// i18n处理
|
||||
eachTree(resp, (node) => {
|
||||
node.label = $t(node.label);
|
||||
});
|
||||
// 设置菜单信息
|
||||
menuTree.value = resp;
|
||||
// keys依赖于menu 需要先加载menu
|
||||
await nextTick();
|
||||
await formApi.setFieldValue('menuIds', []);
|
||||
}
|
||||
}
|
||||
|
||||
const menuTree = ref<any[]>([]);
|
||||
async function setupMenuTree() {
|
||||
const resp = await menuList();
|
||||
const treeData = listToTree(resp, { id: 'menuId' });
|
||||
// i18n处理
|
||||
eachTree(treeData, (node) => {
|
||||
node.menuName = $t(node.menuName);
|
||||
});
|
||||
// 设置菜单信息
|
||||
menuTree.value = treeData;
|
||||
}
|
||||
|
||||
const [BasicDrawer, drawerApi] = useVbenDrawer({
|
||||
onCancel: handleCancel,
|
||||
onConfirm: handleConfirm,
|
||||
@@ -72,20 +82,14 @@ const [BasicDrawer, drawerApi] = useVbenDrawer({
|
||||
// 通过setupMenuTreeSelect设置
|
||||
await formApi.setValues(omit(record, ['menuIds']));
|
||||
}
|
||||
/**
|
||||
* 加载菜单树和已勾选菜单
|
||||
*/
|
||||
await Promise.all([setupMenuTree(), setupMenuTreeSelect(id)]);
|
||||
// init菜单 注意顺序要放在赋值record之后 内部watch会依赖record
|
||||
await setupMenuTree(id);
|
||||
|
||||
drawerApi.drawerLoading(false);
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* 这里拿到的是一个数组ref
|
||||
*/
|
||||
const menuSelectRef = ref();
|
||||
|
||||
const menuSelectRef = ref<InstanceType<typeof MenuSelectTable>>();
|
||||
async function handleConfirm() {
|
||||
try {
|
||||
drawerApi.drawerLoading(true);
|
||||
@@ -94,7 +98,7 @@ async function handleConfirm() {
|
||||
return;
|
||||
}
|
||||
// 这个用于提交
|
||||
const menuIds = menuSelectRef.value?.[0]?.getCheckedKeys() ?? [];
|
||||
const menuIds = menuSelectRef.value?.getCheckedKeys?.() ?? [];
|
||||
// formApi.getValues拿到的是一个readonly对象,不能直接修改,需要cloneDeep
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
data.menuIds = menuIds;
|
||||
@@ -123,22 +127,19 @@ function handleMenuCheckStrictlyChange(value: boolean) {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BasicDrawer :close-on-click-modal="false" :title="title" class="w-[600px]">
|
||||
<BasicDrawer :close-on-click-modal="false" :title="title" class="w-[800px]">
|
||||
<BasicForm>
|
||||
<template #menuIds="slotProps">
|
||||
<TreeSelectPanel
|
||||
ref="menuSelectRef"
|
||||
v-bind="slotProps"
|
||||
:check-strictly="formApi.form.values.menuCheckStrictly"
|
||||
:expand-all-on-init="false"
|
||||
:field-names="{ title: 'menuName', key: 'menuId' }"
|
||||
:tree-data="menuTree"
|
||||
@check-strictly-change="handleMenuCheckStrictlyChange"
|
||||
>
|
||||
<template #title="data">
|
||||
<TreeItem :data="data" />
|
||||
</template>
|
||||
</TreeSelectPanel>
|
||||
<div class="h-[600px] w-full">
|
||||
<!-- association为readonly 不能通过v-model绑定 -->
|
||||
<MenuSelectTable
|
||||
ref="menuSelectRef"
|
||||
:checked-keys="slotProps.value"
|
||||
:association="formApi.form.values.menuCheckStrictly"
|
||||
:menus="menuTree"
|
||||
@update:association="handleMenuCheckStrictlyChange"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</BasicForm>
|
||||
</BasicDrawer>
|
||||
|
@@ -1,14 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import type { Role } from '#/api/system/user/model';
|
||||
|
||||
import { computed, h, ref } from 'vue';
|
||||
|
||||
import { useVbenDrawer } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { addFullName, cloneDeep, getPopupContainer } from '@vben/utils';
|
||||
|
||||
import { Tag } from 'ant-design-vue';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { configInfoByKey } from '#/api/system/config';
|
||||
import { postOptionSelect } from '#/api/system/post';
|
||||
@@ -19,6 +11,11 @@ import {
|
||||
userUpdate,
|
||||
} from '#/api/system/user';
|
||||
import { authScopeOptions } from '#/views/system/role/data';
|
||||
import { useVbenDrawer } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { addFullName, cloneDeep, getPopupContainer } from '@vben/utils';
|
||||
import { Tag } from 'ant-design-vue';
|
||||
import { computed, h, onMounted, ref } from 'vue';
|
||||
|
||||
import { drawerSchema } from './data';
|
||||
|
||||
@@ -117,13 +114,20 @@ async function setupDeptSelect() {
|
||||
]);
|
||||
}
|
||||
|
||||
const defaultPassword = ref('');
|
||||
onMounted(async () => {
|
||||
const password = await configInfoByKey('sys.user.initPassword');
|
||||
if (password) {
|
||||
defaultPassword.value = password;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 新增时候 从参数设置获取默认密码
|
||||
*/
|
||||
async function loadDefaultPassword(update: boolean) {
|
||||
if (!update) {
|
||||
const defaultPassword = await configInfoByKey('sys.user.initPassword');
|
||||
defaultPassword && formApi.setFieldValue('password', defaultPassword);
|
||||
if (!update && defaultPassword.value) {
|
||||
formApi.setFieldValue('password', defaultPassword.value);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user