user.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <?php
  2. use common\helpers\ComponentHelper;
  3. ComponentHelper::loadComponentView('com-user-info');
  4. ComponentHelper::loadComponentView('com-list-page');
  5. ComponentHelper::loadComponentView('com-list-table');
  6. ?>
  7. <com-list-page :crumbs="crumbs" id="application">
  8. <com-list-table
  9. ref="table"
  10. :api-params="apiParams"
  11. :list-params-verify-fun="listParamsVerifyFun"
  12. @select-change="selectChange"
  13. :search-list="searchList"
  14. >
  15. <el-table-column prop="id" label="日志ID" align="center"></el-table-column>
  16. <el-table-column prop="id" label="操作人" align="center">
  17. <template slot-scope="scope">
  18. <com-user-info :user="scope.row.operator_user" :is-to-user-detail="scope.row.operator_user_type == 2" v-if="scope.row.operator_user_type != 3"></com-user-info>
  19. <template v-else>系统</template>
  20. </template>
  21. </el-table-column>
  22. <el-table-column prop="operator_user_type_text" label="操作人类型" align="center"></el-table-column>
  23. <el-table-column prop="id" label="操作目标用户" align="center">
  24. <template slot-scope="scope">
  25. <com-user-info :user="scope.row.user"></com-user-info>
  26. </template>
  27. </el-table-column>
  28. <el-table-column prop="behavior_text" label="行为" align="center"></el-table-column>
  29. <el-table-column label="操作内容" align="center">
  30. <template slot-scope="scope">
  31. <el-tooltip class="item" effect="dark" :content="scope.row.desc" placement="top">
  32. <div>{{ scope.row.desc }}</div>
  33. </el-tooltip>
  34. </template>
  35. </el-table-column>
  36. <el-table-column prop="created_at_text" label="操作时间" align="center"></el-table-column>
  37. <el-table-column prop="ip_text" label="IP" align="center"></el-table-column>
  38. </com-list-table>
  39. </com-list-page>
  40. <script>
  41. const application = new Vue({
  42. el: '#application',
  43. data() {
  44. return {
  45. uid: 0,
  46. name: '',
  47. levelList: [],
  48. btnLoad: false,
  49. operatorUserTypeOptions: <?= $operatorUserTypeOptions ?>,
  50. behaviorOptions: <?= $behaviorOptions ?>,
  51. operatorUserIdPlaceholder: '操作人'
  52. }
  53. },
  54. computed: {
  55. apiParams() {
  56. return {
  57. r: 'mall/logs/user'
  58. }
  59. },
  60. crumbs() {
  61. return [
  62. {
  63. title: '日志记录',
  64. },
  65. {
  66. title: '会员记录',
  67. }
  68. ]
  69. },
  70. searchList() {
  71. return [
  72. {
  73. key: 'operator_user_type',
  74. title: '操作人类型',
  75. type: 'select',
  76. placeholder: '请选择操作人类型',
  77. options: this.operatorUserTypeOptions,
  78. valueKey: {
  79. label: 'label',
  80. value: 'value',
  81. },
  82. },
  83. {
  84. key: 'operator_user_keyword',
  85. title: this.operatorUserIdPlaceholder,
  86. type: 'text',
  87. },
  88. {
  89. key: 'operator_target_user_keyword',
  90. title: '操作目标用户ID或手机号',
  91. type: 'text',
  92. },
  93. {
  94. key: 'behavior',
  95. title: '行为',
  96. type: 'select',
  97. placeholder: '请选择',
  98. options: this.behaviorOptions,
  99. valueKey: {
  100. label: 'label',
  101. value: 'value',
  102. },
  103. },
  104. ]
  105. }
  106. },
  107. created() {
  108. },
  109. methods: {
  110. selectChange(key, value) {
  111. if (key === 'operator_user_type') {
  112. if (value == 2) {
  113. this.operatorUserIdPlaceholder = '操作人ID或手机号'
  114. } else if(value == 1) {
  115. this.operatorUserIdPlaceholder = '操作人账号'
  116. } else {
  117. this.operatorUserIdPlaceholder = '操作人'
  118. }
  119. }
  120. },
  121. listParamsVerifyFun(params) {
  122. if (!isEmpty(params.operator_user_keyword) && isEmpty(params.operator_user_type)) {
  123. this.$message.error('请选择操作人类型')
  124. return false
  125. }
  126. return true
  127. }
  128. }
  129. })
  130. </script>
  131. <style>
  132. </style>