<template>
  <div id="info_create">
    <admin-frame topType="2" @back="back" :rightArrow="false" :usePage="false" :useNav="false">
      <template v-slot:info>
        <detail-1 :form="form"></detail-1>
      </template>
    </admin-frame>
  </div>
</template>

<script>
import detail1 from './parts/detail-1.vue';
import adminFrame from '@frame/src/components/mobile-frame/mobile-main.vue';
import { mapState, createNamespacedHelpers } from 'vuex';
const { mapActions: patentinfo } = createNamespacedHelpers('patentinfo');
export default {
  name: 'info_create',
  props: {},
  components: {
    adminFrame,
    detail1,
  },
  data: function () {
    return {
      form: {},
    };
  },
  async created() {
    if (this.id) await this.search();
  },
  methods: {
    ...patentinfo(['fetch']),
    async search() {
      let res = await this.fetch(this.id);
      if (this.$checkRes(res)) {
        this.$set(this, `form`, res.data);
      }
    },

    // 返回
    back() {
      this.$router.push({ path: '/patent/mech/patent/navigation' });
    },
  },
  computed: {
    ...mapState(['user']),
    id() {
      return this.$route.query.id;
    },
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
  watch: {
    test: {
      deep: true,
      immediate: true,
      handler(val) {},
    },
  },
};
</script>

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