123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311 |
- <template>
- <div>
- <div class="visitBtnWrap">
- <auth auths="studentAttendance/findStudentAttendance">
- <el-button type="text" @click="recordVisible = true"
- >学员考勤</el-button
- >
- </auth>
- <auth
- :auths="[
- 'webCurseHomework/getStudentHomeWorks',
- 'extracurricularExercisesReply/queryPageList',
- ]"
- >
- <el-button type="text" @click="workVisible = true">训练情况</el-button>
- </auth>
- </div>
- <el-form
- :model="visitForm"
- label-width="120px"
- label-position="right"
- ref="visitForm"
- :rules="visitRules"
- >
- <el-form-item label="学生姓名">
- <p>{{ userName }}</p>
- </el-form-item>
- <el-form-item label="回访类型" prop="visitType">
- <el-cascader
- :disabled="isMainGo || !!useVisitType"
- expand-trigger="hover"
- clearable
- style="width: 80% !important"
- placeholder="请选择回访类型"
- :options="visitChiose"
- v-model="visitForm.visitType"
- @change="changeVisitType"
- >
- </el-cascader>
- </el-form-item>
- <el-form-item label="回访日期" prop="visitTime">
- <el-date-picker
- v-model.trim="visitForm.visitTime"
- align="right"
- type="date"
- style="width: 80% !important"
- placeholder="选择日期"
- value-format="yyyy-MM-dd"
- :picker-options="pickerOptions"
- ></el-date-picker>
- </el-form-item>
- <el-form-item label="学员情况" prop="overview">
- <el-input
- type="textarea"
- v-model="visitForm.overview"
- style="width: 80% !important"
- placeholder="请输入学员情况"
- :rows="3"
- maxlength="50"
- show-word-limit
- ></el-input>
- </el-form-item>
- <el-form-item
- label="家长反馈"
- prop="feedback"
- v-if="visitForm.visitType[0] != '小课回访'"
- >
- <el-input
- type="textarea"
- v-model="visitForm.feedback"
- style="width: 80% !important"
- placeholder="请输入家长反馈"
- :rows="3"
- maxlength="50"
- show-word-limit
- ></el-input>
- </el-form-item>
- <el-form-item
- label="家长反馈"
- prop="feedbackType"
- v-if="visitForm.visitType[0] == '小课回访'"
- :rules="[{ required: true, message: '选择家长反馈' }]"
- >
- <el-radio-group
- v-model="visitForm.feedbackType"
- @change="
- () => {
- visitForm.feedbackTypeDesc = '';
- }
- "
- >
- <el-radio-button
- :label="item.value"
- v-for="(item, index) in feedbackTypeList"
- :key="index"
- >{{ item.label }}</el-radio-button
- >
- </el-radio-group>
- </el-form-item>
- <el-form-item
- label="反馈详情"
- prop="feedbackTypeDesc"
- :rules="[{ required: true, message: '选择反馈详情' }]"
- v-if="
- (visitForm.feedbackType == 'THINKING' ||
- visitForm.feedbackType == 'LOST') &&
- visitForm.visitType[0] == '小课回访'
- "
- >
- <el-radio-group v-model="visitForm.feedbackTypeDesc">
- <el-radio-button
- :label="item.value"
- v-for="(item, index) in feedbackTypeDescList"
- :key="index"
- >{{ item.label }}</el-radio-button
- >
- </el-radio-group>
- </el-form-item>
- <!-- probStatus -->
- <el-form-item
- label="问题状态"
- prop="probStatus"
- :rules="[{ required: true, message: '选择问题状态' }]"
- >
- <el-radio-group v-model="visitForm.probStatus">
- <el-radio-button :label="1" >已解决</el-radio-button>
- <el-radio-button :label="0">未解决</el-radio-button>
- </el-radio-group>
- </el-form-item>
- <el-form-item label="回访图片">
- <div style="width: 80% !important">
- <uploadImageList :uploaded="visitForm.attachments" />
- </div>
- </el-form-item>
- <el-form-item
- label="原因"
- prop="feedback"
- :rules="[{ required: true, message: '请输入家长反馈内容' }]"
- v-if="visitForm.visitType[0] == '小课回访'"
- >
- <el-input
- type="textarea"
- v-model="visitForm.feedback"
- style="width: 80% !important"
- placeholder="原因"
- :rows="3"
- maxlength="50"
- show-word-limit
- ></el-input>
- </el-form-item>
- </el-form>
- <div
- slot="footer"
- class="dialog-footer"
- style="text-align: right; margin-right: 15%"
- >
- <el-button @click="$emit('close')">取 消</el-button>
- <el-button type="primary" @click="submitAddVisit">确 定</el-button>
- </div>
- <el-dialog
- title="学员考勤"
- width="1020px"
- :visible.sync="recordVisible"
- append-to-body
- v-if="recordVisible"
- >
- <record :studentId="this.detail.userId" />
- </el-dialog>
- <el-dialog
- v-if="workVisible"
- title="训练列表"
- width="1020px"
- :visible.sync="workVisible"
- append-to-body
- >
- <studentWork :studentId="this.detail.userId" />
- </el-dialog>
- </div>
- </template>
- <script>
- import cleanDeep from "clean-deep";
- import {
- visitChiose,
- visitChiose1,
- feedbackTypeList,
- feedbackTypeDescList,
- } from "@/utils/searchArray";
- import { addVisit } from "@/views/returnVisitManager/api";
- import record from "./record";
- import studentWork from "./studentWork";
- export default {
- // useVisitType 自定义回访类型
- props: ["detail", "username", "isMainGo", "useVisitType"],
- components: { record, studentWork },
- data() {
- return {
- visitChiose,
- feedbackTypeList,
- feedbackTypeDescList,
- visitForm: {
- musicGroupId: "",
- overview: "",
- purpose: "",
- studentId: "",
- type: "",
- visitTime: "",
- visitType: [],
- feedback: "",
- studentName: "",
- attachments: [],
- feedbackTypeDesc: "",
- feedbackType: "",
- probStatus:''
- },
- visitRules: {
- overview: [{ required: true, message: "请输入学生近况" }],
- feedback: [{ required: true, message: "请输入家长反馈" }],
- visitTime: [{ required: true, message: "请输入回访时间" }],
- },
- recordVisible: false,
- workVisible: false,
- pickerOptions: {
- firstDayOfWeek: 1,
- disabledDate(time) {
- return time.getTime() > new Date().getTime();
- },
- },
- };
- },
- mounted() {
- if (this.isMainGo) {
- this.visitChiose = visitChiose1;
- this.$set(this.visitForm, "visitType", ["常规回访", "考勤申诉"]);
- } else if (this.useVisitType) {
- this.visitChiose = visitChiose1;
- this.$set(this.visitForm, "visitType", this.useVisitType);
- } else {
- this.visitChiose = visitChiose1;
- }
- },
- computed: {
- userName() {
- return (
- this.username ||
- this.detail.user?.username ||
- this.detail.realName ||
- this.detail.userName ||
- this.detail.studentName
- );
- },
- studentId() {
- return this.detail.userId || this.detail.studentId;
- },
- isRequire() {
- if (
- this.visitForm.feedbackType == "THINKING" ||
- this.visitForm.feedbackType == "PENDING_PAYMENT"
- ) {
- return false;
- } else {
- return true;
- }
- },
- },
- methods: {
- submitAddVisit() {
- this.$refs.visitForm.validate((res) => {
- if (res) {
- const { visitType, ...rest } = this.visitForm;
- let attachmentsList = this.visitForm.attachments.map((item) => {
- return item.url;
- });
- const data = {
- ...rest,
- objectId: this.detail.id,
- studentName: this.userName,
- musicGroupId: this.detail.musicGroupId,
- studentId: this.studentId,
- type: visitType[0],
- purpose: visitType[1],
- attachments: attachmentsList.join(","),
- };
- addVisit(cleanDeep(data)).then((res) => {
- if (res.code === 200) {
- this.$message.success("保存成功");
- this.$emit("close");
- this.$emit("submited");
- }
- });
- }
- });
- },
- changeVisitType(val) {
- console.log(this.visitForm.visitType);
- this.visitForm.feedback = "";
- this.visitForm.feedbackTypeDesc = "";
- this.visitForm.feedbackType = "";
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .visitBtnWrap {
- position: absolute;
- right: 90px;
- top: 82px;
- z-index: 20;
- }
- </style>
|