diff --git a/components.d.ts b/components.d.ts
index 356e312..7153f90 100644
--- a/components.d.ts
+++ b/components.d.ts
@@ -13,6 +13,7 @@ declare module '@vue/runtime-core' {
ElAvatar: typeof import('element-plus/es')['ElAvatar']
ElButton: typeof import('element-plus/es')['ElButton']
ElCard: typeof import('element-plus/es')['ElCard']
+ ElCascader: typeof import('element-plus/es')['ElCascader']
ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
ElCol: typeof import('element-plus/es')['ElCol']
ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
diff --git a/src/components/table-search.vue b/src/components/table-search.vue
index e859541..ede06bf 100644
--- a/src/components/table-search.vue
+++ b/src/components/table-search.vue
@@ -19,6 +19,16 @@
>
+ cascaderChange(e, item.prop, item.showAllLevels)"
+ />
();
const resetForm = (formEl: FormInstance | undefined) => {
if (!formEl) return;
formEl.resetFields();
props.search();
+ cascaderValue.value = undefined;
+};
+const cascaderChange = (e, name, showAllLevels = true) => {
+ if (e) {
+ props.query[name] = showAllLevels ? e : e[e.length - 1];
+ } else {
+ props.query[name] = undefined;
+ }
};
diff --git a/src/store/common.ts b/src/store/common.ts
index 22760a2..41ce364 100644
--- a/src/store/common.ts
+++ b/src/store/common.ts
@@ -1,13 +1,14 @@
import { defineStore } from 'pinia';
-import { TLogin, TRoleList } from "@/api/index.d";
-import { roleList } from '@/api';
+import { TLogin, TOrg, TRoleList } from "@/api/index.d";
+import { roleList, orgAllList } from '@/api';
export const useCommonStore = defineStore('common', {
state: () => {
return {
time: new Date(),
user: {},
- roleList: []
+ roleList: [],
+ orgTree: []
};
},
getters: {},
@@ -20,6 +21,17 @@ export const useCommonStore = defineStore('common', {
this.roleList = res
})
},
+ getOrgAllList() {
+ orgAllList().then(res => {
+ this.orgTree = this.getTree(res)
+ })
+ },
+ getTree(list) {
+ list.forEach(item => {
+ item.children = list.filter(i => i.parentId === item.id)
+ });
+ return list.filter(item => item.parentId == null)
+ },
setUser(data: TLogin.IRes) {
this.user = data
},
diff --git a/src/types/form-option.ts b/src/types/form-option.ts
index 0cee5fc..afb5217 100644
--- a/src/types/form-option.ts
+++ b/src/types/form-option.ts
@@ -18,6 +18,8 @@ export interface FormOptionList {
activeText?: string;
inactiveText?: string;
required?: boolean;
+ showAllLevels?: boolean;
defalut?: any;
validator?: Function;
+ props?: any;
}
\ No newline at end of file
diff --git a/src/views/login.vue b/src/views/login.vue
index ab1cb06..6e7f637 100644
--- a/src/views/login.vue
+++ b/src/views/login.vue
@@ -57,6 +57,7 @@ const submitForm = async (formEl: FormInstance | undefined) => {
.then((res) => {
comm.setUser(res);
comm.getRoleList();
+ comm.getOrgAllList();
ElMessage({
message: "登录成功",
type: "success",
diff --git a/src/views/monitoringCenter/deviceHistory.vue b/src/views/monitoringCenter/deviceHistory.vue
index d22c014..4aee294 100644
--- a/src/views/monitoringCenter/deviceHistory.vue
+++ b/src/views/monitoringCenter/deviceHistory.vue
@@ -1,26 +1,25 @@