Forráskód Böngészése

课程首页的发布状态

liuyang 5 éve
szülő
commit
6830219139

+ 5 - 6
frontend_web/src/views/course/components/courseInfoDialog.vue

@@ -51,11 +51,10 @@
         </el-select>
       </el-form-item>
       <el-form-item label="状态">
-        <el-radio-group v-model="course.Status">
-          <el-radio class="radio"
-                    label="1">发布</el-radio>
+        <el-radio-group v-model="course.Status" v-for="item in statusList">
+
           <el-radio class="radio"
-                    label="0">草稿</el-radio>
+                    :label="item.ItemValue">{{item.ItemName}}</el-radio>
         </el-radio-group>
       </el-form-item>
     </el-form>
@@ -79,7 +78,8 @@ import itemDetailApi from '@/api/sysadmin/itemdetail'
 export default {
   name: 'courseInfoDialog',
   props: {
-    courseId: Number
+    courseId: Number,
+    statusList: Array
   },
   data () {
     return {
@@ -114,7 +114,6 @@ export default {
     },
     // class
     initDatas_class () {
-      let _this = this
       let params = {
         _currentPage: this.currpage,
         _size: this.size

+ 26 - 26
frontend_web/src/views/course/detail/components/command.vue

@@ -6,34 +6,34 @@
 </template>
 
 <script>
-    import Vue from 'vue'
-    export default Vue.extend({
-        data () {
-            return {
-                tableHeight: 1
-            }
-        },
-        methods: {
-            handleEdit () {
-                let id = this.params.data['Id']
-                this.params.context.page.handleEdit(id)
-            },
-            handleDelete () {
-                let id = this.params.data['Id']
-                let _this = this
-                _this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
-                    confirmButtonText: '确定',
-                    cancelButtonText: '取消',
-                    type: 'warning'
-                }).then(() => {
-                    this.params.context.page.handleDelete(id)
-                }).catch(() => { })
-            }
+import Vue from 'vue'
+export default Vue.extend({
+  data () {
+    return {
+      tableHeight: 1
+    }
+  },
+  methods: {
+    handleEdit () {
+      let id = this.params.data['Id']
+      this.params.context.page.handleEdit(id)
+    },
+    handleDelete () {
+      let id = this.params.data['Id']
+      let _this = this
+      _this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.params.context.page.handleDelete(id)
+      }).catch(() => { })
+    }
 
-        }
-    })
+  }
+})
 </script>
 
 <style scoped>
 
-</style>
+</style>

+ 258 - 258
frontend_web/src/views/course/detail/index.vue

@@ -82,284 +82,284 @@ import itemDetailApi from '@/api/sysadmin/itemdetail'
 import command from './components/command'
 import detailApi from '@/api/course/detail'
 import editForm from './editForm'
-import {searchmanagingroomdata} from '@/api/instrumentroom'
+import { searchmanagingroomdata } from '@/api/instrumentroom'
 import { AgGridVue } from 'ag-grid-vue'
 import 'ag-grid-community/dist/styles/ag-grid.css'
 import 'ag-grid-community/dist/styles/ag-theme-balham.css'
 
 export default {
-    name: 'courseDetail',
-    components: { AgGridVue, editForm },
-    data () {
-        return {
-            // ag-grid相关变量
-            gridOptions: null,
-            gridApi: null,
-            columnApi: null,
-            rowData: null,
-            columnDefs: null,
-            RoomList:[],
-            TeacherList:[],
-            page: {
-                current: 1,
-                size: 10,
-                total: 1
-            },
-            sort: {
-                prop: '',
-                order: ''
-            },
+  name: 'courseDetail',
+  components: { AgGridVue, editForm },
+  data () {
+    return {
+      // ag-grid相关变量
+      gridOptions: null,
+      gridApi: null,
+      columnApi: null,
+      rowData: null,
+      columnDefs: null,
+      RoomList: [],
+      TeacherList: [],
+      page: {
+        current: 1,
+        size: 10,
+        total: 1
+      },
+      sort: {
+        prop: '',
+        order: ''
+      },
 
-            id: -1,
-            CourseId:null,
-            Term:null,
-            Class:null,
-            Year:null,
-            rowdata: {},
-            searchForm: {
-                name: ''
-            },
-            loading: false,
-            multipleSelection: [],
-            editFormVisible: false,
-            deleteBtnVisible: true,
-            deleteIds: []
-        }
-    },
-    beforeMount () {
-        let _this = this
-        this.gridOptions = {
-            rowHeight: 32, // 设置行高为32px
-            // 缺省列属性
-            defaultColDef: {
-                width: 200,
-                resizable: true
-            },
-            onRowSelected: this.handleSelectionChange, // 行选中
-            onSortChanged: this.handleSortChange // 排序传递后台
+      id: -1,
+      CourseId: null,
+      Term: null,
+      Class: null,
+      Year: null,
+      rowdata: {},
+      searchForm: {
+        name: ''
+      },
+      loading: false,
+      multipleSelection: [],
+      editFormVisible: false,
+      deleteBtnVisible: true,
+      deleteIds: []
+    }
+  },
+  beforeMount () {
+    let _this = this
+    this.gridOptions = {
+      rowHeight: 32, // 设置行高为32px
+      // 缺省列属性
+      defaultColDef: {
+        width: 200,
+        resizable: true
+      },
+      onRowSelected: this.handleSelectionChange, // 行选中
+      onSortChanged: this.handleSortChange // 排序传递后台
+    }
+    this.columnDefs = [
+      { headerName: '', checkboxSelection: true, headerCheckboxSelection: true, width: 50, 'pinned': 'left' },
+      {
+        headerName: '序号',
+        width: 50,
+        field: 'OrdNo',
+        cellRenderer: (params) => {
+          return params ? params.node.rowIndex + 1 + '' : ''
         }
-        this.columnDefs = [
-            { headerName: '', checkboxSelection: true, headerCheckboxSelection: true, width: 50, 'pinned': 'left' },
-            {
-                headerName: '序号',
-                width: 50,
-                field: 'OrdNo',
-                cellRenderer: (params) => {
-                    return params ? params.node.rowIndex + 1 + '' : ''
-                }
-            },
-            {headerName: '课程名称', field: 'CourseName', sortable: true},
-            { headerName: '授课老师', field: 'Teacher',valueFormatter:teacherFormatter},
-            { headerName: '实验地点', field: 'Local', valueFormatter:localFormatter},
+      },
+      { headerName: '课程名称', field: 'CourseName', sortable: true },
+      { headerName: '授课老师', field: 'Teacher', valueFormatter: teacherFormatter },
+      { headerName: '实验地点', field: 'Local', valueFormatter: localFormatter },
 
-            { headerName: '人数', field: 'Num', sortable: true },
+      { headerName: '人数', field: 'Num', sortable: true },
 
-            { headerName: '创建时间', field: 'CreatedTime', sortable: true },
-            { headerName: '操作', field: 'operation', width: 120, 'pinned': 'right', cellRendererFramework: command }
-        ]
+      { headerName: '创建时间', field: 'CreatedTime', sortable: true },
+      { headerName: '操作', field: 'operation', width: 120, 'pinned': 'right', cellRendererFramework: command }
+    ]
 
-        // 授课老师
-        function teacherFormatter(item) {
-            for (var i = 0; i < _this.TeacherList.length; i++) {
-                if (parseInt(_this.TeacherList[i].ItemValue) === item.value) {
-                    return _this.TeacherList[i].ItemName
-                }
-            }
+    // 授课老师
+    function teacherFormatter (item) {
+      for (var i = 0; i < _this.TeacherList.length; i++) {
+        if (parseInt(_this.TeacherList[i].ItemValue) === item.value) {
+          return _this.TeacherList[i].ItemName
         }
+      }
+    }
 
-        // 实验地点
-        function localFormatter(item ) {
-            for (var i = 0; i < _this.RoomList.length; i++) {
-                if (parseInt(_this.RoomList[i].Id) === item.value) {
-                    return _this.RoomList[i].RoomName
-                }
-            }
+    // 实验地点
+    function localFormatter (item) {
+      for (var i = 0; i < _this.RoomList.length; i++) {
+        if (parseInt(_this.RoomList[i].Id) === item.value) {
+          return _this.RoomList[i].RoomName
         }
+      }
+    }
+  },
+  created () {
+  },
+  mounted () {
+    let _this = this
+    _this.gridOptions.context = { page: _this }
+    _this.gridApi = _this.gridOptions.api
+    _this.CourseId = _this.$route.query.CourseId
+    _this.Year = _this.$route.query.Year
+    _this.Term = _this.$route.query.Term
+    _this.Class = _this.$route.query.Class
+    this.getTeacherList()
+    let params = {
+      _currentPage: 1,
+      _size: 9999
+    }
+    this.getRoomList(params)
+    this.doRefresh()
+  },
+  methods: {
+    // 表格就绪后后执行
+    onGridReady (params) {
+      // 调整表格列宽大小自适应
+      this.gridApi.sizeColumnsToFit()
     },
-    created () {
+    // 获取教师列表
+    getTeacherList (query) {
+      let _this = this
+      if (query !== '') {
+        _this.loading = true
+        itemDetailApi.getItemDetailByItemCode({ ItemCode: 'Teacher' })
+          .then(res => {
+            _this.loading = false
+            this.TeacherList = res
+            this.initData()
+          })
+          .catch(err => {
+            console.error(err)
+          })
+      } else {
+        _this.TeacherList = []
+      }
     },
-    mounted () {
-        let _this = this
-        _this.gridOptions.context = { page: _this }
-        _this.gridApi = _this.gridOptions.api
-        _this.CourseId = _this.$route.query.CourseId
-        _this.Year = _this.$route.query.Year
-        _this.Term = _this.$route.query.Term
-        _this.Class = _this.$route.query.Class
-        this.getTeacherList()
-        let params = {
-            _currentPage: 1,
-            _size: 9999,
-        }
-        this.getRoomList(params)
-        this.doRefresh()
+    // 获取实验室地点
+    getRoomList (params) {
+      let _this = this
+      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 = []
+      }
+    },
+    // 执行刷新(获取数据)
+    doRefresh () {
+      let _this = this
+      let query = {
+        // 分页信息
+        size: this.page.size,
+        current: this.page.current,
+        // 排序信息
+        prop: this.sort.prop,
+        order: this.sort.order,
+        // 搜索名称
+        CourseName: this.searchForm.name,
+        CourseId: this.CourseId // 课程ID
+      }
+      detailApi.getList(query)
+        .then(res => {
+          _this.rowData = res.records ? res.records : []
+          _this.page.current = res.current
+          _this.page.size = res.size
+          _this.page.total = res.total
+        })
+        .catch(err => {
+          console.error(err)
+        })
     },
-    methods: {
-        // 表格就绪后后执行
-        onGridReady (params) {
-            // 调整表格列宽大小自适应
-            this.gridApi.sizeColumnsToFit()
-        },
-        // 获取教师列表
-        getTeacherList(query) {
-            let _this = this
-            if (query !== '') {
-                _this.loading = true
-                itemDetailApi.getItemDetailByItemCode({ItemCode: 'Teacher'})
-                    .then(res => {
-                        _this.loading = false
-                        this.TeacherList = res
-                        this.initData()
-                    })
-                    .catch(err => {
-                        console.error(err)
-                    })
-            } else {
-                _this.TeacherList = []
-            }
-        },
-        // 获取实验室地点
-        getRoomList (params) {
-            let _this = this
-            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 = []
-            }
-        },
-        // 执行刷新(获取数据)
-        doRefresh () {
-            let _this = this
-            let query = {
-                // 分页信息
-                size: this.page.size,
-                current: this.page.current,
-                // 排序信息
-                prop: this.sort.prop,
-                order: this.sort.order,
-                // 搜索名称
-                CourseName: this.searchForm.name,
-                CourseId:this.CourseId // 课程ID
-            }
-            detailApi.getList(query)
-                .then(res => {
-                    _this.rowData = res.records ? res.records : []
-                    _this.page.current = res.current
-                    _this.page.size = res.size
-                    _this.page.total = res.total
-                })
-                .catch(err => {
-                    console.error(err)
-                })
-        },
 
-        // 分页-改变分页大小
-        handleSizeChange (value) {
-            this.page.size = value
-            this.page.current = 1
-            this.doRefresh()
-        },
-        // 分页-改变当前页
-        handleCurrentChange (value) {
-            this.page.current = value
-            this.doRefresh()
-        },
-        // 处理编辑
-        handleEdit (id) {
-            this.id = id
-            this.editFormVisible = true
-        },
-        // 处理删除
-        handleDelete (id) {
-            const params = {
-                ids: this.deleteIds
-            }
-            detailApi.delete(params).then((res) => {
-                this.$message({
-                    type: 'success',
-                    message: '删除成功!'
-                })
-                this.doRefresh()
-            })
-        },
+    // 分页-改变分页大小
+    handleSizeChange (value) {
+      this.page.size = value
+      this.page.current = 1
+      this.doRefresh()
+    },
+    // 分页-改变当前页
+    handleCurrentChange (value) {
+      this.page.current = value
+      this.doRefresh()
+    },
+    // 处理编辑
+    handleEdit (id) {
+      this.id = id
+      this.editFormVisible = true
+    },
+    // 处理删除
+    handleDelete (id) {
+      const params = {
+        ids: this.deleteIds
+      }
+      detailApi.delete(params).then((res) => {
+        this.$message({
+          type: 'success',
+          message: '删除成功!'
+        })
+        this.doRefresh()
+      })
+    },
 
-        // 查询
-        handleSearch () {
-            this.currentPage = 1
-            this.doRefresh()
-        },
-        // 重置
-        handleSearchFormReset () {
-            this.searchForm.name = ''
-            this.doRefresh()
-        },
-        // 新建窗口
-        add () {
-            this.rowdata = {}
-            this.id = 0
-            this.editFormVisible = true
-        },
-        // 批量删除
-        delSelectedIds () {
-            this.$confirm('此操作将永久删除所选课程, 是否继续?', '提示', {
-                confirmButtonText: '确定',
-                cancelButtonText: '取消',
-                type: 'warning'
-            }).then(() => {
-                const params = {
-                    ids: this.deleteIds
-                }
-                detailApi.delete(params).then((res) => {
-                    this.$message({
-                        type: 'success',
-                        message: '删除成功!'
-                    })
-                    this.doRefresh()
-                })
-            }).catch(() => {
-                this.$message({
-                    type: 'info',
-                    message: '已取消删除'
-                })
-            })
-        },
-        // 处理列表选择
-        handleSelectionChange () {
-            let _this = this
-            _this.multipleSelection = _this.gridOptions.api.getSelectedRows()
-            _this.deleteBtnVisible = !_this.multipleSelection || _this.multipleSelection.length === 0
-            if (!_this.deleteBtnVisible) {
-                _this.deleteIds = []
-                // 赋值删除id列表
-                _this.multipleSelection.forEach((item, k) => {
-                    _this.deleteIds.push(item.Id)
-                })
-            } else {
-                _this.deleteIds = []
-            }
-        },
-        handleSortChange (val) {
-            var sortState = this.gridApi.getSortModel()
-            // 获取排序的字段
-            if (sortState && sortState.length > 0) {
-                var item = sortState[0]
-                this.sort.prop = item.colId
-                this.sort.order = item.sort
-            }
-            this.doRefresh()
-        },
-        back () { // 返回上一页
-            this.$router.go(-1)
+    // 查询
+    handleSearch () {
+      this.currentPage = 1
+      this.doRefresh()
+    },
+    // 重置
+    handleSearchFormReset () {
+      this.searchForm.name = ''
+      this.doRefresh()
+    },
+    // 新建窗口
+    add () {
+      this.rowdata = {}
+      this.id = 0
+      this.editFormVisible = true
+    },
+    // 批量删除
+    delSelectedIds () {
+      this.$confirm('此操作将永久删除所选课程, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        const params = {
+          ids: this.deleteIds
         }
+        detailApi.delete(params).then((res) => {
+          this.$message({
+            type: 'success',
+            message: '删除成功!'
+          })
+          this.doRefresh()
+        })
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消删除'
+        })
+      })
+    },
+    // 处理列表选择
+    handleSelectionChange () {
+      let _this = this
+      _this.multipleSelection = _this.gridOptions.api.getSelectedRows()
+      _this.deleteBtnVisible = !_this.multipleSelection || _this.multipleSelection.length === 0
+      if (!_this.deleteBtnVisible) {
+        _this.deleteIds = []
+        // 赋值删除id列表
+        _this.multipleSelection.forEach((item, k) => {
+          _this.deleteIds.push(item.Id)
+        })
+      } else {
+        _this.deleteIds = []
+      }
+    },
+    handleSortChange (val) {
+      var sortState = this.gridApi.getSortModel()
+      // 获取排序的字段
+      if (sortState && sortState.length > 0) {
+        var item = sortState[0]
+        this.sort.prop = item.colId
+        this.sort.order = item.sort
+      }
+      this.doRefresh()
+    },
+    back () { // 返回上一页
+      this.$router.go(-1)
     }
+  }
 }
 </script>
 

+ 37 - 14
frontend_web/src/views/course/index.vue

@@ -94,11 +94,11 @@
                        align="center"
                        min-width="160px"
                        show-overflow-tooltip></el-table-column>
-      <el-table-column prop="CourseWeek"
-                       label="教学周"
-                       align="center"
-                       min-width="160px"
-                       show-overflow-tooltip></el-table-column>
+<!--      <el-table-column prop="CourseWeek"-->
+<!--                       label="教学周"-->
+<!--                       align="center"-->
+<!--                       min-width="160px"-->
+<!--                       show-overflow-tooltip></el-table-column>-->
       <el-table-column prop="ClassId"
                        label="班级"
                        align="center"
@@ -106,11 +106,13 @@
                        show-overflow-tooltip
                        :formatter="formatClass"
       ></el-table-column>
-      <!--<el-table-column prop="Status"
+      <el-table-column prop="Status"
                        align="center"
                        min-width="40px"
                        label="状态"
-                       show-overflow-tooltip></el-table-column>-->
+                       show-overflow-tooltip
+                       :formatter="formatStatus"
+      ></el-table-column>
       <el-table-column prop="CreatedTime"
                        align="center"
                        min-width="120px"
@@ -121,6 +123,7 @@
     <courseInfoDialog ref="courseDialog"
                       @handleClose="handleClose"
                       :courseId="courseId"
+                      :statusList="statusList"
                       width="75"></courseInfoDialog>
     <!-- </div> -->
     <template slot="footer">
@@ -139,8 +142,9 @@
 
 <script>
 
-import CourseApi from '@/api/course'
 import ClassApi from '@/api/class'
+import CourseApi from '@/api/course'
+import itemDetailApi from '@/api/sysadmin/itemdetail'
 import courseInfoDialog from './components/courseInfoDialog'
 export default {
   name: 'course',
@@ -153,7 +157,8 @@ export default {
       details: false,
       activities: [],
       courseId: -1,
-      classList:[], // 班级列表
+      classList: [], // 班级列表
+      statusList: [], // 状态列表
       search: {
         Term: '',
         Year: '',
@@ -188,9 +193,26 @@ export default {
     }
   },
   mounted () {
+    let _this = this
     this.initDatas()
+    itemDetailApi.getItemDetailByItemCode({ ItemCode: 'PublishStatus' })
+      .then(res => {
+        _this.statusList = res
+        this.initDatas()
+      })
+      .catch(err => {
+        console.error(err)
+      })
   },
   methods: {
+    // 匹配状态
+    formatStatus (row, column) {
+      for (var i = 0; i < this.statusList.length; i++) {
+        if (parseInt(this.statusList[i].ItemValue) === parseInt(row.Status)) {
+          return this.statusList[i].ItemName
+        }
+      }
+    },
     // 匹配班级
     formatClass (row, column) {
       for (var i = 0; i < this.classList.length; i++) {
@@ -216,6 +238,7 @@ export default {
     },
     // 打开 添加弹窗
     openinformationadd () {
+
       this.$refs.courseDialog.dialogvisible = true
     },
     // 打开 编辑弹窗
@@ -301,15 +324,15 @@ export default {
     },
 
     // 获取班级列表
-    getClassList() {
+    getClassList () {
       let params = {
         _currentPage: 1,
-        _size: 9999,
+        _size: 9999
       }
       ClassApi.getAllClass(params)
-              .then(res => {
-                this.classList = res.records
-              })
+        .then(res => {
+          this.classList = res.records
+        })
     }
 
   }