<template>
  <div class="container">
    <fullscreen :fullscreen.sync="fullscreen" class="container-box">
      <div class="titbox">
        <h2>投诉处理工单反馈</h2>
        <div>
          <i class="el-icon-refresh" @click="iconCli(1)"></i>
          <i class="el-icon-full-screen" @click="iconCli(2)"></i>
          <!--                    <i class="el-icon-folder-opened"></i>-->
          <!--                    <i class="el-icon-view"></i>-->
          <!--                    <i class="el-icon-more"></i>-->
        </div>
      </div>
      <div class="search">
        <mySearch :searchList="searchList" @searchInfo="searchInfo"></mySearch>
      </div>
      <div class="tabbox">
        <el-table
          height="calc(100% - 40px)"
          v-loading="loading"
          class="com-table"
          ref="multipleTable"
          :data="tableData"
          tooltip-effect="dark"
          size="small"
          border
          style="width: 100%"
        >
          <el-table-column
            align="center"
            prop="bizCode"
            label="返回码"
            show-overflow-tooltip
          >
          </el-table-column>
          <el-table-column
            align="center"
            prop="bizDesc"
            show-overflow-tooltip
            label="返回信息描述"
          >
          </el-table-column>
        </el-table>
        <el-pagination
          class="pageBox"
          @current-change="currchange"
          layout="prev, pager, next"
          background
          :total="total"
        >
        </el-pagination>
      </div>
    </fullscreen>
  </div>
</template>
<script>
import mySearch from "../../../components/search";

export default {
  components: {
    mySearch,
  },
  data() {
    return {
      fullscreen: false,
      total: 0,
      pageSize: 1,
      tableData: [],
      searchList: [
        {
          type: "input",
          tit: "投诉单号",
          value: "",
          width: "32%",
          options: [],
        },
        {
          type: "input",
          tit: "处理人",
          value: "",
          width: "32%",
          options: [],
        },
        {
          type: "input",
          tit: "处理人工号",
          value: "",
          width: "32%",
          options: [],
        },
        {
          type: "datetime",
          tit: "处理时间",
          value: "",
          width: "32%",
          options: [],
        },
        {
          type: "input",
          tit: "处理内容",
          value: "",
          width: "32%",
          options: [],
        },
      ],
      params: {
        complaintWOID: "",
        handleTime: "",
        rspDescription: "",
        staffNO: "",
        staffName: "",
      },
      loading: false,
    };
  },
  methods: {
    //搜索数据
    searchInfo(v) {
      this.params = {};
      v[0] ? (this.params.complaintWOID = v[0]) : "";
      this.getList(this.params, this.pageSize);
    },
    //获取列表
    getList(v, n) {
      this.loading = true;
      this.pageSize = n;
      this.$http({
        url: "/compvis/cpv/complaintWoFeedback",
        method: "post",
        headers: {
          "Content-Type": "application/json",
          page: '{"pageNo":"' + n + '","pageSize":"10"}',
        },
        data: v,
      }).then((res) => {
        this.loading = false;
        this.tableData = res.data.data;
        this.total = res.data.totalRecord;
      });
    },
    //功能栏
    iconCli(v) {
      if (v === 1) {
        this.getList(this.params, this.pageSize);
      }
      if (v === 2) {
        this.fullscreen = !this.fullscreen;
      }
    },
    // 分页
    currchange(v) {
      this.pageSize = v;
      this.getList(this.params, this.pageSize);
    },
  },
  mounted() {
    if (this.$route.params.complaintWOID) {
      this.searchList[0].value = this.$route.params.complaintWOID;
      this.searchList[2].value = this.$route.params.staffNO;
      this.searchList[3].value = this.$route.params.handleTime;
      this.params.complaintWOID = this.$route.params.complaintWOID;
      this.params.handleTime = this.$route.params.handleTime;
      this.params.staffNO = this.$route.params.staffNO;
      this.getList(this.params, this.pageSize);
    } else {
      this.searchList[0].value = "";
      this.searchList[2].value = "";
      this.searchList[3].value = "";
      this.params.complaintWOID = "";
      this.params.handleTime = "";
      this.params.staffNO = "";
    }
    this.getList(this.params, this.pageSize);
  },
  created() {},
  watch: {
    $route(to, from) {
      if (from.name == "complaintQuery" && this.$route.params.complaintWOID) {
        this.searchList[0].value = this.$route.params.complaintWOID;
        this.searchList[2].value = this.$route.params.staffNO;
        this.searchList[3].value = this.$route.params.handleTime;
        this.params.complaintWOID = this.$route.params.complaintWOID;
        this.params.handleTime = this.$route.params.handleTime;
        this.params.staffNO = this.$route.params.staffNO;
        this.getList(this.params, this.pageSize);
      } else {
        this.searchList[0].value = "";
        this.searchList[2].value = "";
        this.searchList[3].value = "";
        this.params.complaintWOID = "";
        this.params.handleTime = "";
        this.params.staffNO = "";
      }
    },
  },
};
</script>
<style>
.el-input__suffix {
  cursor: pointer;
}
</style>
<style scoped lang="scss">
.titbox {
  div {
    float: right;

    i {
      font-size: 22px;
      margin-left: 20px;
      cursor: pointer;
    }
  }
}

.tabbox {
  margin-top: 15px;
}

.pageBox {
  text-align: right;
  margin-top: 10px;
}
</style>