index.ftl 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>会员日志</title>
  5. <#include "../../include/head-file.ftl">
  6. </head>
  7. <body>
  8. <div id="index" class="ms-index" v-cloak>
  9. <div class="ms-search">
  10. <el-row>
  11. <el-form :model="form" ref="searchForm" label-width="120px" size="default">
  12. <el-row>
  13. <el-col :span=8>
  14. <!--会员编号-->
  15. <el-form-item label="会员编号" prop="peopleId">
  16. <el-input
  17. v-model="form.peopleId"
  18. :style="{width: '100%'}"
  19. :clearable="true"
  20. placeholder="请输入会员编号">
  21. </el-input>
  22. </el-form-item>
  23. </el-col>
  24. <el-col :span=8>
  25. <!--会员编号-->
  26. <el-form-item label="标题" prop="logTitle">
  27. <el-input
  28. v-model="form.logTitle"
  29. :style="{width: '100%'}"
  30. :clearable="true"
  31. placeholder="请输入标题">
  32. </el-input>
  33. </el-form-item>
  34. </el-col>
  35. <el-col :span=8>
  36. <!--日志类型-->
  37. <el-form-item label="日志类型" prop="logType">
  38. <el-select v-model="form.logType"
  39. :style="{width: '100%'}"
  40. :filterable="true"
  41. :disabled="false"
  42. :multiple="false" :clearable="true"
  43. placeholder="请选择日志类型">
  44. <el-option v-for='item in logTypeOptions' :key="item" :value="item.value"
  45. :label="item.label"></el-option>
  46. </el-select>
  47. </el-form-item>
  48. </el-col>
  49. </el-row>
  50. <el-row>
  51. <el-col :span=8>
  52. <!--日志类型-->
  53. <el-form-item label="请求状态" prop="logStatus">
  54. <el-select v-model="form.logStatus"
  55. :style="{width: '100%'}"
  56. :filterable="false"
  57. :multiple="false" :clearable="true"
  58. placeholder="请选择请求状态">
  59. <el-option v-for='item in logStatusOptions' :key="item.value" :value="item.value"
  60. :label="item.label"></el-option>
  61. </el-select>
  62. </el-form-item>
  63. </el-col>
  64. <el-col :span=8>
  65. <el-form-item label="创建时间" prop="createDateScope">
  66. <el-date-picker
  67. v-model="form.createDateScope"
  68. value-format="YYYY-MM-DD HH:mm:ss"
  69. format="YYYY-MM-DD HH:mm:ss"
  70. type="datetimerange"
  71. :style="{width: '100%'}"
  72. start-placeholder="开始时间"
  73. end-placeholder="结束时间">
  74. </el-date-picker>
  75. </el-form-item>
  76. </el-col>
  77. <el-col :span=8 style="text-align: right;">
  78. <el-button type="primary" class="el-icon-search" size="default" @click="currentPage=1;list(true)">
  79. 搜索
  80. </el-button>
  81. <el-button @click="rest" class="el-icon-refresh" size="default">重置</el-button>
  82. </el-col>
  83. </el-row>
  84. </el-form>
  85. </el-row>
  86. </div>
  87. <el-main class="ms-container">
  88. <el-table height="calc(100vh - 68px)" v-loading="loading" ref="multipleTable" border :data="dataList"
  89. tooltip-effect="dark" @selection-change="handleSelectionChange">
  90. <template #empty>
  91. {{emptyText}}
  92. </template>
  93. <el-table-column type="selection" width="40" :selectable="isChecked"></el-table-column>
  94. <el-table-column label="标题" align="left" prop="logTitle">
  95. </el-table-column>
  96. <el-table-column label="会员编号" align="left" prop="peopleId">
  97. </el-table-column>
  98. <el-table-column label="IP" align="left" prop="logIp">
  99. </el-table-column>
  100. <el-table-column label="所在地区" align="left" prop="logAddr">
  101. </el-table-column>
  102. <el-table-column label="请求状态" width="80" align="center" prop="logStatus" :formatter="logStatusFormat">
  103. </el-table-column>
  104. <el-table-column label="创建时间" align="center" prop="createDate">
  105. </el-table-column>
  106. <el-table-column label="操作" width="180" align="center">
  107. <template #default="scope">
  108. <el-link type="primary" :underline="false" @click="save(scope.row.id)">详情</el-link>
  109. </template>
  110. </el-table-column>
  111. </el-table>
  112. <el-pagination
  113. background
  114. :page-sizes="[50,100,200,500]"
  115. layout="total, sizes, prev, pager, next, jumper"
  116. :current-page="currentPage"
  117. :page-size="pageSize"
  118. :total="total"
  119. class="ms-pagination"
  120. @current-change='currentChange'
  121. @size-change="sizeChange">
  122. </el-pagination>
  123. </el-main>
  124. </div>
  125. </body>
  126. </html>
  127. <script>
  128. var indexVue = new _Vue({
  129. el: '#index',
  130. data: function (){
  131. return{
  132. logStatusOptions: [{"value": "success", "label": "成功"}, {"value": "error", "label": "失败"}],
  133. dataList: [], //会员日志列表
  134. selectionList: [],//会员日志列表选中
  135. total: 0, //总记录数量
  136. pageSize: 50, //页面数量
  137. currentPage: 1, //初始页
  138. manager: ms.manager,
  139. loading: true,//加载状态
  140. emptyText: '',//提示文字
  141. // 日志类型
  142. logTypeOptions: [],
  143. //搜索表单
  144. form: {
  145. sqlWhere: null,
  146. logStatus: null,
  147. createDateScope: null,
  148. },
  149. }
  150. },
  151. watch: {},
  152. methods: {
  153. isChecked: function (row) {
  154. if (row.del == 3) {
  155. return false;
  156. }
  157. return true;
  158. },
  159. //查询列表
  160. list: function (isSearch) {
  161. var that = this;
  162. var data = {}; //搜索参数
  163. that.loading = true;
  164. var page = {
  165. pageNo: that.currentPage,
  166. pageSize: that.pageSize
  167. }
  168. var form = JSON.parse(JSON.stringify(that.form))
  169. //处理时间范围
  170. if (form.createDateScope) {
  171. form.startTime = form.createDateScope[0];
  172. form.endTime = form.createDateScope[1];
  173. }
  174. if (isSearch) {
  175. //删除空字符串
  176. for (var key in form) {
  177. if (form[key] === undefined || form[key] === null) {
  178. delete form[key]
  179. }
  180. }
  181. form.sqlWhere ? data = Object.assign({}, {sqlWhere: form.sqlWhere}, page) : data = Object.assign({}, form, page)
  182. } else {
  183. data = page;
  184. }
  185. sessionStorage.setItem(this.historyKey,JSON.stringify({form: form, page: page}));
  186. ms.http.post(ms.manager + "/people/peopleLog/list.do", data).then(
  187. function (res) {
  188. if (!res.result || res.data.total <= 0) {
  189. that.emptyText = "暂无数据"
  190. that.dataList = [];
  191. that.total = 0;
  192. } else {
  193. that.emptyText = '';
  194. that.total = res.data.total;
  195. that.dataList = res.data.rows;
  196. }
  197. that.loading = false;
  198. }).catch(function (err) {
  199. that.loading = false;
  200. console.log(err);
  201. });
  202. },
  203. //会员日志列表选中
  204. handleSelectionChange: function (val) {
  205. this.selectionList = val;
  206. },
  207. //新增
  208. save: function (id) {
  209. if (id) {
  210. ms.util.openSystemUrl("/people/peopleLog/form.do?id=" + id);
  211. }
  212. },
  213. //pageSize改变时会触发
  214. sizeChange: function (pagesize) {
  215. this.loading = true;
  216. this.pageSize = pagesize;
  217. this.list(true);
  218. },
  219. //currentPage改变时会触发
  220. currentChange: function (currentPage) {
  221. this.loading = true;
  222. this.currentPage = currentPage;
  223. this.list(true);
  224. },
  225. //重置表单
  226. rest: function () {
  227. this.currentPage = 1;
  228. this.form = {
  229. sqlWhere: null
  230. };
  231. this.list();
  232. },
  233. //表格数据转换
  234. logStatusFormat: function (row, column, cellValue, index) {
  235. var value = "";
  236. if (cellValue) {
  237. var data = this.logStatusOptions.find(function (value) {
  238. return value.value == cellValue;
  239. })
  240. if (data && data.label) {
  241. value = data.label;
  242. }
  243. }
  244. return value;
  245. },
  246. //获取logType数据源
  247. logTypeOptionsGet: function () {
  248. var that = this;
  249. ms.http.post(ms.manager + '/people/peopleLog/queryLogType.do').then(function (res) {
  250. that.logTypeOptions = res.data;
  251. }).catch(function (err) {
  252. console.log(err);
  253. });
  254. },
  255. },
  256. mounted: function () {
  257. //加载日志类型 数据
  258. this.logTypeOptionsGet();
  259. //如果存在历史参数,恢复页面结果
  260. if(sessionStorage.getItem(this.historyKey) && ms.util.getParameter("isBack") == 'true') {
  261. var _history = JSON.parse(sessionStorage.getItem(this.historyKey))
  262. this.form = _history.form;
  263. this.total = _history.total;
  264. this.currentPage = _history.page.pageNo;
  265. this.pageSize = _history.page.pageSize;
  266. }
  267. this.list();
  268. },
  269. })
  270. </script>
  271. <style>
  272. #index .ms-container {
  273. height: calc(100vh - 141px);
  274. }
  275. </style>