join.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <template>
  2. <drawer-tabs-container>
  3. <div class="project-complete">
  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></Page>
  8. </div>
  9. </drawer-tabs-container>
  10. </template>
  11. <style lang="scss" scoped>
  12. .project-complete {
  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. created() {
  45. this.noDataText = this.$L("数据加载中.....");
  46. this.columns = [{
  47. "title": this.$L("项目名称"),
  48. "key": 'title',
  49. "minWidth": 100,
  50. render: (h, params) => {
  51. return h('a', {
  52. attrs: {
  53. href: 'javascript:void(0)',
  54. },
  55. on: {
  56. click: () => {
  57. this.openProject(params.row.id);
  58. }
  59. }
  60. }, params.row.title);
  61. },
  62. }, {
  63. "title": this.$L("加入时间"),
  64. "minWidth": 160,
  65. render: (h, params) => {
  66. return h('span', $A.formatDate("Y-m-d H:i:s", params.row.uindate));
  67. }
  68. }, {
  69. "title": this.$L("操作"),
  70. "key": 'action',
  71. "width": 80,
  72. "align": 'center',
  73. render: (h, params) => {
  74. return h('Button', {
  75. props: {
  76. type: 'primary',
  77. size: 'small'
  78. },
  79. style: {
  80. fontSize: '12px'
  81. },
  82. on: {
  83. click: () => {
  84. this.outProject(params.row.id, () => {
  85. this.getLists();
  86. });
  87. }
  88. }
  89. }, this.$L('退出'));
  90. }
  91. }];
  92. },
  93. mounted() {
  94. if (this.canload) {
  95. this.loadYet = true;
  96. this.getLists(true);
  97. }
  98. },
  99. watch: {
  100. canload(val) {
  101. if (val && !this.loadYet) {
  102. this.loadYet = true;
  103. this.getLists(true);
  104. }
  105. }
  106. },
  107. methods: {
  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.aAjax({
  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>