visit.vue 5.4 KB

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