Ver Fonte

接口调试

zhangjie há 2 anos atrás
pai
commit
fd3831f652

+ 2 - 0
src/api/allAnalysisPage.ts

@@ -7,6 +7,8 @@ export function getSasPaperList(params: {
   projectId: number;
   pageNo?: number;
   pageSize?: number;
+  sortColName?: string;
+  sortOrder?:string;
 }) {
   return httpApp.post<any, ServerPageResponse<SASPaper>>(
     "/api/ess/sasPaper/page",

+ 3 - 1
src/api/authManagementPage.ts

@@ -2,7 +2,9 @@
 import { httpApp } from "@/plugins/axiosApp";
 
 export function getDeviceInfo() {
-  return httpApp.get(`/api/ess/system/auth/device/info`);
+  return httpApp.get(`/api/ess/system/auth/device/info`,{
+    responseType: "blob"
+  });
 }
 export function getAuthInfo() {
   return httpApp.get(`/api/ess/system/auth/info`);

+ 2 - 2
src/api/userManagementPage.ts

@@ -15,7 +15,7 @@ export function getUserList(params: {
   loginName?: string;
   name?: string;
   enable?: boolean;
-  roleId?: number;
+  role?: string;
   rootOrgId?: number;
   pageNo?: number;
   pageSize?: number;
@@ -79,7 +79,7 @@ export function importUsers(rootOrgId: number, file: File) {
 /** 导出用户 */
 export function exportUsers(params: {
   rootOrgId: number;
-  roleId?: number;
+  role?: string;
   loginName?: string;
   name?: string;
   enable?: boolean;

+ 1 - 1
src/components/Layout.vue

@@ -28,7 +28,7 @@
               角色管理
             </router-link>
           </a-menu-item> -->
-          <a-menu-item v-if="store.isRootOrgAdmin" key="14">
+          <a-menu-item v-if="!store.isCourseAdmin" key="14">
             <router-link activeClass="active-route" to="/basic/user">
               用户管理
             </router-link>

+ 8 - 11
src/components/RoleSelect.vue

@@ -9,7 +9,7 @@
     <a-select-option
       v-for="(item, index) in optionList"
       :key="index"
-      :value="item.id"
+      :value="item.code"
     >
       {{ item.name }}
     </a-select-option>
@@ -25,7 +25,7 @@ import { RoleOption } from "@/types";
 
 const props = withDefaults(
   defineProps<{
-    value?: null | number;
+    value?: null | string;
     rootOrgId?: null | number;
     isManage?: boolean;
   }>(),
@@ -36,7 +36,7 @@ const props = withDefaults(
   }
 );
 const emit = defineEmits<{
-  (e: "update:value", id: number): void;
+  (e: "update:value", code: string): void;
   (e: "change", role: RoleOption | null): void;
 }>();
 
@@ -56,26 +56,23 @@ async function fetchData() {
   optionList = res.data;
 
   if (props.isManage) {
-    let userRoleSet: string[] = [];
-    store.userInfo.roleList.forEach((r) => {
-      const info = ROLE_MANAGE_SET[r.roleCode];
-      userRoleSet.push(...info);
-    });
+    const info = ROLE_MANAGE_SET[store.userInfo.role];
+    let userRoleSet = [...info];
     optionList = optionList.filter((item: RoleOption) =>
       userRoleSet.includes(item.code)
     );
   }
 }
 const valueStr = computed(() => {
-  let res: undefined | number = props.value ?? undefined;
+  let res: undefined | string = props.value ?? undefined;
   // if (typeof res === "number") res = props.value;
   return res;
 });
 
-function handleChange(v: number) {
+function handleChange(v: string) {
   // console.log(typeof v);
   emit("update:value", v);
-  const role = optionList.find((item) => item.id === v);
+  const role = optionList.find((item) => item.code === v);
   emit("change", role || null);
 }
 </script>

+ 1 - 3
src/components/RootOrgSelect.vue

@@ -27,9 +27,7 @@ let optionList = $ref<{ id: number; name: string }[]>([]);
 
 onMounted(async () => {
   const res = await getRootOrgList({});
-  optionList = res.data.content.filter(
-    (item) => item.id !== 1 && item.code !== "qmth"
-  );
+  optionList = res.data.content;
 });
 
 const valueStr = computed(() => {

+ 4 - 2
src/constants/constants.ts

@@ -71,9 +71,11 @@ export const RANGE_POINT_TYPE = {
   TOTAL_SCORE_LINE: "国家满分线",
 } as const;
 
-export const ROLE_MANAGE_SET= {
+export const ROLE_MANAGE_SET = {
   SUPER_ADMIN:[
     'SUPER_ADMIN','ROOT_ORG_ADMIN','ORG_ADMIN','COURSE_ADMIN'
   ],
-  ROOT_ORG_ADMIN:['COURSE_ADMIN'],ORG_ADMIN:[''],COURSE_ADMIN:['']
+  ROOT_ORG_ADMIN:['COURSE_ADMIN'],
+  ORG_ADMIN:[''],
+  COURSE_ADMIN:['']
 } as const

+ 31 - 4
src/features/allAnalysis/AllAnalysis2.vue

@@ -99,6 +99,8 @@ let data = $ref<SASPaper[]>([]);
 let pageSize = $ref<number>(10);
 let pageNo = $ref(1);
 let totalElements = $ref(0);
+let sortColName = $ref("");
+let sortOrder = $ref("");
 
 async function search() {
   pageNo = 1;
@@ -107,8 +109,26 @@ async function search() {
 
 watch(() => [pageNo, pageSize], fetchData);
 
+interface fetchParamType {
+  courseId?: number;
+  projectId: number;
+  pageNo?: number;
+  pageSize?: number;
+  sortColName?: string;
+  sortOrder?: string;
+}
+
 async function fetchData() {
-  const res = await getSasPaperList({ projectId, courseId, pageNo, pageSize });
+  let params: fetchParamType = {
+    projectId,
+    courseId,
+    pageNo,
+    pageSize,
+  };
+  if (sortOrder && sortColName) {
+    params = { ...params, sortColName, sortOrder };
+  }
+  const res = await getSasPaperList(params);
   // console.log(res);
   data = res.data.content.map((v) => {
     v.avgScore = Math.round(v.avgScore * 100) / 100;
@@ -210,13 +230,20 @@ async function goPaperAnalysis(record: SASPaper) {
   await router.push(`/project/${projectId}/paperAnalysis/${record.paperId}`);
 }
 
-function tableChange(
+async function tableChange(
   pagination: PaginationType,
   filters: FilterType[],
   sorter: SorterType
 ) {
-  console.log(sorter);
-  // TODO:
+  // console.log(sorter);
+  if (sorter.order) {
+    sortColName = sorter.field;
+    sortOrder = sorter.order.slice(0, -3).toUpperCase();
+  } else {
+    sortColName = "";
+    sortOrder = "";
+  }
+  await search();
 }
 // async function goProjectPapers(id: number) {
 //   await router.push("/project/papers/" + id);

+ 41 - 29
src/features/authManagement/AuthManagement.vue

@@ -59,9 +59,8 @@
         >
           <a-upload
             accept=".lic"
-            :action="uploadAction"
+            :customRequest="customRequest"
             :showUploadList="false"
-            @change="uploadChange"
           >
             <a-button type="primary">选择文件</a-button>
           </a-upload>
@@ -69,16 +68,28 @@
         <a-form-item v-if="authForm.authType == 'OFFLINE'" label="硬件信息">
           <a-button type="primary" @click="exportFile">导出硬件信息</a-button>
         </a-form-item>
-        <a-button v-else type="primary" @click="submitForm">保存</a-button>
+        <a-form-item v-else>
+          <a-button
+            style="margin-left: 150px"
+            type="primary"
+            @click="submitForm"
+            >保存</a-button
+          >
+        </a-form-item>
       </a-form>
     </div>
   </div>
 </template>
 
 <script setup lang="ts">
-import { getAuthInfo, onlineAuth } from "../../api/authManagementPage";
+import {
+  getAuthInfo,
+  offlineAuth,
+  onlineAuth,
+} from "../../api/authManagementPage";
 import { message } from "ant-design-vue";
-import { onMounted, reactive, ref } from "vue";
+import { onMounted, reactive } from "vue";
+import { downloadFileURL } from "@/utils/utils";
 
 interface InfoType {
   activation: string;
@@ -107,7 +118,6 @@ let authForm: AuthFormType = reactive({
   accessKey: "",
   accessSecret: "",
 });
-let uploadAction = ref("/api/ess/system/auth/offline");
 
 onMounted(async () => {
   await fetchData();
@@ -115,7 +125,23 @@ onMounted(async () => {
 
 async function fetchData() {
   const res = await getAuthInfo();
-  info = res.data;
+  if (res.data.auth == true) {
+    info.activation = "已授权";
+    if (info.activation == "已授权" && !res.data.expireTime) {
+      info.expire = "不限制";
+    } else {
+      info.expire = res.data.expireTime;
+    }
+    if (info.activation == "已授权" && !res.data.maxOnlineUserCount) {
+      info.maxCount = "不限制";
+    } else {
+      info.maxCount = res.data.maxOnlineUserCount;
+    }
+    info.onlineCount = res.data.onlineUserCount;
+    info.type = res.data.type == "ONLINE" ? "在线激活" : "离线激活";
+  } else {
+    info.activation = "未授权";
+  }
 }
 async function submitForm() {
   await onlineAuth(authForm);
@@ -123,29 +149,15 @@ async function submitForm() {
 }
 
 // offline-auth
-interface FileItem {
-  uid: string;
-  name?: string;
-  status?: string;
-  response?: string;
-  url?: string;
-}
-interface FileInfo {
-  file: FileItem;
-  fileList: FileItem[];
+async function customRequest(data: { file: File }) {
+  let formData = new FormData();
+  formData.append("file", data.file);
+  await offlineAuth(formData);
+  void message.success("上传成功!");
+  await fetchData();
 }
-const uploadChange = (info: FileInfo) => {
-  // if (info.file.status !== "uploading") {
-  //   console.log(info.file, info.fileList);
-  // }
-  if (info.file.status === "done") {
-    void message.success(`${info.file.name} 上传成功`);
-  } else if (info.file.status === "error") {
-    void message.error(`${info.file.name} 上传失败`);
-  }
-};
 
-function exportFile() {
-  window.open("/api/ess/system/auth/info");
+async function exportFile() {
+  await downloadFileURL("/api/ess/system/auth/device/info");
 }
 </script>

+ 1 - 1
src/features/projectCompareDetail/ScoreRateCompare.vue

@@ -163,7 +163,7 @@ async function fetchData() {
     v.scoreRangeTotal = acc;
     return v;
   });
-  console.log(res.data);
+  // console.log(res.data);
   courses = res.data;
 }
 

+ 6 - 13
src/features/projectParamsManagement/ProjectParamsManagement.vue

@@ -60,6 +60,9 @@
           <CourseTypeSelect :value="projectObj.courseType" disabled />
         </a-form-item>
 
+        <a-form-item label="起始计算分">
+          <a-input v-model:value="projectObj.startScore"></a-input>
+        </a-form-item>
         <a-form-item label="国家单科线">
           <a-input v-model:value="projectObj.nationalScore"></a-input>
         </a-form-item>
@@ -157,13 +160,9 @@ const columns = [
     dataIndex: "course",
     slots: { customRender: "course" },
   },
-  {
-    title: "满分",
-    dataIndex: "nationalScore",
-  },
   {
     title: "起始计算分",
-    dataIndex: "nationalScore",
+    dataIndex: "startScore",
   },
   {
     title: "国家单科线",
@@ -173,14 +172,6 @@ const columns = [
     title: "复试科目线",
     dataIndex: "retestScore",
   },
-  {
-    title: "考生属性起始分",
-    dataIndex: "retestScore",
-  },
-  {
-    title: "考生属性终止分",
-    dataIndex: "retestScore",
-  },
   // {
   //   title: "国家总分线",
   //   dataIndex: "nationalTotalScore",
@@ -196,6 +187,7 @@ const columns = [
   {
     title: "操作",
     key: "action",
+    width: 120,
     slots: { customRender: "action" },
   },
 ];
@@ -223,6 +215,7 @@ const initProject = <ProjectCourse>(<unknown>{
   id: 0,
   nationalScore: 0,
   nationalTotalScore: 0,
+  startScore: 0,
   retestScore: 0,
   retestTotalScore: 0,
   totalScoreLine: 0,

+ 2 - 3
src/features/rootOrg/RootOrg.vue

@@ -103,9 +103,7 @@ let totalElements = $ref(0);
 async function search() {
   const res = await getRootOrgList({ code, name, enable, pageSize, pageNo });
   // console.log(res);
-  data = res.data.content.filter(
-    (item) => item.id !== 1 && item.code !== "qmth"
-  );
+  data = res.data.content;
   pageNo = res.data.pageNo;
   pageSize = res.data.pageSize;
   totalElements = res.data.totalElements;
@@ -179,5 +177,6 @@ const rootOrgObj = reactive({
 async function handleRootOrgSync() {
   await syncRootOrg();
   void message.success("操作成功");
+  await search();
 }
 </script>

+ 6 - 6
src/features/userManagement/UserManagement.vue

@@ -20,7 +20,7 @@
         allowClear
       ></a-input>
       <span class="tw-mr-4"></span>
-      <RoleSelect v-model:value="roleId" :rootOrgId="rootOrgId" />
+      <RoleSelect v-model:value="role" :rootOrgId="rootOrgId" />
       <span class="tw-mr-4"></span>
       <StateSelect v-model:value="enable" />
       <span class="tw-mr-4"></span>
@@ -138,7 +138,7 @@
         </a-form-item>
         <a-form-item label="角色">
           <RoleSelect
-            v-model:value="userObj.roleId"
+            v-model:value="userObj.role"
             :rootOrgId="userObj.rootOrgId"
           />
         </a-form-item>
@@ -204,7 +204,7 @@ const store = useMainStore();
 store.currentLocation = "基础管理 / 用户管理";
 
 let rootOrgId = $ref(undefined as unknown as number);
-let roleId = $ref(undefined as unknown as number);
+let role = $ref(undefined as unknown as string);
 let loginName = $ref("");
 let name = $ref("");
 let enable = $ref(undefined as undefined | boolean);
@@ -230,7 +230,7 @@ async function fetchData() {
     loginName,
     name,
     enable,
-    roleId,
+    role,
     rootOrgId,
     pageSize,
     pageNo,
@@ -326,7 +326,7 @@ const initUser = <User>(<unknown>{
   loginName: "",
   password: "",
   enable: true,
-  roleId,
+  role: "",
   rootOrgId: store.userInfo.rootOrgId,
 });
 const userObj = reactive({ ...initUser });
@@ -403,7 +403,7 @@ async function handleImport() {
 /** </handleImport> */
 
 async function handleExport() {
-  await exportUsers({ rootOrgId, name, loginName, roleId, enable });
+  await exportUsers({ rootOrgId, name, loginName, role, enable });
   void message.success({ content: "导出成功" });
 }
 

+ 8 - 18
src/store/index.ts

@@ -1,5 +1,5 @@
 import { setSessionId, setToken } from "@/auth/auth";
-import { Role } from "@/types";
+import { RoleCode } from "@/types";
 import { defineStore } from "pinia";
 
 // main is the name of the store. It is unique across your application
@@ -16,39 +16,29 @@ export const useMainStore = defineStore("main", {
         rootOrgId: -1,
         rootOrgName: "",
         token: "",
-        roleList: [] as Role[],
+        role: 'COURSE_ADMIN' as RoleCode,
       },
       currentLocation: "",
     };
   },
   getters: {
     isSuperAdmin(): boolean {
-      return this.userInfo.roleList.some((r) => r.roleCode === "SUPER_ADMIN");
+      return this.userInfo.role === "SUPER_ADMIN";
     },
     isRootOrgAdmin(): boolean {
-      return this.userInfo.roleList.some(
-        (r) => r.roleCode === "ROOT_ORG_ADMIN"
-      );
+      return this.userInfo.role === "ROOT_ORG_ADMIN";
     },
     isOrgAdmin(): boolean {
-      return this.userInfo.roleList.some((r) => r.roleCode === "ORG_ADMIN");
+      return this.userInfo.role === "ORG_ADMIN";
     },
     isGreaterThanEqualRootOrgAdmin(): boolean {
-      return (
-        this.userInfo.roleList.some((r) => r.roleCode === "SUPER_ADMIN") ||
-        this.userInfo.roleList.some((r) => r.roleCode === "ROOT_ORG_ADMIN")
-      );
+      return this.isSuperAdmin || this.isRootOrgAdmin;
     },
     isGreaterThanEqualOrgAdmin(): boolean {
-      return (
-        this.userInfo.roleList.some((r) => r.roleCode === "SUPER_ADMIN") ||
-        this.userInfo.roleList.some((r) => r.roleCode === "ROOT_ORG_ADMIN") ||
-        this.userInfo.roleList.some((r) => r.roleCode === "ORG_ADMIN")
-      );
+      return this.isSuperAdmin || this.isRootOrgAdmin || this.isOrgAdmin;
     },
     isCourseAdmin():boolean {
-      return this.userInfo.roleList.some((r) => r.roleCode === "COURSE_ADMIN");
- 
+      return this.userInfo.role === "COURSE_ADMIN";
     }
   },
   actions: {

+ 8 - 3
src/types/index.ts

@@ -1,11 +1,15 @@
+
+
+export type RoleCode = "ORG_ADMIN" | "SUPER_ADMIN" | "ROOT_ORG_ADMIN" | "COURSE_ADMIN";
+
 export interface Role {
   roleId: number;
-  roleCode: "ORG_ADMIN" | "SUPER_ADMIN" | "ROOT_ORG_ADMIN" | "COURSE_ADMIN";
+  roleCode: RoleCode;
   roleName: string;
 }
 
 export interface RoleOption {
-  id: number; name: string; code: string
+  id: number; name: string; code: RoleCode
 }
 
 export type Course_Type = "PUBLIC" | "MAJOR";
@@ -52,6 +56,7 @@ export interface ProjectCourse {
   courseName: string;
   courseType: Course_Type;
   id: number;
+  startScore: number;
   nationalScore: number;
   nationalTotalScore: number;
   projectId: number;
@@ -288,7 +293,7 @@ export interface User {
   updater: string;
 
   rootOrgId: number; // FE add
-  roleId: number; // FE add
+  role: string; // FE add
   password: string; // FE add
 }
 

+ 2 - 2
vite.config.ts

@@ -3,8 +3,8 @@ import vue from "@vitejs/plugin-vue";
 import ViteComponents from "unplugin-vue-components/vite";
 import { AntDesignVueResolver } from "unplugin-vue-components/resolvers";
 
-// const SERVER_URL = "http://192.168.10.39:8081";
-const SERVER_URL = "http://192.168.10.54:8001";
+const SERVER_URL = "http://192.168.10.39:7180";
+// const SERVER_URL = "http://192.168.10.54:8001";
 const path = require("path");
 
 // https://vitejs.dev/config/