From 321f21c4982c9cec198a27264d722180c79ef913 Mon Sep 17 00:00:00 2001
From: ahaos <8406649+lhailgl@user.noreply.gitee.com>
Date: 星期二, 26 十二月 2023 18:04:35 +0800
Subject: [PATCH] !73 修复全局属性找不到的问题 * Merge remote-tracking branch 'origin/dev' into dev * fix 修复全局属性找不到的问题 * fix 修复变量问题 * fix 修复变量问题 * Merge remote-tracking branch 'origin/dev' into dev * update 依赖升级 * update 依赖升级 * Merge remote-tracking branch 'origin/dev' into dev * 升级依赖 * Merge remote-tracking branch 'origin/ts' into ts * 升级依赖 * Merge branch 'dev' of gitee.com:JavaLionLi/plus-ui into ts * 升级依赖 * !61 fix: 删除重复环境变量ElUploadInstance * fix: 删除重复环境变量ElUploadInstance

---
 src/types/element.d.ts                   |   26 +++++++------
 src/views/monitor/cache/index.vue        |    3 +
 src/views/system/dept/index.vue          |    5 +-
 src/types/global.d.ts                    |    3 -
 src/views/system/user/profile/index.vue  |   11 ++++-
 src/types/axios.d.ts                     |    3 -
 src/types/module.d.ts                    |    4 +
 src/permission.ts                        |    2 -
 src/views/system/user/index.vue          |    2 
 tsconfig.json                            |    3 +
 package.json                             |    3 +
 src/layout/components/Sidebar/index.vue  |    4 +-
 src/layout/components/TopBar/search.vue  |    2 
 src/layout/components/Settings/index.vue |    2 
 14 files changed, 42 insertions(+), 31 deletions(-)

diff --git a/package.json b/package.json
index e1044d8..1395590 100644
--- a/package.json
+++ b/package.json
@@ -57,7 +57,8 @@
     "@unocss/preset-attributify": "^0.58.0",
     "@unocss/preset-icons": "^0.58.0",
     "@unocss/preset-uno": "^0.58.0",
-    "@vue/compiler-sfc": "3.3.9",
+    "@vue/compiler-sfc": "3.3.11",
+    "@vue/runtime-core": "3.3.11",
     "@vitejs/plugin-vue": "4.5.2",
     "autoprefixer": "10.4.14",
     "eslint": "8.55.0",
diff --git a/src/layout/components/Settings/index.vue b/src/layout/components/Settings/index.vue
index 89b1f4c..3082beb 100644
--- a/src/layout/components/Settings/index.vue
+++ b/src/layout/components/Settings/index.vue
@@ -126,7 +126,7 @@
 const topNavChange = (val: any) => {
   if (!val) {
     appStore.toggleSideBarHide(false);
-    permissionStore.setSidebarRouters(permissionStore.defaultRoutes);
+    permissionStore.setSidebarRouters(permissionStore.defaultRoutes as any);
   }
 };
 
diff --git a/src/layout/components/Sidebar/index.vue b/src/layout/components/Sidebar/index.vue
index a905c70..f42473a 100644
--- a/src/layout/components/Sidebar/index.vue
+++ b/src/layout/components/Sidebar/index.vue
@@ -13,7 +13,7 @@
           :collapse-transition="false"
           mode="vertical"
         >
-          <sidebar-item v-for="(r, index) in sidebarRouters" :key="r.path + index" :item="r" :base-path="r.path" />
+          <sidebar-item v-for="(route, index) in sidebarRouters" :key="route.path + index" :item="route" :base-path="route.path" />
         </el-menu>
       </transition>
     </el-scrollbar>
@@ -29,7 +29,7 @@
 import usePermissionStore from '@/store/modules/permission';
 import { RouteRecordRaw } from 'vue-router';
 
-const { proxy } = getCurrentInstance();
+const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 
 const route = useRoute();
 const appStore = useAppStore();
