<!-- 新建联系人 -->
<template>
  <div>
    <dialog-edit :visible.sync="dialogVisible" ref="dialogVisible" :form="form" :editModel="editModel" :api="api" :appendToBody="appendToBody"
                 :title="$t('enterpriseInfoManage.supplierInfoManage.newContact')" :labelWidth="labeldymWidth" :formRules="contactFormRules"
                 :autoSave="autoSave" @onSaved="onSaved"
                 :menuCode="menuId" savePerms="contactCreateSave" :loading="form.loading">
      <span class="contact-account-title">{{$t('enterpriseInfoManage.supplierInfoManage.accountInfos')}}</span>
      <div class="contact-account-info">
        <el-divider></el-divider>
      </div>
      <dym-form :componentList="accountList" :formValue="contactForm" @selectChanged="templateAllEvent"></dym-form>
      <div class="header-title">
        <!--<p>{{$t('enterpriseInfoManage.supplierInfoManage.contactBasicInfo')}}</p>-->
        <el-collapse v-model="activeNames" class="overflow">
          <el-collapse-item :title="$t('enterpriseInfoManage.supplierInfoManage.contactBasicInfo')" name="1">
            <dym-form :componentList="basicList1" :formValue="contactForm" @selectChanged="contactLevelEvent"></dym-form>
            <el-row :gutter="10">
              <!-- 手机号码(表单验证prop) -->
              <el-col :xs="24" :sm="24" :md="24" :lg="8">
                <el-form-item :label="$t('enterpriseInfoManage.supplierInfoManage.mobilePhone')" prop="telephone"
                              :label-width="labeldymWidth"
                              :rules="[{ required: true, message: $t('regMsg.enterpriseInfoManage.mobilePhone'), trigger: 'blur' },
                                  { validator: mobilePhoneCheck, trigger: 'blur' }]">
                  <el-input v-model="contactForm.telephone" maxlength="11" :placeholder="$t('common.pleaseInput')" class="item-width dymForm"></el-input>
                </el-form-item>
              </el-col>
              <!-- 微信号(表单验证prop) -->
              <el-col :xs="24" :sm="24" :md="24" :lg="8">
                <el-form-item :label="$t('enterpriseInfoManage.supplierInfoManage.weChat')" prop="weixin"
                              :label-width="labeldymWidth"
                              :rules="[{ required: contactForm.qq === undefined || contactForm.qq === '', message: $t('regMsg.enterpriseInfoManage.weChat'), trigger: 'blur' },
                                  {validator: weChatCheck, trigger: 'blur', obj: contactForm}]">
                  <el-input v-model="contactForm.weixin" maxlength="50" :placeholder="$t('common.pleaseInput')" class="item-width dymForm"></el-input>
                </el-form-item>
              </el-col>
              <!-- QQ号(表单验证prop) -->
              <el-col :xs="24" :sm="24" :md="24" :lg="8">
                <el-form-item :label="$t('enterpriseInfoManage.supplierInfoManage.QQ')" prop="qq"
                              :label-width="labeldymWidth"
                              :rules="[{ required: contactForm.weixin === undefined || contactForm.weixin === '', message: $t('regMsg.enterpriseInfoManage.QQ'), trigger: 'blur' },
                                  {validator: QQCheck, trigger: 'blur', obj: contactForm}]">
                  <el-input v-model="contactForm.qq" maxlength="20" :placeholder="$t('common.pleaseInput')" class="item-width dymForm"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <dym-form :componentList="basicList2" :formValue="contactForm" @selectChanged="contactListSelectChanged"></dym-form>
            <el-row :gutter="10">
              <!-- 生日 -->
              <el-col :xs="24" :sm="24" :md="24" :lg="8">
                <el-form-item :label="$t('enterpriseInfoManage.supplierInfoManage.birth')" :label-width="labeldymWidth">
                  <div class="birth-class">
                      <div style="flex: 0">
                      <el-radio-group v-model="contactForm.calendarType">
                        <el-radio class="elRadioDiv" :label="0">{{$t('enterpriseInfoManage.supplierInfoManage.solarCalendar')}}</el-radio>
                        <el-radio class="elRadioDiv" :label="1">{{$t('enterpriseInfoManage.supplierInfoManage.lunarCalendar')}}</el-radio>
                      </el-radio-group>
                      </div>
                      <div style="flex: 1">
                        <j-date-picker v-model="contactForm.birthday"
                                       ref="calendar"
                                       :width="width1"
                                       :placeholder="$t('common.pleaseSelect')"
                                       :picker-options="pickerOptions"
                                       :rangeSeparator="rangeSeparator"
                                       :disabled="disabled"
                                       @change="jDatePickerchange"
                                       :showLunarClass="showLunarClass"
                                       :showLunarControl="showLunarControl"
                                       :type="type"
                                       :isLunar1="contactForm.calendarType === 1"
                                       @dateEvent="dateEvent"
                                       :class="{'day-number': true, 'margin-left': true, 'wedgetWidth': true}"
                                       :showBackYears="showBackYears"
                                       :showLunarIcon="showLunarIcon"
                                       :format="format"></j-date-picker>
                      </div>
                      <!--<el-date-picker type="date" v-model="form.birthday" :placeholder="$t('common.pleaseSelect')" class="date-class"></el-date-picker>-->
                  </div>
                </el-form-item>
              </el-col>
              <!-- 年龄 -->
              <el-col :xs="24" :sm="24" :md="24" :lg="8">
                <el-form-item :label="$t('enterpriseInfoManage.supplierInfoManage.age')" :label-width="labeldymWidth">
                  <el-input v-model="contactForm.age" :disabled="true" :placeholder="''" class="item-width dymForm"></el-input>
                </el-form-item>
              </el-col>
              <!-- 星座 -->
              <el-col :xs="24" :sm="24" :md="24" :lg="8">
                <el-form-item :label="$t('enterpriseInfoManage.supplierInfoManage.constellation')" :label-width="labeldymWidth">
                  <select-dictionary v-model="contactForm.constellation" :dictTypeCode="'ZDC0108'" :store="$store"
                                     :placeholder="$t('common.pleaseInput')" class="item-width"></select-dictionary>
                </el-form-item>
              </el-col>
            </el-row>
            <dym-form :componentList="basicList3" :formValue="contactForm"></dym-form>
          </el-collapse-item>
          <el-collapse-item :title="$t('enterpriseInfoManage.supplierInfoManage.contactBusInfo')" name="2">
            <el-row :gutter="10">
              <el-col :xs="24" :sm="24" :md="24" :lg="8">
                <!-- 是否合作方 (表单验证prop) -->
                <el-form-item v-if="enterpriseType === 'projectCompany'" :label="$t('enterpriseInfoManage.projCompanyInfoManage.partnerOrNot')" prop="partnerFlag"
                              :rules="contactFormRules.partnerFlag" :label-width="labeldymWidth">
                  <select-dictionary v-model="contactForm.partnerFlag" :dictTypeCode="'ZD0003'" :store="$store"
                                     :placeholder="$t('common.pleaseSelect')" class="item-width">
                  </select-dictionary>
                </el-form-item>
                <!-- 是否挂靠(表单验证prop) -->
                <el-form-item v-else :label="$t('enterpriseInfoManage.supplierInfoManage.isAttached')" prop="anchoredFlag"
                              :rules="contactFormRules.anchoredFlag" :label-width="labeldymWidth">
                  <select-dictionary v-model="contactForm.anchoredFlag" :dictTypeCode="'ZDC0104'" :store="$store"
                                     :placeholder="$t('common.pleaseSelect')" class="item-width">
                  </select-dictionary>
                </el-form-item>
              </el-col>
              <!-- 上班时间(表单验证prop) -->
              <el-col :xs="24" :sm="24" :md="24" :lg="8">
                <el-form-item :label="$t('enterpriseInfoManage.supplierInfoManage.officeHours')" prop="workTimeId"
                              :rules="contactFormRules.workTimeId" :label-width="labeldymWidth">
                  <select-work-shift v-model="contactForm.workTimeId" :placeholder="$t('common.pleaseSelect')" :reload="workReload" class="item-width">
                  </select-work-shift>
                </el-form-item>
              </el-col>
              <!-- 周末是否操作(字典)(表单验证prop) -->
              <el-col :xs="24" :sm="24" :md="24" :lg="8">
                <el-form-item :label="$t('enterpriseInfoManage.supplierInfoManage.operateWeek')" prop="weekendOperation"
                              :rules="contactFormRules.weekendOperation" :label-width="labeldymWidth">
                  <select-dictionary v-model="contactForm.weekendOperation" :dictTypeCode="'ZD0003'" :store="$store"
                                     :placeholder="$t('common.pleaseSelect')" class="item-width">
                  </select-dictionary>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="10">
              <!-- 保理负责事项(表单验证prop) -->
              <el-col :xs="24" :sm="24" :md="24" :lg="8">
                <el-form-item :label="$t('enterpriseInfoManage.supplierInfoManage.responsibleMatter')" prop="factoringResponsibility"
                              :rules="contactFormRules.responsibleMatter" :label-width="labeldymWidth">
