<template>
  <!-- 顶部按钮区域 -->
  <div class="testdiv">
    <div class="divborder newSearchDiv" style="margin: 0px">
      <div class="searchBtn">
        <Button
          type="primary"
          class="twoWord"
          icon="md-qr-scanner"
          @click="audit1()"
          >{{ $t("700119") }}</Button
        >
        <Button
          type="success"
          class="twoWord intervalRight"
          icon="md-eye"
          @click="preview()"
          >{{ $t("90000066") }}</Button
        >
        <Button
          type="warning"
          class="fourWord"
          icon="md-download"
          @click="downLoad()"
          >{{ $t("200239") }}</Button
        >
        <Button
          type="error"
          class="fourWord"
          icon="ios-search"
          @click="viewDetail()"
          >{{ $t("7000048") }}</Button
        >
      </div>
    </div>
    <div class="divborder newTableDiv">
      <template>
        <Table
          highlight-row
          class="tableClass"
          :data="tableData2"
          :columns="tableColumns1"
          @on-current-change="handleRowChange"
        ></Table>
      </template>
      <div class="pageDiv">
        <div class="pageDirection">
          <Page
            :total="total"
            :current="page"
            show-elevator
            show-sizer
            show-total
            @on-change="changePage"
            @on-page-size-change="handlePageSize"
            :page-size-opts="[10, 20, 30, 40, 100]"
          ></Page>
        </div>
      </div>
    </div>

    <!-- 审核弹框 -->
    <Modal
      class="newModalClass"
      v-model="showModal"
      :styles="{ width: '620px' }"
    >
      <p slot="header">
        <span>{{ $t("700119") }}</span>
      </p>
      <div class="Main">
        <!-- 文档名称 -->
        <div>
          <label>
            <i>*</i>
            {{ $t(900752) }}：
          </label>
          <Input v-model="addobj.documentName" class="searchInput" disabled />
        </div>
        <!-- 文件类型 -->
        <div>
          <label>
            <i>*</i>
            {{ $t("900754") }}：
          </label>
          <Select
            disabled
            clearable
            label-in-value
            class="searchSelect"
            v-model="addobj.documentType"
          >
            <Option
              v-for="item in docuTypeList"
              :value="item.id"
              :key="item.id"
              >{{ item.name }}</Option
            >
          </Select>
        </div>
        <!-- 选择文件 -->
        <div>
          <label>
            <i>*</i>
            {{ $t(700013) }}：
          </label>
          <Upload
            style="
              display: inline-block;
              white-space: nowrap;
              text-overflow: ellipsis;
              overflow: hidden;
              vertical-align: middle;
            "
            ref="upload"
            :action="action"
            name="excel-file"
            :headers="headers"
            :show-upload-list="false"
            :on-format-error="handleFormatError"
            :on-success="handleSuccess"
            :on-error="handleError"
            :format="['xlsx']"
            v-model="addobj.selectFile"
          >
            <Button icon="md-folder" class="selectBtn" disabled>{{
              uploadtitle
            }}</Button>
          </Upload>
        </div>
        <!-- 关联产品 -->
        <div>
          <label>{{ $t("900560") }}：</label>
          <Select
            disabled
            clearable
            filterable
            label-in-value
            class="searchSelect"
            v-model="addobj.relatedProduct"
          >
            <Option
              v-for="item in relatedProductList"
              :value="item.id"
              :key="item.id"
              >{{ item.name }}</Option
            >
          </Select>
        </div>
        <!-- 关联设备 -->
        <div>
          <label>{{ $t("900774") }}：</label>
          <Select
            disabled
            clearable
            filterable
            label-in-value
            class="searchSelect"
            v-model="addobj.relatedEquipment"
          >
            <Option
              v-for="item in ListNCMachinesList"
              :value="item.id"
              :key="item.id"
              >{{ item.name }}</Option
            >
          </Select>
        </div>
        <!-- 使用部门 -->
        <div>
          <label>{{ $t("600325") }}：</label>
          <Select
            disabled
            clearable
            label-in-value
            class="searchSelect"
            v-model="addobj.useDepartment"
          >
            <Option
              v-for="item in UserDepartmentList"
              :value="item.id"
              :key="item.id"
              >{{ item.title }}</Option
            >
          </Select>
        </div>
        <!-- 备注 -->
        <div>
          <label>{{ $t(1030) }}：</label>
          <Input v-model="addobj.note" class="searchInput textarea" disabled />
        </div>
        <!-- 审核流程 -->
        <div class="audit">
          <label class="auditLable">{{ $t(960580) }}：</label>
          <Timeline>
            <TimelineItem v-show="auditflag">
              <p class="time">
                <span>{{ $t("1231") }}</span>
              </p>
            </TimelineItem>
          </Timeline>
          <Timeline>
            <TimelineItem v-for="(item1, index) in auditList" :key="index">
              <p class="time">
                <span>{{ $t("1077") }}{{ index + 1 }}{{ $t("1232") }}</span>
              </p>
              <span
                v-for="(item2, index) in item1.approvalHistories"
                :key="index"
              >
                <p>
                  {{ item2.info }},
                  {{ item2.status == 1 ? "审核通过" : "审核不通过" }}
                </p>
                <p>{{ item2.audit_time }}</p>
              </span>
            </TimelineItem>
          </Timeline>
        </div>
      </div>
      <div slot="footer">
        <Button type="primary" size="large" @click="NotPass()">{{
          $t("700115")
        }}</Button>
        <Button type="primary" size="large" @click="Passing()">{{
          $t("700114")
        }}</Button>
      </div>
    </Modal>

    <!-- 预览弹框 -->
    <Modal
      class="newModalClass"
      title="预览"
      v-model="showmodal"
      :styles="{ width: '760px' }"
    >
      <div style="width: 700px; height: 500px; overflow: auto">
        <div v-show="showcontent" ref="preview_content"></div>
        <div v-show="showpdf">
          <embed
            :src="pdfurl"
            type="application/pdf"
            width="100%"
            height="500px"
          />
        </div>
      </div>
      <div slot="footer">
        <Button type="text" size="large" @click="showmodal = false">{{
          $t("1033")
        }}</Button>
      </div>
    </Modal>

    <!-- 详情弹框 -->
    <Modal
      class="newModalClass"
      v-model="detailModal"
      :styles="{ width: '620px' }"
    >
      <p slot="header">
        <span>{{ $t("950253") }}</span>
      </p>
      <div class="Main">
        <!-- 文档名称 -->
        <div>
          <label>
            <i>*</i>
            {{ $t(900752) }}：
          </label>
          <Input v-model="addobj.documentName" class="searchInput" disabled />
        </div>
        <!-- 文件类型 -->
        <div>
          <label>
            <i>*</i>
            {{ $t("900754") }}：
          </label>
          <Select
            disabled
            label-in-value
            v-model="addobj.documentType"
            class="searchSelect"
          >
            <Option
              v-for="item in docuTypeList"
              :value="item.id"
              :key="item.id"
              >{{ item.name }}</Option
            >
          </Select>
        </div>
        <!-- 选择文件 -->
        <div>
          <label>
            <i>*</i>
            {{ $t(700013) }}：
          </label>
          <Upload
            style="
              display: inline-block;
              white-space: nowrap;
              text-overflow: ellipsis;
              overflow: hidden;
              vertical-align: middle;
            "
            ref="upload"
            :action="action"
            name="excel-file"
            :headers="headers"
            :show-upload-list="false"
            :on-format-error="handleFormatError"
            :on-success="handleSuccess"
            :on-error="handleError"
          >
            <Button icon="md-folder" class="selectBtn" disabled>{{
              uploadtitle
            }}</Button>
          </Upload>
        </div>
        <!-- 关联产品 -->
        <div>
          <label>{{ $t("900560") }}：</label>
          <Select
            disabled
            label-in-value
            class="searchSelect"
            v-model="addobj.relatedProduct"
          >
            <Option
              v-for="item in relatedProductList"
              :value="item.id"
              :key="item.id"
              >{{ item.name }}</Option
            >
          </Select>
        </div>
        <!-- 关联设备 -->
        <div>
          <label>{{ $t("900774") }}：</label>
          <Select
            disabled
            label-in-value
            class="searchSelect"
            v-model="addobj.relatedEquipment"
          >
            <Option
              v-for="item in ListNCMachinesList"
              :value="item.id"
              :key="item.id"
              >{{ item.name }}</Option
            >
          </Select>
        </div>
        <!-- 使用部门 -->
        <div>
          <label>{{ $t("600325") }}：</label>
          <Select
            disabled
            clearable
            label-in-value
            class="searchSelect"
            v-model="addobj.useDepartment"
          >
            <Option
              v-for="item in UserDepartmentList"
              :value="item.id"
              :key="item.id"
              >{{ item.title }}</Option
            >
          </Select>
        </div>
        <!-- 备注 -->
        <div>
          <label>{{ $t(1030) }}：</label>
          <Input v-model="addobj.note" class="searchInput textarea" disabled />
        </div>
      </div>
      <!-- 审核流程 -->
      <div class="audit">
        <label class="auditLable">{{ $t(960580) }}：</label>
        <Timeline>
          <TimelineItem v-show="detailsflag">
            <p class="time">
              <span>{{ $t("1231") }}</span>
            </p>
          </TimelineItem>
        </Timeline>
        <Timeline>
          <TimelineItem v-for="(item, index) in auditresult" :key="index">
            <p class="time flex">
              <span>{{ $t("1077") }}{{ index + 1 }}{{ $t("1232") }}</span>
              <span
                v-for="(item2, index) in item.approvalHistories"
                :key="index"
              >
                <p>
                  {{ item2.info }},
                  {{ item2.status == 1 ? "审核通过" : "审核不通过" }}
                </p>
                <p>{{ item2.audit_time }}</p>
              </span>
            </p>
          </TimelineItem>
        </Timeline>
      </div>
    </Modal>
  </div>
