openLogModal.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <template>
  2. <vxe-modal
  3. v-model="value"
  4. id="openLogModal"
  5. title="操作日志"
  6. width="50%"
  7. height="60%"
  8. min-width="460"
  9. min-height="320"
  10. show-zoom
  11. resize
  12. transfer
  13. :show-footer="!hideBtn"
  14. v-loading="load"
  15. >
  16. <by-table :propConfig="config" ref="table">
  17. <!-- <template v-slot:num="{row}">
  18. <vxe-input v-model="row.num" v-if="row.splitNum > 0" placeholder="请输入" type="integer" @input="onChangeRow(row)"></vxe-input>
  19. </template> -->
  20. </by-table>
  21. <template #footer>
  22. <div class="page">
  23. <el-pagination
  24. v-if="page.total > 0"
  25. @size-change="handleSizeChange"
  26. @current-change="handleCurrentChange"
  27. :current-page="page.pageNo"
  28. :page-size="page.pageSize"
  29. :layout="'total, sizes, prev, pager, next, jumper'"
  30. :total="page.total"
  31. ></el-pagination>
  32. </div>
  33. <!-- <div class="btn">
  34. <el-button plain size="small" @click="value = false">取消</el-button>
  35. </div> -->
  36. </template>
  37. </vxe-modal>
  38. </template>
  39. <script lang="ts">
  40. import { Component, Prop, Vue, Watch } from "vue-property-decorator";
  41. @Component({ components: {} })
  42. export default class openLogModal extends Vue {
  43. value = false;
  44. load = false;
  45. billData: any = null;
  46. hideBtn = false;
  47. data: Array<any> = [];
  48. datas=[];
  49. page: any = {
  50. pageNo: 1, //当前页
  51. pageSize: 10, //每页条数
  52. total: 0, //总条数
  53. };
  54. config: any = {
  55. attr: {
  56. size: "small",
  57. align: "center",
  58. seq: true,
  59. },
  60. columns: [
  61. {
  62. title: "操作内容",
  63. field: "content",
  64. },
  65. {
  66. title: "操作人",
  67. field: "userName",
  68. },
  69. {
  70. title: "创建时间",
  71. field: "createTime",
  72. },
  73. ],
  74. };
  75. setShow(v: boolean) {
  76. this.hideBtn = false;
  77. // console.log("数据111111111========", v);
  78. this.value = v;
  79. }
  80. mounted(){
  81. }
  82. setValue(data: any) {
  83. this.$nextTick(() => {
  84. // const data = localStorage.getItem("logLsit");
  85. // console.log("数据111111111datas========", JSON.parse(data)||null);
  86. const datas:string|null = localStorage.getItem("logLsit");
  87. if(datas){
  88. let data=JSON.parse(datas)
  89. this.data=data;
  90. this.page.total=data.length
  91. // let height = (document.getElementById('openLogModal') as any).parentNode.offsetHeight;
  92. // this.config.attr.height=height - 36;
  93. if (this.$refs.table) {
  94. (this.$refs.table as any).setConfig(this.config);
  95. (this.$refs.table as any).setValue(this.data);
  96. }
  97. }
  98. });
  99. }
  100. handleSizeChange(v: number) {
  101. this.page.pageSize = v;
  102. }
  103. handleCurrentChange(v: number) {
  104. this.page.pageNo = v;
  105. }
  106. }
  107. </script>
  108. <style lang="scss" scoped>
  109. .page {
  110. width: 100%;
  111. display: flex;
  112. justify-content: flex-end;
  113. padding: 8px;
  114. box-sizing: border-box;
  115. }
  116. </style>