<template>
  <div class="resumeDetail">
    <div class="resumeDetail-left">
    <div class="personalInformation" v-show="JSON.stringify(resume)!=='{}'">
      <p class="detailTitel">
        <span>
          <img src="https://o7oe0d6qz.qnssl.com/image/icon_%E5%9F%BA%E6%9C%AC%E4%BF%A1%E6%81%AF_23_16px.png" style="height:16px;width:23px; vertical-align: middle;margin-top:-4px">
        </span>
        <span style="margin-left:7px;font-size:16px;color:#0092FF" >基本信息</span>
        <!-- <span style="float:right;width:50px;height:24px;margin-right:5px"><Button type="primary" size='small' style="width:50px;height:24px" @click="downloadONE(detialID)" v-show="this.showBtn!=1">下载</Button></span> -->
      </p>
       <div class="massageTitle">
        <p>
          <span class="bassMassage">姓名：{{resume&&resume.ownerName}}</span>
          <span class="bassMassageRight">年龄：{{resume&&resume.ownerAge}}岁</span>
        </p>
        <p>
          <span class="bassMassage">联系电话：{{resume&&resume.ownerMobile}}</span>
          <span class="bassMassageRight">职位：{{resume&&resume.ownerExpectTitles}}</span>
        </p>
        <p>
          <span class="bassMassage">电子邮箱：{{resume&&resume.email}}</span>
          <span class="bassMassageRight">学历：{{resume&&resume.ownerHighestDegree}}</span>
        </p>
        <p>
          <span class="bassMassage">所在地：{{resume&&resume.locationCity}}</span>
          <span class="bassMassageRight">经验：{{resume&&resume.workYearsOriginal}}年</span>
        </p>
        <p>
          <span class="bassMassage">求职状态：{{resume&&resume.statusMessage}}</span>
          <span class="bassMassageRight"></span>
        </p>
        <p>
          <span class="bassMassage">期望行业：{{resume&&resume.industries}}</span>
          <span class="bassMassageRight">期望薪资：{{resume&&resume.expectSalary}}</span>
        </p>
        <p >
          <span class="bassMassage">期望职位：{{resume&&resume.expectTitles}}</span>
          <span class="bassMassageRight">期望地区：{{resume&&resume.city}}</span>
        </p>
       </div>
    </div>
    <div class="workExperience" v-show="roList.length !==0 ">
      <p class="detailTitel">
        <span>
          <img src="https://o7oe0d6qz.qnssl.com/image/icon_%E5%B7%A5%E4%BD%9C%E7%BB%8F%E5%8E%86_20_18px.png" style="height:16px;width:23px;vertical-align: middle;margin-top:-4px">
        </span>
        <span style="margin-left:7px;font-size:16px;color:#0092FF;">工作经历</span>
      </p>
      <div class="workExperience-detail"  v-for="(item,index) in roList" :key="index">
        <div class="workExperience-top">
         <p style="height:28px;line-height:28px;font-size:14px;">
           <span style="margin-left:30px">{{item.startTime}}-{{item.endTime}}</span>
           <span style="margin-left:18px"><span>{{item.company}}<span>({{item.workTime}})</span></span></span>
           <span style="float:right;margin-right:30px">
            <span>{{item.industry}}</span>
            <span>{{item.companyType}}</span>
           </span>
         </p>
         <p style="height:28px;line-height:28px;font-size:14px;">
           <span style="float:right;margin-right:30px">{{item.department}}</span>
         </p>
        </div>
        <div class="workExperience-bottom">{{item.desc}}</div>
      </div>
    </div>
    <div class="projectExperience" v-show="rpList.length !==0 ">
      <p class="detailTitel">
        <span>
          <img src="https://o7oe0d6qz.qnssl.com/image/icon_%E9%A1%B9%E7%9B%AE%E7%BB%8F%E5%8E%86_20_20px.png" style="height:14px;width:19px; vertical-align: middle;margin-top:-4px;margin-left:2px"></span>
        <span style="margin-left:7px;font-size:16px;color:#0092FF">项目经历</span>
      </p>
      <div class="projectExperience-detail" v-for="(item,index) in rpList" :key="index">
        <div class="projectExperience-top">
         <p style="height:28px;line-height:28px;font-size:14px;">
           <span style="margin-left:30px">{{item.startYear}}/{{item.startMonth}}-{{item.endYear}}/{{item.endMonth}}</span>
           <span style="margin-left:18px"><span>{{item.name}}<span></span></span></span>
           <span style="float:right;margin-right:30px">
            <span>{{item.post}}</span>
           </span>
         </p>
        </div>
        <div class="projectExperience-bottom">{{item.desc}}</div>
      </div>
    </div>
    <div class="internshipExperience" v-show="riList.length !==0 ">
      <p class="detailTitel">
        <span>
          <img src="https://o7oe0d6qz.qnssl.com/image/icon_%E5%AE%9E%E4%B9%A0%E7%BB%8F%E5%8E%86_21_18px.png" style="height:16px;width:23px; vertical-align: middle;margin-top:-4px"></span>
        <span style="margin-left:7px;font-size:16px;color:#0092FF">实习经历</span>
      </p>
      <div class="internshipExperience-detail"  v-for="(item,index) in riList" :key="index">
        <div class="internshipExperience-top">
         <p style="height:28px;line-height:28px;font-size:14px;">
           <span style="margin-left:30px">{{item.startYear}}/{{item.startMonth}}-{{item.endYear}}/{{item.endMonth}}</span>
           <span style="margin-left:18px"><span>{{item.company}}<span></span></span></span>
           <span style="float:right;margin-right:30px">
            <span>{{item.industry}}</span>
            <!-- <span>{{item.title}}</span> -->
           </span>
         </p>
          <p style="height:28px;line-height:28px;font-size:14px;">
           <span style="float:right;margin-right:30px">{{item.title}}</span>
          </p>
        </div>
        <div class="internshipExperience-bottom">{{item.desc}}</div>
      </div>
    </div>
    <div class="educationalExperience" v-show="reList.length !==0">
      <p class="detailTitel">
        <span>
          <img src="https://o7oe0d6qz.qnssl.com/image/icon_%E6%95%99%E8%82%B2%E7%BB%8F%E5%8E%86_26_20px.png" style="height:16px;width:23px; vertical-align: middle;margin-top:-4px"></span>
        <span style="margin-left:7px;font-size:16px;color:#0092FF">教育经历</span>
      </p>
      <div class="educationalExperience-detail"  v-for="(item,index) in reList" :key="index">
         <div class="educationalExperience-content">
           <div class="educationalExperience-left">
             <p style="line-height:25px;margin-top:20px">{{item.school}}(({{item.startYear}}.{{item.startMonth}}-{{item.endYear}}.{{item.endMonth}}))</p>
             <p style="margin-top:20px;">专业：{{item.major}}</p>
           </div>
           <div class="educationalExperience-right">
             <p style="margin-top:65px">学历：{{item.degree}}</p>
           </div>
         </div>
      </div>
    </div>
    <div class="Self-evaluation" v-show="JSON.stringify(resume)!=='{}'">
      <p class="detailTitel">
        <span>
          <img src="https://o7oe0d6qz.qnssl.com/image/icon_%E8%87%AA%E6%88%91%E8%AF%84%E4%BB%B7_18_18px.png" style="height:16px;width:23px; vertical-align: middle;margin-top:-4px"></span>
        <span style="margin-left:7px;font-size:16px;color:#0092FF">自我评价</span>
      </p>
      <div class="evaluation-content">
          {{resume&&resume.selfEvaluate}}
      </div>
    </div>
    </div>
    <div class="resumeDetail-right" v-if="this.showBtn!=1">
      <div class="testResume">
        <Button type="primary" size='small' style="width:150px;height:34px;margin:0 0 0 15px;font-size:14px" @click="downloadONE(detialID)" >下&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;载</Button><br>
        <Button type="primary" size='small' style="width:150px;height:34px;margin:20px 0 0 15px;font-size:14px" @click="transpond" >转发给面试官</Button><br>
        <p style="margin-top:40px;font-size:16px">当前简历状态：<span style="color:#0092FF" >{{detailStatus[detailSta]}}</span></p>
        <Button type="primary" size='small' style="width:150px;height:34px;margin:20px 0 0 15px;font-size:14px" @click="sendEmail" v-show="hasINterview==false">邀请面试</Button><br>
        <Button type="primary" :disabled="todoDisabled" size='small' style="width:150px;height:34px;margin:20px 0 0 15px;font-size:14px" @click="todo" v-show="hasINterview==false">待&nbsp;处&nbsp;理</Button><br>
        <Button type="primary" :disabled="passDisabled" size='small' style="width:150px;height:34px;margin:20px 0 0 15px;font-size:14px" @click="pass" v-show="hasINterview==false">PASS</Button><br>
        <Button type="primary" :disabled="optionDisabled" size='small' style="width:150px;height:34px;margin:20px 0 0 15px;font-size:14px" @click="option" v-show="hasINterview==false">备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;选</Button><br>
      </div>
    </div>
    <Modal
        v-model="emailMOdal"
         width='1000px'
         :mask-closable='false'
         :closable='false'
         :styles="{top:'50px'}">
        <div >
            <!-- <h2 style="text-align:center;color:black" v-show="this.isShowAll==false">发送邮件</h2> -->
            <h2 style="text-align:center;color:black" >新建面试</h2>
            <h3 style="text-align:center;color:black" > <span>新建面试后，你需要从<span style="color:#0092ff">“面试管理”</span>中对该候选人进行后续的操作。</span></h3>
        </div>
        <div class="emailModal-title">
          <div class="emailModalTitle-left">
            <p>
              <Form :label-width="70"  :model="emailInline" label-position="left" style="margin-left:5%" ref="emailInline" :rules="emailruleInline" class="emailForm">
                <FormItem label="选择模板" style="margin-top:20px" prop='moo'>
                  <Select style="width:95%" @on-change='getEmailContentValue' v-model="emailInline.moo" >
                      <Option  v-for="(item,index) in emailInline.modalArr" :key="index" :value="item.templateCode">{{item.templateName}}</Option>
                  </Select><br>
                  <!-- <span v-show="emailMassage==true">你尚未选择简历，请先选择简历</span> -->
                </FormItem>
                <FormItem label="收件人" style="margin-top:20px" prop='receiveEmail'>
                   <Input style="width:95%" v-model="emailInline.receiveEmail"  @on-focus='getfocus("emailInline","receiveEmail")'/>
                   <span style="position: absolute;left:0;top:30px;color:gray;font-size:12px;" v-show='!tip'>{{tipInfo}}</span>
                </FormItem>
                <FormItem label="抄送" style="margin-top:20px" prop='copyname'>
                  <Input style="width:95%" v-model="emailInline.copyname" @on-focus='getfocus("emailInline","copyname")'/>
                </FormItem>
                <FormItem label="主题" style="margin-top:20px" prop='theme'>
                    <Input  style="width:95%" v-model="emailInline.theme" @on-focus='getfocus("emailInline","theme")'/>
                </FormItem>
              </Form>
            </p>
          </div>
          <div class="emailModalTitle-right">
               <h3 style="text-align:center;margin-top:20px">请输入约面信息</h3>
               <Form :label-width="80" ref="formInline" :rules="ruleInline" :model="formInline" style="margin-top:35px" label-position="left" class="emailForm">
                    <FormItem label="邀约人" style="margin-top:20px" prop="UpdateOWER">
                        <Input v-model="formInline.UpdateOWER" style="width:100%" :maxlength="5" @on-focus='getfocus("formInline", "UpdateOWER")'/>
                    </FormItem>
                    <FormItem label="面试时间" style="margin-top:20px" prop="UpdateTIME">
                      <DatePicker type="datetime"  style="width:100%" v-model="formInline.UpdateTIME" format="yyyy-MM-dd HH:mm" @on-change="changeTime" :options="options3" :editable='false' @on-open-change='getfocus("formInline", "UpdateTIME", $event)'></DatePicker>
                    </FormItem>
                    <FormItem label="面试官" style="margin-top:20px" prop='UpdateVIEW'>
                       <Select v-model ='formInline.UpdateVIEW' filterable style='width:100%;' remote
                        :remote-method="remoteMethod"
                        :loading="loading1" placeholder='请输入面试官全名' clearable @on-open-change='getfocus("formInline", "UpdateVIEW", $event)'  ref='setQuery' :label='formInline.UpdateVIEW'>
                        <Option v-for='(item, index) in options' :key='index' :value='item.name'>{{item.name}}({{item.email}})</Option>
                     </Select>
                    </FormItem>  
                </Form>
               
          </div>
        </div>
        <div class="ckeditor">
            <ckeditor :value='editorObject' ref='editor' :uploadUrl='uploadurl' height='300px' width='100%' style="margin-left:3%"></ckeditor>
        </div>
        <div class="uploadEnclosure">
            <p style="height:50px;">
              <span style="font-size:16px;display:inline-block;margin:20px 0 0 3%">添加附件</span>
              <span style="margin-left:500px">
                 <Upload
                    multiple
                    :before-upload='beforUpload'
                    action="//jsonplaceholder.typicode.com/posts/">
                 <Button  size='small' style="margin:-40px 0 0 95px" type="primary" @click="uploadFile">选择文件</Button>
                 </Upload>
               </span>
            </p>
            <p v-for="(item,index) in fileList" :key="index" style="height:30px;line-height:30px">
              <span style="margin-left:60px">{{item}}</span> 
              <span><Icon type="md-close" @click="delateFile(index)" style="font-size:16px;float:right;margin-right:80px" /></span>
            </p>
        </div>
        <div  slot='footer' style="text-align:center;position:relative;" class="Ubt">
            <Button type='primary' @click='emailModalPush'>取消</Button>
            <Button type='primary' @click='submit'>发送</Button>
            <!-- <Button type='primary' @click='submit' v-show="this.isShowAll==true">添加并发送</Button> -->
            <Checkbox v-model="formInline.sendWeixin" class='wechat'><span>微信通知面试官</span></Checkbox>
        </div>
    </Modal>
     <Modal
        v-model="modal8"
         width='400'
         :closable='false'>
        <div style='min-height:300px;'>
          <div class='title'>
            <h2 style="text-align:center">转发给面试官</h2>
            <p class='hint' style="margin-top:10px;text-align:center">该通知将以微信形式发送给面试官，面试官可通过微信筛选简历</p>
          </div>
          <Form ref="transpondFrom" :model="transpondFrom" :rules="transpondRule" style="margin-top:10px">
            <FormItem label='面试官' prop='interviewerName'>
             <Select v-model ='transpondFrom.interviewerName' filterable style='width:250px;' remote
                :remote-method="remoteMethod"
                :loading="loading1" placeholder='请输入面试官全名' clearable>
                <Option v-for='(item, index) in options' :key='index' :value='item.email'>{{item.name}}({{item.email}})</Option>
             </Select>
            </FormItem>
            <FormItem label='' prop='interviewee'>
              <div class='interviewee'>
                 <div class='pic'>
                  <img src='https://o7oe0d6qz.qnssl.com/resume.png'></img>
                 </div>
                  <span style='' class="name">{{contentName}}</span>
              </div>
            </FormItem>
          </Form>
        </div>
        <div  slot='footer' style="text-align:center">
            <Button type='primary' @click='modal8=false'>取消</Button>
            <Button type='primary' @click="sendNotice" >发送</Button>
        </div>
    </Modal>
    <Modal
        v-model="modal10"
         width='280px'
         :closable='false'>
        <div >
            <h2 style="text-align: center;color:black">提示</h2>
            <p style="text-align:center">确定要发送邮件吗？</p>
        </div>
        <div  slot='footer' style="text-align:center">
            <Button type='primary' @click='modal10=false'>取消</Button>
            <Button type='primary' @click="confireSendEmail">确定</Button>
        </div>
    </Modal>
    <!-- 发送失败再次发送 -->
     <Modal
        v-model="modal11"
         width='350px'
         :closable='false'>
        <div >
            <h2 style="text-align: center;color:black">提示</h2>
            <p style="text-align:center;margin-top:10px;font-size: 14px;text-align:left;">{{errorInfo}}</p>
        </div>
        <div  slot='footer' style="text-align:center">
            <Button type='primary' @click='cancelSubmit'>取消</Button>
            <Button type='primary' @click="sendFail">确定</Button>
        </div>
    </Modal>
    <Modal
        v-model="modal12"
         width='450px'
         :closable='false'
         :footer-hide='true'
         :mask-closable='false'>
        <div style="text-align:center">
          <h2 style="text-align: center;color:black;font-size:16px">发送失败</h2>
          <p style="text-align: center;color:black;margin-top:15px;font-size:15px">该面试官没有通过微信端绑定账号，请提醒他关注并绑定。</p>
          <p style="text-align: center;color:#0092FF;margin-top:30px;font-size:15px;cursor:pointer;font-weight: 900" @click="modal12=false">我已知晓</p>
        </div>
    </Modal>
    <Modal
        v-model="modal13"
         width='480px'
         :closable='false'
         :footer-hide='true'
         :mask-closable='false'>
        <div style="text-align:center">
          <h2 style="text-align: center;color:black;font-size:16px">发送失败</h2>
          <p style="text-align: center;color:black;margin-top:15px;font-size:15px">该面试官没有关注微信，无法接收通知，请提醒他关注并绑定。</p>
          <p style="text-align: center;color:#0092FF;margin-top:30px;font-size:15px;cursor:pointer;font-weight: 900" @click="modal13=false">我已知晓</p>
        </div>
    </Modal>
  </div>
