|
@@ -573,6 +573,10 @@ export default {
|
|
|
},
|
|
},
|
|
|
// 手动输入添加学生
|
|
// 手动输入添加学生
|
|
|
addStu() {
|
|
addStu() {
|
|
|
|
|
+ if (this.uploadfileLoading) {
|
|
|
|
|
+ this.$message.warning(this.lang.ssUploading);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
this.selectedStuData = this.selectedStuData.filter((item) => item != "");
|
|
this.selectedStuData = this.selectedStuData.filter((item) => item != "");
|
|
|
if (this.selectedStuData.length == 0) {
|
|
if (this.selectedStuData.length == 0) {
|
|
|
this.$message.error(this.lang.ssEnterStu);
|
|
this.$message.error(this.lang.ssEnterStu);
|
|
@@ -631,52 +635,55 @@ export default {
|
|
|
e.mail = e.account;
|
|
e.mail = e.account;
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- const batchSize = 50;
|
|
|
|
|
- if (data1.length > 0) {
|
|
|
|
|
- if (data1.length > batchSize) {
|
|
|
|
|
- // 计算总批次数
|
|
|
|
|
- const totalBatches = Math.ceil(data1.length / batchSize);
|
|
|
|
|
- for (let i = 0; i < totalBatches; i++) {
|
|
|
|
|
- const batch = data1.slice(i * batchSize, (i + 1) * batchSize);
|
|
|
|
|
- await this.uploadBatch(batch); // 假设 uploadBatch 返回 Promise
|
|
|
|
|
- console.log(`普通上传第 ${i + 1} 批上传完成`, batch);
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ const batchSize = 50;
|
|
|
|
|
+ if (data1.length > 0) {
|
|
|
|
|
+ if (data1.length > batchSize) {
|
|
|
|
|
+ // 计算总批次数
|
|
|
|
|
+ const totalBatches = Math.ceil(data1.length / batchSize);
|
|
|
|
|
+ for (let i = 0; i < totalBatches; i++) {
|
|
|
|
|
+ const batch = data1.slice(i * batchSize, (i + 1) * batchSize);
|
|
|
|
|
+ await this.uploadBatch(batch); // 假设 uploadBatch 返回 Promise
|
|
|
|
|
+ console.log(`普通上传第 ${i + 1} 批上传完成`, batch);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 长度不超过 10,直接上传整个数组
|
|
|
|
|
+ await this.uploadBatch(data1);
|
|
|
}
|
|
}
|
|
|
- } else {
|
|
|
|
|
- // 长度不超过 10,直接上传整个数组
|
|
|
|
|
- await this.uploadBatch(data1);
|
|
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- if (data2.length > 0) {
|
|
|
|
|
- if (data2.length > batchSize) {
|
|
|
|
|
- // 计算总批次数
|
|
|
|
|
- const totalBatches = Math.ceil(data2.length / batchSize);
|
|
|
|
|
- for (let i = 0; i < totalBatches; i++) {
|
|
|
|
|
- const batch = data2.slice(i * batchSize, (i + 1) * batchSize);
|
|
|
|
|
- await this.uploadBatchAccount (batch); // 假设 uploadBatch 返回 Promise
|
|
|
|
|
- console.log(`自定义账号上传第 ${i + 1} 批上传完成`, batch);
|
|
|
|
|
|
|
+ if (data2.length > 0) {
|
|
|
|
|
+ if (data2.length > batchSize) {
|
|
|
|
|
+ // 计算总批次数
|
|
|
|
|
+ const totalBatches = Math.ceil(data2.length / batchSize);
|
|
|
|
|
+ for (let i = 0; i < totalBatches; i++) {
|
|
|
|
|
+ const batch = data2.slice(i * batchSize, (i + 1) * batchSize);
|
|
|
|
|
+ await this.uploadBatchAccount (batch); // 假设 uploadBatch 返回 Promise
|
|
|
|
|
+ console.log(`自定义账号上传第 ${i + 1} 批上传完成`, batch);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 长度不超过 10,直接上传整个数组
|
|
|
|
|
+ await this.uploadBatchAccount (data2);
|
|
|
}
|
|
}
|
|
|
- } else {
|
|
|
|
|
- // 长度不超过 10,直接上传整个数组
|
|
|
|
|
- await this.uploadBatchAccount (data2);
|
|
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- this.$message({
|
|
|
|
|
- message: this.lang.ssAddOk,
|
|
|
|
|
- type: "success",
|
|
|
|
|
- });
|
|
|
|
|
- this.uploadfileLoading = false;
|
|
|
|
|
|
|
+ this.$message({
|
|
|
|
|
+ message: this.lang.ssAddOk,
|
|
|
|
|
+ type: "success",
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- this.deltypy = 0;
|
|
|
|
|
- this.popBoxdia= true;
|
|
|
|
|
- // this.addStuVisible = false;
|
|
|
|
|
- console.log('this.selectedStuData',this.selectedStuData);
|
|
|
|
|
-
|
|
|
|
|
- // this.selectedStuData = [];
|
|
|
|
|
- this.$emit("getCascaderData");
|
|
|
|
|
- this.addOp3('1', "", { type: "student_add" }, "success")
|
|
|
|
|
|
|
+ this.deltypy = 0;
|
|
|
|
|
+ this.popBoxdia= true;
|
|
|
|
|
+ // this.addStuVisible = false;
|
|
|
|
|
+ console.log('this.selectedStuData',this.selectedStuData);
|
|
|
|
|
+
|
|
|
|
|
+ // this.selectedStuData = [];
|
|
|
|
|
+ this.$emit("getCascaderData");
|
|
|
|
|
+ this.addOp3('1', "", { type: "student_add" }, "success")
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ this.uploadfileLoading = false;
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
async uploadBatch(box){
|
|
async uploadBatch(box){
|
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|