Browse Source

1.导出重复问题

zangkai 5 years ago
parent
commit
5fc8a9bfd1
1 changed files with 41 additions and 104 deletions
  1. 41 104
      frontend_web/src/views/course/detail/index.vue

+ 41 - 104
frontend_web/src/views/course/detail/index.vue

@@ -30,12 +30,12 @@
                      icon="el-icon-circle-plus"
                      @click="add"> 新增
           </el-button>
-<!--          <el-button type="primary"-->
-<!--                     size="mini"-->
-<!--                     icon="el-icon-circle-plus"-->
-<!--                     :disabled="deleteBtnVisible"-->
-<!--                     @click="delSelectedIds"> 删除-->
-<!--          </el-button>-->
+          <!--          <el-button type="primary"-->
+          <!--                     size="mini"-->
+          <!--                     icon="el-icon-circle-plus"-->
+          <!--                     :disabled="deleteBtnVisible"-->
+          <!--                     @click="delSelectedIds"> 删除-->
+          <!--          </el-button>-->
           <el-button type="primary"
                      size="mini"
                      icon="el-icon-download"
@@ -56,14 +56,41 @@
               fit
               tooltip-effect="dark"
               style="width: 100%"
-              @sort-change="orderby"
               id="out-table"
               height="100%">
+      <el-table-column prop="CourseName"
+                       align="center"
+                       min-width="120px"
+                       label="课程名称"
+                       show-overflow-tooltip></el-table-column>
+      <el-table-column prop="Teacher"
+                       align="center"
+                       min-width="120px"
+                       label="授课老师"
+                       show-overflow-tooltip
+                       :formatter="teacherFormatter">
+      </el-table-column>
+      <el-table-column prop="Local"
+                       align="center"
+                       min-width="120px"
+                       label="实验地点"
+                       show-overflow-tooltip
+                       :formatter="localFormatter"></el-table-column>
+      <el-table-column prop="Num"
+                       align="center"
+                       min-width="120px"
+                       label="人数"
+                       show-overflow-tooltip></el-table-column>
+      <el-table-column prop="DayOfWeek"
+                       align="center"
+                       min-width="120px"
+                       label="周次"
+                       show-overflow-tooltip
+                       :formatter="dayOfWeekFormatter"></el-table-column>
       <el-table-column label="操作"
                        width="160px"
                        align="center"
-                       id="operation"
-                       fixed='right'>
+                       id="operation">
         <template slot-scope="scope">
           <el-button size="mini"
                      title="编辑"
@@ -81,35 +108,6 @@
 
         </template>
       </el-table-column>
-        <el-table-column prop="CourseName"
-                         align="center"
-                         min-width="120px"
-                         label="课程名称"
-                         show-overflow-tooltip></el-table-column>
-        <el-table-column prop="Teacher"
-                         align="center"
-                         min-width="120px"
-                         label="授课老师"
-                         show-overflow-tooltip
-                         :formatter="teacherFormatter">
-        </el-table-column>
-        <el-table-column prop="Local"
-                         align="center"
-                         min-width="120px"
-                         label="实验地点"
-                         show-overflow-tooltip
-                         :formatter="localFormatter"></el-table-column>
-        <el-table-column prop="Num"
-                         align="center"
-                         min-width="120px"
-                         label="人数"
-                         show-overflow-tooltip></el-table-column>
-        <el-table-column prop="DayOfWeek"
-                         align="center"
-                         min-width="120px"
-                         label="周次"
-                         show-overflow-tooltip
-                         :formatter="dayOfWeekFormatter"></el-table-column>
 
     </el-table>
 
@@ -142,8 +140,6 @@ import itemDetailApi from '@/api/sysadmin/itemdetail'
 import detailApi from '@/api/course/detail'
 import editForm from './editForm'
 import { searchmanagingroomdata } from '@/api/instrumentroom'
-import 'ag-grid-community/dist/styles/ag-grid.css'
-import 'ag-grid-community/dist/styles/ag-theme-balham.css'
 import FileSaver from 'file-saver'
 import XLSX from 'xlsx'
 import { mapActions, mapState } from 'vuex'
@@ -153,9 +149,6 @@ export default {
   components: { editForm },
   data () {
     return {
-      // ag-grid相关变量
-      gridOptions: null,
-      gridApi: null,
       columnApi: null,
       rowData: null,
       columnDefs: null,
@@ -168,10 +161,6 @@ export default {
         size: 10,
         total: 1
       },
-      sort: {
-        prop: '',
-        order: ''
-      },
 
       id: -1,
       CourseId: null,
@@ -195,24 +184,11 @@ export default {
       'current' // 用户获取当前页面的地址,用于关闭
     ])
   },
-  beforeMount () {
-    this.gridOptions = {
-      rowHeight: 32, // 设置行高为32px
-      // 缺省列属性
-      defaultColDef: {
-        width: 200,
-        resizable: true
-      },
-      onRowSelected: this.handleSelectionChange, // 行选中
-      onSortChanged: this.handleSortChange // 排序传递后台
-    }
-  },
+
   created () {
   },
   mounted: function () {
     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
@@ -227,11 +203,7 @@ export default {
     this.doRefresh()
   },
   methods: {
-    // 表格就绪后后执行
-    onGridReady (params) {
-      // 调整表格列宽大小自适应
-      this.gridApi.sizeColumnsToFit()
-    },
+
     // 获取教师列表
     getTeacherList (query) {
       let _this = this
@@ -306,9 +278,7 @@ export default {
         // 分页信息
         size: this.page.size,
         current: this.page.current,
-        // 排序信息
-        prop: this.sort.prop,
-        order: this.sort.order,
+
         // 搜索名称
         CourseName: this.searchForm.name,
         CourseId: this.CourseId // 课程ID
@@ -403,31 +373,7 @@ export default {
         })
       })
     },
-    // 处理列表选择
-    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()
-    },
+
     // 关闭页面
     ...mapActions('d2admin/page', [
       'close_return'
@@ -438,16 +384,7 @@ export default {
         returnTagName: '/course'
       })
     },
-    // 列表排序功能
-    orderby (column) {
-      if (column.order === 'ascending') {
-        this.Column.Order = 'asc'
-      } else if (column.order === 'descending') {
-        this.Column.Order = 'desc'
-      }
-      this.Column.Prop = column.prop
-      this.initDatas()
-    },
+
     // 导出excel
     handleDownload () {
       /* out-table关联导出的dom节点  */