</template>

<script>
import axios from "@/libs/api.request";
export default {
  data() {
    return {
      pdfurl: "",
      showmodal: false,
      showcontent: false,
      Passflag: false,
      showpdf: false,
      auditflag: false,
      detailsflag: false,
      total: 0, //  总条数
      page: 1, // 当前显示页码值
      pagesize: 10, // 一页展示多少条数据
      tableData2: [], // table 表格数据
      detailobj: {},
      uploadtitle: "请选择上传文件",
      showModal: false, // 审核对话框隐藏
      detailModal: false, // 查看详情对话框
      addobj: {}, // 弹出框中表单对象
      docuTypeList: [], // 文档类型数据
      auditList: [],
      auditresult: [],
      action: this.axios.publicPath + "config/upload/UploadImage", // 上传的地址
      relatedProductList: [], // 关联产品下拉数据
      ListNCMachinesList: [], // 关联设备下拉数据
      UserDepartmentList: [], // 使用部门下拉数据
      headers: {
        // 设置上传的请求头部
        token: localStorage.getItem("token"),
        timestamp: localStorage.getItem("timestamp"),
        nonce: localStorage.getItem("nonce"),
        sign: localStorage.getItem("sign"),
      },
      tableColumns1: [
        {
          type: "sort",
          title: this.$t(1008),
          width: 80,
          render: (h, params) => {
            return h(
              "span",
              params.index + (this.page - 1) * this.pagesize + 1
            );
          },
        },
        {
          title: this.$t(900752),
          key: "name",
        },
        {
          title: this.$t(900754),
          key: "type_name",
        },
        {
          title: this.$t(900774),
          key: "machine_name",
        },
        {
          title: this.$t(900560),
          key: "product_name",
        },
        {
          title: this.$t(100040),
          key: "creator_name",
        },
        {
          title: this.$t(1020),
          key: "create_time",
        },
        {
          title: this.$t(960580),
          key: "process_name",
        },
        {
          title: this.$t(930132),
          key: "file_name",
        },
        {
          title: this.$t(930133),
          key: "version",
        },
        {
          title: this.$t(200054),
          key: "approval_status",
          width: "120px",
          align: "center",
          render: (h, params) => {
            var statusText = "",
              statusBg = "";
            if (params.row.approval_status == 1) {
              statusText = this.$t(700096);
              statusBg = "#f0ad4e";
            } else if (params.row.approval_status == 2) {
              statusText = this.$t(950440);
              statusBg = "#f0ad4e";
            } else if (params.row.approval_status == 3) {
              statusText = this.$t(950320);
              statusBg = "green";
            } else if (params.row.approval_status == 4) {
              statusText = this.$t(950472);
              statusBg = "#d7d7d7";
            } else if (params.row.approval_status == 5) {
              statusText = this.$t(950443);
              statusBg = "red";
            }
            return h(
              "div",
              {
                class: "",
                style: {
                  backgroundColor: statusBg,
                  color: "#fff",
                  width: "100%",
                  height: "36px",
                  lineHeight: "36px",
                  textAlign: "center",
                },
              },
              statusText
            );
          },
        },
      ],
    };
  },
  created() {
    this.tableSearch(1, 10);
    this.tableColumns1 = this.$time.initTableTitle(this.tableColumns1);
  },
  methods: {
    tableSearch(page, pagesize) {
      this.detailobj = {};
      var params = {
        page,
        pagesize,
      };
      this.axios
        .request({
          url: "/esop/EsopDocumentCreate/GetDocumentAuditPagedList",
          params,
          method: "get",
        })
        .then((res) => {
          this.total = 0; //  给定一个初始值
          this.tableData2 = []; //  设定一个初始值
          let result = res.data;
          if (result.ret === 1) {
            this.total = result.total;
            this.tableData2 = result.data;
          } else {
            this.$Message.error(this.$t("" + result.msg));
          }
        });
    },
    //  弹框文档类型数据列表
    GetAllDocumentSets() {
      axios
        .request({
          url: "/esop/EsopDocumentSet/GetAllDocumentSets",
          method: "get",
        })
        .then((res) => {
          this.docuTypeList = []; // 初始值
          if (res.data.ret === 1 && res.data.data.length !== 0) {
            this.docuTypeList = res.data.data;
          }
          // else {
          //   this.$Message.error(this.$t(res.data.msg));
          // }
        });
    },
    // 弹框关联设备数据列表
    GetProducts() {
      axios
        .request({
          url: "/config/projectproduct/GetProducts",
          method: "get",
        })
        .then((res) => {
          this.relatedProductList = []; // 设定一个初始值
          if (res.data.ret == 1 && res.data.data.length !== 0) {
            this.relatedProductList = res.data.data;
          }
          // else {
          //   this.$Message.error(this.$t(res.data.msg));
          // }
        });
    },
    // 弹框关联设备数据列表
    ListNCMachines() {
      axios
        .request({
          url: "/config/Machine/ListNCMachines",
          method: "get",
        })
        .then((res) => {
          this.ListNCMachinesList = []; // 初始值
          if (res.data.ret == 1 && res.data.data.length !== 0) {
            this.ListNCMachinesList = res.data.data;
          }
          // else {
          //   this.$Message.error(this.$t(res.data.msg));
          // }
        });
    },
    // 弹框使用部门数据列表
    getUserDepartment() {
      axios
        .request({
          url: "/config/ProjectUser/getUserDepartment",
          method: "get",
        })
        .then((res) => {
          this.UserDepartmentList = []; // 初始值
          if (res.data.ret == 1 && res.data.data.length !== 0) {
            this.UserDepartmentList = res.data.data;
          }
          // else {
          //   this.$Message.error(this.$t(res.data.msg));
          // }
        });
    },
    //  监听审核事件
    audit1() {
      if (this.detailobj.id == undefined || this.detailobj.id == "") {
        this.$Message.warning(this.$t(1043));
        return false;
      }
      this.GetAllDocumentSets(); // 文档类型下拉数据
      this.GetProducts(); // 关联产品下拉数据
      this.ListNCMachines(); // 关联产品下拉数据
      this.getUserDepartment(); // 使用部门下拉数据
      this.showModal = true; // 弹框显示
      this.addobj.documentName = this.detailobj.name; // 文档名称
      this.addobj.documentType = this.detailobj.type_id; // 文档类型
      this.uploadtitle = this.detailobj.file_name; // 选择文件
      this.addobj.relatedProduct = this.detailobj.product_id; // 关联产品
      this.addobj.relatedEquipment = this.detailobj.machine_id; // 关联设备
      this.addobj.useDepartment = this.detailobj.section_id; // 使用部门
      this.addobj.note = this.detailobj.remark; // 备注
      //  组装请求参数
      let params = {
        document_id: this.detailobj.id,
        process_id: this.detailobj.process_id,
      };
      this.axios
        .request({
          url: "/esop/EsopProcess/GetProcessApprovalHistory",
          params,
          method: "get",
        })
        .then((res) => {
          this.auditflag = false;
          this.auditList = [];
          if (res.data.ret === 1 && res.data.data.length !== 0) {
            // 如果有数据, 就隐藏. 如果没有数据, 就显示
            // res.data.data  展示层级
            // 还需要对状态判断
            if (this.detailobj.approval_status == 1) {
              // 待审核
              this.auditflag = false;
              this.auditList = res.data.data;
            } else if (this.detailobj.approval_status == 2) {
              // 审核中
              this.auditflag = false;
              this.auditList = res.data.data;
            } else if (this.detailobj.approval_status == 3) {
              // 审核通过
              this.auditflag = false;
              this.Passflag = true;
              this.auditList = res.data.data;
            } else if (this.detailobj.approval_status == 4) {
              // 已撤回
              this.auditflag = false;
              this.auditList = res.data.data;
            } else if (this.detailobj.approval_status == 5) {
              // 审核不通过
              this.auditflag = false;
              this.Passflag = false;
              this.auditList = res.data.data;
            }
          } else {
            this.auditflag = true;
          }
        });
    },
    // 监听预览事件
    preview() {
      if (this.detailobj.id == undefined || this.detailobj.id == "") {
        this.$Message.warning(this.$t(1043));
        return false;
      }
      this.showView(this.detailobj.id, 0, this.detailobj.file_url); // 1
    },
    showView(id, versionid, file_url) {
      this.showpdf = false;
      this.showcontent = false;
      let url = axios.publicPath + file_url;
      // 判断url的值
      if (url != undefined && url != "undefined" && url != "") {
        //判断文档过类型
        let arr = url.split(".");
        if (arr.length > 1) {
          let type = arr[arr.length - 1];
          if (
            type == "txt" ||
            type == "pdf" ||
            type == "jpg" ||
            type == "png"
          ) {
            if (type == "jpg" || type == "png") {
              let html =
                '<img style="width:100%;height:100%;" src="' + url + '">';
              this.$refs.preview_content.innerHTML = html;
              this.showcontent = true;
              this.showmodal = true;
            } else if (type == "txt") {
              var params = {
                id: id,
                history_id: versionid,
              };
              axios
                .request({
                  url: "/esop/Download/PreviewFile",
                  params,
                  method: "get",
                })
                .then((res) => {
                  if (res.data.ret === 1) {
                    // var str = 'asfdasdfasdfasfd\nadfasdfasdfasdfad\nasdfasdfasdfasdf\n'
                    var str = res.data.data;
                    var str_o = str.replace(/<br>/g, "\n");
                    var str_t = str_o.replace(/</g, "&lt;");
                    var str_f = str_t.replace(/>/g, "&gt;");
                    var str_s = str_f.replace(/\n/g, "<br/>");
                    this.$refs.preview_content.innerHTML = str_s;
                    this.showcontent = true;
                    this.showmodal = true;
                  } else {
                    this.$Message.error(this.$t(res.data.msg));
                  }
                });
            } else if (type == "pdf") {
              this.showpdf = true;
              this.pdfurl = url;
              this.showmodal = true;
            }
          } else {
            this.$Message.error("预览支持格式：txt,pdf,jpg,png");
            return false;
          }
        } else {
          this.$Message.error("文档路径非法");
          return false;
        }
      } else {
        this.$Message.error("附件url缺失！");
        return false;
      }
    },
    // 监听下载事件
    downLoad() {
      if (!this.detailobj.id) {
        this.$Message.warning(this.$t(1043));
        return false;
      }
      var url =
        axios.publicPath + "esop/Download/DownloadFile?id=" + this.detailobj.id;
      var file_name = this.detailobj.file_name;
      var xhr = new XMLHttpRequest(); // 创建xhr对象
      xhr.open("GET", url, true); // open即打开链接, 方式, 发送请求,  默认true,
      xhr.setRequestHeader("token", localStorage.getItem("token"));
      xhr.setRequestHeader("timestamp", localStorage.getItem("timestamp"));
      xhr.setRequestHeader("sign", localStorage.getItem("sign"));
      xhr.setRequestHeader("nonce", localStorage.getItem("nonce"));
      xhr.responseType = "blob"; // json 脚本
      xhr.onload = function () {
        if (this.status === 200) {
          var blob = this.response;
          var a = document.createElement("a");
          a.download = file_name;
          a.href = window.URL.createObjectURL(blob);
          a.click();
        } else {
          this.$Message.error("下载失败");
          return false;
        }
      };
      xhr.send();
    },
    // 查看详情
    viewDetail() {
      if (this.detailobj.id == undefined || this.detailobj.id == "") {
        this.$Message.warning(this.$t(1043));
        return false;
      }
      this.GetAllDocumentSets(); // 文档类型下拉数据
      this.GetProducts(); // 关联产品下拉数据
      this.ListNCMachines(); // 关联产品下拉数据
      this.getUserDepartment(); // 使用部门下拉数据
      this.detailModal = true; // 弹框显示
      this.addobj.documentName = this.detailobj.name; // 文档名称
      this.addobj.documentType = this.detailobj.type_id; // 文档类型
      this.uploadtitle = this.detailobj.file_name; // 选择文件
      this.addobj.relatedProduct = this.detailobj.product_id; // 关联产品
      this.addobj.relatedEquipment = this.detailobj.machine_id; // 关联设备
      this.addobj.useDepartment = this.detailobj.section_id; // 使用部门
      this.addobj.note = this.detailobj.remark; // 备注
      // 调用接口
      // 组装请求参数
      let params = {
        document_id: this.detailobj.id,
        process_id: this.detailobj.process_id,
      };
      axios
        .request({
          url: "/esop/EsopProcess/GetProcessApprovalHistory",
          params,
          method: "get",
        })
        .then((res) => {
          this.detailsflag = false;
          this.auditresult = [];
          if (res.data.ret === 1 && res.data.data.length !== 0) {
            // 如果有数据, 则隐藏. 如果没有数据, 则显示.
            this.detailsflag = false;
            this.auditresult = res.data.data;
            if (this.detailobj.approval_status == 1) {
              // 待审核
              this.detailsflag = false;
              this.auditresult = res.data.data;
            } else if (this.detailobj.approval_status == 2) {
              // 审核中
              this.detailsflag = false;
              this.auditresult = res.data.data;
            } else if (this.detailobj.approval_status == 3) {
              // 审核通过
              this.detailsflag = false;
              this.Passflag = true;
              this.auditresult = res.data.data;
            } else if (this.detailobj.approval_status == 4) {
              // 已撤回
              this.detailsflag = false;
              this.auditresult = res.data.data;
            } else if (this.detailobj.approval_status == 5) {
              // 审核不通过
              this.detailsflag = false;
              this.Passflag = false;
              this.auditresult = res.data.data;
            }
          } else {
            this.detailsflag = true;
          }
        });
    },
    //  文件格式验证失败时的钩子，返回字段为 file, fileList
    handleFormatError(file) {
      this.$Message.error(this.$t("950396") + file.name + this.$t("950397"));
    },
    //  文件上传成功时的钩子
    handleSuccess(res, file) {
      if (res.ret == 1) {
        this.$Message.success(this.$t("950398"));
        this.pdf_name = res.data;
        this.uploadtitle = file.name;
      } else {
        if (res.msg.indexOf("," != -1)) {
          inittip(res.msg);
        } else {
          this.$Message.error(this.$t(res.msg));
        }
      }
    },
    // 文件上传失败时的钩子
    handleError() {
      this.$Message.error(this.$t("2010006") + "!");
    },
    // 当表格的当前行发生变化的时候会触发
    handleRowChange(currentRow, oldCurrentRow) {
      this.detailobj = currentRow;
    },
    // 页码改变的回调，返回改变后的页码
    changePage(value) {
      this.page = value;
      this.tableData2 = this.tableSearch(this.page, this.pagesize);
    },
    // 切换每页条数时的回调，返回切换后的每页条数
    handlePageSize(value) {
      this.pagesize = value;
      this.tableData2 = this.tableSearch(this.page, this.pagesize);
    },
    // 审核弹框通过事件
    Passing() {
      // 组装请求参数
      let data = {
        id: this.detailobj.id,
        ispass: 1,
      };
      this.axios
        .request({
          url: "/esop/EsopDocumentCreate/ApprovalDocument",
          data,
          method: "post",
        })
        .then((res) => {
          let result = res.data;
          if (result.ret == 1) {
            this.showModal = false; // 隐藏
            this.$Message.success(this.$t("950320")); // 提示
            this.tableSearch(); // 刷新
          } else {
            this.showModal = false; // 隐藏
            this.$Message.error(this.$t("" + result.msg)); // 提示
            this.tableSearch(); // 刷新
          }
        });
    },
    // 审核弹框不通过事件
    NotPass() {
      // 组装请求参数
      let data = {
        id: this.detailobj.id,
        ispass: 0,
      };
      this.axios
        .request({
          url: "/esop/EsopDocumentCreate/ApprovalDocument",
          data,
          method: "post",
        })
        .then((res) => {
          let result = res.data;
          if (result.ret == 1) {
            this.showModal = false; // 隐藏
            this.$Message.warning(this.$t("950321")); // 提示用户
            this.tableSearch(); //  刷新列表
          } else {
            this.showModal = false; // 隐藏
            this.$Message.error(this.$t("" + result.msg)); // 提示用户
            this.tableSearch(); //  刷新列表
          }
        });
    },
  },
};
</script>

<style lang="less" scoped>
.selectBtn {
  width: 140px;
}
.Main > div {
  margin-bottom: 20px;
}
.audit {
  float: right;
  margin-right: 150px;
  margin-top: -345px;
  .auditLable {
    font-weight: bold;
    font-size: 14px;
    padding-bottom: 15px;
    padding-right: 28px;
  }
}
.time {
  font-size: 14px;
}
.content {
  padding-right: -15px;
}
.preview_content {
  overflow-y: scroll;
  overflow-x: hidden;
  min-height: 300px;
  max-height: 500px;
}
</style>
