duijiedetail.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <div id="adviserList">
  3. <duijiedetail-detail
  4. :info="info"
  5. :options="options"
  6. :form="form"
  7. @onSubmit="onSubmit"
  8. :liebiaoList="liebiaoList"
  9. @onsave="onsaveClick"
  10. :option="option"
  11. @placesubmit="placesubmit"
  12. ></duijiedetail-detail>
  13. </div>
  14. </template>
  15. <script>
  16. import duijiedetailDetail from '@/components/enterprise/duijiedetail.vue';
  17. import { createNamespacedHelpers, mapGetters, mapState } from 'vuex';
  18. const { mapActions: login } = createNamespacedHelpers('login');
  19. const { mapActions: dock } = createNamespacedHelpers('dock');
  20. const { mapActions: place } = createNamespacedHelpers('place');
  21. export default {
  22. name: 'adviserList',
  23. props: {},
  24. components: {
  25. duijiedetailDetail,
  26. },
  27. data: () => ({
  28. form: {},
  29. info: {},
  30. options: [],
  31. option: [],
  32. liebiaoList: [
  33. { name: '基本信息' },
  34. { name: '消息管理' },
  35. { name: '我的发布' },
  36. { name: '事项管理' },
  37. { name: '展会管理' },
  38. // { name: '返回首页' },
  39. { name: '修改密码' },
  40. { name: '注销账号' },
  41. ],
  42. }),
  43. created() {
  44. this.searchInfo();
  45. this.search();
  46. },
  47. computed: {
  48. ...mapState(['user']),
  49. id() {
  50. return this.$route.query.id;
  51. },
  52. keyWord() {
  53. let meta = this.$route.meta;
  54. let main = meta.title || '';
  55. return main;
  56. },
  57. },
  58. methods: {
  59. ...dock(['query', 'delete', 'update', 'create', 'fetch']),
  60. ...place({ palcequery: 'query', transactiondtetle: 'delete' }),
  61. ...login({ logout: 'logout', transactiondtetle: 'delete' }),
  62. // 查询基本信息
  63. async searchInfo() {
  64. if (this.id) {
  65. let res = await this.fetch(this.id);
  66. if (res.errcode === 0) {
  67. this.$set(this, `form`, res.data);
  68. }
  69. }
  70. },
  71. async search() {
  72. // let parent = 220000;
  73. let level = 1;
  74. let res = await this.palcequery({ level });
  75. this.$set(this, `option`, res.data);
  76. },
  77. async placesubmit({ value }) {
  78. let level = 2;
  79. let parent = value;
  80. console.log(parent);
  81. let res = await this.palcequery({ level, parent });
  82. this.$set(this, `options`, res.data);
  83. },
  84. async onSubmit({ data }) {
  85. let res;
  86. let msg;
  87. data.user_id = this.user.uid;
  88. if (data.id) {
  89. res = await this.update(data);
  90. this.$checkRes(res, '修改成功', res.errmsg || '删除失败');
  91. } else {
  92. res = await this.create(data);
  93. this.$checkRes(res, '添加成功', res.errmsg || '删除失败');
  94. }
  95. this.$router.push({ path: '/enterprise/appointment' });
  96. },
  97. async onsaveClick({ id }) {
  98. console.log(id);
  99. if (id === '基本信息') {
  100. this.$router.push({ path: '/enterprise/enterprisejb' });
  101. } else if (id === '消息管理') {
  102. this.$router.push({ path: '/enterprise/enterprisexx' });
  103. } else if (id === '我的发布') {
  104. this.$router.push({ path: '/enterprise/enterprisefabu' });
  105. } else if (id === '事项管理') {
  106. this.$router.push({ path: '/enterprise/enterprisedg' });
  107. } else if (id === '展会管理') {
  108. this.$router.push({ path: '/enterprise/appointment' });
  109. } else if (id === '修改密码') {
  110. this.$router.push({ path: '/enterprise/xiugai' });
  111. } else if (id === '返回首页') {
  112. this.$router.push({ path: '/' });
  113. } else if (id === '注销账号') {
  114. this.logout();
  115. this.$message({
  116. message: '注销成功',
  117. type: 'success',
  118. });
  119. this.toLogin();
  120. }
  121. },
  122. async toLogin() {
  123. this.$router.push({ path: '/platlive' });
  124. },
  125. },
  126. };
  127. </script>
  128. <style lang="less" scoped></style>