logMonitor.vue 12 KB

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