Browse Source

学期和编辑的的班级

liuyang 5 năm trước cách đây
mục cha
commit
7fc1ea1067

+ 10 - 27
frontend_web/src/views/course/components/courseInfoDialog.vue

@@ -32,11 +32,12 @@
       <el-form-item label="班级"
                     prop="title">
         <el-select v-model="course.Class"
-                   placeholder="请选择班级">
-          <el-option v-for="item in activitiesclass"
-                     :key="item.value"
-                     :label="item.label"
-                     :value="item.value">
+                   placeholder="请选择班级"
+                   filterable="true">
+          <el-option v-for="item in classList"
+                     :key="item.Id"
+                     :label="item.Name"
+                     :value="item.Id">
           </el-option>
         </el-select>
       </el-form-item>
@@ -44,7 +45,7 @@
                     prop="title">
         <el-select v-model="course.Term">
           <el-option v-for="item in term"
-                     :key="item.ItemName"
+                     :key="item.ItemValue"
                      :label="item.ItemName"
                      :value="item.ItemValue">
           </el-option>
@@ -72,19 +73,18 @@
 <script>
 
 import CourseApi from '@/api/course'
-import ClassApi from '@/api/class'
 import itemDetailApi from '@/api/sysadmin/itemdetail'
 
 export default {
   name: 'courseInfoDialog',
   props: {
     courseId: Number,
-    statusList: Array
+    statusList: Array,
+    term: Array,
+    classList: Array
   },
   data () {
     return {
-      term: [],
-      activitiesclass: [],
       years: [],
       checkAll: false,
       dialogvisible: false,
@@ -96,8 +96,6 @@ export default {
     var myDate = new Date()
     var year = myDate.getFullYear()// 获取当前年
     this.initSelectYear(year)
-    this.initDatas_class()
-    this.getTerm()
     this.getData()
   },
   methods: {
@@ -112,19 +110,6 @@ export default {
           console.error(err)
         })
     },
-    // class
-    initDatas_class () {
-      let params = {
-        _currentPage: this.currpage,
-        _size: this.size
-      }
-      ClassApi.getAllClass(params)
-        .then(res => {
-          for (let i = 0; i < res.records.length; i++) {
-            this.activitiesclass.push({ value: (res.records[i].Id), label: (res.records[i].Year + '_' + res.records[i].Name) })
-          }
-        })
-    },
     initSelectYear (year) {
       this.years = []
       for (let i = 0; i < 30; i++) {
@@ -133,13 +118,11 @@ export default {
     },
     dialogOpen () {
       this.course = {}
-      console.log('courseId:' + this.courseId)
       this.$refs.courseForm.resetFields()
       this.getData()
     },
     dialogClose () {
       this.course = {}
-      console.log('courseId:' + this.courseId)
       this.$refs.courseForm.resetFields()
       this.$emit('handleClose')
       this.dialogVisible = false

+ 40 - 26
frontend_web/src/views/course/index.vue

@@ -88,7 +88,9 @@
                        label="学期"
                        align="center"
                        min-width="160px"
-                       show-overflow-tooltip></el-table-column>
+                       show-overflow-tooltip
+                       :formatter="formatTerm"
+      ></el-table-column>
       <el-table-column prop="Title"
                        label="标题"
                        align="center"
@@ -124,6 +126,8 @@
                       @handleClose="handleClose"
                       :courseId="courseId"
                       :statusList="statusList"
+                      :term="term"
+                      :classList="classList"
                       width="75"></courseInfoDialog>
     <!-- </div> -->
     <template slot="footer">
@@ -159,12 +163,13 @@ export default {
       courseId: -1,
       classList: [], // 班级列表
       statusList: [], // 状态列表
+      term: [], // 学期
       search: {
         Term: '',
         Year: '',
         Title: '',
         CourseWeek: '',
-        status: -1,
+        status: 0,
         content: '',
         page: {
           total: 0,
@@ -172,19 +177,6 @@ export default {
           size: 10
         }
       },
-      status: [{
-        key: '全部',
-        value: -1
-      },
-      {
-        key: '草稿',
-        value: 0
-      },
-      {
-        key: '已发布',
-        value: 1
-      }
-      ],
       // 列表排序
       Column: {
         Order: '',
@@ -193,16 +185,9 @@ export default {
     }
   },
   mounted () {
-    let _this = this
+    this.getTerm()
+    this.getStatus()
     this.initDatas()
-    itemDetailApi.getItemDetailByItemCode({ ItemCode: 'PublishStatus' })
-      .then(res => {
-        _this.statusList = res
-        this.initDatas()
-      })
-      .catch(err => {
-        console.error(err)
-      })
   },
   methods: {
     // 匹配状态
@@ -221,6 +206,36 @@ export default {
         }
       }
     },
+    // 获取学期
+    getTerm () {
+      itemDetailApi.getItemDetailByItemCode({ ItemCode: 'Term' })
+        .then(res => {
+          this.term = res
+        })
+        .catch(err => {
+          console.error(err)
+        })
+    },
+    // 匹配学期
+    formatTerm (row, column) {
+      for (var i = 0; i < this.term.length; i++) {
+        if (parseInt(this.term[i].ItemValue) === parseInt(row.Term)) {
+          return this.term[i].ItemName
+        }
+      }
+    },
+    // 发布状态
+    getStatus () {
+      let _this = this
+      itemDetailApi.getItemDetailByItemCode({ ItemCode: 'PublishStatus' })
+        .then(res => {
+          _this.statusList = res
+          this.initDatas()
+        })
+        .catch(err => {
+          console.error(err)
+        })
+    },
     initSearchInfo () {
       this.search = {
         Title: '',
@@ -238,7 +253,6 @@ export default {
     },
     // 打开 添加弹窗
     openinformationadd () {
-
       this.$refs.courseDialog.dialogvisible = true
     },
     // 打开 编辑弹窗
@@ -259,12 +273,12 @@ export default {
     },
     // 初始化列表数据
     initDatas () {
+      this.getClassList()
       CourseApi.getPageList(this.search)
         .then(res => {
           this.activities = res.records
           this.search.page = res
         })
-      this.getClassList()
     },
     handleSizeChange (val) {
       this.search.page.size = val