model-1.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <div id="model-1">
  3. <el-row type="flex" justify="end">
  4. <el-col :span="2">
  5. <slot></slot>
  6. </el-col>
  7. </el-row>
  8. <el-row>
  9. <el-col :span="24" class="main">
  10. <el-col :span="24" class="title">
  11. 2022年度吉林省科技发展计划高新技术领域项目建议书
  12. </el-col>
  13. <el-col :span="24">
  14. <el-tabs v-model="active" type="card">
  15. <el-tab-pane label="通知正文" name="first">
  16. <questionInfo :info="data"></questionInfo>
  17. </el-tab-pane>
  18. <el-tab-pane label="信息填报" name="second">
  19. <projectForm :form="form" @onSubmit="onSubmit"></projectForm>
  20. </el-tab-pane>
  21. </el-tabs>
  22. </el-col>
  23. </el-col>
  24. </el-row>
  25. </div>
  26. </template>
  27. <script>
  28. import questionInfo from './parts/questionInfo.vue';
  29. import projectForm from './parts/projectForm.vue';
  30. import { mapState, createNamespacedHelpers } from 'vuex';
  31. const { mapActions: projectsolic } = createNamespacedHelpers('projectsolic');
  32. export default {
  33. name: 'model-1',
  34. props: {
  35. data: { type: Object, default: () => {} },
  36. },
  37. components: {
  38. questionInfo,
  39. projectForm,
  40. },
  41. data: function() {
  42. return {
  43. active: 'first',
  44. form: {},
  45. };
  46. },
  47. created() {},
  48. methods: {
  49. ...projectsolic(['create']),
  50. async onSubmit({ data }) {
  51. data.question_id = this.data._id;
  52. // data.user_id = this.user.userid;
  53. let res = await this.create(data);
  54. if (this.$checkRes(res)) {
  55. this.$message({
  56. message: '数据添加成功',
  57. type: 'success',
  58. });
  59. this.form = {};
  60. this.active = 'first';
  61. }
  62. },
  63. },
  64. computed: {
  65. ...mapState(['user', 'menuParams']),
  66. pageTitle() {
  67. return `${this.$route.meta.title}`;
  68. },
  69. },
  70. metaInfo() {
  71. return { title: this.$route.meta.title };
  72. },
  73. };
  74. </script>
  75. <style lang="less" scoped>
  76. .main {
  77. .title {
  78. font-size: 25px;
  79. margin: 40px 0;
  80. text-align: center;
  81. }
  82. }
  83. </style>