Michael Wang преди 3 години
родител
ревизия
0e23bc0557

+ 2 - 2
src/api/allAnalysisPage.ts

@@ -29,7 +29,7 @@ export function getSasCourseList(params: {
 export function setSasCourseRangeConfig(params: {
   courseId?: number;
   projectId: number;
-  rangeConfig: any;
+  rangeConfig: string;
 }) {
   return httpApp.post("/api/ess/projectCourse/rangeConfig", params);
 }
@@ -38,7 +38,7 @@ export function setSasCourseRangeConfig(params: {
 export function setSasCourseTotalRangeConfig(params: {
   courseId?: number;
   projectId: number;
-  rangeConfig: any;
+  rangeConfig: string;
 }) {
   return httpApp.post("/api/ess/projectCourse/totalRangeConfig", params);
 }

+ 5 - 1
src/api/courseManagementPage.ts

@@ -1,6 +1,7 @@
 import { httpApp } from "@/plugins/axiosApp";
 import { responseToFile } from "@/utils/utils";
 import qs from "qs";
+import { CourseResponse } from "@/types";
 
 /** 科目分页查询 */
 export function getCourseList(params: {
@@ -12,7 +13,10 @@ export function getCourseList(params: {
   pageNo?: number;
   pageSize?: number;
 }) {
-  return httpApp.post("/api/ess/course/page", params);
+  return httpApp.post<any, { data: CourseResponse }>(
+    "/api/ess/course/page",
+    params
+  );
 }
 
 /** 更新科目 */

+ 1 - 1
src/api/paperAnalysisPage.ts

@@ -38,7 +38,7 @@ export function setPaperRangeConfig(params: {
   projectId: number;
   courseId?: number;
   paperId?: number;
-  rangeConfig: any;
+  rangeConfig: string;
 }) {
   return httpApp.post("/api/ess/paper/difficulityRangeConfig", params);
 }

+ 5 - 1
src/api/paperManagementPage.ts

@@ -1,4 +1,5 @@
 import { httpApp } from "@/plugins/axiosApp";
+import { PaperResponse } from "@/types";
 
 /** 试卷分页查询 */
 export function getPaperList(params: {
@@ -9,7 +10,10 @@ export function getPaperList(params: {
   pageNo?: number;
   pageSize?: number;
 }) {
-  return httpApp.post("/api/ess/paper/list", params);
+  return httpApp.post<any, { data: PaperResponse }>(
+    "/api/ess/paper/list",
+    params
+  );
 }
 
 /** 更新科目 */

+ 5 - 1
src/api/rootOrgPage.ts

@@ -1,4 +1,5 @@
 import { httpApp } from "@/plugins/axiosApp";
+import { OrgResponse } from "@/types";
 
 /** 顶级机构分页查询 */
 export function getRootOrgList(params: {
@@ -8,7 +9,10 @@ export function getRootOrgList(params: {
   pageNo?: number;
   pageSize?: number;
 }) {
-  return httpApp.post("/api/ess/root/org/page", params);
+  return httpApp.post<any, { data: OrgResponse }>(
+    "/api/ess/root/org/page",
+    params
+  );
 }
 
 /** 更新顶级机构 */

+ 5 - 1
src/api/subOrgPage.ts

@@ -1,6 +1,7 @@
 import { httpApp } from "@/plugins/axiosApp";
 import { responseToFile } from "@/utils/utils";
 import QueryString from "qs";
+import { SubOrgResponse } from "@/types";
 
 /** 机构分页查询 */
 export function getSubOrgList(params: {
@@ -11,7 +12,10 @@ export function getSubOrgList(params: {
   pageNo?: number;
   pageSize?: number;
 }) {
-  return httpApp.post("/api/ess/org/page", params);
+  return httpApp.post<any, { data: SubOrgResponse }>(
+    "/api/ess/org/page",
+    params
+  );
 }
 
 /** 更新机构 */

+ 5 - 1
src/api/userManagementPage.ts

@@ -2,6 +2,7 @@ import { httpApp } from "@/plugins/axiosApp";
 import { Course_Type, Privilege_Type } from "@/types";
 import { responseToFile } from "@/utils/utils";
 import QueryString from "qs";
+import { UserResponse } from "@/types";
 
 /** 用户分页查询 */
 export function getUserList(params: {
@@ -14,7 +15,10 @@ export function getUserList(params: {
   pageNo?: number;
   pageSize?: number;
 }) {
-  return httpApp.post("/api/ess/user/page", params);
+  return httpApp.post<any, { data: UserResponse }>(
+    "/api/ess/user/page",
+    params
+  );
 }
 
 /** 用户id查询 */

+ 1 - 1
src/components/CommonRangeConfig.vue

@@ -143,7 +143,7 @@ function newRangePoint() {
   });
 }
 
-function handleDeleteRangePoint(item: any) {
+function handleDeleteRangePoint(item: RangeConfig) {
   selectedRangeConfig = selectedRangeConfig.filter((v) => v !== item);
 }
 

+ 1 - 1
src/features/allAnalysis/AllAnalysis2.vue

@@ -176,7 +176,7 @@ onMounted(async () => {
   }
 });
 
-async function goPaperAnalysis(record: any) {
+async function goPaperAnalysis(record: SASPaper) {
   await router.push(`/project/${projectId}/paperAnalysis/${record.paperId}`);
 }
 

+ 1 - 1
src/features/allAnalysis/ScoreFirstTryRate.vue

@@ -127,7 +127,7 @@ const openRangeConfigModal = (item: SasCourse) => {
   rangeConfigRef.showModal();
 };
 
-async function handleRangeConfigUpdate(rangeConfig: any) {
+async function handleRangeConfigUpdate(rangeConfig: RangeConfig) {
   await setSasCourseTotalRangeConfig({
     courseId: selectedCourseId,
     projectId: projectId,

+ 4 - 6
src/features/allAnalysis/ScoreRate.vue

@@ -131,12 +131,10 @@ async function fetchData() {
   });
   // console.log(Object.keys(JSON.parse(res.data[0].scoreRange)));
   res.data = res.data.map((v) => {
-    if (typeof v.scoreRange === "string") {
-      // scoreRange {1: 1, 2: 2}
-      const t: any = JSON.parse(v.scoreRange || "{}");
+    v.scoreRange = Object.values(
       // eslint-disable-next-line
-      v.scoreRange = Object.values(t);
-    }
+      JSON.parse(<string>(<unknown>v.scoreRange) || "{}")
+    );
     return v;
   });
   res.data = res.data.map((v) => {
@@ -253,7 +251,7 @@ let selectedCourseId = $ref(0);
 
 let rangeConfigRef = $ref<InstanceType<typeof CommonRangeConfig>>();
 
-const openRangeConfigModal = (item: any) => {
+const openRangeConfigModal = (item: SasCourse) => {
   selectedCourseId = item.courseId;
   selectedRangeConfig = JSON.parse(JSON.stringify(item.rangeConfig));
   // @ts-ignore https://github.com/vuejs/vue-next/issues/4397

+ 5 - 5
src/features/courseManagement/CourseManagement.vue

@@ -151,7 +151,7 @@ import {
   updateCourse,
 } from "@/api/courseManagementPage";
 import { useMainStore } from "@/store";
-import { Course_Type } from "@/types";
+import { Course, Course_Type } from "@/types";
 import { downloadFileURL } from "@/utils/utils";
 import { message } from "ant-design-vue";
 import { watch, onMounted, ref, reactive, toRaw, h } from "vue";
@@ -165,7 +165,7 @@ let code = $ref("");
 let name = $ref("");
 let enable = $ref(undefined as undefined | boolean);
 
-let data = $ref([]);
+let data = $ref<Course[]>([]);
 let pageSize = $ref(10);
 let pageNo = $ref(1);
 let totalElements = $ref(0);
@@ -255,7 +255,7 @@ onMounted(async () => {
 
 const visible = ref<boolean>(false);
 
-const showModal = (record: any) => {
+const showModal = (record: Course) => {
   Object.assign(courseObj, record);
   visible.value = true;
 };
@@ -267,14 +267,14 @@ const handleOk = async () => {
   void message.success({ content: "操作成功" });
 };
 
-const initCourse = {
+const initCourse = <Course>(<unknown>{
   id: undefined,
   code: "",
   name: "",
   enable: true,
   type: undefined,
   rootOrgId: store.userInfo.rootOrgId,
-};
+});
 const courseObj = reactive({ ...initCourse });
 
 const newCourse = () => {

+ 1 - 1
src/features/paperAnalysis/QuestionDifficultyGroup.vue

@@ -144,7 +144,7 @@ const openRangeConfigModal = () => {
   rangeConfigRef.showModal();
 };
 
-async function handleRangeConfigUpdate(rangeConfig: any) {
+async function handleRangeConfigUpdate(rangeConfig: RangeConfig) {
   await setPaperRangeConfig({
     projectId: props.projectId,
     courseId: selectedCourseId,

+ 1 - 1
src/features/projectDataManagement/ProjectDataManagement.vue

@@ -62,7 +62,7 @@ const route = useRoute();
 const projectId = +route.params.projectId;
 let data = $ref<Project[]>([]);
 
-let project: any = computed(() => data[0] || {});
+let project = computed(() => data[0] || {});
 
 async function search() {
   await fetchData();

+ 4 - 4
src/features/projectManagement/ProjectManagement.vue

@@ -280,7 +280,7 @@ onMounted(async () => {
 
 const visible = ref<boolean>(false);
 
-const showModal = (record: any) => {
+const showModal = (record: Project) => {
   Object.assign(projectObj, record);
   visible.value = true;
 };
@@ -292,14 +292,14 @@ const handleOk = async () => {
   void message.success({ content: "操作成功" });
 };
 
-const initProject = {
+const initProject = <Project>(<unknown>{
   id: undefined,
   code: "",
   name: "",
   enable: true,
   type: undefined,
   rootOrgId: store.userInfo.rootOrgId,
-};
+});
 const projectObj = reactive({ ...initProject });
 
 const newProject = () => {
@@ -354,7 +354,7 @@ function handleCancelProject(id: number) {
 
 let showRestartModalVisible = $ref(false);
 let selectedProject = reactive<Project>({ id: 0 } as Project);
-function selectRestartProject(p: any) {
+function selectRestartProject(p: Project) {
   Object.assign(selectedProject, p);
   showRestartModalVisible = true;
 }

+ 3 - 3
src/features/projectPapersManagement/ProjectPapersManagement.vue

@@ -52,7 +52,7 @@ import { goBack } from "@/utils/utils";
 import { watch, onMounted } from "vue";
 import { useRoute } from "vue-router";
 import ProjectSelect from "@/components/ProjectSelect.vue";
-import { Course_Type } from "@/types";
+import { Course_Type, Paper } from "@/types";
 import { getPaperList } from "@/api/paperManagementPage";
 import router from "@/router";
 
@@ -66,7 +66,7 @@ let paperType = $ref(undefined as undefined | string);
 const route = useRoute();
 const projectId = +route.params.projectId;
 
-let data = $ref([]);
+let data = $ref<Paper[]>([]);
 let pageSize = $ref(10);
 let pageNo = $ref(1);
 let totalElements = $ref(0);
@@ -127,7 +127,7 @@ async function goAllAnalysis() {
   await router.push(`/project/allAnalysis/${projectId}`);
 }
 
-async function goPaperAnalysis(record: any) {
+async function goPaperAnalysis(record: Paper) {
   await router.push(`/project/${projectId}/paperAnalysis/${record.id}`);
 }
 </script>

+ 3 - 3
src/features/projectParamsManagement/ProjectParamsManagement.vue

@@ -191,7 +191,7 @@ onMounted(async () => {
 
 const visible = ref<boolean>(false);
 
-const showModal = (record: any) => {
+const showModal = (record: ProjectCourse) => {
   Object.assign(projectObj, record);
   visible.value = true;
 };
@@ -203,7 +203,7 @@ const handleOk = async () => {
   void message.success({ content: "操作成功" });
 };
 
-const initProject = {
+const initProject = <ProjectCourse>(<unknown>{
   id: 0,
   nationalScore: 0,
   nationalTotalScore: 0,
@@ -214,7 +214,7 @@ const initProject = {
   courseName: "",
   courseCode: "",
   courseType: undefined,
-};
+});
 const projectObj = reactive({ ...initProject });
 
 /** <handleImport> */

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

@@ -84,6 +84,7 @@
 import { getRootOrgList, syncRootOrg, updateRootOrg } from "@/api/rootOrgPage";
 import router from "@/router";
 import { useMainStore } from "@/store";
+import { Org } from "@/types";
 import { message } from "ant-design-vue";
 import { ref, onMounted, reactive } from "vue";
 
@@ -94,7 +95,7 @@ let code = $ref("");
 let name = $ref("");
 let enable = $ref(undefined as undefined | boolean);
 
-let data = $ref([]);
+let data = $ref<Org[]>([]);
 let pageSize = $ref(10);
 let pageNo = $ref(1);
 let totalElements = $ref(0);
@@ -150,7 +151,7 @@ onMounted(async () => {
 
 const visible = ref<boolean>(false);
 
-const showModal = (record: any) => {
+const showModal = (record: Org) => {
   Object.assign(rootOrgObj, record);
   visible.value = true;
 };

+ 5 - 4
src/features/subOrg/SubOrg.vue

@@ -137,6 +137,7 @@ import {
   updateSubOrg,
 } from "@/api/subOrgPage";
 import { useMainStore } from "@/store";
+import { SubOrg } from "@/types";
 import { downloadFileURL } from "@/utils/utils";
 import { message } from "ant-design-vue";
 import { watch, onMounted, ref, reactive, toRaw, h } from "vue";
@@ -149,7 +150,7 @@ let code = $ref("");
 let name = $ref("");
 let enable = $ref(undefined as undefined | boolean);
 
-let data = $ref([]);
+let data = $ref<SubOrg[]>([]);
 let pageSize = $ref(10);
 let pageNo = $ref(1);
 let totalElements = $ref(0);
@@ -227,7 +228,7 @@ onMounted(async () => {
 
 const visible = ref<boolean>(false);
 
-const showModal = (record: any) => {
+const showModal = (record: SubOrg) => {
   Object.assign(orgObj, record);
   visible.value = true;
 };
@@ -239,13 +240,13 @@ const handleOk = async () => {
   void message.success({ content: "操作成功" });
 };
 
-const orgObj = reactive({
+const orgObj = reactive(<SubOrg>(<unknown>{
   id: undefined,
   code: "",
   name: "",
   enable: true,
   rootOrgId: store.userInfo.rootOrgId,
-});
+}));
 
 const newOrg = () => {
   Object.assign(orgObj, {

+ 5 - 4
src/features/userManagement/UserManagement.vue

@@ -179,6 +179,7 @@ import {
 } from "@/api/userManagementPage";
 import router from "@/router";
 import { useMainStore } from "@/store";
+import { User } from "@/types";
 import { downloadFileURL } from "@/utils/utils";
 import { message, Modal } from "ant-design-vue";
 import { watch, onMounted, ref, reactive, toRaw, h } from "vue";
@@ -192,7 +193,7 @@ let loginName = $ref("");
 let name = $ref("");
 let enable = $ref(undefined as undefined | boolean);
 
-let data = $ref([]);
+let data = $ref<User[]>([]);
 let pageSize = $ref(10);
 let pageNo = $ref(1);
 let totalElements = $ref(0);
@@ -281,7 +282,7 @@ onMounted(async () => {
 
 const visible = ref<boolean>(false);
 
-const showModal = (record: any) => {
+const showModal = (record: User) => {
   Object.assign(userObj, record);
   visible.value = true;
 };
@@ -293,7 +294,7 @@ const handleOk = async () => {
   void message.success({ content: "操作成功" });
 };
 
-const initUser = {
+const initUser = <User>(<unknown>{
   id: undefined,
   code: "",
   name: "",
@@ -302,7 +303,7 @@ const initUser = {
   enable: true,
   roleId,
   rootOrgId: store.userInfo.rootOrgId,
-};
+});
 const userObj = reactive({ ...initUser });
 
 const newUser = () => {

+ 94 - 0
src/types/index.ts

@@ -57,6 +57,29 @@ export interface SasCourse {
   scoreRangeTotal: number; // 前端自用
 }
 
+export interface Course {
+  code: string;
+  createTime: string;
+  createTimeStr: string;
+  creator: string;
+  enable: boolean;
+  enableStr: string;
+  id: number;
+  name: string;
+  rootOrgId: number; // 供编辑页显示
+  rootOrgCode: string;
+  rootOrgName: string;
+  type: Course_Type;
+  typeStr: string;
+  updateTime: string;
+  updateTimeStr: string;
+  updater: string;
+}
+
+export interface CourseResponse extends Pagination {
+  content: Course[];
+}
+
 export interface RangeConfig {
   type: keyof RANGE_POINT_TYPE;
   baseScore: number;
@@ -95,6 +118,52 @@ export interface SASPaper {
   totalScore: number;
 }
 
+export interface Paper {
+  courseCode: string;
+  courseName: string;
+  id: number;
+  paperName: string;
+  paperType: string;
+  totalCount: number;
+}
+
+export interface PaperResponse extends Pagination {
+  content: Paper[];
+}
+
+export interface Org {
+  code: string;
+  domainName: string;
+  enable: boolean;
+  id: number;
+  name: string;
+  updateTime: string;
+}
+
+export interface OrgResponse extends Pagination {
+  content: Org[];
+}
+
+export interface SubOrg {
+  code: string;
+  createTime: string;
+  createTimeStr: string;
+  creator: string;
+  enable: boolean;
+  enableStr: string;
+  id: number;
+  name: string;
+  rootOrgCode: string;
+  rootOrgId: number;
+  rootOrgName: string;
+  updateTime: string;
+  updateTimeStr: string;
+  updater: string;
+}
+export interface SubOrgResponse extends Pagination {
+  content: SubOrg[];
+}
+
 export interface Pagination {
   pageNo: number;
   pageSize: number;
@@ -256,3 +325,28 @@ export interface Paper {
   updateTime: string;
   updaterId: number;
 }
+
+export interface User {
+  createTime: string;
+  createTimeStr: string;
+  creator: string;
+  enable: boolean;
+  enableStr: string;
+  id: number;
+  loginName: string;
+  name: string;
+  roleName: string;
+  rootOrgCode: string;
+  rootOrgName: string;
+  updateTime: string;
+  updateTimeStr: string;
+  updater: string;
+
+  rootOrgId: number; // FE add
+  roleId: number; // FE add
+  password: string; // FE add
+}
+
+export interface UserResponse extends Pagination {
+  content: User[];
+}