|
@@ -2,9 +2,9 @@
|
|
|
<div class="class-mgt-container">
|
|
|
<Loading v-show="isListLoading"></Loading>
|
|
|
<div class="class-list-wrap">
|
|
|
- <!--班级列表-->
|
|
|
+ <!--教室列表头部-->
|
|
|
<div class="class-list-header">
|
|
|
- <Dropdown class="sort-dropdown" trigger="click" placement="bottom-start" @on-click="function(e){ filterPeriod = e }" @on-visible-change="dropdownStates" v-if="$store.state.user.schoolProfile.school_base">
|
|
|
+ <!-- <Dropdown class="sort-dropdown" trigger="click" placement="bottom-start" @on-click="function(e){ filterPeriod = e }" @on-visible-change="dropdownStates" v-if="$store.state.user.schoolProfile.school_base">
|
|
|
<span style="cursor: pointer;">
|
|
|
{{$t('schoolBaseInfo.pdLabel')}}
|
|
|
<b class="title">{{ filterPeriodName }}</b>
|
|
@@ -13,7 +13,8 @@
|
|
|
<DropdownMenu slot="list" v-for="(item,index) in periods" :value="item.id" :key="index">
|
|
|
<DropdownItem :name="item.id">{{ item.name }}</DropdownItem>
|
|
|
</DropdownMenu>
|
|
|
- </Dropdown>
|
|
|
+ </Dropdown> -->
|
|
|
+ <span>{{$t('schoolBaseInfo.classroomList')}}</span>
|
|
|
<div v-if="!isSearch" style="float:right;">
|
|
|
<Icon class="action-btn-icon" type="ios-search" @click="isSearch = true" />
|
|
|
<Icon v-if="$access.can('admin.*|classroom-upd')" class="action-btn-icon" type="md-trash" @click.stop="showConfirmDelete()" />
|
|
@@ -23,6 +24,7 @@
|
|
|
<Input icon="ios-close" v-model="keyword" :placeholder="$t('schoolBaseInfo.codeSearchHolder')" autofocus style="width:100%" @on-click="closeKeySearch" @on-change="filterClassname" />
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <!-- 排序条件 -->
|
|
|
<div class="class-list-filter">
|
|
|
<div class="class-list-filter-box">
|
|
|
<Dropdown class="sort-dropdown" trigger="click" placement="bottom-start" @on-click="function(e){ orderBy = e }" @on-visible-change="restOrderBy">
|
|
@@ -38,11 +40,12 @@
|
|
|
</Dropdown>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <!-- 教室数据列表 -->
|
|
|
<div class="class-list" id="class-list">
|
|
|
<vuescroll>
|
|
|
<div class="class-list-item" v-for="(item,index) in classroomListShow" :key="index" @click="chooseClassroom(index)" :class="curClassIndex == index ? 'block-bg block-bg-active':'block-bg'">
|
|
|
<div class="class-list-item-left">
|
|
|
- <p style="color: #a5a5a5;">{{$jsFn.getGradeName(schoolBase,item.gradeId)}}</p>
|
|
|
+ <!-- <p style="color: #a5a5a5;">{{$jsFn.getGradeName(schoolBase,item.gradeId)}}</p> -->
|
|
|
<p class="class-name">
|
|
|
<span class="class-id-tag">
|
|
|
{{item.no}}
|
|
@@ -66,13 +69,14 @@
|
|
|
{{$t('schoolBaseInfo.normalClass')}}
|
|
|
</span>
|
|
|
</template>
|
|
|
- <p class="second-text-color" v-if="item.openType == '1'">
|
|
|
+ </p>
|
|
|
+ <!-- <p class="second-text-color" v-if="item.openType == '1'">
|
|
|
<span>{{ $t('schoolBaseInfo.headmaster') }}</span>
|
|
|
<span class="primary-text-color">{{item.teacher.name}}</span>
|
|
|
</p>
|
|
|
<p class="second-text-color" v-else>
|
|
|
<span class="primary-text-color">{{$t('schoolBaseInfo.dClass')}}</span>
|
|
|
- </p>
|
|
|
+ </p> -->
|
|
|
</div>
|
|
|
</div>
|
|
|
<EmptyData v-if="classroomListShow.length == 0" style="padding-top:120px;"></EmptyData>
|
|
@@ -80,21 +84,23 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="class-info-wrap">
|
|
|
+ <!-- tab菜单 -->
|
|
|
<div class="class-info-header common-save-btn">
|
|
|
- <span :class="currentTabIndex == 0 ? 'main-header-tab line-bottom line-bottom-active':'main-header-tab line-bottom'" @click="selectTab(0)">
|
|
|
+ <!-- <span :class="currentTabIndex == 0 ? 'main-header-tab line-bottom line-bottom-active':'main-header-tab line-bottom'" @click="selectTab(0)">
|
|
|
{{$t('schoolBaseInfo.tab1')}}
|
|
|
- </span>
|
|
|
- <span :class="currentTabIndex == 2 ? 'main-header-tab line-bottom line-bottom-active':'main-header-tab line-bottom'" @click="selectTab(2)">
|
|
|
- {{$t('schoolBaseInfo.tab2')}}
|
|
|
- </span>
|
|
|
+ </span> -->
|
|
|
+
|
|
|
<span :class="currentTabIndex == 1 ? 'main-header-tab line-bottom line-bottom-active':'main-header-tab line-bottom'" @click="selectTab(1)">
|
|
|
{{$t('schoolBaseInfo.tab3')}}
|
|
|
</span>
|
|
|
<span :class="currentTabIndex == 3 ? 'main-header-tab line-bottom line-bottom-active':'main-header-tab line-bottom'" @click="selectTab(3)">
|
|
|
{{$t('schoolBaseInfo.tab4')}}
|
|
|
</span>
|
|
|
+ <span :class="currentTabIndex == 2 ? 'main-header-tab line-bottom line-bottom-active':'main-header-tab line-bottom'" @click="selectTab(2)">
|
|
|
+ {{$t('schoolBaseInfo.tab2')}}
|
|
|
+ </span>
|
|
|
<!-- 编辑教室 -->
|
|
|
- <Button v-if="$access.can('admin.*|classroom-upd')" class="save-btn" :loading="isSaveLoading" :disabled="!updated" icon="ios-albums-outline" @click="saveClassroom()" v-show="currentTabIndex == 0">
|
|
|
+ <Button v-if="$access.can('admin.*|classroom-upd')" class="save-btn" :loading="isSaveLoading" :disabled="!updated" icon="ios-albums-outline" @click="saveClassroom()" v-show="currentTabIndex == 1">
|
|
|
{{$t('schoolBaseInfo.saveInfo')}}
|
|
|
</Button>
|
|
|
<!-- 添加学生 -->
|
|
@@ -107,7 +113,7 @@
|
|
|
</Button>
|
|
|
</div>
|
|
|
<div class="class-info-content">
|
|
|
- <!--基础信息-->
|
|
|
+ <!--基础信息 基础信息很少,暂时去掉-->
|
|
|
<div v-show="currentTabIndex == 0" style="display:flex;flex-direction:row;width:100%;height:100%;">
|
|
|
<!--班级属性-->
|
|
|
<div class="class-attr-wrap disabled-iview-select dark-iview-select">
|
|
@@ -121,33 +127,32 @@
|
|
|
<span slot="label" class="class-attr-wrap-label">{{$t('schoolBaseInfo.classroomCode')}}</span>
|
|
|
<Input @on-change="watchUpdate" :disabled="editStatus" v-model="classroomListShow[curClassIndex].no" clearable :placeholder="$t('schoolBaseInfo.classroomCodeHolder')" />
|
|
|
</FormItem>
|
|
|
- <FormItem prop="gradeId" :label="$t('schoolBaseInfo.setGrade')" @click.native.stop class="requird-color" v-if="classroomListShow[curClassIndex].openType == '1'">
|
|
|
+ <!-- <FormItem prop="gradeId" :label="$t('schoolBaseInfo.setGrade')" @click.native.stop class="requird-color" v-if="classroomListShow[curClassIndex].openType == '1'">
|
|
|
<span slot="label" class="class-attr-wrap-label">{{$t('schoolBaseInfo.setGrade')}}</span>
|
|
|
<Select @on-change="watchUpdate" :disabled="editStatus" v-model="classroomListShow[curClassIndex].gradeId" clearable>
|
|
|
<Option v-for="(item,index) in $jsFn.getPeriod($store.state.user.schoolProfile.school_base,classroomListShow[curClassIndex].periodId).grades" :value="item.id" :key="index">
|
|
|
{{ item.name }}
|
|
|
</Option>
|
|
|
</Select>
|
|
|
- </FormItem>
|
|
|
+ </FormItem> -->
|
|
|
<FormItem prop="openType" @click.native.stop class="requird-color">
|
|
|
<span slot="label" class="class-attr-wrap-label">{{$t('schoolBaseInfo.classAttr')}}</span>
|
|
|
<Select @on-change="watchUpdate" :disabled="editStatus" v-model="classroomListShow[curClassIndex].openType" clearable>
|
|
|
<Option v-for="(item,index) in attributeList" :value="item.value" :key="index">{{ item.label }}</Option>
|
|
|
</Select>
|
|
|
</FormItem>
|
|
|
- <FormItem prop="teacher" :label="$t('schoolBaseInfo.headmaster')" @click.native.stop class="requird-color" v-if="classroomListShow[curClassIndex].openType == '1'">
|
|
|
+ <!-- <FormItem prop="teacher" :label="$t('schoolBaseInfo.headmaster')" @click.native.stop class="requird-color" v-if="classroomListShow[curClassIndex].openType == '1'">
|
|
|
<span slot="label" class="class-attr-wrap-label">{{$t('schoolBaseInfo.headmaster')}}</span>
|
|
|
<Select @on-change="watchUpdate" :disabled="editStatus" v-model="classroomListShow[curClassIndex].teacher.id" clearable filterable>
|
|
|
<Option v-for="(item,index) in $store.state.teachers.teacherList.filter(item=>item.status == 'join')" :value="item.id" :key="index" @click.native="classroomListShow[curClassIndex].teacher = {id:item.id, name:item.name}">
|
|
|
{{ item.name }}
|
|
|
</Option>
|
|
|
</Select>
|
|
|
- </FormItem>
|
|
|
+ </FormItem> -->
|
|
|
</Form>
|
|
|
</vuescroll>
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
|
|
|
<!-- 關聯 Hiteach -->
|
|
|
<div id="hiteach-link" style="height: 100%;" v-show="currentTabIndex == 3">
|
|
@@ -178,7 +183,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="hiteach-code-wrap-list">
|
|
|
- <vuescroll >
|
|
|
+ <vuescroll>
|
|
|
<div class="hiteach-collapse" v-for="(item, index) in showHiteachData" :key="index">
|
|
|
<div @click="openHiSub(index)" class="hiteach-collapse-main">
|
|
|
<Icon class="arrowIcon" v-if="item.deviceMax > 1" :type="item.subOpen ? 'ios-arrow-up' : 'ios-arrow-down'" size="30" color="white" />
|
|
@@ -211,7 +216,7 @@
|
|
|
<template v-if="item.deviceBound.length >0">
|
|
|
<div v-for="(dbItem, dbIndex) in item.deviceBound" :key="dbIndex" class="hiteach-collapse-sub gradient" :class="{'linked': dbItem.classId != '' && dbItem.classId != null && classroomListShow[curClassIndex].id != dbItem.classId}">
|
|
|
<!-- 被關聯 disabled -->
|
|
|
- <Button class="hiteach-collapse-sub-linkBtn" v-model="dbItem.hiteachLink" @click="confirmLink(dbItem.hiteachLink, item.id, dbItem.uuid, dbItem.uuid2, classroomListShow[curClassIndex].id)" >{{ dbItem.hiteachLink ? $t('schoolBaseInfo.deLink') : $t('schoolBaseInfo.link') }}</Button>
|
|
|
+ <Button class="hiteach-collapse-sub-linkBtn" v-model="dbItem.hiteachLink" @click="confirmLink(dbItem.hiteachLink, item.id, dbItem.uuid, dbItem.uuid2, classroomListShow[curClassIndex].id)">{{ dbItem.hiteachLink ? $t('schoolBaseInfo.deLink') : $t('schoolBaseInfo.link') }}</Button>
|
|
|
<!-- <Checkbox :id="'checkbox-' + (dbItem.uuid + dbItem.uuid2)" @on-change="whatUpdHiLink(dbItem, classroomListShow[curClassIndex].id, item.id)" style="margin-right: 70px;" v-model="dbItem.hiteachLink" :disabled="dbItem.classId != '' && dbItem.classId != null && classroomListShow[curClassIndex].id != dbItem.classId"></Checkbox> -->
|
|
|
<div class="hiteach-collapse-sub-detail">
|
|
|
<ul>
|
|
@@ -314,6 +319,25 @@
|
|
|
<Modal v-model="addStuStatus" :title="$t('schoolBaseInfo.addStuBtn')" width="1200" @on-ok="confirmAddStu" class-name="dark-iview-modal">
|
|
|
<StudentList @getSelectInfo="(selction)=>{selections = selction}"></StudentList>
|
|
|
</Modal>
|
|
|
+ <Modal v-model="addRoomStatus" :title="$t('schoolBaseInfo.addClassroom')" @on-ok="confirmAddRoom" class-name="dark-iview-modal dark-iview-form">
|
|
|
+ <Form ref="classInfo" :model="room" :rules="classValidate">
|
|
|
+ <FormItem prop="name" :label="$t('schoolBaseInfo.classroomName')" @click.native.stop class="requird-color">
|
|
|
+ <span slot="label" class="class-attr-wrap-label">{{$t('schoolBaseInfo.classroomName')}}</span>
|
|
|
+ <Input @on-change="watchUpdate" :disabled="editStatus" v-model="room.name" clearable :placeholder="$t('schoolBaseInfo.classroomNameHolder')" />
|
|
|
+ </FormItem>
|
|
|
+ <FormItem prop="no" @click.native.stop class="requird-color">
|
|
|
+ <span slot="label" class="class-attr-wrap-label">{{$t('schoolBaseInfo.classroomCode')}}</span>
|
|
|
+ <Input @on-change="watchUpdate" :disabled="editStatus" v-model="room.no" clearable :placeholder="$t('schoolBaseInfo.classroomCodeHolder')" />
|
|
|
+ </FormItem>
|
|
|
+ <FormItem prop="openType" @click.native.stop class="requird-color">
|
|
|
+ <span slot="label" class="class-attr-wrap-label">{{$t('schoolBaseInfo.classAttr')}}</span>
|
|
|
+ <Select @on-change="watchUpdate" :disabled="editStatus" v-model="room.openType" clearable>
|
|
|
+ <Option v-for="(item,index) in attributeList" :value="item.value" :key="index">{{ item.label }}</Option>
|
|
|
+ </Select>
|
|
|
+ </FormItem>
|
|
|
+ </Form>
|
|
|
+ </Modal>
|
|
|
+
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -344,6 +368,13 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
return {
|
|
|
+ room: {
|
|
|
+ id: '',
|
|
|
+ name: '',
|
|
|
+ no: '',
|
|
|
+ openType: ''
|
|
|
+ },
|
|
|
+ addRoomStatus: false,
|
|
|
studentColumn: [
|
|
|
{
|
|
|
title: ' ',
|
|
@@ -413,7 +444,7 @@ export default {
|
|
|
editStatus: true,//可切换编辑状态
|
|
|
noStatus: false,
|
|
|
isSearch: false,
|
|
|
- currentTabIndex: 0,
|
|
|
+ currentTabIndex: 1,
|
|
|
isListLoading: false,
|
|
|
isSaveLoading: false,
|
|
|
hiteachListLoading: true,
|
|
@@ -528,12 +559,12 @@ export default {
|
|
|
let data = this.hiteachData
|
|
|
let filterText = this.filterHiteachVer
|
|
|
let nowSeletedClassId = null
|
|
|
- if(this.classroomListShow.length > 0){
|
|
|
+ if (this.classroomListShow.length > 0) {
|
|
|
nowSeletedClassId = this.classroomListShow[this.curClassIndex].id
|
|
|
}
|
|
|
|
|
|
- if(nowSeletedClassId != null && this.isSmart(nowSeletedClassId)){
|
|
|
-
|
|
|
+ if (nowSeletedClassId != null && this.isSmart(nowSeletedClassId)) {
|
|
|
+
|
|
|
// 篩選有 deviceBound 且classID 和現在的教室相同的
|
|
|
data = data.filter(item => {
|
|
|
return Array.isArray(item.deviceBound) && item.deviceBound.length > 0 && item.deviceBound.some(s => { return s.classId == nowSeletedClassId })
|
|
@@ -542,7 +573,7 @@ export default {
|
|
|
// 整形 拿掉不相關的
|
|
|
data = data.map(item => {
|
|
|
let newD = item
|
|
|
- newD.deviceBound = newD.deviceBound.filter( f => {
|
|
|
+ newD.deviceBound = newD.deviceBound.filter(f => {
|
|
|
return f.classId != null && f.classId != ''
|
|
|
})
|
|
|
return newD
|
|
@@ -551,15 +582,15 @@ export default {
|
|
|
// 整形 拿掉沒被關聯的
|
|
|
data = data.map(item => {
|
|
|
let newD = item
|
|
|
- if(Array.isArray(item.deviceBound) && item.deviceBound.length > 0){
|
|
|
- newD.deviceBound = newD.deviceBound.filter( f => {
|
|
|
+ if (Array.isArray(item.deviceBound) && item.deviceBound.length > 0) {
|
|
|
+ newD.deviceBound = newD.deviceBound.filter(f => {
|
|
|
return f.classId == null || f.classId == ''
|
|
|
})
|
|
|
}
|
|
|
return newD
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
if (Array.isArray(data) && data.length > 0 && filterText != 'ALL') {
|
|
|
data = data.filter(item => {
|
|
@@ -610,7 +641,7 @@ export default {
|
|
|
err => {
|
|
|
this.$Message.error(this.$t('schoolBaseInfo.findStuErr'))
|
|
|
}
|
|
|
- ).finally(()=>{
|
|
|
+ ).finally(() => {
|
|
|
this.stuLoading = false
|
|
|
})
|
|
|
}
|
|
@@ -637,14 +668,14 @@ export default {
|
|
|
let requestParams = {
|
|
|
schoolId: this.$store.state.userInfo.schoolCode,
|
|
|
students: [],
|
|
|
- grant_type:'remove'
|
|
|
+ grant_type: 'remove'
|
|
|
}
|
|
|
let names = []
|
|
|
if (index > -1) {
|
|
|
requestParams.students.push(this.students[index].id)
|
|
|
names = [this.students[index].name]
|
|
|
} else if (this.delSelections.length > 0) {
|
|
|
- requestParams.students = this.delSelections.map(item=>{
|
|
|
+ requestParams.students = this.delSelections.map(item => {
|
|
|
return item.id
|
|
|
})
|
|
|
names = this.delSelections.map(item => {
|
|
@@ -659,12 +690,12 @@ export default {
|
|
|
this.$api.stuAccount.removeStudent(requestParams).then(
|
|
|
res => {
|
|
|
this.$Message.success(this.$t('schoolBaseInfo.removeOk'))
|
|
|
- if(index > -1){
|
|
|
+ if (index > -1) {
|
|
|
this.students.splice(index, 1)
|
|
|
- }else{
|
|
|
- for(let i = 0; i < this.students.length; i){
|
|
|
- if(requestParams.students.indexOf(this.students[i].id) > -1){
|
|
|
- this.students.splice(i,1)
|
|
|
+ } else {
|
|
|
+ for (let i = 0; i < this.students.length; i) {
|
|
|
+ if (requestParams.students.indexOf(this.students[i].id) > -1) {
|
|
|
+ this.students.splice(i, 1)
|
|
|
i--
|
|
|
}
|
|
|
|
|
@@ -685,12 +716,12 @@ export default {
|
|
|
if (this.selections.length > 0) {
|
|
|
console.log(this.selections)
|
|
|
let data = this._.cloneDeep(this.selections)
|
|
|
- data.forEach(item=>{
|
|
|
+ data.forEach(item => {
|
|
|
item.classId = this.classroomListShow[this.curClassIndex].id
|
|
|
item.className = this.classroomListShow[this.curClassIndex].name
|
|
|
item.classNo = this.classroomListShow[this.curClassIndex].no
|
|
|
})
|
|
|
-
|
|
|
+
|
|
|
this.listLoading = true
|
|
|
this.$api.stuAccount.updateStudent({
|
|
|
students: data,
|
|
@@ -1046,78 +1077,126 @@ export default {
|
|
|
return false
|
|
|
},
|
|
|
saveClassroom() {
|
|
|
- this.$refs['classInfo'].validate((valid) => {
|
|
|
- if (!valid) {
|
|
|
- this.$Message.error(this.$t('schoolBaseInfo.formWarning'))
|
|
|
- } else {
|
|
|
- let option = this.classroomListShow[this.curClassIndex].option
|
|
|
- if (!option) {
|
|
|
- option = 'update'
|
|
|
- } else {
|
|
|
- this.classroomListShow[this.curClassIndex]['code'] = this.$store.state.userInfo.schoolCode
|
|
|
- }
|
|
|
- delete this.classroomListShow[this.curClassIndex].option
|
|
|
- this.isSaveLoading = true
|
|
|
- this.isListLoading = true
|
|
|
- if (this.classroomListShow[this.curClassIndex].openType == '2') {
|
|
|
- this.classroomListShow[this.curClassIndex].teacher.id = ''
|
|
|
- this.classroomListShow[this.curClassIndex].teacher.name = ''
|
|
|
- }
|
|
|
- this.$api.schoolSetting.classUpsert({
|
|
|
- classroom: this.classroomListShow[this.curClassIndex],
|
|
|
- option: option,
|
|
|
- school_code: this.$store.state.userInfo.schoolCode
|
|
|
- }).then(
|
|
|
- res => {
|
|
|
- if (res) {
|
|
|
- if (res.error) {
|
|
|
- this.classroomListShow[this.curClassIndex].option = option
|
|
|
- this.$Message.error(res.v)
|
|
|
- } else {
|
|
|
- this.$Message.success(this.$t('schoolBaseInfo.csTips3'))
|
|
|
- this.updated = false
|
|
|
- this.updHiteachLink = []
|
|
|
- if (option == 'insert') {
|
|
|
- this.classroomListShow[this.curClassIndex].code = 'Class-' + this.classroomListShow[this.curClassIndex].code
|
|
|
- this.classroomList.unshift(this.classroomListShow[this.curClassIndex])
|
|
|
- this.$store.dispatch('user/addSchoolClasses', this.classroomListShow[this.curClassIndex]);
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- this.$Message.error('API error!')
|
|
|
+ // this.$refs['room'].validate((valid) => {
|
|
|
+ // if (!valid) {
|
|
|
+ // this.$Message.error(this.$t('schoolBaseInfo.formWarning'))
|
|
|
+ // } else {
|
|
|
+ this.classroomListShow[this.curClassIndex]['code'] = this.$store.state.userInfo.schoolCode
|
|
|
+ this.isSaveLoading = true
|
|
|
+ this.isListLoading = true
|
|
|
+ // if (this.classroomListShow[this.curClassIndex].openType == '2') {
|
|
|
+ // this.classroomListShow[this.curClassIndex].teacher.id = ''
|
|
|
+ // this.classroomListShow[this.curClassIndex].teacher.name = ''
|
|
|
+ // }
|
|
|
+ // this.$api.schoolSetting.classUpsert({
|
|
|
+ // classroom: this.classroomListShow[this.curClassIndex],
|
|
|
+ // option: option,
|
|
|
+ // school_code: this.$store.state.userInfo.schoolCode
|
|
|
+ // }).then(
|
|
|
+ // res => {
|
|
|
+ // if (res) {
|
|
|
+ // if (res.error) {
|
|
|
+ // this.classroomListShow[this.curClassIndex].option = option
|
|
|
+ // this.$Message.error(res.v)
|
|
|
+ // } else {
|
|
|
+ // this.$Message.success(this.$t('schoolBaseInfo.csTips3'))
|
|
|
+ // this.updated = false
|
|
|
+ // this.updHiteachLink = []
|
|
|
+ // if (option == 'insert') {
|
|
|
+ // this.classroomListShow[this.curClassIndex].code = 'Class-' + this.classroomListShow[this.curClassIndex].code
|
|
|
+ // this.classroomList.unshift(this.classroomListShow[this.curClassIndex])
|
|
|
+ // this.$store.dispatch('user/addSchoolClasses', this.classroomListShow[this.curClassIndex]);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // this.$Message.error('API error!')
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // err => {
|
|
|
+ // this.$Message.error('API error!')
|
|
|
+ // }
|
|
|
+ // ).finally(
|
|
|
+ // () => {
|
|
|
+ // this.isSaveLoading = false
|
|
|
+ // this.isListLoading = false
|
|
|
+ // }
|
|
|
+ // )
|
|
|
+ this.$api.room.RoomUpsert(this.classroomListShow[this.curClassIndex]).then(
|
|
|
+ res => {
|
|
|
+ if (res) {
|
|
|
+ if (res.error) {
|
|
|
+ this.classroomListShow[this.curClassIndex].option = option
|
|
|
+ this.$Message.error(res.v)
|
|
|
+ } else {
|
|
|
+ this.$Message.success(this.$t('schoolBaseInfo.csTips3'))
|
|
|
+ this.updated = false
|
|
|
+ this.updHiteachLink = []
|
|
|
+ if (option == 'insert') {
|
|
|
+ this.classroomListShow[this.curClassIndex].code = 'Class-' + this.classroomListShow[this.curClassIndex].code
|
|
|
+ this.classroomList.unshift(this.classroomListShow[this.curClassIndex])
|
|
|
+ this.$store.dispatch('user/addSchoolClasses', this.classroomListShow[this.curClassIndex]);
|
|
|
}
|
|
|
- },
|
|
|
- err => {
|
|
|
- this.$Message.error('API error!')
|
|
|
}
|
|
|
- ).finally(
|
|
|
- () => {
|
|
|
- this.isSaveLoading = false
|
|
|
- this.isListLoading = false
|
|
|
- }
|
|
|
- )
|
|
|
+ } else {
|
|
|
+ this.$Message.error('API error!')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ err => {
|
|
|
+ this.$Message.error('API error!')
|
|
|
}
|
|
|
- })
|
|
|
+ ).finally(
|
|
|
+ () => {
|
|
|
+ this.isSaveLoading = false
|
|
|
+ this.isListLoading = false
|
|
|
+ }
|
|
|
+ )
|
|
|
+ // }
|
|
|
+ // })
|
|
|
},
|
|
|
getClassroom() {
|
|
|
this.isListLoading = true
|
|
|
- this.$store.dispatch('user/getSchoolProfile').then(
|
|
|
- (res) => {
|
|
|
- if (res) {
|
|
|
- this.classroomList = res.school_classes
|
|
|
- this.schoolBase = res.school_base
|
|
|
- if (this.classroomList.length > 0) {
|
|
|
- this.updateBefore = JSON.stringify(this.classroomList[0])
|
|
|
- }
|
|
|
- this.filterClassname()
|
|
|
- // 預設搜尋給第一個
|
|
|
- // this.filterPeriod = res.school_base.period[0].id
|
|
|
- if (this.periods) this.filterPeriod = this.periods[0].id
|
|
|
- this.filterByPeriod()
|
|
|
- }
|
|
|
+ // this.$store.dispatch('user/getSchoolProfile').then(
|
|
|
+ // (res) => {
|
|
|
+ // if (res) {
|
|
|
+ // this.classroomList = res.school_classes
|
|
|
+ // this.schoolBase = res.school_base
|
|
|
+ // if (this.classroomList.length > 0) {
|
|
|
+ // this.updateBefore = JSON.stringify(this.classroomList[0])
|
|
|
+ // }
|
|
|
+ // this.filterClassname()
|
|
|
+ // // 預設搜尋給第一個
|
|
|
+ // // this.filterPeriod = res.school_base.period[0].id
|
|
|
+ // if (this.periods) this.filterPeriod = this.periods[0].id
|
|
|
+ // this.filterByPeriod()
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // (err) => {
|
|
|
+ // this.$Message.error('API error!')
|
|
|
+ // }
|
|
|
+ // ).finally(() => {
|
|
|
+ // setTimeout(() => {
|
|
|
+ // this.isListLoading = false
|
|
|
+ // }, 500)
|
|
|
+ // })
|
|
|
+ let requstData = {
|
|
|
+ code: this.$store.state.userInfo.schoolCode
|
|
|
+ }
|
|
|
+ this.$api.room.FindRoomList(requstData).then(
|
|
|
+ res => {
|
|
|
+ this.classroomList = res.rooms
|
|
|
+ this.classroomListShow = res.rooms
|
|
|
+ console.log(this.classroomListShow)
|
|
|
+ // this.schoolBase = res.school_base
|
|
|
+ // if (this.classroomList.length > 0) {
|
|
|
+ // this.updateBefore = JSON.stringify(this.classroomList[0])
|
|
|
+ // }
|
|
|
+ // this.filterClassname()
|
|
|
+ // // 預設搜尋給第一個
|
|
|
+ // if (this.periods) this.filterPeriod = this.periods[0].id
|
|
|
+ // this.filterByPeriod()
|
|
|
},
|
|
|
- (err) => {
|
|
|
- this.$Message.error('API error!')
|
|
|
+ err => {
|
|
|
+ console.log(err)
|
|
|
}
|
|
|
).finally(() => {
|
|
|
setTimeout(() => {
|
|
@@ -1141,55 +1220,78 @@ export default {
|
|
|
},
|
|
|
delClassroom(index) {
|
|
|
this.isListLoading = true
|
|
|
- if (this.classroomListShow[index].option !== 'insert') {
|
|
|
- this.$api.schoolSetting.delClassroom({
|
|
|
- id: this.classroomListShow[index].id,
|
|
|
- scope: this.classroomListShow[index].scope,
|
|
|
- school_code: this.$store.state.userInfo.schoolCode
|
|
|
- }).then(
|
|
|
- (res) => {
|
|
|
- if (res.error == null) {
|
|
|
- if (this.curClassIndex >= index && index > 0) {
|
|
|
- this.curClassIndex = 0
|
|
|
- this.updateBefore = JSON.stringify(this.classroomListShow[this.curClassIndex])
|
|
|
- }
|
|
|
- let originIndex = -1
|
|
|
- for (let i in this.classroomList) {
|
|
|
- if (this.classroomList[i].id == this.classroomListShow[index].id) {
|
|
|
- originIndex = i
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
- this.$api.schoolSetting.hiteachUnlinkByClassId({
|
|
|
- classId: this.classroomListShow[index].id,
|
|
|
- school_code: this.$store.state.userInfo.schoolCode
|
|
|
- })
|
|
|
- this.unlinkHiteachByClassId(this.classroomListShow[index].id) // 刪掉指定的classId
|
|
|
- this.$store.dispatch('user/delSchoolClasses', this.classroomListShow[index].id);
|
|
|
- this.classroomList.splice(originIndex, 1)
|
|
|
- this.classroomListShow.splice(index, 1)
|
|
|
- this.$Message.success(this.$t('schoolBaseInfo.csTips7'))
|
|
|
- this.updated = false
|
|
|
- this.updHiteachLink = []
|
|
|
+ // if (this.classroomListShow[index].option !== 'insert') {
|
|
|
+ // this.$api.schoolSetting.delClassroom({
|
|
|
+ // id: this.classroomListShow[index].id,
|
|
|
+ // scope: this.classroomListShow[index].scope,
|
|
|
+ // school_code: this.$store.state.userInfo.schoolCode
|
|
|
+ // }).then(
|
|
|
+ // (res) => {
|
|
|
+ // if (res.error == null) {
|
|
|
+ // if (this.curClassIndex >= index && index > 0) {
|
|
|
+ // this.curClassIndex = 0
|
|
|
+ // this.updateBefore = JSON.stringify(this.classroomListShow[this.curClassIndex])
|
|
|
+ // }
|
|
|
+ // let originIndex = -1
|
|
|
+ // for (let i in this.classroomList) {
|
|
|
+ // if (this.classroomList[i].id == this.classroomListShow[index].id) {
|
|
|
+ // originIndex = i
|
|
|
+ // break
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // this.$api.schoolSetting.hiteachUnlinkByClassId({
|
|
|
+ // classId: this.classroomListShow[index].id,
|
|
|
+ // school_code: this.$store.state.userInfo.schoolCode
|
|
|
+ // })
|
|
|
+ // this.unlinkHiteachByClassId(this.classroomListShow[index].id) // 刪掉指定的classId
|
|
|
+ // this.$store.dispatch('user/delSchoolClasses', this.classroomListShow[index].id);
|
|
|
+ // this.classroomList.splice(originIndex, 1)
|
|
|
+ // this.classroomListShow.splice(index, 1)
|
|
|
+ // this.$Message.success(this.$t('schoolBaseInfo.csTips7'))
|
|
|
+ // this.updated = false
|
|
|
+ // this.updHiteachLink = []
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // (err) => {
|
|
|
+ // this.$Message.error('API error!')
|
|
|
+ // }
|
|
|
+ // ).finally(() => {
|
|
|
+ // this.isListLoading = false
|
|
|
+ // })
|
|
|
+ // } else {
|
|
|
+ // if (this.curClassIndex >= index && index > 0) {
|
|
|
+ // this.curClassIndex = 0
|
|
|
+ // this.updateBefore = JSON.stringify(this.classroomListShow[this.curClassIndex])
|
|
|
+ // }
|
|
|
+ // this.classroomListShow.splice(index, 1)
|
|
|
+ // this.unlinkHiteachByClassId(this.classroomListShow[index].id)// 刪掉指定的classId
|
|
|
+ // this.isListLoading = false
|
|
|
+ // this.updated = false
|
|
|
+ // this.updHiteachLink = []
|
|
|
+ // }
|
|
|
+ let requestData = {
|
|
|
+ id: this.classroomListShow[index].id,
|
|
|
+ code: this.$store.state.userInfo.schoolCode
|
|
|
+ }
|
|
|
+ this.$api.room.DelRoom(requestData).then(
|
|
|
+ res => {
|
|
|
+ this.$Message.success(this.$t('schoolBaseInfo.csTips7'))
|
|
|
+ let originIndex = -1
|
|
|
+ for (let i in this.classroomList) {
|
|
|
+ if (this.classroomList[i].id == this.classroomListShow[index].id) {
|
|
|
+ originIndex = i
|
|
|
+ break
|
|
|
}
|
|
|
- },
|
|
|
- (err) => {
|
|
|
- this.$Message.error('API error!')
|
|
|
}
|
|
|
- ).finally(() => {
|
|
|
- this.isListLoading = false
|
|
|
- })
|
|
|
- } else {
|
|
|
- if (this.curClassIndex >= index && index > 0) {
|
|
|
- this.curClassIndex = 0
|
|
|
- this.updateBefore = JSON.stringify(this.classroomListShow[this.curClassIndex])
|
|
|
+ this.classroomList.splice(originIndex, 1)
|
|
|
+ this.classroomListShow.splice(index, 1)
|
|
|
+ },
|
|
|
+ err => {
|
|
|
+ this.$Message.error('API error!')
|
|
|
}
|
|
|
- this.classroomListShow.splice(index, 1)
|
|
|
- this.unlinkHiteachByClassId(this.classroomListShow[index].id)// 刪掉指定的classId
|
|
|
+ ).finally(() => {
|
|
|
this.isListLoading = false
|
|
|
- this.updated = false
|
|
|
- this.updHiteachLink = []
|
|
|
- }
|
|
|
+ })
|
|
|
},
|
|
|
uploadSchoolPlan(res, file) {
|
|
|
this.$Message.success(this.$t('schoolBaseInfo.csTips5'))
|
|
@@ -1250,32 +1352,55 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
addClassroom() {
|
|
|
- if (this.$access.can('admin.*|classroom-upd')) {
|
|
|
- this.keyword = ''
|
|
|
- this.classroomListShow.unshift({
|
|
|
- id: this.$jsFn.uuid(),
|
|
|
- name: this.$t('schoolBaseInfo.presetClassroomName') + (this.classroomList.length + 1),
|
|
|
- style: 'normal',
|
|
|
- sn: '',
|
|
|
- no: '',
|
|
|
- openType: '1',
|
|
|
- teacher: {
|
|
|
- id: '',
|
|
|
- name: ''
|
|
|
- },
|
|
|
- periodId: this.filterPeriod,
|
|
|
- gradeId: '',
|
|
|
- x: 20 * (this.classroomList.length % 5),
|
|
|
- y: 20 * (this.classroomList.length / 5).toFixed(0),
|
|
|
- scope: 'school',
|
|
|
- option: 'insert'
|
|
|
- })
|
|
|
- this.drawIcon(5, 6)
|
|
|
- this.curClassIndex = 0
|
|
|
- this.updateBefore = JSON.stringify(this.classroomListShow[this.curClassIndex])
|
|
|
- } else {
|
|
|
- this.$Message.warning(this.$t('schoolBaseInfo.authWarning'))
|
|
|
- }
|
|
|
+ // if (this.$access.can('admin.*|classroom-upd')) {
|
|
|
+ // this.keyword = ''
|
|
|
+ // this.classroomListShow.unshift({
|
|
|
+ // id: this.$jsFn.uuid(),
|
|
|
+ // name: this.$t('schoolBaseInfo.presetClassroomName') + (this.classroomList.length + 1),
|
|
|
+ // style: 'normal',
|
|
|
+ // sn: '',
|
|
|
+ // no: '',
|
|
|
+ // openType: '1',
|
|
|
+ // teacher: {
|
|
|
+ // id: '',
|
|
|
+ // name: ''
|
|
|
+ // },
|
|
|
+ // periodId: this.filterPeriod,
|
|
|
+ // gradeId: '',
|
|
|
+ // x: 20 * (this.classroomList.length % 5),
|
|
|
+ // y: 20 * (this.classroomList.length / 5).toFixed(0),
|
|
|
+ // scope: 'school',
|
|
|
+ // option: 'insert'
|
|
|
+ // })
|
|
|
+ // this.drawIcon(5, 6)
|
|
|
+ // this.curClassIndex = 0
|
|
|
+ // this.updateBefore = JSON.stringify(this.classroomListShow[this.curClassIndex])
|
|
|
+ // } else {
|
|
|
+ // this.$Message.warning(this.$t('schoolBaseInfo.authWarning'))
|
|
|
+ // }
|
|
|
+ this.addRoomStatus = true
|
|
|
+ },
|
|
|
+ confirmAddRoom() {
|
|
|
+ this.room.code = this.$store.state.userInfo.schoolCode
|
|
|
+ this.$api.room.RoomUpsert(this.room).then(
|
|
|
+ res => {
|
|
|
+ if (!res.error) {
|
|
|
+ this.$Message.success(this.$t('schoolBaseInfo.csTips3'))
|
|
|
+ this.classroomListShow.unshift(this._.cloneDeep(res.room))
|
|
|
+ console.log(this.classroomListShow)
|
|
|
+ } else {
|
|
|
+ this.$Message.error('API error!')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ err => {
|
|
|
+ this.$Message.error('API error!')
|
|
|
+ }
|
|
|
+ ).finally(
|
|
|
+ () => {
|
|
|
+ this.isSaveLoading = false
|
|
|
+ this.isListLoading = false
|
|
|
+ }
|
|
|
+ )
|
|
|
},
|
|
|
initHiteachData: async function () {
|
|
|
let temp;
|
|
@@ -1400,21 +1525,21 @@ export default {
|
|
|
this.orgHiteachData = JSON.stringify(orgHiData)
|
|
|
},
|
|
|
// 詢問視窗
|
|
|
- confirmLink: function(linkFlag, pid, uuid, uuid2, classId){
|
|
|
+ confirmLink: function (linkFlag, pid, uuid, uuid2, classId) {
|
|
|
let action = linkFlag ? 'unLink' : 'link';
|
|
|
- if(action == 'unLink'){
|
|
|
+ if (action == 'unLink') {
|
|
|
this.$Modal.confirm({
|
|
|
title: this.$t('schoolBaseInfo.deLink'),
|
|
|
content: `${this.$t('schoolBaseInfo.confirmDelink')}?`,
|
|
|
onOk: () => {
|
|
|
- this.executeHiteachLink(action, pid, uuid, uuid2, classId)
|
|
|
+ this.executeHiteachLink(action, pid, uuid, uuid2, classId)
|
|
|
}
|
|
|
})
|
|
|
} else {
|
|
|
this.executeHiteachLink(action, pid, uuid, uuid2, classId)
|
|
|
}
|
|
|
},
|
|
|
- executeHiteachLink: function(action, pid, uuid, uuid2, classId){
|
|
|
+ executeHiteachLink: function (action, pid, uuid, uuid2, classId) {
|
|
|
// Hiteach 與教室綁定
|
|
|
this.hiteachListLoading = true
|
|
|
this.$api.schoolSetting.hiteachLink({
|
|
@@ -1436,10 +1561,10 @@ export default {
|
|
|
})
|
|
|
temp.deviceBound.forEach((dbItem, dbIndex, dbArray) => {
|
|
|
if ((dbItem.uuid + dbItem.uuid2) == (uuid + uuid2)) {
|
|
|
- if(action == 'link'){
|
|
|
+ if (action == 'link') {
|
|
|
dbItem.classId = classId
|
|
|
dbItem.hiteachLink = true
|
|
|
- } else if(action == 'unLink'){
|
|
|
+ } else if (action == 'unLink') {
|
|
|
dbItem.classId = null
|
|
|
dbItem.hiteachLink = false
|
|
|
}
|
|
@@ -1447,19 +1572,19 @@ export default {
|
|
|
})
|
|
|
|
|
|
orgHiData[tempIndex] = temp
|
|
|
-
|
|
|
+
|
|
|
// 新增加
|
|
|
this.hiteachData = orgHiData
|
|
|
this.orgHiteachData = JSON.stringify(orgHiData)
|
|
|
- } else if (res.error == 1){
|
|
|
+ } else if (res.error == 1) {
|
|
|
this.$Message.error(this.$t('無法關聯已被關聯的Hiteach'))
|
|
|
}
|
|
|
},
|
|
|
- err => {
|
|
|
- this.$Message.error(this.$t('參數錯誤'))
|
|
|
- }).finally(()=>{
|
|
|
- this.hiteachListLoading = false
|
|
|
- })
|
|
|
+ err => {
|
|
|
+ this.$Message.error(this.$t('參數錯誤'))
|
|
|
+ }).finally(() => {
|
|
|
+ this.hiteachListLoading = false
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|