update.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <div id="update">
  3. <el-row>
  4. <el-col :span="24" class="main">
  5. <el-col :span="24" class="top">
  6. <el-button type="primary" size="mini" @click="back">返回</el-button>
  7. </el-col>
  8. <el-col :span="24" class="down">
  9. <el-col :span="24" class="setp">
  10. <el-steps :active="active" align-center>
  11. <el-step title="(一)基本信息"> </el-step>
  12. <el-step title="(二)内容简介"> </el-step>
  13. <el-step title="(三)主研人员名单"></el-step>
  14. <el-step title="(四)评价委托方提供资料清单"></el-step>
  15. </el-steps>
  16. </el-col>
  17. <el-col :span="24" class="twoInfo">
  18. <basic :basicForm="form.basic" @resetBtn="back" @basicBtn="basicBtn" v-if="active == '1'"></basic>
  19. <brief :briefForm="form.brief" @briefUp="briefUp" @briefBtn="briefBtn" v-else-if="active == '2'"></brief>
  20. <research :researchForm="form.research" @researchUp="researchUp" @researchBtn="researchBtn" v-else-if="active == '3'"></research>
  21. <datalists :datalistForm="form.datalist" @detailedUp="detailedUp" @onSubmit="onSubmit" v-else-if="active == '4'"></datalists>
  22. </el-col>
  23. </el-col>
  24. </el-col>
  25. </el-row>
  26. </div>
  27. </template>
  28. <script>
  29. import basic from './parts/basic.vue';
  30. import brief from './parts/brief.vue';
  31. import research from './parts/research.vue';
  32. import datalists from './parts/datalists.vue';
  33. import { mapState, createNamespacedHelpers } from 'vuex';
  34. const { mapActions: achieveApply } = createNamespacedHelpers('achieveApply');
  35. export default {
  36. name: 'update',
  37. props: {},
  38. components: {
  39. basic,
  40. brief,
  41. research,
  42. datalists,
  43. },
  44. data: function() {
  45. return {
  46. // 步骤
  47. active: 1,
  48. form: {
  49. basic: {},
  50. brief: {},
  51. research: [],
  52. datalist: {},
  53. },
  54. };
  55. },
  56. async created() {
  57. await this.search();
  58. },
  59. methods: {
  60. ...achieveApply(['fetch', 'update']),
  61. async search() {
  62. if (this.id) {
  63. let res = await this.fetch(this.id);
  64. if (this.$checkRes(res)) {
  65. this.$set(this, `form`, res.data);
  66. }
  67. }
  68. },
  69. //基本信息下一步
  70. basicBtn() {
  71. this.active = 2;
  72. },
  73. // 内容简介上一步
  74. briefUp() {
  75. this.active = 1;
  76. },
  77. // 内容简介下一步
  78. briefBtn() {
  79. this.active = 3;
  80. },
  81. // 研发人员名单上一步
  82. researchUp() {
  83. this.active = 2;
  84. },
  85. // 研发人员名单下一步
  86. researchBtn({ data }) {
  87. this.$set(this.form, `research`, data);
  88. this.active = 4;
  89. },
  90. // 补充材料上一步
  91. detailedUp() {
  92. this.active = 3;
  93. },
  94. async onSubmit() {
  95. let data = this.form;
  96. data.status = '0';
  97. console.log(data);
  98. let res = await this.update(data);
  99. if (this.$checkRes(res)) {
  100. this.$message({
  101. message: '修改信息完成,等待审核',
  102. type: 'success',
  103. });
  104. this.back();
  105. }
  106. },
  107. // 返回
  108. back() {
  109. this.$router.push({ path: '/userExamine' });
  110. },
  111. },
  112. computed: {
  113. ...mapState(['user']),
  114. id() {
  115. return this.$route.query.id;
  116. },
  117. },
  118. metaInfo() {
  119. return { title: this.$route.meta.title };
  120. },
  121. watch: {
  122. test: {
  123. deep: true,
  124. immediate: true,
  125. handler(val) {},
  126. },
  127. },
  128. };
  129. </script>
  130. <style lang="less" scoped>
  131. .main {
  132. .top {
  133. text-align: right;
  134. margin: 0 0 10px 0;
  135. }
  136. }
  137. </style>