index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493
  1. <template>
  2. <div class="app-container">
  3. <el-row>
  4. <el-col :span="24">
  5. <div class="cell">
  6. <div class="cell-title">
  7. <div class="title-left">
  8. <div class="title">操作日志</div>
  9. <!-- <div class="title-detail">总余额:{{total_balance}}元</div>
  10. <div class="title-detail">总充值:{{total_recharge}}元</div>
  11. <div class="title-detail">总交易笔数:{{total_number}}笔</div> -->
  12. </div>
  13. <!-- <div class="title-right">
  14. <el-button type="primary" @click="handler_download_excel">导出表单</el-button>
  15. </div> -->
  16. </div>
  17. <div class="cell-body">
  18. <el-form :inline="true" :model="formInline" class="demo-form-inline">
  19. <el-form-item label="关键字:">
  20. <el-input v-model="formInline.user" clearable placeholder="请输入操作账号"></el-input>
  21. </el-form-item>
  22. <el-form-item>
  23. <el-button type="warning" @click="btn_search">查询</el-button>
  24. </el-form-item>
  25. <el-form-item label="时间筛选:">
  26. <el-date-picker v-model="search_datatime" type="datetimerange" align="right" start-placeholder="开始日期" end-placeholder="结束日期"
  27. @change="search_datetime_change" :default-time="['23:59:59', '23:59:59']" :picker-options="pickerOptions"
  28. value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd HH:mm:ss" clearable>
  29. </el-date-picker>
  30. </el-form-item>
  31. <el-form-item label="操作:">
  32. <el-select v-model="formInline.re_state" clearable placeholder="请选择" @change="search_state_change">
  33. <el-option label="全部" value=""></el-option>
  34. <el-option label="补充" value="补充"></el-option>
  35. <el-option label="赠送" value="赠送"></el-option>
  36. </el-select>
  37. </el-form-item>
  38. </el-form>
  39. <el-table :data="tableData" height="510" style="width: 100%" :cell-style="cell_style" v-loading="loading"
  40. :header-cell-style="header_cell_style">
  41. <el-table-column label="序号" align="center" width="80">
  42. <template slot-scope="scope">
  43. <span>{{(pagination.currentPage - 1) * pagination.pageSize + scope.$index + 1}}</span>
  44. </template>
  45. </el-table-column>
  46. <el-table-column label="操作账号" align="center" width="100">
  47. <template slot-scope="scope">
  48. <span>{{ scope.row.oper_user }}</span>
  49. </template>
  50. </el-table-column>
  51. <el-table-column label="操作模块" align="center">
  52. <template slot-scope="scope">
  53. <span>{{ scope.row.oper_interface }}</span>
  54. </template>
  55. </el-table-column>
  56. <el-table-column label="操作页面" align="center">
  57. <template slot-scope="scope">
  58. <span>{{ scope.row.oper_url }}</span>
  59. </template>
  60. </el-table-column>
  61. <el-table-column label="操作时间" align="center" width="150">
  62. <template slot-scope="scope">
  63. <span>{{ scope.row.oper_time }}</span>
  64. </template>
  65. </el-table-column>
  66. <el-table-column label="操作人IP" align="center" width="100">
  67. <template slot-scope="scope">
  68. <span>{{ scope.row.oper_ip }}</span>
  69. </template>
  70. </el-table-column>
  71. <el-table-column label="内容" align="center">
  72. <template slot-scope="scope">
  73. <span>{{ scope.row.oper_remark }}</span>
  74. </template>
  75. </el-table-column>
  76. <el-table-column label="操作" align="center" width="180">
  77. <template slot-scope="scope">
  78. <span v-if="scope.row.oper_way.includes('失败')" class="txt-cell-red">{{ scope.row.oper_way }}</span>
  79. <span v-else-if="scope.row.oper_way.includes('用户行为')">{{ scope.row.oper_way }}</span>
  80. <span v-else class="txt-cell-green">{{ scope.row.oper_way }}</span>
  81. </template>
  82. </el-table-column>
  83. </el-table>
  84. <div class="pagination-table">
  85. <el-pagination @current-change="currentPageChange" :current-page.sync="pagination.currentPage" :page-size="pagination.pageSize"
  86. layout="prev, pager, next, jumper" :total="pagination.total">
  87. </el-pagination>
  88. </div>
  89. </div>
  90. </div>
  91. </el-col>
  92. </el-row>
  93. </div>
  94. </template>
  95. <script>
  96. import {
  97. getThreeData,
  98. getTableData,
  99. downloadExcel
  100. } from '@/api/operationRecord'
  101. export default {
  102. data() {
  103. return {
  104. // total_balance: 0.0.toFixed(2), // 总余额
  105. // total_recharge: 0.0.toFixed(2), // 总充值
  106. // total_number: 0, // 总交易笔数
  107. // 表格单元格样式
  108. cell_style: {
  109. color: '#1A202B',
  110. 'font-size': '14px',
  111. 'font-family': 'Microsoft YaHei-3970(82674968)'
  112. },
  113. // 表格头部样式
  114. header_cell_style: {
  115. background: '#E6ECFE',
  116. color: '#1A202B',
  117. 'font-size': '16px',
  118. 'font-family': 'Microsoft YaHei-3970(82674968)'
  119. },
  120. search_datatime: [],
  121. pickerOptions: {
  122. shortcuts: [{
  123. text: '最近一周',
  124. onClick(picker) {
  125. const end = new Date();
  126. const start = new Date();
  127. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  128. picker.$emit('pick', [start, end]);
  129. }
  130. }, {
  131. text: '最近一个月',
  132. onClick(picker) {
  133. const end = new Date();
  134. const start = new Date();
  135. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  136. picker.$emit('pick', [start, end]);
  137. }
  138. }, {
  139. text: '最近三个月',
  140. onClick(picker) {
  141. const end = new Date();
  142. const start = new Date();
  143. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  144. picker.$emit('pick', [start, end]);
  145. }
  146. }]
  147. },
  148. // 表单数据
  149. formInline: {
  150. user: '',
  151. startTime: '',
  152. endTime: '',
  153. re_state: ''
  154. },
  155. tableData: [],
  156. cond_data: {},
  157. // 分页参数
  158. pagination: {
  159. currentPage: 1,
  160. pageSize: 9,
  161. total: 0
  162. },
  163. loading: true
  164. }
  165. },
  166. created() {
  167. // 获取消费记录,表格数据
  168. this.get_table_data('list')
  169. },
  170. mounted() {
  171. document.getElementsByClassName("el-pagination__jump")[0].childNodes[0].nodeValue = "跳至";
  172. },
  173. methods: {
  174. /**
  175. * 选取的时间进行格式化,赋值给formInline
  176. */
  177. search_datetime_change() {
  178. // console.log(this.search_datatime);
  179. if (this.search_datatime == null) {
  180. this.formInline.startTime = ''
  181. this.formInline.endTime = ''
  182. } else {
  183. this.formInline.startTime = this.search_datatime[0]
  184. this.formInline.endTime = this.search_datatime[1]
  185. }
  186. // 刷新列表
  187. this.get_table_data('search')
  188. },
  189. /**
  190. * 搜索状态
  191. */
  192. search_state_change() {
  193. // 刷新列表
  194. this.get_table_data('search')
  195. },
  196. /**
  197. * 获取消费记录,表格数据
  198. */
  199. get_table_data(param) {
  200. this.loading = true
  201. this.get_condtion();
  202. let data = this.cond_data;
  203. if (param == 'search') {
  204. data.page = 1
  205. this.pagination.currentPage = 1
  206. }
  207. // console.log(data);
  208. getTableData(data).then((res) => {
  209. // console.log(res);
  210. if (typeof res.rows !== 'undefined' && res.rows !== '') {
  211. this.pagination.total = res.total
  212. this.tableData = []
  213. for (var i = 0; i < res.rows.length; i++) {
  214. this.tableData.push(res.rows[i])
  215. }
  216. } else {
  217. this.tableData = []
  218. this.$message.warning('没有符合条件的数据!')
  219. }
  220. }).catch((err) => {
  221. // console.log(err);
  222. this.$message.error(err.message)
  223. });
  224. this.loading = false;
  225. },
  226. /**
  227. * 条件
  228. */
  229. get_condtion() {
  230. let data = {
  231. page: this.pagination.currentPage,
  232. rows: this.pagination.pageSize
  233. }
  234. if (this.formInline.user !== '') {
  235. data.name_card = this.formInline.user
  236. }
  237. if (this.formInline.startTime !== '') {
  238. data.start_time = this.formInline.startTime
  239. }
  240. if (this.formInline.endTime !== '') {
  241. data.end_time = this.formInline.endTime
  242. }
  243. if (this.formInline.re_state !== '') {
  244. data.re_state = this.formInline.re_state
  245. }
  246. this.cond_data = data;
  247. },
  248. /**
  249. * 搜索
  250. */
  251. btn_search() {
  252. this.get_table_data('search')
  253. },
  254. /**
  255. * currentPage 改变时会触发
  256. * @param {Object} val
  257. */
  258. currentPageChange(val) {
  259. this.pagination.currentPage = val
  260. this.get_table_data('pages')
  261. }
  262. }
  263. }
  264. </script>
  265. <style lang="scss" scoped>
  266. .app-container {
  267. background-color: #EFF2F7;
  268. padding: 10px;
  269. .el-row {
  270. .el-col {
  271. padding: 10px;
  272. .cell {
  273. padding: 30px;
  274. border-radius: 10px;
  275. background-color: #FFFFFF;
  276. // box-shadow: 5px 5px 15px #979797;
  277. box-shadow: 0px 3px 21px 0px rgba(60, 108, 254, 0.16);
  278. .cell-title {
  279. display: flex;
  280. justify-content: space-between;
  281. align-items: center;
  282. margin-bottom: 30px;
  283. padding-bottom: 30px;
  284. border-bottom: 1px solid #CCCCCC;
  285. .title-left {
  286. display: flex;
  287. align-items: center;
  288. .title {
  289. font-size: 22px;
  290. font-family: Microsoft YaHei-3970(82674968);
  291. font-weight: bold;
  292. color: #1A202B;
  293. }
  294. .title-detail {
  295. margin-left: 50px;
  296. font-size: 18px;
  297. font-family: Microsoft YaHei-3970(82674968);
  298. color: #1A202B;
  299. }
  300. }
  301. .title-right {
  302. display: flex;
  303. justify-content: space-between;
  304. align-items: center;
  305. .el-button {
  306. width: 110px;
  307. height: 46px;
  308. background: #2B4CFE;
  309. font-size: 18px;
  310. color: #FFFFFF;
  311. font-family: Microsoft YaHei-3970(82674968);
  312. border-radius: 5px;
  313. }
  314. .el-button--warning {
  315. background: #F88A64;
  316. }
  317. }
  318. }
  319. .cell-body {
  320. .el-form {
  321. display: flex;
  322. flex-wrap: wrap;
  323. align-items: center;
  324. .el-button--warning {
  325. background: #F88A64;
  326. }
  327. .el-date-editor--datetimerange {
  328. padding: 3px 8px;
  329. width: 370px;
  330. }
  331. .el-select {
  332. width: 130px;
  333. }
  334. }
  335. .btn-cell-blue {
  336. color: #2B4CFE;
  337. border: none;
  338. font-size: 18px;
  339. }
  340. .btn-cell-black {
  341. color: #53575A;
  342. border: none;
  343. font-size: 18px;
  344. }
  345. .txt-cell-green {
  346. color: #67C23A;
  347. }
  348. .txt-cell-blue {
  349. color: #0202c2;
  350. }
  351. .txt-cell-red {
  352. color: #F56C6C;
  353. font-size: 16px;
  354. }
  355. .pagination-table {
  356. display: flex;
  357. justify-content: flex-end;
  358. align-items: center;
  359. height: 30px;
  360. margin-top: 20px;
  361. padding-right: 100px;
  362. ::v-deep .el-pagination {
  363. display: flex;
  364. justify-content: flex-end;
  365. align-items: center;
  366. }
  367. ::v-deep .el-pagination ul {
  368. display: flex;
  369. }
  370. ::v-deep .el-pagination button,
  371. ::v-deep .el-pagination li {
  372. display: flex;
  373. justify-content: center;
  374. align-items: center;
  375. width: 50px;
  376. height: 36px;
  377. border: 1px solid #626262;
  378. border-radius: 3px;
  379. font-size: 14px;
  380. margin: 0 5px;
  381. }
  382. ::v-deep .el-pagination span {
  383. margin-left: 10px;
  384. }
  385. ::v-deep .el-pagination .el-pagination__jump {
  386. font-size: 16px;
  387. }
  388. ::v-deep .el-pagination .el-pagination__editor {
  389. width: 50px;
  390. height: 36px;
  391. margin: 0 5px;
  392. }
  393. ::v-deep .el-pagination .el-input__inner {
  394. width: 50px;
  395. height: 36px;
  396. border: 1px solid #626262;
  397. margin: -4px 0 0 0;
  398. }
  399. }
  400. }
  401. }
  402. }
  403. }
  404. ::v-deep .el-table .cell {
  405. padding: 0 3px;
  406. overflow: hidden;
  407. white-space: nowrap;
  408. text-overflow: ellipsis;
  409. }
  410. ::v-deep .el-table__row:hover .cell {
  411. overflow: visible;
  412. white-space: normal;
  413. }
  414. ::v-deep .el-dialog {
  415. margin: 0 !important;
  416. width: 400px;
  417. height: 320px;
  418. background: #FFFFFF;
  419. box-shadow: 0px 0px 13px 0px rgba(0, 0, 0, 0.29);
  420. border-radius: 10px;
  421. position: absolute;
  422. top: 50%;
  423. left: 50%;
  424. transform: translate(-50%, -50%);
  425. .el-dialog__header {
  426. display: flex;
  427. align-items: center;
  428. width: 100%;
  429. height: 58px;
  430. padding: 30px;
  431. background: #E6EBFE;
  432. border-radius: 10px 10px 0px 0px;
  433. font-weight: bold;
  434. }
  435. .el-dialog__body {
  436. padding-bottom: 0;
  437. .el-form-item {
  438. margin-bottom: 0;
  439. .el-form-item__label,
  440. .el-form-item__content {
  441. font-size: 16px;
  442. font-family: Microsoft YaHei-3970(82674968);
  443. color: #53575A;
  444. }
  445. .el-input__inner {
  446. width: 100px;
  447. }
  448. }
  449. }
  450. }
  451. }
  452. </style>