leave.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <div>
  3. <el-form ref="leaveForm"
  4. :model="leaveForm"
  5. class="leaveForm"
  6. label-width="100px">
  7. <el-alert title="已拒绝" show-icon center v-if="leaveForm.status == 'REJECT'" :closable="false" class="alert" type="error"></el-alert>
  8. <el-alert title="已同意" show-icon center v-if="leaveForm.status == 'PASS'" :closable="false" class="alert" type="success"></el-alert>
  9. <el-form-item label="开始时间">
  10. <el-input disabled v-model.trim="leaveForm.startTime"></el-input>
  11. </el-form-item>
  12. <el-form-item label="结束时间">
  13. <el-input disabled v-model.trim="leaveForm.endTime"></el-input>
  14. </el-form-item>
  15. <el-form-item label="备注">
  16. <el-input type="textarea" disabled v-model.trim="leaveForm.remark"></el-input>
  17. </el-form-item>
  18. </el-form>
  19. <!-- vip -->
  20. <el-table :data="vipCourse"
  21. style="width: 100%"
  22. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  23. <el-table-column label="编号" prop="before.id"></el-table-column>
  24. <el-table-column label="类型"
  25. width="100px">
  26. <template slot-scope="scope">
  27. {{ scope.row.before.type == "VIP" ? 'VIP课' : '乐团课' }}
  28. </template>
  29. </el-table-column>
  30. <el-table-column label="班名"
  31. width="140px">
  32. <template slot-scope="scope">
  33. <tooltip :content="scope.row.before.name" />
  34. </template>
  35. </el-table-column>
  36. <el-table-column label="调整前日期">
  37. <template slot-scope="scope">
  38. {{ scope.row.before.classDate | formatTimer }}
  39. </template>
  40. </el-table-column>
  41. <el-table-column label="上课时间">
  42. <template slot-scope="scope">
  43. {{ scope.row.before.startClassTime | getFormatTime(scope.row.before.endClassTime) }}
  44. </template>
  45. </el-table-column>
  46. <el-table-column label="调整后日期">
  47. <template slot-scope="scope"
  48. v-if="scope.row.before.type == 'VIP'">
  49. {{ scope.row.after.classDate | formatTimer }}
  50. </template>
  51. </el-table-column>
  52. <el-table-column label="调整后时间">
  53. <template slot-scope="scope"
  54. v-if="scope.row.before.type == 'VIP'">
  55. {{ scope.row.after.startClassTime | getFormatTime(scope.row.after.endClassTime) }}
  56. </template>
  57. </el-table-column>
  58. </el-table>
  59. <el-table :data="musicGroupCourse"
  60. style="width: 100%; padding-top: 10px;"
  61. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  62. <el-table-column label="乐团编号"
  63. prop="before.musicGroupId">
  64. </el-table-column>
  65. <el-table-column label="类型">
  66. <template slot-scope="scope">
  67. {{ scope.row.before.type == "VIP" ? 'VIP课' : '乐团课' }}
  68. </template>
  69. </el-table-column>
  70. <el-table-column label="班名">
  71. <template slot-scope="scope">
  72. <tooltip :content="scope.row.before.name" />
  73. </template>
  74. </el-table-column>
  75. <el-table-column label="调整前日期">
  76. <template slot-scope="scope">
  77. {{ scope.row.before.classDate | formatTimer }}
  78. </template>
  79. </el-table-column>
  80. <el-table-column label="上课时间">
  81. <template slot-scope="scope">
  82. {{ scope.row.before.startClassTime | getFormatTime(scope.row.before.endClassTime) }}
  83. </template>
  84. </el-table-column>
  85. </el-table>
  86. <div slot="footer" class="dialog-footer" v-permission="'teacherLeaveRecord/approve'" v-if="leaveForm.status == 'ING'">
  87. <el-button type="primary" @click="onSubmit('leaveForm', 'PASS')">确 定</el-button>
  88. <el-button type="danger" @click="onSubmit('leaveForm', 'REJECT')">拒 绝</el-button>
  89. </div>
  90. </div>
  91. </template>
  92. <script>
  93. import { leaveQueryDetail, approve } from '@/api/journal'
  94. import Tooltip from '@/components/Tooltip'
  95. import dayjs from 'dayjs'
  96. export default {
  97. props: ['dialogDetail'],
  98. components: { Tooltip },
  99. data() {
  100. return {
  101. leaveForm: {},
  102. musicGroupCourse: [],
  103. vipCourse: [],
  104. }
  105. },
  106. mounted() {
  107. this.__init()
  108. },
  109. methods: {
  110. async __init() {
  111. let { memo } = this.dialogDetail
  112. memo = memo ? JSON.parse(memo) : null
  113. if(!memo) { // 判断是否有参数
  114. this.$message.error('参数有误')
  115. return
  116. }
  117. await leaveQueryDetail({ id: memo.leaveRecordId }).then(res => {
  118. let result = res.data
  119. if (res.code == 200) {
  120. this.leaveForm = result
  121. let tempJson = result.coursesScheduleJson ? JSON.parse(result.coursesScheduleJson) : []
  122. let musicGroupCourse = []
  123. let vipCourse = []
  124. tempJson.forEach(item => {
  125. if (item.before.type == 'VIP') {
  126. vipCourse.push(item)
  127. } else {
  128. musicGroupCourse.push(item)
  129. }
  130. })
  131. this.musicGroupCourse = musicGroupCourse
  132. this.vipCourse = vipCourse
  133. }
  134. })
  135. },
  136. async onSubmit(formName, type) {
  137. const params = {
  138. id: this.leaveForm.id,
  139. status: type,
  140. userId: this.leaveForm.userId
  141. }
  142. const str = type == 'PASS' ? '同意' : '拒绝'
  143. this.$confirm(`您确定${str}该请假申请吗?`, '提示', {
  144. confirmButtonText: '确定',
  145. cancelButtonText: '取消',
  146. type: 'warning'
  147. }).then(async () => {
  148. await approve(params).then(res => {
  149. if (res.code == 200) {
  150. this.$message.success('处理成功')
  151. this.$listeners.close()
  152. } else {
  153. this.$message.error(res.msg)
  154. }
  155. })
  156. }).catch(() => {
  157. //
  158. })
  159. }
  160. },
  161. filters: {
  162. getFormatTime (tempA, tempB) {
  163. return dayjs(tempA).format('HH') + ':' + dayjs(tempA).format('mm') + '-' + dayjs(tempB).format('HH') + ':' + dayjs(tempB).format('mm')
  164. }
  165. }
  166. }
  167. </script>
  168. <style lang="less" scoped>
  169. .dialog-footer{
  170. margin-top: 20px;
  171. display: block;
  172. text-align: right;
  173. }
  174. .alert {
  175. margin-bottom: 10px;
  176. }
  177. </style>