|
@@ -15,16 +15,18 @@
|
|
<div class="progress-box">
|
|
<div class="progress-box">
|
|
<h3 id="message">正在下载考生...</h3>
|
|
<h3 id="message">正在下载考生...</h3>
|
|
<div class="progress">
|
|
<div class="progress">
|
|
- <div class="progress-outer">
|
|
|
|
|
|
+ <!-- <div class="progress-outer">
|
|
<div id="progress" class="progress-inner" style="width: 0%">
|
|
<div id="progress" class="progress-inner" style="width: 0%">
|
|
<span class="progress-text"></span>
|
|
<span class="progress-text"></span>
|
|
</div>
|
|
</div>
|
|
- </div>
|
|
|
|
|
|
+ </div> -->
|
|
|
|
+ <a-progress
|
|
|
|
+ :percent="Math.round((finishCount / totalCount) * 100)"
|
|
|
|
+ />
|
|
</div>
|
|
</div>
|
|
<p>
|
|
<p>
|
|
- 已数据同步考生:<b id="finish-count"></b> / 全部考生:<b
|
|
|
|
- id="total-count"
|
|
|
|
- ></b>
|
|
|
|
|
|
+ 已数据同步考生:<b id="finish-count">{{ finishCount }}</b> /
|
|
|
|
+ 全部考生:<b id="total-count">{{ totalCount }}</b>
|
|
</p>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -52,35 +54,97 @@
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
import { store } from "@/store";
|
|
import { store } from "@/store";
|
|
-import { computed, onMounted, ref } from "vue";
|
|
|
|
|
|
+import { onMounted, ref } from "vue";
|
|
import router from "@/router";
|
|
import router from "@/router";
|
|
-import { getStudents, countStudents } from "@/api/api";
|
|
|
|
-import { httpApp } from "@/plugins/axiosApp";
|
|
|
|
|
|
+import { getStudents, countStudents, getPackages } from "@/api/api";
|
|
|
|
|
|
const lastTime =
|
|
const lastTime =
|
|
store.config["syncTime"][store.env.server.host + store.env.exam.id];
|
|
store.config["syncTime"][store.env.server.host + store.env.exam.id];
|
|
|
|
|
|
-let studentCount = ref(0);
|
|
|
|
|
|
+let finishCount = ref(0);
|
|
|
|
+let totalCount = ref(0);
|
|
|
|
+let finished = ref(false);
|
|
onMounted(async () => {
|
|
onMounted(async () => {
|
|
- const studentCountRes = await window.electron.queryStudentCount(
|
|
|
|
- JSON.parse(JSON.stringify(store))
|
|
|
|
- );
|
|
|
|
- console.log(studentCountRes);
|
|
|
|
- studentCount.value = studentCountRes;
|
|
|
|
|
|
+ const res = await countStudents(store.env.examId);
|
|
|
|
+ totalCount.value = res.data;
|
|
|
|
|
|
- console.log("waiting ipcMain");
|
|
|
|
- window.electron.updateSyncRun((event) => {
|
|
|
|
- console.log(event);
|
|
|
|
- });
|
|
|
|
-});
|
|
|
|
-window.electron.receiveMessage((msg) => {
|
|
|
|
- console.log(msg);
|
|
|
|
|
|
+ let pageNumber = 0;
|
|
|
|
+
|
|
|
|
+ while (true) {
|
|
|
|
+ pageNumber++;
|
|
|
|
+ const array = (
|
|
|
|
+ await getStudents(store.env.examId, pageNumber, 100, {
|
|
|
|
+ withScoreDetail: true,
|
|
|
|
+ })
|
|
|
|
+ ).data;
|
|
|
|
+ if (array == undefined || array.length == 0) {
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ const datas = [];
|
|
|
|
+ for (let i = 0; i < array.length; i++) {
|
|
|
|
+ const obj = array[i];
|
|
|
|
+ var objList = [];
|
|
|
|
+ var subList = [];
|
|
|
|
+ if (obj.objectiveScoreDetail) {
|
|
|
|
+ obj.objectiveScoreDetail.forEach((detail) => {
|
|
|
|
+ const score = Math.round((detail.score * 10) / 10);
|
|
|
|
+ objList.push(detail.answer + ":" + score);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ if (obj.subjectiveScoreDetail) {
|
|
|
|
+ obj.subjectiveScoreDetail.forEach((detail) => {
|
|
|
|
+ const score = Math.round((detail.score * 10) / 10);
|
|
|
|
+ subList.push(score);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ datas.push([
|
|
|
|
+ obj["id"],
|
|
|
|
+ store.env.examId,
|
|
|
|
+ obj["schoolId"],
|
|
|
|
+ obj["examNumber"],
|
|
|
|
+ obj["examNumber"],
|
|
|
|
+ obj["name"],
|
|
|
|
+ obj["studentCode"],
|
|
|
|
+ obj["subjectCode"],
|
|
|
|
+ obj["subjectName"],
|
|
|
|
+ obj["campusName"],
|
|
|
|
+ obj["packageCode"],
|
|
|
|
+ obj["batchCode"],
|
|
|
|
+ obj["sheetCount"],
|
|
|
|
+ obj["sliceCount"],
|
|
|
|
+ obj["answers"],
|
|
|
|
+ obj["upload"] ? 1 : 0,
|
|
|
|
+ obj["absent"] ? 1 : 0,
|
|
|
|
+ obj["breach"] ? 1 : 0,
|
|
|
|
+ obj["manualAbsent"] ? 1 : 0,
|
|
|
|
+ obj["objectiveScore"].length > 0 ? obj["objectiveScore"] : 0,
|
|
|
|
+ obj["subjectiveScore"].length > 0 ? obj["subjectiveScore"] : 0,
|
|
|
|
+ objList.join(";"),
|
|
|
|
+ subList.join(";"),
|
|
|
|
+ obj["subjectiveStatus"] || "UNMARK",
|
|
|
|
+ obj["examSite"],
|
|
|
|
+ obj["examRoom"],
|
|
|
|
+ obj["remark"],
|
|
|
|
+ obj["college"] || "",
|
|
|
|
+ obj["className"] || "",
|
|
|
|
+ obj["teacher"] || "",
|
|
|
|
+ obj["paperType"] || "",
|
|
|
|
+ ]);
|
|
|
|
+ }
|
|
|
|
+ console.log("get:" + array.length);
|
|
|
|
+ await window.electron.replaceStudents(datas);
|
|
|
|
+ finishCount.value += array.length;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //get and save package
|
|
|
|
+ const packages = (await getPackages(store.env.examId)).data;
|
|
|
|
+ const packageData = [];
|
|
|
|
+ for (let i = 0; i < packages.length; i++) {
|
|
|
|
+ const obj = packages[i];
|
|
|
|
+ packageData.push([store.env.examId, obj["code"], obj["picCount"]]);
|
|
|
|
+ }
|
|
|
|
+ await window.electron.replacePackage(packageData);
|
|
|
|
+
|
|
|
|
+ finished.value = true;
|
|
});
|
|
});
|
|
-console.log(window.electron.syncer);
|
|
|
|
-const _sync = window.electron.syncer;
|
|
|
|
-console.log(_sync);
|
|
|
|
-console.log(window.electron.dialog);
|
|
|
|
-window.electron.syncer(JSON.parse(JSON.stringify(store)));
|
|
|
|
-// _sync.on("total", (c) => console.log(c));
|
|
|
|
-// _sync.start();
|
|
|
|
</script>
|
|
</script>
|