form-1.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <div id="form-1">
  3. <van-row>
  4. <van-col span="24" class="main">
  5. <van-col span="24" class="one">
  6. <van-form @submit="onSubmit">
  7. <van-field v-model="form.name" name="name" label="发明名称" placeholder="发明名称" :rules="[{ required: true, message: '发明名称' }]" />
  8. <van-field v-model="form.apply_name" name="apply_name" label="申请人" placeholder="申请人" :rules="[{ required: true, message: '申请人' }]" />
  9. <van-field name="type" label="专利类型" :rules="[{ required: true, message: '请填写专利类型' }]">
  10. <template #input>
  11. <van-radio-group v-model="form.type" direction="horizontal">
  12. <van-radio name="发明申请">发明申请</van-radio>
  13. <van-radio name="实用新型">实用新型</van-radio>
  14. </van-radio-group>
  15. </template>
  16. </van-field>
  17. <van-field v-model="form.inventor" name="inventor" label="发明人" placeholder="发明人" :rules="[{ required: true, message: '发明人' }]" />
  18. <van-field v-model="form.contact" name="contact" label="技术联系人" placeholder="技术联系人" :rules="[{ required: true, message: '技术联系人' }]" />
  19. <van-field v-model="form.phone" name="phone" label="联系人电话" placeholder="联系人电话" :rules="[{ required: true, message: '联系人电话' }]" />
  20. <van-field v-model="form.email" name="email" label="联系人邮箱" placeholder="联系人邮箱" :rules="[{ required: true, message: '联系人邮箱' }]" />
  21. <van-field v-model="form.questions.q1" type="textarea" autosize name="特殊情况说明" label="特殊情况说明" placeholder="特殊情况说明" />
  22. <van-field v-model="form.questions.q2" type="textarea" autosize label="本发明的技术领域" placeholder="本发明的技术领域" />
  23. <van-field v-model="form.questions.q3" type="textarea" autosize label="与本发明相关的背景技术" placeholder="与本发明相关的背景技术" />
  24. <van-field v-model="form.questions.q4" type="textarea" autosize label="现有技术的缺点及本发明所要解决的技术问题" />
  25. <van-field v-model="form.questions.q5" type="textarea" autosize label="本发明技术方案的详细阐述" />
  26. <van-field v-model="form.questions.q6" type="textarea" autosize label="本申请的关键点和欲保护点" />
  27. <van-field v-model="form.questions.q7" type="textarea" autosize label="与本发明最相似,相近的实现技术,方案相比,本发明有何优点" />
  28. <van-field v-model="form.questions.q8" type="textarea" autosize label="针对本发明技术方案,是否还有别的替代方案" />
  29. <van-col span="24" style="text-align: center; margin: 10px 0">
  30. <van-button type="info" size="small" native-type="submit">提交申请</van-button>
  31. </van-col>
  32. </van-form>
  33. </van-col>
  34. </van-col>
  35. </van-row>
  36. </div>
  37. </template>
  38. <script>
  39. import { mapState, createNamespacedHelpers } from 'vuex';
  40. const { mapActions: adminLogin } = createNamespacedHelpers('adminLogin');
  41. const { mapActions: patentanalysis } = createNamespacedHelpers('patentanalysis');
  42. export default {
  43. name: 'form-1',
  44. props: {},
  45. components: {},
  46. data: function () {
  47. return {
  48. // 管理员信息
  49. adminInfo: {},
  50. form: { questions: {} },
  51. };
  52. },
  53. created() {
  54. this.searchOther();
  55. },
  56. methods: {
  57. ...adminLogin({ adminQuery: 'query', adminFetch: 'fetch' }),
  58. ...patentanalysis(['query', 'fetch', 'create', 'update']),
  59. async onSubmit(values) {
  60. if (values) {
  61. let data = this.form;
  62. if (data.id) {
  63. console.log(data);
  64. } else {
  65. let res = await this.create(data);
  66. if (this.$checkRes(res)) {
  67. this.$toast({ type: `success`, message: `操作成功` });
  68. this.searchOther();
  69. }
  70. }
  71. }
  72. },
  73. async searchOther() {
  74. let res = await this.adminQuery({ code: this.user.code });
  75. if (this.$checkRes(res)) {
  76. let arr = await this.adminFetch(res.data[0].pid);
  77. if (this.$checkRes(arr)) {
  78. this.$set(this, `adminInfo`, arr.data);
  79. let data = {
  80. user_id: this.user._id,
  81. user_name: this.user.phone,
  82. admin_id: this.adminInfo.id,
  83. admin_name: this.adminInfo.name,
  84. apply_name: this.user.phone,
  85. inventor: this.user.phone,
  86. contact: this.user.phone,
  87. phone: this.user.name,
  88. email: this.user.email,
  89. questions: {},
  90. status: '0',
  91. };
  92. this.$set(this, `form`, data);
  93. }
  94. }
  95. },
  96. },
  97. computed: {
  98. ...mapState(['user']),
  99. },
  100. metaInfo() {
  101. return { title: this.$route.meta.title };
  102. },
  103. watch: {
  104. test: {
  105. deep: true,
  106. immediate: true,
  107. handler(val) {},
  108. },
  109. },
  110. };
  111. </script>
  112. <style lang="less" scoped></style>