accompanySet.vue 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <div class="m-container">
  3. <div class="infoWrap">
  4. <el-form :model="accompanyForm" :inline="true" label-position="left">
  5. <el-form-item label="每周可预约课次" style="position: relative" label-width="130px">
  6. <el-tooltip placement="top" popper-class='mTooltip'>
  7. <div slot="content">
  8. 不填时,默认不限制上课次数
  9. </div>
  10. <img :src="imageIcon" class='micon el-tooltip' style="width:8px height:8px" alt="">
  11. </el-tooltip>
  12. <el-input type="number" v-model.trim="accompanyForm.count"></el-input>
  13. </el-form-item>
  14. <el-form-item label="每周休息的周次">
  15. <el-select v-model="accompanyForm.week" clearable>
  16. <el-option label="星期一" value="1" />
  17. <el-option label="星期二" value="2" />
  18. <el-option label="星期三" value="3" />
  19. <el-option label="星期四" value="4" />
  20. <el-option label="星期五" value="5" />
  21. <el-option label="星期六" value="6" />
  22. <el-option label="星期日" value="7" />
  23. </el-select>
  24. </el-form-item>
  25. <el-form-item>
  26. <el-button type="primary" @click="submitOk">确定</el-button>
  27. </el-form-item>
  28. </el-form>
  29. </div>
  30. </div>
  31. </template>
  32. <script>
  33. import { teacherFreeTime,resetTeacherFreeTime } from '@/api/teacherManager'
  34. export default {
  35. props: ['teacherId'],
  36. data() {
  37. return {
  38. accompanyForm: {
  39. count: null,
  40. week: null
  41. },
  42. accompanyId:null,
  43. imageIcon:require('@/assets/images/base/warning.png'),
  44. };
  45. },
  46. created(){
  47. this.init()
  48. },
  49. activated(){
  50. this.init()
  51. },
  52. methods:{
  53. init(){
  54. // this.teacherId = this.$route.query.teacherId ;
  55. if (this.$route.query.search) {
  56. this.Fsearch = this.$route.query.search;
  57. }
  58. if (this.$route.query.rules) {
  59. this.Frules = this.$route.query.rules
  60. }
  61. if( this.teacherId){
  62. teacherFreeTime({id:this.teacherId}).then(res=>{
  63. if(res.code == 200&&res.data){
  64. this.accompanyId = res.data.id;
  65. this.accompanyForm.count = res.data.totalTimes;
  66. res.data.holiday?this.accompanyForm.week = res.data.holiday.toString():this.accompanyForm.week = null;
  67. }
  68. })
  69. }
  70. },
  71. submitOk(){
  72. this.$confirm('确认保存设置?', '提示', {
  73. confirmButtonText: '确定',
  74. cancelButtonText: '取消',
  75. type: 'warning'
  76. }).then(() => {
  77. resetTeacherFreeTime({holiday:this.accompanyForm.week,userId:this.teacherId,id:this.accompanyId,totalTimes:this.accompanyForm.count}).then(res=>{
  78. if(res.code == 200){
  79. this.$message.success('保存成功')
  80. this.$router.push({ path: '/business/teacherList', query: { rules: this.Frules, search: this.Fsearch } })
  81. }
  82. })
  83. })
  84. }
  85. }
  86. };
  87. </script>
  88. <style lang="scss" scoped>
  89. .micon {
  90. position: absolute;
  91. top:12px;
  92. left:-26px;
  93. z-index: 100;
  94. }
  95. </style>