|
@@ -1,441 +1,442 @@
|
|
|
<style lang="less" scoped>
|
|
|
- @import './Index.less';
|
|
|
+ @import './Index.less';
|
|
|
</style>
|
|
|
<style lang="less">
|
|
|
- @import './IndexIview.less';
|
|
|
+ @import './IndexIview.less';
|
|
|
</style>
|
|
|
|
|
|
<template>
|
|
|
- <div class="sc-container">
|
|
|
- <div class="sc-menu">
|
|
|
- <div class="sc-menu-left dark-iview-select">
|
|
|
- <Input v-model="searchText" clearable :placeholder="$t('stuAccount.searchHolder')" style="width: 28%;margin-left:20px;" :search="true" @on-enter="searchData" @on-change="searchData" @on-clear="searchData">
|
|
|
- </Input>
|
|
|
- <Select v-model="searchPeriod" style="width:20%;margin-left:5%;" :placeholder="$t('stuAccount.periodHolder')" clearable @on-change="filterStudentInfo">
|
|
|
- <Option v-for="(item,index) in schoolData.period" :value="item.periodCode" :key="index" @click.native="getGradeList(index)">{{ item.periodName }}</Option>
|
|
|
- </Select>
|
|
|
- <Select v-model="searchGrade" style="width:20%;margin-left:1%;" :placeholder="$t('stuAccount.gradeHolder')" clearable @on-change="filterStudentInfo">
|
|
|
- <!--<Option v-for="(item,index) in gradeList" :value="item.gradeCode" :key="index" @click.native="getClassroomList(index)">{{ item.gradeName }}</Option>-->
|
|
|
- <Option v-for="(item,index) in fn.getPeriod($store.state.schoolBaseInfo.schoolBaseInfo,searchPeriod).grades" :value="item.gradeCode" :key="index">{{ item.gradeName }}</Option>
|
|
|
- </Select>
|
|
|
- <Select v-model="searchClassroom" ref="classroom" style="width:20%;margin-left:1%;" :placeholder="$t('stuAccount.classroomHolder')" clearable @on-change="filterStudentInfo">
|
|
|
- <Option v-for="(item,index) in classroomShowList" :value="item.classroomCode" :key="index">{{ item.classroomName }}</Option>
|
|
|
- </Select>
|
|
|
- </div>
|
|
|
- <div class="sc-menu-right sc-text-no-select">
|
|
|
- <ul>
|
|
|
- <li @click="delStudent(-1)" :class=" selections.length > 0 ? '':'sc-disable-cursor' ">
|
|
|
- <Icon type="md-trash" :color="selections.length > 0 ? 'white':'#606060'" size="18" />
|
|
|
- <span>{{ $t('stuAccount.delStu') }}</span>
|
|
|
- </li>
|
|
|
- <li @click="editStudent()" :class=" selections.length > 0 ? '':'sc-disable-cursor' ">
|
|
|
- <Icon type="md-create" :color="selections.length > 0 ? 'white':'#606060'" size="18" />
|
|
|
- <span>{{ $t('stuAccount.editInfo') }}</span>
|
|
|
- </li>
|
|
|
- <li @click="addStudent()">
|
|
|
- <Icon type="md-person-add" color="white" size="18" />
|
|
|
- <span>{{ $t('stuAccount.addStu') }}</span>
|
|
|
- </li>
|
|
|
- <li @click="importStudent()">
|
|
|
- <Icon type="md-arrow-round-up" color="white" size="18" />
|
|
|
- <span>{{ $t('stuAccount.importStu') }}</span>
|
|
|
- </li>
|
|
|
- <li @click="showAuthorization()">
|
|
|
- <Icon type="ios-cog-outline" color="white" size="18" />
|
|
|
- <span>{{$t('stuAccount.menuAuth') }}</span>
|
|
|
- </li>
|
|
|
- </ul>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="sc-content" style="position:relative">
|
|
|
- <Table ref="selection" :columns="tableColumns" :data="tablePageData" height="730" :loading="tableLoading" @on-select="getSelectInfo" @on-select-cancel="getSelectInfo" @on-select-all="getSelectInfo" @on-select-all-cancel="cancelAll">
|
|
|
- <template slot-scope="{ row,index }" slot="status">
|
|
|
- <Icon v-if="index%3 == 1" type="md-checkmark-circle-outline" size="18" color="#1CD0A1" />
|
|
|
- <span v-else>—</span>
|
|
|
- </template>
|
|
|
- <template slot-scope="{ row,index }" slot="classroomName">
|
|
|
- <span>{{row.classroom.classroomName}}</span>
|
|
|
- </template>
|
|
|
- <template slot-scope="{ row,index }" slot="classroomCode">
|
|
|
- <span>{{row.classroom.classroomCode}}</span>
|
|
|
- </template>
|
|
|
- <template slot-scope="{ row,index }" slot="periodName">
|
|
|
- <span>{{row.classroom.periodName}}</span>
|
|
|
- </template>
|
|
|
- <template slot-scope="{ row,index }" slot="gradeName">
|
|
|
- <span>{{row.classroom.gradeName}}</span>
|
|
|
- </template>
|
|
|
- <template slot-scope="{ row,index }" slot="action">
|
|
|
- <div class="item-tools">
|
|
|
- <Icon type="md-create" size="18" color="white" @click="editStudent(index)" />
|
|
|
- <Icon type="md-trash" size="18" color="white" @click="delStudent(index)" />
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </Table>
|
|
|
- <Page :total="tableShowData.length" size="small" :page-size="pageSize" show-total style="margin-top:15px;float:right;color:white;margin-right:20px;" :current.sync="currentPage" @on-change="getPageData" />
|
|
|
- <authorization :isShow="authorizationStatus" @closeAuth="closeAuth"></authorization>
|
|
|
- </div>
|
|
|
+ <div class="sc-container">
|
|
|
+ <div class="sc-menu">
|
|
|
+ <div class="sc-menu-left dark-iview-select">
|
|
|
+ <Input v-model="searchText" clearable :placeholder="$t('stuAccount.searchHolder')" style="width: 28%;margin-left:20px;" :search="true" @on-enter="searchData" @on-change="searchData" @on-clear="searchData">
|
|
|
+ </Input>
|
|
|
+ <Select v-model="searchPeriod" style="width:20%;margin-left:5%;" :placeholder="$t('stuAccount.periodHolder')" clearable @on-change="filterStudentInfo">
|
|
|
+ <Option v-for="(item,index) in schoolData.period" :value="item.periodCode" :key="index" @click.native="getGradeList(index)">{{ item.periodName }}</Option>
|
|
|
+ </Select>
|
|
|
+ <Select v-model="searchGrade" style="width:20%;margin-left:1%;" :placeholder="$t('stuAccount.gradeHolder')" clearable @on-change="filterStudentInfo">
|
|
|
+ <!--<Option v-for="(item,index) in gradeList" :value="item.gradeCode" :key="index" @click.native="getClassroomList(index)">{{ item.gradeName }}</Option>-->
|
|
|
+ <Option v-for="(item,index) in fn.getPeriod($store.state.schoolBaseInfo.schoolBaseInfo,searchPeriod).grades" :value="item.gradeCode" :key="index">{{ item.gradeName }}</Option>
|
|
|
+ </Select>
|
|
|
+ <Select v-model="searchClassroom" ref="classroom" style="width:20%;margin-left:1%;" :placeholder="$t('stuAccount.classroomHolder')" clearable @on-change="filterStudentInfo">
|
|
|
+ <Option v-for="(item,index) in classroomShowList" :value="item.classroomCode" :key="index">{{ item.classroomName }}</Option>
|
|
|
+ </Select>
|
|
|
+ </div>
|
|
|
+ <div class="sc-menu-right sc-text-no-select">
|
|
|
+ <ul>
|
|
|
+ <li @click="delStudent(-1)" :class=" selections.length > 0 ? '':'sc-disable-cursor' ">
|
|
|
+ <Icon type="md-trash" :color="selections.length > 0 ? 'white':'#606060'" size="18" />
|
|
|
+ <span>{{ $t('stuAccount.delStu') }}</span>
|
|
|
+ </li>
|
|
|
+ <li @click="editStudent()" :class=" selections.length > 0 ? '':'sc-disable-cursor' ">
|
|
|
+ <Icon type="md-create" :color="selections.length > 0 ? 'white':'#606060'" size="18" />
|
|
|
+ <span>{{ $t('stuAccount.editInfo') }}</span>
|
|
|
+ </li>
|
|
|
+ <li @click="addStudent()">
|
|
|
+ <Icon type="md-person-add" color="white" size="18" />
|
|
|
+ <span>{{ $t('stuAccount.addStu') }}</span>
|
|
|
+ </li>
|
|
|
+ <li @click="importStudent()">
|
|
|
+ <Icon type="md-arrow-round-up" color="white" size="18" />
|
|
|
+ <span>{{ $t('stuAccount.importStu') }}</span>
|
|
|
+ </li>
|
|
|
+ <li @click="showAuthorization()">
|
|
|
+ <Icon type="ios-cog-outline" color="white" size="18" />
|
|
|
+ <span>{{$t('stuAccount.menuAuth') }}</span>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="sc-content" style="position:relative">
|
|
|
+ <Table ref="selection" :columns="tableColumns" :data="tablePageData" height="730" :loading="tableLoading" @on-select="getSelectInfo" @on-select-cancel="getSelectInfo" @on-select-all="getSelectInfo" @on-select-all-cancel="cancelAll">
|
|
|
+ <template slot-scope="{ row,index }" slot="status">
|
|
|
+ <Icon v-if="index%3 == 1" type="md-checkmark-circle-outline" size="18" color="#1CD0A1" />
|
|
|
+ <span v-else>—</span>
|
|
|
+ </template>
|
|
|
+ <template slot-scope="{ row,index }" slot="classroomName">
|
|
|
+ <span>{{row.classroomName}}</span>
|
|
|
+ </template>
|
|
|
+ <template slot-scope="{ row,index }" slot="classroomCode">
|
|
|
+ <span>{{row.classroomCode}}</span>
|
|
|
+ </template>
|
|
|
+ <template slot-scope="{ row,index }" slot="periodName">
|
|
|
+ <span>{{row.periodName}}</span>
|
|
|
+ </template>
|
|
|
+ <template slot-scope="{ row,index }" slot="gradeName">
|
|
|
+ <span>{{row.gradeName}}</span>
|
|
|
+ </template>
|
|
|
+ <template slot-scope="{ row,index }" slot="action">
|
|
|
+ <div class="item-tools">
|
|
|
+ <Icon type="md-create" size="18" color="white" @click="editStudent(index)" />
|
|
|
+ <Icon type="md-trash" size="18" color="white" @click="delStudent(index)" />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </Table>
|
|
|
+ <Page :total="tableShowData.length" size="small" :page-size="pageSize" show-total style="margin-top:15px;float:right;color:white;margin-right:20px;" :current.sync="currentPage" @on-change="getPageData" />
|
|
|
+ <authorization :isShow="authorizationStatus" @closeAuth="closeAuth"></authorization>
|
|
|
+ </div>
|
|
|
|
|
|
- <Modal v-model="addStudentStatus" width="520" class="add-student" :mask-closable="false" @on-cancel="cancel">
|
|
|
- <div slot="header"></div>
|
|
|
- <add-student v-if="addStudentStatus" :schoolCode="demoLoginInfo.schoolCode" :isShow="addStudentStatus" :editStudentInfo="editStudentInfo" @saveStudentInfo="closeAddStudent" :bizType="bizType"></add-student>
|
|
|
- <div slot="footer">
|
|
|
- </div>
|
|
|
- </Modal>
|
|
|
- <Modal v-model="importStudentStatus" width="70%" class="import-student" :mask-closable="false" @on-cancel="cancel">
|
|
|
- <div slot="header">
|
|
|
- <span class="import-model-title">{{$t('stuAccount.importTitle')}}</span>
|
|
|
- </div>
|
|
|
- <import-student v-if="importStudentStatus" :schoolCode="demoLoginInfo.schoolCode" :isShow="importStudentStatus" @importStudentInfo="closeImportStudent"></import-student>
|
|
|
- <div slot="footer"></div>
|
|
|
- </Modal>
|
|
|
- </div>
|
|
|
+ <Modal v-model="addStudentStatus" width="520" class="add-student" :mask-closable="false" @on-cancel="cancel">
|
|
|
+ <div slot="header"></div>
|
|
|
+ <add-student v-if="addStudentStatus" :schoolCode="demoLoginInfo.schoolCode" :isShow="addStudentStatus" :editStudentInfo="editStudentInfo" @saveStudentInfo="closeAddStudent" :bizType="bizType"></add-student>
|
|
|
+ <div slot="footer">
|
|
|
+ </div>
|
|
|
+ </Modal>
|
|
|
+ <Modal v-model="importStudentStatus" width="70%" class="import-student" :mask-closable="false" @on-cancel="cancel">
|
|
|
+ <div slot="header">
|
|
|
+ <span class="import-model-title">{{$t('stuAccount.importTitle')}}</span>
|
|
|
+ </div>
|
|
|
+ <import-student v-if="importStudentStatus" :schoolCode="demoLoginInfo.schoolCode" :isShow="importStudentStatus" @importStudentInfo="closeImportStudent"></import-student>
|
|
|
+ <div slot="footer"></div>
|
|
|
+ </Modal>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import fn from '@/utils/js-fn.js'
|
|
|
- import AddStudent from './add-student/AddStudent'
|
|
|
- import ImportStudent from './add-student/ImportStudent'
|
|
|
- import Authorization from './add-student/Authorization'
|
|
|
- export default {
|
|
|
- components: {
|
|
|
- AddStudent,
|
|
|
- ImportStudent,
|
|
|
- Authorization
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- fn,
|
|
|
- classroomList: [],
|
|
|
- classroomShowList: [],
|
|
|
- gradeList: [],
|
|
|
- searchPeriod: '',
|
|
|
- searchGrade: '',
|
|
|
- searchClassroom: '',
|
|
|
- schoolData: {},
|
|
|
- tableLoading: false,
|
|
|
- searchText: '',
|
|
|
- currentPage: 1,
|
|
|
- pageSize: 30,
|
|
|
- bizType: 0, // 0:新增 1:修改
|
|
|
- editStudentInfo: [],
|
|
|
- selections: [],
|
|
|
- selectRow: {},
|
|
|
- addStudentStatus: false,
|
|
|
- importStudentStatus: false,
|
|
|
- authorizationStatus: false,
|
|
|
- demoLoginInfo: {
|
|
|
- user: 'admin',
|
|
|
- TEAMModelId: 'habook#0001',
|
|
|
- school: '醍摩豆书院',
|
|
|
- schoolCode: 'HBCN'
|
|
|
+ import fn from '@/utils/js-fn.js'
|
|
|
+ import AddStudent from './add-student/AddStudent'
|
|
|
+ import ImportStudent from './add-student/ImportStudent'
|
|
|
+ import Authorization from './add-student/Authorization'
|
|
|
+ export default {
|
|
|
+ components: {
|
|
|
+ AddStudent,
|
|
|
+ ImportStudent,
|
|
|
+ Authorization
|
|
|
},
|
|
|
- tableData: [],
|
|
|
- tableShowData: [],
|
|
|
- tablePageData: [],
|
|
|
- tableColumns: []
|
|
|
- }
|
|
|
- },
|
|
|
- methods: {
|
|
|
- cancel() {
|
|
|
- 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 })
|
|
|
- if (this.classroomShowList.length == 0) {
|
|
|
- this.$refs.classroom.clearSingleSelect()
|
|
|
- }
|
|
|
- },
|
|
|
- getClassroomList(index) {
|
|
|
- this.classroomShowList = this.classroomList.filter((item) => { return item.grade == this.gradeList[index].code })
|
|
|
- if (this.classroomShowList.length == 0) {
|
|
|
- this.$refs.classroom.clearSingleSelect()
|
|
|
- }
|
|
|
- },
|
|
|
- getPageData() {
|
|
|
- let start = ((this.currentPage - 1) * this.pageSize)
|
|
|
- let end = 0
|
|
|
- if (this.tableShowData.length < this.currentPage * this.pageSize) {
|
|
|
- end = this.tableShowData.length
|
|
|
- } else {
|
|
|
- end = this.currentPage * this.pageSize
|
|
|
- }
|
|
|
- this.tablePageData = this.tableShowData.slice(start, end)
|
|
|
- },
|
|
|
- searchData() {
|
|
|
- this.tableLoading = true
|
|
|
- this.tableShowData = this.tableData.filter(item => JSON.stringify(item).indexOf(this.searchText) != -1)
|
|
|
- this.currentPage = 1
|
|
|
- this.getPageData()
|
|
|
- this.tableLoading = false
|
|
|
- },
|
|
|
- filterStudentInfo() {
|
|
|
- let grade = ''
|
|
|
- if (this.searchPeriod == undefined) {
|
|
|
- this.searchPeriod = ''
|
|
|
- }
|
|
|
- if (this.searchGrade == undefined || this.searchGrade == '') {
|
|
|
- this.grade = ''
|
|
|
- } else {
|
|
|
- grade = '"gradeCode":' + '"' + this.searchGrade + '"'
|
|
|
- }
|
|
|
- console.log(JSON.stringify(this.tableData[0]))
|
|
|
- if (this.searchClassroom == undefined) {
|
|
|
- this.searchClassroom = ''
|
|
|
- }
|
|
|
- this.tableLoading = true
|
|
|
- this.tableShowData = this.tableData.filter(
|
|
|
- item => {
|
|
|
- return JSON.stringify(item).indexOf(this.searchPeriod) !== -1 && JSON.stringify(item).indexOf(grade) !== -1 && JSON.stringify(item).indexOf(this.searchClassroom) !== -1
|
|
|
- }
|
|
|
- )
|
|
|
- this.currentPage = 1
|
|
|
- this.getPageData()
|
|
|
- this.tableLoading = false
|
|
|
- },
|
|
|
- cancelAll() {
|
|
|
- this.selections = []
|
|
|
- },
|
|
|
- getIndex(_arr, _obj) {
|
|
|
- var len = _arr.length
|
|
|
- for (let i = 0; i < len; i++) {
|
|
|
- if (this.isObjEqual(_arr[i], _obj)) {
|
|
|
- return parseInt(i)
|
|
|
- }
|
|
|
- }
|
|
|
- return -1
|
|
|
- },
|
|
|
- isObjEqual(o1, o2) {
|
|
|
- var props1 = Object.keys(o1)
|
|
|
- var props2 = Object.keys(o2)
|
|
|
- if (props1.length != props2.length) {
|
|
|
- return false
|
|
|
- }
|
|
|
- for (var i = 0, max = props1.length; i < max; i++) {
|
|
|
- var propName = props1[i]
|
|
|
- if (o1[propName] !== o2[propName]) {
|
|
|
- return false
|
|
|
- }
|
|
|
- }
|
|
|
- return true
|
|
|
- },
|
|
|
- getSelectInfo(selction, row) {
|
|
|
- this.selections = selction
|
|
|
- this.selectRow = row
|
|
|
- },
|
|
|
- closeAddStudent(data) {
|
|
|
- if (data.action == 1) {
|
|
|
- let infoString = JSON.stringify(data.studentInfo)
|
|
|
- let info = JSON.parse(infoString)
|
|
|
- this.tableData.unshift(info);
|
|
|
- [...this.tableShowData] = this.tableData
|
|
|
- this.getPageData()
|
|
|
- } else {
|
|
|
- this.findStudentInfo()
|
|
|
- }
|
|
|
- this.addStudentStatus = false
|
|
|
- },
|
|
|
- closeImportStudent(data) {
|
|
|
- this.findStudentInfo()
|
|
|
- this.importStudentStatus = false
|
|
|
- },
|
|
|
- closeAuth() {
|
|
|
- this.authorizationStatus = false
|
|
|
- },
|
|
|
- addStudent() {
|
|
|
- this.bizType = 1
|
|
|
- this.$refs.selection.clearCurrentRow()
|
|
|
- this.addStudentStatus = true
|
|
|
- },
|
|
|
- importStudent() {
|
|
|
- this.importStudentStatus = true
|
|
|
- },
|
|
|
- showAuthorization() {
|
|
|
- this.authorizationStatus = true
|
|
|
- },
|
|
|
- editStudent(index) {
|
|
|
- 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
|
|
|
- } else {
|
|
|
- if (this.selections.length > 0) {
|
|
|
- this.editStudentInfo = [];
|
|
|
- [...this.editStudentInfo] = this.selections
|
|
|
- this.addStudentStatus = true
|
|
|
- } else {
|
|
|
- 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])
|
|
|
- this.$Modal.confirm({
|
|
|
- title: this.$t('stuAccount.tips2Title'),
|
|
|
- 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)
|
|
|
- }
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ fn,
|
|
|
+ classroomList: [],
|
|
|
+ classroomShowList: [],
|
|
|
+ gradeList: [],
|
|
|
+ searchPeriod: '',
|
|
|
+ searchGrade: '',
|
|
|
+ searchClassroom: '',
|
|
|
+ schoolData: {},
|
|
|
+ tableLoading: false,
|
|
|
+ searchText: '',
|
|
|
+ currentPage: 1,
|
|
|
+ pageSize: 30,
|
|
|
+ bizType: 0, // 0:新增 1:修改
|
|
|
+ editStudentInfo: [],
|
|
|
+ selections: [],
|
|
|
+ selectRow: {},
|
|
|
+ addStudentStatus: false,
|
|
|
+ importStudentStatus: false,
|
|
|
+ authorizationStatus: false,
|
|
|
+ demoLoginInfo: {
|
|
|
+ user: 'admin',
|
|
|
+ TEAMModelId: 'habook#0001',
|
|
|
+ school: '醍摩豆书院',
|
|
|
+ schoolCode: 'HBCN'
|
|
|
},
|
|
|
- (err) => {
|
|
|
- alert('API error!')
|
|
|
+ tableData: [],
|
|
|
+ tableShowData: [],
|
|
|
+ tablePageData: [],
|
|
|
+ tableColumns: []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ cancel() {
|
|
|
+ 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 })
|
|
|
+ if (this.classroomShowList.length == 0) {
|
|
|
+ this.$refs.classroom.clearSingleSelect()
|
|
|
}
|
|
|
- )
|
|
|
},
|
|
|
- onCancel: () => {
|
|
|
- }
|
|
|
- })
|
|
|
- } else {
|
|
|
- let i = this.getIndex(this.tableData, row)
|
|
|
- if (i >= 0) {
|
|
|
- this.tableData.splice(i, 1)
|
|
|
- } else {
|
|
|
- this.$Message.error(this.$t('stuAccount.tips3'))
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- getSchoolData() {
|
|
|
- this.$api.schoolSetting.findSchoolSystem({
|
|
|
- schoolCode: this.demoLoginInfo.schoolCode
|
|
|
- }).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()
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- )
|
|
|
- },
|
|
|
- getClassroom() {
|
|
|
- this.$api.schoolSetting.findClassInfo({
|
|
|
- // schoolCode: this.demoLoginInfo.schoolCode,
|
|
|
- // scope:'school'
|
|
|
- scopeCode: this.demoLoginInfo.schoolCode
|
|
|
- }).then(res => {
|
|
|
- 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()
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- initData() {
|
|
|
- this.tableColumns = [
|
|
|
- {
|
|
|
- type: 'selection',
|
|
|
- width: 80,
|
|
|
- align: 'center'
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'seatNo',
|
|
|
- title: this.$t('stuAccount.seatNo'),
|
|
|
- align: 'center',
|
|
|
- width: 80
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'studentId',
|
|
|
- title: this.$t('stuAccount.account'),
|
|
|
- align: 'center'
|
|
|
- },
|
|
|
- {
|
|
|
- key: 'name',
|
|
|
- title: this.$t('stuAccount.stuName'),
|
|
|
- align: 'center'
|
|
|
- },
|
|
|
- {
|
|
|
- slot: 'classroomName',
|
|
|
- title: this.$t('stuAccount.classroomName'),
|
|
|
- align: 'center'
|
|
|
- },
|
|
|
- {
|
|
|
- slot: 'classroomCode',
|
|
|
- title: this.$t('stuAccount.classroomCode'),
|
|
|
- align: 'center'
|
|
|
- },
|
|
|
- {
|
|
|
- slot: 'periodName',
|
|
|
- title: this.$t('stuAccount.period'),
|
|
|
- align: 'center'
|
|
|
- },
|
|
|
- {
|
|
|
- slot: 'gradeName',
|
|
|
- title: this.$t('stuAccount.grade'),
|
|
|
- align: 'center'
|
|
|
- },
|
|
|
- {
|
|
|
- slot: 'status',
|
|
|
- title: this.$t('stuAccount.authStatus'),
|
|
|
- align: 'center'
|
|
|
- },
|
|
|
- {
|
|
|
- slot: 'action',
|
|
|
- title: ' ',
|
|
|
- width: 100,
|
|
|
- align: 'center'
|
|
|
- }
|
|
|
- ]
|
|
|
- },
|
|
|
- findStudentInfo() {
|
|
|
- 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
|
|
|
- for (let item of this.tableData) {
|
|
|
- let currentSchoolInfo = this.$JSONPath.query(this.$store.state.schoolBaseInfo.schoolBaseInfo, "$..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
|
|
|
+ getClassroomList(index) {
|
|
|
+ this.classroomShowList = this.classroomList.filter((item) => { return item.grade == this.gradeList[index].code })
|
|
|
+ if (this.classroomShowList.length == 0) {
|
|
|
+ this.$refs.classroom.clearSingleSelect()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getPageData() {
|
|
|
+ let start = ((this.currentPage - 1) * this.pageSize)
|
|
|
+ let end = 0
|
|
|
+ if (this.tableShowData.length < this.currentPage * this.pageSize) {
|
|
|
+ end = this.tableShowData.length
|
|
|
+ } else {
|
|
|
+ end = this.currentPage * this.pageSize
|
|
|
+ }
|
|
|
+ this.tablePageData = this.tableShowData.slice(start, end)
|
|
|
+ },
|
|
|
+ searchData() {
|
|
|
+ this.tableLoading = true
|
|
|
+ this.tableShowData = this.tableData.filter(item => JSON.stringify(item).indexOf(this.searchText) != -1)
|
|
|
+ this.currentPage = 1
|
|
|
+ this.getPageData()
|
|
|
+ this.tableLoading = false
|
|
|
+ },
|
|
|
+ filterStudentInfo() {
|
|
|
+ let grade = ''
|
|
|
+ if (this.searchPeriod == undefined) {
|
|
|
+ this.searchPeriod = ''
|
|
|
+ }
|
|
|
+ if (this.searchGrade == undefined || this.searchGrade == '') {
|
|
|
+ this.grade = ''
|
|
|
+ } else {
|
|
|
+ grade = '"gradeCode":' + '"' + this.searchGrade + '"'
|
|
|
}
|
|
|
- }
|
|
|
- [...this.tableShowData] = this.tableData
|
|
|
- this.getPageData()
|
|
|
- this.$forceUpdate()
|
|
|
- this.tableLoading = false
|
|
|
- } else {
|
|
|
- alert('API error!')
|
|
|
- this.tableLoading = false
|
|
|
+ if (this.searchClassroom == undefined) {
|
|
|
+ this.searchClassroom = ''
|
|
|
+ }
|
|
|
+ this.tableLoading = true
|
|
|
+ this.tableShowData = this.tableData.filter(
|
|
|
+ item => {
|
|
|
+ return JSON.stringify(item).indexOf(this.searchPeriod) !== -1 && JSON.stringify(item).indexOf(grade) !== -1 && JSON.stringify(item).indexOf(this.searchClassroom) !== -1
|
|
|
+ }
|
|
|
+ )
|
|
|
+ this.currentPage = 1
|
|
|
+ this.getPageData()
|
|
|
+ this.tableLoading = false
|
|
|
+ },
|
|
|
+ cancelAll() {
|
|
|
+ this.selections = []
|
|
|
+ },
|
|
|
+ getIndex(_arr, _obj) {
|
|
|
+ var len = _arr.length
|
|
|
+ for (let i = 0; i < len; i++) {
|
|
|
+ if (this.isObjEqual(_arr[i], _obj)) {
|
|
|
+ return parseInt(i)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return -1
|
|
|
+ },
|
|
|
+ isObjEqual(o1, o2) {
|
|
|
+ var props1 = Object.keys(o1)
|
|
|
+ var props2 = Object.keys(o2)
|
|
|
+ if (props1.length != props2.length) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ for (var i = 0, max = props1.length; i < max; i++) {
|
|
|
+ var propName = props1[i]
|
|
|
+ if (o1[propName] !== o2[propName]) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ },
|
|
|
+ getSelectInfo(selction, row) {
|
|
|
+ this.selections = selction
|
|
|
+ this.selectRow = row
|
|
|
+ },
|
|
|
+ closeAddStudent(data) {
|
|
|
+ if (data.action == 1) {
|
|
|
+ let infoString = JSON.stringify(data.studentInfo)
|
|
|
+ let info = JSON.parse(infoString)
|
|
|
+ this.tableData.unshift(info);
|
|
|
+ [...this.tableShowData] = this.tableData
|
|
|
+ this.getPageData()
|
|
|
+ } else {
|
|
|
+ this.findStudentInfo()
|
|
|
+ }
|
|
|
+ this.addStudentStatus = false
|
|
|
+ },
|
|
|
+ closeImportStudent(data) {
|
|
|
+ this.findStudentInfo()
|
|
|
+ this.importStudentStatus = false
|
|
|
+ },
|
|
|
+ closeAuth() {
|
|
|
+ this.authorizationStatus = false
|
|
|
+ },
|
|
|
+ addStudent() {
|
|
|
+ this.bizType = 1
|
|
|
+ this.$refs.selection.clearCurrentRow()
|
|
|
+ this.addStudentStatus = true
|
|
|
+ },
|
|
|
+ importStudent() {
|
|
|
+ this.importStudentStatus = true
|
|
|
+ },
|
|
|
+ showAuthorization() {
|
|
|
+ this.authorizationStatus = true
|
|
|
+ },
|
|
|
+ editStudent(index) {
|
|
|
+ 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
|
|
|
+ } else {
|
|
|
+ if (this.selections.length > 0) {
|
|
|
+ this.editStudentInfo = [];
|
|
|
+ [...this.editStudentInfo] = this.selections
|
|
|
+ this.addStudentStatus = true
|
|
|
+ } else {
|
|
|
+ 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])
|
|
|
+ this.$Modal.confirm({
|
|
|
+ title: this.$t('stuAccount.tips2Title'),
|
|
|
+ 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)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ alert('API error!')
|
|
|
+ }
|
|
|
+ )
|
|
|
+ },
|
|
|
+ onCancel: () => {
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ let i = this.getIndex(this.tableData, row)
|
|
|
+ if (i >= 0) {
|
|
|
+ this.tableData.splice(i, 1)
|
|
|
+ } else {
|
|
|
+ this.$Message.error(this.$t('stuAccount.tips3'))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getSchoolData() {
|
|
|
+ this.$api.schoolSetting.findSchoolSystem({
|
|
|
+ schoolCode: this.demoLoginInfo.schoolCode
|
|
|
+ }).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()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ )
|
|
|
+ },
|
|
|
+ getClassroom() {
|
|
|
+ this.$api.schoolSetting.findClassInfo({
|
|
|
+ // schoolCode: this.demoLoginInfo.schoolCode,
|
|
|
+ // scope:'school'
|
|
|
+ scopeCode: this.demoLoginInfo.schoolCode
|
|
|
+ }).then(res => {
|
|
|
+ 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()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ initData() {
|
|
|
+ this.tableColumns = [
|
|
|
+ {
|
|
|
+ type: 'selection',
|
|
|
+ width: 80,
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'seatNo',
|
|
|
+ title: this.$t('stuAccount.seatNo'),
|
|
|
+ align: 'center',
|
|
|
+ width: 80
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'studentId',
|
|
|
+ title: this.$t('stuAccount.account'),
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'name',
|
|
|
+ title: this.$t('stuAccount.stuName'),
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ slot: 'classroomName',
|
|
|
+ title: this.$t('stuAccount.classroomName'),
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ slot: 'classroomCode',
|
|
|
+ title: this.$t('stuAccount.classroomCode'),
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ slot: 'periodName',
|
|
|
+ title: this.$t('stuAccount.period'),
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ slot: 'gradeName',
|
|
|
+ title: this.$t('stuAccount.grade'),
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ slot: 'status',
|
|
|
+ title: this.$t('stuAccount.authStatus'),
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ slot: 'action',
|
|
|
+ title: ' ',
|
|
|
+ width: 100,
|
|
|
+ align: 'center'
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ findStudentInfo() {
|
|
|
+ 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
|
|
|
+ for (let item of this.tableData) {
|
|
|
+ let currentClassroomlInfo = this.$JSONPath.query(this.$store.state.schoolBaseInfo.classroomList, "$..[?(@.classroomCode=='" + item.classroomCode + "')]")
|
|
|
+
|
|
|
+ if (currentClassroomlInfo.length > 0) {
|
|
|
+ let currentSchoolInfo = this.$JSONPath.query(this.$store.state.schoolBaseInfo.schoolBaseInfo, "$..period[?(@.periodCode=='" + currentClassroomlInfo[0].periodCode + "')]")
|
|
|
+ item.periodName = currentSchoolInfo[0].periodName
|
|
|
+ item.periodCode = currentSchoolInfo[0].periodCode
|
|
|
+ item.gradeName = this.$JSONPath.query(currentSchoolInfo, "$..grades[?(@.gradeCode=='" + currentClassroomlInfo[0].gradeCode + "')]")[0].gradeName
|
|
|
+ item.gradeCode = this.$JSONPath.query(currentSchoolInfo, "$..grades[?(@.gradeCode=='" + currentClassroomlInfo[0].gradeCode + "')]")[0].gradeCode
|
|
|
+ item.classroomName = currentClassroomlInfo[0].classroomName
|
|
|
+ }
|
|
|
+ }
|
|
|
+ [...this.tableShowData] = this.tableData
|
|
|
+ this.getPageData()
|
|
|
+ this.$forceUpdate()
|
|
|
+ this.tableLoading = false
|
|
|
+ } else {
|
|
|
+ alert('API error!')
|
|
|
+ this.tableLoading = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ this.tableLoading = false
|
|
|
+ }
|
|
|
+ )
|
|
|
}
|
|
|
- },
|
|
|
- (err) => {
|
|
|
- this.tableLoading = false
|
|
|
- }
|
|
|
- )
|
|
|
- }
|
|
|
- },
|
|
|
- created() {
|
|
|
- this.initData()
|
|
|
- this.getSchoolData()
|
|
|
- // this.getClassroom();
|
|
|
- // this.findStudentInfo();
|
|
|
- },
|
|
|
- computed: {
|
|
|
- },
|
|
|
- mounted() {
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.initData()
|
|
|
+ this.getSchoolData()
|
|
|
+ // this.getClassroom();
|
|
|
+ // this.findStudentInfo();
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
</script>
|