<!-- 删除联系人提示 -->
<template>
  <div>
    <dialog-edit :visible.sync="dialogVisible" :form="form" :editModel="editModel" :api="api" :appendToBody="appendToBody"
                 :title="$t('common.tip')" :width="width" :autoSave="autoSave" @onSaved="onSaved" labelWidth="0px" :loading="saveLoading"
                 :menuCode="menuId" savePerms="contactDeleteSave">
<!--      <div class="result-box">-->
<!--        <el-row>-->
<!--          <i class="el-icon-warning"></i>-->
<!--        </el-row>-->
<!--        <p class="fontSize">{{$t('enterpriseInfoManage.supplierInfoManage.delEnterpriseTip1')}}</p>-->
<!--        <select-enterprise v-model="queryParas.trusteeshipId"-->
<!--                        :placeholder="$t('common.pleaseSelect')"-->
<!--                        width="80%"-->
<!--                        :queryParas="queryList">-->
<!--        </select-enterprise>-->
<!--        <p class="fontSize1">{{$t('enterpriseInfoManage.supplierInfoManage.delEnterpriseTip2')}}</p>-->
<!--      </div>-->
      <div class="margin-top">
        <el-row :gutter="10">
          <el-col :xs="24" :sm="24" :md="24" :lg="24">
            <el-form-item :label="$t('enterpriseInfoManage.supplierInfoManage.deleteReson')" labelWidth="115px" prop="deleteReason"
                          :rules="formRules.deleteReason">
              <el-input type="textarea" v-model="form.deleteReason" maxlength="50"  style="width: 87.5% !important;" :placeholder="$t('common.pleaseInput')" class="dymForm"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </div>
    </dialog-edit>
  </div>
</template>

<script>
import BaseEdit from '@/pages/baseEditPage'
import { DialogEdit } from 'newepoch-components'
import SelectEnterprise from '@/components/element/enterpriseInfoManage/SelectEnterprise.vue'
import ladingNoticeManageApi from '@/api/shouji/ladingNoticeManageApi'
export default {
  extends: new BaseEdit(),
  name: 'delHintEdit',
  components: {
    DialogEdit,
    SelectEnterprise
  },
  props: {
    delStatus: {
      type: Boolean,
      default: function () {
        return false
      }
    }
  },
  data () {
    return {
      saveLoading: false,
      width: '670px',
      appendToBody: true,
      autoSave: false,
      // formValue: {
      //   deleteReason: ''
      // },
      queryParas: {
      },
      formRules: {
        deleteReason: [{
          required: true,
          message: this.$i18n.messages[this.$i18n.locale].regMsg.enterpriseInfoManage.deleteReason,
          trigger: 'blur'
        }]
      }
      // form: {}
    }
  },
  computed: {
    api () {
      return ladingNoticeManageApi.callentErpriseInfoApi
    }
  },
  methods: {
    // 保存
    onSaved () {
      let $this = this
      $this.saveLoading = true
      // delStatus 走单条删除
      $this.queryParas.employeeIds = $this.form.employeeId
      $this.queryParas.deleteReason = $this.form.deleteReason
      ladingNoticeManageApi.emploeeOper.getDeleteAssetcollectemployee(this.queryParas).then(res => {
        if (res && res.data) {
          $this.$emit('delSuccess')
          this.queryParas = {}
          this.dialogVisible = false
          $this.success(this.$i18n.messages[this.$i18n.locale].common.delSuccess)
        } else {
          this.saveLoading = false
          $this.error(this.$i18n.messages[this.$i18n.locale].common.delFailure)
        }
      }).catch(res => {
        this.saveLoading = false
      })
    }
  },
  watch: {
    visible (val) {
      if (!val) {
        this.queryParas = {}
      } else {
        this.saveLoading = false
      }
    }
  }
}
</script>

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