complete.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <div class="project-complete">
  3. <!-- 列表 -->
  4. <Table class="tableFill" ref="tableRef" :columns="columns" :data="lists" :loading="loadIng > 0" :no-data-text="noDataText" stripe></Table>
  5. <!-- 分页 -->
  6. <Page class="pageBox" :total="listTotal" :current="listPage" @on-change="setPage" @on-page-size-change="setPageSize" :page-size-opts="[10,20,30,50,100]" placement="top" show-elevator show-sizer show-total></Page>
  7. </div>
  8. </template>
  9. <style lang="scss" scoped>
  10. .project-complete {
  11. .tableFill {
  12. margin: 20px;
  13. }
  14. }
  15. </style>
  16. <script>
  17. export default {
  18. name: 'ProjectComplete',
  19. props: {
  20. projectid: {
  21. default: 0
  22. },
  23. },
  24. data () {
  25. return {
  26. loadIng: 0,
  27. columns: [],
  28. lists: [],
  29. listPage: 1,
  30. listTotal: 0,
  31. noDataText: "数据加载中.....",
  32. }
  33. },
  34. created() {
  35. this.columns = [{
  36. "title": "任务名称",
  37. "key": 'title',
  38. "minWidth": 100,
  39. }, {
  40. "title": "创建人",
  41. "key": 'createuser',
  42. "minWidth": 80,
  43. }, {
  44. "title": "账号",
  45. "key": 'username',
  46. "minWidth": 80,
  47. }, {
  48. "title": "归档时间",
  49. "minWidth": 160,
  50. render: (h, params) => {
  51. return h('span', $A.formatDate("Y-m-d H:i:s", params.row.archiveddate));
  52. }
  53. }, {
  54. "title": "操作",
  55. "key": 'action',
  56. "width": 80,
  57. "align": 'center',
  58. render: (h, params) => {
  59. return h('Button', {
  60. props: {
  61. type: 'primary',
  62. size: 'small'
  63. },
  64. on: {
  65. click: () => {
  66. }
  67. }
  68. }, '取消归档');
  69. }
  70. }];
  71. },
  72. mounted() {
  73. this.listPage = 1;
  74. this.getLists();
  75. },
  76. watch: {
  77. projectid() {
  78. this.listPage = 1;
  79. this.getLists();
  80. }
  81. },
  82. methods: {
  83. setPage(page) {
  84. this.listPage = page;
  85. this.getLists();
  86. },
  87. setPageSize(size) {
  88. if (Math.max($A.runNum(this.listPageSize), 10) != size) {
  89. this.listPageSize = size;
  90. this.getLists();
  91. }
  92. },
  93. getLists() {
  94. if (this.projectid == 0) {
  95. this.lists = [];
  96. this.listTotal = 0;
  97. this.noDataText = "没有相关的数据";
  98. return;
  99. }
  100. this.loadIng++;
  101. $A.aAjax({
  102. url: 'project/task/lists',
  103. data: {
  104. page: Math.max(this.listPage, 1),
  105. pagesize: Math.max($A.runNum(this.listPageSize), 10),
  106. projectid: this.projectid,
  107. archived: 1,
  108. },
  109. complete: () => {
  110. this.loadIng--;
  111. },
  112. success: (res) => {
  113. if (res.ret === 1) {
  114. this.lists = res.data.lists;
  115. this.listTotal = res.data.total;
  116. } else {
  117. this.lists = [];
  118. this.listTotal = 0;
  119. this.noDataText = res.msg;
  120. }
  121. }
  122. });
  123. },
  124. }
  125. }
  126. </script>