<template>
  <div id="index">
    <admin-frame @search="search" :limit="limit" :total="total" :useNav="false">
      <template v-slot:info>
        <list-1 :list="list" @toView="toView"></list-1>
      </template>
    </admin-frame>
    <van-dialog class="dialog" v-model="dialog.show" :title="dialog.title" :show-confirm-button="false" show-cancel-button cancel-button-text="返回">
      <info-1 :info="info" v-if="dialog.type == '1'"></info-1>
    </van-dialog>
  </div>
</template>

<script>
import list1 from '@/layout/infoview/laboratory/list-1.vue';
import info1 from '@/layout/infoview/laboratory/info-1.vue';
import adminFrame from '@common/src/components/mobile-frame/mobile-main.vue';
import { mapState, createNamespacedHelpers } from 'vuex';
export default {
  name: 'index',
  props: {},
  components: {
    adminFrame,
    list1,
    info1,
  },
  data: function () {
    return {
      list: [],
      total: 0,
      limit: 5,
      // 弹框
      dialog: { show: false, title: '详细信息', type: '1' },
      // 详细信息
      info: {},
    };
  },
  async created() {
    await this.search();
  },
  methods: {
    async search({ skip = 0, limit = this.limit, searchName, ...info } = {}) {
      if (searchName) info.name = searchName;
      let data = [
        {
          buildTime: null,
          chiefName: '梁建民',
          createBy: '1',
          createTime: '2021-09-16 00:00:00',
          delFlag: '0',
          englishName: '',
          id: '1',
          labAcreage: '',
          labAddress: '',
          labEmail: 'jackyliangjm@163.com',
          labPerson: '梁建民',
          labPhone: '13578652528',
          name: '儿科神经吉林省重点实验室',
          numb: '0',
          params: {},
          remark: null,
          searchValue: null,
          unitName: '吉林大学白求恩第一医院',
          unitPerson: '孙宇飞 ',
          unitPhone: '13944843792',
          updateBy: 'userid001',
          updateTime: '2021-09-30 14:09:43',
        },
      ];
      this.$set(this, `list`, data);
    },
    // 查看信息
    async toView(data) {
      this.$set(this, `info`, data);
      this.dialog = { show: true, title: '详细信息', type: '1' };
    },
  },
  computed: {
    ...mapState(['user']),
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
  watch: {
    test: {
      deep: true,
      immediate: true,
      handler(val) {},
    },
  },
};
</script>

<style lang="less" scoped>
.dialog {
  /deep/.van-dialog__content {
    max-height: 350px;
    overflow-y: auto;
  }
}
</style>
