<template>
  <div id="dataConfig">
    <input v-show="false" id="file" type="file" @change="exportFunc" />
    <search-box-new
      ref="searchBox"
      :formData="formData"
      :formList="formList"
      @search="search"
      @init="init"
      :shType="shType"
    >
      <template slot="customize" v-if="false">
        <el-button size="small" type="success" @click="moreActive"
          >批量导出</el-button
        >
      </template>
    </search-box-new>
    <table-list
      :tableSets="tableSet"
      :tableData="tableData"
      :navText="navText"
      @addClick="addClick"
      :loading="loading"
      @editInfo="editInfo"
    >
      <template slot="customize" v-if="formData.status == 1">
        <el-button size="small" type="success" @click="studentLeadInfo"
          >学员资料导入</el-button
        ><el-button size="small" type="success" @click="studentExport"
          >学员资料导出</el-button
        >
      </template>
      <template slot="btn" slot-scope="props">
        <el-button
          type="text"
          @click="addClick(props.scope.row, 0)"
          :disabled="
            !(
              props.scope.row.changeStatus === 2 || props.scope.row.status === 2
            )
          "
          >审核</el-button
        >
        <el-button type="text" @click="openRecord(props.scope.row)"
          >审核记录</el-button
        >
      </template>
    </table-list>
    <pagination
      :total="total"
      :pageSize="formData.pageSize"
      :currentPage="formData.pageNum"
      @handleSizeChange="handleSizeChange"
      @handleCurrentChange="handleCurrentChange"
    />
    <el-dialog
      @closed="loadingClose"
      :visible.sync="dialogVisible"
      width="1000px"
      :show-close="false"
      :close-on-click-modal="false"
    >
      <div slot="title" class="hearders">
        <div class="leftTitle">资料审核</div>
        <div class="rightBoxs">
          <img src="@/assets/images/Close@2x.png" alt="" @click="close" />
        </div>
      </div>
      <div slot="title" class="topStys">
        <div class="btnsTys">学员编码：{{ listData.userAccount }}</div>
        <div class="btnsTys">学员姓名：{{ listData.realname }}</div>
        <div class="btnsTys">学员身份证号码：{{ listData.idCard }}</div>
        <div class="btnsTys">绑定手机号码：{{ listData.telphone }}</div>
        <div style="clear: both"></div>
      </div>
      <div class="heightstybox gdt">
        <ul>
          <li class="dissty" v-for="(item, index) in listInfos" :key="index">
            <div
              style="
                width: 50px;
                color: red;
                align-self: flex-start;
                flex-shrink: 0;
              "
            >
              {{ item.status === 1 ? "有变更" : "" }}
            </div>
            <div class="stys">{{ item.fieldName }}：</div>
            <div v-if="pdStatus(item.fieldKey)">
              <div
                v-if="item.fieldKey === 'recent_photos'"
                style="width: 145px; height: 160px"
              >
                <el-image
                  v-if="item.value"
                  style="width: 100%; height: 100%"
                  :src="$methodsTools.splitImgHost(item.value)"
                  :preview-src-list="[$methodsTools.splitImgHost(item.value)]"
                >
                </el-image>
                <p v-else>暂无上传图片</p>
              </div>
              <div v-else-if="item.fieldKey === 'commitment_electr_signature'">
                <div>
                  本人自愿做出如下承诺：本人己仔细阅读《广东
                  省住房和城乡建设厅关于推进住房和城乡建设领域施
                  工现场专业人员职业培训工作的通知》
                  全部内容并知晓和理解，本人的学历证书、身份证、工作年限、相片等所有资料完全真实、符合报名条件、资格审查要求和相关规定，本人在报名、审查、培训、测试等有关的事项中会严格道守相关规定和要求，如有虛假或与实际规定不符等情况造成的一切后果由本人承担。
                  特此承诺！
                </div>
                <div
                  style="width: 300px; height: 150px; border: 1px solid #999"
                  v-if="item.value"
                >
                  <el-image
                    style="width: 100%; height: 100%"
                    :src="$methodsTools.splitImgHost(item.value)"
                    :preview-src-list="[$methodsTools.splitImgHost(item.value)]"
                  >
                  </el-image>
                </div>
                <p v-else>暂无上传图片</p>
              </div>
              <div
                v-else
                style="width: 224px; height: 160px; position: relative"
              >
                <el-image
                  v-if="item.value"
                  style="width: 100%; height: 100%"
                  :src="$methodsTools.splitImgHost(item.value + '?r=' + Math.random())"
                  :preview-src-list="[$methodsTools.splitImgHost(item.value + '?r=' + Math.random())]"
                >
                </el-image>
                <p v-else>暂无上传图片</p>
                <div
                  v-if="
                    item.value &&
                    (item.fieldKey === 'idcard_face_photo' ||
                      item.fieldKey === 'idcard_national_photo')
                  "
                  style="
                    height: 26px;
                    bottom: 0px;
                    width: 100%;
                    background-color: rgb(141 141 141 / 50%);
                    text-align: center;
                    font-size: 28px;
                    color: #0cdb31;
                    position: absolute;
                  "
                >
                  <i
                    class="el-icon-refresh-left"
                    style="margin-right: 20px"
                    @click="transange(-90, index)"
                    title="向左旋转90度"
                  ></i>
                  <i
                    class="el-icon-refresh-right"
                    @click="transange(90, index)"
                    title="向右旋转90度"
                  ></i>
                </div>
                <div style="position: absolute; right: -100px; bottom: 0px">
                  <el-button
                    v-if="item.value && item.fieldKey === 'idcard_face_photo'"
                    size="mini"
                    type="success"
                    onclick="document.querySelector('#file1').click()"
                    >更换照片</el-button
                  >
                  <input
                    v-if="item.value && item.fieldKey === 'idcard_face_photo'"
                    id="file1"
                    type="file"
                    ref="file1"
                    style="display: none"
                    @change="uploadImg(index)"
                  />
                  <el-button
                    v-if="
                      item.value && item.fieldKey === 'idcard_national_photo'
                    "
                    type="success"
                    size="mini"
                    onclick="document.querySelector('#file2').click()"
                    >更换照片</el-button
                  >
                  <input
                    v-if="
                      item.value && item.fieldKey === 'idcard_national_photo'
                    "
                    id="file2"
                    type="file"
                    ref="file2"
                    style="display: none"
                    @change="uploadImg(index)"
                  />
                </div>
              </div>
            </div>
            <div v-else>{{ item.value }}</div>
          </li>
          <li class="dissty" style="border-bottom: none">
            <div class="stys">审核结果反馈：</div>
            <el-input
              v-model="listData.text"
              type="textarea"
              :rows="5"
            ></el-input>
          </li>
        </ul>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="close">取 消</el-button>
        <el-button :loading="disabledBtn" @click="submitTable(1)" type="success"
          >审核通过</el-button
        >
        <el-button :loading="disabledBtn" @click="submitTable(3)" type="danger"
          >审核不通过</el-button
        >
      </span>
    </el-dialog>
    <el-dialog
      :visible.sync="dialogVisibleRecord"
      width="1000px"
      :show-close="false"
      :close-on-click-modal="false"
    >
      <div slot="title" class="hearders">
        <div class="leftTitle">资料审核</div>
        <div class="rightBoxs">
          <img
            src="@/assets/images/Close@2x.png"
            alt=""
            @click="dialogVisibleRecord = false"
          />
        </div>
      </div>
      <div slot="title" class="topStys">
        <div class="btnsTys">
          学员编码：{{ recordList[activeIndex].userAccount }}
        </div>
        <div class="btnsTys">
          学员姓名：{{ recordList[activeIndex].realname }}
        </div>
        <div class="btnsTys">
          学员身份证号码：{{ recordList[activeIndex].idCard }}
        </div>
        <div class="btnsTys">
          绑定手机号码：{{ recordList[activeIndex].telphone }}
        </div>
        <div style="clear: both"></div>
      </div>
      <el-row :gutter="20">
        <el-col :span="6">
          <ul class="max_heightAuto">
            <li
              class="lsTYs"
              v-for="(item, index) in recordList"
              :key="index"
              :class="index === activeIndex ? 'active' : ''"
              @click="changeIndex(index)"
            >
              {{ $methodsTools.onlyForma(item.auditTime) }}
            </li>
          </ul>
        </el-col>
        <el-col :span="18">
          <transition>
            <div class="heightstybox gdt" v-if="showIS">
              <ul>
                <li>
                  <div class="float_lefts">
                    审核人：{{ recordList[activeIndex].createByName }}
                  </div>
                  <div class="float_lefts">
                    {{
                      recordList[activeIndex].status === 1
                        ? "审核通过"
                        : recordList[activeIndex].status === 2
                        ? "待审核"
                        : recordList[activeIndex].status === 3
                        ? "审核不通过"
                        : "无审核状态"
                    }}
                  </div>
                  <div style="clear: both"></div>
                </li>
                <li
                  class="dissty"
                  v-for="(item, index) in recordList[activeIndex]
                    .keyValueArrays"
                  :key="index"
                >
                  <div class="stys">{{ item.fieldName }}：</div>
                  <div v-if="pdStatus(item.fieldKey)">
                    <div
                      v-if="item.fieldKey === 'recent_photos'"
                      style="width: 145px; height: 160px"
                    >
                      <el-image
                        v-if="item.value"
                        style="width: 100%; height: 100%"
                        :src="$methodsTools.splitImgHost(item.value)"
                        :preview-src-list="[
                          $methodsTools.splitImgHost(item.value),
                        ]"
                      >
                      </el-image>
                      <p v-else>暂无上传图片</p>
                    </div>
                    <div
                      v-else-if="
                        item.fieldKey === 'commitment_electr_signature'
                      "
                    >
                      <div>
                        本人自愿做出如下承诺：本人己仔细阅读《广东
                        省住房和城乡建设厅关于推进住房和城乡建设领域施
                        工现场专业人员职业培训工作的通知》
                        全部内容并知晓和理解，本人的学历证书、身份证、工作年限、相片等所有资料完全真实、符合报名条件、资格审查要求和相关规定，本人在报名、审查、培训、测试等有关的事项中会严格道守相关规定和要求，如有虛假或与实际规定不符等情况造成的一切后果由本人承担。
                        特此承诺！
                      </div>
                      <div
                        style="
                          width: 300px;
                          height: 150px;
                          border: 1px solid #999;
                        "
                        v-if="item.value"
                      >
                        <el-image
                          style="width: 100%; height: 100%"
                          :src="$methodsTools.splitImgHost(item.value)"
                          :preview-src-list="[
                            $methodsTools.splitImgHost(item.value),
                          ]"
                        >
                        </el-image>
                      </div>
                      <p v-else>暂无上传图片</p>
                    </div>
                    <div v-else style="width: 224px; height: 160px">
                      <el-image
                        v-if="item.value"
                        style="width: 100%; height: 100%"
                        :src="$methodsTools.splitImgHost(item.value)"
                        :preview-src-list="[
                          $methodsTools.splitImgHost(item.value),
                        ]"
                      >
                      </el-image>
                      <p v-else>暂无上传图片</p>
                    </div>
                  </div>
                  <div v-else>{{ item.value }}</div>
                </li>
                <li class="dissty" style="border-bottom: none">
                  <div class="stys">审核结果反馈：</div>
                  <div>
                    {{ recordList[activeIndex].text }}
                  </div>
                </li>
              </ul>
            </div>
          </transition>
        </el-col>
      </el-row>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisibleRecord = false">取 消</el-button>
      </span>
    </el-dialog>
    <el-dialog
      :visible.sync="dialogDR"
      width="660px"
      :show-close="false"
      :close-on-click-modal="false"
    >
      <div slot="title" class="hearders">
        <div class="leftTitle">批量导出</div>
        <div class="rightBoxs">
          <img
            src="@/assets/images/Close@2x.png"
            alt=""
            @click="dialogDR = false"
          />
        </div>
      </div>
      <div>
        <div class="swq">
          <img
            style="width: 182px; height: 168px"
            src="@/assets/images/dc.png"
            alt=""
          />
        </div>
        <div style="padding: 40px">
          <el-row>
            <el-col :span="12"
              ><div style="text-align: end; padding-right: 14px">
                填写资料审核状态：
              </div></el-col
            >
            <el-col :span="12">
              <el-radio-group v-model="activeDCIndex">
                <el-radio
                  style="display: block; margin-bottom: 16px"
                  v-for="(items, indexs) in DCLIST"
                  :key="indexs"
                  :label="items.value"
                  >{{ items.label }}</el-radio
                >
              </el-radio-group>
            </el-col>
          </el-row>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogDR = false">取消</el-button>
        <el-button type="primary" @click="exputs">确定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import * as baseUrls from "@/utils/request.js";
