|
|
@@ -169,9 +169,12 @@
|
|
|
>{{ lang.ssDownloadTemp }}</span
|
|
|
>
|
|
|
</div>
|
|
|
- <div style="margin-top: 10px">
|
|
|
+ <div v-if="boxType == 0" style="margin-top: 10px">
|
|
|
{{ lang.ssUploadNote }}
|
|
|
</div>
|
|
|
+ <div v-else style="margin-top: 10px">
|
|
|
+ {{ lang.ssSyncImportClassInfo }}
|
|
|
+ </div>
|
|
|
<!-- <div style="margin-top: 10px">
|
|
|
学生列表批量上传需表格需添加“班级”列
|
|
|
</div> -->
|
|
|
@@ -433,7 +436,7 @@ export default {
|
|
|
var wb; //读取完成的数据
|
|
|
var outdata;
|
|
|
var reader = new FileReader();
|
|
|
- reader.onload = function (e) {
|
|
|
+ reader.onload = async function (e) {
|
|
|
var bytes = new Uint8Array(reader.result);
|
|
|
var length = bytes.byteLength;
|
|
|
for (var i = 0; i < length; i++) {
|
|
|
@@ -473,7 +476,7 @@ export default {
|
|
|
} else {
|
|
|
obj.mail = uuidv4() + "@" + _this.userSuffix;
|
|
|
}
|
|
|
- obj.class = _this.boxType == 2 ? v[_this.lang.Class] : _this.classInfo.name;
|
|
|
+ obj.class = _this.boxType == 2 ? v[_this.lang.Class] : _this.classInfo.id;
|
|
|
arr.push(obj);
|
|
|
}else{
|
|
|
_this.$message.error(_this.lang.ssCheckStuNameCol);
|
|
|
@@ -481,22 +484,35 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
console.log(arr);
|
|
|
- // if (arr.length > 70) {
|
|
|
- // _this.$message.error(_this.lang.Limitmore);
|
|
|
- // return;
|
|
|
- // }
|
|
|
-
|
|
|
- if (this.boxType == 2 && arr.filter(e => e.class) != arr.length) {
|
|
|
- _this.$message.error(_this.lang.ssCheckClassCol);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
if (!arr.length) {
|
|
|
_this.$message.error(
|
|
|
_this.lang.ssParseStuFail
|
|
|
);
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ if (_this.boxType == 2) {
|
|
|
+ let stuClassInfo = await _this.getClassInfo();
|
|
|
+ console.log(stuClassInfo, "stuClassInfo");
|
|
|
+ arr.forEach((e) => {
|
|
|
+ let classInfo = stuClassInfo.find(item => item.name == e.class);
|
|
|
+ if (classInfo) {
|
|
|
+ e.class = classInfo.id;
|
|
|
+ } else {
|
|
|
+ e.class = '';
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ console.log(arr, "arr");
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if (_this.boxType == 2 && arr.filter(e => e.class).length !== arr.length) {
|
|
|
+ _this.$message.error(_this.lang.ssCheckClassCol);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
_this.deltypy = 1;
|
|
|
_this.popBoxdia= true;
|
|
|
_this.stuexcel = arr;
|
|
|
@@ -511,6 +527,37 @@ export default {
|
|
|
reader.readAsBinaryString(f);
|
|
|
}
|
|
|
},
|
|
|
+ async getClassInfo() {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ let params = {
|
|
|
+ oid: this.oid,
|
|
|
+ };
|
|
|
+ this.ajax
|
|
|
+ .get(this.$store.state.api + "selectGradeNew", params)
|
|
|
+ .then((res) => {
|
|
|
+ let box1 = JSON.parse(JSON.stringify(res.data[0]));
|
|
|
+ let box2 = JSON.parse(JSON.stringify(res.data[1]));
|
|
|
+
|
|
|
+ // box1.push({id:0,name:this.lang.ssInterestClass});
|
|
|
+
|
|
|
+ const gradeIds = box1.filter(e => e.id !== 0).map(e => e.id);
|
|
|
+
|
|
|
+ let box3 = [];
|
|
|
+
|
|
|
+ box2.forEach((e) => {
|
|
|
+ if (gradeIds.includes(e.pid)) {
|
|
|
+ e.name = box1.find(item => item.id == e.pid).name + e.name;
|
|
|
+ box3.push(e);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ resolve(box3);
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.error(err);
|
|
|
+ reject(err);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
// 手动输入添加学生
|
|
|
addStu() {
|
|
|
this.selectedStuData = this.selectedStuData.filter((item) => item != "");
|
|
|
@@ -550,15 +597,13 @@ export default {
|
|
|
if (this.boxType == 2) {
|
|
|
classInfo = this.cascaderData.flatMap((item) => item.children).filter((item) => this.cascaderDataPath[1]==item.id)[0];
|
|
|
}
|
|
|
- // console.log(classInfo, "classInfo");
|
|
|
let box = this.selectedStuData.map((item) => {
|
|
|
return {
|
|
|
name: item,
|
|
|
mail: uuidv4() + mail,
|
|
|
- class: classInfo.name,
|
|
|
+ class: classInfo.id,
|
|
|
};
|
|
|
});
|
|
|
- // console.log(box, "box");
|
|
|
|
|
|
this.accUpdate(box);
|
|
|
},
|
|
|
@@ -606,10 +651,10 @@ export default {
|
|
|
oid: this.oid,
|
|
|
},
|
|
|
];
|
|
|
- console.log(params, "batchRegistrationMoreCopy");
|
|
|
+ console.log(params, "batchRegistrationMoreCopyNew");
|
|
|
// batchRegistrationMoreCopy
|
|
|
this.ajax
|
|
|
- .post(this.$store.state.api + "batchRegistrationMoreCopy", params)
|
|
|
+ .post(this.$store.state.api + "batchRegistrationMoreCopyNew", params)
|
|
|
.then((res) => {
|
|
|
console.log(res, "res");
|
|
|
if (res.data.type == 1) {
|