<template>
  <div class="app-container">
    <el-tabs type="border-card">
      <el-tab-pane label="月度反馈">
        <!-- 搜索栏 -->
        <!-- <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch">
          <el-form-item label="年" prop="feedbackYear"  label-width="35px">
            <el-input
              v-model="queryParams.feedbackYear"
              placeholder="请输入年"
              clearable
              size="small"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item label="月" prop="feedbackMonth"  label-width="35px">
            <el-input
              v-model="queryParams.feedbackMonth"
              placeholder="请输入月"
              clearable
              size="small"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item label="学员编号" prop="successorId" label-width="80px">
            <el-input
              v-model="queryParams.successorId"
              placeholder="请输入学员编号"
              clearable
              size="small"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item>
            <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="refresh()">刷新</el-button>
          </el-form-item>
        </el-form> -->
        <!-- 列表 -->
        <el-table
          :span-method="spanMethod"
          v-loading="loading"
          :data="feedbackList"
          @selection-change="handleSelectionChange"
          ref="feedbackListTable"
          :height="clientHeight"
          border
          :cell-style="tableCellStyle"
        >
          <el-table-column label="学员" width="80" align="center" :show-overflow-tooltip="true" prop="staffName"/>
          <el-table-column label="时间" align="center" :show-overflow-tooltip="true" width="120">
            <template slot-scope="scope">
              <span>{{scope.row.feedbackYear}}年{{scope.row.feedbackMonth}}月</span>
            </template>
          </el-table-column>
          <el-table-column label="培养内容" align="center" :show-overflow-tooltip="true" prop="plantName"/>
          <el-table-column label="开始日期" align="center" :show-overflow-tooltip="true" width="120" prop="startDate"/>
          <el-table-column label="结束日期" align="center" :show-overflow-tooltip="true" width="120" prop="endDate"/>
          <el-table-column label="实际完成日期" align="center" :show-overflow-tooltip="true" width="120" prop="dateOfCompletion"/>
          <el-table-column label="学习状态" align="center" :show-overflow-tooltip="true" width="120" prop="studyState" :formatter="studyStateFormat"/>
          <el-table-column label="学员反馈" align="center" prop="successorFeedback" :show-overflow-tooltip="true"/>
          <el-table-column label="导师反馈" align="center" prop="mentorFeedback" :show-overflow-tooltip="true"/>
          <el-table-column label="操作" align="center" fixed="right" width="120" class-name="small-padding fixed-width">
            <template slot-scope="scope">
              <el-button
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="handleUpdate(scope.row)"
                v-hasPermi="['spec:feedback:edit']"
                v-if="scope.row.mentorFeedback==null"
              >反馈</el-button>
              <el-button
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="handleUpdate(scope.row)"
                v-hasPermi="['spec:feedback:edit']"
                v-if="scope.row.mentorFeedback!=null"
              >修改</el-button>
            </template>
          </el-table-column>
        </el-table>
        <!-- 分页 -->
        <pagination
          v-show="total>0"
          :total="total"
          :page.sync="queryParams.pageNum"
          :limit.sync="queryParams.pageSize"
          @pagination="getList"
        />
        <!-- 添加或修改对话框 -->
        <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
          <el-form ref="form" :model="form" :rules="rules">
            <el-form-item prop="successorFeedback">
              <el-input type="textarea" rows="6" v-model="form.mentorFeedback" placeholder="请输入反馈内容" />
            </el-form-item>
          </el-form>
          <div slot="footer" class="dialog-footer">
            <el-button type="primary" @click="submitForm">确 定</el-button>
            <el-button @click="cancel">取 消</el-button>
          </div>
        </el-dialog>
      </el-tab-pane>
      <el-tab-pane label="季度反馈">
        <!-- 搜索栏 -->
        <!-- <el-form :model="queryParams2" ref="queryForm2" :inline="true" v-show="showSearch">
          <el-form-item label="年" prop="feedbackYear"  label-width="35px">
            <el-input
              v-model="queryParams2.feedbackYear"
              placeholder="请输入年"
              clearable
              size="small"
              @keyup.enter.native="handleQuery2"
            />
          </el-form-item>
          <el-form-item label="季度" prop="feedbackSeason">
            <el-input
              v-model="queryParams2.feedbackSeason"
              placeholder="请输入季度"
              clearable
              size="small"
              @keyup.enter.native="handleQuery2"
              label-width="50px"
            />
          </el-form-item>
          <el-form-item label="学员编号" prop="feedbackMonth" label-width="80px">
            <el-input
              v-model="queryParams2.successorId"
              placeholder="请输入学员编号"
              clearable
              size="small"
              @keyup.enter.native="handleQuery2"
            />
          </el-form-item>
          <el-form-item>
            <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery2">搜索</el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery2">重置</el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="refresh2()">刷新</el-button>
          </el-form-item>
        </el-form> -->
        <!-- 列表 -->
        <el-table
          :span-method="spanMethod2"
          v-loading="loading"
          :data="feedbackListSeasonal"
          @selection-change="handleSelectionChange"
          :height="clientHeight"
          ref="feedbackListSeasonalTable"
          border
          :cell-style="tableCellStyle"
        >
          <el-table-column label="学员" width="80" align="center" :show-overflow-tooltip="true" prop="staffName"/>
          <el-table-column label="时间" align="center" :show-overflow-tooltip="true" width="200">
            <template slot-scope="scope">
              <span>{{scope.row.feedbackYear}}年{{scope.row.feedbackSeason}}季度</span>
            </template>
          </el-table-column>
          <el-table-column label="培养内容" align="center" :show-overflow-tooltip="true" prop="plantName"/>
          <el-table-column label="开始日期" align="center" :show-overflow-tooltip="true" width="120" prop="startDate"/>
          <el-table-column label="结束日期" align="center" :show-overflow-tooltip="true" width="120" prop="endDate"/>
          <el-table-column label="实际完成日期" align="center" :show-overflow-tooltip="true" width="120" prop="dateOfCompletion"/>
          <el-table-column label="学习状态" align="center" :show-overflow-tooltip="true" width="120" prop="studyState" :formatter="studyStateFormat"/>
          <el-table-column label="导师反馈" align="center" prop="mentorFeedback" :show-overflow-tooltip="true"/>
          <el-table-column label="操作" align="center" fixed="right" width="120" class-name="small-padding fixed-width">
            <template slot-scope="scope">
              <el-button
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="handleUpdate2(scope.row)"
                v-hasPermi="['spec:feedback:edit']"
                v-if="scope.row.mentorFeedback==null"
              >反馈</el-button>
              <el-button
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="handleUpdate2(scope.row)"
                v-hasPermi="['spec:feedback:edit']"
                v-if="scope.row.mentorFeedback!=null"
              >修改</el-button>
            </template>
          </el-table-column>
        </el-table>
        <!-- 分页 -->
        <!-- <pagination
          v-show="total>0"
          :total="total"
          :page.sync="queryParams.pageNum"
          :limit.sync="queryParams.pageSize"
          @pagination="getList"
        /> -->
        <!-- 添加或修改对话框 -->
        <el-dialog :title="title2" :visible.sync="open2" width="500px" append-to-body>
          <!-- <el-row>
            <span>问卷调查问题</span>
          </el-row>
          <el-row>
            <el-checkbox v-model="checked">备选项</el-checkbox>
            <el-checkbox v-model="checked">备选项</el-checkbox>
            <el-checkbox v-model="checked">备选项</el-checkbox>
            <el-checkbox v-model="checked">备选项</el-checkbox>
            <el-checkbox v-model="checked">备选项</el-checkbox>
          </el-row> -->
          <el-form ref="form" :model="form2" :rules="rules">
            <el-form-item prop="successorFeedback">
              <el-input type="textarea" rows="6" v-model="form.mentorFeedback" placeholder="请输入反馈内容" />
            </el-form-item>
          </el-form>
          <div slot="footer" class="dialog-footer">
            <el-button type="primary" @click="submitForm">确 定</el-button>
            <el-button @click="cancel">取 消</el-button>
          </div>
        </el-dialog>
        <!-- 报告附件对话框 -->
        <el-dialog v-dialogDrag :title="doc.title" :visible.sync="doc.open" width="700px" append-to-body>
            <el-table :data="doc.commonfileList" border>
              <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
                <template slot-scope="scope">
                  <a  class="link-type"  @click="handleDownload(scope.row)">
                    <span>{{ scope.row.fileName }}</span>
                  </a>
                </template>
              </el-table-column>
              <el-table-column :label="$t('大小(Kb)')" align="center" prop="fileSize" :show-overflow-tooltip="true" width="80" />
              <el-table-column :label="$t('上传人')" align="center" prop="creator" :show-overflow-tooltip="true" width="120"/>
              <el-table-column :label="$t('操作')" align="center" width="120" class-name="small-padding fixed-width">
                <template slot-scope="scope">
                  <el-button
                    v-if="scope.row.fileName.endsWith('pdf')"
                    size="mini"
                    type="text"
                    icon="el-icon-view"
                    @click="handleSee(scope.row)"
                  >{{ $t('预览') }}</el-button>
                  <el-button
                    size="mini"
                    type="text"
                    icon="el-icon-download"
                    @click="handleDownload(scope.row)"
                  >{{ $t('下载') }}</el-button>
                  <el-button
                    size="mini"
                    type="text"
                    icon="el-icon-delete"
                    @click="handleDeleteDoc(scope.row)"
                  >{{ $t('删除') }}</el-button>
                </template>
              </el-table-column>
            </el-table>
            <el-dialog v-dialogDrag :title="pdf.title" :visible.sync="pdf.open" width="1300px" append-to-body>
              <div style="margin-top: -60px;float: right;margin-right: 40px;">
                <el-button size="mini" type="text" @click="openPdf">{{$t('新页面打开PDF')}}</el-button></div>
              <div style="margin-top: -30px">
                <iframe :src="pdf.pdfUrl" frameborder="0" width="100%" height="700px"></iframe>
              </div>
            </el-dialog>
            <div slot="footer" class="dialog-footer">
              <el-button @click="doc.open = false">{{ $t('返 回') }}</el-button>
            </div>
        </el-dialog>
      </el-tab-pane>
      <el-tab-pane label="受邀反馈"></el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import { listMentorMonthlyFeedback, listMentorSeasonalFeedback, getFeedback, delFeedback, addFeedback, updateFeedback, exportFeedback, importTemplate} from "@/api/training/spec/feedback";
