<template>
  <el-form
    class="content-main"
    label-width="200px"
    :model="formQuery"
    ref="detailForm"
  >
    <el-row>
      <el-col :span="24">
        <h3 class="h3">人员基本信息</h3>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="12">
        <el-form-item label="企业名称:">
          <el-input
            class="inputWidth"
            :disabled="showLock || opCode"
            placeholder="企业名称"
            v-model="formQuery.qymc"
          ></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item
          label="姓名:"
          prop="ryxm"
          :rules="{
            required: true,
            trigger: ['change', 'blur'],
            validator: checkName,
          }"
        >
          <el-input
            maxlength="20"
            class="inputWidth"
            :disabled="showLock"
            placeholder="姓名"
            v-model="formQuery.ryxm"
          ></el-input>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="12">
        <el-form-item label="性别:" prop="xb" :rules="rules('性别')">
          <el-radio-group v-model="formQuery.xb">
            <el-radio label="男" :disabled="showLock">男</el-radio>
            <el-radio label="女" :disabled="showLock">女</el-radio>
          </el-radio-group>
          <!-- <el-input maxlength="20" class="inputWidth" :disabled="showLock"  placeholder="性别" v-model="formQuery.xb"></el-input> -->
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="政治面貌:" prop="zzmm" :rules="rules('政治面貌')">
          <!-- <el-input maxlength="20" class="inputWidth" :disabled="showLock" v-model="formQuery.zzmm"></el-input> -->
          <el-select
            class="inputWidth"
            :disabled="showLock"
            clearable
            v-model="formQuery.zzmm"
            placeholder="政治面貌"
          >
            <el-option
              v-for="(item, i) in zzmms"
              :key="i"
              :label="item.dictName"
              :value="item.dictCode"
            ></el-option>
          </el-select>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="12">
        <el-form-item label="出生年月:" prop="cssj" :rules="rules('出生年月')">
          <!-- <el-input maxlength="20" class="inputWidth" :disabled="showLock" v-model="formQuery.cssj"></el-input> -->
          <el-date-picker
            class="inputWidth"
            v-model="formQuery.cssj"
            type="date"
            :disabled="showLock"
            value-format="yyyy-MM-dd HH:mm:ss"
            placeholder="选择日期"
          ></el-date-picker>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item
          label="联系方式:"
          prop="lxdh"
          :rules="[rules('手机号码'), { validator: checkPhone }]"
        >
          <el-input
            class="inputWidth"
            :disabled="showLock"
            placeholder="联系方式"
            v-model="formQuery.lxdh"
            maxlength="11"
          ></el-input>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="12">
        <el-form-item
          label="固定电话:"
          prop="gddh"
          :rules="{
            validator: checkTelephone,
            trigger: ['chagne', 'blur'],
          }"
        >
          <el-input
            maxlength="20"
            class="inputWidth"
            :disabled="showLock"
            placeholder="固定电话"
            v-model="formQuery.gddh"
          ></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item
          label="邮箱:"
          prop="dzyx"
          :rules="{
            validator: checkEmail,
            trigger: ['chagne', 'blur'],
          }"
        >
          <el-input
            maxlength="20"
            class="inputWidth"
            :disabled="showLock"
            placeholder="邮箱"
            v-model="formQuery.dzyx"
          ></el-input>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="12">
        <el-form-item label="职务:" prop="zwmc" :rules="rules('职务')">
          <el-input
            maxlength="20"
            class="inputWidth"
            placeholder="职务"
            :disabled="showLock"
            v-model="formQuery.zwmc"
          ></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="岗位:" prop="gwdm" :rules="rules('岗位')">
          <el-select
            clearable
            v-model="formQuery.gwdm"
            class="inputWidth"
            :disabled="showLock"
            placeholder="岗位"
          >
            <el-option
              v-for="item in gw"
              :key="item.dictName"
              :label="item.dictName"
              :value="+item.dictCode"
            ></el-option>
          </el-select>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="12">
        <el-form-item label="岗位性质:" prop="gwxz" :rules="rules('岗位性质')">
          <el-select
            clearable
            v-model="formQuery.gwxz"
            class="inputWidth"
            :disabled="showLock"
            placeholder="岗位性质"
          >
            <el-option
              v-for="item in gwxzList"
              :key="item.dictName"
              :label="item.dictName"
              :value="item.dictCode"
            ></el-option>
          </el-select>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="24">
        <el-form-item label="个人简介:" prop="grjj">
          <el-input
            maxlength="200"
            style="width: 92%"
            placeholder="个人简介"
            :disabled="showLock"
            v-model="formQuery.grjj"
          ></el-input>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="24">
        <h3 class="h3">学历学位情况</h3>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="12">
        <el-form-item label="教育形式:">
          <el-select
            clearable
            v-model="formQuery.jyxs"
            class="inputWidth"
            :disabled="showLock"
            placeholder="教育形式"
          >
            <el-option
              v-for="item in statut"
              :key="item.dictCode"
              :label="item.dictName"
              :value="item.dictCode"
            ></el-option>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item
          label="毕业院校:"
          prop="byyx"
          :rules="{ validator: checkXw, trigger: ['chagne', 'blur'] }"
        >
          <el-input
            maxlength="20"
            class="inputWidth"
            placeholder="毕业院校"
            :disabled="showLock"
            v-model="formQuery.byyx"
          ></el-input>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="12">
        <el-form-item
          label="专业:"
          prop="xxzy"
          :rules="{ validator: checkXw, trigger: ['chagne', 'blur'] }"
        >
          <el-input
            maxlength="20"
            class="inputWidth"
            :disabled="showLock"
            placeholder="专业"
            v-model="formQuery.xxzy"
          ></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item
          label="学位:"
          prop="xw"
          :rules="{ validator: checkXw, trigger: ['chagne', 'blur'] }"
        >
          <el-input
            maxlength="20"
            class="inputWidth"
            placeholder="学位"
            :disabled="showLock"
            v-model="formQuery.xw"
          ></el-input>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="12">
        <el-form-item label="最高学历:">
          <el-select
            clearable
            v-model="formQuery.whcd"
            class="inputWidth"
            :disabled="showLock"
            placeholder="最高学历"
          >
            <el-option
              v-for="item in xl"
              :key="item.dictName"
              :label="item.dictName"
              :value="+item.dictCode"
            ></el-option>
          </el-select>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="24">
        <h3 class="h3">职业资格及等级</h3>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="12">
        <el-form-item label="职称(等级):">
          <!-- <el-input maxlength="20" class="inputWidth" :disabled="showLock" v-model="formQuery.zcdj"></el-input> -->
          <el-select
            clearable
            v-model="formQuery.zcdj"
            class="inputWidth"
            :disabled="showLock"
            placeholder="职称(等级)"
          >
            <el-option
              v-for="item in classDj"
              :key="item.dictName"
              :label="item.dictName"
              :value="+item.dictCode"
            ></el-option>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="职业资格证书名称:">
          <!-- <el-input maxlength="20" class="inputWidth"  v-model="formQuery.jszcdm"></el-input> -->
          <el-select
            clearable
            v-model="formQuery.jszcmc"
            :disabled="showLock"
            class="inputWidth"
            placeholder="职业资格证书名称"
          >
            <el-option
              v-for="item in bookName"
              :key="item.dictName"
              :label="item.dictName"
              :value="item.dictCode"
            ></el-option>
          </el-select>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="12">
        <el-form-item
          label="证书编号:"
          prop="jbzs"
          :rules="{
            validator: checkJbzs,
            trigger: ['chagne', 'blur'],
          }"
        >
          <el-input
            maxlength="20"
            class="inputWidth"
            :disabled="showLock"
            placeholder="证书编号"
            v-model="formQuery.jbzs"
          ></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item
          label="发证机关:"
          prop="fzdw"
          :rules="{ validator: checkXw, trigger: ['chagne', 'blur'] }"
        >
          <el-input
            maxlength="20"
            class="inputWidth"
            :disabled="showLock"
            placeholder="发证机关"
            v-model="formQuery.fzdw"
          ></el-input>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="12">
        <el-form-item label="颁证时间:">
          <el-date-picker
            :disabled="showLock"
            class="inputWidth"
            v-model="formQuery.bzsj"
            type="date"
            value-format="yyyy-MM-dd HH:mm:ss"
            placeholder="选择日期"
          ></el-date-picker>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="24">
        <h3 class="h3">其他证书</h3>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="12">
        <el-form-item
          label="专业:"
          prop="qtzy"
          :rules="{ validator: checkXw, trigger: ['blur'] }"
        >
          <el-input
            maxlength="20"
            class="inputWidth"
            placeholder="专业"
            :disabled="showLock"
            v-model="formQuery.qtzy"
          ></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item
          label="颁证机构:"
          prop="qtbzjg"
          :rules="{ validator: checkXw, trigger: ['blur'] }"
        >
          <el-input
            maxlength="20"
            class="inputWidth"
            placeholder="颁证机构"
            :disabled="showLock"
            v-model="formQuery.qtbzjg"
          ></el-input>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="12">
        <el-form-item label="颁证时间:">
          <!-- <el-input maxlength="20" class="inputWidth"  v-model="formQuery.qtbzsj" value-form="yyyy-MM-dd HH:mm:ss"></el-input> -->
          <el-date-picker
            class="inputWidth"
            :disabled="showLock"
            v-model="formQuery.qtbzsj"
            type="date"
            value-format="yyyy-MM-dd HH:mm:ss"
            placeholder="选择日期"
          ></el-date-picker>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="24">
        <h3 class="h3">证书附件</h3>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="12">
        <el-form-item label="证书附件:">
          <el-upload
            :on-preview="handlePreview"
            disabled
            :action="actionUrl"
            class="upload-demo"
            :file-list="fileList"
          >
          </el-upload>
        </el-form-item>
      </el-col>
    </el-row>
    <el-col :span="24">
      <div style="text-align: center; margin-top: 20px">
        <el-button
          type="primary"
          icon="iconfont iconchucun"
          @click="saveSubmit('save')"
          v-if="news"
          >保存</el-button
        >
        <el-button
          type="primary"
          icon="iconfont iconchucun"
          @click="Subsave('editsss')"
          v-if="updates"
          >保存</el-button
        >
        <el-button
          type="primary"
          icon="iconfont icontijiao"
          @click="SubmitSave"
          v-if="updates"
          >提交</el-button
        >
        <el-button
          type="primary"
          icon="iconfont icontijiao"
          @click="newSubmit('send')"
          v-if="news"
          >提交</el-button
        >
        <el-button
          type="primary"
          icon="iconfont icontijiao"
          @click="smts"
          v-if="trues"
          >提交</el-button
        >
        <el-button
          type="primary"
          icon="iconfont iconqiyong1"
          @click="openBox"
          v-if="openDiv"
          >启用</el-button
        >
        <el-button
          type="primary"
          icon="iconfont iconjinyong1"
          @click="closeBox"
          v-if="closesDiv"
          >禁用</el-button
        >
        <el-button type="primary" icon="iconfont iconfanhui" @click="cancel">
          返回</el-button
        >
      </div>
    </el-col>
  </el-form>