diff --git a/src/layout/components/TopBar/search.vue b/src/layout/components/TopBar/search.vue
index 62322a4..440b88d 100644
--- a/src/layout/components/TopBar/search.vue
+++ b/src/layout/components/TopBar/search.vue
@@ -54,7 +54,7 @@
 const openSearch = () => {
   state.menuQuery = '';
   state.isShowSearch = true;
-  state.menuList = generateRoutes(routes.value);
+  state.menuList = generateRoutes(routes.value as any);
   nextTick(() => {
     setTimeout(() => {
       layoutMenuAutocompleteRef.value.focus();
diff --git a/src/permission.ts b/src/permission.ts
index 69795f8..ef9976a 100644
--- a/src/permission.ts
+++ b/src/permission.ts
@@ -40,8 +40,6 @@
               router.addRoute(route); // 鍔ㄦ�佹坊鍔犲彲璁块棶璺敱琛�
             }
           });
-          const n = { ...to, replace: true };
-          console.log(n);
           next({ path: to.path, replace: true, params: to.params, query: to.query, hash: to.hash, name: to.name as string }); // hack鏂规硶 纭繚addRoutes宸插畬鎴�
         }
       } else {
diff --git a/src/types/axios.d.ts b/src/types/axios.d.ts
index 2451f2a..9f2c6d2 100644
--- a/src/types/axios.d.ts
+++ b/src/types/axios.d.ts
@@ -1,5 +1,4 @@
-import axios from 'axios';
-
+export {};
 declare module 'axios' {
   interface AxiosResponse<T = any> {
     code: number;
diff --git a/src/types/element.d.ts b/src/types/element.d.ts
index 6a7bdef..2087773 100644
--- a/src/types/element.d.ts
+++ b/src/types/element.d.ts
@@ -5,30 +5,32 @@
   declare type ElTableInstance = ep.TableInstance;
   declare type ElUploadInstance = ep.UploadInstance;
   declare type ElScrollbarInstance = ep.ScrollbarInstance;
+  declare type ElInputInstance = ep.InputInstance;
+  declare type ElInputNumberInstance = ep.InputNumberInstance;
+  declare type ElRadioInstance = ep.RadioInstance;
+  declare type ElRadioGroupInstance = ep.RadioGroupInstance;
+  declare type ElRadioButtonInstance = ep.RadioButtonInstance;
+  declare type ElCheckboxInstance = ep.CheckboxInstance;
+  declare type ElSwitchInstance = ep.SwitchInstance;
+  declare type ElCascaderInstance = ep.CascaderInstance;
+  declare type ElColorPickerInstance = ep.ColorPickerInstance;
+  declare type ElRateInstance = ep.RateInstance;
+  declare type ElSliderInstance = ep.SliderInstance;
+
   declare type ElTreeInstance = InstanceType<typeof ep.ElTree>;
   declare type ElTreeSelectInstance = InstanceType<typeof ep.ElTreeSelect>;
   declare type ElSelectInstance = InstanceType<typeof ep.ElSelect>;
   declare type ElCardInstance = InstanceType<typeof ep.ElCard>;
   declare type ElDialogInstance = InstanceType<typeof ep.ElDialog>;
-  declare type ElInputInstance = InstanceType<typeof ep.ElInput>;
-  declare type ElInputNumberInstance = InstanceType<typeof ep.ElInputNumber>;
-  declare type ElRadioInstance = InstanceType<typeof ep.ElRadio>;
-  declare type ElRadioGroupInstance = InstanceType<typeof ep.ElRadioGroup>;
-  declare type ElRadioButtonInstance = InstanceType<typeof ep.ElRadioButton>;
-  declare type ElCheckboxInstance = InstanceType<typeof ep.ElCheckbox>;
   declare type ElCheckboxGroupInstance = InstanceType<typeof ep.ElCheckboxGroup>;
-  declare type ElSwitchInstance = InstanceType<typeof ep.ElSwitch>;
   declare type ElDatePickerInstance = InstanceType<typeof ep.ElDatePicker>;
   declare type ElTimePickerInstance = InstanceType<typeof ep.ElTimePicker>;
   declare type ElTimeSelectInstance = InstanceType<typeof ep.ElTimeSelect>;
-  declare type ElCascaderInstance = InstanceType<typeof ep.ElCascader>;
-  declare type ElColorPickerInstance = InstanceType<typeof ep.ElColorPicker>;
-  declare type ElRateInstance = InstanceType<typeof ep.ElRate>;
-  declare type ElSliderInstance = InstanceType<typeof ep.ElSlider>;
 
   declare type TransferKey = ep.TransferKey;
   declare type CheckboxValueType = ep.CheckboxValueType;
   declare type ElFormRules = ep.FormRules;
   declare type DateModelType = ep.DateModelType;
-  declare type UploadFile = typeof ep.UploadFile;
+  declare type UploadFile = ep.UploadFile;
+
 }
diff --git a/src/types/global.d.ts b/src/types/global.d.ts
index 10cc438..17476a3 100644
--- a/src/types/global.d.ts
+++ b/src/types/global.d.ts
@@ -1,5 +1,4 @@
-import type { ComponentInternalInstance as ComponentInstance } from 'vue/runtime-core';
-import type { PropType as VuePropType } from 'vue';
+import type { PropType as VuePropType, ComponentInternalInstance as ComponentInstance } from 'vue';
 import { LanguageEnum } from '@/enums/LanguageEnum';
 
 declare global {
diff --git a/src/types/module.d.ts b/src/types/module.d.ts
index 16b1116..bc2f16b 100644
--- a/src/types/module.d.ts
+++ b/src/types/module.d.ts
@@ -5,10 +5,12 @@
 import cache from '@/plugins/cache';
 import animate from '@/animate';
 import { useDict } from '@/utils/dict';
-import handleTree, { addDateRange, selectDictLabel, selectDictLabels, parseTime } from '@/utils/ruoyi';
+import { handleTree, addDateRange, selectDictLabel, selectDictLabels, parseTime } from '@/utils/ruoyi';
 import { getConfigKey, updateConfigByKey } from '@/api/system/config';
 import { download as rd } from '@/utils/request';
 
+export {};
+
 declare module '@vue/runtime-core' {
   interface ComponentCustomProperties {
     // 鍏ㄥ眬鏂规硶澹版槑
diff --git a/src/views/monitor/cache/index.vue b/src/views/monitor/cache/index.vue
index c58f89c..81bbf2d 100644
--- a/src/views/monitor/cache/index.vue
+++ b/src/views/monitor/cache/index.vue
@@ -126,8 +126,9 @@
 <script setup name="Cache" lang="ts">
 import { getCache } from '@/api/monitor/cache';
 import * as echarts from 'echarts';
+import { CacheVO } from '@/api/monitor/cache/types';
 
-const cache = ref<any>({});
+const cache = ref<Partial<CacheVO>>({});
 const commandstats = ref();
 const usedmemory = ref();
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue
index 399114a..cd75d7b 100644
--- a/src/views/system/dept/index.vue
+++ b/src/views/system/dept/index.vue
@@ -172,7 +172,7 @@
   email: undefined,
   status: '0'
 };
-const data = reactive<PageData<DeptForm, DeptQuery>>({
+const initData: PageData<DeptForm, DeptQuery> = {
   form: { ...initFormData },
   queryParams: {
     pageNum: 1,
@@ -187,7 +187,8 @@
     email: [{ type: 'email', message: '璇疯緭鍏ユ纭殑閭鍦板潃', trigger: ['blur', 'change'] }],
     phone: [{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: '璇疯緭鍏ユ纭殑鎵嬫満鍙风爜', trigger: 'blur' }]
   }
-});
+};
+const data = reactive<PageData<DeptForm, DeptQuery>>(initData);
 
 const { queryParams, form, rules } = toRefs<PageData<DeptForm, DeptQuery>>(data);
 
diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue
index a952954..2de26a5 100644
--- a/src/views/system/user/index.vue
+++ b/src/views/system/user/index.vue
@@ -306,7 +306,7 @@
 import { globalHeaders } from '@/utils/request';
 
 const router = useRouter();
-const { proxy } = getCurrentInstance();
+const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 const { sys_normal_disable, sys_user_sex } = toRefs<any>(proxy?.useDict('sys_normal_disable', 'sys_user_sex'));
 const userList = ref<UserVO[]>();
 const loading = ref(true);
diff --git a/src/views/system/user/profile/index.vue b/src/views/system/user/profile/index.vue
index 75e1fde..ae8fa0f 100644
--- a/src/views/system/user/profile/index.vue
+++ b/src/views/system/user/profile/index.vue
@@ -27,7 +27,7 @@
               </li>
               <li class="list-group-item">
                 <svg-icon icon-class="tree" />鎵�灞為儴闂�
-                <div v-if="state.user.dept" class="pull-right">{{ state.user.dept.deptName }} / {{ state.postGroup }}</div>
+                <div v-if="state.user.dept" class="pull-right">{{ state.user.dept?.deptName }} / {{ state.postGroup }}</div>
               </li>
               <li class="list-group-item">
                 <svg-icon icon-class="peoples" />鎵�灞炶鑹�
@@ -72,9 +72,16 @@
 import ThirdParty from './thirdParty.vue';
 import { getAuthList } from '@/api/system/social/auth';
 import { getUserProfile } from '@/api/system/user';
+import { UserVO } from '@/api/system/user/types';
 
 const activeTab = ref('userinfo');
-const state = ref<Record<string, any>>({
+interface State {
+  user: Partial<UserVO>;
+  roleGroup: string;
+  postGroup: string;
+  auths: any;
+}
+const state = ref<State>({
   user: {},
   roleGroup: '',
   postGroup: '',
diff --git a/tsconfig.json b/tsconfig.json
index a2f57c5..bb287e9 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -4,8 +4,9 @@
     "module": "esnext",
 //    "useDefineForClassFields": true,
     "moduleResolution": "bundler",
-    "strict": false,
+    "strict": true,
     "jsx": "preserve",
+    "strictNullChecks": false,
     "sourceMap": true,
     "resolveJsonModule": true,
     "esModuleInterop": true,

--
Gitblit v1.9.3