import { treeselect } from "@/api/system/dept";
import { getToken } from "@/utils/auth";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";

export default {
  name: "Feedback",
  components: { Treeselect },
  data() {
    return {
      // 学习状态字典
      studyStateOptions: [],
      // 复选框是否选中
      checked:false,
      // 标签页选中项
      activeName: 'first',
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      //  专项培养反馈表格数据
      feedbackList: [],
      //  专项培养季度反馈表格数据
      feedbackListSeasonal: [],
      // 弹出层标题
      title: "",
      title2: "",
      // 部门树选项
      deptOptions: undefined,
      clientHeight:300,
      // 是否显示弹出层
      open: false,
      open2: false,
        // 用户导入参数
        upload: {
            // 是否显示弹出层（用户导入）
            open: false,
            // 弹出层标题（用户导入）
            title: "",
            // 是否禁用上传
            isUploading: false,
            // 是否更新已经存在的用户数据
            updateSupport: 0,
            // 设置上传的请求头部
            headers: { Authorization: "Bearer " + getToken() },
            // 上传的地址
            url: process.env.VUE_APP_BASE_API + "/spec/feedback/importData"
        },
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 1000,
        feedbackType: null,
        mentorId: null,
        successorId: null,
        parentId: null,
        planId: null,
        feedbackYear: null,
        feedbackSeason: null,
        feedbackMonth: null,
        successorFeedback: null,
        mentorFeedback: null,
        feedbackScore: null,
        feedbackStatus: null,
        meetingDate: null
      },
      queryParams2: {
        pageNum: 1,
        pageSize: 1000,
        feedbackType: null,
        mentorId: null,
        successorId: null,
        parentId: null,
        planId: null,
        feedbackYear: null,
        feedbackSeason: null,
        feedbackMonth: null,
        successorFeedback: null,
        mentorFeedback: null,
        feedbackScore: null,
        feedbackStatus: null,
        meetingDate: null
      },
      // 表单参数
      form: {},
      form2: {},
      // 表单校验
      rules: {
      },
      //合并单元格参数
      spanArr: [],
      spanArr2: [],
      // 报告附件参数
      doc: {
        file: "",
        // 是否显示弹出层（报告附件）
        open: false,
        open2: false,
        // 弹出层标题（报告附件）
        title: "",
        // 是否禁用上传
        isUploading: false,
        // 是否更新已经存在的用户数据
        updateSupport: 0,
        // 报告附件上传位置编号
        ids: 0,
        // 设置上传的请求头部
        headers: { Authorization: "Bearer " + getToken() },
        // 上传的地址
        url: process.env.VUE_APP_BASE_API + "/common/commonfile/uploadFile",
        commonfileList: null,
        queryParams: {
          pId: null,
          pType: 'plan'
        },
        pType: 'plan',
        pId: null
      },
      // pdf文件参数
      pdf : {
          title: '',
          pdfUrl: '',
          numPages: null,
          open: false,
          pageNum: 1,
          pageTotalNum: 1,
          loadedRatio: 0,
      },
    };
  },
  watch: {
        // 根据名称筛选部门树
        deptName(val) {
            this.$refs.tree.filter(val);
        }
   },
  created() {
      //设置表格高度对应屏幕高度
      this.$nextTick(() => {
          this.clientHeight = document.body.clientHeight -250
      })
    this.getDicts("st_study_state").then(response => {
      this.studyStateOptions = response.data;
    });
    this.getList();
    this.getListSeasonal();
    this.getTreeselect();
  },
  methods: {
    // 单元格样式
    tableCellStyle (row, column, rowIndex, columnIndex) {
      if (row.column.label === "实际完成培养日期" && row.row.dateOfCompletion > row.row.endDate) {
        return "background: #FFEEEE"
      }
    },
    /** 学习状态字典翻译 */
    studyStateFormat(row, column) {
      return this.selectDictLabel(this.studyStateOptions, row.studyState);
    },
    // 合并单元格
    spanMethod({ row, column, rowIndex, columnIndex }) {
      // 按月合并单元格
      if (columnIndex === 1 || columnIndex === 7 || columnIndex === 8 || columnIndex === 9) {
        if (row.isFirstLine == 1) {
          return {
            rowspan: row.rowspan,
            colspan: 1
          };
        } else {
          return {
            rowspan: 0,
            colspan: 0
          };
        }
      }
      // 按人合并单元格
      if (columnIndex === 0) {
        if(this.spanArr[rowIndex]){
          return {
            rowspan:this.spanArr[rowIndex],
            colspan:1
          }
        }else{
          return {
            rowspan: 0,
            colspan: 0
          }
        }
      }
    },
    spanMethod2({ row, column, rowIndex, columnIndex }) {
      // 按月合并单元格
      if (columnIndex === 1 || columnIndex === 7 || columnIndex === 8 || columnIndex === 9) {
        if (row.isFirstLine == 1) {
          return {
            rowspan: row.rowspan,
            colspan: 1
          };
        } else {
          return {
            rowspan: 0,
            colspan: 0
          };
        }
      }
      // 按人合并单元格
      if (columnIndex === 0) {
        if(this.spanArr2[rowIndex]){
          return {
            rowspan:this.spanArr2[rowIndex],
            colspan:1
          }
        }else{
          return {
            rowspan: 0,
            colspan: 0
          }
        }
      }
    },
    // 刷新
    refresh() {
      // 保留检索条件
      this.getList(this.form);
    },
    refresh2() {
      // 保留检索条件
      this.getListSeasonal(this.form2);
    },
    // 标签页切换
    handleClick(tab, event) {
        console.log(tab, event);
      },
    /** 查询 专项培养反馈列表 */
    getList() {
      this.loading = true;
      this.spanArr = []
      this.feedbackList = []
      listMentorMonthlyFeedback(this.queryParams).then(response => {
        let dataList = [];
        let responseRows = response.rows;
        let rowCount = 0;
        for (let i = 0; i < responseRows.length; i++) {
          let planList = responseRows[i].planList;
          for (let j = 0; j < planList.length; j++) {
            rowCount = rowCount + 1;
            let data = {...planList[j]};
            data.id = responseRows[i].id;
            data.feedbackStatus = responseRows[i].feedbackStatus;
            data.feedbackYear = responseRows[i].feedbackYear;
            data.feedbackMonth = responseRows[i].feedbackMonth;
            data.mentorFeedback = responseRows[i].mentorFeedback;
            data.successorFeedback = responseRows[i].successorFeedback;
            data.successorId = responseRows[i].successorId;
            if (j == 0) { // 第一条计划
              data.isFirstLine = 1;
              data.rowspan = planList.length;
            } else {
              data.isFirstLine = 0;
            }
            dataList.push(data);
          }
        }
        let contactDot = 0;
        for (let i = 0; i < dataList.length; i++) {
          if (i == 0) {
            this.spanArr.push(1);
          } else {
                if(dataList[i].successorId === dataList[i-1].successorId){
                    this.spanArr[contactDot] += 1;
                    this.spanArr.push(0);
                }else{
                    contactDot = i;
                    this.spanArr.push(1);
                }
          }
        }
        this.$nextTick(() => {
          this.feedbackList = dataList;
          this.total = response.total;
          this.$refs.feedbackListTable.doLayout(); // 解决表格错位
        });
        this.loading = false;
      });
    },
    /** 查询 专项培养季度反馈列表 */
    getListSeasonal() {
      this.loading = true;
      this.spanArr2 = []
      this.feedbackListSeasonal = []
      listMentorSeasonalFeedback(this.queryParams).then(response => {
        let dataList = [];
        let responseRows = response.rows;
        let rowCount = 0;
        for (let i = 0; i < responseRows.length; i++) {
          let planList = responseRows[i].planList;
          for (let j = 0; j < planList.length; j++) {
            rowCount = rowCount + 1;
            let data = {...planList[j]};
            data.id = responseRows[i].id;
            data.feedbackStatus = responseRows[i].feedbackStatus;
            data.feedbackYear = responseRows[i].feedbackYear;
            data.feedbackSeason = responseRows[i].feedbackSeason;
            data.mentorFeedback = responseRows[i].mentorFeedback;
            data.successorFeedback = responseRows[i].successorFeedback;
            data.successorId = responseRows[i].successorId;
            if (j == 0) { // 第一条计划
              data.isFirstLine = 1;
              data.rowspan = planList.length;
            } else {
              data.isFirstLine = 0;
            }
            dataList.push(data);
          }
        }
        let contactDot = 0;
        for (let i = 0; i < dataList.length; i++) {
          if (i == 0) {
            this.spanArr2.push(1);
          } else {
                if(dataList[i].successorId === dataList[i-1].successorId){
                    this.spanArr2[contactDot] += 1;
                    this.spanArr2.push(0);
                }else{
                    contactDot = i;
                    this.spanArr2.push(1);
                }
          }
        }
        this.$nextTick(() => {
          this.feedbackListSeasonal = dataList;
          this.total = response.total;
          this.$refs.feedbackListSeasonalTable.doLayout(); // 解决表格错位
        });
        this.loading = false;
      });
    },
    /** 文件下载处理 */
    handleDownload(row) {
      var name = row.fileName;
      var url = row.fileUrl;
      var suffix = url.substring(url.lastIndexOf("."), url.length);
      const a = document.createElement('a')
      a.setAttribute('download', name)
      a.setAttribute('target', '_blank')
      a.setAttribute('href', process.env.VUE_APP_BASE_API + url)
      a.click()
    },
    openPdf(){
      window.open(this.pdf.pdfUrl);//path是文件的全路径地址
    },
    handleSee (row){
      this.pdf.open =true
      this.pdf.title = row.fileName
      this.pdf.pdfUrl = process.env.VUE_APP_BASE_API +'/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl
    },
    /** 报告附件按钮操作 */
    handleDoc(row) {
      this.doc.id = row.id;
      this.doc.title = row.feedbackYear + "年" + row.feedbackSeason + "季度" + this.$t('学习汇报附件');
      this.doc.open = true;
      this.doc.queryParams.pId = row.id
      this.doc.pId = row.id
      this.getFileList()
      this.$nextTick(() => {
        this.$refs.doc.clearFiles()
      })
    },
    getFileList (){
      allFileList(this.doc.queryParams).then(response => {
        this.doc.commonfileList = response;
      });
    },
    /** 附件上传中处理 */
    handleFileDocProgress(event, file, fileList) {
      this.doc.file = file;
      this.doc.isUploading = true;
    },
    /** 附件上传成功处理 */
    handleFileDocSuccess(response, file, fileList) {
      this.doc.isUploading = false;
      this.$alert(response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
      this.getFileList()
    },
     /** 查询部门下拉树结构 */
     getTreeselect() {
          treeselect().then(response => {
              this.deptOptions = response.data;
          });
     },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        feedbackType: null,
        mentorId: null,
        successorId: null,
        parentId: null,
        planId: null,
        feedbackYear: null,
        feedbackSeason: null,
        feedbackMonth: null,
        successorFeedback: null,
        mentorFeedback: null,
        feedbackScore: null,
        feedbackStatus: 0,
        meetingDate: null
      };
      this.resetForm("form");
    },
    reset2() {
      this.form2 = {
        id: null,
        feedbackType: null,
        mentorId: null,
        successorId: null,
        parentId: null,
        planId: null,
        feedbackYear: null,
        feedbackSeason: null,
        feedbackMonth: null,
        successorFeedback: null,
        mentorFeedback: null,
        feedbackScore: null,
        feedbackStatus: 0,
        meetingDate: null
      };
      this.resetForm("form2");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    handleQuery2() {
      this.queryParams2.pageNum = 1;
      this.getListSeasonal();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    resetQuery2() {
      this.resetForm("queryForm2");
      this.handleQuery2();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加 专项培养反馈";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getFeedback(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "导师反馈（" + row.feedbackYear + "年" + row.feedbackMonth + "月）";
      });
    },
    handleUpdate2(row) {
      this.reset();
      const id = row.id || this.ids
      getFeedback(id).then(response => {
        this.form2 = response.data;
        this.open2 = true;
        this.title2 = "导师反馈（" + row.feedbackYear + "年" + row.feedbackSeason + "季度）";
      });
    },
    /** 提交操作 */
    handleSubmit(row) {
      this.reset();
      const id = row.id || this.ids
      getFeedback(id).then(response => {
        this.form = response.data;
        this.form.feedbackStatus = 1;
        updateFeedback(this.form).then(response => {
              this.msgSuccess("提交成功");
              this.open = false;
              this.getList();
            });
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateFeedback(this.form).then(response => {
              this.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addFeedback(this.form).then(response => {
              this.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$confirm('是否确认删除?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return delFeedback(ids);
        }).then(() => {
          this.getList();
          this.msgSuccess("删除成功");
        })
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm('是否确认导出所有 专项培养反馈数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return exportFeedback(queryParams);
        }).then(response => {
          this.download(response.msg);
        })
    },
      /** 导入按钮操作 */
      handleImport() {
          this.upload.title = "用户导入";
          this.upload.open = true;
      },
      /** 下载模板操作 */
      importTemplate() {
          importTemplate().then(response => {
              this.download(response.msg);
          });
      },
      // 文件上传中处理
      handleFileUploadProgress(event, file, fileList) {
          this.upload.isUploading = true;
      },
      // 文件上传成功处理
      handleFileSuccess(response, file, fileList) {
          this.upload.open = false;
          this.upload.isUploading = false;
          this.$refs.upload.clearFiles();
          this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
          this.getList();
      },
      // 提交上传文件
      submitFileForm() {
          this.$refs.upload.submit();
      }
  }
};
</script>