</template>

<script>
import { detailsFn, addFn, editFn, tyshs, zzmm } from "@/api/jcxxwh/ryxx";
import { fileInfo } from "@/api/grainReserves/alternationPlanManage/alternationApproval/index";
import {
  way,
  pack,
  statut,
  classDj,
  bookName,
  xl,
  gw,
  gwxzList,
} from "./zoots4.js";
import { file } from "@/api";
export default {
  name: "slqyxxsb",
  data() {
    return {
      actionUrl: file + "/file/upload",
      fileList: [],
      gwxzList: gwxzList,
      openDiv: true,
      closesDiv: true,
      opCode: true,
      news: true,
      updates: true,
      trues: true,
      shows: true,
      kddms: "",
      way: way,
      pack: pack,
      gw: gw,
      xl: xl,
      classDj: classDj,
      statut: statut,
      bookName: bookName,
      tysh: this.tysh,
      orgC: this.orgC,
      orgN: "",
      showLock: false,
      formQuery: {
        qymc: window.sessionStorage.getItem("orgName"),
        bmbdm: "",
        bmdm: "",
        bmzdm: "",
        byyx: "",
        bzsj: "",
        cjgzsj: "",
        createDate: "",
        creator: "",
        creatorCode: "",
        cssj: "",
        dzyx: "",
        fzdw: "",
        gddh: "",
        gwdm: null,
        jbzs: "",
        jg: "",
        jszcdm: null,
        jszcmc: "",
        jyxs: null,
        kddm: this.kddms,
        kdmc: "",
        lxdh: "",
        mz: "",
        qtbzjg: "",
        qtbzsj: "",
        qtzy: "",
        refreshTime: "",
        refresher: "",
        refresherCode: "",
        remark: "",
        rybh: window.sessionStorage.getItem("tyshxydm"),
        ryxm: "",
        sfba: null,
        sfzh: "",
        status: 0,
        whcd: null,
        xb: "",
        xw: "",
        xxzy: null,
        zcdj: null,
        zgqkdm: null,
        zwdm: null,
        zwmc: "",
        zzmm: "",
        grjj: "",
        gwxz: "",
      },
      dwzyyw1: [],
      qylx1: [],
      zzmms: [],
    };
  },
  methods: {
    checkName(rule, value, callback) {
      if (
        !/^([\u4e00-\u9fa5a-zA-Z]{1,20}|[\u4e00-\u9fa5a-zA-Z\.\s]{1,20})$/.test(
          value
        )
      ) {
        callback(new Error("姓名只能输入汉字和字母"));
      } else {
        callback();
      }
    },
    checkEmail(rule, value, callback) {
      let val = value.trim();
      if (
        /^([a-zA-Z0-9._-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/.test(
          value.trim()
        )
      )
        callback();
      else if (val == "") callback();
      else callback(new Error("请按照正确邮箱格式填写"));
    },
    checkPhone(rule, value, callback) {
      var val = value.trim();
      if (/^1\d{10}/.test(val)) {
        callback();
      } else {
        callback(new Error("请按照正确的手机号码格式填写"));
      }
    },
    checkXw(rule, value, callback) {
      var val = value;
      if (/^[\u4e00-\u9fa5a-z]+$/gi.test(val)) {
        callback();
      } else if (val == "") {
        callback();
      } else {
        callback(new Error("请输入汉字或英文"));
      }
    },
    checkJbzs(rule, value, callback) {
      var val = value.trim();
      if (/^[A-Za-z0-9]+$/.test(val)) {
        callback();
      } else if (val == "") {
        callback();
      } else {
        callback(new Error("请输入数字或英文"));
      }
    },
    checkTelephone(rule, value, callback) {
      var val = value.trim();
      if (/^(\(\d{3,4}\)|\d{3,4}-|\s)?\d{7,14}$/.test(val)) {
        callback();
      } else if (val == "") {
        callback();
      } else {
        callback(new Error("请输入正确固定电话格式"));
      }
    },
    rules(label) {
      return {
        required: true,
        message: "请输入" + label,
        trigger: ["change", "blur"],
      };
    },
    //查看详情
    scalePlanDetails(rybh) {
      //里的小table
      detailsFn(rybh).then((res) => {
        if (res.infoCode == "200") {
          this.formQuery = res.data;
          if (res.data.clfj) {
            fileInfo(res.data.clfj).then((res) => {
              this.fileList = res.data;
            });
          }
          this.$nextTick(() => {
            this.$refs.detailForm.clearValidate();
          });
        }
      });
    },
    tyshsMore() {
      tyshs(this.tysh).then((res) => {
        this.kddms = res.data[0].kddm;
      });
    },
    smts() {
      if (this.formQuery.jszcmc == "仓储管理员") {
        this.formQuery.jszcdm = 401;
      }
      if (this.formQuery.jszcmc == "农产品检验员") {
        this.formQuery.jszcdm = 402;
      }
      if (this.formQuery.jszcmc == "其他") {
        this.formQuery.jszcdm = 403;
      }
      this.formQuery.kddm = this.kddms;
      this.formQuery.qyzt = 1;
      let data = {
        ...this.formQuery,
        tyshxydm: this.tysh,
      };
      editFn(data).then((res) => {
        if (res.infoCode == 200) {
          this.$message({
            message: "修改成功",
            type: "success",
          });
          this.$router.push({ path: "/jcxxwh/ryxx" });
        } else {
          this.$message({
            message: "修改失败",
            type: "error",
          });
        }
      });
    },
    async newSubmit() {
      let isVoid = false;
      await this.$refs.detailForm.validate((valid) => {
        if (!valid) {
          this.$message.warning("必填项未填写或有格式填写错误,请先完善修改");
          isVoid = true;
        }
      });
      if (isVoid) return;
      if (this.formQuery.jszcmc == "仓储管理员") {
        this.formQuery.jszcdm = 401;
      }
      if (this.formQuery.jszcmc == "农产品检验员") {
        this.formQuery.jszcdm = 402;
      }
      if (this.formQuery.jszcmc == "其他") {
        this.formQuery.jszcdm = 403;
      }
      this.formQuery.kddm = this.kddms;
      this.formQuery.qyzt = 1;
      let data = {
        ...this.formQuery,
        tyshxydm: this.tysh,
      };
      addFn(data).then((res) => {
        if (res.infoCode == 200) {
          this.$message({
            message: "新增成功",
            type: "success",
          });
          this.$router.push({ path: "/jcxxwh/ryxx" });
        } else {
          this.$message({
            message: "新增失败",
            type: "error",
          });
        }
      });
    },
    async saveSubmit(status) {
      let isVoid = false;
      await this.$refs.detailForm.validate((valid) => {
        if (!valid) {
          this.$message.warning("请先完成必填项");
          isVoid = true;
        }
      });
      if (isVoid) return;
      this.orgN = window.sessionStorage.getItem("orgName");
      if (status == "save") {
        if (this.formQuery.jszcmc == "仓储管理员") {
          this.formQuery.jszcdm = 401;
        }
        if (this.formQuery.jszcmc == "农产品检验员") {
          this.formQuery.jszcdm = 402;
        }
        if (this.formQuery.jszcmc == "其他") {
          this.formQuery.jszcdm = 403;
        }
        this.formQuery.kddm = this.kddms;
        this.formQuery.qyzt = 0;
        let data = {
          ...this.formQuery,
          tyshxydm: this.tysh,
        };
        addFn(data).then((res) => {
          if (res.infoCode == 200) {
            this.$message({
              message: "保存成功",
              type: "success",
            });
            this.$router.push({ path: "/jcxxwh/ryxx" });
          } else {
            this.$message({
              message: "保存失败",
              type: "error",
            });
          }
        });
      }
    },
    async Subsave() {
      let isVoid = false;
      await this.$refs.detailForm.validate((valid) => {
        if (!valid) {
          this.$message.warning("请先完成必填项");
          isVoid = true;
        }
      });
      if (isVoid) return;
      if (this.formQuery.jszcmc == "仓储管理员") {
        this.formQuery.jszcdm = 401;
      }
      if (this.formQuery.jszcmc == "农产品检验员") {
        this.formQuery.jszcdm = 402;
      }
      if (this.formQuery.jszcmc == "其他") {
        this.formQuery.jszcdm = 403;
      }
      this.formQuery.kddm = this.kddms;
      this.formQuery.qyzt = 0;
      let data = {
        ...this.formQuery,
        tyshxydm: this.tysh,
      };
      editFn(data).then((res) => {
        if (res.infoCode == 200) {
          this.$router.push({ path: "/jcxxwh/ryxx" });
          this.$message({
            message: "保存成功",
            type: "success",
          });
        } else {
          this.$message({
            message: "保存失败",
            type: "error",
          });
        }
      });
    },
    async SubmitSave() {
      let isVoid = false;
      await this.$refs.detailForm.validate((valid) => {
        if (!valid) {
          this.$message.warning("请先完成必填项");
          isVoid = true;
        }
      });
      if (isVoid) return;
      if (this.formQuery.jszcmc == "仓储管理员") {
        this.formQuery.jszcdm = 401;
      }
      if (this.formQuery.jszcmc == "农产品检验员") {
        this.formQuery.jszcdm = 402;
      }
      if (this.formQuery.jszcmc == "其他") {
        this.formQuery.jszcdm = 403;
      }
      this.formQuery.kddm = this.kddms;
      this.formQuery.qyzt = 1;
      let data = {
        ...this.formQuery,
        tyshxydm: this.tysh,
      };
      editFn(data).then((res) => {
        if (res.infoCode == 200) {
          this.$message({
            message: "提交成功",
            type: "success",
          });
          this.$router.push({ path: "/jcxxwh/ryxx" });
        } else {
          this.$message({
            message: "提交失败",
            type: "error",
          });
        }
      });
    },
    //启用
    openBox() {
      if (this.formQuery.jszcmc == "仓储管理员") {
        this.formQuery.jszcdm = 401;
      }
      if (this.formQuery.jszcmc == "农产品检验员") {
        this.formQuery.jszcdm = 402;
      }
      if (this.formQuery.jszcmc == "其他") {
        this.formQuery.jszcdm = 403;
      }
      this.formQuery.kddm = this.kddms;
      this.formQuery.qyzt = 1;
      let data = {
        ...this.formQuery,
        tyshxydm: this.tysh,
      };
      editFn(data).then((res) => {
        if (res.infoCode == 200) {
          this.$message({
            message: "成功启用",
            type: "success",
          });
          this.$router.push({ path: "/jcxxwh/ryxx" });
        } else {
          this.$message({
            message: "启用失败",
            type: "error",
          });
        }
      });
    },
    //禁用
    closeBox() {
      if (this.formQuery.jszcmc == "仓储管理员") {
        this.formQuery.jszcdm = 401;
      }
      if (this.formQuery.jszcmc == "农产品检验员") {
        this.formQuery.jszcdm = 402;
      }
      if (this.formQuery.jszcmc == "其他") {
        this.formQuery.jszcdm = 403;
      }
      this.formQuery.kddm = this.kddms;
      this.formQuery.qyzt = 0;
      let data = {
        ...this.formQuery,
        tyshxydm: this.tysh,
      };
      editFn(data).then((res) => {
        if (res.infoCode == 200) {
          this.$message({
            message: "成功禁用",
            type: "success",
          });
          this.$router.push({ path: "/jcxxwh/ryxx" });
        } else {
          this.$message({
            message: "禁用失败",
            type: "error",
          });
        }
      });
    },
    cancel() {
      this.$router.back(-1);
    },
    initOpts() {
      zzmm().then((res) => {
        if (!res) return;
        var _arr = [];
        this.zzmms = res.data.filter((d) => {
          if (_arr.includes(d.dictCode)) return false;
          else {
            _arr.push(d.dictCode);
            return true;
          }
        });
      });
    },
    //shangchaun
    handlePreview(files) {
      window.location.href = `${file}/file/download?id=${
        files.response ? files.response.data.id : files.id
      }`;
    },
  },

  created() {
    this.initOpts();
    this.updates = false;
    this.trues = false;
    this.openDiv = false;
    this.closesDiv = false;
    // this.getInfo();
    if (this.$route.query.type == "detailsss") {
      this.scalePlanDetails(this.$route.query.rybh);
      this.news = false;
      this.showLock = true;
      this.updates = false;
      this.trues = false;
    }
    if (this.$route.query.type == "editsss") {
      this.showLock = false;
      this.news = false;
      this.updates = true;
      this.scalePlanDetails(this.$route.query.rybh);
    }
    if (this.$route.query.type == "smts") {
      this.scalePlanDetails(this.$route.query.rybh);
      this.showLock = false;
      this.news = false;
      this.updates = false;
      this.trues = true;
    }
    if (this.$route.query.type == "openOpen") {
      this.scalePlanDetails(this.$route.query.rybh);
      this.news = false;
      this.closesDiv = false;
      this.openDiv = true;
      this.updates = false;
      this.trues = false;
    }
    if (this.$route.query.type == "closeClose") {
      this.scalePlanDetails(this.$route.query.rybh);
      this.news = false;
      this.closesDiv = true;
      this.openDiv = false;
      this.updates = false;
      this.trues = false;
    }
    this.tysh = this.$route.query.tyshxydm;
    this.orgC = window.sessionStorage.getItem("orgCode");

    this.tyshsMore();
  },
};
</script>

<style scoped lang="scss" scoped>
.content-main {
  margin: 10px 10px 0;
  padding-top: 20px;
}

.span-inline-block {
  float: left;
  margin-right: 5px;
  width: 80px;
  text-align: right;
  line-height: 30px;
}

.inputWidth {
  width: 80% !important;
}

.h3 {
  width: 98%;
  text-align: center;
  font-size: 1em;
  line-height: 2.5;
  color: #fff;
  background-color: #49a2fa;
  margin-bottom: 20px;
}

.el-form {
  overflow: hidden;
  overflow-y: auto;
}

.el-row {
  .el-tooltip {
    float: left;
    padding: 0 12px 0 0;
    width: 118px;
    white-space: nowrap;
    text-align: right;
    vertical-align: middle;
    color: #525357;
    font-size: 14px;
    line-height: 40px;
    box-sizing: border-box;
  }
}
</style>
