courseInfoDialog.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <template>
  2. <el-dialog title="课程详情"
  3. :visible.sync="dialogvisible"
  4. @opened="dialogOpen"
  5. @closed="dialogClose"
  6. width="75%">
  7. <el-form label-width="100px">
  8. <el-row :gutter="20">
  9. <el-col :span="6">
  10. <el-form-item label="标题"
  11. label-width="120px">
  12. {{courselist.Title}}
  13. </el-form-item>
  14. </el-col>
  15. <el-col :span="6">
  16. <el-form-item label="学年"
  17. label-width="120px">
  18. {{courselist.Year}}年
  19. </el-form-item>
  20. </el-col>
  21. <el-col :span="6">
  22. <el-form-item label="学期"
  23. label-width="120px">
  24. {{this.termName}}
  25. </el-form-item>
  26. </el-col>
  27. <el-col :span="6">
  28. <el-form-item label="班级"
  29. label-width="120px">
  30. {{this.className}}
  31. </el-form-item>
  32. </el-col>
  33. </el-row>
  34. </el-form>
  35. <el-table ref="multipleTable"
  36. :data="activities"
  37. border
  38. fit
  39. tooltip-effect="dark"
  40. style="width: 100%"
  41. height="300px">
  42. <el-table-column prop="CourseName"
  43. align="center"
  44. min-width="120px"
  45. label="课程名称"
  46. show-overflow-tooltip></el-table-column>
  47. <el-table-column prop="Teacher"
  48. align="center"
  49. min-width="120px"
  50. label="授课老师"
  51. show-overflow-tooltip
  52. :formatter="teacherFormatter"></el-table-column>
  53. <el-table-column prop="Local"
  54. align="center"
  55. min-width="120px"
  56. label="实验地点"
  57. show-overflow-tooltip
  58. :formatter="localFormatter"></el-table-column>
  59. <el-table-column prop="Num"
  60. align="center"
  61. min-width="80px"
  62. label="人数"
  63. show-overflow-tooltip></el-table-column>
  64. <el-table-column prop="DayOfWeek"
  65. align="center"
  66. min-width="180px"
  67. :formatter="dayOfWeekFormatter"
  68. label="周次"></el-table-column>
  69. <el-table-column prop="Section"
  70. align="center"
  71. min-width="180px"
  72. label="节次"></el-table-column>
  73. </el-table>
  74. <template slot="footer">
  75. <el-pagination style="margin: -10px;"
  76. @size-change="handleSizeChange"
  77. @current-change="handleCurrentChange"
  78. :current-page="page.current"
  79. :page-size="page.size"
  80. :total="page.total"
  81. :page-sizes="[10, 20]"
  82. layout="total, sizes, prev, pager, next, jumper">
  83. </el-pagination>
  84. </template>
  85. </el-dialog>
  86. </template>
  87. <script>
  88. import ClassApi from '@/api/class'
  89. import detailApi from '@/api/course/detail'
  90. import itemDetailApi from '@/api/sysadmin/itemdetail'
  91. import { searchmanagingroomdata } from '@/api/instrumentroom'
  92. export default {
  93. name: 'informationDialog',
  94. props: {
  95. courselist: { // 当前样本存在位置
  96. type: Array
  97. }
  98. },
  99. data () {
  100. return {
  101. page: {
  102. current: 1,
  103. size: 10,
  104. total: 1
  105. },
  106. sort: {
  107. prop: '',
  108. order: ''
  109. },
  110. TimeList: [], // 节次
  111. RoomList: [],
  112. className: [], // 班级名称
  113. DayOfWeekList: [], // 周次列表
  114. TeacherList: [],
  115. termName: '',
  116. activities: [],
  117. dialogvisible: false,
  118. information: {},
  119. rulesinformationForm: {
  120. title: [{
  121. required: true,
  122. message: '请输入信息标题',
  123. trigger: 'blur'
  124. }],
  125. content: [{
  126. required: true,
  127. message: '请输入信息内容',
  128. trigger: 'blur'
  129. }]
  130. }
  131. }
  132. },
  133. created () {
  134. this.getTimeList()
  135. },
  136. methods: {
  137. dialogOpen () {
  138. this.information = {}
  139. // this.$refs.informationForm.resetFields()
  140. this.getData()
  141. },
  142. dialogClose () {
  143. this.activities = []
  144. // this.$refs.informationForm.resetFields()
  145. // this.$emit('handleClose')
  146. this.dialogVisible = false
  147. },
  148. // 分页-改变分页大小
  149. handleSizeChange (value) {
  150. this.page.size = value
  151. this.page.current = 1
  152. this.getData()
  153. },
  154. // 分页-改变当前页
  155. handleCurrentChange (value) {
  156. this.page.current = value
  157. this.getData()
  158. },
  159. // 获取实验室地点
  160. getRoomList () {
  161. let _this = this
  162. let params = {
  163. _currentPage: 1,
  164. _size: 9999
  165. }
  166. if (params !== '') {
  167. _this.loading = true
  168. searchmanagingroomdata(params)
  169. .then(res => {
  170. _this.loading = false
  171. this.RoomList = res.info.items
  172. })
  173. .catch(function (error) {
  174. console.log(error)
  175. })
  176. } else {
  177. _this.RoomList = []
  178. }
  179. },
  180. // 获取班级列表
  181. getClassList () {
  182. let params = {
  183. _currentPage: 1,
  184. _size: 9999
  185. }
  186. ClassApi.getAllClass(params)
  187. .then(res => {
  188. this.getClassName(res.records)
  189. })
  190. },
  191. // 获取教师列表
  192. getTeacherList (query) {
  193. let _this = this
  194. if (query !== '') {
  195. _this.loading = true
  196. itemDetailApi.getItemDetailByItemCode({ ItemCode: 'Teacher' })
  197. .then(res => {
  198. _this.loading = false
  199. this.TeacherList = res
  200. })
  201. .catch(err => {
  202. console.error(err)
  203. })
  204. } else {
  205. _this.TeacherList = []
  206. }
  207. },
  208. // 周次
  209. getDayOfWeekList () {
  210. itemDetailApi.getItemDetailByItemCode({ ItemCode: 'DayOfWeek' })
  211. .then(res => {
  212. this.DayOfWeekList = res
  213. })
  214. .catch(err => {
  215. console.error(err)
  216. })
  217. },
  218. // 授课老师
  219. teacherFormatter (row, column) {
  220. for (var i = 0; i < this.TeacherList.length; i++) {
  221. if (parseInt(this.TeacherList[i].ItemValue) === row.Teacher) {
  222. return this.TeacherList[i].ItemName
  223. }
  224. }
  225. },
  226. // 实验地点
  227. localFormatter (row, column) {
  228. for (var i = 0; i < this.RoomList.length; i++) {
  229. if (parseInt(this.RoomList[i].Id) === row.Local) {
  230. return this.RoomList[i].RoomName
  231. }
  232. }
  233. },
  234. // 周次
  235. dayOfWeekFormatter (row, column) {
  236. for (var i = 0; i < this.DayOfWeekList.length; i++) {
  237. if (parseInt(this.DayOfWeekList[i].ItemValue) === row.DayOfWeek) {
  238. return this.DayOfWeekList[i].ItemName
  239. }
  240. }
  241. },
  242. // 获取课程节次列表
  243. getTimeList (query) {
  244. let _this = this
  245. if (query !== '') {
  246. itemDetailApi.getItemDetailByItemCode({ ItemCode: 'Time' })
  247. .then(res => {
  248. _this.TimeList = res
  249. })
  250. .catch(err => {
  251. console.error(err)
  252. })
  253. } else {
  254. _this.TimeList = []
  255. }
  256. },
  257. // 获取学期名称
  258. getTermName (termList) {
  259. let _this = this
  260. termList.forEach(function (value, key) {
  261. if (_this.courselist.Term == value.ItemValue) {
  262. _this.termName = value.ItemName
  263. }
  264. })
  265. },
  266. // 获取学期
  267. getTerm () {
  268. itemDetailApi.getItemDetailByItemCode({ ItemCode: 'Term' })
  269. .then(res => {
  270. this.getTermName(res)
  271. })
  272. .catch(err => {
  273. console.error(err)
  274. })
  275. },
  276. // 获取学期名称
  277. getClassName (termList) {
  278. let _this = this
  279. termList.forEach(function (value, key) {
  280. if (_this.courselist.ClassId === value.Id) {
  281. _this.className = value.Name
  282. }
  283. })
  284. },
  285. getData () {
  286. this.getTeacherList()
  287. this.getRoomList()
  288. this.getTerm()
  289. this.getClassList()
  290. this.getDayOfWeekList()
  291. let _this = this
  292. let query = {
  293. // 分页信息
  294. size: this.page.size,
  295. current: this.page.current,
  296. CourseId: this.courselist.CourseId // 课程ID
  297. }
  298. detailApi.getList(query)
  299. .then(res => {
  300. _this.activities = res.records ? res.records : []
  301. for (var i = 0; i < _this.activities.length; i++) {
  302. _this.activities[i].Section = ''
  303. if (_this.activities[i].Time != '') {
  304. var section = _this.activities[i].Time.split(",")
  305. for (var a = 0; a < _this.TimeList.length; a++) {
  306. if (section.indexOf(_this.TimeList[a].ItemValue) > -1) {
  307. if (_this.activities[i].Section === '') {
  308. _this.activities[i].Section = _this.TimeList[a].ItemName
  309. } else {
  310. _this.activities[i].Section = _this.activities[i].Section + ',' + _this.TimeList[a].ItemName
  311. }
  312. }
  313. }
  314. }
  315. }
  316. _this.page.current = res.current
  317. _this.page.size = res.size
  318. _this.page.total = res.total
  319. })
  320. .catch(err => {
  321. console.error(err)
  322. })
  323. }
  324. }
  325. }
  326. </script>