|
@@ -71,14 +71,14 @@
|
|
<!--新增学生表单-->
|
|
<!--新增学生表单-->
|
|
<Form ref="studentInfoForm" :model="studentInfo" label-position="top" :rules="ruleValidate" :show-message="showError" v-if="bizType == 1">
|
|
<Form ref="studentInfoForm" :model="studentInfo" label-position="top" :rules="ruleValidate" :show-message="showError" v-if="bizType == 1">
|
|
<!-- ID -->
|
|
<!-- ID -->
|
|
- <FormItem :label="$t('stuAccount.accountInfo')" prop="studentId">
|
|
|
|
- <Input v-model="studentInfo.studentId" :placeholder="$t('stuAccount.accountHolder')" @on-change="setPassword(same)">
|
|
|
|
|
|
+ <FormItem :label="$t('stuAccount.accountInfo')" prop="id">
|
|
|
|
+ <Input v-model="studentInfo.id" :placeholder="$t('stuAccount.accountHolder')" @on-change="setPassword(same)">
|
|
<!-- <span slot="prepend">{{schoolCode}}#</span> 前方 -->
|
|
<!-- <span slot="prepend">{{schoolCode}}#</span> 前方 -->
|
|
</Input>
|
|
</Input>
|
|
</FormItem>
|
|
</FormItem>
|
|
<!-- 密碼 -->
|
|
<!-- 密碼 -->
|
|
- <FormItem :label="$t('stuAccount.passwordInfo')" prop="password.value">
|
|
|
|
- <Input v-model="studentInfo.password.value" type="password" password :placeholder="$t('stuAccount.passwordHolder')"></Input>
|
|
|
|
|
|
+ <FormItem :label="$t('stuAccount.passwordInfo')" prop="pw">
|
|
|
|
+ <Input v-model="studentInfo.pw" type="password" password :placeholder="$t('stuAccount.passwordHolder')"></Input>
|
|
<Checkbox v-model="same" @on-change="setPassword">{{$t('stuAccount.isSame')}}</Checkbox>
|
|
<Checkbox v-model="same" @on-change="setPassword">{{$t('stuAccount.isSame')}}</Checkbox>
|
|
</FormItem>
|
|
</FormItem>
|
|
<!-- 姓名 -->
|
|
<!-- 姓名 -->
|
|
@@ -86,19 +86,16 @@
|
|
<Input v-model="studentInfo.name" :placeholder="$t('stuAccount.stuNameHolder')"></Input>
|
|
<Input v-model="studentInfo.name" :placeholder="$t('stuAccount.stuNameHolder')"></Input>
|
|
</FormItem>
|
|
</FormItem>
|
|
<!-- 教室資訊 -->
|
|
<!-- 教室資訊 -->
|
|
- <FormItem :label="$t('stuAccount.classroomInfo')" prop="classroomCode">
|
|
|
|
- <Select filterable style="width:100%" :placeholder="$t('stuAccount.classroomInfoHolder')" v-model="studentInfo.classroomCode" clearable>
|
|
|
|
|
|
+ <FormItem :label="$t('stuAccount.classroomInfo')" prop="classId">
|
|
|
|
+ <Select filterable style="width:100%" :placeholder="$t('stuAccount.classroomInfoHolder')" v-model="studentInfo.classId" clearable>
|
|
<Option v-for="(item,index) in classes" :value="item.id" :key="index" @click.native="setCurrentClassDetail(item)">{{ item.name }}</Option>
|
|
<Option v-for="(item,index) in classes" :value="item.id" :key="index" @click.native="setCurrentClassDetail(item)">{{ item.name }}</Option>
|
|
</Select>
|
|
</Select>
|
|
<span style="float:right;color:#6DE2C4;cursor:pointer;text-decoration:underline;font-size:12px;" @click="createClassroom">{{$t('stuAccount.newClassroom')}}</span>
|
|
<span style="float:right;color:#6DE2C4;cursor:pointer;text-decoration:underline;font-size:12px;" @click="createClassroom">{{$t('stuAccount.newClassroom')}}</span>
|
|
</FormItem>
|
|
</FormItem>
|
|
- <!--<FormItem :label="$t('stuAccount.periodInfo')" prop="periodCode">
|
|
|
|
- <span style="color:white;margin-left:15px;">{{fn.getPeriod($store.state.schoolBaseInfo.schoolBaseInfo,studentInfo.periodCode).periodName}}</span>
|
|
|
|
- </FormItem>-->
|
|
|
|
<div style="display:flex;justify-content: space-between;">
|
|
<div style="display:flex;justify-content: space-between;">
|
|
<!-- 座位號 -->
|
|
<!-- 座位號 -->
|
|
- <FormItem :label="$t('stuAccount.stuSeatNo')" prop="seatNo" style="width:45%">
|
|
|
|
- <InputNumber v-model="studentInfo.seatNo" :min="1" :placeholder="$t('stuAccount.stuSeatNoHolder')"></InputNumber>
|
|
|
|
|
|
+ <FormItem :label="$t('stuAccount.stuSeatNo')" prop="no" style="width:45%">
|
|
|
|
+ <InputNumber v-model="studentInfo.no" :min="1" :placeholder="$t('stuAccount.stuSeatNoHolder')"></InputNumber>
|
|
</FormItem>
|
|
</FormItem>
|
|
<!-- 學級 -->
|
|
<!-- 學級 -->
|
|
<FormItem :label="$t('stuAccount.gradeInfo')" prop="gradeCode" style="width:45%">
|
|
<FormItem :label="$t('stuAccount.gradeInfo')" prop="gradeCode" style="width:45%">
|
|
@@ -107,8 +104,8 @@
|
|
</div>
|
|
</div>
|
|
<div style="display:flex;justify-content: space-between;">
|
|
<div style="display:flex;justify-content: space-between;">
|
|
<!-- 學年度 -->
|
|
<!-- 學年度 -->
|
|
- <FormItem :label="$t('stuAccount.academicYear')" prop="academicYear" style="width:45%">
|
|
|
|
- <InputNumber v-model="studentInfo.academicYear" :editable="false"></InputNumber>
|
|
|
|
|
|
+ <FormItem :label="$t('stuAccount.academicYear')" prop="year" style="width:45%">
|
|
|
|
+ <InputNumber v-model="studentInfo.year" :editable="false"></InputNumber>
|
|
</FormItem>
|
|
</FormItem>
|
|
</div>
|
|
</div>
|
|
</Form>
|
|
</Form>
|
|
@@ -116,38 +113,43 @@
|
|
<!--修改信息表单-->
|
|
<!--修改信息表单-->
|
|
<Form ref="updateForm" :model="editStudentInfo[0]" label-position="top" :rules="ruleValidate" :show-message="showError" v-if="bizType == 2">
|
|
<Form ref="updateForm" :model="editStudentInfo[0]" label-position="top" :rules="ruleValidate" :show-message="showError" v-if="bizType == 2">
|
|
<FormItem :label="$t('stuAccount.chooseInfo')" v-if="editStudentInfo.length > 1">
|
|
<FormItem :label="$t('stuAccount.chooseInfo')" v-if="editStudentInfo.length > 1">
|
|
- <span class="account-item" :key="index" v-for="(item,index) in editStudentInfo">{{item.studentId}}{{index < editStudentInfo.length - 1 ? ", ":""}}</span>
|
|
|
|
|
|
+ <span class="account-item" :key="index" v-for="(item,index) in editStudentInfo">{{item.id}}{{index < editStudentInfo.length - 1 ? ", ":""}}</span>
|
|
</FormItem>
|
|
</FormItem>
|
|
<FormItem :label="$t('stuAccount.chooseNum') + editStudentInfo.length + $t('stuAccount.numUnit')" v-if="editStudentInfo.length > 1">
|
|
<FormItem :label="$t('stuAccount.chooseNum') + editStudentInfo.length + $t('stuAccount.numUnit')" v-if="editStudentInfo.length > 1">
|
|
</FormItem>
|
|
</FormItem>
|
|
- <FormItem :label="$t('stuAccount.accountInfo')" prop="studentId" v-if="editStudentInfo.length == 1">
|
|
|
|
- <Input v-model="editStudentInfo[0].studentId" disabled :placeholder="$t('stuAccount.accountHolder')" @on-change="setPassword(same)">
|
|
|
|
- <span slot="prepend">{{schoolCode}}#</span>
|
|
|
|
- </Input>
|
|
|
|
|
|
+ <FormItem :label="$t('stuAccount.accountInfo')" prop="id" v-if="editStudentInfo.length == 1">
|
|
|
|
+ <Input v-model="editStudentInfo[0].id" disabled :placeholder="$t('stuAccount.accountHolder')" @on-change="setPassword(same)"></Input>
|
|
</FormItem>
|
|
</FormItem>
|
|
- <FormItem :label="$t('stuAccount.passwordInfo')" prop="password" v-if="editStudentInfo.length == 1">
|
|
|
|
- <Input v-model="editStudentInfo[0].password.value" type="password" disabled :placeholder="$t('stuAccount.passwordHolder')">
|
|
|
|
- <span slot="append" size="small" style="cursor:pointer;">重置密码</span>
|
|
|
|
|
|
+ <FormItem :label="$t('stuAccount.passwordInfo')" prop="pw" v-if="editStudentInfo.length == 1">
|
|
|
|
+ <Input v-model="editStudentInfo[0].pw" disabled type="text" :placeholder="$t('stuAccount.passwordHolder')">
|
|
|
|
+ <span slot="append" size="small" style="cursor:pointer;" @click="setPassword(true)">重置密码</span>
|
|
</Input>
|
|
</Input>
|
|
</FormItem>
|
|
</FormItem>
|
|
<FormItem :label="$t('stuAccount.stuName')" prop="name" v-if="editStudentInfo.length == 1">
|
|
<FormItem :label="$t('stuAccount.stuName')" prop="name" v-if="editStudentInfo.length == 1">
|
|
<Input v-model="editStudentInfo[0].name" :placeholder="$t('stuAccount.stuNameHolder')"></Input>
|
|
<Input v-model="editStudentInfo[0].name" :placeholder="$t('stuAccount.stuNameHolder')"></Input>
|
|
</FormItem>
|
|
</FormItem>
|
|
- <FormItem :label="$t('stuAccount.classroomInfo')" prop="classroomCode">
|
|
|
|
- <Select filterable style="width:100%" v-model="editStudentInfo[0].classroomCode" :placeholder="$t('stuAccount.classroomInfoHolder')" clearable>
|
|
|
|
- <Option v-for="(item,index) in classes" :value="item.id" :key="item.id" @click.native="getCurrentClassroom(index)">{{ item.name }}</Option>
|
|
|
|
|
|
+ <FormItem :label="$t('stuAccount.classroomInfo')" prop="classId">
|
|
|
|
+ <Select filterable style="width:100%" v-model="editStudentInfo[0].classId" :placeholder="$t('stuAccount.classroomInfoHolder')" clearable>
|
|
|
|
+ <Option v-for="(item) in classes" :value="item.id" :key="item.id" @click.native="setCurrentClassDetail(item)">{{ item.name }}</Option>
|
|
</Select>
|
|
</Select>
|
|
<span style="float:right;color:#6DE2C4;cursor:pointer;text-decoration:underline;" @click="createClassroom">{{$t('stuAccount.newClassroom')}}</span>
|
|
<span style="float:right;color:#6DE2C4;cursor:pointer;text-decoration:underline;" @click="createClassroom">{{$t('stuAccount.newClassroom')}}</span>
|
|
</FormItem>
|
|
</FormItem>
|
|
<div style="display:flex;justify-content: space-between;" v-if="editStudentInfo.length == 1">
|
|
<div style="display:flex;justify-content: space-between;" v-if="editStudentInfo.length == 1">
|
|
- <FormItem :label="$t('stuAccount.stuSeatNo')" prop="seatNo" style="width:45%">
|
|
|
|
- <Input type="number" number v-model="editStudentInfo[0].seatNo" :min="1" :placeholder="$t('stuAccount.stuSeatNoHolder')"></Input>
|
|
|
|
|
|
+ <FormItem :label="$t('stuAccount.stuSeatNo')" prop="no" style="width:45%">
|
|
|
|
+ <Input type="number" number v-model="editStudentInfo[0].no" :min="1" :placeholder="$t('stuAccount.stuSeatNoHolder')"></Input>
|
|
</FormItem>
|
|
</FormItem>
|
|
<FormItem :label="$t('stuAccount.gradeInfo')" prop="gradeCode" style="width:45%">
|
|
<FormItem :label="$t('stuAccount.gradeInfo')" prop="gradeCode" style="width:45%">
|
|
- <span style="color:white;">{{editStudentInfo[0].gradeName}}</span>
|
|
|
|
|
|
+ <span style="color:white;">{{ gradeName }}</span>
|
|
|
|
+ </FormItem>
|
|
|
|
+ </div>
|
|
|
|
+ <div style="display:flex;justify-content: space-between;">
|
|
|
|
+ <!-- 學年度 -->
|
|
|
|
+ <FormItem :label="$t('stuAccount.academicYear')" prop="year" style="width:45%">
|
|
|
|
+ <InputNumber v-model="editStudentInfo[0].year" :editable="false"></InputNumber>
|
|
</FormItem>
|
|
</FormItem>
|
|
</div>
|
|
</div>
|
|
</Form>
|
|
</Form>
|
|
|
|
+
|
|
<Button @click="confirm()" :loading="isLoading" type="success" :class="isFull?'confirm-btn confirm-btn-active':'confirm-btn'">{{isFull ? $t('stuAccount.submitActive'): bizType == 1 ? $t('stuAccount.submitAccount'):$t('stuAccount.submitActive')}}</Button>
|
|
<Button @click="confirm()" :loading="isLoading" type="success" :class="isFull?'confirm-btn confirm-btn-active':'confirm-btn'">{{isFull ? $t('stuAccount.submitActive'): bizType == 1 ? $t('stuAccount.submitAccount'):$t('stuAccount.submitActive')}}</Button>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
@@ -170,7 +172,7 @@
|
|
default: () => {
|
|
default: () => {
|
|
return [
|
|
return [
|
|
{
|
|
{
|
|
- classroomCode: ''
|
|
|
|
|
|
+ classId: ''
|
|
}
|
|
}
|
|
]
|
|
]
|
|
}
|
|
}
|
|
@@ -183,19 +185,26 @@
|
|
data() {
|
|
data() {
|
|
const validateSeatNo = (rule, value, callback) => {
|
|
const validateSeatNo = (rule, value, callback) => {
|
|
let flag = (value == null || typeof value == 'undefined' || value === '')
|
|
let flag = (value == null || typeof value == 'undefined' || value === '')
|
|
- if (flag && (this.studentInfo.classroomCode != null && typeof this.studentInfo.classroomCode != 'undefined' && this.studentInfo.classroomCode !=='')) {
|
|
|
|
|
|
+ if (flag && (this.studentInfo.classId != null && typeof this.studentInfo.classId != 'undefined' && this.studentInfo.classId !=='')) {
|
|
callback(new Error('学生座位号不能为空'));
|
|
callback(new Error('学生座位号不能为空'));
|
|
} else {
|
|
} else {
|
|
callback();
|
|
callback();
|
|
}
|
|
}
|
|
};
|
|
};
|
|
- const validateClassroomCode = (rule, value, callback) => {
|
|
|
|
- if (value === '' && (this.studentInfo.seatNo != null && typeof this.studentInfo.seatNo != 'undefined' && this.studentInfo.seatNo !=='')) {
|
|
|
|
|
|
+ const validateclassId = (rule, value, callback) => {
|
|
|
|
+ if (value === '' && (this.studentInfo.no != null && typeof this.studentInfo.no != 'undefined' && this.studentInfo.no !=='')) {
|
|
callback(new Error('班级资讯不能为空'));
|
|
callback(new Error('班级资讯不能为空'));
|
|
} else {
|
|
} else {
|
|
callback()
|
|
callback()
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
+ const validatePw = (rule, value, callback) => {
|
|
|
|
+ if(this.bizType == 1 && value === ''){
|
|
|
|
+ callback(new Error('密码不能为空'));
|
|
|
|
+ } else {
|
|
|
|
+ callback()
|
|
|
|
+ }
|
|
|
|
+ };
|
|
return {
|
|
return {
|
|
fn,
|
|
fn,
|
|
isLoading: false,
|
|
isLoading: false,
|
|
@@ -207,33 +216,32 @@
|
|
list: [],
|
|
list: [],
|
|
studentInfo: {
|
|
studentInfo: {
|
|
name: '',
|
|
name: '',
|
|
- studentId: '',
|
|
|
|
- seatNo: null,
|
|
|
|
- classroomCode:'',
|
|
|
|
|
|
+ id: '',
|
|
|
|
+ no: null,
|
|
|
|
+ classId:'',
|
|
className:'',
|
|
className:'',
|
|
// periodCode:'',
|
|
// periodCode:'',
|
|
// gradeCode:'',
|
|
// gradeCode:'',
|
|
- password: {
|
|
|
|
- value: ''
|
|
|
|
- },
|
|
|
|
- academicYear: new Date().getFullYear()
|
|
|
|
|
|
+ pw: '',
|
|
|
|
+ year: new Date().getFullYear()
|
|
},
|
|
},
|
|
gradeName:'',
|
|
gradeName:'',
|
|
ruleValidate: {
|
|
ruleValidate: {
|
|
- studentId: [
|
|
|
|
|
|
+ id: [
|
|
{ required: true, message: '账号不能为空', trigger: 'blur' }
|
|
{ required: true, message: '账号不能为空', trigger: 'blur' }
|
|
],
|
|
],
|
|
- 'password.value': [
|
|
|
|
- { required: true, message: '密码不能为空', trigger: 'blur' }
|
|
|
|
|
|
+ pw: [
|
|
|
|
+ // { required: true, message: '密码不能为空', trigger: 'blur' }
|
|
|
|
+ { validator: validatePw, trigger: 'blur' }
|
|
],
|
|
],
|
|
name: [
|
|
name: [
|
|
{ required: true, message: '学生姓名不能为空', trigger: 'blur' }
|
|
{ required: true, message: '学生姓名不能为空', trigger: 'blur' }
|
|
],
|
|
],
|
|
- seatNo: [
|
|
|
|
|
|
+ no: [
|
|
{ validator: validateSeatNo, type: 'number', trigger: 'blur' }
|
|
{ validator: validateSeatNo, type: 'number', trigger: 'blur' }
|
|
],
|
|
],
|
|
- classroomCode: [
|
|
|
|
- { validator: validateClassroomCode, trigger: 'blur' },
|
|
|
|
|
|
+ classId: [
|
|
|
|
+ { validator: validateclassId, trigger: 'blur' },
|
|
]
|
|
]
|
|
},
|
|
},
|
|
modal_loading: false
|
|
modal_loading: false
|
|
@@ -250,9 +258,9 @@
|
|
get() {
|
|
get() {
|
|
// if (this.bizType == 2 && this.isShow == true) {
|
|
// if (this.bizType == 2 && this.isShow == true) {
|
|
// if (this.editStudentInfo.length == 1) {
|
|
// if (this.editStudentInfo.length == 1) {
|
|
- // let arr = this.editStudentInfo[0].studentId.split("#");
|
|
|
|
|
|
+ // let arr = this.editStudentInfo[0].id.split("#");
|
|
// if (arr.length > 1) {
|
|
// if (arr.length > 1) {
|
|
- // this.editStudentInfo[0].studentId = arr[1];
|
|
|
|
|
|
+ // this.editStudentInfo[0].id = arr[1];
|
|
// } else {
|
|
// } else {
|
|
// alert("学生账号格式错误!");
|
|
// alert("学生账号格式错误!");
|
|
// }
|
|
// }
|
|
@@ -276,17 +284,9 @@
|
|
setPassword(data) {
|
|
setPassword(data) {
|
|
//bizType 编辑
|
|
//bizType 编辑
|
|
if (this.bizType == 2) {
|
|
if (this.bizType == 2) {
|
|
- if (data) {
|
|
|
|
- this.$set(this.editStudentInfo[0], 'password.value', this.editStudentInfo[0].studentId)
|
|
|
|
- } else {
|
|
|
|
- // this.$set(this.editStudentInfo[0], 'password', "");
|
|
|
|
- }
|
|
|
|
|
|
+ this.$set(this.editStudentInfo[0], 'pw', data ? this.editStudentInfo[0].id : '')
|
|
} else {
|
|
} else {
|
|
- if (data) {
|
|
|
|
- this.studentInfo.password.value = this.studentInfo.studentId
|
|
|
|
- } else {
|
|
|
|
- // this.studentInfo.password = "";
|
|
|
|
- }
|
|
|
|
|
|
+ this.studentInfo.pw = data ? this.studentInfo.id : ''
|
|
}
|
|
}
|
|
},
|
|
},
|
|
setCurrentClassDetail(item){
|
|
setCurrentClassDetail(item){
|
|
@@ -310,7 +310,7 @@
|
|
// this.studentInfo.classroomName = this.classroomList[index].classroomName
|
|
// this.studentInfo.classroomName = this.classroomList[index].classroomName
|
|
// this.studentInfo.periodCode = this.classroomList[index].periodCode;
|
|
// this.studentInfo.periodCode = this.classroomList[index].periodCode;
|
|
// this.studentInfo.gradeCode = this.classroomList[index].gradeCode;
|
|
// this.studentInfo.gradeCode = this.classroomList[index].gradeCode;
|
|
- // this.studentInfo.classroomCode = this.classroomList[index].classroomCode;
|
|
|
|
|
|
+ // this.studentInfo.classId = this.classroomList[index].classId;
|
|
// let currentInfo = this.$JSONPath.query(this.$store.state.schoolBaseInfo.schoolBaseInfo, "$..period[?(@.periodCode=='" + this.classroomList[index].periodCode + "')]")
|
|
// let currentInfo = this.$JSONPath.query(this.$store.state.schoolBaseInfo.schoolBaseInfo, "$..period[?(@.periodCode=='" + this.classroomList[index].periodCode + "')]")
|
|
|
|
|
|
// if (currentInfo.length > 0) {
|
|
// if (currentInfo.length > 0) {
|
|
@@ -329,7 +329,7 @@
|
|
// for (let i = 0; i < this.editStudentInfo.length; i++) {
|
|
// for (let i = 0; i < this.editStudentInfo.length; i++) {
|
|
// this.editStudentInfo[i].periodCode = this.classroomList[index].periodCode
|
|
// this.editStudentInfo[i].periodCode = this.classroomList[index].periodCode
|
|
// this.editStudentInfo[i].gradeCode = this.classroomList[index].gradeCode
|
|
// this.editStudentInfo[i].gradeCode = this.classroomList[index].gradeCode
|
|
- // this.editStudentInfo[i].classroomCode = this.classroomList[index].classroomCode
|
|
|
|
|
|
+ // this.editStudentInfo[i].classId = this.classroomList[index].classId
|
|
// this.$set(this.editStudentInfo[i],'periodName',periodName)
|
|
// this.$set(this.editStudentInfo[i],'periodName',periodName)
|
|
// this.$set(this.editStudentInfo[i],'gradeName',gradeName)
|
|
// this.$set(this.editStudentInfo[i],'gradeName',gradeName)
|
|
// }
|
|
// }
|
|
@@ -355,11 +355,15 @@
|
|
this.same = false
|
|
this.same = false
|
|
if (this.bizType == 2) {
|
|
if (this.bizType == 2) {
|
|
this.isLoading = true
|
|
this.isLoading = true
|
|
- if (this.editStudentInfo.length == 1) {
|
|
|
|
- // this.editStudentInfo[0].studentId = this.schoolCode + '#' + this.editStudentInfo[0].studentId
|
|
|
|
- this.editStudentInfo[0].studentId = this.editStudentInfo[0].studentId
|
|
|
|
- }
|
|
|
|
- this.$api.stuAccount.saveAllStudent(this.editStudentInfo).then(
|
|
|
|
|
|
+ let editInfo = this.editStudentInfo.map(function(item){
|
|
|
|
+ let itemTemp = item
|
|
|
|
+ if(itemTemp.pw == '******') {
|
|
|
|
+ delete itemTemp.pw
|
|
|
|
+ }
|
|
|
|
+ return itemTemp
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ this.$api.stuAccount.saveAllStudent(this.schoolCode, this.editStudentInfo).then(
|
|
(res) => {
|
|
(res) => {
|
|
if (res.error == null) {
|
|
if (res.error == null) {
|
|
this.show = false
|
|
this.show = false
|
|
@@ -382,35 +386,27 @@
|
|
)
|
|
)
|
|
} else {
|
|
} else {
|
|
this.isLoading = true
|
|
this.isLoading = true
|
|
- this.studentInfo.code = this.schoolCode
|
|
|
|
- this.studentInfo.studentId = this.studentInfo.studentId
|
|
|
|
|
|
|
|
let apiData = {
|
|
let apiData = {
|
|
- "grant_type": "create",
|
|
|
|
- "schoolId": this.studentInfo.code.toLowerCase(),
|
|
|
|
- "students": [
|
|
|
|
- {
|
|
|
|
- "id": this.studentInfo.studentId,
|
|
|
|
- "no": this.studentInfo.seatNo ? this.studentInfo.seatNo.toString() : '',
|
|
|
|
- "name": this.studentInfo.name,
|
|
|
|
- "year": this.studentInfo.academicYear ? this.studentInfo.academicYear.toString() : '',
|
|
|
|
- "pw": this.studentInfo.password.value,
|
|
|
|
- "classId": this.studentInfo.classroomCode,
|
|
|
|
- // Excel 匯入才需要給classname
|
|
|
|
- // "className":this.studentInfo.classroomName ? this.studentInfo.classroomName : ''
|
|
|
|
- }
|
|
|
|
- ]
|
|
|
|
|
|
+ "id": this.studentInfo.id,
|
|
|
|
+ "no": this.studentInfo.no ? this.studentInfo.no.toString() : '',
|
|
|
|
+ "name": this.studentInfo.name,
|
|
|
|
+ "year": this.studentInfo.year ? this.studentInfo.year.toString() : '',
|
|
|
|
+ "pw": this.studentInfo.pw,
|
|
|
|
+ "classId": this.studentInfo.classId,
|
|
|
|
+ // Excel 匯入才需要給classname
|
|
|
|
+ // "className":this.studentInfo.classroomName ? this.studentInfo.classroomName : ''
|
|
}
|
|
}
|
|
|
|
|
|
- let checkData = apiData.students[0]
|
|
|
|
let isRepeat= this.students.some(function(item){
|
|
let isRepeat= this.students.some(function(item){
|
|
- return (item.id === checkData.id || (checkData.classId !='' && checkData.classId === item.classId && checkData.no === item.no))
|
|
|
|
|
|
+ return (item.id === apiData.id || (apiData.classId !='' && apiData.classId === item.classId && apiData.no === item.no))
|
|
})
|
|
})
|
|
if(isRepeat){
|
|
if(isRepeat){
|
|
this.$Message.error('請檢查 帳號資訊 或 座號重複 了。')
|
|
this.$Message.error('請檢查 帳號資訊 或 座號重複 了。')
|
|
this.isLoading = false
|
|
this.isLoading = false
|
|
} else {
|
|
} else {
|
|
- this.$api.stuAccount.saveStudent(apiData).then(
|
|
|
|
|
|
+
|
|
|
|
+ this.$api.stuAccount.saveStudent(this.schoolCode, apiData).then(
|
|
(res) => {
|
|
(res) => {
|
|
if (res.error == null) {
|
|
if (res.error == null) {
|
|
this.show = false
|
|
this.show = false
|
|
@@ -443,12 +439,12 @@
|
|
// this.getClassroom()
|
|
// this.getClassroom()
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
- console.log(this.editStudentInfo, 'this.editStudentInfo')
|
|
|
|
if (this.bizType == 2 && this.isShow == true) {
|
|
if (this.bizType == 2 && this.isShow == true) {
|
|
if (this.editStudentInfo.length == 1) {
|
|
if (this.editStudentInfo.length == 1) {
|
|
- // let arr = this.editStudentInfo[0].studentId.split('#')
|
|
|
|
|
|
+ this.setCurrentClassDetail(this.editStudentInfo[0])
|
|
|
|
+ // let arr = this.editStudentInfo[0].id.split('#')
|
|
// if (arr.length > 1) {
|
|
// if (arr.length > 1) {
|
|
- // this.editStudentInfo[0].studentId = arr[1]
|
|
|
|
|
|
+ // this.editStudentInfo[0].id = arr[1]
|
|
// } else {
|
|
// } else {
|
|
// alert('学生账号格式错误!')
|
|
// alert('学生账号格式错误!')
|
|
// }
|
|
// }
|