appointment.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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 = 4 } = { skip: 0, limit: 4 }) {
  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. console.log(places);
  70. let level = 1;
  71. log
  72. let reslte = await this.palcefetch({ level, parent });
  73. let resltes = await this.palcefetch({ level: 2, parent });
  74. // console.log(reslte.data);
  75. var arr = reslte.data.filter(item => item.code === parent);
  76. var cre = resltes.data.filter(item => item.code === places);
  77. console.log(cre);
  78. for (const shi of cre) {
  79. val.shi = shi.name;
  80. }
  81. for (const sheng of arr) {
  82. val.sheng = sheng.name;
  83. }
  84. }
  85. this.$set(this, `resultTable`, res.data);
  86. this.$set(this, `total`, res.total);
  87. },
  88. //查询
  89. async searchinfo({ skip = 0, limit = 4, currentPage } = { skip: 0, limit: 4 }) {
  90. this.display = 'dadad';
  91. this.$set(this, `total`, this.datas.apply.length);
  92. const newProducts = [];
  93. for (let index = skip; index < skip + limit; index++) {
  94. if (this.datas.apply[index]) {
  95. newProducts.push(this.datas.apply[index]);
  96. }
  97. }
  98. this.$set(this, `resultTable`, newProducts);
  99. },
  100. look(row) {
  101. this.display = 'dadad';
  102. this.$set(this, `datas`, row);
  103. this.searchinfo();
  104. },
  105. async onsaveClick({ id }) {
  106. console.log(id);
  107. if (id === '基本信息') {
  108. this.$router.push({ path: '/enterprise/enterprisejb' });
  109. } else if (id === '消息管理') {
  110. this.$router.push({ path: '/enterprise/enterprisexx' });
  111. } else if (id === '我的发布') {
  112. this.$router.push({ path: '/enterprise/enterprisefabu' });
  113. } else if (id === '事项管理') {
  114. this.$router.push({ path: '/enterprise/enterprisedg' });
  115. } else if (id === '展会管理') {
  116. this.$router.push({ path: '/enterprise/appointment' });
  117. } else if (id === '修改密码') {
  118. this.$router.push({ path: '/enterprise/xiugai' });
  119. } else if (id === '返回首页') {
  120. this.$router.push({ path: '/home' });
  121. } else if (id === '注销账号') {
  122. this.logout();
  123. this.$message({
  124. message: '注销成功',
  125. type: 'success',
  126. });
  127. this.toLogin();
  128. }
  129. },
  130. async toLogin() {
  131. this.$router.push({ path: '/platlive' });
  132. },
  133. handleCurrentChange({ currentPage }) {
  134. this.searchinfo({ skip: (currentPage - 1) * this.pageSize, limit: this.pageSize, currentPage });
  135. console.log(currentPage);
  136. },
  137. async success(row) {
  138. row.status = '1';
  139. console.log(this.datas);
  140. row.dock_id = this.datas.id;
  141. row.id = row._id;
  142. console.log(row);
  143. let res = await this.applyupdate(row);
  144. this.$checkRes(res, '通过审核', '添加失败');
  145. },
  146. async shibai(row) {
  147. row.status = '2';
  148. console.log(this.datas);
  149. row.dock_id = this.datas.id;
  150. row.id = row._id;
  151. console.log(row);
  152. let res = await this.applyupdate(row);
  153. this.$checkRes(res, '审核拒绝', '添加失败');
  154. },
  155. },
  156. };
  157. </script>
  158. <style lang="less" scoped></style>