<template>
  <div class="Detail">
    <ai-detail class="add">
      <template #title>
        <ai-title :title="params.id ? '详情' : '新增行政许可信息'" :isShowBack="true" :isShowBottomBorder="true" @onBackClick="cancel(false)" />
      </template>
      <template #content>
        <div class="add-form">
          <div class="info">
            <ai-bar title="基本信息"></ai-bar>
            <el-form ref="forms" :model="forms" size="small"  label-width="150px">
            <el-form-item label="许可文书名称" prop="num">
              {{ forms.licenseName }}
            </el-form-item>
            <el-row type="flex">
              <el-col :span="20">
                <el-form-item label="许可文书号" prop="num">
                  {{ forms.licenseCode }}
                </el-form-item>
              </el-col>
              <el-col :span="20">
                <el-form-item label="许可决定日期" prop="num">
                  {{ forms.decisionDate }}
                </el-form-item>
              </el-col>
            </el-row>
            <el-row type="flex">
              <el-col :span="20">
                <el-form-item label="许可有效期自" prop="num">
                  {{ forms.startDate }}
                </el-form-item>
              </el-col>
              <el-col :span="20">
                <el-form-item label="许可有效期至" prop="num">
                  {{ forms.endDate }}
                </el-form-item>
              </el-col>
            </el-row>
            <el-form-item label="许可机关" prop="num">
              {{ forms.licenseOrganization }}
            </el-form-item>
            <el-row type="flex">
              <el-col :span="20">
                <el-form-item label="经营主体" prop="num">
                  {{ forms.enterpriseName }}
                </el-form-item>
              </el-col>
              <el-col :span="20">
                <el-form-item label="统一信用代码" prop="num">
                  {{ forms.unifiedCode }}
                </el-form-item>
              </el-col>
            </el-row>
            <el-form-item label="许可内容" prop="num">
              {{ forms.licenseContent }}
            </el-form-item>
            </el-form>
          </div>
        </div>
      </template>
    </ai-detail>
  </div>
</template>

<script>
export default {
  name: "Detail",
  props: {
    instance: Function,
    dict: Object,
    permissions: Function,
    params: Object,
  },
  data() {
    return {
      id: '',
      forms: {},
    }
  },
  created() {
    if (this.params && this.params.id) {
      this.id = this.params.id
      this.getDetail(this.params.id)
    }
  },
  methods: {
    getDetail(id) {
      this.instance.post(`/appcreditadminstrativelicense/queryDetailById?id=${id}`).then(res => {
        if (res.code === 0) {
          this.forms = res.data
          // this.forms.codeUrl = [{
          //   url: res.data.codeUrl
          // }]
        }
      })
    },
    cancel (isRefresh) {
      this.$emit('change', {
        type: 'List',
        isRefresh: !!isRefresh
      })
    }
  },
}
</script>

<style lang="scss" scoped>
.Detail {
  height: 100%;
  overflow: hidden;
  background: #f2f4f6 ;

  .add-form__item {
    display: flex;
    align-items: center;
  }

  ::v-deep .el-form-item__label {
    padding-right: 40px;
  }

  ::v-deep .ai-detail__content--active {
    padding: 0 400px;
    background: #FFF;

    .ai-detail__content--wrapper {
      width: 100%;
    }

    .aibar {
      padding: 0 16px;
    }

    .el-form {
      padding: 0 96px 20px 50px;
    }

    .add-form {
      background: #fff;
      .info {
        box-sizing: border-box;
        padding: 0 100px 0 0;
        background: #FFF;
      }
    }
  }

  ::v-deep .ai-wrapper {
    align-items: inherit !important;
  }

  .user-wrapper {
    display: flex;
    justify-content: space-between;
  }

  .avatar {
    width: 100px;
    height: 100px;
    object-fit: contain;
    border-radius: 10px;
  }

  .footer-btn {
    width: 130px;
  }

  .el-form {
    padding-bottom: 80px;
  }
}
</style>