xiaoma hace 3 años
padre
commit
314f399cfc

+ 8 - 0
CHANGELOG.md

@@ -2,6 +2,14 @@
 
 ## Pending
 
+## 1.3.5 (2023-02-08)
+
+- 🌟 新增 `项目配置` 开关
+- 🌟 新增 `添加角色` 页面模板
+- 🌟 新增 `BasicForm` 支持 `setSchema` 方法
+- 💎 新增 `@types/lodash-es` 移除 `@types/lodash` 依赖
+- `依赖升级`
+
 ## 1.3.4 (2022-12-12)
 
 - 🌟 新增 `env.test` 环境打包配置

+ 2 - 3
package.json

@@ -1,6 +1,6 @@
 {
   "name": "naive-admin-element-tenant",
-  "version": "1.0.0",
+  "version": "1.3.5",
   "author": {
     "name": "Ahjung",
     "email": "735878602@qq.com",
@@ -45,7 +45,6 @@
     "echarts": "^5.3.3",
     "element-plus": "^2.2.26",
     "element-resize-detector": "^1.2.4",
-    "lodash": "^4.17.21",
     "lodash-es": "^4.17.21",
     "mockjs": "^1.1.0",
     "nprogress": "^0.2.0",
@@ -65,7 +64,7 @@
     "@commitlint/config-conventional": "^17.0.3",
     "@types/element-resize-detector": "^1.1.3",
     "@types/intro.js": "^3.0.2",
-    "@types/lodash": "^4.14.182",
+    "@types/lodash-es": "^4.17.6",
     "@types/node": "^17.0.45",
     "@types/qrcode": "^1.4.2",
     "@typescript-eslint/eslint-plugin": "^5.30.7",

+ 2 - 5
pnpm-lock.yaml

@@ -6,7 +6,7 @@ specifiers:
   '@element-plus/icons-vue': ^2.0.9
   '@types/element-resize-detector': ^1.1.3
   '@types/intro.js': ^3.0.2
-  '@types/lodash': ^4.14.182
+  '@types/lodash-es': ^4.17.6
   '@types/node': ^17.0.45
   '@types/qrcode': ^1.4.2
   '@typescript-eslint/eslint-plugin': ^5.30.7
@@ -43,7 +43,6 @@ specifiers:
   gh-pages: ^4.0.0
   husky: ^8.0.1
   lint-staged: ^13.0.3
-  lodash: ^4.17.21
   lodash-es: ^4.17.21
   mockjs: ^1.1.0
   nprogress: ^0.2.0
@@ -96,7 +95,6 @@ dependencies:
   echarts: 5.3.3
   element-plus: 2.2.26_vue@3.2.45
   element-resize-detector: 1.2.4
-  lodash: 4.17.21
   lodash-es: 4.17.21
   mockjs: 1.1.0
   nprogress: 0.2.0
@@ -116,7 +114,7 @@ devDependencies:
   '@commitlint/config-conventional': 17.0.3
   '@types/element-resize-detector': 1.1.3
   '@types/intro.js': 3.0.2
-  '@types/lodash': 4.14.182
+  '@types/lodash-es': 4.17.6
   '@types/node': 17.0.45
   '@types/qrcode': 1.4.2
   '@typescript-eslint/eslint-plugin': 5.30.7_6wltbjakwuqm7awqswigmiuhd4
@@ -952,7 +950,6 @@ packages:
     resolution: {integrity: sha512-R+zTeVUKDdfoRxpAryaQNRKk3105Rrgx2CFRClIgRGaqDTdjsm8h6IYA8ir584W3ePzkZfst5xIgDwYrlh9HLg==}
     dependencies:
       '@types/lodash': 4.14.182
-    dev: false
 
   /@types/lodash/4.14.182:
     resolution: {integrity: sha512-/THyiqyQAP9AfARo4pF+aCGcyiQ94tX/Is2I7HofNRqoYLgN1PBoOWu2/zTA5zMxzP5EFutMtWtGAFRKUe961Q==}

+ 5 - 0
src/components/Form/src/hooks/useForm.ts

@@ -85,6 +85,11 @@ export function useForm(props?: Props): UseFormReturnType {
     setLoadingSub: (value: boolean) => {
       loadedRef.value = value;
     },
+
+    setSchema: async (values) => {
+      const form = await getForm();
+      form.setSchema(values);
+    },
   };
 
   return [register, methods];

+ 1 - 1
src/components/Form/src/types/form.ts

@@ -63,7 +63,7 @@ export interface FormProps {
 export interface FormActionType {
   submit: () => Promise<any>;
   setProps: (formProps: Partial<FormProps>) => Promise<void>;
-  setSchema?: (schemaProps: Partial<FormSchema>) => Promise<void>;
+  setSchema: (schemaProps: Partial<FormSchema>) => Promise<void>;
   setFieldsValue: (values: Recordable) => void;
   clearValidate: (name?: string | string[]) => Promise<void>;
   getFieldsValue: () => Recordable;

+ 3 - 0
src/hooks/setting/useProjectSetting.ts

@@ -30,6 +30,8 @@ export function useProjectSetting() {
 
   const getMenuMinWidth = computed(() => projectStore.menuSetting.minMenuWidth);
 
+  const getIsProjectSetting = computed(() => projectStore.isProjectSetting);
+
   return {
     getNavMode,
     getNavTheme,
@@ -44,5 +46,6 @@ export function useProjectSetting() {
     getPageAnimateType,
     getMenuWidth,
     getMenuMinWidth,
+    getIsProjectSetting,
   };
 }

+ 9 - 6
src/layout/index.vue

@@ -65,13 +65,15 @@
   </div>
 
   <!--项目配置-->
-  <ProjectSetting ref="drawerSetting" /> -->
+  <template v-if="getIsProjectSetting">
+    <ProjectSetting ref="drawerSetting" />
 
-  <div class="shadow-lg circular" @click="openSetting">
-    <el-icon class="el-input__icon" :size="20">
-      <SettingOutlined class="transition ease-in-out delay-150 transform hover:animate-spin" />
-    </el-icon>
-  </div>
+    <div class="shadow-lg circular" @click="openSetting">
+      <el-icon class="el-input__icon" :size="20">
+        <SettingOutlined class="transition ease-in-out delay-150 transform hover:animate-spin" />
+      </el-icon>
+    </div>
+  </template>
 </template>
 
 <script lang="ts" setup>
@@ -99,6 +101,7 @@
     getHeaderSetting,
     getMenuSetting,
     getMultiTabsSetting,
+    getIsProjectSetting,
   } = useProjectSetting();
 
   const settingStore = useProjectSettingStore();

+ 2 - 0
src/settings/projectSetting.ts

@@ -56,5 +56,7 @@ const setting = {
   isPageAnimate: true,
   //路由动画类型 默认消退
   pageAnimateType: 'fade',
+  //显示项目配置
+  isProjectSetting: true,
 };
 export default setting;

+ 6 - 0
src/store/modules/projectSetting.ts

@@ -21,6 +21,7 @@ const {
   permissionMode,
   isPageAnimate,
   pageAnimateType,
+  isProjectSetting,
 } = projectSetting;
 
 interface ProjectSettingState {
@@ -35,6 +36,7 @@ interface ProjectSettingState {
   permissionMode: string; //权限模式
   isPageAnimate: boolean; //是否开启路由动画
   pageAnimateType: string; //路由动画类型
+  isProjectSetting: boolean; //显示项目配置
 }
 
 export const useProjectSettingStore = defineStore({
@@ -51,6 +53,7 @@ export const useProjectSettingStore = defineStore({
     permissionMode,
     isPageAnimate,
     pageAnimateType,
+    isProjectSetting,
   }),
   getters: {
     getNavMode(): string {
@@ -86,6 +89,9 @@ export const useProjectSettingStore = defineStore({
     getPageAnimateType(): string {
       return this.pageAnimateType;
     },
+    getIsProjectSetting(): boolean {
+      return this.isProjectSetting;
+    },
   },
   actions: {
     setNavTheme(value: string): void {

+ 5 - 1
src/utils/http/axios/index.ts

@@ -159,7 +159,11 @@ const transform: AxiosTransform = {
     } else {
       if (!isString(params)) {
         formatDate && formatRequestDate(params);
-        if (Reflect.has(config, 'data') && config.data && Object.keys(config.data).length > 0) {
+        if (
+          Reflect.has(config, 'data') &&
+          config.data &&
+          (Object.keys(config.data).length > 0 || config.data instanceof FormData)
+        ) {
           config.data = data;
           config.params = params;
         } else {