| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328 |
- <template>
- <el-dialog title="课程详情"
- :visible.sync="dialogvisible"
- @opened="dialogOpen"
- @closed="dialogClose"
- width="75%">
- <el-form label-width="100px">
- <el-row :gutter="20">
- <el-col :span="6">
- <el-form-item label="标题"
- label-width="120px">
- {{courselist.Title}}
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="学年"
- label-width="120px">
- {{courselist.Year}}年
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="学期"
- label-width="120px">
- {{this.termName}}
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="班级"
- label-width="120px">
- {{this.className}}
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <el-table ref="multipleTable"
- :data="activities"
- border
- fit
- tooltip-effect="dark"
- style="width: 100%"
- height="300px">
- <el-table-column prop="CourseName"
- align="center"
- min-width="120px"
- label="课程名称"
- show-overflow-tooltip></el-table-column>
- <el-table-column prop="Teacher"
- align="center"
- min-width="120px"
- label="授课老师"
- show-overflow-tooltip
- :formatter="teacherFormatter"></el-table-column>
- <el-table-column prop="Local"
- align="center"
- min-width="120px"
- label="实验地点"
- show-overflow-tooltip
- :formatter="localFormatter"></el-table-column>
- <el-table-column prop="Num"
- align="center"
- min-width="80px"
- label="人数"
- show-overflow-tooltip></el-table-column>
- <el-table-column prop="DayOfWeek"
- align="center"
- min-width="180px"
- :formatter="dayOfWeekFormatter"
- label="周次"></el-table-column>
- <el-table-column prop="Section"
- align="center"
- min-width="180px"
- label="节次"></el-table-column>
- </el-table>
- <template slot="footer">
- <el-pagination style="margin: -10px;"
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :current-page="page.current"
- :page-size="page.size"
- :total="page.total"
- :page-sizes="[10, 20]"
- layout="total, sizes, prev, pager, next, jumper">
- </el-pagination>
- </template>
- </el-dialog>
- </template>
- <script>
- import ClassApi from '@/api/class'
- import detailApi from '@/api/course/detail'
- import itemDetailApi from '@/api/sysadmin/itemdetail'
- import { searchmanagingroomdata } from '@/api/instrumentroom'
- export default {
- name: 'informationDialog',
- props: {
- courselist: { // 当前样本存在位置
- type: Array
- }
- },
- data () {
- return {
- page: {
- current: 1,
- size: 10,
- total: 1
- },
- sort: {
- prop: '',
- order: ''
- },
- TimeList: [], // 节次
- RoomList: [],
- className: [], // 班级名称
- DayOfWeekList: [], // 周次列表
- TeacherList: [],
- termName: '',
- activities: [],
- dialogvisible: false,
- information: {},
- rulesinformationForm: {
- title: [{
- required: true,
- message: '请输入信息标题',
- trigger: 'blur'
- }],
- content: [{
- required: true,
- message: '请输入信息内容',
- trigger: 'blur'
- }]
- }
- }
- },
- created () {
- this.getTimeList()
- },
- methods: {
- dialogOpen () {
- this.information = {}
- // this.$refs.informationForm.resetFields()
- this.getData()
- },
- dialogClose () {
- this.activities = []
- // this.$refs.informationForm.resetFields()
- // this.$emit('handleClose')
- this.dialogVisible = false
- },
- // 分页-改变分页大小
- handleSizeChange (value) {
- this.page.size = value
- this.page.current = 1
- this.getData()
- },
- // 分页-改变当前页
- handleCurrentChange (value) {
- this.page.current = value
- this.getData()
- },
- // 获取实验室地点
- getRoomList () {
- let _this = this
- let params = {
- _currentPage: 1,
- _size: 9999
- }
- if (params !== '') {
- _this.loading = true
- searchmanagingroomdata(params)
- .then(res => {
- _this.loading = false
- this.RoomList = res.info.items
- })
- .catch(function (error) {
- console.log(error)
- })
- } else {
- _this.RoomList = []
- }
- },
- // 获取班级列表
- getClassList () {
- let params = {
- _currentPage: 1,
- _size: 9999
- }
- ClassApi.getAllClass(params)
- .then(res => {
- this.getClassName(res.records)
- })
- },
- // 获取教师列表
- getTeacherList (query) {
- let _this = this
- if (query !== '') {
- _this.loading = true
- itemDetailApi.getItemDetailByItemCode({ ItemCode: 'Teacher' })
- .then(res => {
- _this.loading = false
- this.TeacherList = res
- })
- .catch(err => {
- console.error(err)
- })
- } else {
- _this.TeacherList = []
- }
- },
- // 周次
- getDayOfWeekList () {
- itemDetailApi.getItemDetailByItemCode({ ItemCode: 'DayOfWeek' })
- .then(res => {
- this.DayOfWeekList = res
- })
- .catch(err => {
- console.error(err)
- })
- },
- // 授课老师
- teacherFormatter (row, column) {
- for (var i = 0; i < this.TeacherList.length; i++) {
- if (parseInt(this.TeacherList[i].ItemValue) === row.Teacher) {
- return this.TeacherList[i].ItemName
- }
- }
- },
- // 实验地点
- localFormatter (row, column) {
- for (var i = 0; i < this.RoomList.length; i++) {
- if (parseInt(this.RoomList[i].Id) === row.Local) {
- return this.RoomList[i].RoomName
- }
- }
- },
- // 周次
- dayOfWeekFormatter (row, column) {
- for (var i = 0; i < this.DayOfWeekList.length; i++) {
- if (parseInt(this.DayOfWeekList[i].ItemValue) === row.DayOfWeek) {
- return this.DayOfWeekList[i].ItemName
- }
- }
- },
- // 获取课程节次列表
- getTimeList (query) {
- let _this = this
- if (query !== '') {
- itemDetailApi.getItemDetailByItemCode({ ItemCode: 'Time' })
- .then(res => {
- _this.TimeList = res
- })
- .catch(err => {
- console.error(err)
- })
- } else {
- _this.TimeList = []
- }
- },
- // 获取学期名称
- getTermName (termList) {
- let _this = this
- termList.forEach(function (value, key) {
- if (_this.courselist.Term == value.ItemValue) {
- _this.termName = value.ItemName
- }
- })
- },
- // 获取学期
- getTerm () {
- itemDetailApi.getItemDetailByItemCode({ ItemCode: 'Term' })
- .then(res => {
- this.getTermName(res)
- })
- .catch(err => {
- console.error(err)
- })
- },
- // 获取学期名称
- getClassName (termList) {
- let _this = this
- termList.forEach(function (value, key) {
- if (_this.courselist.ClassId === value.Id) {
- _this.className = value.Name
- }
- })
- },
- getData () {
- this.getTeacherList()
- this.getRoomList()
- this.getTerm()
- this.getClassList()
- this.getDayOfWeekList()
- let _this = this
- let query = {
- // 分页信息
- size: this.page.size,
- current: this.page.current,
- CourseId: this.courselist.CourseId // 课程ID
- }
- detailApi.getList(query)
- .then(res => {
- _this.activities = res.records ? res.records : []
- for (var i = 0; i < _this.activities.length; i++) {
- _this.activities[i].Section = ''
- if (_this.activities[i].Time != '') {
- var section = _this.activities[i].Time.split(",")
- for (var a = 0; a < _this.TimeList.length; a++) {
- if (section.indexOf(_this.TimeList[a].ItemValue) > -1) {
- if (_this.activities[i].Section === '') {
- _this.activities[i].Section = _this.TimeList[a].ItemName
- } else {
- _this.activities[i].Section = _this.activities[i].Section + ',' + _this.TimeList[a].ItemName
- }
- }
- }
- }
- }
- _this.page.current = res.current
- _this.page.size = res.size
- _this.page.total = res.total
- })
- .catch(err => {
- console.error(err)
- })
- }
- }
- }
- </script>
|