detail.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <div id="detail">
  3. <el-row>
  4. <el-col :span="24" class="main">
  5. <el-col :span="24" class="back">
  6. <el-button type="primary" size="mini" @click="back">返回</el-button>
  7. </el-col>
  8. <el-col :span="24" class="info">
  9. <span v-if="type == '4'">
  10. <perDetail :form="form" @toSave="perSave"></perDetail>
  11. </span>
  12. <span v-else-if="type == '5'">
  13. <orgDetail :form="form" @toSave="orgSave"></orgDetail>
  14. </span>
  15. <span v-else-if="type == '6'">
  16. <expDetail :form="form" @toSave="expSave"></expDetail>
  17. </span>
  18. </el-col>
  19. </el-col>
  20. </el-row>
  21. </div>
  22. </template>
  23. <script>
  24. import perDetail from './parts/perDetail.vue';
  25. import orgDetail from './parts/orgDetail.vue';
  26. import expDetail from './parts/expDetail.vue';
  27. import { mapState, createNamespacedHelpers } from 'vuex';
  28. const { mapActions: personal } = createNamespacedHelpers('personal');
  29. const { mapActions: organization } = createNamespacedHelpers('organization');
  30. const { mapActions: expert } = createNamespacedHelpers('expert');
  31. export default {
  32. metaInfo() {
  33. return { title: this.$route.meta.title };
  34. },
  35. name: 'detail',
  36. props: {},
  37. components: {
  38. perDetail,
  39. orgDetail,
  40. expDetail,
  41. },
  42. data: function() {
  43. return {
  44. form: {},
  45. };
  46. },
  47. async created() {
  48. await this.search();
  49. },
  50. methods: {
  51. ...personal({ personalFetch: 'fetch', personalUpdate: 'update' }),
  52. ...organization({ organizationFetch: 'fetch', organizationUpdate: 'update' }),
  53. ...expert({ expertFetch: 'fetch', expertUpdate: 'update' }),
  54. async search() {
  55. let type = this.type;
  56. if (type == '4') {
  57. let res = await this.personalFetch(this.id);
  58. if (this.$checkRes(res)) {
  59. this.$set(this, `form`, res.data);
  60. }
  61. } else if (type == '5') {
  62. let res = await this.organizationFetch(this.id);
  63. if (this.$checkRes(res)) {
  64. this.$set(this, `form`, res.data);
  65. }
  66. } else if (type == '6') {
  67. let res = await this.expertFetch(this.id);
  68. if (this.$checkRes(res)) {
  69. this.$set(this, `form`, res.data);
  70. }
  71. }
  72. },
  73. // 提交审核-个人用户
  74. async perSave(data) {
  75. let res = await this.personalUpdate(data);
  76. if (this.$checkRes(res)) {
  77. this.$message({
  78. message: '信息审核成功',
  79. type: 'success',
  80. });
  81. this.back();
  82. }
  83. },
  84. // 提交审核-机构用户
  85. async orgSave(data) {
  86. let res = await this.organizationUpdate(data);
  87. if (this.$checkRes(res)) {
  88. this.$message({
  89. message: '信息审核成功',
  90. type: 'success',
  91. });
  92. this.back();
  93. }
  94. },
  95. // 提交审核-专家用户
  96. async expSave(data) {
  97. let res = await this.expertUpdate(data);
  98. if (this.$checkRes(res)) {
  99. this.$message({
  100. message: '信息审核成功',
  101. type: 'success',
  102. });
  103. this.back();
  104. }
  105. },
  106. // 返回列表
  107. back() {
  108. this.$router.push({ path: '/user' });
  109. },
  110. },
  111. computed: {
  112. ...mapState(['user']),
  113. id() {
  114. return this.$route.query.id;
  115. },
  116. type() {
  117. return this.$route.query.type;
  118. },
  119. },
  120. watch: {},
  121. };
  122. </script>
  123. <style lang="less" scoped>
  124. .main {
  125. .back {
  126. text-align: right;
  127. margin: 0 0 15px 0s;
  128. }
  129. }
  130. </style>