lex-xin 4 lat temu
rodzic
commit
2264d505b9

+ 21 - 10
src/views/workBenchManager/journal/index.vue

@@ -74,10 +74,18 @@
     <el-dialog :title="dialogTitle"
                :visible.sync="dialogStudent"
                width="500px">
-      <student v-if="dialogStudent"
+      <student-model v-if="dialogStudent"
                :dialogDetail="dialogDetail"
                @close="dialogStudent = false" />
     </el-dialog>
+    <!-- 请假 -->
+    <el-dialog :title="dialogTitle"
+               :visible.sync="dialogLeave"
+               width="800px">
+      <leave-model v-if="dialogLeave"
+               :dialogDetail="dialogDetail"
+               @close="dialogLeave = false" />
+    </el-dialog>
   </div>
 </template>
 <script>
@@ -85,14 +93,17 @@ import cleanDeep from 'clean-deep';
 import pagination from "@/components/Pagination/index";
 import { queryCountOfUnread, sysMessageList, setRead } from '@/api/journal'
 import { journalType } from '@/constant'
-import Student from './model/student'
+import StudentModel from './model/student'
+import LeaveModel from './model/leave'
 export default {
-  components: { pagination, Student },
+  components: { pagination, StudentModel, LeaveModel },
   name: 'journal',
   data () {
     return {
       dialogSystem: false,
       dialogStudent: false,
+      dialogLeave: false,
+      dialogVipApply: false,
       dialogTitle: null,
       dialogDetail: {},
       searchForm: {
@@ -140,6 +151,13 @@ export default {
       })
     },
     async onLook(row) {
+      // 把当前消息变成已读
+      if(row.readStatus != 1) {
+        await setRead({ id: row.id })
+        row.readStatus = 1 // 手动把消息变一下状态
+      }
+      this.dialogTitle = journalType[row.group]
+      this.dialogDetail = row
       switch(row.group) {
         case 'SYSTEM':
           this.dialogSystem = true
@@ -154,13 +172,6 @@ export default {
           this.dialogVipApply = true
           break;
       }
-      // 把当前消息变成已读
-      if(row.readStatus != 1) {
-        await setRead({ id: row.id })
-        row.readStatus = 1 // 手动把消息变一下状态
-      }
-      this.dialogTitle = journalType[row.group]
-      this.dialogDetail = row
     }
   }
 }

+ 182 - 0
src/views/workBenchManager/journal/model/leave.vue

@@ -0,0 +1,182 @@
+<template>
+    <div>
+        <el-form ref="leaveForm"
+                 :model="leaveForm"
+                 class="leaveForm"
+                 label-width="100px">
+            <el-alert title="已拒绝" show-icon center v-if="leaveForm.status == 'REJECT'" :closable="false" class="alert" type="error"></el-alert>
+            <el-alert title="已同意" show-icon center v-if="leaveForm.status == 'PASS'" :closable="false" class="alert" type="success"></el-alert>
+            <el-form-item label="开始时间">
+                <el-input disabled v-model.trim="leaveForm.startTime"></el-input>
+            </el-form-item>
+            <el-form-item label="结束时间">
+                <el-input disabled v-model.trim="leaveForm.endTime"></el-input>
+            </el-form-item>
+            <el-form-item label="备注">
+                <el-input type="textarea" disabled v-model.trim="leaveForm.remark"></el-input>
+            </el-form-item>
+        </el-form>
+        <!-- vip -->
+        <el-table :data="vipCourse"
+                    style="width: 100%"
+                    :header-cell-style="{background:'#EDEEF0',color:'#444'}">
+            <el-table-column label="编号" prop="before.id"></el-table-column>
+            <el-table-column label="类型"
+                            width="100px">
+                <template slot-scope="scope">
+                    {{ scope.row.before.type == "VIP" ? 'VIP课' : '乐团课' }}
+                </template>
+            </el-table-column>
+            <el-table-column label="班名"
+                            width="140px">
+                <template slot-scope="scope">
+                    <tooltip :content="scope.row.before.name" />
+                </template>
+            </el-table-column>
+            <el-table-column label="调整前日期">
+                <template slot-scope="scope">
+                    {{ scope.row.before.classDate | formatTimer }}
+                </template>
+            </el-table-column>
+            <el-table-column label="上课时间">
+                <template slot-scope="scope">
+                    {{ scope.row.before.startClassTime | getFormatTime(scope.row.before.endClassTime) }}
+                </template>
+            </el-table-column>
+            <el-table-column label="调整后日期">
+            <template slot-scope="scope"
+                        v-if="scope.row.before.type == 'VIP'">
+                {{ scope.row.after.classDate | formatTimer }}
+            </template>
+            </el-table-column>
+            <el-table-column label="调整后时间">
+            <template slot-scope="scope"
+                        v-if="scope.row.before.type == 'VIP'">
+                {{ scope.row.after.startClassTime | getFormatTime(scope.row.after.endClassTime) }}
+            </template>
+            </el-table-column>
+        </el-table>
+
+        <el-table :data="musicGroupCourse"
+                    style="width: 100%; padding-top: 10px;"
+                    :header-cell-style="{background:'#EDEEF0',color:'#444'}">
+            <el-table-column label="乐团编号"
+                            prop="before.musicGroupId">
+            </el-table-column>
+            <el-table-column label="类型">
+            <template slot-scope="scope">
+                {{ scope.row.before.type == "VIP" ? 'VIP课' : '乐团课' }}
+            </template>
+            </el-table-column>
+            <el-table-column label="班名">
+                <template slot-scope="scope">
+                    <tooltip :content="scope.row.before.name" />
+                </template>
+            </el-table-column>
+            <el-table-column label="调整前日期">
+                <template slot-scope="scope">
+                    {{ scope.row.before.classDate | formatTimer }}
+                </template>
+            </el-table-column>
+            <el-table-column label="上课时间">
+                <template slot-scope="scope">
+                    {{ scope.row.before.startClassTime | getFormatTime(scope.row.before.endClassTime) }}
+                </template>
+            </el-table-column>
+        </el-table>
+        <div slot="footer" class="dialog-footer" v-permission="'teacherLeaveRecord/approve'" v-if="leaveForm.status == 'ING'">
+            <el-button type="primary" @click="onSubmit('leaveForm', 'PASS')">确 定</el-button>
+            <el-button type="danger" @click="onSubmit('leaveForm', 'REJECT')">拒 绝</el-button>
+        </div>
+    </div>
+</template>
+
+<script>
+import { leaveQueryDetail, approve } from '@/api/journal'
+import Tooltip from '@/components/Tooltip'
+import dayjs from 'dayjs'
+export default {
+    props: ['dialogDetail'],
+    components: { Tooltip },
+    data() {
+        return {
+            leaveForm: {},
+            musicGroupCourse: [],
+            vipCourse: [],
+        }
+    },
+    mounted() {
+        this.__init()
+    },
+    methods: {
+        async __init() {
+            let { memo } = this.dialogDetail
+            memo = memo ? JSON.parse(memo) : null
+            if(!memo) { // 判断是否有参数
+                this.$message.error('参数有误')
+                return
+            }
+            await leaveQueryDetail({ id: memo.leaveRecordId }).then(res => {
+                let result = res.data
+                if (res.code == 200) {
+                    this.leaveForm = result
+                    let tempJson = result.coursesScheduleJson ? JSON.parse(result.coursesScheduleJson) : []
+                    let musicGroupCourse = []
+                    let vipCourse = []
+                    console.log(tempJson)
+                    tempJson.forEach(item => {
+                        if (item.before.type == 'VIP') {
+                            vipCourse.push(item)
+                        } else {
+                            musicGroupCourse.push(item)
+                        }
+                    })
+                    console.log(vipCourse)
+                    this.musicGroupCourse = musicGroupCourse
+                    this.vipCourse = vipCourse
+                }
+            })
+        },
+        async onSubmit(formName, type) {
+            const params = {
+                id: this.leaveForm.id,
+                status: type,
+                userId: this.leaveForm.userId
+            }
+            const str = type == 'PASS' ? '同意' : '拒绝'
+            this.$confirm(`您确定${str}该请假申请吗?`, '提示', {
+                confirmButtonText: '确定',
+                cancelButtonText: '取消',
+                type: 'warning'
+            }).then(async () => {
+                await approve(params).then(res => {
+                    if (res.code == 200) {
+                        this.$message.success('处理成功')
+                        this.$listeners.close()
+                    } else {
+                        this.$message.error(res.msg)
+                    }
+                })
+            }).catch(() => {
+                //
+            })
+        }
+    },
+    filters: {
+        getFormatTime (tempA, tempB) {
+            return dayjs(tempA).format('HH') + ':' + dayjs(tempA).format('mm') + '-' + dayjs(tempB).format('HH') + ':' + dayjs(tempB).format('mm')
+        }
+    }
+}
+</script>
+
+<style lang="less" scoped>
+.dialog-footer{
+    margin-top: 20px;
+    display: block;
+    text-align: right;
+}
+.alert {
+   margin-bottom: 10px;
+}
+</style>

+ 33 - 21
src/views/workBenchManager/journal/model/student.vue

@@ -5,8 +5,8 @@
                  v-if="studentForm"
                  class="studentForm"
                  label-width="110px">
-            <el-alert title="已拒绝" v-if="studentForm.complaints.status == 'REJECT'" :closable="false" class="alert" type="error"></el-alert>
-            <el-alert title="已处理" v-if="studentForm.complaints.status == 'PASS'" :closable="false" class="alert" type="success"></el-alert>
+            <el-alert title="已拒绝" show-icon center v-if="studentForm.complaints.status == 'REJECT'" :closable="false" class="alert" type="error"></el-alert>
+            <el-alert title="已同意" show-icon center v-if="studentForm.complaints.status == 'PASS'" :closable="false" class="alert" type="success"></el-alert>
             <el-form-item label="发起投诉时间">
                 <el-input disabled v-model.trim="studentForm.courseSchedule.createTime"></el-input>
             </el-form-item>
@@ -52,7 +52,7 @@
               </el-input>
             </el-form-item>
         </el-form>
-        <div slot="footer" class="dialog-footer" v-if="studentForm && studentForm.complaints.status === 'ING'">
+        <div slot="footer" class="dialog-footer" v-permission="'courseSchedule/courseScheduleCommplaintAudit'" v-if="studentForm && studentForm.complaints.status === 'ING'">
             <el-button type="primary" @click="onSubmit('studentForm', 'submit')">确 定</el-button>
             <el-button type="danger" @click="onSubmit('studentForm', 'reject')">拒 绝</el-button>
         </div>
@@ -106,28 +106,40 @@ export default {
             })
         },
         async onSubmit(formName, type) {
-            this.$refs[formName].validate(async (valid) => {
-                if(valid) {
-                    const params = {
-                        id: this.studentForm.complaints.id
-                    }
-                    if(type == 'submit') {
+            const params = {
+                id: this.studentForm.complaints.id
+            }
+            if(type == 'reject') {
+                this.$confirm('您确定拒绝吗?', '提示', {
+                    confirmButtonText: '确定',
+                    cancelButtonText: '取消',
+                    type: 'warning'
+                }).then(async () => {
+                    params.status = 'REJECT'
+                    params.studentLiabilityRatio = 0
+                    params.teacherLiabilityRatio = 0
+                    await this.onComm(params)
+                }).catch(() => {
+                    //
+                });
+            } else {
+                this.$refs[formName].validate(async (valid) => {
+                    if(valid) {
                         params.status = 'PASS'
                         params.studentLiabilityRatio = this.rateForm.studentRate
                         params.teacherLiabilityRatio = this.rateForm.teacherRate
-                    } else if (type == 'reject') {
-                        params.status = 'REJECT'
-                        params.studentLiabilityRatio = 0
-                        params.teacherLiabilityRatio = 0
+                        await this.onComm(params)
                     }
-                    await courseScheduleCommplaintAudit(params).then(res => {
-                        if (res.code == 200) {
-                            this.$message.success('处理成功')
-                            this.$listeners.close()
-                        } else {
-                            this.$message.error(res.msg)
-                        }
-                    })
+                })
+            }
+        },
+        async onComm(params) {
+            await courseScheduleCommplaintAudit(params).then(res => {
+                if (res.code == 200) {
+                    this.$message.success('处理成功')
+                    this.$listeners.close()
+                } else {
+                    this.$message.error(res.msg)
                 }
             })
         }

+ 171 - 0
src/views/workBenchManager/journal/model/vipApply.vue

@@ -0,0 +1,171 @@
+<template>
+    <div>
+        <el-form ref="studentForm"
+                 :model="rateForm"
+                 v-if="studentForm"
+                 class="studentForm"
+                 label-width="110px">
+            <el-alert title="已拒绝" show-icon center v-if="studentForm.complaints.status == 'REJECT'" :closable="false" class="alert" type="error"></el-alert>
+            <el-alert title="已同意" show-icon center v-if="studentForm.complaints.status == 'PASS'" :closable="false" class="alert" type="success"></el-alert>
+            <el-form-item label="发起投诉时间">
+                <el-input disabled v-model.trim="studentForm.courseSchedule.createTime"></el-input>
+            </el-form-item>
+            <el-form-item label="学员姓名">
+                <el-input disabled v-model.trim="studentForm.complaints.user.username"></el-input>
+            </el-form-item>
+            <el-form-item label="课程名称">
+                <el-input disabled v-model.trim="studentForm.courseSchedule.name"></el-input>
+            </el-form-item>
+            <el-form-item label="课程时间">
+                <!-- {{ showMessage.courseSchedule.classDate | formatTimer }} {{ showMessage.courseSchedule.startClassTime | timer }} -->
+                <el-input disabled v-model.trim="studentForm.courseSchedule.classDate"></el-input>
+            </el-form-item>
+            <el-form-item label="老师名称">
+                <el-input disabled v-model.trim="studentForm.courseSchedule.teacher.username"></el-input>
+            </el-form-item>
+            <el-form-item label="投诉理由">
+                <el-input type="textarea" disabled v-model.trim="studentForm.complaints.reason"></el-input>
+            </el-form-item>
+            <el-alert title="责任比" :closable="false" class="alert" type="info"></el-alert>
+            <el-form-item label="老师比例"
+                          prop="teacherRate"
+                          :rules="[{ required: true, message: '请输入老师比例', trigger: 'blur'},
+                            { required: true, validator: validateRate, trigger: 'blur' }]">
+                <el-input type="number"
+                      @mousewheel.native.prevent
+                      :disabled="studentForm.complaints.status !== 'ING'"
+                      v-model.number="rateForm.teacherRate"
+                      placeholder="请输入内容">
+                    <template slot="append">%</template>
+                </el-input>
+            </el-form-item>
+            <el-form-item label="学生比例"
+                          prop="studentRate"
+                          :rules="[{ required: true, message: '请输入学生比例', trigger: 'blur'},
+                            { required: true, validator: validateRate, trigger: 'blur' }]">
+                <el-input type="number"
+                      @mousewheel.native.prevent
+                      :disabled="studentForm.complaints.status !== 'ING'"
+                      v-model.number="rateForm.studentRate"
+                      placeholder="请输入内容">
+                <template slot="append">%</template>
+              </el-input>
+            </el-form-item>
+        </el-form>
+        <div slot="footer" class="dialog-footer" v-permission="'courseSchedule/courseScheduleCommplaintAudit'" v-if="studentForm && studentForm.complaints.status === 'ING'">
+            <el-button type="primary" @click="onSubmit('studentForm', 'submit')">确 定</el-button>
+            <el-button type="danger" @click="onSubmit('studentForm', 'reject')">拒 绝</el-button>
+        </div>
+    </div>
+</template>
+
+<script>
+import { queryCourseScheduleComplaintsDetail, courseScheduleCommplaintAudit } from '@/api/journal'
+const validateRate = (rule, value, callback) => {
+    if (value == '' && typeof value == 'string' || value == null) {
+        callback(new Error('请输入比例'))
+    } else if (value < 0 || value > 100) {
+        callback(new Error('比例必须在0~100之间'))
+    } else {
+        callback()
+    }
+}
+export default {
+    props: ['dialogDetail'],
+    data() {
+        return {
+            validateRate: validateRate,
+            studentForm: null,
+            rateForm: {
+                studentRate: null,
+                teacherRate: null
+            }
+        }
+    },
+    mounted() {
+        this.__init()
+    },
+    methods: {
+        async __init() {
+            let { memo } = this.dialogDetail
+            memo = memo ? JSON.parse(memo) : null
+            if(!memo) { // 判断是否有参数
+                this.$message.error('参数有误')
+                return
+            }
+            await queryCourseScheduleComplaintsDetail({ courseScheduleComplaintsId: memo.courseScheduleComplaintsId }).then(res => {
+                let result = res.data
+                if (res.code == 200) {
+                    this.studentForm = result
+                    const { complaints } = result
+                    if (complaints.status != 'ING') {
+                        this.rateForm.teacherRate = complaints.teacherLiabilityRatio
+                        this.rateForm.studentRate = complaints.studentLiabilityRatio
+                    }
+                }
+            })
+        },
+        async onSubmit(formName, type) {
+            const params = {
+                id: this.studentForm.complaints.id
+            }
+            if(type == 'reject') {
+                this.$confirm('您确定拒绝吗?', '提示', {
+                    confirmButtonText: '确定',
+                    cancelButtonText: '取消',
+                    type: 'warning'
+                }).then(async () => {
+                    params.status = 'REJECT'
+                    params.studentLiabilityRatio = 0
+                    params.teacherLiabilityRatio = 0
+                    await this.onComm(params)
+                }).catch(() => {
+                    //
+                });
+            } else {
+                this.$refs[formName].validate(async (valid) => {
+                    if(valid) {
+                        params.status = 'PASS'
+                        params.studentLiabilityRatio = this.rateForm.studentRate
+                        params.teacherLiabilityRatio = this.rateForm.teacherRate
+                        await this.onComm(params)
+                    }
+                })
+            }
+        },
+        async onComm(params) {
+            await courseScheduleCommplaintAudit(params).then(res => {
+                if (res.code == 200) {
+                    this.$message.success('处理成功')
+                    this.$listeners.close()
+                } else {
+                    this.$message.error(res.msg)
+                }
+            })
+        }
+    },
+    watch: {
+        'rateForm.teacherRate' (newValue, old) {
+            if (newValue) {
+                this.rateForm.studentRate = parseInt(100 - newValue)
+            }
+        },
+        'rateForm.studentRate' (newValue, old) {
+            if (newValue) {
+                this.rateForm.teacherRate = parseInt(100 - newValue)
+            }
+        }
+    },
+}
+</script>
+
+<style lang="less" scoped>
+.dialog-footer{
+    margin-top: 20px;
+    display: block;
+    text-align: right;
+}
+.alert {
+   margin-bottom: 10px;
+}
+</style>