visit.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. <template>
  2. <div>
  3. <div class="visitBtnWrap">
  4. <auth auths="studentAttendance/findStudentAttendance">
  5. <el-button type="text" @click="recordVisible = true"
  6. >学员考勤</el-button
  7. >
  8. </auth>
  9. <auth
  10. :auths="[
  11. 'webCurseHomework/getStudentHomeWorks',
  12. 'extracurricularExercisesReply/queryPageList',
  13. ]"
  14. >
  15. <el-button type="text" @click="workVisible = true">训练情况</el-button>
  16. </auth>
  17. </div>
  18. <el-form
  19. :model="visitForm"
  20. label-width="120px"
  21. label-position="right"
  22. ref="visitForm"
  23. :rules="visitRules"
  24. >
  25. <el-form-item label="学生姓名">
  26. <p>{{ userName }}</p>
  27. </el-form-item>
  28. <el-form-item label="回访类型" prop="visitType">
  29. <el-cascader
  30. :disabled="isMainGo || !!useVisitType"
  31. expand-trigger="hover"
  32. clearable
  33. style="width: 80% !important"
  34. placeholder="请选择回访类型"
  35. :options="visitChiose"
  36. v-model="visitForm.visitType"
  37. @change="changeVisitType"
  38. >
  39. </el-cascader>
  40. </el-form-item>
  41. <el-form-item label="回访日期" prop="visitTime">
  42. <el-date-picker
  43. v-model.trim="visitForm.visitTime"
  44. align="right"
  45. type="date"
  46. style="width: 80% !important"
  47. placeholder="选择日期"
  48. value-format="yyyy-MM-dd"
  49. :picker-options="pickerOptions"
  50. ></el-date-picker>
  51. </el-form-item>
  52. <el-form-item label="学员情况" prop="overview">
  53. <el-input
  54. type="textarea"
  55. v-model="visitForm.overview"
  56. style="width: 80% !important"
  57. placeholder="请输入学员情况"
  58. :rows="3"
  59. maxlength="50"
  60. show-word-limit
  61. ></el-input>
  62. </el-form-item>
  63. <el-form-item
  64. label="家长反馈"
  65. prop="feedback"
  66. v-if="visitForm.visitType[0] != '小课回访'"
  67. >
  68. <el-input
  69. type="textarea"
  70. v-model="visitForm.feedback"
  71. style="width: 80% !important"
  72. placeholder="请输入家长反馈"
  73. :rows="3"
  74. maxlength="50"
  75. show-word-limit
  76. ></el-input>
  77. </el-form-item>
  78. <el-form-item
  79. label="家长反馈"
  80. prop="feedbackType"
  81. v-if="visitForm.visitType[0] == '小课回访'"
  82. :rules="[{ required: true, message: '选择家长反馈' }]"
  83. >
  84. <el-radio-group
  85. v-model="visitForm.feedbackType"
  86. @change="
  87. () => {
  88. visitForm.feedbackTypeDesc = '';
  89. }
  90. "
  91. >
  92. <el-radio-button
  93. :label="item.value"
  94. v-for="(item, index) in feedbackTypeList"
  95. :key="index"
  96. >{{ item.label }}</el-radio-button
  97. >
  98. </el-radio-group>
  99. </el-form-item>
  100. <el-form-item
  101. label="反馈详情"
  102. prop="feedbackTypeDesc"
  103. :rules="[{ required: true, message: '选择反馈详情' }]"
  104. v-if="
  105. (visitForm.feedbackType == 'THINKING' ||
  106. visitForm.feedbackType == 'LOST') &&
  107. visitForm.visitType[0] == '小课回访'
  108. "
  109. >
  110. <el-radio-group v-model="visitForm.feedbackTypeDesc">
  111. <el-radio-button
  112. :label="item.value"
  113. v-for="(item, index) in feedbackTypeDescList"
  114. :key="index"
  115. >{{ item.label }}</el-radio-button
  116. >
  117. </el-radio-group>
  118. </el-form-item>
  119. <!-- probStatus -->
  120. <el-form-item
  121. label="问题状态"
  122. prop="probStatus"
  123. :rules="[{ required: true, message: '选择问题状态' }]"
  124. >
  125. <el-radio-group v-model="visitForm.probStatus">
  126. <el-radio-button :label="1" >已解决</el-radio-button>
  127. <el-radio-button :label="0">未解决</el-radio-button>
  128. </el-radio-group>
  129. </el-form-item>
  130. <el-form-item label="回访图片">
  131. <div style="width: 80% !important">
  132. <uploadImageList :uploaded="visitForm.attachments" />
  133. </div>
  134. </el-form-item>
  135. <el-form-item
  136. label="原因"
  137. prop="feedback"
  138. :rules="[{ required: true, message: '请输入家长反馈内容' }]"
  139. v-if="visitForm.visitType[0] == '小课回访'"
  140. >
  141. <el-input
  142. type="textarea"
  143. v-model="visitForm.feedback"
  144. style="width: 80% !important"
  145. placeholder="原因"
  146. :rows="3"
  147. maxlength="50"
  148. show-word-limit
  149. ></el-input>
  150. </el-form-item>
  151. </el-form>
  152. <div
  153. slot="footer"
  154. class="dialog-footer"
  155. style="text-align: right; margin-right: 15%"
  156. >
  157. <el-button @click="$emit('close')">取 消</el-button>
  158. <el-button type="primary" @click="submitAddVisit">确 定</el-button>
  159. </div>
  160. <el-dialog
  161. title="学员考勤"
  162. width="1020px"
  163. :visible.sync="recordVisible"
  164. append-to-body
  165. v-if="recordVisible"
  166. >
  167. <record :studentId="this.detail.userId" />
  168. </el-dialog>
  169. <el-dialog
  170. v-if="workVisible"
  171. title="训练列表"
  172. width="1020px"
  173. :visible.sync="workVisible"
  174. append-to-body
  175. >
  176. <studentWork :studentId="this.detail.userId" />
  177. </el-dialog>
  178. </div>
  179. </template>
  180. <script>
  181. import cleanDeep from "clean-deep";
  182. import {
  183. visitChiose,
  184. visitChiose1,
  185. feedbackTypeList,
  186. feedbackTypeDescList,
  187. } from "@/utils/searchArray";
  188. import { addVisit } from "@/views/returnVisitManager/api";
  189. import record from "./record";
  190. import studentWork from "./studentWork";
  191. export default {
  192. // useVisitType 自定义回访类型
  193. props: ["detail", "username", "isMainGo", "useVisitType"],
  194. components: { record, studentWork },
  195. data() {
  196. return {
  197. visitChiose,
  198. feedbackTypeList,
  199. feedbackTypeDescList,
  200. visitForm: {
  201. musicGroupId: "",
  202. overview: "",
  203. purpose: "",
  204. studentId: "",
  205. type: "",
  206. visitTime: "",
  207. visitType: [],
  208. feedback: "",
  209. studentName: "",
  210. attachments: [],
  211. feedbackTypeDesc: "",
  212. feedbackType: "",
  213. probStatus:''
  214. },
  215. visitRules: {
  216. overview: [{ required: true, message: "请输入学生近况" }],
  217. feedback: [{ required: true, message: "请输入家长反馈" }],
  218. visitTime: [{ required: true, message: "请输入回访时间" }],
  219. },
  220. recordVisible: false,
  221. workVisible: false,
  222. pickerOptions: {
  223. firstDayOfWeek: 1,
  224. disabledDate(time) {
  225. return time.getTime() > new Date().getTime();
  226. },
  227. },
  228. };
  229. },
  230. mounted() {
  231. if (this.isMainGo) {
  232. this.visitChiose = visitChiose1;
  233. this.$set(this.visitForm, "visitType", ["常规回访", "考勤申诉"]);
  234. } else if (this.useVisitType) {
  235. this.visitChiose = visitChiose1;
  236. this.$set(this.visitForm, "visitType", this.useVisitType);
  237. } else {
  238. this.visitChiose = visitChiose1;
  239. }
  240. },
  241. computed: {
  242. userName() {
  243. return (
  244. this.username ||
  245. this.detail.user?.username ||
  246. this.detail.realName ||
  247. this.detail.userName ||
  248. this.detail.studentName
  249. );
  250. },
  251. studentId() {
  252. return this.detail.userId || this.detail.studentId;
  253. },
  254. isRequire() {
  255. if (
  256. this.visitForm.feedbackType == "THINKING" ||
  257. this.visitForm.feedbackType == "PENDING_PAYMENT"
  258. ) {
  259. return false;
  260. } else {
  261. return true;
  262. }
  263. },
  264. },
  265. methods: {
  266. submitAddVisit() {
  267. this.$refs.visitForm.validate((res) => {
  268. if (res) {
  269. const { visitType, ...rest } = this.visitForm;
  270. let attachmentsList = this.visitForm.attachments.map((item) => {
  271. return item.url;
  272. });
  273. const data = {
  274. ...rest,
  275. objectId: this.detail.id,
  276. studentName: this.userName,
  277. musicGroupId: this.detail.musicGroupId,
  278. studentId: this.studentId,
  279. type: visitType[0],
  280. purpose: visitType[1],
  281. attachments: attachmentsList.join(","),
  282. };
  283. addVisit(cleanDeep(data)).then((res) => {
  284. if (res.code === 200) {
  285. this.$message.success("保存成功");
  286. this.$emit("close");
  287. this.$emit("submited");
  288. }
  289. });
  290. }
  291. });
  292. },
  293. changeVisitType(val) {
  294. console.log(this.visitForm.visitType);
  295. this.visitForm.feedback = "";
  296. this.visitForm.feedbackTypeDesc = "";
  297. this.visitForm.feedbackType = "";
  298. },
  299. },
  300. };
  301. </script>
  302. <style lang="scss" scoped>
  303. .visitBtnWrap {
  304. position: absolute;
  305. right: 90px;
  306. top: 82px;
  307. z-index: 20;
  308. }
  309. </style>