courseInfoDialog.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <el-dialog title="课程详情"
  3. :visible.sync="dialogvisible"
  4. @opened="dialogOpen"
  5. @closed="dialogClose"
  6. width="75%">
  7. <!-- <el-form size="mini"
  8. :model="information"
  9. :rules="rulesinformationForm"
  10. label-width="100px"
  11. ref="informationForm">
  12. <el-row :gutter="24">
  13. <el-col :span="24">
  14. <el-form-item label="信息标题222"
  15. label-width="120px">
  16. <el-input v-model="information.title"
  17. :disabled="true"
  18. style="width:100%;font-size:20px"></el-input>
  19. </el-form-item>
  20. </el-col>
  21. <el-col :span="24">
  22. <el-form-item label="2333"
  23. label-width="120px">
  24. <el-input v-model="information.content"
  25. type="textarea"
  26. :rows=3
  27. :disabled="true"
  28. style="width:100%;font-size:20px"></el-input>
  29. </el-form-item>
  30. </el-col>
  31. </el-row>
  32. </el-form> -->
  33. <el-table ref="multipleTable"
  34. :data="activities"
  35. border
  36. fit
  37. tooltip-effect="dark"
  38. style="width: 100%"
  39. height="100%">
  40. <el-table-column prop="CourseName"
  41. align="center"
  42. min-width="120px"
  43. label="课程名称"
  44. show-overflow-tooltip></el-table-column>
  45. <el-table-column prop="Teacher"
  46. align="center"
  47. min-width="120px"
  48. label="授课老师"
  49. show-overflow-tooltip
  50. :formatter="teacherFormatter"></el-table-column>
  51. <el-table-column prop="Local"
  52. align="center"
  53. min-width="120px"
  54. label="实验地点"
  55. show-overflow-tooltip
  56. :formatter="localFormatter"></el-table-column>
  57. <el-table-column prop="Num"
  58. align="center"
  59. min-width="120px"
  60. label="人数"
  61. show-overflow-tooltip></el-table-column>
  62. <el-table-column prop="CreatedTime"
  63. align="center"
  64. min-width="120px"
  65. label="创建时间"
  66. show-overflow-tooltip></el-table-column>
  67. </el-table>
  68. <template slot="footer">
  69. <el-pagination style="margin: -10px;"
  70. @size-change="handleSizeChange"
  71. @current-change="handleCurrentChange"
  72. :current-page="page.current"
  73. :page-size="page.size"
  74. :total="page.total"
  75. :page-sizes="[10, 20]"
  76. layout="total, sizes, prev, pager, next, jumper">
  77. </el-pagination>
  78. </template>
  79. </el-dialog>
  80. </template>
  81. <script>
  82. import detailApi from '@/api/course/detail'
  83. import itemDetailApi from '@/api/sysadmin/itemdetail'
  84. import { searchmanagingroomdata } from '@/api/instrumentroom'
  85. export default {
  86. name: 'informationDialog',
  87. props: {
  88. courselist: { // 当前样本存在位置
  89. type: Array
  90. },
  91. },
  92. data () {
  93. return {
  94. page: {
  95. current: 1,
  96. size: 10,
  97. total: 1
  98. },
  99. sort: {
  100. prop: '',
  101. order: ''
  102. },
  103. RoomList: [],
  104. TeacherList: [],
  105. activities: [],
  106. dialogvisible: false,
  107. information: {},
  108. rulesinformationForm: {
  109. title: [{
  110. required: true,
  111. message: '请输入信息标题',
  112. trigger: 'blur'
  113. }],
  114. content: [{
  115. required: true,
  116. message: '请输入信息内容',
  117. trigger: 'blur'
  118. }]
  119. }
  120. }
  121. },
  122. created () {
  123. this.getData()
  124. },
  125. methods: {
  126. dialogOpen () {
  127. this.information = {}
  128. // this.$refs.informationForm.resetFields()
  129. this.getData()
  130. },
  131. dialogClose () {
  132. this.information = {}
  133. // this.$refs.informationForm.resetFields()
  134. // this.$emit('handleClose')
  135. this.dialogVisible = false
  136. },
  137. // 分页-改变分页大小
  138. handleSizeChange (value) {
  139. this.page.size = value
  140. this.page.current = 1
  141. this.getData()
  142. },
  143. // 分页-改变当前页
  144. handleCurrentChange (value) {
  145. this.page.current = value
  146. this.getData()
  147. },
  148. // 获取实验室地点
  149. getRoomList () {
  150. let _this = this
  151. let params = {
  152. _currentPage: 1,
  153. _size: 9999
  154. }
  155. if (params !== '') {
  156. _this.loading = true
  157. searchmanagingroomdata(params)
  158. .then(res => {
  159. _this.loading = false
  160. this.RoomList = res.info.items
  161. })
  162. .catch(function (error) {
  163. console.log(error)
  164. })
  165. } else {
  166. _this.RoomList = []
  167. }
  168. },
  169. // 获取教师列表
  170. getTeacherList (query) {
  171. let _this = this
  172. if (query !== '') {
  173. _this.loading = true
  174. itemDetailApi.getItemDetailByItemCode({ ItemCode: 'Teacher' })
  175. .then(res => {
  176. _this.loading = false
  177. this.TeacherList = res
  178. })
  179. .catch(err => {
  180. console.error(err)
  181. })
  182. } else {
  183. _this.TeacherList = []
  184. }
  185. },
  186. // 授课老师
  187. teacherFormatter (row, column) {
  188. for (var i = 0; i < this.TeacherList.length; i++) {
  189. if (parseInt(this.TeacherList[i].ItemValue) === row.Teacher) {
  190. return this.TeacherList[i].ItemName
  191. }
  192. }
  193. },
  194. // 实验地点
  195. localFormatter (row, column) {
  196. for (var i = 0; i < this.RoomList.length; i++) {
  197. if (parseInt(this.RoomList[i].Id) === row.Local) {
  198. return this.RoomList[i].RoomName
  199. }
  200. }
  201. },
  202. getData () {
  203. this.getTeacherList()
  204. this.getRoomList()
  205. let _this = this
  206. let query = {
  207. // 分页信息
  208. size: this.page.size,
  209. current: this.page.current,
  210. CourseId: this.courselist.CourseId // 课程ID
  211. }
  212. detailApi.getList(query)
  213. .then(res => {
  214. _this.activities = res.records ? res.records : []
  215. _this.page.current = res.current
  216. _this.page.size = res.size
  217. _this.page.total = res.total
  218. })
  219. .catch(err => {
  220. console.error(err)
  221. })
  222. }
  223. }
  224. }
  225. </script>