|
@@ -92,9 +92,9 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import AddStudent from "./add-student/AddStudent"
|
|
|
- import ImportStudent from "./add-student/ImportStudent"
|
|
|
- import Authorization from "./add-student/Authorization"
|
|
|
+ import AddStudent from './add-student/AddStudent'
|
|
|
+ import ImportStudent from './add-student/ImportStudent'
|
|
|
+ import Authorization from './add-student/Authorization'
|
|
|
export default {
|
|
|
components: {
|
|
|
AddStudent,
|
|
@@ -103,192 +103,185 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- classroomList:[],
|
|
|
- classroomShowList:[],
|
|
|
- gradeList:[],
|
|
|
- searchPeriod: "",
|
|
|
- searchGrade: "",
|
|
|
- searchClassroom:"",
|
|
|
+ classroomList: [],
|
|
|
+ classroomShowList: [],
|
|
|
+ gradeList: [],
|
|
|
+ searchPeriod: '',
|
|
|
+ searchGrade: '',
|
|
|
+ searchClassroom: '',
|
|
|
schoolData: {},
|
|
|
tableLoading: false,
|
|
|
- searchText:'',
|
|
|
- currentPage:1,
|
|
|
- pageSize:30,
|
|
|
- bizType:0,
|
|
|
- editStudentInfo:[],
|
|
|
+ searchText: '',
|
|
|
+ currentPage: 1,
|
|
|
+ pageSize: 30,
|
|
|
+ bizType: 0,
|
|
|
+ editStudentInfo: [],
|
|
|
selections: [],
|
|
|
selectRow: {},
|
|
|
- addStudentStatus:false,
|
|
|
+ addStudentStatus: false,
|
|
|
importStudentStatus: false,
|
|
|
authorizationStatus: false,
|
|
|
demoLoginInfo: {
|
|
|
- user: "admin",
|
|
|
- teamModelId: "habook#0001",
|
|
|
- school: "醍摩豆书院",
|
|
|
- schoolCode:"HBCN"
|
|
|
+ user: 'admin',
|
|
|
+ teamModelId: 'habook#0001',
|
|
|
+ school: '醍摩豆书院',
|
|
|
+ schoolCode: 'HBCN'
|
|
|
},
|
|
|
- model: "",
|
|
|
+ model: '',
|
|
|
list: [],
|
|
|
tableData: [],
|
|
|
tableShowData: [],
|
|
|
- tablePageData:[],
|
|
|
- tableColumns:[]
|
|
|
+ tablePageData: [],
|
|
|
+ tableColumns: []
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
cancel() {
|
|
|
- console.log(this);
|
|
|
+ console.log(this)
|
|
|
},
|
|
|
getGradeList(index) {
|
|
|
- this.gradeList = this.schoolData.period[index].grade;
|
|
|
- this.classroomShowList = this.classroomList.filter((item) => { return item.period == this.schoolData.period[index].code });
|
|
|
+ this.gradeList = this.schoolData.period[index].grade
|
|
|
+ this.classroomShowList = this.classroomList.filter((item) => { return item.period == this.schoolData.period[index].code })
|
|
|
if (this.classroomShowList.length == 0) {
|
|
|
- this.$refs.classroom.clearSingleSelect();
|
|
|
+ this.$refs.classroom.clearSingleSelect()
|
|
|
}
|
|
|
},
|
|
|
getClassroomList(index) {
|
|
|
- this.classroomShowList = this.classroomList.filter((item) => { return item.grade == this.gradeList[index].code });
|
|
|
+ this.classroomShowList = this.classroomList.filter((item) => { return item.grade == this.gradeList[index].code })
|
|
|
if (this.classroomShowList.length == 0) {
|
|
|
- this.$refs.classroom.clearSingleSelect();
|
|
|
+ this.$refs.classroom.clearSingleSelect()
|
|
|
}
|
|
|
},
|
|
|
getPageData() {
|
|
|
- let start = ((this.currentPage - 1) * this.pageSize);
|
|
|
- let end = 0;
|
|
|
+ let start = ((this.currentPage - 1) * this.pageSize)
|
|
|
+ let end = 0
|
|
|
if (this.tableShowData.length < this.currentPage * this.pageSize) {
|
|
|
- end = this.tableShowData.length;
|
|
|
+ end = this.tableShowData.length
|
|
|
} else {
|
|
|
- end = this.currentPage * this.pageSize;
|
|
|
+ end = this.currentPage * this.pageSize
|
|
|
}
|
|
|
- this.tablePageData = this.tableShowData.slice(start, end);
|
|
|
+ this.tablePageData = this.tableShowData.slice(start, end)
|
|
|
},
|
|
|
searchData() {
|
|
|
- this.tableLoading = true;
|
|
|
- this.tableShowData = this.tableData.filter(item => item.studentId.indexOf(this.searchText) != -1);
|
|
|
- this.currentPage = 1;
|
|
|
- this.getPageData();
|
|
|
- this.tableLoading = false;
|
|
|
+ this.tableLoading = true
|
|
|
+ this.tableShowData = this.tableData.filter(item => item.studentId.indexOf(this.searchText) != -1)
|
|
|
+ this.currentPage = 1
|
|
|
+ this.getPageData()
|
|
|
+ this.tableLoading = false
|
|
|
},
|
|
|
cancelAll() {
|
|
|
- this.selections = [];
|
|
|
+ this.selections = []
|
|
|
},
|
|
|
getIndex(_arr, _obj) {
|
|
|
- var len = _arr.length;
|
|
|
+ var len = _arr.length
|
|
|
for (let i = 0; i < len; i++) {
|
|
|
- if (this.isObjEqual(_arr[i],_obj)) {
|
|
|
- return parseInt(i);
|
|
|
+ if (this.isObjEqual(_arr[i], _obj)) {
|
|
|
+ return parseInt(i)
|
|
|
}
|
|
|
}
|
|
|
- return -1;
|
|
|
+ return -1
|
|
|
},
|
|
|
isObjEqual(o1, o2) {
|
|
|
- var props1 = Object.keys(o1);
|
|
|
- var props2 = Object.keys(o2);
|
|
|
+ var props1 = Object.keys(o1)
|
|
|
+ var props2 = Object.keys(o2)
|
|
|
if (props1.length != props2.length) {
|
|
|
- return false;
|
|
|
+ return false
|
|
|
}
|
|
|
for (var i = 0, max = props1.length; i < max; i++) {
|
|
|
- var propName = props1[i];
|
|
|
+ var propName = props1[i]
|
|
|
if (o1[propName] !== o2[propName]) {
|
|
|
- return false;
|
|
|
+ return false
|
|
|
}
|
|
|
}
|
|
|
- return true;
|
|
|
+ return true
|
|
|
},
|
|
|
getSelectInfo(selction, row) {
|
|
|
- this.selections = selction;
|
|
|
- this.selectRow = row;
|
|
|
+ this.selections = selction
|
|
|
+ this.selectRow = row
|
|
|
},
|
|
|
closeAddStudent(data) {
|
|
|
if (data.action == 1) {
|
|
|
- let infoString = JSON.stringify(data.studentInfo);
|
|
|
- let info = JSON.parse(infoString);
|
|
|
+ let infoString = JSON.stringify(data.studentInfo)
|
|
|
+ let info = JSON.parse(infoString)
|
|
|
this.tableData.unshift(info);
|
|
|
- [...this.tableShowData] = this.tableData;
|
|
|
- this.getPageData();
|
|
|
+ [...this.tableShowData] = this.tableData
|
|
|
+ this.getPageData()
|
|
|
} else {
|
|
|
- this.findStudentInfo();
|
|
|
+ this.findStudentInfo()
|
|
|
}
|
|
|
- this.addStudentStatus = false;
|
|
|
+ this.addStudentStatus = false
|
|
|
},
|
|
|
closeImportStudent(data) {
|
|
|
- //this.tableData.push(...(data.data));
|
|
|
- //[...this.tableShowData] = this.tableData;
|
|
|
- this.findStudentInfo();
|
|
|
- this.importStudentStatus = false;
|
|
|
+ // this.tableData.push(...(data.data));
|
|
|
+ // [...this.tableShowData] = this.tableData;
|
|
|
+ this.findStudentInfo()
|
|
|
+ this.importStudentStatus = false
|
|
|
},
|
|
|
closeAuth() {
|
|
|
- this.authorizationStatus = false;
|
|
|
+ this.authorizationStatus = false
|
|
|
},
|
|
|
addStudent() {
|
|
|
- this.bizType = 1;
|
|
|
- this.$refs.selection.clearCurrentRow();
|
|
|
- this.addStudentStatus = true;
|
|
|
-
|
|
|
+ this.bizType = 1
|
|
|
+ this.$refs.selection.clearCurrentRow()
|
|
|
+ this.addStudentStatus = true
|
|
|
},
|
|
|
importStudent() {
|
|
|
- this.importStudentStatus = true;
|
|
|
+ this.importStudentStatus = true
|
|
|
},
|
|
|
showAuthorization() {
|
|
|
- this.authorizationStatus = true;
|
|
|
+ this.authorizationStatus = true
|
|
|
},
|
|
|
editStudent(index) {
|
|
|
- this.bizType = 2;
|
|
|
+ this.bizType = 2
|
|
|
if (index != undefined) {
|
|
|
- this.editStudentInfo = [];
|
|
|
- let objStr = JSON.stringify(this.tableData[index]);
|
|
|
- this.editStudentInfo.push(JSON.parse(objStr));
|
|
|
- this.tableShowData[index]._checked = true;
|
|
|
- this.tablePageData[index]._checked = true;
|
|
|
- this.$forceUpdate();
|
|
|
- this.addStudentStatus = true;
|
|
|
+ this.editStudentInfo = []
|
|
|
+ let objStr = JSON.stringify(this.tableData[index])
|
|
|
+ this.editStudentInfo.push(JSON.parse(objStr))
|
|
|
+ this.tableShowData[index]._checked = true
|
|
|
+ this.tablePageData[index]._checked = true
|
|
|
+ this.$forceUpdate()
|
|
|
+ this.addStudentStatus = true
|
|
|
} else {
|
|
|
if (this.selections.length > 0) {
|
|
|
-
|
|
|
this.editStudentInfo = [];
|
|
|
- [...this.editStudentInfo] = this.selections;
|
|
|
- this.addStudentStatus = true;
|
|
|
+ [...this.editStudentInfo] = this.selections
|
|
|
+ this.addStudentStatus = true
|
|
|
} else {
|
|
|
- this.$Message.error(this.$t('stuAccount.tips1'));
|
|
|
+ this.$Message.error(this.$t('stuAccount.tips1'))
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
delStudent(index, row) {
|
|
|
if (index >= 0) {
|
|
|
- let showIndex = index + (this.currentPage - 1) * this.pageSize;
|
|
|
- let originIndex = this.getIndex(this.tableData, this.tablePageData[index]);
|
|
|
+ let showIndex = index + (this.currentPage - 1) * this.pageSize
|
|
|
+ let originIndex = this.getIndex(this.tableData, this.tablePageData[index])
|
|
|
this.$Modal.confirm({
|
|
|
title: this.$t('stuAccount.tips2Title'),
|
|
|
- content: '<p>' + this.$t('stuAccount.tips2Content1') +" <strong style='color:red;'>"+ this.tableShowData[showIndex].name + '</strong></p>',
|
|
|
+ content: '<p>' + this.$t('stuAccount.tips2Content1') + " <strong style='color:red;'>" + this.tableShowData[showIndex].name + '</strong></p>',
|
|
|
onOk: () => {
|
|
|
this.$api.stuAccount.deleteStudentInfo(this.tablePageData[index]).then(
|
|
|
(res) => {
|
|
|
if (res.error == null) {
|
|
|
- this.tableData.splice(originIndex, 1);
|
|
|
- this.tablePageData.splice(index, 1);
|
|
|
- this.tableShowData.splice(showIndex, 1);
|
|
|
+ this.tableData.splice(originIndex, 1)
|
|
|
+ this.tablePageData.splice(index, 1)
|
|
|
+ this.tableShowData.splice(showIndex, 1)
|
|
|
}
|
|
|
},
|
|
|
(err) => {
|
|
|
- alert("API error!");
|
|
|
+ alert('API error!')
|
|
|
}
|
|
|
- );
|
|
|
-
|
|
|
+ )
|
|
|
},
|
|
|
onCancel: () => {
|
|
|
}
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
+ })
|
|
|
} else {
|
|
|
- let i = this.getIndex(this.tableData, row);
|
|
|
+ let i = this.getIndex(this.tableData, row)
|
|
|
if (i >= 0) {
|
|
|
- this.tableData.splice(i, 1);
|
|
|
+ this.tableData.splice(i, 1)
|
|
|
} else {
|
|
|
- this.$Message.error(this.$t('stuAccount.tips3'));
|
|
|
+ this.$Message.error(this.$t('stuAccount.tips3'))
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
},
|
|
|
getSchoolData() {
|
|
@@ -297,13 +290,13 @@
|
|
|
}).then(res => {
|
|
|
if (res.error == null) {
|
|
|
if (res.result.data.length > 0) {
|
|
|
- this.schoolData = res.result.data[0];
|
|
|
- this.$store.commit("schoolBaseInfo/setSchoolInfo", this.schoolData);
|
|
|
- this.getClassroom();
|
|
|
- }
|
|
|
+ this.schoolData = res.result.data[0]
|
|
|
+ this.$store.commit('schoolBaseInfo/setSchoolInfo', this.schoolData)
|
|
|
+ this.getClassroom()
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- );
|
|
|
+ )
|
|
|
},
|
|
|
getClassroom() {
|
|
|
this.$api.schoolSetting.findClassInfo({
|
|
@@ -312,12 +305,12 @@
|
|
|
if (res.error == null) {
|
|
|
if (res.result.data.length > 0) {
|
|
|
this.classroomList = res.result.data;
|
|
|
- [...this.classroomShowList] = this.classroomList;
|
|
|
- this.$store.commit("schoolBaseInfo/setClassroomList", this.classroomList);
|
|
|
- this.findStudentInfo();
|
|
|
+ [...this.classroomShowList] = this.classroomList
|
|
|
+ this.$store.commit('schoolBaseInfo/setClassroomList', this.classroomList)
|
|
|
+ this.findStudentInfo()
|
|
|
}
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
},
|
|
|
initData() {
|
|
|
this.tableColumns = [
|
|
@@ -327,96 +320,96 @@
|
|
|
align: 'center'
|
|
|
},
|
|
|
{
|
|
|
- key: "seatNo",
|
|
|
- title:this.$t('stuAccount.seatNo'),
|
|
|
+ key: 'seatNo',
|
|
|
+ title: this.$t('stuAccount.seatNo'),
|
|
|
align: 'center',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
- key: "studentId",
|
|
|
- title:this.$t('stuAccount.account'),
|
|
|
+ key: 'studentId',
|
|
|
+ title: this.$t('stuAccount.account'),
|
|
|
align: 'center'
|
|
|
},
|
|
|
{
|
|
|
- key: "name",
|
|
|
- title:this.$t('stuAccount.stuName'),
|
|
|
+ key: 'name',
|
|
|
+ title: this.$t('stuAccount.stuName'),
|
|
|
align: 'center'
|
|
|
},
|
|
|
{
|
|
|
- slot: "classroomName",
|
|
|
- title:this.$t('stuAccount.classroomName'),
|
|
|
+ slot: 'classroomName',
|
|
|
+ title: this.$t('stuAccount.classroomName'),
|
|
|
align: 'center'
|
|
|
},
|
|
|
{
|
|
|
- slot: "classroomCode",
|
|
|
- title:this.$t('stuAccount.classroomCode'),
|
|
|
+ slot: 'classroomCode',
|
|
|
+ title: this.$t('stuAccount.classroomCode'),
|
|
|
align: 'center'
|
|
|
},
|
|
|
{
|
|
|
- slot: "periodName",
|
|
|
- title:this.$t('stuAccount.period'),
|
|
|
+ slot: 'periodName',
|
|
|
+ title: this.$t('stuAccount.period'),
|
|
|
align: 'center'
|
|
|
},
|
|
|
{
|
|
|
- slot: "gradeName",
|
|
|
- title:this.$t('stuAccount.grade'),
|
|
|
+ slot: 'gradeName',
|
|
|
+ title: this.$t('stuAccount.grade'),
|
|
|
align: 'center'
|
|
|
},
|
|
|
{
|
|
|
- slot: "status",
|
|
|
- title:this.$t('stuAccount.authStatus'),
|
|
|
+ slot: 'status',
|
|
|
+ title: this.$t('stuAccount.authStatus'),
|
|
|
align: 'center'
|
|
|
},
|
|
|
{
|
|
|
- slot: "action",
|
|
|
- title: " ",
|
|
|
- width:100,
|
|
|
+ slot: 'action',
|
|
|
+ title: ' ',
|
|
|
+ width: 100,
|
|
|
align: 'center'
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
findStudentInfo() {
|
|
|
- this.tableLoading = true;
|
|
|
+ this.tableLoading = true
|
|
|
let params = {
|
|
|
schoolCode: this.demoLoginInfo.schoolCode
|
|
|
}
|
|
|
this.$api.stuAccount.findStudent(params).then(
|
|
|
(res) => {
|
|
|
if (res.error == null) {
|
|
|
- this.tableData = res.result.data;
|
|
|
+ this.tableData = res.result.data
|
|
|
for (let item of this.tableData) {
|
|
|
- let currentSchoolInfo = this.$JSONPath.query(this.$store.state.schoolBaseInfo.schoolInfo, "$..period[?(@.periodCode=='" + item.classroom.periodCode + "')]");
|
|
|
- let currentClassroomlInfo = this.$JSONPath.query(this.$store.state.schoolBaseInfo.classroomList, "$..[?(@.classroomCode=='" + item.classroom.classroomCode + "')]");
|
|
|
-
|
|
|
+ let currentSchoolInfo = this.$JSONPath.query(this.$store.state.schoolBaseInfo.schoolInfo, "$..period[?(@.periodCode=='" + item.classroom.periodCode + "')]")
|
|
|
+ let currentClassroomlInfo = this.$JSONPath.query(this.$store.state.schoolBaseInfo.classroomList, "$..[?(@.classroomCode=='" + item.classroom.classroomCode + "')]")
|
|
|
+
|
|
|
if (currentSchoolInfo.length > 0) {
|
|
|
- item.classroom.periodName = currentSchoolInfo[0].periodName;
|
|
|
- item.classroom.gradeName = this.$JSONPath.query(currentSchoolInfo, "$..grades[?(@.gradeCode=='" + item.classroom.gradeCode + "')]")[0].gradeName;
|
|
|
- item.classroom.classroomName = currentClassroomlInfo[0].classroomName;
|
|
|
+ item.classroom.periodName = currentSchoolInfo[0].periodName
|
|
|
+ item.classroom.gradeName = this.$JSONPath.query(currentSchoolInfo, "$..grades[?(@.gradeCode=='" + item.classroom.gradeCode + "')]")[0].gradeName
|
|
|
+ item.classroom.classroomName = currentClassroomlInfo[0].classroomName
|
|
|
}
|
|
|
}
|
|
|
- [...this.tableShowData] = this.tableData;
|
|
|
- this.getPageData();
|
|
|
- this.$forceUpdate();
|
|
|
- console.log(this.tableData);
|
|
|
- this.tableLoading = false;
|
|
|
+ [...this.tableShowData] = this.tableData
|
|
|
+ this.getPageData()
|
|
|
+ this.$forceUpdate()
|
|
|
+ console.log(this.tableData)
|
|
|
+ this.tableLoading = false
|
|
|
} else {
|
|
|
- alert("API error!");
|
|
|
- this.tableLoading = false;
|
|
|
+ alert('API error!')
|
|
|
+ this.tableLoading = false
|
|
|
}
|
|
|
},
|
|
|
(err) => {
|
|
|
- this.tableLoading = false;
|
|
|
+ this.tableLoading = false
|
|
|
}
|
|
|
- );
|
|
|
+ )
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
- this.initData();
|
|
|
- this.getSchoolData();
|
|
|
- //this.getClassroom();
|
|
|
- //this.findStudentInfo();
|
|
|
+ this.initData()
|
|
|
+ this.getSchoolData()
|
|
|
+ // this.getClassroom();
|
|
|
+ // this.findStudentInfo();
|
|
|
},
|
|
|
- computed: {
|
|
|
+ computed: {
|
|
|
},
|
|
|
mounted() {
|
|
|
}
|