</template>
<script>
import moment from 'moment'
import {seedetail,updatastatus,TODORes,sendEmail,getEmailMoo,getEmailContent,uploadimage, findCompanyEmailByKey,forwardResume} from '../../api/resume.server'
import localStorage from '../../service/localstorage.service.js'
 import {
  sapi
}from '../../config'
import ckeditor from '../../components/ckeditor'
import{_debounce,_throttle,emailValidata, emailRule, vidte, validator} from '../../service/util.js'
export default {
  data(){
    return {
      resume:{},
      riList:[],
      roList:[],
      rpList:[],
      reList:[],
      name:'',
      detailSta:'',
      emailMOdal:false,
      tip: false,
      loading1: false,
      modal8:false,
      modal10:false,
      modal11:false,
      modal12:false,
      modal13:false,
      boxIsShow:false,
      errorMassage:'',
      interviewee: [],
      contentName:'',
      a:{'a_b':'hjbjhbjbh','b':'4'},
      detailStatus:{'TO_DO':'待处理','INTERVIEW_OK':'面试合适','INTERVIEW_FAIL':'面试淘汰','END':'终止面试','SEE_FAIL':'约面失败','NO_ENTRY':'未入职',
      'TO_SEE':'准备约面','END':'终止面试','SEE_FAIL':'约面失败','NO_ENTRY':'未入职','HAS_SEE':'已邀约','OPTION':'备选','TO_SENT_OFFER':'待Offer','HAS_SENT_OFFER':'已发offer',
       'TO_ENTRY':'待入职', 'HAS_ENTRY':'已入职', 'PASS':'PASS', 'RESET':'重启面试','ARRIVED':'已到达'},
      // detailStatus:[{sta:'TO_DO',detailSta:'待处理'},{sta:'INTERVIEW_OK',detailSta:'面试合适'},{sta:'INTERVIEW_FAIL',detailSta:'面试淘汰'},
      //  {sta:'END',detailSta:'终止面试'},{sta:'SEE_FAIL',detailSta:'约面失败'},{sta:'NO_ENTRY',detailSta:'未入职'},{sta:'TO_SEE',detailSta:'准备约面'},
      //  {sta:'HAS_SEE',detailSta:'已邀约'},{sta:'OPTION',detailSta:'备选'},{sta:'TO_SENT_OFFER',detailSta:'待Offer'},{sta:'HAS_SENT_OFFER',detailSta:'已发offer'},{sta:'TO_ENTRY',detailSta:'待入职'},
      //  {sta:'HAS_ENTRY',detailSta:'已入职'},{sta:'PASS',detailSta:'PASS'},{sta:'RESET',detailSta:'重启面试'},{sta:'ARRIVED',detailSta:'已到达'}],
      emailId:'',
      transpondFrom: {
        interviewerName: ''
      },
      transpondRule: {
        interviewerName: [{required: true, trigger: 'blur', validator: validator.bind(this)}]
      },
      options: [],
      todoDisabled:false,
      passDisabled:false,
      optionDisabled:false,
      editorObject: {type: '', value: ''},
      tipInfo: '输入多个邮箱地址以英文”;“分隔',
      fileList:[],
      UpdateTIMETwo:'',
      uploadFileList:[],
      temp:'',
      uploadurl:`${sapi}/api/ckeditor/uploadImage?token=${localStorage.get('token')}&&backUrl=/getimage`,
      downresume:'',
      detialID:'',
      showBtn:'',
      errorInfo:'',
      isShowAll:false,
      isShowTwo:false,
      interviewIsShow:false,
      hasINterview:false,
      resumeIdList:[],
      options3: {
        disabledDate (date) {
          return date && date.valueOf() <Date.now()-3600*24*1000;
        }
      },
      ruleInline: {
        UpdateOWER: [
          {  required: true, message: '邀约人不能为空', trigger: 'blur',validator: emailValidata.bind(this)}
        ],
        UpdateTIME: [
          {  required: true,  message: '面试时间不能为空', trigger: 'change', type:'date', validator: emailValidata.bind(this)}
        ],
          UpdateVIEW: [
          {  required: true,message: '面试官不能为空',  trigger: 'change', validator: emailValidata.bind(this), type: String}
        ]
    },
    emailruleInline: {
      receiveEmail: [{required: true, trigger: 'blur', pattern: emailRule, validator: emailValidata.bind(this)}],
      theme: [{required: true, trigger: 'blur',message: '主题不能为空', validator: emailValidata.bind(this)}],
      copyname: [{required: false, trigger: 'blur', pattern: emailRule, validator: emailValidata.bind(this), empty: true}]
    },
    formInline:{
        UpdateOWER:'',
        UpdateTIME:'',
        UpdateVIEW:'',
        sendWeixin: true
    },
    emailInline:{
      moo:'',
      modalArr:[],
      copyname:'',
      receiveEmail:'',//收件人
      theme:'',//主题
      Enclosure:[],//附件
      templateContent:'',//模板内容
    },
    }
  },
  components:{
    ckeditor
  },
   methods: {
    getDETAIL(){
      this.detialID=this.$route.query.ID
      this.resumeIdList.push(this.$route.query.ID)
      this.emailId=this.$route.query.ID
      this.detailSta=this.$route.query.status
      this.showBtn=this.$route.query.noShowBtn
      let token = this.$route.query.token || ''
      let parmars={
        uid:this.$route.query.id
      }
      seedetail(parmars).then(res=>{
        this.resume=res.data.body.resume
        this.riList=res.data.body.riList
        this.roList=res.data.body.roList
        this.rpList=res.data.body.rpList
        this.reList=res.data.body.reList
        this.name=res.data.body.resume.ownerName
      })
    },
        // 下载简历
    downloadONE(doid){
      window.location.href=`${sapi}/api/resume/download/formatted/one?resumeId=${doid}`
    },
    // 发送邮件
    sendEmail(type){
      this.emailInline.modalArr=[]
      this.$refs.emailInline.resetFields()
      this.$refs.formInline.resetFields()
      this.emailInline.moo = 'TEMP_0001'
      this.options=[]
      this.emailMOdal=true
      getEmailMoo().then(res=>{
        this.emailInline.modalArr=res.data.body
        })
        this.getEmailContentValue(this.emailInline.moo)
      },
      getEmailContentValue(value){
        if (!value){
          return
        }
        this.isDisable=true
        this.temp=value
        this.emailCode=value
        let params={
          resumeId:this.emailId==''?'':this.emailId,
          templateCode:this.emailCode
        }
        getEmailContent(params).then(res=>{
          this.emailInline.theme=res.data.body.templateSubject
          this.emailInline.receiveEmail=res.data.body.receiveEmail
          this.emailInline.templateContent=res.data.body.templateContent
          this.editorObject = {
            type: value,
            value: this.emailInline.templateContent || ''
          }
          if(res.data.body&&res.data.body.resumeInterviewVO){
          this.formInline.UpdateOWER=res.data.body.resumeInterviewVO.inviterName
          this.formInline.UpdateVIEW=res.data.body.resumeInterviewVO.interviewerName
          this.formInline.UpdateTIME=res.data.body.resumeInterviewVO.seeTime
          this.changeTime(this.formInline.UpdateTIME)
          }else{
            this.formInline.UpdateOWER=''
            this.formInline.UpdateVIEW=''
            this.formInline.UpdateTIME='' 
          }
          
        })
      },
        getfocus(form, name, e){
          let vm = this;
          let value = this[form][name]
          if(name == 'receiveEmail') {
            this.tip&&this.$refs[form].fields.forEach(function (e) {
              if (e.prop == name) {      
                e.resetField()
                vm[form][name] = value
                vm.tip = false
              }
            })
          } else {
            if (name=='UpdateTIME'&&e==false){ // 时间选择器关闭弹框的时候
              this.$refs.formInline.validateField('UpdateTIME', (e) => {})
              return
            }
            if (name=='UpdateVIEW'&&e==false){ // 选择关闭弹框的时候
              this.$refs.formInline.validateField('UpdateVIEW', (e) => {
              })
              return
            }
            this.$refs[form].fields.forEach(function (e) {
              if (e.prop == name) {      
                e.resetField()
                vm[form][name] = value
              }
            })
          }          
        },
        changeTime(b){
          this.UpdateTIME=b
          if (!b){
            this.editorObject = {
              type: this.temp,
              value: this.emailInline.templateContent
            }
            this.isDisable = false
            return
          } else {
            this.isDisable = true
          }
          var reg = /<span id="email_seeTime"><span>/g
          var time = b.split('-')
          var year = time[0]
          var mon = time[1]
          var day = time[2].split(' ')[0]
          var time = time[2].split(' ')[1]
          var content = `<span id="email_seeTime">${year}年${mon}月${day}日 ${time}<span>`
          this.editorObject = {
            type: this.temp,
            value: this.emailInline.templateContent.replace(reg, content)
          }
        },
        remoteMethod: async function(query){
          if (query !== '') {
            this.loading1 = true;
            setTimeout(async () => {
              this.loading1 = false;
              query = query.split('(')[0]
              let list = await findCompanyEmailByKey(query)
              this.options = list.data.body || []
            }, 200);                  
          } else {
            this.options = [];
          }
        },
        beforUpload(uploadFile){
        let isLiment=false
          if(uploadFile.size/1024 > 10240){
            isLiment=true
            this.limentName+=1
            if(this.limentName==1){
          this.$Notice.error({
          title: '提示',
          desc:  '单个文件不能大于10M'
          })
        }
          }else{
            this.fileList.push(uploadFile.name)
            this.uploadFileList.push(uploadFile)
          }
          return false
        },
        uploadFile(){
          this.limentName=0
        },
        emailModalPush(){
          this.$refs.emailInline.resetFields()
          this.$refs.formInline.resetFields()
          this.emailInline.modalArr=[]
          this.emailInline.theme=''
          this.emailInline.receiveEmail=''
          this.emailInline.templateContent=''
          this.sad=''
          this.fileList=[]
          this.emailInline.moo=''
          this.emailMOdal=false
          this.emailMassage=false 
          this.emailIdArr=[]
          this.emailFlowStatus=''
          this.formInline.UpdateOWER=''
          this.formInline.UpdateVIEW=''
          this.formInline.UpdateTIME=''
          this.formInline.sendWeixin=true
          this.emailInline.copyname=''
          this.isShowTwo=false
          this.isLimitSize=false 
          this.uploadFileList=[]
          // this.clearInterviewee()
          // this.SouSuo(this.pageT,'init')
        },
        submit() {
          let flag = false
          this.$refs.emailInline.validate(val => {
          if (!val) {
            flag = true
            return
          }
         })
         this.$refs.formInline.validate(val => {
          if (!val) {
            flag = true
            return
          }
         })
         if (!flag){
          this.modal10=true
         }
        },
        clearInterviewee (value) {
          this.interviewee = []
          this.checkboxList = []
          this.delateARRALL = []
          this.flowStatusarr = []
        },
        sendNotice: _debounce( function() {
          this.$refs.transpondFrom.validate(valid => {
            if(!this.transpondFrom.interviewerName){
              return
            }
             let params = {
                 resumeIdList:this.resumeIdList,
                 email: this.transpondFrom.interviewerName
             }
             forwardResume(params).then(res => {
                if (res.data.success == true) {
                  this.clearInterviewee()
                  this.modal8 = false
                  setTimeout(() => {
                      this.$Notice.success({
                        title: '提示',
                        desc:  '发送成功'
                      })
                    }, 300)
                } else{
                  this.errorCode=res.data.body.code
                  this.errorMassage=res.data.body.message
                  this.modal8=false
                  this.clearInterviewee()
                  if(this.errorCode=='40001'){
                    this.modal12=true
                  }
                  if(this.errorCode=='40002'){
                    this.modal13=true
                  }
                  if(this.errorCode=='0'){
                    this.$Notice.error({
                      title: '提示',
                      desc: this.errorMassage
                    })
                  }
                }    
             })
          })
        },800),
        transpond() { //打开转发简历的modal
          this.$refs.transpondFrom.resetFields()
          this.modal8= true
          this.contentName=this.name
        },
        delInterviewee(name){
          this.contentName=''
        },
        // 确认发送邮件
        // _debounce(confireSendEmail,500),
        confireSendEmail: _debounce(function(){
        this.sad = this.getEditorValue()
        if(this.sad==''){
          this.$Notice.error({
            title: '提示',
            desc:  '请填写完整的信息'
            });
            return 
         }
         if(this.emailInline.moo==''){
           this.$Notice.error({
            title: '提示',
            desc:  '请填写完整的信息'
            });
            return 
         }
         if((this.temp=='TEMP_0001')&&(this.emailInline.moo==''||this.emailInline.receiveEmail==''||this.emailInline.theme==''||this.formInline.UpdateOWER==''||this.formInline.UpdateVIEW==''||this.formInline.UpdateTIME=='')){
            this.$Notice.error({
            title: '提示',
            desc:  '请填写完整的信息'
            });
            return
         }
         if(this.emailInline.copyname!==''&&!(/^((([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6}\;))*(([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})))$/.test(this.emailInline.copyname))){
            this.$Notice.error({
            title: '提示',
            desc:  '请正确填写邮箱地址'
           });
           return
        }
        if(!(/^((([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6}\;))*(([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})))$/.test(this.emailInline.receiveEmail))){
            this.$Notice.error({
            title: '提示',
            desc:  '请正确填写邮箱地址'
           });
           return
        }
         this.attachFileList=this.uploadFileList.length==0?'':this.uploadFileList
         this.flowStatusTT=this.emailFlowStatus==''?'':'TO_SEE'
         this.UpdateTIMETwo=this.formInline.UpdateTIME==''?'':this.formInline.UpdateTIME
         if(this.temp=='TEMP_0001'){
            var formData= new FormData()
            if(this.attachFileList.length!==0){
               this.attachFileList.map(item=>{
              formData.append('attachFileList',item)   
            }) 
            }else{
                formData.append('attachFileList','')   
            }
            formData.append('resumeId',this.emailId)
            formData.append('templateCode',this.emailCode)
            formData.append('subject',this.emailInline.theme)
            formData.append('toEmail',this.emailInline.receiveEmail)
            formData.append('ccEmail',this.emailInline.copyname)
            formData.append('emailContent',this.sad)
            formData.append('resumeInterviewVO.resumeId',this.emailId)
            formData.append('resumeInterviewVO.inviterName',this.formInline.UpdateOWER==''?'':this.formInline.UpdateOWER)
            formData.append('resumeInterviewVO.interviewerName',this.formInline.UpdateVIEW==''?'':this.formInline.UpdateVIEW)
            let info = this.options.find(item => item.name == this.formInline.UpdateVIEW)
            formData.append('resumeInterviewVO.email',(info&&info.email) || '')
            formData.append('sendWeixin',this.formInline.sendWeixin==true ? 1 : 0)
            formData.append('resumeInterviewVO.seeTime',moment( this.UpdateTIMETwo).format('YYYY/MM/DD HH:mm'))
            formData.append(' flowStatus',this.flowStatusTT)
            this.isDisable=false
            sendEmail(formData).then(res=>{
              this.isDisable=true
              if(res.data.success==true){
                setTimeout(() => {
                  this.$Notice.success({
                    title: '提示',
                    desc:  '发送邮件成功'
                  })
                }, 500)
                this.detailSta='HAS_SEE'
                this.hasINterview=true
                this.emailMOdal=false
                this.modal10=false
                this.emailInline.modalArr=[]
                this.emailInline.theme=''
                this.emailInline.receiveEmail=''
                this.emailInline.templateContent=''
                this.sad=''
                this.fileList=[]
                this.emailInline.moo=''
                this.emailMOdal=false
                this.emailMassage=false 
                this.emailIdArr=[]
                this.emailFlowStatus=''
                this.formInline.UpdateOWER=''
                this.formInline.UpdateVIEW=''
                this.formInline.UpdateTIME=''
                this.formInline.sendWeixin=true
                this.emailInline.copyname=''
                this.isShowTwo=false
                this.uploadFileList=[]
                this.clearInterviewee()
                }
                if(res.data.success==false){
                  this.modal10 = false
                  this.modal11 = true
                  this.errorInfo = res.data.body.message
                }
            })
          }
        },800),
        getEditorValue(value){ // 调编辑器组件方法获取数据
          return this.$refs.editor.getValue()
        },
        // 判断按钮的显示与隐藏
        judeBtn(){
          if(this.detailSta == 'TO_DO'|| this.detailSta == 'PASS' || this.detailSta == 'OPTION'){
            this.hasINterview=false 
          }else{
            this.hasINterview=true 
          }
          if(this.detailSta == 'TO_DO'){
            this.todoDisabled=true
          }
          if(this.detailSta == 'PASS'){
            this.passDisabled=true
          }
          if(this.detailSta == 'OPTION'){
            this.optionDisabled=true
          }
        },
         cancelSubmit(){
          this.emailMOdal=false
          this.modal11=false
          this.emailInline.modalArr=[]
          this.emailInline.theme=''
          this.emailInline.receiveEmail=''
          this.emailInline.templateContent=''
          this.sad=''
          this.fileList=[]
          this.emailInline.moo=''
          this.emailMOdal=false
          this.emailMassage=false 
          this.emailIdArr=[]
          this.emailFlowStatus=''
          this.formInline.UpdateOWER=''
          this.formInline.UpdateVIEW=''
          this.formInline.UpdateTIME=''
          this.formInline.sendWeixin=true
          this.emailInline.copyname=''
          this.isShowTwo=false
          this.uploadFileList=[]
          this.clearInterviewee()
        },
         sendFail(){
          this.modal11 = false
        },
        // 待处理
        todo(){
          let parmars={
            id: this.detialID,
            status:'TO_DO'
          }
          updatastatus(parmars).then(res=>{
             this.detailSta='TO_DO'
             this.todoDisabled=true
             this.passDisabled=false
             this.optionDisabled=false
          })
        },
        // 备选
        option(){
          let parmars={
            id: this.detialID,
            status:'OPTION'
          }
          updatastatus(parmars).then(res=>{
             this.detailSta='OPTION'
             this.todoDisabled=false
             this.passDisabled=false
             this.optionDisabled=true
          })
        },
        // PASS
        pass(){
          let parmars={
            id: this.detialID,
            status:'PASS'
          }
          updatastatus(parmars).then(res=>{
            this.detailSta='PASS'
            this.todoDisabled=false
            this.passDisabled=true
            this.optionDisabled=false
          })
        },
      },
      mounted(){
        this.getDETAIL()
        this.boxIsShow=true
        this.judeBtn()
      }
}
</script>
<style scoped>
.resumeDetail{
  width: 1100px;
  margin: 30px auto;
  color: #000000;
  font-family: "\5FAE\8F6F\96C5\9ED1"
}
.resumeDetail-left{
  float: left;
  width:860px;
  min-height: 200px
  /* border: 1px solid #999 */
}
.pic img{
  width: 60px;
  height: 60px
}
.pic .icon{
  position: relative;
  left:100px;
  top:-90px
}
.interviewee .name{
  position: relative;
  left: 13px;
  top:-20px;
  display: inline-block;
  /* margin-left: 200px */
}
.resumeDetail-right{
  float: left;
  width: 200px;
}
.wechat{
 float: right;
 margin-top: 10px
}
.emailModal-title{
    height: 280px;
    width: 100%;
    
  }
  .emailModalTitle-left{
    height: 100%;
    width: 60%;
    float: left;
  }
  .emailModalTitle-right{
    height: 100%;
    width: 40%;
    float: left;
  }
