 <template>
  <ai-detail>
    <template slot="title">
      <ai-title title="详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
      </ai-title>
    </template>
    <template slot="content">
      <AiSidebar :tabTitle="tabList" v-model="currIndex"></AiSidebar>
      <div v-show="currIndex === 0">
        <ai-card title="基本信息" v-show="currIndex === 0">
          <template #content>
            <ai-wrapper
              label-width="120px">
              <ai-info-item label="姓名" :value="info.title"></ai-info-item>
              <ai-info-item label="填报时间" :value="info.areaName"></ai-info-item>
              <ai-info-item label="身份证号" :value="info.beginTime"></ai-info-item>
              <ai-info-item label="手机号码" :value="info.endTime"></ai-info-item>
              <ai-info-item label="人员类别" isLine :value="info.address"></ai-info-item>
            </ai-wrapper>
          </template>
        </ai-card>
        <ai-card title="行程信息">
          <template #content>
            <ai-wrapper
              label-width="120px">
              <ai-info-item label="出发时间" :value="info.title"></ai-info-item>
              <ai-info-item label="出发地区" :value="info.areaName"></ai-info-item>
              <ai-info-item label="出发地址" isLine :value="info.beginTime"></ai-info-item>
              <ai-info-item label="出行方式" :value="info.endTime"></ai-info-item>
              <ai-info-item label="行程描述" isLine :value="info.address"></ai-info-item>
              <ai-info-item label="到达时间" :value="info.contactPerson"></ai-info-item>
              <ai-info-item label="到达地区" isLine :value="info.contactPhone"></ai-info-item>
              <ai-info-item label="返乡地址" isLine :value="info.contactPerson"></ai-info-item>
            </ai-wrapper>
          </template>
        </ai-card>
        <ai-card title="健康状况">
          <template #content>
            <ai-wrapper
              label-width="120px">
              <ai-info-item label="体温" :value="info.title"></ai-info-item>
              <ai-info-item label="当前健康状况" :value="info.areaName"></ai-info-item>
            </ai-wrapper>
          </template>
        </ai-card>
        <ai-card title="核酸检测">
          <template #content>
            <ai-wrapper
              label-width="120px">
              <ai-info-item label="检测日期" :value="info.title"></ai-info-item>
              <ai-info-item label="检测结果" :value="info.areaName"></ai-info-item>
              <ai-info-item label="本人健康码截图" isLine></ai-info-item>
            </ai-wrapper>
          </template>
        </ai-card>
      </div>
      <ai-card title="异常处理" v-show="currIndex === 1">
        <template #content>
          <ai-wrapper
            label-width="120px">
            <ai-info-item label="异常状况" :value="info.title"></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 {
        total: 0,
        info: {},
        id: '',
        search: {
          current: 1,
          size: 10
        },
        currIndex: 0,
        tableData: [],
        colConfigs: [
          {prop: 'name', label: '报名人员名称', align: 'center' },
          {prop: 'createTime', label: '报名时间', align: 'center'},
          {prop: 'phone', label: '联系方式', align: 'center' }
        ],
        tabList: ['基本信息', '异常处理']
      }
    },

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

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

      getList (id) {
        this.instance.post(`/app/appvillageactivityuser/list`, null, {
          params: {
            ...this.search,
            activityId: id
          }
        }).then(res => {
          if (res.code == 0) {
            this.tableData = res.data.records
            this.total = res.data.total
          }
        })
      },

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

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