courseInfoDialog.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <template>
  2. <el-dialog title="新增课程表信息"
  3. :visible.sync="dialogvisible"
  4. @opened="dialogOpen"
  5. @closed="dialogClose"
  6. width="65%">
  7. <el-form size="mini"
  8. :model="course"
  9. label-width="100px"
  10. ref="courseForm">
  11. <el-row :gutter="24"
  12. class="donorsaddformcss">
  13. <el-col :span="6">
  14. <el-form-item label="学年"
  15. prop="content">
  16. <el-input v-model="course.Year"
  17. placeholder="请输入"></el-input>
  18. </el-form-item>
  19. </el-col>
  20. <el-col :span="6">
  21. <el-form-item label="班级"
  22. prop="title">
  23. <el-input v-model="course.Class"
  24. placeholder="请输入"></el-input>
  25. </el-form-item>
  26. </el-col>
  27. <el-col :span="6">
  28. <el-form-item label="学期"
  29. prop="title">
  30. <el-input v-model="course.Term"
  31. placeholder="请输入"></el-input>
  32. </el-form-item>
  33. </el-col>
  34. </el-row>
  35. </el-form>
  36. <el-table ref="multipleTable"
  37. :data="activities"
  38. border
  39. fit
  40. tooltip-effect="dark"
  41. style="width: 100%"
  42. @sort-change="orderby"
  43. height="100%">
  44. <el-table-column prop="title"
  45. fit
  46. min-width="80px"
  47. label="教学周"
  48. align="center"
  49. show-overflow-tooltip></el-table-column>
  50. <el-table-column prop="content"
  51. label="周次"
  52. align="center"
  53. min-width="160px"
  54. show-overflow-tooltip></el-table-column>
  55. <el-table-column prop="content"
  56. label="节次"
  57. align="center"
  58. min-width="160px"
  59. show-overflow-tooltip></el-table-column>
  60. <el-table-column prop="content"
  61. label="实验课程名称"
  62. align="center"
  63. min-width="160px"
  64. show-overflow-tooltip></el-table-column>
  65. <el-table-column prop="status"
  66. align="center"
  67. min-width="40px"
  68. label="学分"
  69. show-overflow-tooltip
  70. :formatter="formatStatus"></el-table-column>
  71. <el-table-column prop="createdtime"
  72. align="center"
  73. min-width="120px"
  74. label="授课老师"
  75. show-overflow-tooltip></el-table-column>
  76. <el-table-column prop="createdtime"
  77. align="center"
  78. min-width="120px"
  79. label="人数"
  80. show-overflow-tooltip></el-table-column>
  81. <el-table-column prop="createdtime"
  82. align="center"
  83. min-width="120px"
  84. label="实验地点"
  85. show-overflow-tooltip></el-table-column>
  86. </el-table>
  87. <span slot="footer">
  88. <el-button size="mini"
  89. @click="save(0)">保存</el-button>
  90. <el-button size="mini"
  91. @click="dialogClose">关闭</el-button>
  92. </span>
  93. </el-dialog>
  94. </template>
  95. <script>
  96. import CourseApi from '@/api/course'
  97. export default {
  98. name: 'courseInfoDialog',
  99. props: {
  100. informationId: Number
  101. },
  102. data () {
  103. return {
  104. dialogvisible: false,
  105. course: {
  106. CourseId: '',
  107. Year: '',
  108. Term: '',
  109. CourseName: '',
  110. Teacher: '',
  111. Local: '',
  112. Class: '',
  113. Mark: '',
  114. Num: '',
  115. WeekTitle: '',
  116. DayOfWeek: '',
  117. Time: '',
  118. Status: ''
  119. },
  120. }
  121. },
  122. created () {
  123. this.getData()
  124. },
  125. methods: {
  126. dialogOpen () {
  127. this.course = {}
  128. console.log("informationId:" + this.informationId)
  129. this.$refs.courseForm.resetFields()
  130. this.getData()
  131. },
  132. dialogClose () {
  133. this.course = {}
  134. console.log("informationId:" + this.informationId)
  135. this.$refs.courseForm.resetFields()
  136. this.$emit('handleClose')
  137. this.dialogVisible = false
  138. },
  139. save (flag) {
  140. this.$refs.courseForm.validate(valid => {
  141. if (valid) {
  142. this.course.status = flag
  143. InformationApi.save(this.course, {})
  144. .then(res => {
  145. this.$emit('handleClose')
  146. this.dialogvisible = false
  147. })
  148. .catch(err => {
  149. // handle error
  150. console.error(err)
  151. })
  152. } else {
  153. console.log("error submit!!");
  154. return false;
  155. }
  156. });
  157. },
  158. getData () {
  159. if (this.informationId > 0) {
  160. var id = {
  161. id: this.informationId
  162. }
  163. InformationApi.getById(id)
  164. .then(res => {
  165. this.course = res
  166. })
  167. }
  168. }
  169. }
  170. }
  171. </script>
  172. <style lang="scss">
  173. .button {
  174. padding: 0;
  175. float: right;
  176. }
  177. .donorsaddformcss .el-col-8 {
  178. height: 58px;
  179. }
  180. </style>