review.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <template>
  2. <section>
  3. <el-col :span="24" class="toolbar" style="">
  4. <div style="display:flex;justify-content: left;align-items: center;">
  5. <el-input id="contractAmount" v-model="paramCompanyName" placeholder="输入公司名称" @keyup.native="restrictNumber('contractAmount')" style="width:200px" clearable size="small">
  6. <el-button slot="append" size="small" icon="el-icon-search" @click="toolbarSelect()"></el-button>
  7. </el-input>
  8. <el-date-picker
  9. v-model="dateArray"
  10. type="daterange"
  11. range-separator="至"
  12. :clearable="false"
  13. value-format="yyyy-MM-dd"
  14. format="yyyy-MM-dd"
  15. size="small"
  16. style="margin-left:20px"
  17. @change="toolbarSelect()"
  18. ></el-date-picker>
  19. </div>
  20. </el-col>
  21. <el-table :data="tableList" highlight-current-row v-loading="listLoading" :height="tableHeight" style="width: 100%;">
  22. <el-table-column prop="companyName" label="公司名称" min-width="160"></el-table-column>
  23. <el-table-column prop="moduleName" label="模块" min-width="80"></el-table-column>
  24. <el-table-column prop="operatorName" label="操作人" min-width="100"></el-table-column>
  25. <el-table-column prop="time" label="操作时间" min-width="200"></el-table-column>
  26. <el-table-column prop="content" label="操作内容" min-width="500">
  27. <template slot-scope="scope">
  28. <div v-for="item,index in contentString(scope.row.content)" :key="index">{{item}}</div>
  29. <!-- <span>{{contentString(scope.row.content)}}</span> -->
  30. <!-- <span>{{scope.row.content}}</span> -->
  31. </template>
  32. </el-table-column>
  33. </el-table>
  34. <!--工具条-->
  35. <el-col :span="24" class="toolbar">
  36. <el-pagination
  37. @size-change="handleSizeChange"
  38. @current-change="handleCurrentChange"
  39. :page-sizes="[20, 50 , 80 , 100]"
  40. :page-size="20"
  41. :current-page="page"
  42. layout="total, sizes, prev, pager, next"
  43. :total="total"
  44. style="float:right;"
  45. ></el-pagination>
  46. </el-col>
  47. </section>
  48. </template>
  49. <script>
  50. export default {
  51. data() {
  52. return {
  53. listLoading: false,
  54. tableHeight: 0,
  55. page: 1,
  56. size: 20,
  57. total: 0,
  58. tableList: [],
  59. dateArray: [],
  60. paramCompanyName: ''
  61. }
  62. },
  63. created() {
  64. let height = window.innerHeight;
  65. this.tableHeight = height - 180;
  66. const that = this;
  67. window.onresize = function temp() {
  68. that.tableHeight = window.innerHeight - 180;
  69. };
  70. let date = new Date()
  71. let datemonth = date.getMonth() + 1
  72. let dateday = date.getDate()
  73. let datestr1 = date.getFullYear()+'-'+(datemonth<10?'0'+datemonth:datemonth)+'-'+(dateday<10?'0'+dateday:dateday)
  74. let date2 = new Date(date.getFullYear(),date.getMonth(),date.getDate()-7)
  75. let date2month = date2.getMonth() + 1
  76. let date2day = date2.getDate()
  77. let datestr2 = date2.getFullYear()+'-'+(date2month<10?'0'+date2month:date2month)+'-'+(date2day<10?'0'+date2day:date2day)
  78. this.dateArray = [datestr2,datestr1]
  79. },
  80. mounted() {
  81. this.getTableList()
  82. },
  83. methods: {
  84. toolbarSelect(){
  85. this.page = 1
  86. this.getTableList()
  87. },
  88. getTableList(){
  89. this.listLoading = true
  90. this.http.post('/operation-record/getList',{
  91. startDate: this.dateArray[0],
  92. endDate: this.dateArray[1],
  93. companyName: this.paramCompanyName,
  94. pageIndex: this.page,
  95. pageSize: this.size,
  96. },res => {
  97. this.listLoading = false
  98. if(res.code == 'ok'){
  99. this.total = res.data ? res.data.total : 0
  100. this.tableList = res.data ? res.data.record : []
  101. }else {
  102. this.$message({
  103. message: res.msg,
  104. type: 'error'
  105. })
  106. }
  107. },err => {
  108. this.listLoading = false
  109. this.$message({
  110. message: err,
  111. type: 'error'
  112. })
  113. })
  114. },
  115. contentString(string){
  116. return string.split('\n')
  117. },
  118. handleSizeChange(val){
  119. this.size = val;
  120. this.page = 1
  121. this.getTableList();
  122. },
  123. handleCurrentChange(val) {
  124. this.page = val;
  125. this.getTableList();
  126. },
  127. restrictNumber(targetId){
  128. // let inpu = document.getElementById(targetId);
  129. // inpu.value = inpu.value.replace(/\D/g,'')
  130. }
  131. },
  132. };
  133. </script>
  134. <style lang="scss" scoped>
  135. .classification {
  136. width: 120px;
  137. border-right: 1px solid #f2f2f2;
  138. display: flex;
  139. flex-wrap: wrap;
  140. padding-top: 20px;
  141. .on {
  142. color: #409EFF;
  143. }
  144. p{
  145. width: 120px;
  146. text-align: center;
  147. line-height: 50px;
  148. margin: 0;
  149. cursor: pointer;
  150. }
  151. p:hover{
  152. background: #dddddd;
  153. }
  154. }
  155. </style>