Browse Source

首页值班课程

all 5 years ago
parent
commit
1279320acf

+ 206 - 0
frontend_web/src/views/demo/page1/components/dutyInfoDialog.vue

@@ -0,0 +1,206 @@
+<template>
+  <el-dialog title="值班详情"
+             :visible.sync="dialogvisible"
+             @opened="dialogOpen"
+             @closed="dialogClose"
+             width="75%">
+    <el-table ref="multipleTable"
+              :data="activities"
+              border
+              fit
+              tooltip-effect="dark"
+              style="width: 100%"
+              height="500px">
+      <el-table-column fit
+                       prop="Local"
+                       label="地点"
+                       align="center"
+                       show-overflow-tooltip
+                       :formatter="formatLocal"></el-table-column>
+      <el-table-column prop="Time"
+                       label="时间段"
+                       align="center"
+                       show-overflow-tooltip
+                       :formatter="formatTime"></el-table-column>
+      <el-table-column prop="Monday"
+                       label="周一"
+                       align="center"
+                       show-overflow-tooltip
+                       :formatter="formatPerson"></el-table-column>
+      <el-table-column prop="Tuesday"
+                       label="周二"
+                       align="center"
+                       show-overflow-tooltip
+                       :formatter="formatPerson"></el-table-column>
+      <el-table-column prop="Wednesday"
+                       label="周三"
+                       align="center"
+                       show-overflow-tooltip
+                       :formatter="formatPerson"></el-table-column>
+      <el-table-column prop="Thursday"
+                       label="周四"
+                       align="center"
+                       show-overflow-tooltip
+                       :formatter="formatPerson"></el-table-column>
+      <el-table-column prop="Friday"
+                       label="周五"
+                       align="center"
+                       show-overflow-tooltip
+                       :formatter="formatPerson"></el-table-column>
+      <el-table-column prop="Saturday"
+                       label="周六"
+                       align="center"
+                       show-overflow-tooltip
+                       :formatter="formatPerson"></el-table-column>
+      <el-table-column prop="Sunday"
+                       label="周日"
+                       align="center"
+                       show-overflow-tooltip
+                       :formatter="formatPerson"></el-table-column>
+    </el-table>
+    <template slot="footer">
+    </template>
+  </el-dialog>
+</template>
+
+<script>
+
+import DutyApi from '@/api/duty'
+import itemDetailApi from '@/api/sysadmin/itemdetail'
+import { searchmanagingroomdata } from '@/api/instrumentroom'
+export default {
+  name: 'informationDialog',
+  props: {
+    dutydetail: { // 当前样本存在位置
+      type: Array
+    },
+  },
+  data () {
+    return {
+      page: {
+        current: 1,
+        size: 10,
+        total: 1
+      },
+      sort: {
+        prop: '',
+        order: ''
+      },
+      LocalList: [],
+      PeopleList: [],
+      TimeList: [],
+      RoomList: [],
+      TeacherList: [],
+      activities: [],
+      dialogvisible: false,
+      information: {},
+      rulesinformationForm: {
+        title: [{
+          required: true,
+          message: '请输入信息标题',
+          trigger: 'blur'
+        }],
+        content: [{
+          required: true,
+          message: '请输入信息内容',
+          trigger: 'blur'
+        }]
+      }
+    }
+  },
+  created () {
+    this.getData()
+
+  },
+  methods: {
+    // 获取字典表地点
+    formatLocal (row, column, cellValue, index) {
+      for (var i = 0; i < this.LocalList.length; i++) {
+        if (this.LocalList[i].ItemValue == cellValue) {
+          return this.LocalList[i].ItemName
+        }
+      }
+    },
+    getLocal () {
+      let _this = this
+      itemDetailApi.getItemDetailByItemCode({ ItemCode: 'Local' })
+        .then(res => {
+          _this.LocalList = res
+        })
+        .catch(err => {
+          console.error(err)
+        })
+    },
+    // 获取字典表课程时间段
+    getDutyTime () {
+      let _this = this
+      itemDetailApi.getItemDetailByItemCode({ ItemCode: 'DutyTime' })
+        .then(res => {
+          _this.TimeList = res
+        })
+        .catch(err => {
+          console.error(err)
+        })
+    },
+    formatTime (row, column, cellValue, index) {
+      for (var i = 0; i < this.TimeList.length; i++) {
+        if (this.TimeList[i].ItemValue == cellValue) {
+          return this.TimeList[i].ItemName
+        }
+      }
+    },
+    // 获取字典表值班人员
+    getPeople () {
+      let _this = this
+      itemDetailApi.getItemDetailByItemCode({ ItemCode: 'People' })
+        .then(res => {
+          _this.PeopleList = res
+        })
+        .catch(err => {
+          console.error(err)
+        })
+    },
+    formatPerson (row, column, cellValue, index) {
+      let label = '休息'
+      for (var i = 0; i < this.PeopleList.length; i++) {
+        if (this.PeopleList[i].ItemValue == cellValue) {
+          return this.PeopleList[i].ItemName
+        }
+      }
+      return label
+    },
+    dialogOpen () {
+      this.information = {}
+      // this.$refs.informationForm.resetFields()
+      this.getData()
+    },
+    dialogClose () {
+      this.information = {}
+      // this.$refs.informationForm.resetFields()
+      // this.$emit('handleClose')
+      this.dialogVisible = false
+    },
+    // 分页-改变分页大小
+    handleSizeChange (value) {
+      this.page.size = value
+      this.page.current = 1
+      this.getData()
+    },
+    getData () {
+      let _this = this
+      _this.activities = []
+      _this.getLocal()
+      _this.getDutyTime()
+      _this.getPeople()
+      DutyApi.getDetailByDutyId({
+        DutyId: _this.dutydetail.Id
+      }).then(res => {
+        if (res.length > 0) {
+          _this.activities = res
+        }
+      })
+    }
+
+  }
+}
+</script>

