浏览代码

feat: 人员选择默认打开指定机构

zhangjie 9 月之前
父节点
当前提交
7aeaaae586

+ 1 - 0
src/components/ImageWatermark.vue

@@ -52,6 +52,7 @@ export default {
     loadingImg(url) {
       return new Promise((reslove, reject) => {
         const img = new Image();
+        img.crossOrigin = "";
         img.src = url;
         img.onload = () => {
           reslove(img);

+ 10 - 2
src/modules/base/components/SelectUserDialog.vue

@@ -24,13 +24,13 @@
         </div>
         <div class="user-types">
           <div
-            :class="['user-type', { 'is-active': userType === 'org' }]"
+            :class="['user-type', { 'is-active': isOrgTab }]"
             @click="switchUserType('org')"
           >
             组织架构
           </div>
           <div
-            :class="['user-type', { 'is-active': userType === 'role' }]"
+            :class="['user-type', { 'is-active': !isOrgTab }]"
             @click="switchUserType('role')"
           >
             角色
@@ -43,6 +43,8 @@
             node-key="id"
             :default-checked-keys="selectedUserIds"
             :props="defaultProps"
+            :default-expand-all="!isOrgTab"
+            :default-expanded-keys="isOrgTab ? userOrgKeys : []"
           >
             <span class="custom-tree-node" slot-scope="{ node, data }">
               <el-checkbox
@@ -138,12 +140,18 @@ export default {
       selectedRoleUserIds: [],
       selectedUserIds: [],
       selectValid: true,
+      userOrgKeys: [this.$ls.get("orgId")],
       defaultProps: {
         children: "children",
         label: "label",
       },
     };
   },
+  computed: {
+    isOrgTab() {
+      return this.userType === "org";
+    },
+  },
   methods: {
     async getOrgData() {
       const data = await organizationList();

+ 10 - 3
src/modules/exam/components/SelectQuestionTeacher.vue

@@ -28,13 +28,13 @@
           </div>
           <div class="user-types">
             <div
-              :class="['user-type', { 'is-active': userType === 'org' }]"
+              :class="['user-type', { 'is-active': isOrgTab }]"
               @click="switchUserType('org')"
             >
               组织架构
             </div>
             <div
-              :class="['user-type', { 'is-active': userType === 'course' }]"
+              :class="['user-type', { 'is-active': !isOrgTab }]"
               @click="switchUserType('course')"
             >
               课程
@@ -47,7 +47,8 @@
               node-key="id"
               :default-checked-keys="selectedUserIds"
               :props="defaultProps"
-              default-expand-all
+              :default-expand-all="!isOrgTab"
+              :default-expanded-keys="isOrgTab ? userOrgKeys : []"
             >
               <span class="custom-tree-node" slot-scope="{ node, data }">
                 <el-checkbox
@@ -141,6 +142,7 @@ export default {
       userList: [],
       selectedUsers: [],
       selectedUserIds: [],
+      userOrgKeys: [this.$ls.get("orgId")],
       defaultProps: {
         children: "children",
         label: "label",
@@ -156,6 +158,11 @@ export default {
       },
     };
   },
+  computed: {
+    isOrgTab() {
+      return this.userType === "org";
+    },
+  },
   watch: {
     courseId(val, oldval) {
       if (val !== oldval) {

+ 1 - 1
src/modules/exam/components/createExamAndPrintTask/CreateExamAndPrintTask.vue

@@ -99,7 +99,7 @@ import { examRuleDetail, flowDetailByType } from "../../../base/api";
 import { teacherSubmitTaskApply } from "../../api";
 import InfoExamTask from "./InfoExamTask";
 import InfoPrintTask from "./InfoPrintTask";
-import SelectUserDialog from "../../../base/components/SelectUserDialog";
+import SelectUserDialog from "../../../base/components/SelectUserDialog.vue";
 import { randomCode } from "@/plugins/utils";
 
 const initExamTask = {

+ 10 - 3
src/modules/mark/components/markDetail/ModifyMarkerBind.vue

@@ -27,13 +27,13 @@
           </div>
           <div class="user-types">
             <div
-              :class="['user-type', { 'is-active': userType === 'org' }]"
+              :class="['user-type', { 'is-active': isOrgTab }]"
               @click="switchUserType('org')"
             >
               组织架构
             </div>
             <div
-              :class="['user-type', { 'is-active': userType === 'course' }]"
+              :class="['user-type', { 'is-active': !isOrgTab }]"
               @click="switchUserType('course')"
             >
               课程
@@ -46,7 +46,8 @@
               node-key="id"
               :default-checked-keys="selectedUserIds"
               :props="defaultProps"
-              default-expand-all
+              :default-expand-all="!isOrgTab"
+              :default-expanded-keys="isOrgTab ? userOrgKeys : []"
             >
               <span class="custom-tree-node" slot-scope="{ node, data }">
                 <el-checkbox
@@ -143,6 +144,7 @@ export default {
       selectedUsers: [],
       disabledUserIds: [],
       selectedUserIds: [],
+      userOrgKeys: [this.$ls.get("orgId")],
       defaultProps: {
         children: "children",
         label: "label",
@@ -158,6 +160,11 @@ export default {
       },
     };
   },
+  computed: {
+    isOrgTab() {
+      return this.userType === "org";
+    },
+  },
   mounted() {
     this.getOrgData();
   },

+ 1 - 1
src/plugins/download.js

@@ -80,7 +80,7 @@ export function downloadByImgUrl(url, filename) {
   return new Promise((resolve, reject) => {
     const img = new Image();
     // 跨域支持,需要服务端辅助配置
-    // img.crossOrigin = "";
+    img.crossOrigin = "";
     img.onload = function () {
       const canvas = document.createElement("canvas");
       const ctx = canvas.getContext("2d");