<template>
  <div id="form-1">
    <van-row>
      <van-col span="24" class="main">
        <van-col span="24" class="one">
          <van-form @submit="onSubmit">
            <van-field v-model="form.user_id" name="user_id" label="用户id" style="display: none" />
            <van-field v-model="form.admin_id" name="admin_id" label="管理员id" style="display: none" />
            <van-field v-model="form.create_number" name="create_number" label="申请号" placeholder="申请号" readonly />
            <van-field v-model="form.name" name="name" label="发明名称" placeholder="发明名称" readonly />
            <van-field v-model="form.apply_personal" name="apply_personal" label="专利申请人" placeholder="专利申请人" readonly />
            <van-field v-model="form.type" name="type" label="申请类型" placeholder="申请类型" readonly />
            <van-field v-model="form.inventor" name="inventors" label="发明人" readonly />
            <van-field v-model="form.contact" name="contact" label="联系人" placeholder="联系人" :rules="[{ required: true, message: '联系人' }]" />
            <van-field v-model="form.phone" name="phone" label="联系人电话" placeholder="联系人电话" :rules="[{ required: true, message: '联系人电话' }]" />
            <van-field v-model="form.email" name="email" label="联系人邮箱" placeholder="联系人邮箱" :rules="[{ required: true, message: '联系人邮箱' }]" />
            <van-field
              v-model="form.questions.q9"
              type="textarea"
              rows="1"
              autosize
              name="诉求"
              label="诉求"
              placeholder="诉求"
              :rules="[{ required: true, message: '诉求' }]"
            />
            <van-field
              v-model="form.questions.q8"
              type="textarea"
              rows="1"
              autosize
              name="侵权事实"
              label="侵权事实"
              placeholder="侵权事实"
              :rules="[{ required: true, message: '侵权事实' }]"
            />
            <van-field
              v-model="form.questions.q1"
              type="textarea"
              rows="1"
              autosize
              name="本发明的技术领域"
              label="本发明的技术领域"
              placeholder="本发明的技术领域"
              :rules="[{ required: false, message: '本发明的技术领域' }]"
            />
            <van-field
              v-model="form.questions.q2"
              type="textarea"
              rows="1"
              autosize
              name="与本发明相关的背景技术"
              label="与本发明相关的背景技术"
              placeholder="与本发明相关的背景技术"
              :rules="[{ required: false, message: '与本发明相关的背景技术' }]"
            />
            <van-field
              v-model="form.questions.q3"
              type="textarea"
              rows="1"
              autosize
              name="现有技术的缺点及本发明所要解决的技术问题"
              label="现有技术的缺点及本发明所要解决的技术问题"
              placeholder="现有技术的缺点及本发明所要解决的技术问题"
              :rules="[{ required: false, message: '现有技术的缺点及本发明所要解决的技术问题' }]"
            />
            <van-field
              v-model="form.questions.q4"
              type="textarea"
              rows="1"
              autosize
              name="本发明技术方案的详细阐述"
              label="本发明技术方案的详细阐述"
              placeholder="本发明技术方案的详细阐述"
              :rules="[{ required: false, message: '本发明技术方案的详细阐述' }]"
            />
            <van-field
              v-model="form.questions.q5"
              type="textarea"
              rows="1"
              autosize
              name="本申请的关键点和欲保护点"
              label="本申请的关键点和欲保护点"
              placeholder="本申请的关键点和欲保护点"
              :rules="[{ required: false, message: '本申请的关键点和欲保护点' }]"
            />
            <van-field
              v-model="form.questions.q6"
              type="textarea"
              rows="1"
              autosize
              name="与本发明最相似,相近的实现技术,方案相比,本发明有何优点"
              label="与本发明最相似,相近的实现技术,方案相比,本发明有何优点"
              placeholder="与本发明最相似,相近的实现技术,方案相比,本发明有何优点"
              :rules="[{ required: false, message: '与本发明最相似,相近的实现技术,方案相比,本发明有何优点' }]"
            />
            <van-field
              v-model="form.questions.q7"
              type="textarea"
              rows="1"
              autosize
              name="针对本发明技术方案,是否还有别的替代方案"
              label="针对本发明技术方案,是否还有别的替代方案"
              placeholder="针对本发明技术方案,是否还有别的替代方案"
              :rules="[{ required: false, message: '针对本发明技术方案,是否还有别的替代方案' }]"
            />
            <div style="margin: 16px">
              <van-button round block type="info" native-type="submit">提交申请</van-button>
            </div>
          </van-form>
        </van-col>
      </van-col>
    </van-row>
  </div>
</template>

<script>
import { mapState, createNamespacedHelpers } from 'vuex';
export default {
  name: 'form-1',
  props: { form: { type: Object } },
  components: {},
  data: function () {
    return {};
  },
  created() {},
  methods: {
    onSubmit(value) {
      if (value) this.$emit('onSubmit', { data: this.form });
    },
  },
  computed: {
    ...mapState(['user']),
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
  watch: {
    test: {
      deep: true,
      immediate: true,
      handler(val) {},
    },
  },
};
</script>

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