+ 45 - 15
frontend_web/src/views/demo/page1/index.vue

@@ -113,7 +113,7 @@
         <el-table ref="multipleTable"
                   :data="activitiescourse"
                   border
-                  @row-click="opencourseDetails"
+                  @row-click="openCourseDetails"
                   fit
                   tooltip-effect="dark"
                   style="width: 100%"
@@ -173,7 +173,7 @@
 
     <el-row :gutter="15"
             style="margin-top: 10px;">
-      <!-- <el-card>
+      <el-card>
         <div style="font-size:20px">
           值班表
         </div>
@@ -221,9 +221,10 @@
         <el-table :data="activitiesduty"
                   border
                   fit
+                  @row-click="openDutyDetails"
                   tooltip-effect="dark"
                   style="width: 100%;margin-top: 5px;"
-                  height="100%">
+                  height="280px">
           <el-table-column prop="Year"
                            fit
                            min-width="160px"
@@ -260,7 +261,7 @@
                        layout="total, sizes, prev, pager, next, jumper"
                        :total="searchcourse.page.total">
         </el-pagination>
-      </el-card> -->
+      </el-card>
     </el-row>
 
     <!-- 信息发布 -->
@@ -273,6 +274,11 @@
                       @handleClose="handleClose"
                       :courselist="courselist"
                       width="75"></courseInfoDialog>
+    <!-- 值班表 -->
+    <dutyInfoDialog ref="dutyDialog"
+                    @handleClose="handleClose"
+                    :dutydetail="dutydetail"
+                    width="75"></dutyInfoDialog>
   </d2-container>
 </template>
 
@@ -284,11 +290,13 @@ import CourseApi from '@/api/course'
 import DutyApi from '@/api/duty'
 import informationInfoDialog from './components/informationInfoDialog'
 import courseInfoDialog from './components/courseInfoDialog'
+import dutyInfoDialog from './components/dutyInfoDialog'
 export default {
   name: 'informationIndex',
   components: {
     informationInfoDialog,
-    courseInfoDialog
+    courseInfoDialog,
+    dutyInfoDialog
   },
   data () {
     return {
@@ -301,6 +309,7 @@ export default {
       activities: [],
       activitiescourse: [],
       courselist: [],
+      dutydetail: [],
       activitiesduty: [],
       activitiesclass: [],
       informationId: -1,
@@ -325,6 +334,15 @@ export default {
       //     size: 5
       //   }
       // },
+      searchduty: {
+        Term: '',
+        Year: '',
+        page: {
+          total: 0,
+          current: 1,
+          size: 10
+        }
+      },
       searchcourse: {
         Term: '',
         Year: '',
@@ -358,7 +376,7 @@ export default {
     this.initDatas()
     this.initDatasCourse()
     this.initSelectYear()
-    // this.initDatas_duty()
+    this.initDatas_duty()
     this.initDatas_class()
     this.getTerm()
     this.getClassList()
@@ -368,7 +386,7 @@ export default {
       this.informationId = row.id
       this.$refs.informationDialog.dialogvisible = true
     },
-    opencourseDetails (row) {
+    openCourseDetails (row) {
       this.courselist = []
       this.courselist.CourseId = row.Id
       this.courselist.Year = row.Year
@@ -376,6 +394,14 @@ export default {
       this.courselist.ClassId = row.ClassId
       this.$refs.courseDialog.dialogvisible = true
     },
+    openDutyDetails (row) {
+      this.dutydetail = []
+      this.dutydetail.Id = row.Id
+      // this.courselist.Year = row.Year
+      // this.courselist.Term = row.Term
+      // this.courselist.ClassId = row.ClassId
+      this.$refs.dutyDialog.dialogvisible = true
+    },
     // 获取字典表
     getTerm () {
       itemDetailApi.getItemDetailByItemCode({ ItemCode: 'Term' })
@@ -465,21 +491,26 @@ export default {
     // 初始化列表数据,值班管理列表
     initDatas_duty () {
       let _this = this
-      let params = {
-        _currentPage: this.currpage,
-        _size: this.size
-      }
-      DutyApi.getAllDuty(params)
+      // let params = {
+      //   _currentPage: this.currpage,
+      //   _size: this.size,
+      //   Year: this.search.Year,
+      //   Term: this.search.Term,
+      //   Title: this.search.Title,
+      //   Order: this.search.Order,
+      //   Prop: this.search.Prop
+      // }
+      DutyApi.getPageList(this.searchduty)
         .then(res => {
+          console.log('----res----', res)
           _this.activitiesduty = res.records
+          // _this.search.page.total = res.total
         })
     },
     // 初始化列表数据课程
     initDatasCourse () {
-      console.log('-----this.searchcourse----', this.searchcourse)
       CourseApi.getPageList(this.searchcourse)
         .then(res => {
-          console.log('------res---', res)
           this.activitiescourse = res.records
           this.searchcourse.page.total = res.total
         })
@@ -547,7 +578,6 @@ export default {
     },
     // 课程管理
     handleSizeChange_course (val) {
-      console.log('----val--111--', val)
       this.searchcourse.page.size = val
       this.searchcourse.page.current = 1
       this.initDatasCourse()