refactor: ♻️ 代码规范优化

This commit is contained in:
ray
2025-02-12 13:40:27 +08:00
parent e865b33bd9
commit cd72290d06
31 changed files with 113 additions and 120 deletions

View File

@@ -437,7 +437,7 @@ interface TreeNode {
}
const treeData = ref<TreeNode[]>([]);
const queryFormRef = ref(ElForm);
const queryFormRef = ref();
const queryParams = reactive<TablePageQuery>({
pageNum: 1,
pageSize: 10,
@@ -535,7 +535,6 @@ const initSort = () => {
ghostClass: "sortable-ghost", //拖拽样式
handle: ".sortable-handle", //拖拽区域
easing: "cubic-bezier(1, 0, 0, 1)",
onStart: (item: any) => {},
// 结束拖动事件
onEnd: (item: any) => {

View File

@@ -236,7 +236,6 @@ defineOptions({
name: "Dashboard",
inheritAttrs: false,
});
import VisitTrend from "./components/visit-trend.vue";
import router from "@/router";

View File

@@ -89,8 +89,8 @@ function back() {
}
&__return-home {
display: block;
float: left;
display: block;
width: 110px;
height: 36px;
font-size: 14px;

View File

@@ -268,7 +268,7 @@ import { Camera } from "@element-plus/icons-vue";
const userProfile = ref<UserProfileVO>({});
enum DialogType {
const enum DialogType {
ACCOUNT = "account",
PASSWORD = "password",
MOBILE = "mobile",
@@ -287,10 +287,10 @@ const mobileUpdateForm = reactive<MobileUpdateForm>({});
const emailUpdateForm = reactive<EmailUpdateForm>({});
const mobileCountdown = ref(0);
const mobileTimer = ref<NodeJS.Timeout | null>(null);
const mobileTimer = ref();
const emailCountdown = ref(0);
const emailTimer = ref<NodeJS.Timeout | null>(null);
const emailTimer = ref();
// 修改密码校验规则
const passwordChangeRules = {
@@ -466,6 +466,7 @@ const handleFileChange = async (event: Event) => {
avatar: data.url,
});
} catch (error) {
console.error("头像上传失败:" + error);
ElMessage.error("头像上传失败");
}
}

View File

@@ -137,8 +137,8 @@ defineOptions({
import ConfigAPI, { ConfigPageVO, ConfigForm, ConfigPageQuery } from "@/api/system/config";
const queryFormRef = ref(ElForm);
const dataFormRef = ref(ElForm);
const queryFormRef = ref();
const dataFormRef = ref();
const loading = ref(false);
const selectIds = ref<number[]>([]);

View File

@@ -160,8 +160,8 @@ defineOptions({
import DeptAPI, { DeptVO, DeptForm, DeptQuery } from "@/api/system/dept";
const queryFormRef = ref(ElForm);
const deptFormRef = ref(ElForm);
const queryFormRef = ref();
const deptFormRef = ref();
const loading = ref(false);
const selectIds = ref<number[]>([]);

View File

@@ -144,8 +144,8 @@ const route = useRoute();
const dictCode = ref(route.query.dictCode as string);
const queryFormRef = ref(ElForm);
const dataFormRef = ref(ElForm);
const queryFormRef = ref();
const dataFormRef = ref();
const loading = ref(false);
const ids = ref<number[]>([]);

View File

@@ -57,7 +57,7 @@
link
size="small"
icon="edit"
@click.stop="handleEditClick(scope.row.id, scope.row.name)"
@click.stop="handleEditClick(scope.row.id)"
>
编辑
</el-button>
@@ -133,8 +133,8 @@ import DictAPI, { DictPageQuery, DictPageVO, DictForm } from "@/api/system/dict"
import router from "@/router";
const queryFormRef = ref(ElForm);
const dataFormRef = ref(ElForm);
const queryFormRef = ref();
const dataFormRef = ref();
const loading = ref(false);
const ids = ref<number[]>([]);
@@ -198,7 +198,7 @@ function handleAddClick() {
*
* @param id 字典ID
*/
function handleEditClick(id: number, name: string) {
function handleEditClick(id: number) {
dialog.visible = true;
dialog.title = "修改字典";
DictAPI.getFormData(id).then((data) => {

View File

@@ -62,7 +62,7 @@ defineOptions({
import LogAPI, { LogPageVO, LogPageQuery } from "@/api/system/log";
const queryFormRef = ref(ElForm);
const queryFormRef = ref();
const loading = ref(false);
const total = ref(0);

View File

@@ -338,8 +338,8 @@ defineOptions({
import MenuAPI, { MenuQuery, MenuForm, MenuVO } from "@/api/system/menu";
import { MenuTypeEnum } from "@/enums/MenuTypeEnum";
const queryFormRef = ref(ElForm);
const menuFormRef = ref(ElForm);
const queryFormRef = ref();
const menuFormRef = ref();
const loading = ref(false);
const dialog = reactive({

View File

@@ -87,7 +87,7 @@ defineOptions({
import NoticeAPI, { NoticePageVO, NoticePageQuery } from "@/api/system/notice";
const queryFormRef = ref(ElForm);
const queryFormRef = ref();
const noticeDetailRef = ref();
const pageData = ref<NoticePageVO[]>([]);

View File

@@ -223,8 +223,8 @@ defineOptions({
import NoticeAPI, { NoticePageVO, NoticeForm, NoticePageQuery } from "@/api/system/notice";
import UserAPI from "@/api/system/user";
const queryFormRef = ref(ElForm);
const dataFormRef = ref(ElForm);
const queryFormRef = ref();
const dataFormRef = ref();
const noticeDetailRef = ref();
const loading = ref(false);

View File

@@ -211,9 +211,9 @@ defineOptions({
import RoleAPI, { RolePageVO, RoleForm, RolePageQuery } from "@/api/system/role";
import MenuAPI from "@/api/system/menu";
const queryFormRef = ref(ElForm);
const roleFormRef = ref(ElForm);
const permTreeRef = ref<InstanceType<typeof ElTree>>();
const queryFormRef = ref();
const roleFormRef = ref();
const permTreeRef = ref();
const loading = ref(false);
const ids = ref<number[]>([]);

View File

@@ -30,7 +30,7 @@ const props = defineProps({
});
const deptList = ref<OptionType[]>(); // 部门列表
const deptTreeRef = ref(ElTree); // 部门树
const deptTreeRef = ref(); // 部门树
const deptName = ref(); // 部门名称
const emits = defineEmits(["node-click"]);

View File

@@ -175,8 +175,9 @@ const handleUpload = async () => {
invalidCount.value = result.invalidCount;
validCount.value = result.validCount;
}
} catch (error) {
ElMessage.error("上传失败");
} catch (error: any) {
console.error(error);
ElMessage.error("上传失败:" + error);
}
};

View File

@@ -249,9 +249,8 @@ defineOptions({
name: "User",
inheritAttrs: false,
});
const queryFormRef = ref(ElForm);
const userFormRef = ref(ElForm);
const queryFormRef = ref();
const userFormRef = ref();
const queryParams = reactive<UserPageQuery>({
pageNum: 1,