 <template>
  <ai-detail isHasSidebar v-loading="isLoading">
    <template slot="title">
      <ai-title title="调查走访详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
      </ai-title>
    </template>
    <template slot="content">
      <ai-card title="基本信息">
        <template #content>
          <ai-wrapper
            label-width="120px">
            <ai-info-item label="标题" isLine :value="info.title"></ai-info-item>
            <ai-info-item label="描述" isLine :value="info.description"></ai-info-item>
            <ai-info-item label="图片">
              <ai-uploader
                :instance="instance"
                :value="info.files"
                disabled
                :limit="9">
              </ai-uploader>
            </ai-info-item>
            <ai-info-item label="慰问对象" :value="info.name"></ai-info-item>
            <ai-info-item label="联系方式" :value="info.phone"></ai-info-item>
            <ai-info-item label="走访区域" :value="info.areaName"></ai-info-item>
            <ai-info-item label="所在位置" :value="info.address"></ai-info-item>
            <ai-info-item label="走访人" :value="info.name"></ai-info-item>
            <ai-info-item label="走访时间" :value="info.visitTime"></ai-info-item>
          </ai-wrapper>
        </template>
      </ai-card>
    </template>
  </ai-detail>
</template>

<script>
  export default {
    name: 'Detail',

    props: {
      instance: Function,
      dict: Object,
      params: Object
    },

    data () {
      return {
        info: {}
      }
    },

    created () {
      if (this.params && this.params.id) {
        this.getInfo(this.params.id)
      }
    },

    methods: {
      getInfo (id) {
        this.instance.post(`/app/appvisitvondolencepingchang/queryDetailById?id=${id}`).then(res => {
          if (res.code === 0) {
            this.info = res.data
          }
        })
      },

      cancel () {
        this.$emit('change', {
          type: 'List',
          isRefresh: true
        })
      }
    }
  }
</script>

<style scoped lang="scss">
</style>
