index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <template>
  2. <div class="m-container">
  3. <h2>
  4. <div class="squrt"></div>系统日志
  5. </h2>
  6. <div class="m-core">
  7. <location-hash v-model="searchForm.group" @change="onTabClick">
  8. <el-tabs v-model="activeIndex" @tab-click="onTabClick">
  9. <el-tab-pane label="系统通知" v-if="permissionList.journalItem" name="SYSTEM" value="SYSTEM"></el-tab-pane>
  10. <el-tab-pane label="学生申诉" v-if="permissionList.studentComplain" name="STUDENT" value="STUDENT"></el-tab-pane>
  11. <!-- <el-tab-pane label="退团退课" value="MUSICGROUP"></el-tab-pane> -->
  12. <el-tab-pane label="请假处理" v-if="permissionList.leaveOperation" name="LEAVE" value="LEAVE"></el-tab-pane>
  13. <el-tab-pane label="VIP申请审核" v-if="permissionList.vipApply" name="VIPAPPLY" value="VIPAPPLY"></el-tab-pane>
  14. </el-tabs>
  15. </location-hash>
  16. <el-form :inline="true"
  17. ref="searchForm"
  18. :model="searchForm">
  19. <el-form-item prop="readStatus">
  20. <el-select v-model.trim="searchForm.readStatus"
  21. clearable
  22. placeholder="日志状态">
  23. <el-option label="已读" :value="1"></el-option>
  24. <el-option label="未读" :value="0"></el-option>
  25. </el-select>
  26. </el-form-item>
  27. <!-- <el-form-item>
  28. <el-date-picker :clearable="false"
  29. v-model="searchForm.month"
  30. type="date"
  31. placeholder="选择年月"></el-date-picker>
  32. </el-form-item> -->
  33. <el-form-item>
  34. <el-button type="danger" @click="onSearch">搜索</el-button>
  35. </el-form-item>
  36. </el-form>
  37. <div class="tableWrap">
  38. <el-table style="width: 100%"
  39. :header-cell-style="{background:'#EDEEF0',color:'#444'}"
  40. :data="tableList">
  41. <el-table-column label="申请人" prop="userId" width="100px">
  42. <template slot-scope="scope">
  43. <el-badge :is-dot="!scope.row.readStatus" style="vertical-align: sub;"></el-badge>
  44. {{ scope.row.userId }}
  45. </template>
  46. </el-table-column>
  47. <el-table-column align="center" label="申请时间" prop="createOn"></el-table-column>
  48. <el-table-column align="center" label="内容" prop="content"></el-table-column>
  49. <el-table-column align="center"
  50. label="操作"
  51. fixed="right">
  52. <template slot-scope="scope">
  53. <el-button type="text" @click="onLook(scope.row)">查看</el-button>
  54. </template>
  55. </el-table-column>
  56. </el-table>
  57. <pagination :total="pageInfo.total"
  58. :page.sync="pageInfo.page"
  59. :limit.sync="pageInfo.limit"
  60. :page-sizes="pageInfo.page_size"
  61. @pagination="getList" />
  62. </div>
  63. </div>
  64. <el-dialog :title="dialogTitle"
  65. :visible.sync="dialogSystem"
  66. width="400px">
  67. <el-row>
  68. <el-col :span="24">{{ dialogDetail.content }}</el-col>
  69. </el-row>
  70. <div slot="footer">
  71. <el-button type="primary" @click="dialogSystem = false">确 定</el-button>
  72. </div>
  73. </el-dialog>
  74. <el-dialog :title="dialogTitle"
  75. :visible.sync="dialogStudent"
  76. width="500px">
  77. <student-model v-if="dialogStudent"
  78. :dialogDetail="dialogDetail"
  79. @close="dialogStudent = false" />
  80. </el-dialog>
  81. <!-- 请假 -->
  82. <el-dialog :title="dialogTitle"
  83. :visible.sync="dialogLeave"
  84. width="800px">
  85. <leave-model v-if="dialogLeave"
  86. :dialogDetail="dialogDetail"
  87. @close="dialogLeave = false" />
  88. </el-dialog>
  89. <!-- 请假 -->
  90. <el-dialog :title="dialogTitle"
  91. :visible.sync="dialogVipApply"
  92. width="500px">
  93. <vip-apply-model v-if="dialogVipApply"
  94. :dialogDetail="dialogDetail"
  95. @close="dialogVipApply = false" />
  96. </el-dialog>
  97. </div>
  98. </template>
  99. <script>
  100. import cleanDeep from 'clean-deep';
  101. import pagination from "@/components/Pagination/index";
  102. import { queryCountOfUnread, sysMessageList, setRead } from '@/api/journal'
  103. import { journalType } from '@/constant'
  104. import StudentModel from './model/student'
  105. import LeaveModel from './model/leave'
  106. import vipApplyModel from './model/vipApply'
  107. import { permission } from '@/utils/directivePage'
  108. export default {
  109. components: { pagination, StudentModel, LeaveModel, vipApplyModel },
  110. name: 'journal',
  111. data () {
  112. const query = this.$route.query
  113. return {
  114. permissionList: {
  115. journalItem: permission('/journalItem'),
  116. studentComplain: permission('/studentComplain'),
  117. musicGroupCourse: permission('/musicGroupCourse'),
  118. leaveOperation: permission('/leaveOperation'),
  119. vipApply: permission('/vipApply')
  120. },
  121. dialogSystem: false,
  122. dialogStudent: false,
  123. dialogLeave: false,
  124. dialogVipApply: false,
  125. dialogTitle: null,
  126. dialogDetail: {},
  127. activeIndex: query.opt || 'SYSTEM',
  128. searchForm: {
  129. search: null,
  130. group: query.opt || 'SYSTEM',
  131. readStatus: 0
  132. },
  133. tableList: [],
  134. pageInfo: {
  135. // 分页规则
  136. limit: 10, // 限制显示条数
  137. page: 1, // 当前页
  138. total: 0, // 总条数
  139. page_size: [10, 20, 40, 50] // 选择限制显示条数
  140. }
  141. }
  142. },
  143. mounted() {
  144. this.getList()
  145. console.log(this.searchForm.group)
  146. },
  147. methods: {
  148. onSearch() {
  149. this.pageInfo.page = 1
  150. this.getList()
  151. },
  152. onTabClick(elm) {
  153. // 判断 group 是否一致
  154. const searchForm = this.searchForm
  155. console.log(searchForm)
  156. this.activeIndex = searchForm.group
  157. if(elm.$attrs.value == searchForm.group) {
  158. return
  159. }
  160. searchForm.group = elm.$attrs.value
  161. this.getList()
  162. },
  163. async getList() {
  164. const pageInfo = this.pageInfo
  165. const params = Object.assign({}, this.searchForm)
  166. params.rows = pageInfo.limit
  167. params.page = pageInfo.page
  168. await sysMessageList(params).then(res => {
  169. if (res.code == 200) {
  170. this.tableList = res.data.rows
  171. pageInfo.total = res.data.total
  172. }
  173. })
  174. },
  175. async onLook(row) {
  176. // 把当前消息变成已读
  177. if(row.readStatus != 1) {
  178. await setRead({ id: row.id })
  179. row.readStatus = 1 // 手动把消息变一下状态
  180. }
  181. this.dialogTitle = journalType[row.group]
  182. this.dialogDetail = row
  183. switch(row.group) {
  184. case 'SYSTEM':
  185. this.dialogSystem = true
  186. break;
  187. case 'STUDENT':
  188. this.dialogStudent = true
  189. break;
  190. case 'LEAVE':
  191. this.dialogLeave = true
  192. break;
  193. case 'VIPAPPLY':
  194. this.dialogVipApply = true
  195. break;
  196. }
  197. }
  198. }
  199. }
  200. </script>
  201. <style lang="scss" scoped>
  202. </style>