From eeebb8d40266d614c14133b96bf40c57e30424ea Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期二, 16 七月 2024 11:47:35 +0800
Subject: [PATCH] feat:默认选中当前部门

---
 src/api/department.js                          |    2 ++
 src/views/exam/personalRandomTemplate/edit.vue |    5 +++++
 src/views/exam/paper/edit.vue                  |    5 +++++
 3 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/api/department.js b/src/api/department.js
index 6f52034..08fbe86 100644
--- a/src/api/department.js
+++ b/src/api/department.js
@@ -15,6 +15,8 @@
   getDeptUserList: id => get('/api/admin/department/' + id + '/user-list'),
   // 鑾峰彇褰撳墠鐢ㄦ埛绠$悊鐨勯儴闂�
   getDeptAdmins: id => get('/api/admin/department/getDeptAdmins'),
+  // 鑾峰彇褰撳墠鐢ㄦ埛绠$悊鐨勯儴闂紙涓嶅垎灞傜骇鍏崇郴锛�
+  getCurrentDeptId: id => get('/api/admin/department/getCurrentDeptId'),
   // 淇敼閮ㄩ棬绠$悊鍛�
   updateDeptAdmin: data => post('/api/admin/department/update-admin', data),
   cascaderList: () => get('/api/admin/department/cascader')
diff --git a/src/views/exam/paper/edit.vue b/src/views/exam/paper/edit.vue
index b9c2e96..d65df94 100644
--- a/src/views/exam/paper/edit.vue
+++ b/src/views/exam/paper/edit.vue
@@ -282,6 +282,11 @@
     };
   },
   created() {
+    departmentApi.getCurrentDeptId().then(res => {
+      if (res.response && res.response[0]) {
+        this.form.deptId = res.response[0];
+      }
+    });
     let id = this.$route.query.id;
     let _this = this;
     this.initSubject(function () {
diff --git a/src/views/exam/personalRandomTemplate/edit.vue b/src/views/exam/personalRandomTemplate/edit.vue
index 7fc5262..4ab71d1 100644
--- a/src/views/exam/personalRandomTemplate/edit.vue
+++ b/src/views/exam/personalRandomTemplate/edit.vue
@@ -309,6 +309,11 @@
     });
   },
   async mounted() {
+    departmentApi.getCurrentDeptId().then(res => {
+      if (res.response && res.response[0]) {
+        this.form.deptId = res.response[0];
+      }
+    });
 
     let id = this.$route.query.id;
     let _this = this;

--
Gitblit v1.8.0