Просмотр исходного кода

授课教师和实验室地点和节次

liuyang 5 лет назад
Родитель
Сommit
141d7fc6eb

+ 14 - 0
backend/src/dashoo.cn/modi_webapi/app/api/course/detail/detail.go

@@ -7,6 +7,8 @@ import (
 	"dashoo.cn/modi_webapi/library/request"
 	"github.com/gogf/gf/net/ghttp"
 	"github.com/gogf/gf/os/glog"
+	"strconv"
+	"strings"
 )
 
 // 课程详情管理API
@@ -71,6 +73,18 @@ func (c CourseDetailController) Save(r *ghttp.Request) {
 	if err != nil {
 		response.Json(r, -1, err.Error())
 	}
+	Time := ""
+	// 多选节次转存为字符串
+	timeIds := r.GetInts("Time")
+	if len(timeIds) > 0 {
+		TimeArray := make([]string, len(timeIds))
+		for i, arg := range timeIds {
+			TimeArray[i] = strconv.Itoa(arg)
+		}
+
+		Time = strings.Join(TimeArray, ",")
+	}
+	entity.Time = Time
 	// 获取操作人
 	realName := r.GetParamVar("realname").String()
 

+ 0 - 12
backend/src/dashoo.cn/modi_webapi/app/model/course/detail/detail.go

@@ -28,18 +28,6 @@ type SelectPageReq struct {
 	Order      string    `json:order`
 }
 
-// 查询信息
-type SearchEntity struct {
-	Id          int         `xorm:"not null pk autoincr INT(10)"`
-	CourseId    int         `xorm:"INT(10)"`     // 课程ID
-	CourseName  string      `xorm:"VARCHAR(32)"` // 课程名
-	Teacher     int         `xorm:"INT(10)"`     // 授课老师
-	TeacherName string      `xorm:"VARCHAR(32)"` // 授课教师
-	Local       int         `xorm:"INT(10)"`     // 实验地点
-	Num         int         `xorm:"INT(10)"`     // 人数
-	Status      int         `xorm:"INT(10)"`     // 发布状态
-	CreatedTime *gtime.Time `xorm:"DATETIME"`    // 创建时间
-}
 
 // 删除详情请求
 type DeleteUpdReq struct {

+ 1 - 1
backend/src/dashoo.cn/modi_webapi/app/model/course/detail/detail_entity.go

@@ -20,7 +20,7 @@ type Entity struct {
 	Num 		int 		`xorm:"INT(10)"`		// 人数
 	WeekTitle	string		`xorm:"VARCHAR(32)"`	// 教学周
 	DayOfWeek   int 		`xorm:"INT(10)"`  		// 周次 1-7
-	Time		string 		`xorm:"VARCHAR(32)"`	// 节次
+	Time		string 		`xorm:"VARCHAR(32)"`	// 节次 多个节次id,逗号隔开
 	Status		int 		`xorm:"TINYINT"` 		// 状态 发布状态
 	CreatedBy	string		`xorm:"VARCHAR(32)"`	// 创建人
 	CreatedTime	*gtime.Time	`xorm:"DATETIME"`		// 创建时间

+ 6 - 15
backend/src/dashoo.cn/modi_webapi/app/service/course/detail/detail.go

@@ -2,7 +2,6 @@ package detail
 
 import (
 	"dashoo.cn/micro_libary/db"
-	"dashoo.cn/modi_webapi/app/common"
 	"dashoo.cn/modi_webapi/app/model/course/detail"
 	"database/sql"
 	"github.com/gogf/gf/errors/gerror"
@@ -48,8 +47,8 @@ func (s CourseDetailService) Update(param *detail.Entity) (*detail.Entity, error
 }
 
 // 分页查询课程表详情
-func (s CourseDetailService) GetPageList(param *detail.SelectPageReq) (list []*detail.SearchEntity, total int, err error) {
-	model := s.DB.Table(detail.Table).As("d").InnerJoin("base_itemdetails b", "d.Teacher = b.ItemValue").Where("b.ItemCode", "Teacher")
+func (s CourseDetailService) GetPageList(param *detail.SelectPageReq) (list []*detail.Entity, total int, err error) {
+	model := s.DB.Table(detail.Table)
 	if param != nil {
 		if param.CourseName != "" {
 			model = model.Where("CourseName like ?", "%"+param.CourseName+"%")
@@ -66,19 +65,11 @@ func (s CourseDetailService) GetPageList(param *detail.SelectPageReq) (list []*d
 		return nil, -1, gerror.New("读取行数失败")
 	}
 	// 排序
-	prop := param.Prop
-	order := param.Order
-	orderby := "d.Id asc" // 默认排序
-	if prop != "" {
-		if prop == "TeacherName" {
-			orderby = "b.ItemName " + order
-		} else {
-			orderby = "s." + common.UnMarshal(prop) + " " + order
-		}
-	}
+	orderby := "Id asc" // 默认排序
+
 	// 查询列表
-	model = model.Fields("d.*, b.ItemName as TeacherName").Page(int(param.Page.Current), int(param.Page.PagesSize)).Where("isDel", 0).Order(orderby)
-	var result []*detail.SearchEntity
+	model = model.Page(int(param.Page.Current), int(param.Page.PagesSize)).Where("isDel", 0).Order(orderby)
+	var result []*detail.Entity
 	err = model.Structs(&result)
 	// 如果未查到列表返回空
 	if err == sql.ErrNoRows {

+ 2 - 1
frontend_web/.env.development

@@ -14,7 +14,8 @@ VUE_APP_API=http://127.0.0.1:8090/api/
 
 # 第二后端API地址
 #VUE_APP_API02=http://39.98.34.197:9915/api/
-VUE_APP_API02=http://127.0.0.1:9635/api/
+#VUE_APP_API02=http://127.0.0.1:9635/api/
+VUE_APP_API02=http://192.168.0.252:12002/api/
 
 # 分模块地址
 VUE_APP_MODULE01=http://localhost:8081/#

+ 74 - 35
frontend_web/src/views/course/detail/editForm.vue

@@ -14,10 +14,10 @@
                           label="课程名">
                 <el-input v-model="formdata.CourseName"></el-input>
             </el-form-item>
-            <el-form-item label="授课教师">
+            <el-form-item label="授课教师" prop="Teacher">
                 <el-select v-model="formdata.Teacher"
                            style="width: 100%">
-                    <el-option v-for="item in Teachers"
+                    <el-option v-for="item in TeacherList"
                                :key="item.Teacher"
                                :label="item.ItemName"
                                :value="parseInt(item.ItemValue)">
@@ -25,13 +25,13 @@
                 </el-select>
             </el-form-item>
 
-            <el-form-item label="实验地点">
-                <el-select v-model="formdata.Teacher"
+            <el-form-item label="实验地点" prop="Local">
+                <el-select v-model="formdata.Local"
                            style="width: 100%">
-                    <el-option v-for="item in Teachers"
-                               :key="item.Teacher"
-                               :label="item.ItemName"
-                               :value="parseInt(item.ItemValue)">
+                    <el-option v-for="item in RoomList"
+                               :key="item.Id"
+                               :label="item.RoomName"
+                               :value="parseInt(item.Id)">
                     </el-option>
                 </el-select>
             </el-form-item>
@@ -57,15 +57,16 @@
                 <el-input v-model="formdata.DayOfWeek"></el-input>
             </el-form-item>
 
-            <el-form-item prop="Time"
-                          label="节次">
-                <el-input v-model="formdata.Time"></el-input>
+            <el-form-item label="节次">
+                <el-checkbox-group style="width:100%;text-align:left" v-model="checkedTimes" @change="handleCheckedChange">
+                    <el-checkbox :label="item.ItemValue" v-for="item in TimeList" :key="item.ItemValue">{{ item.ItemName }}</el-checkbox>
+                </el-checkbox-group>
             </el-form-item>
 
 
-            <el-form-item label="发布状态" prop="Status">
-                <el-switch style="width:100%;text-align:left" v-model="formdata.Status"></el-switch>
-            </el-form-item>
+<!--            <el-form-item label="发布状态" prop="Status">-->
+<!--                <el-switch style="width:100%;text-align:left" v-model="formdata.Status"></el-switch>-->
+<!--            </el-form-item>-->
 
 
         </el-form>
@@ -83,6 +84,9 @@
 <script>
 import detailApi from '@/api/course/detail'
 import itemDetailApi from '@/api/sysadmin/itemdetail'
+import {
+    searchmanagingroomdata,
+} from '@/api/instrumentroom'
 export default {
     name: 'detailEditForm',
     props: {
@@ -92,17 +96,17 @@ export default {
         Year: Number,
         Term: Number,
         ClassId: Number,
+        RoomList: Array,
+        TeacherList: Array,
     },
     data () {
         return {
             loading: false,
             dialogVisible: false,
-            classList: [],
-            subjectList: [],
-            selectSubject: [],
+            checkedTimes: [],
             Teachers :[],
             formdata: {
-                Id: 0,
+                Id: '',
                 CourseId : '',
                 Year : '',
                 Term : '',
@@ -114,16 +118,25 @@ export default {
                 Num :'',
                 WeekTitle : '',
                 DayOfWeek : '',
-                Time : '',
-                Status : 0,
+                Time : [],
+                // Status : 0,
             },
-            imageUrl: '',
             rules: {
                 CourseName: [{
                     required: true,
                     message: '课程名不能为空',
                     trigger: 'blur'
                 }],
+                Teacher: [{
+                    required: true,
+                    message: '授课教师不能为空',
+                    trigger: 'blur'
+                }],
+                Local: [{
+                    required: true,
+                    message: '实验地点不能为空',
+                    trigger: 'blur'
+                }],
                 Mark: [{
                     required: true,
                     message: '学分不能为空',
@@ -161,14 +174,7 @@ export default {
         }
     },
     mounted () {
-        itemDetailApi.getItemDetailByItemCode({ ItemCode: 'Teacher' })
-            .then(res => {
-                this.Teachers = res
-                this.initData()
-            })
-            .catch(err => {
-                console.error(err)
-            })
+        this.getTimeList()
     },
     methods: {
         dialogOpen () {
@@ -186,13 +192,21 @@ export default {
                     .then(res => {
                         _this.formdata = res
                         // 编辑时初始化表单数据,给字段赋值
-                        _this.formdata.Status = _this.formdata.Status === 1
+                        // _this.formdata.Status = _this.formdata.Status === 1
+                        // 判断多选的选中状态
+                        if (_this.formdata.Time) {
+                            let subStr = _this.formdata.Time
+                            _this.checkedTimes = subStr.split(',').map(Number)
+
+                            console.log(_this.checkedTimes)
+                        } else {
+                            _this.checkedTimes = []
+                        }
                     })
                     .catch(err => {
                         console.error(err)
                     })
             } else {
-                console.log(_this)
                 _this.formdata.Id = ''
                 _this.formdata.CourseId = _this.CourseId
                 _this.formdata.Year = _this.Year
@@ -205,17 +219,18 @@ export default {
                 _this.formdata.Num = ''
                 _this.formdata.WeekTitle = ''
                 _this.formdata.DayOfWeek = ''
-                _this.formdata.Time = ''
-                _this.formdata.Status = 0
+                _this.formdata.Time = []
+                // _this.formdata.Status = 0
+                _this.checkedTimes = [] // 多选选中项、
+
             }
         },
         saveEntity () {
             let _this = this
-            console.log(_this)
             _this.formdata.Id = this.id
             _this.$refs['form'].validate(valid => {
                 if (valid) {
-                    _this.formdata.Status = _this.formdata.Status ? 1 : 0
+                    // _this.formdata.Status = _this.formdata.Status ? 1 : 0
                     _this.loading = true
                     detailApi.save(_this.formdata)
                         .then(data => {
@@ -231,6 +246,30 @@ export default {
                 }
             })
         },
+
+        // 获取课程节次列表
+        getTimeList (query) {
+            let _this = this
+            if (query !== '') {
+                _this.loading = true
+                itemDetailApi.getItemDetailByItemCode({ ItemCode: 'Time' })
+                    .then(res => {
+                        _this.loading = false
+                        this.TimeList = res
+                        this.initData()
+                    })
+                    .catch(err => {
+                        console.error(err)
+                    })
+            } else {
+                _this.TimeList = []
+            }
+        },
+        handleCheckedChange (val) {
+            let _this = this
+            _this.formdata.Time = val
+        },
+
         dialogClose () {
             this.$refs['form'].resetFields()
             this.dialogVisible = false

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

@@ -71,151 +71,249 @@
                    :Year="parseInt(Year)"
                    :Term="parseInt(Term)"
                    :ClassId="parseInt(Class)"
+                   :RoomList="RoomList"
+                   :TeacherList="TeacherList"
                    @submit="doRefresh" />
     </d2-container>
 </template>
 
 <script>
-    import command from './components/command'
-    import detailApi from '@/api/course/detail'
-    import editForm from './editForm'
-    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,
+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 { AgGridVue } from 'ag-grid-vue'
+import 'ag-grid-community/dist/styles/ag-grid.css'
+import 'ag-grid-community/dist/styles/ag-theme-balham.css'
 
-                page: {
-                    current: 1,
-                    size: 10,
-                    total: 1
-                },
-                sort: {
-                    prop: '',
-                    order: ''
-                },
+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: ''
+            },
+
+            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 + '' : ''
+                }
+            },
+            {headerName: '课程名称', field: 'CourseName', sortable: true},
+            { headerName: '授课老师', field: 'Teacher',valueFormatter:teacherFormatter},
+            { headerName: '实验地点', field: 'Local', valueFormatter:localFormatter},
+
+            { headerName: '人数', field: 'Num', sortable: true },
 
-                id: -1,
-                CourseId:null,
-                Term:null,
-                Class:null,
-                Year:null,
-                rowdata: {},
-                searchForm: {
-                    name: ''
-                },
-                loading: false,
-                multipleSelection: [],
-                editFormVisible: false,
-                deleteBtnVisible: true,
-                deleteIds: []
+            { 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
+                }
             }
-        },
-        beforeMount () {
-            this.gridOptions = {
-                rowHeight: 32, // 设置行高为32px
-                // 缺省列属性
-                defaultColDef: {
-                    width: 200,
-                    resizable: true
-                },
-                onRowSelected: this.handleSelectionChange, // 行选中
-                onSortChanged: this.handleSortChange // 排序传递后台
+        }
+
+        // 实验地点
+        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
+                }
             }
-            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: 'TeacherName'},
-                { headerName: '实验地点', field: 'Local' },
-                { headerName: '人数', field: 'Num', sortable: true },
-                { headerName: '发布状态', field: 'Status',
-                    valueFormatter (params) {
-                        return params.value === 0 ? '未发布' : '已发布'
-                    },},
-                { headerName: '创建时间', field: 'CreatedTime', sortable: true },
-                { headerName: '操作', field: 'operation', width: 120, 'pinned': 'right', cellRendererFramework: command }
-            ]
-        },
-        created () {
+        }
+    },
+    created () {
+        this.getTeacherList()
+        let params = {
+            _currentPage: 1,
+            _size: 9999,
+        }
+        this.getRoomList(params)
+    },
+    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.doRefresh()
+    },
+    methods: {
+        // 表格就绪后后执行
+        onGridReady (params) {
+            // 调整表格列宽大小自适应
+            this.gridApi.sizeColumnsToFit()
         },
-        mounted () {
+        // 获取教师列表
+        getTeacherList(query) {
             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.doRefresh()
-        },
-        methods: {
-            // 表格就绪后后执行
-            onGridReady (params) {
-                // 调整表格列宽大小自适应
-                this.gridApi.sizeColumnsToFit()
-            },
-            // 执行刷新(获取数据)
-            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)
+            if (query !== '') {
+                _this.loading = true
+                itemDetailApi.getItemDetailByItemCode({ItemCode: 'Teacher'})
                     .then(res => {
-                        _this.rowData = res.records
-                        // console.log(_this.rowData, '============')
-                        // _this.page.current = res.current
-                        // _this.page.size = res.size
-                        _this.page.total = res.total
+                        _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
+        // 分页-改变分页大小
+        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()
-            },
-            // 处理编辑
-            handleEdit (id) {
-                this.id = id
-                this.editFormVisible = true
-            },
-            // 处理删除
-            handleDelete (id) {
+            })
+        },
+
+        // 查询
+        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
                 }
@@ -226,77 +324,43 @@
                     })
                     this.doRefresh()
                 })
-            },
-            // 查询
-            handleSearch () {
-                this.currentPage = 1
-                this.doRefresh()
-            },
-            // 重置
-            handleSearchFormReset () {
-                this.searchForm.name = ''
-                this.doRefresh()
-            },
-            // 新建窗口
-            add () {
-                this.rowdata = {}
-                this.id = -1
-                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: '已取消删除'
-                    })
+            }).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)
+            })
+        },
+        // 处理列表选择
+        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>
 
 <style lang="scss">