.personalInformation{
  width:860px;
  /* height: 600px; */
  float: left;
}
.bassMassage{
  display: inline-block;
  width: 322px;
  float: left;
  margin-left:30px;
  font-size: 14px;
  margin-top:20px
}
.bassMassageRight{
  display: inline-block;
  width: 322px;
  float: left;
  font-size: 14px;
  margin-top:20px;
  margin-left:20px;
}
.testResume{
  position: fixed;
  /* float: left; */
  top: 280px;
   width: 180px;
   /* border: 1px solid black; */
   margin-left: 20px
}
/* .test{
  position: relative;
  left:900px;
  top: 0
} */
.massageTitle{
  /* height: 300px; */
  float: left;
}
.personalInformation-left{
  width: 400px;
  height:260px;
  margin-left: 30px;
  float: left;
  font-size: 14px;
}
.personalInformation-left p{
  line-height: 37px
}
.personalInformation-right{
  width: 400px;
  height:260px;
  font-size: 14px;
  float: left;
}
.personalInformation-right p{
  line-height: 37px
}
.workExperience{
  width: 860px;
  float: left;
  margin-top: 10px
}
.workExperience-detail{
  width: 860px;

  float: left;
  margin-top: 20px;
}
.workExperience-top{
  width: 860px;
  height: 56px;
  background: rgba(246,246,246,1);
}
.workExperience-bottom{
  width:640px;
  margin-left: 71px;
  margin-top: 20px;
  line-height: 24px;
}
.projectExperience{
  width: 860px;
  margin-top: 30px;
   float: left;
}
.projectExperience-detail{
  width: 860px;
  float: left;
  margin-top: 20px;
}
.projectExperience-top{
  width: 860px;
  height: 34px;
  line-height: 34px;
  background: rgba(246,246,246,1);
}
.projectExperience-bottom{
  width:640px;
  margin-left: 71px;
  margin-top: 20px;
  line-height: 24px
}
.internshipExperience{
  width: 860px;
  margin-top: 30px;
  float: left;
}
.internshipExperience-detail{
  width: 860px;
  float: left;
  margin-top: 20px;
}
.internshipExperience-top{
  width: 860px;
  height: 56px;
  line-height: 34px;
  background: rgba(246,246,246,1);
}
.internshipExperience-bottom{
  width:640px;
  margin-left: 71px;
  margin-top: 20px;
  line-height: 24px
}
.educationalExperience{
  width: 860px;
  float: left;
}
.educationalExperience-left{
  width: 430px;
  float: left;
  margin-left: 30px;
  font-size: 14px
}
.educationalExperience-right{
  width: 380px;
  float: left;
  font-size: 14px
}
.Self-evaluation{
  width: 860px;
  float: left;
}
.evaluation-content{
  width: 690px;
  margin-left:30px;
  float: left;
  margin-top: 20px;
  line-height: 30px;
  margin-bottom: 40px
}
.detailTitel{
  width: 860px;
  height: 24px;
  float: left;
  margin-top: 20px;
  /* border: 1px solid red */
}
</style>

