form-1.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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-button type="info" size="small" @click="toSearch()">查询专利</van-button>
  7. </van-col>
  8. <van-col span="24" class="two">
  9. <van-form @submit="onSubmit">
  10. <van-field v-model="form.user_id" name="user_id" label="用户id" style="display: none" />
  11. <van-field v-model="form.user_name" name="user_name" label="用户姓名" style="display: none" />
  12. <van-field v-model="form.admin_id" name="admin_id" label="管理员id" style="display: none" />
  13. <van-field v-model="form.admin_name" name="admin_name" label="管理员姓名" style="display: none" />
  14. <van-field v-model="form.patent_id" name="patent_id" label="专利id" style="display: none" />
  15. <van-field v-model="form.create_number" name="create_number" label="申请号" readonly />
  16. <van-field v-model="form.patent_name" name="patent_name" label="专利名称" readonly />
  17. <van-field v-model="form.inventor" name="inventor" label="发明人" readonly />
  18. <van-field v-model="form.type" name="type" label="专利类型" readonly />
  19. <van-field v-model="form.contact" name="contact" label="联系人" placeholder="请输入联系人" :rules="[{ required: true, message: '请输入联系人' }]" />
  20. <van-field
  21. v-model="form.phone"
  22. name="phone"
  23. label="联系电话"
  24. placeholder="请输入联系电话"
  25. :rules="[{ required: true, message: '请输入联系电话' }]"
  26. />
  27. <van-field
  28. v-model="form.email"
  29. name="email"
  30. label="电子邮箱"
  31. placeholder="请输入电子邮箱"
  32. :rules="[{ required: true, message: '请输入电子邮箱' }]"
  33. />
  34. <van-field v-model="form.abstract" name="abstract" label="摘要" type="textarea" autosize readonly />
  35. <van-field
  36. v-model="form.field"
  37. name="field"
  38. label="应用领域"
  39. placeholder="请输入应用领域"
  40. type="textarea"
  41. autosize
  42. rows="1"
  43. :rules="[{ required: true, message: '请输入应用领域' }]"
  44. />
  45. <van-field
  46. v-model="form.explain"
  47. name="explain"
  48. label="技术说明"
  49. placeholder="请输入技术说明"
  50. type="textarea"
  51. autosize
  52. rows="1"
  53. :rules="[{ required: true, message: '请输入技术说明' }]"
  54. />
  55. <van-field v-model="form.shared_value" name="shared_value" label="合享价值度" readonly />
  56. <van-field v-model="form.techol_stable" name="techol_stable" label="技术稳定性" readonly />
  57. <van-field v-model="form.techol_advanced" name="techol_advanced" label="技术先进性" readonly />
  58. <van-col span="24" class="btn">
  59. <van-button type="info" size="small" native-type="submit">提交申请</van-button>
  60. </van-col>
  61. </van-form>
  62. </van-col>
  63. </van-col>
  64. </van-row>
  65. <van-dialog class="dialog" v-model="dialog.show" :title="dialog.title" :show-confirm-button="false" show-cancel-button cancel-button-text="返回">
  66. <search-1 v-if="dialog.type == '1'" @conPatent="conPatent"></search-1>
  67. </van-dialog>
  68. </div>
  69. </template>
  70. <script>
  71. import search1 from '@/layout/assessment/search-1.vue';
  72. import { mapState, createNamespacedHelpers } from 'vuex';
  73. const { mapActions: patentassess } = createNamespacedHelpers('patentassess');
  74. const { mapActions: patentinfo } = createNamespacedHelpers('patentinfo');
  75. const { mapActions: adminLogin } = createNamespacedHelpers('adminLogin');
  76. export default {
  77. name: 'form-1',
  78. props: {
  79. patent_id: { type: String },
  80. },
  81. components: { search1 },
  82. data: function () {
  83. return {
  84. adminInfo: {},
  85. form: {},
  86. // 弹框
  87. dialog: { show: false, title: '查询专利', type: '1' },
  88. };
  89. },
  90. created() {
  91. this.searchOther();
  92. },
  93. methods: {
  94. ...adminLogin({ adminQuery: 'query', adminFetch: 'fetch' }),
  95. ...patentinfo({ patentQuery: 'query', patentFetch: 'fetch' }),
  96. ...patentassess(['fetch', 'create', 'update']),
  97. // 提交
  98. async onSubmit(values) {
  99. if (values) {
  100. let data = this.form;
  101. if (data.id) {
  102. } else {
  103. let res = await this.create(data);
  104. if (this.$checkRes(res)) {
  105. this.$toast({ type: `success`, message: `操作完成` });
  106. this.form = {};
  107. }
  108. }
  109. }
  110. },
  111. // 查询专利
  112. toSearch() {
  113. this.dialog = { show: true, title: '查询专利', type: '1' };
  114. },
  115. // 确认选择专利
  116. conPatent(value) {
  117. let data = {
  118. admin_id: this.adminInfo.id,
  119. admin_name: this.adminInfo.name,
  120. user_id: this.user.id,
  121. user_name: this.user.phone,
  122. patent_id: value.id,
  123. create_number: value.create_number,
  124. patent_name: value.name,
  125. inventor: value.inventor,
  126. type: value.type,
  127. contact: this.user.phone,
  128. phone: this.user.name,
  129. email: this.user.email,
  130. abstract: value.abstract,
  131. shared_value: value.shared_value,
  132. techol_stable: value.techol_stable,
  133. techol_advanced: value.techol_advanced,
  134. };
  135. this.$set(this, `form`, data);
  136. this.dialog = { show: false, title: '查询专利', type: '1' };
  137. },
  138. // 查询其他信息
  139. async searchOther() {
  140. // 查询管理员信息
  141. let res = await this.adminQuery({ code: this.user.code });
  142. if (this.$checkRes(res)) {
  143. let arr = await this.adminFetch(res.data[0].pid);
  144. if (this.$checkRes(arr)) this.$set(this, `adminInfo`, arr.data);
  145. }
  146. },
  147. // 查询专利信息
  148. async searchPatent() {
  149. let res = await this.patentFetch(this.patent_id);
  150. if (this.$checkRes(res)) {
  151. this.searchOther();
  152. this.conPatent(res.data);
  153. }
  154. },
  155. },
  156. computed: {
  157. ...mapState(['user']),
  158. },
  159. metaInfo() {
  160. return { title: this.$route.meta.title };
  161. },
  162. watch: {
  163. patent_id: {
  164. deep: true,
  165. immediate: true,
  166. handler(val) {
  167. if (val) this.searchPatent();
  168. },
  169. },
  170. },
  171. };
  172. </script>
  173. <style lang="less" scoped>
  174. .main {
  175. .one {
  176. text-align: center;
  177. padding: 5px 0;
  178. }
  179. .two {
  180. .btn {
  181. text-align: center;
  182. margin: 10px 0;
  183. }
  184. }
  185. }
  186. .dialog {
  187. /deep/.van-dialog__content {
  188. max-height: 350px;
  189. overflow-y: auto;
  190. }
  191. }
  192. </style>