PositionLog.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <template>
  2. <div class="page">
  3. <el-form size="small" :inline="true" class="query-form" ref="searchForm" :model="searchForm" @keyup.enter.native="refreshList()" @submit.native.prevent>
  4. <!-- 搜索框-->
  5. <el-form-item prop="createBy">
  6. <el-input size="small" v-model="searchForm.createBy" placeholder="操作人" clearable></el-input>
  7. </el-form-item>
  8. <el-form-item prop="operationType">
  9. <el-input size="small" v-model="searchForm.operationType" placeholder="操作类型" clearable></el-input>
  10. </el-form-item>
  11. <el-form-item prop="operationContent">
  12. <el-input size="small" v-model="searchForm.operationContent" placeholder="操作内容" clearable></el-input>
  13. </el-form-item>
  14. <el-form-item prop="remoteAddr">
  15. <el-input size="small" v-model="searchForm.remoteAddr" placeholder="访问IP" clearable></el-input>
  16. </el-form-item>
  17. <el-form-item prop="operationResult">
  18. <el-select v-model="searchForm.operationResult" @change="change" placeholder="请选择">
  19. <el-option label="成功" value="成功"></el-option>
  20. <el-option label="失败" value="失败"></el-option>
  21. </el-select>
  22. </el-form-item>
  23. <el-form-item prop="createDates">
  24. <el-date-picker
  25. v-model="searchForm.createDates"
  26. type="datetimerange"
  27. range-separator="至"
  28. start-placeholder="开始日期"
  29. end-placeholder="结束日期">
  30. </el-date-picker>
  31. </el-form-item>
  32. <el-form-item>
  33. <el-button type="primary" @click="refreshList()" size="small" icon="el-icon-search">查询</el-button>
  34. <el-button @click="resetSearch()" size="small" icon="el-icon-refresh-right">重置</el-button>
  35. </el-form-item>
  36. </el-form>
  37. <div class="bg-white top">
  38. <!--<vxe-toolbar :refresh="{query: refreshList}" import export print custom>
  39. <template #buttons>
  40. <el-button v-if="hasPermission('sys:project:add')" type="primary" size="small" icon="el-icon-plus" @click="add()">新建</el-button>
  41. &lt;!&ndash; <el-button v-if="hasPermission('sys:post:edit')" type="warning" size="small" icon="el-icon-edit-outline" @click="edit()" :disabled="$refs.projectTable && $refs.projectTable.getCheckboxRecords().length !== 1" plain>修改</el-button>&ndash;&gt;
  42. <el-button v-if="hasPermission('sys:project:del')" type="danger" size="small" icon="el-icon-delete" @click="del()" :disabled="$refs.projectTable && $refs.projectTable.getCheckboxRecords().length === 0" plain>删除</el-button>
  43. <el-button v-if="hasPermission('sys:project:import')" type="default" @click="downloadTpl()" size="small">下载模板</el-button>
  44. </template>
  45. </vxe-toolbar>-->
  46. <div style="height: calc(100% - 80px);">
  47. <vxe-table
  48. border="inner"
  49. auto-resize
  50. resizable
  51. height="auto"
  52. :loading="loading"
  53. size="small"
  54. ref="projectTable"
  55. show-header-overflow
  56. show-overflow
  57. highlight-hover-row
  58. :menu-config="{}"
  59. :print-config="{}"
  60. @sort-change="sortChangeHandle"
  61. :sort-config="{remote:true}"
  62. :data="dataList"
  63. :checkbox-config="{}">
  64. <vxe-column type="seq" width="60" title="序号"></vxe-column>
  65. <!-- <vxe-column type="checkbox" width="40px"></vxe-column>-->
  66. <vxe-column width="160" title="操作时间" field="createDate"></vxe-column>
  67. <vxe-column width="100px" title="操作人" field="createBy" > </vxe-column>
  68. <vxe-column width="100px" title="操作模块" field="type" > </vxe-column>
  69. <vxe-column width="100px" title="操作类型" field="operationType" > </vxe-column>
  70. <vxe-column width="" title="操作内容" field="operationContent" > </vxe-column>
  71. <vxe-column width="100px" title="操作结果" field="operationResult" ></vxe-column>
  72. <vxe-column width="80px" title="访问IP" field="remoteAddr" ></vxe-column>
  73. <!-- <vxe-column width="100px" title="访问位置" field="accessLocation" ></vxe-column>-->
  74. <!--<vxe-column title="操作" width="200px" fixed="right" align="center">
  75. <template slot-scope="scope">
  76. <el-button v-if="hasPermission('sys:project:view')" type="text" icon="el-icon-view" size="small" @click="view(scope.row.id)">查看</el-button>
  77. <el-button v-if="hasPermission('sys:project:edit') && scope.row.permissionFlag" type="text" icon="el-icon-edit" size="small" @click="edit(scope.row.id)">修改</el-button>
  78. <el-button v-if="hasPermission('sys:project:del') && scope.row.permissionFlag" type="text" icon="el-icon-delete" size="small" @click="del(scope.row.id)">删除</el-button>
  79. </template>
  80. </vxe-column>-->
  81. </vxe-table>
  82. <vxe-pager
  83. background
  84. size="small"
  85. :current-page="tablePage.currentPage"
  86. :page-size="tablePage.pageSize"
  87. :total="tablePage.total"
  88. :page-sizes="[10, 20, 100, 1000, {label: '全量数据', value: 1000000}]"
  89. :layouts="['PrevPage', 'JumpNumber', 'NextPage', 'FullJump', 'Sizes', 'Total']"
  90. @page-change="currentChangeHandle">
  91. </vxe-pager>
  92. </div>
  93. </div>
  94. </div>
  95. </template>
  96. <script>
  97. import PositionLogService from '@/api/position/PositionLogService'
  98. import moment from 'moment'
  99. export default {
  100. data () {
  101. return {
  102. searchForm: {
  103. createDates: [],
  104. createBy: '',
  105. operationType: '',
  106. operationResult: '',
  107. operationContent: '',
  108. remoteAddr: ''
  109. },
  110. dataList: [],
  111. tablePage: {
  112. total: 0,
  113. currentPage: 1,
  114. pageSize: 10,
  115. orders: []
  116. },
  117. loading: false
  118. }
  119. },
  120. projectLogService: null,
  121. created () {
  122. this.projectLogService = new PositionLogService()
  123. },
  124. components: {
  125. },
  126. activated () {
  127. this.refreshList()
  128. },
  129. methods: {
  130. change () {
  131. this.$forceUpdate()
  132. },
  133. // 获取数据列表
  134. refreshList () {
  135. this.loading = true
  136. if (this.searchForm.createDates !== undefined && this.searchForm.createDates !== null && this.searchForm.createDates !== '' && this.searchForm.createDates !== [] && this.searchForm.createDates.length !== 0) {
  137. this.searchForm.createDateStart = moment(this.searchForm.createDates[0]).format('YYYY-MM-DD HH:mm:ss')
  138. this.searchForm.createDateEnd = moment(this.searchForm.createDates[1]).format('YYYY-MM-DD HH:mm:ss')
  139. }
  140. this.projectLogService.list({
  141. 'current': this.tablePage.currentPage,
  142. 'size': this.tablePage.pageSize,
  143. 'orders': this.tablePage.orders,
  144. 'type': this.$route.query.type,
  145. ...this.searchForm
  146. }).then(({data}) => {
  147. this.dataList = data.records
  148. this.tablePage.total = data.total
  149. this.loading = false
  150. })
  151. },
  152. // 当前页
  153. currentChangeHandle ({ currentPage, pageSize }) {
  154. this.tablePage.currentPage = currentPage
  155. this.tablePage.pageSize = pageSize
  156. this.refreshList()
  157. },
  158. // 排序
  159. sortChangeHandle (column) {
  160. this.tablePage.orders = []
  161. if (column.order != null) {
  162. this.tablePage.orders.push({column: this.$utils.toLine(column.property), asc: column.order === 'asc'})
  163. }
  164. this.refreshList()
  165. },
  166. // 删除
  167. // del (id) {
  168. // let ids = id || this.$refs.projectTable.getCheckboxRecords().map(item => {
  169. // return item.id
  170. // }).join(',')
  171. // this.$confirm(`确定删除所选项吗?`, '提示', {
  172. // confirmButtonText: '确定',
  173. // cancelButtonText: '取消',
  174. // type: 'warning'
  175. // }).then(() => {
  176. // this.loading = true
  177. // this.projectService.delete(ids).then(({data}) => {
  178. // this.$message.success(data)
  179. // this.refreshList()
  180. // this.loading = false
  181. // })
  182. // })
  183. // },
  184. resetSearch () {
  185. this.searchForm.createDateStart = null
  186. this.searchForm.createDateEnd = null
  187. this.$refs.searchForm.resetFields()
  188. this.refreshList()
  189. }
  190. }
  191. }
  192. </script>