index.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <template>
  2. <div id="index">
  3. <el-row>
  4. <el-col :span="24">
  5. <data-table :fields="fields" :opera="opera" :data="list" :total="total" @query="search"></data-table>
  6. </el-col>
  7. </el-row>
  8. </div>
  9. </template>
  10. <script>
  11. import dataTable from '@common/src/components/frame/filter-page-table.vue';
  12. import { mapState, createNamespacedHelpers } from 'vuex';
  13. const { mapActions: inviteCode } = createNamespacedHelpers('inviteCode');
  14. import _ from 'lodash';
  15. export default {
  16. metaInfo() {
  17. return { title: this.$route.meta.title };
  18. },
  19. name: 'index',
  20. props: {},
  21. components: {
  22. dataTable,
  23. },
  24. data: function() {
  25. return {
  26. opera: [],
  27. fields: [
  28. { label: '机构代码或邀请码', prop: 'code', filter: 'input' },
  29. { label: '所属人', prop: 'user_name', filter: 'input' },
  30. ],
  31. list: [],
  32. total: 0,
  33. };
  34. },
  35. async created() {
  36. await this.search();
  37. },
  38. methods: {
  39. ...inviteCode(['query']),
  40. async search({ skip = 0, limit = 10, ...info } = {}) {
  41. let res = await this.query({ skip, limit, ...info });
  42. if (this.$checkRes(res)) {
  43. this.$set(this, `list`, res.data);
  44. this.$set(this, `total`, res.total);
  45. }
  46. },
  47. },
  48. computed: {
  49. ...mapState(['user']),
  50. },
  51. watch: {},
  52. };
  53. </script>
  54. <style lang="less" scoped></style>