From 4b43bfb3f6f499f480712dd29bef52275466afd6 Mon Sep 17 00:00:00 2001 From: heyujie <516346543@qq.com> Date: 星期五, 30 七月 2021 22:10:59 +0800 Subject: [PATCH] change all --- src/pages/syslog/views/systemLog.vue | 593 +++++++++++++++++++++++++++++++--------------------------- 1 files changed, 316 insertions(+), 277 deletions(-) diff --git a/src/pages/syslog/views/systemLog.vue b/src/pages/syslog/views/systemLog.vue index 6f2d951..3e7b84d 100644 --- a/src/pages/syslog/views/systemLog.vue +++ b/src/pages/syslog/views/systemLog.vue @@ -1,326 +1,365 @@ <template> - <div class="all"> - <div class="backup-content"> - <div class="backup-center" ref="left"> - <div class="menu-item" @click="openRight(0)"> - <div class="con"> - <span class="icon iconfont"></span> - <span class="menu-text">鑷姩澶囦唤璁剧疆</span> + <div class="sys-log" v-loading="loading" :element-loading-text="loadingText"> + <div class="top"> + <div class="first"> + <div class="time-option"> + <div class="title">鍛ㄦ湡锛�</div> + + <div class="opts"> + <div + :class="activeDateChoise == i ? 'opt-active' : ''" + class="opt" + v-for="(item, i) in dateArr" + :key="i" + @click="choseRange(item, i)" + > + {{ item }} + </div> </div> </div> - <div class="menu-item" @click="openRight(1)"> - <div class="con"> - <span class="icon iconfont"></span> - - <span class="menu-text">浠庡浠戒腑鎭㈠</span> - </div> + <div class="search"> + <el-input + placeholder="鎼滅储" + v-model="fuzzySearch" + size="small" + class="input-with-select" + > + <el-button + slot="append" + icon="el-icon-search" + @click="getOperationLog(1)" + ></el-button> + </el-input> </div> </div> - <div class="backup-right"> - <div class="auto" v-if="activePage == 0"> - <div class="bar"> - <div class="name">鑷姩澶囦唤</div> - <el-switch - v-model="isBackUp" - active-color="rgba(61, 104, 225, 1)" - @change="switchChange" + <div class="second"> + <div class="bar"> + <div class="name">绾у埆锛�</div> + + <el-select + v-model="level" + placeholder="璇烽�夋嫨" + size="small" + @change="levelChange" + > + <el-option label="鍏ㄩ儴" :value="''"> </el-option> + <el-option + v-for="item in levelOptions" + :key="item.proc_name" + :label="item.proc_name" + :value="item.proc_name" > - </el-switch> - </div> - <div class="bar"> - <div class="name">澶囦唤鐩綍</div> - <input type="file" id="file_input" webkitdirectory directory /> - </div> - <div class="bar"> - <div class="name">澶囦唤闂撮殧 / 澶�</div> - <el-input - v-model="interval" - :placeholder="'璇疯緭鍏ュぉ鏁�'" - @change="handleChange" - size="small" - ></el-input> - <!-- :controls="false" --> - </div> - <div class="bar"> - <div class="name">澶囦唤鏁版嵁淇濆瓨鏃堕棿 / 澶�</div> - <el-input - v-model="lifeSpan" - placeholder="璇疯緭鍏ュぉ鏁�" - @change="handleChange" - size="small" - ></el-input> - </div> - <div class="bar"> - <div class="name">鑷姩澶囦唤</div> - <el-button type="primary" size="small" @click="backUpNow" - >绔嬪嵆澶囦唤</el-button - > - </div> + </el-option> + </el-select> </div> - <div class="recover" v-if="activePage == 1"> - <div class="title">鏄剧ず澶囦唤鐨勬枃浠惰寖鍥达細{{ 5 }}</div> - - <div class="table-head"> - <span class="line1">鑷姩澶囦唤鏃堕棿</span> - <span class="line1">澶囦唤鏂囦欢鍚嶇О</span> - <span class="line2">鎿嶄綔</span> - </div> - - <div class="bar" v-for="(item, i) in fileList" :key="i"> - <span class="time">{{ item.time }}</span> - <span class="time">{{ item.name }}</span> - <span class="operation">鎭㈠</span> - </div> + <div class="bar"> + <div class="name">涓绘満鍚嶏細</div> + <el-select + v-model="hostName" + placeholder="璇烽�夋嫨" + size="small" + @change="getOperationLog(1)" + > + <el-option + v-for="item in hostNameOptions" + :key="item.value" + :label="item.label" + :value="item.value" + > + </el-option> + </el-select> </div> </div> </div> + <div class="table"> + <el-table + class="tableBox" + ref="multipleTable" + highlight-current-row + :data="tableData" + :header-cell-style="{ background: '#f8f8f8', color: '#222222' }" + style="width: 100%" + > + <!-- <el-table-column :align="'center'" label="搴忓彿" type="index" width="50"> + </el-table-column> --> + <el-table-column + :align="'center'" + sortable + + prop="add_time" + label="绾у埆" + ></el-table-column> + <el-table-column + sortable + :align="'center'" + prop="userName" + label="鏃ユ湡鏃堕棿" + ></el-table-column> + <el-table-column + :align="'center'" + sortable + prop="module" + label="杩涚▼" + ></el-table-column> + <el-table-column + :align="'center'" + prop="procName" + label="璇︾粏淇℃伅" + ></el-table-column> + <el-table-column + :align="'center'" + sortable + prop="result" + label="杩涚▼鍙�" + ></el-table-column> + <el-table-column + :align="'center'" + prop="msg" + min-width="100px" + label="涓绘満鍚�" + ></el-table-column> + + </el-table> + </div> + + <el-pagination + @size-change="handleSizeChange" + @current-change="handleCurrentChange" + :current-page="page" + :page-sizes="[15, 30, 50, 100]" + :page-size="15" + layout="total, sizes, prev, pager, next, jumper" + :total="total" + > + </el-pagination> </div> </template> <script> +import { deleteDate } from "@/api/system"; +import { pad0 } from "@/api/utils"; +import { } from "@/api/log"; + export default { - mounted() {}, data() { return { - langList: [ - { name: "绠�浣撲腑鏂�" }, - { name: "鑻辨枃" }, - { name: "绻佷綋涓枃锛堥娓級" }, - ], - fileList: [ - { time: "2010-10-02 12:30:09", name: "鏂囦欢1" }, - { time: "2010-10-02 12:30:09", name: "鏂囦欢12121212121" }, - { time: "2010-10-02", name: "鏂囦欢2211" }, - { time: "2011", name: "澶囦唤鏂囦欢2" }, - ], - activePage: 0, - interval: "", - lifeSpan: "", - options: [ + loading: false, + loadingText: "", + input3: "", + tableData: [], + dateArr: ["浠婃棩", "杩戜笁澶�", "杩戜竷澶�", "杩戜竴涓湀", "杩戝叚涓湀"], + levelOptions: [], + hostNameOptions: [], + resultOptions: [ { - value: "閫夐」1", - label: "鎵嬪姩", + value: "", + label: "鍏ㄩ儴", }, { - value: "閫夐」2", - label: "鑷姩", + value: "鎴愬姛", + label: "鎴愬姛", + }, + { + value: "澶辫触", + label: "澶辫触", }, ], - isBackUp: true, + value: "", + page: 1, + pageSize: 15, + activeDateChoise: 0, + hostName: "", + result: "", + level: "", + timeStart: "", + timeEnd: "", + fuzzySearch: "", + total: 0, }; }, + mounted() { + this.getTimeRange(24 * 60 * 60 * 1000); + // this.getOperationLog(); + this.getOptions(); + }, methods: { - openRight(typ) { - const es = document.getElementsByClassName("menu-item"); - es[this.activePage].style.backgroundColor = "#f8f8f8"; - es[this.activePage].style.color = "rgba(54, 54, 54, 1)"; - es[typ].style.backgroundColor = "rgba(61, 104, 225, 1)"; - es[typ].style.color = "#fff"; - this.activePage = typ; + handleSizeChange(val) { + this.pageSize = val; + // this.getOperationLog(); }, - handleChange() {}, - backUpNow() { - this.$confirm("鎮ㄦ槸鍚︾‘璁ょ珛鍗冲浠芥墍鏈夊簲鐢ㄧ殑閰嶇疆鏁版嵁锛�", "绔嬪嵆澶囦唤", { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", - }).then(() => { - this.$message({ - type: "success", - message: "澶囦唤鎴愬姛", - }); + handleCurrentChange(val) { + this.page = val; + // this.getOperationLog(); + }, + levelChange(val) { + // this.getOperationLog(1); + // this.hostName = ""; + // getOperations({ + // module: this.level, + // }).then((res) => { + // this.hostNameOptions = res.data; + // }); + }, + getOptions() { + getModules().then((res) => { + this.levelOptions = res.data; }); - // .then((resp) => { - // if (resp.success) { - // this.$message({ - // type: "success", - // message: "鍒犻櫎鏁版嵁鎴愬姛", - // }); - // this.loading = false; - // } - // }) - // .catch((err) => { - // this.$message({ - // type: "error", - // message: "鍒犻櫎鏁版嵁澶辫触锛�", - // }); - // this.loading = false; - // }); }, - switchChange(val) { - console.log(val); + choseRange(item, i) { + switch (item) { + case "浠婃棩": + this.getTimeRange(24 * 60 * 60 * 1000); + break; + case "杩戜笁澶�": + this.getTimeRange(24 * 60 * 60 * 1000 * 3); + break; + case "杩戜竷澶�": + this.getTimeRange(24 * 60 * 60 * 1000 * 7); + break; + case "杩戜竴涓湀": + this.getTimeRange(24 * 60 * 60 * 1000 * 30); + break; + case "杩戝叚涓湀": + this.getTimeRange(24 * 60 * 60 * 1000 * 30 * 6); + break; + default: + break; + } + // this.getOperationLog(1); + this.activeDateChoise = i; + }, + getOperationLog(typ) { + if (typ==1) { + this.page=1 + } + // queryOperationLog({ + // timeStart: this.timeStart, + // timeEnd: this.timeEnd, + // page: this.page, + // pageSize: this.pageSize, + // module: this.level, + // function: this.hostName, + // result: this.result, + // fuzzySearch: this.fuzzySearch, + // }).then((res) => { + // this.tableData = res.data.logs; + // this.total = res.data.total; + // }); + }, + getTimeStr(date) { + var month = pad0(date.getMonth() + 1); //鏈� + var day = pad0(date.getDate()); //鏃� + var hour = pad0(date.getHours()); //鏃� + var minute = pad0(date.getMinutes()); //鍒� + var second = pad0(date.getSeconds()); //绉� + return `${date.getFullYear()}-${month}-${day} ${hour}:${minute}:${second}`; + }, + getTimeRange(gap) { + var date = new Date(); //褰撳墠鏃堕棿 + var preDay = new Date(new Date().getTime() - gap); + this.timeStart = this.getTimeStr(preDay); + this.timeEnd = this.getTimeStr(date); }, }, }; </script> <style lang="scss"> -.all { +.sys-log { + margin: 0 auto; + padding: 10px 8px 10px 5px; + background-color: rgba(248, 248, 248, 1); width: 100%; -} - -.backup-content { - height: 100%; display: flex; - flex-direction: row; - flex: 1; - flex-basis: auto; - box-sizing: border-box; - .backup-center { - height: 100%; - width: 280px; - overflow: auto; - box-sizing: border-box; - flex-shrink: 0; - padding: 10px; - border-right: 5px solid #f8f8f8; - .menu-item { - background-color: #f8f8f8; - height: 50px; - margin-bottom: 10px; - border-radius: 8px; - line-height: 50px; - box-sizing: border-box; - font-size: 14px; - cursor: pointer; - padding: 0 20px; + flex-direction: column; + overflow: auto; + .top { + height: 100px; + background: #fff; + border-radius: 5px; + .first { display: flex; justify-content: space-between; - .con { - .iconfont { + height: 45px; + padding: 0 20px; + .time-option { + display: flex; + justify-content: space-between; + align-items: center; + .title { margin-right: 10px; + min-width: fit-content; + font-size: 14px; } - .menu-text { - font-size: 15px; + .opts { + display: flex; + justify-content: space-between; + .opt { + min-width: fit-content; + width: 50px; + height: 32px; + padding: 0 15px; + border-radius: 4px; + cursor: pointer; + margin-right: 10px; + line-height: 32px; + font-size: 14px; + } + .opt:hover { + background-color: rgba(61, 104, 225, 1); + color: #fff; + } + .opt-active { + color: #fff; + background-color: rgba(61, 104, 225, 1); + } + } + } + .search { + display: flex; + align-items: center; + } + } + .second { + display: flex; + margin: 10px 0; + padding: 0 20px; + .bar { + display: flex; + align-items: baseline; + width: fit-content; + margin-right: 20px; + min-width: 120px; + .name { + margin-right: 5px; + min-width: fit-content; + font-size: 14px; } } } } - .backup-right { - flex: 1; - flex-basis: auto; - overflow: auto; - box-sizing: border-box; - position: relative; - padding: 20px 40px; - .el-form-item.is-required:not(.is-no-asterisk) - > .el-form-item__label:before, - .el-form-item.is-required:not(.is-no-asterisk) - .el-form-item__label-wrap - > .el-form-item__label:before { - display: none; - } - .el-select { - width: 100%; - } - .el-form-item { - margin-bottom: 10px; - height: 50px; - background: #f8f8f8; - padding: 4px 20px; - -webkit-box-sizing: border-box; - box-sizing: border-box; - border-radius: 10px; - .el-form-item__label { - text-align: left; - line-height: 42px; - } - } - .el-form-item__content { - line-height: 40px; - position: relative; - font-size: 14px; - } - .ip-input-container { - max-width: none !important; - } - .auto { - .bar { - display: flex; - align-items: center; - height: 50px; - padding: 0 25px; - background-color: #f8f8f8; - justify-content: space-between; - border-radius: 12px; - margin-bottom: 10px; - .name { - font-size: 15px; - text-align: left; - min-width: 180px; - } - .el-input { - width: 100%; - .el-input { - height: auto; - } - .el-input__inner { - border: none; - border-radius: 8px; - background-color: rgba(240, 240, 240, 1); - text-align: left; - } - } - } - } - .recover { - .title { - font-size: 13px; - color: #868686; - text-align: left; - padding: 0 10px; - margin-bottom: 10px; - } - .table-head { - height: 30px; - line-height: 30px; - display: flex; - // justify-content: space-between; - box-sizing: border-box; - font-size: 15px; - padding: 0 10px; - margin-bottom: 5px; - .line1 { - flex: 4; - text-align: left; - } - .line2 { - flex: 1; - text-align: right; - } - } - .bar { + .table { + margin-top: 16px; + border-radius: 5px; + padding: 12px; + background-color: white; + .tableBox { + th { + padding: 0 !important; height: 40px; - background-color: rgba(248, 248, 248, 1); - display: flex; - box-sizing: border-box; - padding: 0 10px; - align-items: center; - border-radius: 8px; - color: #797979; - font-size: 14px; - margin-bottom: 10px; - .time { - width: 45%; - text-align: left; - } - .operation { - color: rgba(26, 115, 232, 1); - cursor: pointer; - width: 10%; - text-align: right; - } + line-height: 40px; + } + td { + padding: 0 !important; + height: 34px; + line-height: 34px; } } - .save-btn { - background-color: #3d68e1; - width: 240px; - height: 40px; - margin: 0 auto; - border-radius: 10px; - color: #fff; - line-height: 40px; - font-size: 14px; - margin-top: 20px; - } + } + .el-pagination { + padding: 20px 5px; + height: 100%; + box-sizing: border-box; + background-color: white; } } </style> -- Gitblit v1.8.0