visit.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <template>
  2. <div>
  3. <div class="visitBtnWrap">
  4. <el-button type="text" @click="recordVisible = true">学员考勤</el-button>
  5. <el-button type="text" @click="workVisible=true">作业情况</el-button>
  6. </div>
  7. <el-form
  8. :model="visitForm"
  9. label-width="120px"
  10. label-position="right"
  11. ref="visitForm"
  12. :rules="visitRules"
  13. >
  14. <el-form-item label="学生姓名">
  15. <p>{{ userName }}</p>
  16. </el-form-item>
  17. <el-form-item label="回访类型" prop="visitType">
  18. <el-cascader
  19. :disabled='isMainGo'
  20. expand-trigger="hover"
  21. clearable
  22. style="width: 80% !important"
  23. placeholder="请选择回访类型"
  24. :options="visitChiose"
  25. v-model="visitForm.visitType"
  26. >
  27. </el-cascader>
  28. </el-form-item>
  29. <el-form-item label="回访日期" prop="visitTime">
  30. <el-date-picker
  31. v-model.trim="visitForm.visitTime"
  32. align="right"
  33. type="date"
  34. style="width: 80% !important"
  35. placeholder="选择日期"
  36. value-format="yyyy-MM-dd"
  37. ></el-date-picker>
  38. </el-form-item>
  39. <el-form-item label="学员情况" prop="overview">
  40. <el-input
  41. type="textarea"
  42. v-model="visitForm.overview"
  43. style="width: 80% !important"
  44. placeholder="请输入学员情况"
  45. :rows="3"
  46. maxlength="50"
  47. show-word-limit
  48. ></el-input>
  49. </el-form-item>
  50. <el-form-item label="家长反馈" prop="feedback">
  51. <el-input
  52. type="textarea"
  53. v-model="visitForm.feedback"
  54. style="width: 80% !important"
  55. placeholder="请输入家长反馈"
  56. :rows="3"
  57. maxlength="50"
  58. show-word-limit
  59. ></el-input>
  60. </el-form-item>
  61. </el-form>
  62. <div
  63. slot="footer"
  64. class="dialog-footer"
  65. style="text-align: right; margin-right: 15%"
  66. >
  67. <el-button @click="$emit('close')">取 消</el-button>
  68. <el-button type="primary" @click="submitAddVisit">确 定</el-button>
  69. </div>
  70. <el-dialog
  71. title="学员考勤"
  72. width="1020px"
  73. :visible.sync="recordVisible"
  74. append-to-body
  75. v-if="recordVisible"
  76. >
  77. <record :studentId="this.detail.userId"/>
  78. </el-dialog>
  79. <el-dialog
  80. v-if="workVisible"
  81. title="作业列表"
  82. width="1020px"
  83. :visible.sync="workVisible"
  84. append-to-body
  85. >
  86. <studentWork :studentId="this.detail.userId"/>
  87. </el-dialog>
  88. </div>
  89. </template>
  90. <script>
  91. import cleanDeep from "clean-deep";
  92. import { visitChiose,visitChiose1 } from "@/utils/searchArray";
  93. import { addVisit } from "@/views/returnVisitManager/api";
  94. import record from './record'
  95. import studentWork from './studentWork'
  96. export default {
  97. props: ["detail", "username",'isMainGo'],
  98. components:{record,studentWork},
  99. data() {
  100. return {
  101. visitChiose,
  102. visitForm: {
  103. musicGroupId: "",
  104. overview: "",
  105. purpose: "",
  106. studentId: "",
  107. type: "",
  108. visitTime: "",
  109. visitType: "",
  110. feedback: "",
  111. studentName: "",
  112. },
  113. visitRules: {
  114. overview: [{ required: true, message: "请输入学生近况" }],
  115. feedback: [{ required: true, message: "请输入家长反馈" }],
  116. visitTime: [{ required: true, message: "请输入回访时间" }],
  117. visitType: [{ required: true, message: "请选择回访类型" }],
  118. },
  119. recordVisible:false,
  120. workVisible:false
  121. };
  122. },
  123. mounted(){
  124. if(this.isMainGo){
  125. this.visitChiose = visitChiose1
  126. this.$set(this.visitForm,'visitType',['常规回访','考勤申诉'])
  127. }else{
  128. this.visitChiose = visitChiose
  129. }
  130. },
  131. computed: {
  132. userName() {
  133. return this.username || this.detail.user?.username || this.detail.realName || this.detail.userName || this.detail.studentName
  134. },
  135. studentId(){
  136. return this.detail.userId || this.detail.studentId
  137. }
  138. },
  139. methods: {
  140. submitAddVisit() {
  141. this.$refs.visitForm.validate((res) => {
  142. if (res) {
  143. const { visitType, ...rest } = this.visitForm;
  144. const data = {
  145. ...rest,
  146. objectId: this.detail.id,
  147. studentName: this.userName,
  148. musicGroupId: this.detail.musicGroupId,
  149. studentId: this.studentId,
  150. type: visitType[0],
  151. purpose: visitType[1],
  152. };
  153. addVisit(cleanDeep(data)).then((res) => {
  154. if (res.code === 200) {
  155. this.$message.success("新增成功");
  156. this.$emit("close");
  157. this.$emit("submited");
  158. }
  159. });
  160. }
  161. });
  162. },
  163. },
  164. };
  165. </script>
  166. <style lang="scss" scoped>
  167. .visitBtnWrap {
  168. position: absolute;
  169. right: 90px;
  170. top: 82px;
  171. z-index: 20;
  172. }
  173. </style>