appointment.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <div id="adviserList">
  3. <appointment-detail
  4. :liebiaoList="liebiaoList"
  5. @query="search"
  6. :total="total"
  7. :resultTable="resultTable"
  8. @onsave="onsaveClick"
  9. @success="success"
  10. @shibai="shibai"
  11. :limit="limit"
  12. @handleCurrentChange="handleCurrentChange"
  13. :pageSize="pageSize"
  14. :display="display"
  15. @searchinfo="look"
  16. ></appointment-detail>
  17. </div>
  18. </template>
  19. <script>
  20. import appointmentDetail from '@/components/enterprise/appointment.vue';
  21. import { createNamespacedHelpers, mapGetters, mapState } from 'vuex';
  22. const { mapActions: dock } = createNamespacedHelpers('dock');
  23. const { mapActions: apply } = createNamespacedHelpers('apply');
  24. const { mapActions: login } = createNamespacedHelpers('login');
  25. const { mapActions: place } = createNamespacedHelpers('place');
  26. export default {
  27. name: 'adviserList',
  28. props: {},
  29. components: {
  30. appointmentDetail,
  31. },
  32. data: () => ({
  33. total: 0,
  34. limit: 4,
  35. pageSize: 4,
  36. info: {},
  37. datas: {},
  38. display: 'list',
  39. liebiaoList: [
  40. { name: '基本信息' },
  41. { name: '消息管理' },
  42. { name: '我的发布' },
  43. { name: '事项管理' },
  44. { name: '展会管理' },
  45. // // { name: '返回首页' },
  46. { name: '修改密码' },
  47. { name: '注销账号' },
  48. ],
  49. resultTable: [],
  50. form: {},
  51. }),
  52. created() {
  53. this.search();
  54. },
  55. computed: {
  56. ...mapState(['user']),
  57. },
  58. methods: {
  59. ...dock(['query', 'delete', 'update']),
  60. ...apply({ applyupdate: 'update' }),
  61. ...login({ logout: 'logout', transactiondtetle: 'delete' }),
  62. ...place({ palcequery: 'query', palcefetch: 'fetch' }),
  63. //查询
  64. async search({ skip = 0, limit = 0 } = { skip: 0, limit: 0 }) {
  65. let res = await this.query({ skip, limit });
  66. for (const val of res.data) {
  67. let parent = val.province;
  68. let places = val.place;
  69. let reslte = await this.palcequery({ level: 1, parent });
  70. let resltes = await this.palcequery({ level: 2, parent });
  71. var arr = reslte.data.filter(item => item.code === parent);
  72. var cre = resltes.data.filter(item => item.code === places);
  73. for (const shi of cre) {
  74. val.shi = shi.name;
  75. }
  76. for (const sheng of arr) {
  77. val.sheng = sheng.name;
  78. }
  79. }
  80. this.$set(this, `resultTable`, res.data);
  81. this.$set(this, `total`, res.total);
  82. },
  83. //查询
  84. async searchinfo({ skip = 0, limit = 0, currentPage } = { skip: 0, limit: 0 }) {
  85. this.display = 'dadad';
  86. this.$set(this, `total`, this.datas.apply.length);
  87. const newProducts = [];
  88. for (let index = skip; index < skip + limit; index++) {
  89. if (this.datas.apply[index]) {
  90. newProducts.push(this.datas.apply[index]);
  91. }
  92. }
  93. this.$set(this, `resultTable`, newProducts);
  94. },
  95. look(row) {
  96. this.display = 'dadad';
  97. this.$set(this, `datas`, row);
  98. this.searchinfo();
  99. },
  100. async onsaveClick({ id }) {
  101. if (id === '基本信息') {
  102. this.$router.push({ path: '/enterprise/enterprisejb' });
  103. } else if (id === '消息管理') {
  104. this.$router.push({ path: '/enterprise/enterprisexx' });
  105. } else if (id === '我的发布') {
  106. this.$router.push({ path: '/enterprise/enterprisefabu' });
  107. } else if (id === '事项管理') {
  108. this.$router.push({ path: '/enterprise/enterprisedg' });
  109. } else if (id === '展会管理') {
  110. this.$router.push({ path: '/enterprise/appointment' });
  111. } else if (id === '修改密码') {
  112. this.$router.push({ path: '/enterprise/xiugai' });
  113. } else if (id === '返回首页') {
  114. this.$router.push({ path: '/home' });
  115. } else if (id === '注销账号') {
  116. this.logout();
  117. this.$message({
  118. message: '注销成功',
  119. type: 'success',
  120. });
  121. this.toLogin();
  122. }
  123. },
  124. async toLogin() {
  125. this.$router.push({ path: '/platlive' });
  126. },
  127. handleCurrentChange({ currentPage }) {
  128. this.searchinfo({ skip: (currentPage - 1) * this.pageSize, limit: this.pageSize, currentPage });
  129. },
  130. async success(row) {
  131. row.status = '1';
  132. row.dock_id = this.datas.id;
  133. row.id = row._id;
  134. let res = await this.applyupdate(row);
  135. this.$checkRes(res, '通过审核', '添加失败');
  136. },
  137. async shibai(row) {
  138. row.status = '2';
  139. row.dock_id = this.datas.id;
  140. row.id = row._id;
  141. let res = await this.applyupdate(row);
  142. this.$checkRes(res, '审核拒绝', '添加失败');
  143. },
  144. },
  145. };
  146. </script>
  147. <style lang="less" scoped></style>