Michael Wang 3 yıl önce
ebeveyn
işleme
74e80cdd0e

+ 5 - 2
src/api/allAnalysisPage.ts

@@ -1,5 +1,5 @@
 import { httpApp } from "@/plugins/axiosApp";
-import { SASPaperResponse } from "@/types";
+import { SASPaperResponse, SasCourse } from "@/types";
 
 /** 试卷特征数分页查询 */
 export function getSasPaperList(params: {
@@ -19,7 +19,10 @@ export function getSasCourseList(params: {
   courseId?: number;
   projectId: number;
 }) {
-  return httpApp.post("/api/ess/sasCourse/list", params);
+  return httpApp.post<any, { data: SasCourse[] }>(
+    "/api/ess/sasCourse/list",
+    params
+  );
 }
 
 /** 科目成绩(总分)频率分布-分段设置 */

+ 32 - 23
src/features/allAnalysis/ScoreRate.vue

@@ -31,7 +31,7 @@
                 <th>累计频数</th>
                 <th>累计频数(%)</th>
               </tr>
-              <tr v-for="(seg, index) in course.segements" :key="index">
+              <tr v-for="(seg, index2) in course.segements" :key="index2">
                 <td>{{ seg[0] }}-</td>
                 <td>{{ seg[1] }}</td>
                 <td v-number-to-percent>{{ seg[2] }}%</td>
@@ -67,7 +67,7 @@
                 <th>累计频数</th>
                 <th>累计频数(%)</th>
               </tr>
-              <tr v-for="(seg, index) in course.rangeSegements" :key="index">
+              <tr v-for="(seg, index3) in course.rangeSegements" :key="index3">
                 <td>{{ seg[0] }}-</td>
                 <td>{{ seg[1] }}</td>
                 <td v-number-to-percent>{{ seg[2] }}%</td>
@@ -100,7 +100,7 @@
 </template>
 
 <script setup lang="ts">
-import { useMainStore } from "@/store";
+// import { useMainStore } from "@/store";
 import { onMounted, watch } from "vue";
 import { useRoute } from "vue-router";
 import {
@@ -111,29 +111,36 @@ import EventBus from "@/plugins/eventBus";
 import { message } from "ant-design-vue";
 import { RANGE_POINT_TYPE } from "@/constants/constants";
 import { EChartsOption } from "echarts";
+import CommonRangeConfig from "@/components/CommonRangeConfig.vue";
+import { RangeConfig, SasCourse } from "@/types";
 
 let activeKey = $ref(["0"]);
 
-const store = useMainStore();
+// const store = useMainStore();
 
-let rootOrgId = $ref(undefined as unknown as number);
+// let rootOrgId = $ref(undefined as unknown as number);
 let courseId = $ref(undefined as undefined | number);
 const route = useRoute();
 const projectId = +route.params.projectId;
 
-let courses = $ref([]);
+let courses = $ref<SasCourse[]>([]);
 async function fetchData() {
   const res = await getSasCourseList({
     projectId,
     courseId,
   });
   // console.log(Object.keys(JSON.parse(res.data[0].scoreRange)));
-  res.data = res.data.map((v: any) => {
-    v.scoreRange = Object.values(JSON.parse(v.scoreRange || "{}"));
+  res.data = res.data.map((v) => {
+    if (typeof v.scoreRange === "string") {
+      // scoreRange {1: 1, 2: 2}
+      const t: any = JSON.parse(v.scoreRange || "{}");
+      // eslint-disable-next-line
+      v.scoreRange = Object.values(t);
+    }
     return v;
   });
-  res.data = res.data.map((v: any) => {
-    v.rangeConfig = JSON.parse(v.rangeConfig || "0") || [
+  res.data = res.data.map((v) => {
+    v.rangeConfig = JSON.parse(<string>(<unknown>v.rangeConfig) || "0") || [
       {
         type: "ZERO",
         baseScore: 0,
@@ -142,12 +149,13 @@ async function fetchData() {
     ];
     return v;
   });
-  res.data = res.data.map((v: { scoreRange: number[] }) => {
+  res.data = res.data.map((v) => {
     let acc = 0;
-    v.scoreRangeAcc = v.scoreRange.map((_v, i, a) => {
-      acc += a[i];
-      return acc;
-    });
+    if (Array.isArray(v.scoreRange))
+      v.scoreRangeAcc = v.scoreRange.map((_v, i, a) => {
+        acc += a[i];
+        return acc;
+      });
     v.scoreRangeTotal = acc;
     return v;
   });
@@ -156,7 +164,7 @@ async function fetchData() {
 }
 
 onMounted(async () => {
-  rootOrgId = store.userInfo.rootOrgId;
+  // rootOrgId = store.userInfo.rootOrgId;
   await fetchData();
 });
 
@@ -196,7 +204,7 @@ watch(
 
       course.rangeSegements = [];
       for (let i = 0; i < course.rangeConfig.length; i++) {
-        const range = course.rangeConfig[i];
+        const range = course.rangeConfig[i]!;
         const nextRange =
           i === course.rangeConfig.length - 1
             ? { baseScore: course.totalScore, adjustScore: 0 }
@@ -243,16 +251,17 @@ watch(
 let selectedRangeConfig = $ref([]);
 let selectedCourseId = $ref(0);
 
-let rangeConfigRef = $ref(null);
+let rangeConfigRef = $ref<InstanceType<typeof CommonRangeConfig>>();
 
 const openRangeConfigModal = (item: any) => {
   selectedCourseId = item.courseId;
   selectedRangeConfig = JSON.parse(JSON.stringify(item.rangeConfig));
-  // @ts-ignore
+  // @ts-ignore https://github.com/vuejs/vue-next/issues/4397
+  // eslint-disable-next-line @typescript-eslint/no-unsafe-call
   rangeConfigRef.showModal();
 };
 
-async function handleRangeConfigUpdate(rangeConfig: any) {
+async function handleRangeConfigUpdate(rangeConfig: RangeConfig) {
   await setSasCourseRangeConfig({
     courseId: selectedCourseId,
     projectId: projectId,
@@ -263,7 +272,7 @@ async function handleRangeConfigUpdate(rangeConfig: any) {
   window.location.reload();
 }
 
-function scoreTitle(rangeConfig: any) {
+function scoreTitle(rangeConfig: RangeConfig) {
   if (!rangeConfig) return false;
   if (rangeConfig.type === "ZERO") return "0-";
 
@@ -280,7 +289,7 @@ function openModal2() {
   EventBus.emit("SHOW_SETTING", "DESCRIBE030");
 }
 
-function segementsLine(course: any) {
+function segementsLine(course: SasCourse) {
   console.log(course);
   return {
     title: {
@@ -304,7 +313,7 @@ function segementsLine(course: any) {
   } as EChartsOption;
 }
 
-function rangeSegementsLine(course: any) {
+function rangeSegementsLine(course: SasCourse) {
   console.log(course);
   return {
     title: {

+ 11 - 10
src/features/courseManagement/CourseManagement.vue

@@ -52,12 +52,12 @@
           pageSize: pageSize,
           current: pageNo,
           total: totalElements,
-          showTotal: (total: number) => ``,
-          onChange: (pageNoChanged: number, pageSizeChanged: number) => {
-            selectIds = []
-            pageNo = pageNoChanged; 
+          showTotal: () => ``,
+          onChange: (pageNoChanged, pageSizeChanged) => {
+            selectIds = [];
+            pageNo = pageNoChanged;
             pageSize = pageSizeChanged;
-          }
+          },
         }"
       >
         <template #rootOrgName="{ record }">
@@ -260,7 +260,7 @@ const showModal = (record: any) => {
   visible.value = true;
 };
 
-const handleOk = async (e: MouseEvent) => {
+const handleOk = async () => {
   await updateCourse(toRaw(courseObj));
   visible.value = false;
   await search();
@@ -277,7 +277,7 @@ const initCourse = {
 };
 const courseObj = reactive({ ...initCourse });
 
-const newCourse = async () => {
+const newCourse = () => {
   Object.assign(courseObj, initCourse);
   showModal(courseObj);
 };
@@ -311,9 +311,10 @@ async function handleImport() {
   if (!res.data.hasError) {
     importModalVisible = false;
     void message.success({ content: "导入成功" });
-    clickSearch();
+    await clickSearch();
   } else {
-    const msg = res.data.failRecords.map((v) =>
+    // eslint-disable-next-line
+    const msg = res.data.failRecords.map((v: any) =>
       h("div", `行号:${v.lineNum}, 错误:${v.msg}`)
     );
     void message.error({
@@ -337,6 +338,6 @@ const rowSelection = {
 };
 
 async function downloadTpl() {
-  downloadFileURL("/api/ess/course/template");
+  await downloadFileURL("/api/ess/course/template");
 }
 </script>

+ 3 - 2
src/features/paperAnalysis/QuestionTypeDifficulty.vue

@@ -213,7 +213,8 @@ async function handleImport() {
     importModalVisible = false;
     void message.success({ content: "导入成功" });
   } else {
-    const msg = res.data.failRecords.map((v) =>
+    // eslint-disable-next-line
+    const msg = res.data.failRecords.map((v: any) =>
       h("div", `行号:${v.lineNum}, 错误:${v.msg}`)
     );
     void message.error({
@@ -224,7 +225,7 @@ async function handleImport() {
 /** </handleImport> */
 
 async function downloadTpl() {
-  downloadFileURL("/api/ess/sasQuestionGroup/template");
+  await downloadFileURL("/api/ess/sasQuestionGroup/template");
 }
 </script>
 

+ 3 - 2
src/features/paperAnalysis/QuestionTypeDiscrimination.vue

@@ -213,7 +213,8 @@ async function handleImport() {
     importModalVisible = false;
     void message.success({ content: "导入成功" });
   } else {
-    const msg = res.data.failRecords.map((v) =>
+    // eslint-disable-next-line
+    const msg = res.data.failRecords.map((v: any) =>
       h("div", `行号:${v.lineNum}, 错误:${v.msg}`)
     );
     void message.error({
@@ -224,7 +225,7 @@ async function handleImport() {
 /** </handleImport> */
 
 async function downloadTpl() {
-  downloadFileURL("/api/ess/sasQuestionGroup/template");
+  await downloadFileURL("/api/ess/sasQuestionGroup/template");
 }
 </script>
 

+ 11 - 10
src/features/projectParamsManagement/ProjectParamsManagement.vue

@@ -21,11 +21,11 @@
           pageSize: pageSize,
           current: pageNo,
           total: totalElements,
-          showTotal: (total: number) => ``,
-          onChange: (pageNoChanged: number, pageSizeChanged: number) => {
-            pageNo = pageNoChanged; 
+          showTotal: () => ``,
+          onChange: (pageNoChanged, pageSizeChanged) => {
+            pageNo = pageNoChanged;
             pageSize = pageSizeChanged;
-          }
+          },
         }"
       >
         <template #course="{ record }">
@@ -115,7 +115,7 @@ import { useRoute } from "vue-router";
 const store = useMainStore();
 store.currentLocation = "项目管理 / 项目列表 / 参数配置";
 
-let rootOrgId = $ref(undefined as unknown as number);
+// let rootOrgId = $ref(undefined as unknown as number);
 let courseId = $ref(undefined as undefined | number);
 const route = useRoute();
 const projectId = +route.params.projectId;
@@ -184,7 +184,7 @@ const columns = [
 ];
 
 onMounted(async () => {
-  rootOrgId = store.userInfo.rootOrgId;
+  // rootOrgId = store.userInfo.rootOrgId;
   await search();
 });
 
@@ -195,7 +195,7 @@ const showModal = (record: any) => {
   visible.value = true;
 };
 
-const handleOk = async (e: MouseEvent) => {
+const handleOk = async () => {
   await updateProjectCourse(toRaw(projectObj));
   visible.value = false;
   await search();
@@ -231,9 +231,10 @@ async function handleImport() {
   if (!res.data.hasError) {
     importModalVisible = false;
     void message.success({ content: "导入成功" });
-    clickSearch();
+    await clickSearch();
   } else {
-    const msg = res.data.failRecords.map((v) =>
+    // eslint-disable-next-line
+    const msg = res.data.failRecords.map((v: any) =>
       h("div", `行号:${v.lineNum}, 错误:${v.msg}`)
     );
     void message.error({
@@ -249,6 +250,6 @@ async function handleExport() {
 }
 
 async function downloadTpl() {
-  downloadFileURL("/api/ess/projectCourse/template");
+  await downloadFileURL("/api/ess/projectCourse/template");
 }
 </script>

+ 24 - 24
src/features/subOrg/SubOrg.vue

@@ -45,12 +45,12 @@
           pageSize: pageSize,
           current: pageNo,
           total: totalElements,
-          showTotal: (total: number) => ``,
-          onChange: (pageNoChanged: number, pageSizeChanged: number) => {
+          showTotal: () => ``,
+          onChange: (pageNoChanged, pageSizeChanged) => {
             selectIds = [];
-            pageNo = pageNoChanged; 
+            pageNo = pageNoChanged;
             pageSize = pageSizeChanged;
-          }
+          },
         }"
       >
         <template #enable="{ text }">
@@ -130,7 +130,6 @@
 
 <script setup lang="ts">
 import {
-  delOrgs,
   exportOrgs,
   getSubOrgList,
   importOrgs,
@@ -139,7 +138,7 @@ import {
 } from "@/api/subOrgPage";
 import { useMainStore } from "@/store";
 import { downloadFileURL } from "@/utils/utils";
-import { message, Modal } from "ant-design-vue";
+import { message } from "ant-design-vue";
 import { watch, onMounted, ref, reactive, toRaw, h } from "vue";
 
 const store = useMainStore();
@@ -233,7 +232,7 @@ const showModal = (record: any) => {
   visible.value = true;
 };
 
-const handleOk = async (e: MouseEvent) => {
+const handleOk = async () => {
   await updateSubOrg(toRaw(orgObj));
   visible.value = false;
   await search();
@@ -248,7 +247,7 @@ const orgObj = reactive({
   rootOrgId: store.userInfo.rootOrgId,
 });
 
-const newOrg = async () => {
+const newOrg = () => {
   Object.assign(orgObj, {
     id: undefined,
     code: "",
@@ -274,20 +273,20 @@ async function handleToggleOrg(enable: boolean, ids: number[]) {
   await search();
 }
 
-async function handleDelOrg(ids: number[]) {
-  if (checkEmpty(ids)) return;
-  Modal.confirm({
-    title: "提示",
-    content: "确认删除?",
-    cancelText: "取消",
-    okText: "确定",
-    onOk: async () => {
-      await delOrgs(ids);
-      await search();
-      void message.success({ content: "操作成功" });
-    },
-  });
-}
+//  function handleDelOrg(ids: number[]) {
+//   if (checkEmpty(ids)) return;
+//   Modal.confirm({
+//     title: "提示",
+//     content: "确认删除?",
+//     cancelText: "取消",
+//     okText: "确定",
+//     onOk: async () => {
+//       await delOrgs(ids);
+//       await search();
+//       void message.success({ content: "操作成功" });
+//     },
+//   });
+// }
 
 /** <handleImport> */
 let importModalVisible = $ref<boolean>(false);
@@ -305,7 +304,8 @@ async function handleImport() {
     importModalVisible = false;
     void message.success({ content: "导入成功" });
   } else {
-    const msg = res.data.failRecords.map((v) =>
+    // eslint-disable-next-line
+    const msg = res.data.failRecords.map((v: any) =>
       h("div", `行号:${v.lineNum}, 错误:${v.msg}`)
     );
     void message.error({
@@ -329,6 +329,6 @@ const rowSelection = {
 };
 
 async function downloadTpl() {
-  downloadFileURL("/api/ess/org/template");
+  await downloadFileURL("/api/ess/org/template");
 }
 </script>

+ 13 - 12
src/features/userManagement/UserManagement.vue

@@ -50,12 +50,12 @@
           pageSize: pageSize,
           current: pageNo,
           total: totalElements,
-          showTotal: (total: number) => ``,
-          onChange: (pageNoChanged: number, pageSizeChanged: number) => {
+          showTotal: () => ``,
+          onChange: (pageNoChanged, pageSizeChanged) => {
             selectIds = [];
-            pageNo = pageNoChanged; 
+            pageNo = pageNoChanged;
             pageSize = pageSizeChanged;
-          }
+          },
         }"
       >
         <template #rootOrgName="{ record }">
@@ -286,7 +286,7 @@ const showModal = (record: any) => {
   visible.value = true;
 };
 
-const handleOk = async (e: MouseEvent) => {
+const handleOk = async () => {
   await updateUser(toRaw(userObj));
   visible.value = false;
   await search();
@@ -305,7 +305,7 @@ const initUser = {
 };
 const userObj = reactive({ ...initUser });
 
-const newUser = async () => {
+const newUser = () => {
   Object.assign(userObj, initUser);
   showModal(userObj);
 };
@@ -324,7 +324,7 @@ async function handleToggleUsers(enable: boolean, ids: number[]) {
   await search();
 }
 
-async function handleResetUsers(ids: number[]) {
+function handleResetUsers(ids: number[]) {
   if (checkEmpty(ids)) return;
   Modal.confirm({
     title: "提示",
@@ -356,9 +356,10 @@ async function handleImport() {
   if (!res.data.hasError) {
     importModalVisible = false;
     void message.success({ content: "导入成功" });
-    clickSearch();
+    await clickSearch();
   } else {
-    const msg = res.data.failRecords.map((v) =>
+    // eslint-disable-next-line
+    const msg = res.data.failRecords.map((v: any) =>
       h("div", `行号:${v.lineNum}, 错误:${v.msg}`)
     );
     void message.error({
@@ -382,10 +383,10 @@ const rowSelection = {
 };
 
 async function downloadTpl() {
-  downloadFileURL("/api/ess/user/template");
+  await downloadFileURL("/api/ess/user/template");
 }
 
-function handleUserPrivilege(userId: number) {
-  router.push("/basic/user/privilege/" + userId);
+async function handleUserPrivilege(userId: number) {
+  await router.push("/basic/user/privilege/" + userId);
 }
 </script>

+ 7 - 2
src/types/index.ts

@@ -116,13 +116,18 @@ export interface SasCourse {
   difficulty: number;
   id: number;
   projectId: number;
-  rangeConfig: string | RangeConfig[];
-  // scoreRange: string | ;
+  rangeConfig: RangeConfig[];
+  scoreRange: number[];
   totalCount: number;
   totalRangeConfig: string;
   totalScore: number;
   totalScoreRange: string;
   totalScoreRangeTitle: string;
+
+  segements: number[][]; // 前端自用
+  rangeSegements: (string | number | boolean)[][]; // 前端自用
+  scoreRangeAcc: number[]; // 前端自用
+  scoreRangeTotal: number; // 前端自用
 }
 
 export interface RangeConfig {