logMonitor.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  1. <template>
  2. <div class="container">
  3. <div class="header">
  4. <el-form label-width="120px" v-model="form">
  5. <div style="display: flex; padding: 10px">
  6. <el-form-item label="系统模块名称:">
  7. <el-select v-model="form.moduleName" placeholder="请选择模块名称">
  8. <el-option
  9. v-for="item in moduleNameOptions"
  10. :key="item.value"
  11. :label="item.label"
  12. :value="item.value"
  13. ></el-option>
  14. </el-select>
  15. </el-form-item>
  16. <el-form-item label="人员姓名:">
  17. <el-input
  18. v-model="form.nameInput"
  19. placeholder="请输入人员名称"
  20. ></el-input>
  21. </el-form-item>
  22. <el-form-item label="操作类型:">
  23. <el-select
  24. v-model="form.operationType"
  25. placeholder="请选择操作类型"
  26. >
  27. <el-option
  28. v-for="item in operationTypeOptions"
  29. :key="item.value"
  30. :label="item.label"
  31. :value="item.value"
  32. ></el-option>
  33. </el-select>
  34. </el-form-item>
  35. <el-form-item label="操作状态:">
  36. <el-select
  37. v-model="form.operationStatus"
  38. placeholder="请选择操作状态"
  39. >
  40. <el-option
  41. v-for="item in operationStatusOptions"
  42. :key="item.value"
  43. :label="item.label"
  44. :value="item.value"
  45. ></el-option>
  46. </el-select>
  47. </el-form-item>
  48. <el-form-item label="时间范围:">
  49. <el-date-picker
  50. v-model="form.timeVal"
  51. type="datetimerange"
  52. start-placeholder="开始日期"
  53. end-placeholder="结束日期"
  54. :default-time="['12:00:00']"
  55. >
  56. </el-date-picker>
  57. </el-form-item>
  58. </div>
  59. <div class="button-box">
  60. <el-button class="reset-btn" @click="resetEvent">重置</el-button>
  61. <el-button class="search-btn" @click="searchEvent">查询</el-button>
  62. </div>
  63. </el-form>
  64. </div>
  65. <div class="content">
  66. <div class="export">
  67. <el-button class="new_button" @click="exportEvent">导出</el-button>
  68. </div>
  69. <el-table
  70. ref="multipleTable"
  71. :data="tableData"
  72. tooltip-effect="dark"
  73. :header-cell-style="{ textAlign: 'center' }"
  74. :cell-style="{ textAlign: 'center' }"
  75. style="width: 100%"
  76. height="350"
  77. @selection-change="handleSelectionChange"
  78. >
  79. <el-table-column type="selection" width="50"> </el-table-column>
  80. <el-table-column label="序号" type="index" width="60">
  81. </el-table-column>
  82. <el-table-column prop="systemTemplate" label="系统模块">
  83. </el-table-column>
  84. <el-table-column prop="operationType" label="操作类型">
  85. </el-table-column>
  86. <el-table-column prop="requestType" label="请求方式"> </el-table-column>
  87. <el-table-column prop="operationPerson" label="操作人员">
  88. </el-table-column>
  89. <el-table-column prop="operationAddress" label="操作地址">
  90. </el-table-column>
  91. <el-table-column prop="operationAddress_desc" label="操作地点">
  92. </el-table-column>
  93. <el-table-column prop="operationStatus" label="操作状态">
  94. <template slot-scope="scope">
  95. <el-tag
  96. style="width: 60px; height: 30px"
  97. :type="scope.row.operationStatus == 'true' ? 'success' : 'danger'"
  98. >
  99. {{ scope.row.operationStatus == "true" ? "成功" : "失败" }}
  100. </el-tag>
  101. </template>
  102. </el-table-column>
  103. <el-table-column prop="operationTime" label="操作时间" width="180">
  104. </el-table-column>
  105. </el-table>
  106. </div>
  107. <div class="bottom">
  108. <page class="page" :paginationData="paginationData"></page>
  109. </div>
  110. </div>
  111. </template>
  112. <script>
  113. import page from "@/components/pagination/index";
  114. import { getLogList } from "@/api/security/logMonitor";
  115. export default {
  116. components: { page },
  117. data() {
  118. return {
  119. show: true,
  120. form: {
  121. moduleName: "",
  122. operationType: "",
  123. nameInput: "",
  124. operationStatus: "",
  125. timeVal: "",
  126. },
  127. tableData: [],
  128. operationTypeOptions: [
  129. {
  130. value: "",
  131. label: "不限",
  132. },
  133. {
  134. value: "新增",
  135. label: "新增",
  136. },
  137. {
  138. value: "查询",
  139. label: "查询",
  140. },
  141. {
  142. value: "修改",
  143. label: "修改",
  144. },
  145. {
  146. value: "删除",
  147. label: "删除",
  148. },
  149. {
  150. value: "批量修改",
  151. label: "批量修改",
  152. },
  153. {
  154. value: "批量删除",
  155. label: "批量删除",
  156. },
  157. {},
  158. ],
  159. operationStatusOptions: [
  160. {
  161. value: "",
  162. label: "不限",
  163. },
  164. {
  165. value: "0",
  166. label: "成功",
  167. },
  168. {
  169. value: "1",
  170. label: "失败",
  171. },
  172. ],
  173. moduleNameOptions: [
  174. {
  175. value: "",
  176. label: "不限",
  177. },
  178. {
  179. value: "登入",
  180. label: "登入",
  181. },
  182. {
  183. value: "用户管理",
  184. label: "用户管理",
  185. },
  186. {
  187. value: "组织管理",
  188. label: "组织管理",
  189. },
  190. {
  191. value: "角色管理",
  192. label: "角色管理",
  193. },
  194. {
  195. value: "消息管理",
  196. label: "消息管理",
  197. },
  198. {
  199. value: "信息管理",
  200. label: "信息管理",
  201. },
  202. {
  203. value: "日志管理",
  204. label: "日志管理",
  205. },
  206. {
  207. value: "数据管理",
  208. label: "数据管理",
  209. },
  210. ],
  211. multipleSelection: [],
  212. defaultProps: {
  213. children: "children",
  214. label: "label",
  215. },
  216. currentPageSize: 10,
  217. currentPage: 1,
  218. paginationData: {
  219. pageSize: 10,
  220. pagerCount: 5,
  221. currentPage: 1,
  222. pageSizes: [5, 10, 20, 30],
  223. total: 30,
  224. currentChange: (val) => {
  225. this.getTableData(val);
  226. },
  227. handleSizeChange: (val) => {
  228. this.handleSizeChange(val);
  229. },
  230. },
  231. };
  232. },
  233. watch: {
  234. filterText(val) {
  235. this.$refs.search.filter(val);
  236. },
  237. },
  238. mounted() {
  239. this.initData();
  240. },
  241. methods: {
  242. initData() {
  243. this.getTableData(1);
  244. },
  245. getTableData(page) {
  246. this.tableData = [];
  247. getLogList(
  248. page,
  249. this.currentPageSize,
  250. this.form.nameInput,
  251. this.form.moduleName,
  252. this.form.operationType,
  253. this.form.operationStatus
  254. ).then((res) => {
  255. if (res.data.code === 0 && res.data.data.length > 0) {
  256. this.tableData = res.data.data.map((v) => {
  257. return {
  258. logID: v.id,
  259. systemTemplate: v.module,
  260. operationType: v.operation_type,
  261. requestType: v.request,
  262. operationPerson: v.operation_staff,
  263. operationAddress: v.operation_address,
  264. operationAddress_desc: "内网IP",
  265. operationStatus: v.operation_status == "0" ? "true" : "false",
  266. operationTime: v.operation_time,
  267. };
  268. });
  269. }
  270. });
  271. },
  272. // 切换条数
  273. handleSizeChange(val) {
  274. console.log(`每页 ${val} 条`);
  275. this.currentPageSize = val;
  276. this.getTableData(this.currentPage);
  277. },
  278. filterNode(value, data) {
  279. if (!value) return true;
  280. return data.label.indexOf(value) !== -1;
  281. },
  282. cancleChecked() {
  283. this.$refs.multipleTable.clearSelection();
  284. },
  285. handleSelectionChange(val) {
  286. this.multipleSelection = val;
  287. },
  288. resetEvent() {
  289. this.form.moduleName = "";
  290. this.form.nameInput = "";
  291. this.form.operationType = "";
  292. this.form.operationStatus = "";
  293. this.searchEvent();
  294. },
  295. searchEvent() {
  296. console.log(this.form);
  297. this.getTableData(this.currentPage);
  298. },
  299. exportEvent() {
  300. console.log("导出事件");
  301. },
  302. batchDelete() {},
  303. batchActivate() {},
  304. exportData() {},
  305. },
  306. };
  307. </script>
  308. <style lang="less" scoped>
  309. .container {
  310. position: relative;
  311. height: 100%;
  312. line-height: 20px;
  313. background-color: rgba(255, 255, 255, 1);
  314. color: rgba(16, 16, 16, 1);
  315. font-size: 14px;
  316. text-align: center;
  317. overflow-y: auto;
  318. //box-shadow: 0px 0px 4px 0px rgba(0, 0, 0, 0.15);
  319. .header {
  320. margin: 2%;
  321. height: 100px;
  322. width: 96%;
  323. background-color: #fafafa;
  324. border-radius: 4px;
  325. .el-form-item {
  326. margin-bottom: 0 !important;
  327. /deep/ .el-form-item__label {
  328. color: #666666;
  329. font-weight: 600;
  330. }
  331. }
  332. .button-box {
  333. width: 100%;
  334. height: 30px;
  335. position: relative;
  336. .reset-btn,
  337. .search-btn {
  338. height: 30px;
  339. width: 80px;
  340. position: absolute;
  341. color: #fff;
  342. display: flex;
  343. align-items: center;
  344. justify-content: center;
  345. }
  346. .reset-btn {
  347. right: 130px;
  348. background-color: #b3b3b3;
  349. }
  350. .search-btn {
  351. right: 20px;
  352. background-color: #2ea8e6;
  353. }
  354. }
  355. }
  356. .content {
  357. width: 95%;
  358. height: 400px;
  359. position: absolute;
  360. margin-left: 2.5%;
  361. margin-right: 2.5%;
  362. .export {
  363. width: 100%;
  364. height: 30px;
  365. position: absolute;
  366. left: 0;
  367. top: 0;
  368. .new_button {
  369. position: absolute;
  370. padding: 5px;
  371. width: 80px;
  372. left: 10px;
  373. // position: relative;
  374. // right: 760px;
  375. background-color: #2ea8e6;
  376. color: #fff;
  377. }
  378. }
  379. .el-table {
  380. position: absolute;
  381. top: 30px;
  382. left: 0;
  383. width: 100%;
  384. height: calc(100% - 30px);
  385. border: 1px solid #f0f2f2;
  386. margin-top: 10px;
  387. font-size: 0.95rem;
  388. font-family: PingFang SC;
  389. font-weight: 500;
  390. color: #b2b2b2;
  391. background: rgba(255, 255, 255, 0.8);
  392. /deep/th {
  393. background: #f7fbff;
  394. }
  395. /deep/.el-checkbox {
  396. color: #b2b2b2;
  397. .el-checkbox__input.is-checked + .el-checkbox__label {
  398. color: #2ea8e6;
  399. }
  400. .el-checkbox__input.is-checked .el-checkbox__inner::after {
  401. width: 70%;
  402. height: 70%;
  403. background: #2ea8e6;
  404. border-radius: 0;
  405. transform: rotate(0deg) scaleY(1);
  406. position: static;
  407. // border: 1px solid #8DD9FF;
  408. }
  409. .el-checkbox__inner {
  410. border: 1px solid #8dd9ff;
  411. background: rgba(0, 170, 255, 0);
  412. display: flex;
  413. align-items: center;
  414. justify-content: center;
  415. position: static;
  416. &::after {
  417. transition: 0ms;
  418. }
  419. }
  420. .el-checkbox__label {
  421. padding-left: 0;
  422. font-size: 15px;
  423. position: absolute;
  424. top: 1px;
  425. left: 25px;
  426. }
  427. }
  428. }
  429. .el-select {
  430. width: 80px;
  431. margin-right: 20px;
  432. }
  433. }
  434. .bottom {
  435. position: absolute;
  436. bottom: 10px;
  437. left: 50px;
  438. height: 50px;
  439. width: 95%;
  440. line-height: 20px;
  441. background-color: rgba(255, 255, 255, 1);
  442. text-align: center;
  443. }
  444. }
  445. </style>