<template>
  <ele-modal
    custom-class="ele-dialog-form"
    v-if="visible"
    :visible.sync="visible"
    :title="title"
    :close-on-click-modal="false"
    width="80%"
    @close="cancel"
  >
      <el-form
          label-width="160px"
          ref="formRef"
          :model="form"
          style="margin-top: 30px"
        >
          <el-row>
            <el-col :span="8">
              <el-form-item
                label="客户名称："
                prop="contactName"
              >
                {{form.contactName}}
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="商机名称：" prop="name">
                {{form.name}}
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="负责人名称：" prop="responsibleName">
                {{form.responsibleName}}
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="商机来源：" prop="source">
                {{form.source}}
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="状态：" prop="status">
                {{ form.status === 1 ? "有效" : "失效"}}
              </el-form-item>
            </el-col>
          
            <el-col :span="16">
              <el-form-item label="备注：" prop="remark">
                {{form.remark}}
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>

    <div slot="footer" class="footer">
      <el-button @click="cancel">返回</el-button>
    </div>
  </ele-modal>
</template>

<script>
import {contactDetail} from '@/api/saleManage/contact';
import {getFile} from '@/api/system/file';
import {getInfoById as getCategoryInfo} from '@/api/classifyManage/index';
import fileUpload from '@/components/upload/fileUpload';
import dictMixins from '@/mixins/dictMixins';
import deptSelect from '@/components/CommomSelect/dept-select.vue';
import personSelect from '@/components/CommomSelect/person-select.vue';
import {copyObj} from '@/utils/util';


export default {
    props: {
      categoryTreeList: Array
    },
    mixins: [dictMixins],
    components: {
      fileUpload,
      deptSelect,
      personSelect
    },
    data() {
      let formDef = {
        id:'',
          contactName: '',
          contactId: 0,
          name: '',
          remark: '',
          responsibleName: '',
          responsibleId: '',
          source: '',
          status: 1
        };
    
      return {
        visible: false,
        title: '详情',
        row: {},
        activeName: 'base',
        formDef,
        form: copyObj(formDef),
        tableBankData: [],
        tableLinkData: [],
        ifChiefList: [
          {
            value: 0,
            label: '否'
          },
          {
            value: 1,
            label: '是'
          }
        ],
      };
    },
    methods: {
      async open(row) {
        this.form = row;
        this.visible = true;
      },

      cancel() {
        this.$nextTick(() => {
          // 关闭后，销毁所有的表单数据
          this.form = copyObj(this.formDef),
          this.otherForm = copyObj(this.otherFormDef),
          this.tableBankData = []
          this.tableLinkData = []
          this.visible = false;
        })
      },

   

    }
  };
</script>
