index.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <div class="print-log">
  3. <module-view :propConfig="config" ref="view" v-loading="load" @pagination="pagination" @onRefresh="getList" @resert="queryList" @search="queryList"/>
  4. </div>
  5. </template>
  6. <script lang="ts">
  7. import { Component, Prop, Vue, Watch } from "vue-property-decorator";
  8. import { query} from '@/api/printLog'
  9. import SuccessTag from "./components/successTag.vue";
  10. @Component({components:{}})
  11. export default class PrintLog extends Vue {
  12. load=false;
  13. isSearch=false
  14. timeNum = 0;
  15. config:any={
  16. attr:{
  17. calculateH:true
  18. },
  19. search:{
  20. attr:{
  21. size:'small',
  22. labelWidth:'130px'
  23. },
  24. columns:[
  25. [{
  26. span:8,
  27. label:'模板名称',
  28. prop:'templateName',
  29. component:'by-input',
  30. compConfig:{
  31. attr:{
  32. clearable:true
  33. }
  34. }
  35. },{
  36. span:8,
  37. label:'外部用户标识',
  38. prop:'userId',
  39. component:'user-modal'
  40. }]
  41. ]
  42. },
  43. tool:{
  44. tools:{
  45. search:true,
  46. refresh:true
  47. }
  48. },
  49. table:{
  50. attr:{
  51. size:'mini',
  52. seq:true,
  53. // checkbox:true
  54. },
  55. columns:[{
  56. title:'外部用户标识',
  57. field:'userId',
  58. width:130
  59. },{
  60. title:'模板名称',
  61. field:'templateName'
  62. },{
  63. title:'打印时间',
  64. field:'printTime',
  65. width:150
  66. },{
  67. title:'输出类型',
  68. field:'outType',
  69. width:120
  70. },{
  71. title:'输出是否成功',
  72. field:'success',
  73. width:120,
  74. component:SuccessTag
  75. }]
  76. }
  77. }
  78. mounted(){
  79. this.getList();
  80. }
  81. //分页
  82. pagination(){
  83. if(this.isSearch){
  84. this.queryList();
  85. }else{
  86. this.getList()
  87. }
  88. }
  89. //列表请求(只有分页,不包含搜素条件)
  90. getList(){
  91. if(!this.$refs.view){
  92. if(this.timeNum > 5){
  93. return
  94. }
  95. setTimeout(()=>{
  96. this.getList()
  97. },500)
  98. this.timeNum ++;
  99. return
  100. }
  101. this.isSearch = false;
  102. let data = (this.$refs.view as any).getPage();
  103. delete data.total;
  104. this.requestList(data);
  105. }
  106. //列表请求(包含分页和搜素条件)
  107. queryList(){
  108. this.isSearch = true;
  109. let data = (this.$refs.view as any).getQuery();
  110. delete data.total;
  111. this.requestList(data);
  112. }
  113. requestList(data:any){
  114. this.load = true;
  115. query(data).then((res:any) => {
  116. this.load = false;
  117. (this.$refs.view as any).setTableValue(res.data.records);
  118. let page = {
  119. pageNo: res.data.current, //当前页
  120. pageSize: res.data.size, //每页条数
  121. total: res.data.total //总条数
  122. };
  123. (this.$refs.view as any).setPage(page)
  124. }).catch(()=>{
  125. this.load = false;
  126. })
  127. }
  128. }
  129. </script>
  130. <style lang="scss" scoped>
  131. .print-log{
  132. height: 100%;
  133. width: 100%;
  134. overflow-y: hidden;
  135. }
  136. </style>