<template>
  <div class="dialog" v-if="dialogVisible">
    <div class="head_box">
      <span class="title">{{ title }}</span>
      <div>
        <!-- <el-button size="small" @click="save" type="primary" :loading="loading">保存</el-button> -->
        <el-button size="small" @click="close">关闭</el-button>
      </div>
    </div>
    <div class="cntinfo">
      <el-descriptions column="3" border label-width="180px">
        <el-descriptions-item label="单位名称(营业执照登记名称)">{{ formData.dwmc }}</el-descriptions-item>
        <el-descriptions-item label="统一社会信用代码">{{ formData.xydm }}</el-descriptions-item>
        <el-descriptions-item label="娱乐场所图片" :rowspan="4">
          <div class="imgWrapper">
            <Upload v-model="formData.cszp" />
          </div>
        </el-descriptions-item>
        <el-descriptions-item label="保安单位类型">{{ formData.type }}</el-descriptions-item>
        <el-descriptions-item label="场所名称">{{ formData.csmc }}</el-descriptions-item>
        <el-descriptions-item label="场所代码">{{ formData.csdm }}</el-descriptions-item>
        <el-descriptions-item label="场所联系电话">{{ formData.csLxdh }}</el-descriptions-item>
        <el-descriptions-item label="经营状况">{{ formData.jyzk }}</el-descriptions-item>
        <el-descriptions-item label="开业日期">{{ formData.kyrq }}</el-descriptions-item>
        <el-descriptions-item label="单位注册地址" :span="3">{{ formData.zcdz }}</el-descriptions-item>
        <el-descriptions-item label="场所经营地址" :span="3">{{ formData.csjydz }}</el-descriptions-item>
        <el-descriptions-item label="法定代表人">{{ formData.fdrXm }}</el-descriptions-item>
        <el-descriptions-item label="法定代表人证件号码">{{ formData.fdrSfzh }}</el-descriptions-item>
        <el-descriptions-item label="法定代表人照片" :rowspan="2">
          <div class="imgWrapper">
            <Upload v-model="formData.frSfzZm" disabled />
            <Upload v-model="formData.frSfzFm" disabled />
          </div>
        </el-descriptions-item>
        <el-descriptions-item label="经营法定代表人联系电话">{{ formData.fdrLxdh }}</el-descriptions-item>
        <el-descriptions-item label="经营法定代表人居住地址">{{ formData.fdrJzdz }}</el-descriptions-item>
        <el-descriptions-item label="场所负责人">{{ formData.fzrXm }}</el-descriptions-item>
        <el-descriptions-item label="场所负责人身份证号">{{ formData.fzrSfzh }}</el-descriptions-item>
        <el-descriptions-item label="场所负责人照片" :rowspan="2">
          <div class="imgWrapper">
            <Upload v-model="formData.fzrSfzZm" disabled />
            <Upload v-model="formData.fzrSfzFm" disabled />
          </div>
        </el-descriptions-item>
        <el-descriptions-item label="场所负责人联系方式">{{ formData.fzrLxdh }}</el-descriptions-item>
        <el-descriptions-item label="场所负责人居住地址">{{ formData.fzrJzdz }}</el-descriptions-item>
        <el-descriptions-item label="保安服务公司名称" :span="3">{{ formData.bagsMc }}</el-descriptions-item>
        <el-descriptions-item label="保安负责人">{{ formData.bagsFzrXm }}</el-descriptions-item>
        <el-descriptions-item label="保安负责人身份证号码">{{ formData.bagsFzrSfzh }}</el-descriptions-item>
        <el-descriptions-item label="保安负责人联系方式">{{ formData.bagsFzrLxdh }}</el-descriptions-item>
        <el-descriptions-item label="保安人员数量">{{ formData.bagsRysl }}</el-descriptions-item>
        <el-descriptions-item label="场所面积" :span="3">{{ formData.csmj }}</el-descriptions-item>
        <el-descriptions-item label="营业执照照片" :span="1.5">
          <div class="imgWrapper">
            <Upload v-model="formData.yyzzzp" />
          </div>
        </el-descriptions-item>
        <el-descriptions-item label="武装押运证书" :span="1.5">
          <div class="imgWrapper">
            <Upload v-model="formData.jyxkz" />
          </div>
        </el-descriptions-item>
        <el-descriptions-item label="备案编号">{{ formData.babh }}</el-descriptions-item>
        <el-descriptions-item label="备案机构名称">{{ formData.bamc }}</el-descriptions-item>
        <el-descriptions-item label="经营许可证编号">{{ formData.jyxkzBh }}</el-descriptions-item>
        <el-descriptions-item label="经营许可证发证机构">{{ formData.jyxkzBfjg }}</el-descriptions-item>
      </el-descriptions>
    </div>
  </div>
</template>

<script setup>
import { ref, computed, reactive } from 'vue'
import Upload from "@/components/MyComponents/Upload/index.vue"

const title = ref('保安培训项目新增')
const disabled = ref(false)
const visible = ref(true)

const props = defineProps({
  modelValue: {
    type: Boolean,
    default: false
  },
  dic: {
    type: Object,
    default: () => ({})
  }
})

const emits = defineEmits(['update:modelValue'])

const dialogVisible = computed({
  get() {
    return props.modelValue
  },
  set(val) {
    emits('update:modelValue', val)
  }
})

const formData = ref({})

const close = () => {
  dialogVisible.value = false
}

const open = (row = {}, type = 'add') => {
  disabled.value = false
  dialogVisible.value = true
  formData.value = { ...row }
  if (type === 'view') {
    title.value = '查看详情'
    visible.value = true
  } else if (type === 'edit') {
    title.value = '保安证申请'
    visible.value = false
  }
}

defineExpose({ open })
</script>

<style lang="scss" scoped>
@import "@/assets/css/layout.scss";

.dialog {
  ::v-deep {
    .imgWrapper {
      display: flex;

      .el-upload-list__item {
        height: 80px;
        width: 90%;
      }
      .form-item-box {
        width: auto !important;
      }
    }
    .el-upload--picture-card, .el-upload-list--picture-card .el-upload-list__item-actions span+span {
      display: none !important;
    }
  }
}

.label {
  margin-top: 20px;
  color: #000;
}

.cntinfo {
  padding: 2rem 12rem 0rem 12rem;
  height: calc(100% - 170px);
  overflow-y: auto;
}

.mapBox {
  width: 100%;
  height: 400px;
  overflow: hidden;
}
</style>
