index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <div class="AbstractProgram">
  3. <br />
  4. <el-breadcrumb separator-class="el-icon-arrow-right">
  5. <el-breadcrumb-item>新媒体</el-breadcrumb-item>
  6. <el-breadcrumb-item>稿前校对统计</el-breadcrumb-item>
  7. </el-breadcrumb>
  8. <br />
  9. <el-card class="box-card">
  10. <el-form
  11. :model="form"
  12. size="small"
  13. :inline="true"
  14. label-width="120px"
  15. class="demo-form-inline"
  16. >
  17. <el-form-item label="日期">
  18. <el-date-picker
  19. v-model="form.time"
  20. type="datetimerange"
  21. value-format="YYYY-MM-DD HH:mm:ss"
  22. start-placeholder="开始时间"
  23. end-placeholder="结束时间"
  24. :disabled-date="disabledDate"
  25. placeholder="日期"
  26. >
  27. </el-date-picker>
  28. </el-form-item>
  29. <el-form-item label="关键词">
  30. <el-input v-model="form.keyword" placeholder="检索关键词" clearable />
  31. </el-form-item>
  32. <el-form-item style="float: right">
  33. <el-button type="primary" @click="onSubmit" :loading="load">
  34. 查询
  35. </el-button>
  36. <!-- <el-button type="primary" @click="onExport" :loading="load">
  37. 导出
  38. </el-button> -->
  39. </el-form-item>
  40. </el-form>
  41. </el-card>
  42. <br />
  43. <el-card>
  44. <el-table :data="tableData" style="width: 100%" :header-cell-style="{ backgroundColor: '#f4f5f7', color: '#606266' }">
  45. <el-table-column
  46. show-overflow-tooltip
  47. align="center"
  48. prop="displayName"
  49. label="用户名称"
  50. />
  51. <el-table-column
  52. show-overflow-tooltip
  53. align="center"
  54. prop="createTime"
  55. label="校对时间"
  56. />
  57. <el-table-column
  58. show-overflow-tooltip
  59. align="center"
  60. prop="textLength"
  61. label="校对字数"
  62. />
  63. </el-table>
  64. <br />
  65. <el-pagination
  66. @current-change="change"
  67. background
  68. :default-current-page="page"
  69. layout="prev, pager, next"
  70. :total="total"
  71. />
  72. </el-card>
  73. </div>
  74. </template>
  75. <script>
  76. // @ is an alias to /src
  77. import { getYoumeiList } from '@/api/newMdeiaApi';
  78. import dayjs from 'dayjs';
  79. // import config from "@/config/index";
  80. let T = undefined;
  81. export default {
  82. name: 'Proofread',
  83. data() {
  84. return {
  85. page: 1,
  86. size: 10,
  87. total: 0,
  88. load: false,
  89. tableData: [],
  90. form: {
  91. keyword: '',
  92. time: [],
  93. },
  94. };
  95. },
  96. mounted() {
  97. const h = Date.now();
  98. const h1 = h - (h % 3600000);
  99. const h2 = h - (h % 3600000) - 3600000;
  100. const time1 = dayjs(h2).format('YYYY-MM-DD HH:mm:ss');
  101. const time2 = dayjs(h1).format('YYYY-MM-DD HH:mm:ss');
  102. this.form = {
  103. keyword: '',
  104. time: [time1, time2],
  105. };
  106. this.getDate();
  107. },
  108. computed: {},
  109. methods: {
  110. getDate() {
  111. if (T) window.clearTimeout(T);
  112. T = setTimeout(() => {
  113. this.load = true;
  114. if (T) window.clearTimeout(T);
  115. }, 200);
  116. getYoumeiList({
  117. page: this.page,
  118. size: this.size,
  119. keyword: this.form.keyword,
  120. startTime: this.form.time[0],
  121. endTime: this.form.time[1],
  122. })
  123. .then(r => {
  124. if (T) window.clearTimeout(T);
  125. this.load = false;
  126. this.total = r.total || 0;
  127. this.tableData = r.records || [];
  128. })
  129. .catch(() => {
  130. if (T) window.clearTimeout(T);
  131. this.tableData = [];
  132. this.load = false;
  133. });
  134. },
  135. disabledDate(time) {
  136. return time.getTime() > Date.now();
  137. },
  138. change(page) {
  139. this.page = page;
  140. console.log(page);
  141. this.getDate();
  142. },
  143. onSubmit() {
  144. this.page = 1;
  145. this.getDate();
  146. },
  147. onExport() {},
  148. },
  149. components: {},
  150. };
  151. </script>
  152. <style>
  153. .el-pagination .btn-next .el-icon,
  154. .el-pagination .btn-prev .el-icon{
  155. margin: 0 auto;
  156. }
  157. </style>