join.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <template>
  2. <drawer-tabs-container>
  3. <div class="project-my-join">
  4. <!-- 列表 -->
  5. <Table class="tableFill" ref="tableRef" :columns="columns" :data="lists" :loading="loadIng > 0" :no-data-text="noDataText" stripe></Table>
  6. <!-- 分页 -->
  7. <Page class="pageBox" :total="listTotal" :current="listPage" :disabled="loadIng > 0" @on-change="setPage" @on-page-size-change="setPageSize" :page-size-opts="[10,20,30,50,100]" placement="top" show-elevator show-sizer show-total transfer :simple="windowMax768"></Page>
  8. </div>
  9. </drawer-tabs-container>
  10. </template>
  11. <style lang="scss" scoped>
  12. .project-my-join {
  13. .tableFill {
  14. margin: 12px 12px 20px;
  15. }
  16. }
  17. </style>
  18. <script>
  19. import Project from '../../../mixins/project'
  20. import DrawerTabsContainer from "../../DrawerTabsContainer";
  21. export default {
  22. name: 'ProjectMyJoin',
  23. components: {DrawerTabsContainer},
  24. props: {
  25. canload: {
  26. type: Boolean,
  27. default: true
  28. },
  29. },
  30. mixins: [
  31. Project
  32. ],
  33. data () {
  34. return {
  35. loadYet: false,
  36. loadIng: 0,
  37. columns: [],
  38. lists: [],
  39. listPage: 1,
  40. listTotal: 0,
  41. noDataText: "",
  42. }
  43. },
  44. mounted() {
  45. if (this.canload) {
  46. this.loadYet = true;
  47. this.getLists(true);
  48. }
  49. },
  50. watch: {
  51. canload(val) {
  52. if (val && !this.loadYet) {
  53. this.loadYet = true;
  54. this.getLists(true);
  55. }
  56. }
  57. },
  58. methods: {
  59. initLanguage() {
  60. this.noDataText = this.$L("数据加载中.....");
  61. this.columns = [{
  62. "title": this.$L("项目名称"),
  63. "key": 'title',
  64. "minWidth": 100,
  65. render: (h, params) => {
  66. return h('a', {
  67. attrs: {
  68. href: 'javascript:void(0)',
  69. },
  70. on: {
  71. click: () => {
  72. this.openProject(params.row.id);
  73. }
  74. }
  75. }, params.row.title);
  76. },
  77. }, {
  78. "title": this.$L("加入时间"),
  79. "minWidth": 160,
  80. render: (h, params) => {
  81. return h('span', $A.formatDate("Y-m-d H:i:s", params.row.uindate));
  82. }
  83. }, {
  84. "title": this.$L("操作"),
  85. "key": 'action',
  86. "width": 80,
  87. "align": 'center',
  88. render: (h, params) => {
  89. return h('Button', {
  90. props: {
  91. type: 'primary',
  92. size: 'small'
  93. },
  94. style: {
  95. fontSize: '12px'
  96. },
  97. on: {
  98. click: () => {
  99. this.outProject(params.row.id, () => {
  100. this.getLists();
  101. });
  102. }
  103. }
  104. }, this.$L('退出'));
  105. }
  106. }];
  107. },
  108. setPage(page) {
  109. this.listPage = page;
  110. this.getLists();
  111. },
  112. setPageSize(size) {
  113. if (Math.max($A.runNum(this.listPageSize), 10) != size) {
  114. this.listPageSize = size;
  115. this.getLists();
  116. }
  117. },
  118. getLists(resetLoad) {
  119. if (resetLoad === true) {
  120. this.listPage = 1;
  121. }
  122. this.loadIng++;
  123. this.noDataText = this.$L("数据加载中.....");
  124. $A.apiAjax({
  125. url: 'project/lists',
  126. data: {
  127. act: 'join',
  128. page: Math.max(this.listPage, 1),
  129. pagesize: Math.max($A.runNum(this.listPageSize), 10),
  130. },
  131. complete: () => {
  132. this.loadIng--;
  133. },
  134. error: () => {
  135. this.noDataText = this.$L("数据加载失败!");
  136. },
  137. success: (res) => {
  138. if (res.ret === 1) {
  139. this.lists = res.data.lists;
  140. this.listTotal = res.data.total;
  141. this.noDataText = this.$L("没有相关的数据");
  142. } else {
  143. this.lists = [];
  144. this.listTotal = 0;
  145. this.noDataText = res.msg;
  146. }
  147. }
  148. });
  149. },
  150. }
  151. }
  152. </script>