sms-log.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <template>
  2. <div class='main-content'>
  3. <baseTable
  4. ref='systemSmsLogTable'
  5. :tableHeader='tableHeader'
  6. :tableData='tableData'
  7. :searchParams='searchParams'
  8. @searchFn='searchFn'
  9. @resetFn='resetFn'
  10. :moreOperation='false'
  11. :addBtn='false'
  12. >
  13. <template slot='search'>
  14. <el-form-item label='手机号'>
  15. <el-input v-model.trim='searchParams.mobile' />
  16. </el-form-item>
  17. <el-form-item label='内容关键字'>
  18. <el-input v-model.trim='searchParams.content' />
  19. </el-form-item>
  20. </template>
  21. </baseTable>
  22. </div>
  23. </template>
  24. <script>
  25. import {
  26. fetchSystemSmsLogPage
  27. } from '@api/upms/sms-log';
  28. import dateUtil from '@utils/dateUtil';
  29. export default {
  30. name: 'SystemSmsLog',
  31. components: {},
  32. data() {
  33. return {
  34. tableHeader: [
  35. {
  36. label: '手机号',
  37. prop: 'mobile',
  38. width: 150,
  39. align: 'center'
  40. },
  41. {
  42. label: '发送内容',
  43. prop: 'content',
  44. align: 'center'
  45. },
  46. {
  47. label: '发送结果',
  48. prop: 'result',
  49. align: 'center'
  50. },
  51. {
  52. label: '发送时间',
  53. prop: 'createTime',
  54. align: 'center',
  55. type: 'render',
  56. render: (h, params) => {
  57. let date = dateUtil.stringToDate(params.row.createTime);
  58. return h('span', dateUtil.dateToString(date, 's', false));
  59. }
  60. }
  61. ],
  62. tableData: [],
  63. defaultSearch: {},
  64. searchParams: Object.assign({}, this.$search),
  65. uploadParams: {}
  66. };
  67. },
  68. methods: {
  69. searchFn(isReset = false) {
  70. let vm = this;
  71. if (isReset) {
  72. vm.searchParams = Object.assign(vm.searchParams, vm.$search);
  73. }
  74. fetchSystemSmsLogPage(vm.searchParams).then(
  75. (res) => {
  76. vm.tableData = res.data.records;
  77. vm.searchParams.total = res.data.total;
  78. },
  79. (error) => {
  80. vm.$notify.error({
  81. title: error.data.msg,
  82. message: error.data.data
  83. });
  84. }
  85. );
  86. },
  87. resetFn() {
  88. let vm = this;
  89. vm.searchParams = Object.assign({}, vm.defaultSearch, this.$search);
  90. vm.searchFn();
  91. }
  92. },
  93. created() {
  94. this.searchFn();
  95. }
  96. };
  97. </script>
  98. <style scoped type='less'></style>