import searchBoxNew from "@/components/searchBoxNew";
import tableList from "@/components/tableList";
import pagination from "@/components/pagination";
export default {
  name: "DataConfig",
  components: { searchBoxNew, tableList, pagination },
  data() {
    return {
      dialogDR: false,
      disabledBtn: false,
      dialogVisibleRecord: false,
      shType: true,
      loading: false, //当前表单加载是否加载动画
      navText: {
        title: "填写资料审核",
        index: 0,
        ch: "条",
        num: true,
        border: true,
        choice: true,
        addHide: true,
        backFatherBtn: {
          status: false,
          title: "未定义",
        },
      },
      //搜索
      formList: [
        {
          prop: "changeStatus",
          placeholder: "变更状态",
          scope: "select",
          options: [
            {
              label: "正常",
              value: 1,
            },
            {
              label: "有变更",
              value: 2,
            },
          ],
        },
        {
          prop1: "applyStartTime",
          prop2: "applyEndTime",
          placeholder1: "报名开始时间",
          placeholder2: "报名结束时间",
          scope: "moreDataPicker",
          Diszing: true,
        },
        {
          prop: "companyName",
          placeholder: "请输入公司名称",
        },
        {
          prop: "realname",
          placeholder: "请输入学员姓名",
        },
      ],
      formData: {
        status: "",
        pageSize: 10,
        pageNum: 1,
      },
      showIS: true,
      // 表单
      tableSet: [
        {
          label: "学员编码",
          prop: "userAccount",
          hidden: true,
        },
        {
          label: "学员姓名",
          prop: "realname",
          hidden: true,
        },

        {
          label: "学员身份证",
          prop: "idCard",
          hidden: true,
        },
        {
          label: "绑定手机号",
          prop: "telphone",
          hidden: true,
        },
        {
          label: "公司名称",
          prop: "companyName",
          hidden: true,
        },
        {
          label: "所购商品",
          hidden: true,
          scope: "getShops",
        },
        {
          label: "填写资料审核状态",
          prop: "status",
          hidden: true,
          scope: "isOptions",
          options: [
            {
              label: "通过",
              value: 1,
            },
            {
              label: "待审核",
              value: 2,
            },
            {
              label: "不通过",
              value: 3,
            },
          ],
        },
        {
          label: "填写资料变更状态",
          prop: "changeStatus",
          hidden: true,
          scope: "isOptions",
          options: [
            {
              label: "正常",
              value: 1,
            },

            {
              label: "有变更",
              value: 2,
              style: "color:red",
            },
          ],
        },
        {
          label: "报名时间",
          prop: "applyTime",
          hidden: true,
          scope: "aTimeList",
        },
        {
          label: "第一次提交资料时间",
          prop: "oneTime",
          hidden: true,
          scope: "aTimeList",
        },
        {
          label: "最后一次提交资料时间",
          prop: "lastTime",
          hidden: true,
          scope: "aTimeList",
        },
        {
          label: "最后一次审核人",
          prop: "createByName",
          hidden: true,
        },
        {
          label: "最后一次审核时间",
          prop: "auditTime",
          hidden: true,
          scope: "aTimeList",
        },
      ],
      tableData: [], //表单数据
      total: 0, //一共多少条
      //   弹窗数据
      listData: {},
      statusPop: -1,
      dialogVisible: false,
      //表单验证
      rules: {
        natureName: [
          { required: true, message: "请输入收费性质名称", trigger: "blur" },
        ],
        status: [{ required: true, message: "请选择状态", trigger: "change" }],
      },
      listInfos: [],
      recordList: [{ keyValueArrays: [] }], //记录列表
      activeIndex: 0,
      activeDCIndex: 0, //导出按钮索引
      DCLIST: [
        { label: "全部", value: 0 },
        { label: "待审核", value: 2 },
        { label: "审核通过", value: 1 },
        { label: "审核不通过", value: 3 },
      ], //导出按钮列表
    };
  },
  async mounted() {
    await this.moRenBus();
    this.search();
  },
  async activated() {
    await this.moRenBus();
    this.search();
  },
  methods: {
    uploadImg(int) {
      var self = this;
      if (self.listInfos[int].fieldKey === "idcard_face_photo") {
        console.log("file1", this.$refs.file1);
        var file = this.$refs.file1[0].files[0];
      }
      if (self.listInfos[int].fieldKey === "idcard_national_photo") {
        var file = self.$refs.file2[0].files[0];
      }

      if (file === undefined) {
        return;
      }
      if (file.size > 2 * 1024 * 1024) {
        self.$message.error("图片不得大于2MB");
        return;
      }
      if (self.listInfos[int].fieldKey === "idcard_face_photo") {
        var type = self.$refs.file1[0].value
          .toLowerCase()
          .split(".")
          .splice(-1);
      }
      if (self.listInfos[int].fieldKey === "idcard_national_photo") {
        var type = self.$refs.file2[0].value
          .toLowerCase()
          .split(".")
          .splice(-1);
      }
      if (
        type[0] != "jpg" &&
        type[0] != "png" &&
        type[0] != "jpeg" &&
        type[0] != "gif"
      ) {
        self.$message.error("上传格式需为：.jpg/.png/.jpeg/gif");

        self.$refs.file1[0].value = "";
        self.$refs.file2[0].value = "";
        return;
      }
      this.$upload.upload(file, 0).then((res) => {
        self.listInfos[int].value = res;
        var data = { id: self.listData.id, idCard1: "", idCard2: "" };
        if (self.listInfos[int].fieldKey === "idcard_face_photo") {
          data.idCard1 = res;
        }
        if (self.listInfos[int].fieldKey === "idcard_national_photo") {
          data.idCard2 = res;
        }
        self.baseprofileeditcard(data);
      });
    },
    baseprofileeditcard(data) {
      this.$api.baseprofileeditcard(data).then((res) => {
        this.$message.success("保存成功");
        this.addClick(data, 0);
      });
    },
    transange(ange, int) {
      var data = {
        id: this.listData.id,
        idCard1: "",
        idCard2: "",
        degree: ange,
      };
      if (this.listInfos[int].fieldKey === "idcard_face_photo") {
        data.idCard1 = this.listInfos[int].value;
      }
      if (this.listInfos[int].fieldKey === "idcard_national_photo") {
        data.idCard2 = this.listInfos[int].value;
      }
      this.baseprofileeditcard(data);
    },
    /**
     * 默认选择考前培训-施工七大员
     */
    moRenBus() {
      return new Promise((resolve, reject) => {
        this.$api.inquireCourseEducationType({ status: 1 }).then((res) => {
          for (let i = 0; i < res.rows.length; i++) {
            if (res.rows[i].educationName === "考前培训") {
              this.$api
                .inquirebusinessList({ status: 1, educationId: res.rows[i].id })
                .then((result) => {
                  for (let j = 0; j < result.rows.length; j++) {
                    if (
                      result.rows[j].projectName === "施工现场专业人员" &&
                      result.rows[j].businessName === "七大员"
                    ) {
                      this.$set(
                        this.formData,
                        "educationTypeId",
                        res.rows[i].id
                      );
                      this.$set(this.formData, "businessId", result.rows[j].id);
                      resolve();
                      break;
                    }
                  }
                });
              break;
            }
          }
        });
      });
    },
    exputs(data) {
      // if (!data.businessId) {
      //   this.$message.warning("请选择业务层次");
      //   return;
      // }
      this.$modal.loading("正在导出数据，请稍后...");
      this.$api
        .inquirebaseprofileExport(data)
        .then(async (res) => {
          for (let k in res.data) {
            if (res.data[k].code === 200) {
              await this.dowmFunc(res, k);
            } else {
              this.$message.error("code值错误：", res.data[k].code);
            }
          }
        })
        .catch((err) => {
          let { message } = err;
          if (message.includes("timeout")) {
            this.$message.error(
              "数据体量过大，无法正常导出，请调整导出的日期范围，缩小数据体量"
            );
          }
        })
        .finally(() => {
          this.$modal.closeLoading();
        });
    },
    dowmFunc(res, k) {
      return new Promise((resolve, reject) => {
        let url =
          baseUrls.baseURL + "common/download?fileName=" + res.data[k].msg;
        let link = document.createElement("a");
        let fileName = "导入模板" + ".xlsx";
        document.body.appendChild(link);
        link.href = url;
        link.dowmload = fileName;
        link.click();
        link.remove();
        setTimeout(() => {
          resolve();
        }, 200);
      });
    },
    studentLeadInfo() {
      document.getElementById("file").click();
    },
    //学员资料导入
    exportFunc(e) {
      let formData = new FormData();
      formData.append("file", e.target.files[0]);
      this.$api
        .systemapplyuserprofile(formData)
        .then((res) => {
          this.search(2);
        })
        .finally(() => {
          e.target.value = "";
        });
    },
    studentExport() {
      let data = {
        changeStatus: this.formData.changeStatus || "",
        companyName: this.formData.companyName || "",
        status:
          this.formData.status && this.formData.status !== 0
            ? [this.formData.status]
            : [],
        educationTypeId: this.formData.educationTypeId || "",
        businessId: this.formData.businessId || "",
        realname: this.formData.realname || "",
        applyStartTime: this.formData.applyStartTime / 1000 || "",
        applyEndTime: this.formData.applyEndTime / 1000 || "",
      };
      this.$api.systemapplyuserprofileexport(data).then((res) => {
        let url = baseUrls.baseURL + "common/download?fileName=" + res.msg;
        let link = document.createElement("a");
        let fileName = "导入模板" + ".xlsx";
        document.body.appendChild(link);
        link.href = url;
        link.dowmload = fileName;
        link.click();
        link.remove();
      });
    },
    moreActive() {
      let data = {
        changeStatus: this.formData.changeStatus || "",
        companyName: this.formData.companyName || "",
        status: this.formData.status || 0,
        educationTypeId: this.formData.educationTypeId || "",
        businessId: this.formData.businessId || "",
        realname: this.formData.realname || "",
        applyStartTime: this.formData.applyStartTime / 1000 || "",
        applyEndTime: this.formData.applyEndTime / 1000 || "",
      };
      this.exputs(data);
    },
    changeIndex(v) {
      if (this.activeIndex === v) {
        return;
      }
      this.showIS = false;
      this.activeIndex = v;
      setTimeout(() => {
        this.showIS = true;
      }, 50);
    },
    openRecord(v) {
      this.$api
        .inquirebaseprofilelistRecord({ userId: v.userId, goodsId: v.goodsId })
        .then((res) => {
          if (!res.rows.length) {
            this.$message.warning("该条数据无审核记录");
            return;
          }
          res.rows.forEach((item) => {
            item.keyValue = JSON.parse(item.keyValue);
            var arst = [];
            for (let k in item.keyValue) {
              if (item.keyValue[k].fieldName) {
                arst.push(item.keyValue[k]);
              }
            }
            item.keyValueArrays = arst;
          });
          this.activeIndex = 0;
          this.recordList = res.rows;
          this.dialogVisibleRecord = true;
        });
    },
    pdStatus(int) {
      if (
        int === "recent_photos" ||
        int === "idcard_face_photo" ||
        int === "idcard_national_photo" ||
        int === "commitment_electr_signature" ||
        int === "commitment_seal"
      ) {
        return true;
      }
    },
    //1通过 3不通过
    submitTable(int) {
      this.disabledBtn = true;
      var data = JSON.parse(JSON.stringify(this.listData));
      for (let k in data.keyValue) {
        data.keyValue[k].status = 0;
      }
      data.keyValue = JSON.stringify(data.keyValue);
      data.status = int;
      data.changeStatus = 1;
      this.$api
        .editbaseprofilesss(data)
        .then((res) => {
          this.$message.success("提交成功");
          this.search();
          this.dialogVisible = false;
        })
        .catch(() => {
          this.disabledBtn = false;
        });
    },
    loadingClose() {
      this.disabledBtn = false;
    },
    editInfo(v) {
      this.addClick(v, 0);
    },
    search(int) {
      this.loading = true;
      if (int === 1) {
        this.formData.pageNum = 1;
      }
      if (int === 2) {
        this.formData = {
          status: "",
          pageSize: 10,
          pageNum: 1,
          educationTypeId: this.formData.educationTypeId,
          businessId: this.formData.businessId,
        };
      }
      var data = JSON.parse(JSON.stringify(this.formData));
      console.log(this.formData, "data");
      if (this.formData.applyStartTime) {
        data.applyStartTime = data.applyStartTime / 1000;
      }
      if (this.formData.applyEndTime) {
        data.applyEndTime = data.applyEndTime / 1000;
      }
      this.$api
        .inquirebaseprofile(data)
        .then((res) => {
          this.tableData = res.rows;
          this.total = res.total;
          this.navText.index = res.total;
        })
        .finally(() => {
          this.loading = false;
        });
    },
    init() {
      this.search(2);
    },
    del(v) {
      this.$alert(
        "确定删除此内容？<br />内容删除后将无法恢复，请慎重考虑",
        "提示",
        {
          dangerouslyUseHTMLString: true,
        }
      )
        .then(() => {
          var data = {
            natureId: v.natureId,
            status: -1,
          };
          this.$api.editpaynature(data).then((res) => {
            this.$message.success("删除成功");
            this.search();
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
    addClick(v, int) {
      if (v === undefined) {
        this.listData = {};
      } else {
        this.$api.obtainbaseprofile(v.id).then((res) => {
          res.data.keyValue = JSON.parse(res.data.keyValue);
          this.listData = res.data;
          var arst = [];
          for (let k in res.data.keyValue) {
            if (res.data.keyValue[k].fieldName) {
              arst.push(res.data.keyValue[k]);
            }
          }
          this.listInfos = arst;
        });
      }
      this.dialogVisible = true;
    },
    close() {
      this.dialogVisible = false;
    },
    handleSizeChange(v) {
      this.formData.pageSize = v;
      this.formData.pageNum = 1;
      this.search();
    },
    handleCurrentChange(v) {
      this.formData.pageNum = v;
      this.search();
    },
  },
};
</script>

<style lang="less" scoped>
// 进入前和结束后的状态
.v-enter,
.v-leave-to {
  opacity: 0;
  // transform: translateX(80px);
}
// 进入和离开的动画时间段
.v-enter-active,
.v-leave-active {
  transition: all 0.5s ease;
}
.gdt {
  /* 设置滚动条的样式 */
  &::-webkit-scrollbar {
    width: 8px;
  }
  /* 滚动槽 */
  &::-webkit-scrollbar-track {
    box-shadow: inset 6px rgba(0, 0, 0, 0.3);
    border-radius: 10px;
  }
  /* 滚动条滑块 */
  &::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.1);
    box-shadow: inset 6px rgba(0, 0, 0, 0.5);
  }
  &::-webkit-scrollbar-thumb:window-inactive {
    background: rgba(182, 182, 182, 0.4);
  }
}
.max_heightAuto {
  padding: 0px 10px;
  max-height: 560px;
  overflow-y: auto;
}
.float_lefts {
  float: left;
  padding: 0px 10px;
  border-radius: 12px;
  background-color: #eee;
  height: 35px;
  line-height: 35px;
  margin-right: 10px;
}
.lsTYs {
  height: 40px;
  border-top: 1px solid #999;
  border-left: 1px solid #999;
  border-right: 1px solid #999;
  line-height: 39px;
  cursor: pointer;
  text-align: center;
  &:last-child {
    border-bottom: 1px solid #999 !important;
  }
}
.swq {
  text-align: center;
  border-bottom: 1px solid #eee;
}
.active {
  color: blue;
}
.heightstybox {
  padding: 20px;
  height: 600px;
  overflow-y: auto;
}
.dissty {
  display: flex;
  align-items: center;
  padding: 20px;
  border-bottom: 1px dotted #999;
}
.stys {
  flex-shrink: 0;
  align-self: flex-start;
  width: 200px;
  padding-left: 50px;
}
.topStys {
  padding: 20px;
  background-color: rgb(215, 215, 215);
  display: flex;
  align-items: center;
  overflow-x: auto;

  .btnsTys {
    flex-shrink: 0;
    margin-right: 16px;
    padding: 0px 7px;
    background-color: #fff;
    border-radius: 4px;
    font-size: 14px;
    height: 40px;
    line-height: 40px;
  }
}
/deep/.el-button {
  border-radius: 8px;
}
/deep/ .el-dialog__body {
  padding: 10px 0px;
}
/deep/.el-dialog {
  border-radius: 8px;
  .el-dialog__header {
    padding: 0;
    .hearders {
      height: 40px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0px 18px 0px 20px;
      border-bottom: 1px solid #e2e2e2;
      .leftTitle {
        font-size: 14px;
        font-weight: bold;
        color: #2f4378;
      }
      .rightBoxs {
        display: flex;
        align-items: center;
        img {
          width: 14px;
          height: 14px;
          margin-left: 13px;
          cursor: pointer;
        }
      }
    }
  }
  .el-dialog__footer {
    padding: 0;
    .dialog-footer {
      padding: 0px 40px;
      height: 70px;
      border-top: 1px solid #e2e2e2;
      display: flex;
      align-items: center;
      justify-content: center;
    }
  }
}
.imgBox {
  width: 100%;
  // height: 210px;
  border: 1px solid #e2e2e2;
  border-radius: 8px;
  padding: 8px 8px 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  .imgLabel {
    flex: 1;
    width: 100%;
    border: 1px dotted #e2e2e2;
    color: #999;
    font-size: 14px;
    cursor: pointer;
    border-radius: 8px;
    .msPhoto {
      display: flex;
      justify-content: center;
      align-items: center;
      max-width: 100%;
      max-height: 270px;
      img {
        max-width: 100%;
        max-height: 270px;
      }
    }
    .imgbbx {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      width: 100%;
      height: 100%;
      i {
        font-weight: bold;
        margin: 14px 0;
        font-size: 24px;
      }
    }
  }
  p {
    margin: 5px 0px;
  }
}
</style>