<!--                  <select-dictionary v-model="contactForm.factoringResponsibility" :dictTypeCode="'factor_responsibility'"-->
<!--                                     :placeholder="$t('common.pleaseSelect')" class="item-width">-->
<!--                  </select-dictionary>-->
                  <select-dict-dis v-model="contactForm.factoringResponsibility" :disabledOptions="disabledOptions"
                                   :dictTypeCode="'factor_responsibility'" name="forbiddenStatusDict" :reload="disabledOptionsReload"
                                   :multiple="true" :placeholder="$t('common.pleaseSelect')"
                                   class="item-width" @selectChanged="forbiddenStatusChange">
                  </select-dict-dis>
                </el-form-item>
              </el-col>
              <!-- 对保理熟悉程度(表单验证prop) -->
              <el-col :xs="24" :sm="24" :md="24" :lg="8">
                <el-form-item :label="$t('enterpriseInfoManage.supplierInfoManage.familiarity')" prop="factoringDegree"
                              :rules="contactFormRules.familiarity" :label-width="labeldymWidth">
                  <select-dictionary v-model="contactForm.factoringDegree" :dictTypeCode="'factor_degree'" :store="$store"
                                     :placeholder="$t('common.pleaseSelect')" class="item-width">
                  </select-dictionary>
                </el-form-item>
              </el-col>
              <!-- 保理操作配合程度(表单验证prop) -->
              <el-col :xs="24" :sm="24" :md="24" :lg="8">
                <el-form-item :label="$t('enterpriseInfoManage.supplierInfoManage.coordination')" prop="coordinationDegree"
                              :rules="contactFormRules.coordination" :label-width="labeldymWidth">
                  <select-dictionary v-model="contactForm.coordinationDegree" :dictTypeCode="'coordination_degree'" :store="$store"
                                     :placeholder="$t('common.pleaseSelect')" class="item-width">
                  </select-dictionary>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="10">
              <!-- 盖章方式(表单验证prop) -->
              <el-col :xs="24" :sm="24" :md="24" :lg="8">
                <el-form-item :label="$t('enterpriseInfoManage.supplierInfoManage.sealWay')" prop="stampWay"
                              :rules="contactFormRules.sealWay" :label-width="labeldymWidth">
                  <select-dictionary v-model="contactForm.stampWay" :multiple="true" :dictTypeCode="'sealing_method'" :store="$store"
                                     @selectChanged="selectChanged"
                                     name="stampWayInfo"
                                     :placeholder="$t('common.pleaseSelect')" class="item-width">
                  </select-dictionary>
                </el-form-item>
              </el-col>
              <!-- 电子章盖章流程(表单验证prop) -->
              <el-col :xs="24" :sm="24" :md="24" :lg="8">
                <el-form-item :label="$t('enterpriseInfoManage.supplierInfoManage.sealFlow')" prop="stampingProcess"
                              :label-width="labeldymWidth"
                              :rules="contactForm.stampingFlag ? contactFormRules.sealFlow : {}">
                  <select-dictionary v-model="contactForm.stampingProcess" :disabled="!contactForm.stampingFlag" :dictTypeCode="'stamp_process'" :store="$store"
                                     :placeholder="(!contactForm.stampingFlag) ? '' : $t('common.pleaseSelect')" class="item-width">
                  </select-dictionary>
                </el-form-item>
              </el-col>
              <!-- 电子章盖章天数(表单验证prop) -->
              <el-col :xs="24" :sm="24" :md="24" :lg="8">
                <el-form-item :label="$t('enterpriseInfoManage.supplierInfoManage.sealDay')" prop="stampedDays"
                              :label-width="labeldymWidth"
                              :rules="contactForm.stampingFlag ? contactFormRules.sealDay : {}">
                  <el-input v-model="contactForm.stampedDays" :disabled="!contactForm.stampingFlag"
                            :placeholder="(!contactForm.stampingFlag) ? '' : $t('common.pleaseInput')" class="item-width dymForm"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="10">
              <!-- 鲜章盖章流程(表单验证prop) -->
              <el-col :xs="24" :sm="24" :md="24" :lg="8">
                <el-form-item :label="$t('enterpriseInfoManage.supplierInfoManage.chapterStampingProcess')" prop="chapterStampingProcess"
                              :label-width="labeldymWidth"
                              :rules="contactForm.stampingFlag1 ? contactFormRules.chapterStampingProcess : {}">
                  <select-dictionary v-model="contactForm.chapterStampingProcess" :disabled="!contactForm.stampingFlag1" :dictTypeCode="'chapter_stamping_process'" :store="$store"
                                     :placeholder="(!contactForm.stampingFlag1) ? '' : $t('common.pleaseSelect')" class="item-width">
                  </select-dictionary>
                </el-form-item>
              </el-col>
              <!-- 鲜章盖章天数(表单验证prop) -->
              <el-col :xs="24" :sm="24" :md="24" :lg="8">
                <el-form-item :label="$t('enterpriseInfoManage.supplierInfoManage.chapterStampedDays')" prop="chapterStampedDays"
                              :label-width="labeldymWidth"
                              :rules="contactForm.stampingFlag1 ? contactFormRules.chapterStampedDays : {}">
                  <el-input v-model="contactForm.chapterStampedDays" :disabled="!contactForm.stampingFlag1"
                            :placeholder="(!contactForm.stampingFlag1) ? '' : $t('common.pleaseInput')" class="item-width dymForm"></el-input>
                </el-form-item>
              </el-col>
              <!-- 保理资料模板(表单验证prop) -->
              <!--<el-col :xs="24" :sm="24" :md="24" :lg="8">-->
              <!--<el-form-item :label="$t('enterpriseInfoManage.supplierInfoManage.absDataTemplate')" :prop="'contactList.' + index + '.factoringTemplate'"-->
              <!--:rules="formRules.absDataTemplate">-->
              <!--<el-input v-model="item.factoringTemplate" :placeholder="$t('common.pleaseInput')" class="item-width"></el-input>-->
              <!--</el-form-item>-->
              <!--</el-col>-->
              <!-- 工作负责板块(表单验证prop) -->
              <el-col :xs="24" :sm="24" :md="24" :lg="8">
                <el-form-item :label="$t('enterpriseInfoManage.supplierInfoManage.workResTemplate')" prop="workResTemplate"
                              :label-width="labeldymWidth"
                              :rules="contactFormRules.workResTemplate">
                  <select-work-template-plat-modify v-model="contactForm.workResTemplate" ref="reloadFind" v-if="form.tagCode === '140'"
                                        @selectChanged="templateEvent" :optionList="optionList"
                                        :placeholder="$t('common.pleaseSelect')" class="item-width"></select-work-template-plat-modify>
                  <select-work-template-pro-plat-modify v-model="contactForm.workResTemplate" ref="reloadFind" v-if="form.tagCode === '150'"
                                        @selectChanged="proTemplateEvent" :optionList="optionList"
                                        :placeholder="$t('common.pleaseSelect')" class="item-width"></select-work-template-pro-plat-modify>
                  <select-work-template-core-plat-modify v-model="contactForm.workResTemplate" ref="reloadFind" v-if="form.tagCode === '60'"
                                        @selectChanged="coreTemplateEvent" :optionList="optionList"
                                        :placeholder="$t('common.pleaseSelect')" class="item-width"></select-work-template-core-plat-modify>
                </el-form-item>
              </el-col>
            </el-row>
            <dym-form :componentList="busList1" :formValue="contactForm"></dym-form>
          </el-collapse-item>
        </el-collapse>
      </div>
    </dialog-edit>
  </div>
</template>

<script>
import BaseEdit from '@/pages/baseEditPage'
import { DialogEdit, dymForm, SelectDictionary, regExp, validate, JDatePicker } from 'newepoch-components'
import SelectWorkTemplate from '@/components/element/enterpriseInfoManage/SelectWorkTemplate.vue'
import SelectDepartment from '@/components/element/enterpriseInfoManage/SelectDepartment.vue'
import supplierInfoManageApi from '@/api/enterpriseInfoManage/supplierInfoManageApi.js'
import SelectWorkShift from '@/components/element/enterpriseInfoManage/SelectWorkShift.vue'
import SelectContactLevel from '@/components/element/enterpriseInfoManage/SelectContactLevel.vue'
import * as format from '@/filters/index.js'
import selectDictDis from '@/components/element/enterpriseInfoManage/selectDictDis.vue'
import SelectWorkTemplateCorePlatModify from '@/components/element/enterpriseInfoManage/platElement/SelectWorkTemplateCorePlatModify.vue'
import SelectWorkTemplateProPlatModify from '@/components/element/enterpriseInfoManage/platElement/SelectWorkTemplateProPlatModify'
import SelectWorkTemplatePlatModify from '@/components/element/enterpriseInfoManage/platElement/SelectWorkTemplatePlatModify.vue'
// import Calendar from 'vue2-slot-calendar'
export default {
  extends: new BaseEdit(),
  name: 'createContactEdit',
  components: {
    DialogEdit,
    dymForm,
    SelectDictionary,
    SelectWorkTemplate,
    SelectDepartment,
    JDatePicker,
    SelectWorkShift,
    SelectContactLevel,
    selectDictDis,
    SelectWorkTemplateCorePlatModify,
    SelectWorkTemplateProPlatModify,
    SelectWorkTemplatePlatModify
  },
  props: {
    enterpriseType: {
      type: String,
      default: function () {
        return null
      }
    }
  },
  data () {
    return {
      labeldymWidth: '150px', // formitem文字宽度
      disabledOptions: [],
      disabledOptionsReload: false,
      // 农历信息
      value1: 0,
      type: 'DATE',
      isLunar1: false,
      showLunarClass: 'MIX',
      showBackYears: 2,
      showLunarIcon: false,
      showLunarControl: false,
      width1: '100%',
      format: 'YYYY-MM-DD',
      rangeSeparator: '-',
      disabled: false,
      editable: true,
      clearable: true,
      pickerOptions: {
        disabledDate (time) {
          return null
          // return time.getTime() < Date.now() - 8.64e7;
        }
      },
      // 以上为日历信息
      appendToBody: true,
      autoSave: false,
      // 重新加载
      reloadflag: false,
      // 重新加载
      reload: false,
      // 按钮标识
      loading: false,
      workReload: false,
      // 总模块
      allWorkReload: false,
      // 负责模块
      templateInfo: [],
      // 工作负责模块入参
      optionList: [],
      // 联系人角色查询条件
      contactInfo: {
        companyId: this.form.enterpriseId,
        flag: '0'
      },
      contactForm: {
        contact: '',
        calendarType: 0,
        birthday: '',
        workTimeId: ''
      },
      activeNames: ['1', '2'],
      // 账号信息
      accountList: [
        // 企业名称
        {
          value: 'enterpriseName',
          disabled: false,
          componentName: 'el-input',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.enterpriseName,
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseInput,
          cols: [24, 24, 24, 8],
          labelWidth: this.labeldymWidth,
          prop: 'enterpriseName'
        },
        // 账号类型(字典处理)
        {
          value: 'employeeAccountType',
          disabled: false,
          componentName: 'SelectDictionary',
          dictTypeCode: 'create_account_type',
          store: this.$store,
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.accountType,
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseInput,
          cols: [24, 24, 24, 8],
          labelWidth: this.labeldymWidth,
          prop: 'employeeAccountType'
        },
        // 登录账号
        {
          value: 'account',
          disabled: false,
          componentName: 'el-input',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.loginAccount,
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseInput,
          cols: [24, 24, 24, 8],
          labelWidth: this.labeldymWidth,
          prop: 'account'
        },
        // 是否做业务(表单验证)
        {
          value: 'businessStatus',
          disabled: false,
          componentName: 'SelectDictionary',
          dictTypeCode: 'ZD0003',
          store: this.$store,
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.doBusiness,
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseSelect,
          cols: [24, 24, 24, 8],
          labelWidth: this.labeldymWidth,
          prop: 'businessStatus'
        },
        // 负责板块 (级联多选组件)(表单验证)
        {
          value: 'resTemplate',
          disabled: true,
          name: 'resTemplate',
          reload: this.allWorkReload,
          componentName: SelectWorkTemplate,
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.resTemplate,
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseSelect,
          cols: [24, 24, 24, 8],
          labelWidth: this.labeldymWidth,
          prop: 'resTemplate',
          attrs: {
            attrsQueryParas: '',
            isload: true
          }
        }
      ],
      // 联系人基本信息
      basicList1: [
        // 联系人角色(下拉组件)
        {
          value: 'contactLevel',
          disabled: false,
          componentName: 'SelectDictionary',
          dictTypeCode: 'ZD00690',
          store: this.$store,
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.contactRole,
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseSelect,
          cols: [24, 24, 24, 8],
          labelWidth: this.labeldymWidth,
          prop: 'contactLevel'
        },
        // 联系人
        {
          value: 'employeeName',
          disabled: false,
          componentName: 'el-input',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.contact,
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseInput,
          cols: [24, 24, 24, 8],
          labelWidth: this.labeldymWidth,
          prop: 'employeeName'
        },
        // 性别(字典)
        {
          value: 'gender',
          disabled: false,
          componentName: 'SelectDictionary',
          dictTypeCode: 'ZD0031',
          store: this.$store,
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.sex,
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseSelect,
          cols: [24, 24, 24, 8],
          labelWidth: this.labeldymWidth,
          prop: 'gender'
        }
      ],
      // 联系人基本信息
      basicList2: [
        // 座机
        {
          value: 'officePhone',
          disabled: false,
          componentName: 'el-input',
          maxlength: 12,
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.telephone,
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseInput,
          cols: [24, 24, 24, 8],
          labelWidth: this.labeldymWidth,
          prop: 'officePhone'
        },
        // 邮箱地址
        {
          value: 'email',
          disabled: false,
          componentName: 'el-input',
          maxlength: 100,
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.email,
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseInput,
          cols: [24, 24, 24, 8],
          labelWidth: this.labeldymWidth,
          prop: 'email'
        },
        // 做事风格
        {
          value: 'characterStyle',
          disabled: false,
          componentName: 'el-input',
          maxlength: 100,
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.workStyle,
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseInput,
          cols: [24, 24, 24, 8],
          labelWidth: this.labeldymWidth,
          prop: 'characterStyle'
        },
        // 部门
        {
          value: 'enterpriseDeptId',
          disabled: false,
          componentName: SelectDepartment,
          queryName: 'keyId',
          queryValue: 'enterpriseId',
          allowCreate: true,
          name: 'deptInfo',
          reload: this.reloadflag,
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.department,
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseSelect,
          cols: [24, 24, 24, 8],
          labelWidth: this.labeldymWidth,
          prop: 'enterpriseDeptId'
        },
        // 职务
        {
          value: 'position',
          disabled: false,
          componentName: 'el-input',
          maxlength: 100,
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.duty,
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseInput,
          cols: [24, 24, 24, 8],
          labelWidth: this.labeldymWidth,
          prop: 'position'
        },
        // 性格
        {
          value: 'temperament',
          disabled: false,
          componentName: 'el-input',
          maxlength: 50,
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.character,
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseInput,
          cols: [24, 24, 24, 8],
          labelWidth: this.labeldymWidth,
          prop: 'temperament'
        }
      ],
      // 联系人基本信息
      basicList3: [
        // 籍贯
        {
          value: 'nativePlace',
          disabled: false,
          componentName: 'el-input',
          maxlength: 20,
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.native,
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseInput,
          cols: [24, 24, 24, 8],
          labelWidth: this.labeldymWidth,
          prop: 'nativePlace'
        },
        // 婚否(字典)
        {
          value: 'maritalStatus',
          disabled: false,
          componentName: 'SelectDictionary',
          dictTypeCode: 'ZD0003',
          store: this.$store,
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.marital,
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseSelect,
          cols: [24, 24, 24, 8],
          labelWidth: this.labeldymWidth,
          prop: 'maritalStatus'
        },
        // 爱好
        {
          value: 'hobby',
          disabled: false,
          componentName: 'el-input',
          maxlength: 100,
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.hobby,
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseInput,
          cols: [24, 24, 24, 8],
          labelWidth: this.labeldymWidth,
          prop: 'hobby'
        }
      ],
      // 业务相关信息
      busList1: [
        // // 是否挂靠
        // {
        //   value: 'anchoredFlag',
        //   disabled: false,
        //   componentName: 'SelectDictionary',
        //   dictTypeCode: '',
        //   store: this.$store,
        //   label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.isAttached,
        //   placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseSelect,
        //   cols: [24, 24, 24, 8],
        //   prop: 'anchoredFlag'
        // },
        // // 上班时间
        // {
        //   value: 'workTimeId',
        //   disabled: false,
        //   componentName: 'SelectDictionary',
        //   dictTypeCode: '',
        //   store: this.$store,
        //   label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.officeHours,
        //   placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseSelect,
        //   cols: [24, 24, 24, 8],
        //   prop: 'workTimeId'
        // },
        // // 周末是否操作
        // {
        //   value: 'weekendOperation',
        //   disabled: false,
        //   componentName: 'SelectDictionary',
        //   dictTypeCode: '',
        //   store: this.$store,
        //   label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.operateWeek,
        //   placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseSelect,
        //   cols: [24, 24, 24, 8],
        //   prop: 'weekendOperation'
        // },
        // 盖章方式
        // {
        //   value: 'stampWay',
        //   disabled: false,
        //   componentName: 'SelectDictionary',
        //   dictTypeCode: 'sealing_method',
        //   store: this.$store,
        //   label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.sealWay,
        //   placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseSelect,
        //   cols: [24, 24, 24, 8],
        //   prop: 'stampWay'
        // },
        // // 盖章流程
        // {
        //   value: 'stampingProcess',
        //   disabled: false,
        //   componentName: 'SelectDictionary',
        //   dictTypeCode: 'stamp_process',
        //   store: this.$store,
        //   label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.sealFlow,
        //   placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseSelect,
        //   cols: [24, 24, 24, 8],
        //   prop: 'stampingProcess'
        // },
        // // 盖章天数
        // {
        //   value: 'stampedDays',
        //   disabled: false,
        //   componentName: 'el-input',
        //   label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.sealDay,
        //   placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseInput,
        //   cols: [24, 24, 24, 8],
        //   prop: 'stampedDays'
        // },
        // // 保理资料模板
        // {
        //   value: 'factoringTemplate',
        //   disabled: false,
        //   componentName: 'el-input',
        //   label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.absDataTemplate,
        //   placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseInput,
        //   cols: [24, 24, 24, 8],
        //   prop: 'factoringTemplate'
        // },
        // 工作负责板块
        // {
        //   value: 'workResTemplate',
        //   disabled: false,
        //   componentName: SelectWorkTemplate,
        //   label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.workResTemplate,
        //   placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseSelect,
        //   cols: [24, 24, 24, 8],
        //   prop: 'workResTemplate'
        // },
        // 特殊事项
        {
          value: 'specialMatter',
          disabled: false,
          componentName: 'el-input',
          maxlength: 500,
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.specialIssue,
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseInput,
          cols: [24, 24, 24, 24],
          labelWidth: this.labeldymWidth,
          prop: 'specialMatter'
        },
        // 备注
        {
          value: 'memo',
          disabled: false,
          componentName: 'el-input',
          maxlength: 500,
          type: 'textarea',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.remark,
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseInput,
          cols: [24, 24, 24, 24],
          labelWidth: this.labeldymWidth,
          prop: 'memo'
        }
      ],
      // 表单验证
      contactFormRules: {
        // 是否做业务
        businessStatus: [{ required: true, message: this.regMsg.enterpriseInfoManage.doBusiness, trigger: 'change' }],
        // 负责板块
        resTemplate: [{ required: true, message: this.regMsg.enterpriseInfoManage.resTemplate, trigger: 'change' }],
        // 联系人角色
        contactLevel: [{ required: true, message: this.regMsg.enterpriseInfoManage.contactRole, trigger: 'change' }],
        // 联系人
        employeeName: [{ required: true, message: this.regMsg.enterpriseInfoManage.contact }, { validator: validate.nameValidate, trigger: 'blur' }],
        // 性别
        gender: [{ required: true, message: this.regMsg.enterpriseInfoManage.sex, trigger: 'change' }],
        // 手机号码
        mobilePhone: [{ required: true, message: this.regMsg.enterpriseInfoManage.mobilePhone, trigger: 'blur' }, { validator: this.mobilePhoneCheck, trigger: 'blur' }],
        // 座机号
        officePhone: [{ validator: validate.telephoneValidate, trigger: 'blur' }],
        // 是否挂靠
        anchoredFlag: [{ required: true, message: this.regMsg.enterpriseInfoManage.isAttached, trigger: 'change' }],
        // 上班时间
        workTimeId: [{ required: true, message: this.regMsg.enterpriseInfoManage.officeHours, trigger: 'change' }],
        // 周末是否操作
        weekendOperation: [{ required: true, message: this.regMsg.enterpriseInfoManage.operateWeek, trigger: 'change' }],
        // 保理负责事项
        responsibleMatter: [{ required: true, message: this.regMsg.enterpriseInfoManage.responsibleMatter, trigger: 'change' }],
        // 对保理熟悉程度
        familiarity: [{ required: true, message: this.regMsg.enterpriseInfoManage.familiarity, trigger: 'change' }],
        // 保理操作配合程度
        coordination: [{ required: true, message: this.regMsg.enterpriseInfoManage.coordination, trigger: 'change' }],
        // 盖章方式
        stampWay: [{ required: true, message: this.regMsg.enterpriseInfoManage.sealWay, trigger: 'change' }],
        // 盖章流程
        stampingProcess: [{ required: true, message: this.regMsg.enterpriseInfoManage.sealFlow, trigger: 'change' }],
        // 盖章天数
        stampedDays: [{ required: true, message: this.regMsg.enterpriseInfoManage.sealDay, trigger: 'blur' },
          { validator: this.chapterStampedDaysCheck, trigger: 'blur' }],
        // 鲜章盖章流程
        chapterStampingProcess: [{ required: true, message: this.regMsg.enterpriseInfoManage.sealFlow, trigger: 'change' }],
        // 鲜章盖章天数
        chapterStampedDays: [{ required: true, message: this.regMsg.enterpriseInfoManage.sealDay, trigger: 'blur' },
          { validator: this.chapterStampedDaysCheck, trigger: 'blur' }],
        // 保理资料模板
        factoringTemplate: [{ required: true, message: this.regMsg.enterpriseInfoManage.absDataTemplate, trigger: 'blur' }],
        // 工作负责模板
        workResTemplate: [{ required: true, message: this.regMsg.enterpriseInfoManage.workResTemplate, trigger: 'change' }],
        // 是否合作方
        partnerFlag: [{ required: true, message: this.regMsg.enterpriseInfoManage.partnerFlag, trigger: 'change' }],
        // 邮箱
        email: [{ validator: validate.emailValidate, trigger: 'blur' }],
        // 爱好
        hobby: [{ validator: validate.legalPersonValidate, trigger: 'blur' }],
        // 性格
        temperament: [{ validator: validate.legalPersonValidate, trigger: 'blur' }]
      }
    }
  },
  computed: {
    api () {
      return supplierInfoManageApi.employee
    }
  },
  methods: {
    forbiddenStatusChange (a, b, c, d) {
      if (a) {
        if (a.some(it => it === '1')) {
          this.contactForm.factoringResponsibility = ['1']
          this.disabledOptions = [{ dictId: '1' }]
        } else {
          this.disabledOptions = []
        }
        this.$nextTick(() => {
          this.disabledOptionsReload = !this.disabledOptionsReload
        })
      }
    },
    jDatePickerchange (data) {
      if (!data || data.length === 0) {
        this.$set(this.contactForm, 'birthday', '')
        this.$set(this.contactForm, 'age', '')
        this.$set(this.contactForm, 'constellation', '')
        this.$set(this.contactForm, 'newDate', '')
      }
    },
    // 日历信息返回
    dateEvent (date, constellation) {
      let $this = this
      // this.contactForm.contactList[index].constellation = constellation
      let borthday = date.substring(0, 4)
      let nowDate = new Date()
      let newYear = nowDate.getFullYear()
      let age = newYear - parseInt(borthday)
      let num = format.constellationToNumber(constellation)
      if (num) {
        // $this.contactForm.constellation = num.toString()
        $this.$set($this.contactForm, 'constellation', num.toString())
      } else {
        $this.$set($this.contactForm, 'constellation', '12')
        // $this.contactForm.constellation = '12'
      }
      // $this.contactForm.newDate = format.getTimestamp(date)
      // $this.contactForm.newDate = date
      $this.$set($this.contactForm, 'newDate', '')
      $this.$set($this.contactForm, 'age', '')
      $this.contactForm.newDate = date
      // $this.contactForm.constellation = constellation
      $this.contactForm.age = age
    },
    // 盖章方式返回 盖章流程禁用
    selectChanged (key, name, data) {
      if (name === 'stampWayInfo') {
        if (data.length > 0) {
          if (data.length === 1) {
            data.forEach(it => {
              // 1 电子章 2 鲜章
              if (it.dictId === '1') {
                this.$set(this.contactForm, 'chapterStampingProcess', '')
                this.$set(this.contactForm, 'chapterStampedDays', '')
                this.$set(this.contactForm, 'stampingFlag', true)
              } else {
                this.$set(this.contactForm, 'stampingFlag', false)
              }
              if (it.dictId === '2') {
                this.$set(this.contactForm, 'stampingProcess', '')
                this.$set(this.contactForm, 'stampedDays', '')
                this.$set(this.contactForm, 'stampingFlag1', true)
              } else {
                this.$set(this.contactForm, 'stampingFlag1', false)
              }
            })
          }
          if (data.length === 2) {
            // data.forEach(it => {
            //   // 1 鲜章 2 电子章
            //   if (it.dictId === '2') {
            //     this.$set(this.contactForm, 'stampingFlag', true)
            //   }
            //   if (it.dictId === '1') {
            //     this.$set(this.contactForm, 'stampingFlag1', true)
            //   }
            // })
            this.$set(this.contactForm, 'stampingFlag1', true)
            this.$set(this.contactForm, 'stampingFlag', true)
          }
        } else {
          this.$set(this.contactForm, 'stampingProcess', '')
          this.$set(this.contactForm, 'stampedDays', '')
          this.$set(this.contactForm, 'chapterStampingProcess', '')
          this.$set(this.contactForm, 'chapterStampedDays', '')
          this.$set(this.contactForm, 'stampingFlag', false)
          this.$set(this.contactForm, 'stampingFlag1', false)
        }
      }
    },
    // 负责模块数据处理
    templateAllEvent (data, index) {
      if (data.resTemplateInfo) {
        this.optionList = data.resTemplateInfo
        if (this.form.tagCode === '60') {
          this.coreWorkInfoFun(data.resTemplateInfo)
        } else if (this.form.tagCode === '150') {
          this.proWorkInfoFun(data.resTemplateInfo)
        } else if (this.form.tagCode === '140') {
          this.workInfoFun(data.resTemplateInfo)
        }
      }
    },
    // 负责模块-供应商
    workInfoFun (data) {
      let list = []
      data.forEach(item => {
        let data = {
          children: []
        }
        if (item.children && item.children.length > 0) {
          item.children.forEach(it => {
            let child = {
              children: []
            }
            if (it.children && it.children.length > 0) {
              it.children.forEach(it2 => {
                let child2 = {}
                child2.contractId = it2.value
                child2.contractName = it2.label
                child.children.push(child2)
              })
            }
            child.areaId = it.value
            child.areaName = it.label
            data.children.push(child)
          })
        }
        data.coreEnterpriseId = item.value
        data.coreEnterpriseName = item.label
        list.push(data)
      })
      this.templateInfo = list
    },
    // 项目公司
    proWorkInfoFun (data) {
      let list = []
      if (data.some(it => it.value === '-1')) {
        list.push({
          contractId: '-1',
          contractName: '全部'
        })
      } else {
        data.forEach(it => {
          list.push({
            contractId: it.value,
            contractName: it.label
          })
        })
      }
      this.templateInfo = list
    },
    // 核心企业
    coreWorkInfoFun (data) {
      let list = []
      data.some(it => {
        if (it.value === '-1') {
          list.push({
            areaName: it.label,
            areaId: it.value,
            fincrmCorePlateProjectRelDTOList: []
          })
          return true
        } else {
          list.push({
            bigAreaId: it.areaParent,
            bigAreaName: it.areaParentName,
            areaName: it.areaName,
            areaId: it.keyId,
            fincrmCorePlateProjectRelDTOList: []
          })
          if (it.children) {
            it.children.forEach(it1 => {
              console.log(it1)
              var a = it1.companyId
              var b = it1.companyName
              if (it1.value === '-1') {
                a = it1.value
                b = it1.label
              }
              list[list.length - 1].fincrmCorePlateProjectRelDTOList.push({
                projectEnterpriseId: a,
                projectEnterpriseName: b
              })
            })
          }
        }
      })
      this.templateInfo = list
    },
    // 工作模块数据处理
    templateEvent (index, name, dataList, val) {
      // this.$refs['reloadFind'].onBlurAddressFun()
      this.contactForm.fincrmPlateAreaRelDTOList = []
      if (dataList.length > 0) {
        let list = []
        dataList.some(item => {
          let data = {
            children: []
          }
          if (item.value === '-1') {
            data.coreEnterpriseId = item.value
            data.coreEnterpriseName = item.label
            list.push(data)
            return true
          } else {
            if (item.children && item.children.length > 0) {
              item.children.some(it => {
                if (it.value === '-1') {
                  data.children.push({
                    areaId: it.value,
                    areaName: it.label,
                    children: []
                  })
                  return true
                } else {
                  let child = {
                    children: []
                  }
                  if (it.children && it.children.length > 0) {
                    it.children.some(it2 => {
                      let child2 = {}
                      child2.contractId = it2.value
                      child2.contractName = it2.label
                      child.children.push(child2)
                    })
                  }
                  child.areaId = it.value
                  child.areaName = it.label
                  data.children.push(child)
                }
              })
            }
            data.coreEnterpriseId = item.value
            data.coreEnterpriseName = item.label
            list.push(data)
          }
        })
        this.contactForm.fincrmPlateAreaRelDTOList = list
      }
    },
    // 工作模块数据处理-核心企业
    coreTemplateEvent (index, name, dataLists, val) {
      let list = []
      dataLists.forEach(it => {
        list.push({
          bigAreaId: it.areaParent,
          bigAreaName: it.areaParentName,
          areaName: it.areaName,
          areaId: it.keyId,
          fincrmCorePlateProjectRelDTOList: []
        })
        if (it.children) {
          it.children.forEach(it1 => {
            list[list.length - 1].fincrmCorePlateProjectRelDTOList.push({
              projectEnterpriseId: it1.companyId,
              projectEnterpriseName: it1.companyName
            })
          })
        }
      })
      this.contactForm.fincrmPlateAreaRelDTOList = list
    },
    // 工作模块数据处理-项目公司
    proTemplateEvent (index, name, dataLists, val) {
      let list = []
      dataLists.forEach(it => {
        list.push({
          contractId: it.value,
          contractName: it.label
        })
      })
      this.contactForm.fincrmPlateAreaRelDTOList = list
    },
    // 联系人角色处理
    contactLevelEvent (data, index) {
      if (data.contactLevelInfo) {
        this.contactForm.contactLevel1 = data.contactLevelInfo.contactLevel
        // this.$set(this.contactForm, 'contactLevel1', data.contactLevelInfo.contactLevel)
      }
    },
    // 联系人校验
    contactCheck: function (rule, value, callback) {
      if (!this.UtilJs.isEmpty(value)) {
        if (regExp.name.test(value)) {
          callback()
        } else {
          callback(new Error(this.regMsg.enterpriseInfoManage.name))
        }
      } else {
        callback(new Error(this.regMsg.enterpriseInfoManage.contact))
      }
    },
    // 手机号码校验
    mobilePhoneCheck: function (rule, value, callback) {
      if (!this.UtilJs.isEmpty(value)) {
        if (regExp.mobilePhone.test(value)) {
          callback()
        } else {
          callback(new Error(this.regMsg.enterpriseInfoManage.phone))
        }
      } else {
        callback()
      }
    },
    // 座机号验证
    officePhoneCheck: function (rule, value, callback) {
      if (!this.UtilJs.isEmpty(value)) {
        if (regExp.telephone.test(value)) {
          callback()
        } else {
          callback(new Error(this.regMsg.enterpriseInfoManage.officePhone))
        }
      } else {
        callback()
      }
    },
    // 微信校验
    weChatCheck: function (rule, value, callback) {
      console.log(rule)
      // let obj = rule.obj
      if (!this.UtilJs.isEmpty(value)) {
        if (regExp.weChat.test(value)) {
          callback()
        } else {
          callback(new Error(this.regMsg.enterpriseInfoManage.weixin))
        }
      } else {
        callback()
      }
      this.clearValidateField('qq', rule)
    },
    // 盖章天数校验
    chapterStampedDaysCheck: function (rule, value, callback) {
      let obj = rule.obj
      if (!this.UtilJs.isEmpty(value)) {
        if (regExp.dayNum.test(value)) {
          if (value > 30) {
            callback(new Error(this.regMsg.enterpriseInfoManage.sealDayInfoCheck))
          } else {
            callback()
          }
        } else {
          callback(new Error(this.regMsg.enterpriseInfoManage.sealDayInfo))
        }
      } else {
        if (this.UtilJs.isEmpty(obj.QQ)) {
          callback(new Error(this.regMsg.enterpriseInfoManage.sealDay))
        } else {
          callback()
        }
      }
    },
    // 清空qq微信
    clearValidateField (checkType, rule) {
      var field = rule.field
      field = field.split('.')
      if (field.length > 1) {
        field[2] = checkType
      } else {
        field = [checkType]
      }
      field = field.join('.')
      if (this.$refs.dialogVisible && this.$refs.dialogVisible.$refs.editForm) {
        this.$refs.dialogVisible.$refs.editForm.clearValidate(field)
      }
    },
    // QQ校验
    QQCheck: function (rule, value, callback) {
      // let obj = rule.obj
      if (!this.UtilJs.isEmpty(value)) {
        if (regExp.QQ.test(value)) {
          callback()
        } else {
          callback(new Error(this.regMsg.enterpriseInfoManage.qq))
        }
      } else {
        callback()
      }
      this.clearValidateField('weixin', rule)
    },
    onSaved () {
      let $this = this
      // $this.form.loading = true
      this.$set($this.form, 'loading', true)
      // 保存信息
      let data = {}
      // 联系人基本信息
      let baseDTO = {}
      // 联系人相关业务信息
      let bizDTO = {}
      // 联系人部门信息
      // let deptInputDTO = {}
      // 联系人角色  待处理
      baseDTO.contactLevel = $this.contactForm.contactLevel
      // 联系人
      baseDTO.employeeName = $this.contactForm.employeeName
      // 性别
      baseDTO.gender = $this.contactForm.gender
      // 手机号
      baseDTO.telephone = $this.contactForm.telephone
      // 微信号
      baseDTO.weixin = $this.contactForm.weixin
      // qq
      baseDTO.qq = $this.contactForm.qq
      // 座机
      baseDTO.officePhone = $this.contactForm.officePhone
      // 邮箱地址
      baseDTO.email = $this.contactForm.email
      // 做事风格
      baseDTO.characterStyle = $this.contactForm.characterStyle
      // 部门
      baseDTO.enterpriseDeptId = $this.contactForm.deptId
      // 部门名称
      baseDTO.enterpriseDeptName = $this.contactForm.deptName
      // 职务
      baseDTO.position = $this.contactForm.position
      // 性格
      baseDTO.character = $this.contactForm.temperament
      // 生日
      baseDTO.birthday = $this.contactForm.newDate
      // 日期类型
      baseDTO.calendarType = $this.contactForm.calendarType
      // 年龄
      baseDTO.age = $this.contactForm.age
      // 星座
      if ($this.contactForm.constellation === '' || $this.contactForm.constellation === undefined) {
        baseDTO.constellation = -1
      } else {
        baseDTO.constellation = $this.contactForm.constellation
      }
      // 籍贯
      baseDTO.nativePlace = $this.contactForm.nativePlace
      // 婚否
      baseDTO.maritalStatus = !$this.contactForm.maritalStatus || $this.contactForm.toString().maritalStatus === '' ? '-1' : $this.contactForm.maritalStatus
      // 爱好
      baseDTO.hobby = $this.contactForm.hobby
      // 备注
      baseDTO.memo = $this.contactForm.memo
      /* 业务相关操作信息 */
      // 是否挂靠
      bizDTO.anchoredFlag = $this.contactForm.anchoredFlag
      // 是否合作方
      bizDTO.partnerFlag = $this.contactForm.partnerFlag
      // 上班时间
      bizDTO.workTimeId = $this.contactForm.workTimeId
      // 保理熟悉程度
      bizDTO.factoringDegree = $this.contactForm.factoringDegree
      // 保理操作配合程度
      bizDTO.coordinationDegree = $this.contactForm.coordinationDegree
      // 周末是否操作
      bizDTO.weekendOperation = $this.contactForm.weekendOperation
      // 盖章方式 attributeDTOList
      data.attributeDTOList = []
      $this.contactForm.stampWay.forEach(s => {
        let attribute = {}
        attribute.attributeType = '1'
        attribute.attributeValue = s
        data.attributeDTOList.push(attribute)
      })
      $this.contactForm.factoringResponsibility.forEach(s => {
        let attribute = {}
        attribute.attributeType = '3'
        attribute.attributeValue = s
        data.attributeDTOList.push(attribute)
      })
      // 电子章盖章流程
      data.stampProcessZero = $this.contactForm.stampingProcess
      // 电子章盖章天数
      data.stampedAayZero = $this.contactForm.stampedDays
      // 鲜章盖章流程
      data.stampProcessOne = $this.contactForm.chapterStampingProcess
      // 鲜章盖章天数
      data.stampedAayOne = $this.contactForm.chapterStampedDays
      // 保理资料模板
      // info.factoringTemplate = it
      // 工作负责板块 fincrmPlateAreaRelDTOList
      // bizDTO.fincrmPlateAreaRelDTOList = $this.contactForm.fincrmPlateAreaRelDTOList
      if (this.form.tagCode === '60') {
        bizDTO.corePlateAreaRelDTOList = $this.contactForm.fincrmPlateAreaRelDTOList
      } else if (this.form.tagCode === '150') {
        bizDTO.projectPlateContractRelDTOList = $this.contactForm.fincrmPlateAreaRelDTOList
      } else if (this.form.tagCode === '140') {
        bizDTO.fincrmPlateAreaRelDTOList = $this.contactForm.fincrmPlateAreaRelDTOList
      }
      // 特殊事项
      bizDTO.specialMatter = $this.contactForm.specialMatter
      // 备注
      bizDTO.memo = $this.contactForm.memo
      // 是否做业务
      data.businessStatus = $this.contactForm.businessStatus
      // 账号keyId
      data.accountId = $this.form.accountKeyId
      // 企业keyId
      data.enterpriseId = $this.form.enterpriseId
      // 企业负责板块
      if (this.form.tagCode === '60') {
        data.accountCorePlateAreaRelDTOList = $this.templateInfo
      } else if (this.form.tagCode === '150') {
        data.accountProjectPlateContractRelDTOList = $this.templateInfo
      } else if (this.form.tagCode === '140') {
        data.accountTerritoryDtoList = $this.templateInfo
      }
      // data.accountTerritoryDtoList = $this.templateInfo
      // 账号类型
      data.employeeAccountType = $this.form.employeeAccountType
      data.employeeType = $this.form.tagCode
      data.baseDTO = baseDTO
      data.bizDTO = bizDTO
      data.userName = $this.$store.getters.nikeName
      $this.api.create(data).then(res => {
        if (res && res.data) {
          $this.success(this.$i18n.messages[this.$i18n.locale].common.saveSuccess)
          this.$emit('createSuccess', this.contactForm)
          this.$set($this.form, 'loading', false)
          this.dialogVisible = false
        } else {
          $this.error(this.$i18n.messages[this.$i18n.locale].common.saveError)
        }
      }).catch(() => {
        this.$set($this.form, 'loading', false)
      })
    },
    // 部门数据处理
    contactListSelectChanged (data, val) {
      if (data.deptInfoInfo) {
        this.$set(this.contactForm, 'deptId', data.deptInfoInfo.keyId)
      } else if (data.deptInfoInfo === undefined && val) {
        this.$set(this.contactForm, 'deptName', val)
      }
    }
  },
  watch: {
    visible (val) {
      let $this = this
      if (this.form.tagCode === '60') {
        $this.accountList[$this.accountList.length - 1].componentName = SelectWorkTemplateCorePlatModify
        this.accountList[this.accountList.length - 1].attrs.attrsQueryParas = { coreCompanyId: this.form.enterpriseId }
      } else if (this.form.tagCode === '150') {
        $this.accountList[$this.accountList.length - 1].componentName = SelectWorkTemplateProPlatModify
        this.accountList[this.accountList.length - 1].attrs.attrsQueryParas = { enterpriseId: this.form.enterpriseId }
      } else if (this.form.tagCode === '140') {
        $this.accountList[$this.accountList.length - 1].componentName = SelectWorkTemplatePlatModify
      }
      $this.reload = !$this.reload
      $this.workReload = !$this.workReload
      $this.$set($this.basicList1[0], 'reload', $this.reload)
      if (val) {
        $this.$set($this.accountList[0], 'disabled', true)
        $this.$set($this.accountList[0], 'pleaceholder', '')
        $this.$set($this.accountList[1], 'disabled', true)
        $this.$set($this.accountList[1], 'pleaceholder', '')
        $this.$set($this.accountList[2], 'disabled', true)
        $this.$set($this.accountList[2], 'pleaceholder', '')
        this.disabledOptions = []
        this.$nextTick(() => {
          this.disabledOptionsReload = !this.disabledOptionsReload
          this.$set($this.accountList[$this.accountList.length - 1], 'reload', !$this.accountList[$this.accountList.length - 1].reload)
        })
      } else {
        $this.optionList = []
        this.contactForm = {}
      }
      this.contactForm = this.form
      this.contactForm.newDate = ''
      this.contactForm.calendarType = 0
      // 获取企业ID
      this.contactInfo.companyId = this.form.enterpriseId
    },
    'contactForm.enterpriseDeptId' (val) {
      if (val) {
        this.reloadflag = !this.reloadflag
      }
    },
    'contactForm.calendarType' (newValue, oldValue) {
      if (newValue !== oldValue) {
        this.$set(this.contactForm, 'birthday', '')
        this.$set(this.contactForm, 'age', '')
        this.$set(this.contactForm, 'constellation', '')
        this.$set(this.contactForm, 'newDate', '')
      }
    }
  }
}
</script>

<style scoped lang="scss">
  @import '~@/styles/enterpriseInfoManage/supplierInfoManage/createContactEdit.scss';
</style>
