| | |
| | | <template> |
| | | <basic-container> |
| | | <avue-crud ref="crud" |
| | | v-model="form" |
| | | :before-close="beforeClose" |
| | | :before-open="beforeOpen" |
| | | :data="data" |
| | | :option="option" |
| | | :permission="permissionList" |
| | | :table-loading="loading" |
| | | @row-del="rowDel" |
| | | @search-change="searchChange" |
| | | @search-reset="searchReset" |
| | | @selection-change="selectionChange" |
| | | @row-click="clickRowChange" |
| | | @current-change="currentChange" |
| | | @size-change="sizeChange" |
| | | @refresh-change="refreshChange" |
| | | @on-load="onLoad" |
| | | @tree-load="treeLoad"> |
| | | <template slot="menu" slot-scope="scope"> |
| | | <el-button |
| | | icon="el-icon-download el-icon--right" |
| | | size="small" |
| | | type="text" |
| | | :loading="downloadLoading" |
| | | @click="downLoadLogFile(scope.row)" |
| | | v-if="permissionList.downLoadBtn" |
| | | >下载 |
| | | </el-button> |
| | | </template> |
| | | </avue-crud> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script> |
| | | import {getLazyList, deleteLocalLog,downLoadLog} from "@/api/logs"; |
| | | import func from "@/util/func"; |
| | | import {mapGetters} from "vuex"; |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | form: {}, |
| | | selectionList: [], |
| | | query: {}, |
| | | logPath: "", |
| | | loading: true, |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0 |
| | | }, |
| | | option: { |
| | | height: "auto", |
| | | lazy: true, |
| | | columnBtn: false, |
| | | tip: false, |
| | | searchShow: true, |
| | | searchMenuSpan: 6, |
| | | tree: true, |
| | | border: true, |
| | | index: true, |
| | | selection: true, |
| | | editBtn: false, |
| | | delBtn: true, |
| | | addBtn: false, |
| | | viewBtn: false, |
| | | // menuWidth: 300, |
| | | dialogClickModal: false, |
| | | highlightCurrentRow: true, //行选中时高亮 |
| | | rowKey: "logName", //行数据的 Key,用来优化 Table 的渲染 |
| | | column: [ |
| | | { |
| | | label: "服务名称", |
| | | prop: "serviceName", |
| | | width:'120', |
| | | search: true |
| | | }, |
| | | { |
| | | label: "服务ID", |
| | | prop: "serviceId", |
| | | search: true |
| | | }, |
| | | { |
| | | label: "日志路径", |
| | | prop: "logPath", |
| | | width:'160' |
| | | }, |
| | | { |
| | | label: "日志名称", |
| | | prop: "logName", |
| | | width:'80', |
| | | }, |
| | | { |
| | | label: "日志类型", |
| | | prop: "logType" |
| | | }, |
| | | { |
| | | label: "创建时间", |
| | | prop: "createTime", |
| | | width:'180' |
| | | }, |
| | | { |
| | | label: "最后修改时间", |
| | | prop: "lastModifier", |
| | | width:'180' |
| | | } |
| | | ] |
| | | }, |
| | | data: [], |
| | | downloadLoading: false, |
| | | }; |
| | | }, |
| | | computed: { |
| | | ...mapGetters(["permission"]), |
| | | permissionList() { |
| | | return { |
| | | delBtn: this.vaildData(this.permission.localLog.localLog_delete, false), |
| | | downLoadBtn: this.vaildData(this.permission.localLog.localLog_dwonload, false) |
| | | }; |
| | | } |
| | | }, |
| | | methods: { |
| | | <basic-container> |
| | | <avue-crud ref="crud" |
| | | v-model="form" |
| | | :before-close="beforeClose" |
| | | :before-open="beforeOpen" |
| | | :data="data" |
| | | :option="option" |
| | | :permission="permissionList" |
| | | :table-loading="loading" |
| | | @row-del="rowDel" |
| | | @search-change="searchChange" |
| | | @search-reset="searchReset" |
| | | @selection-change="selectionChange" |
| | | @row-click="clickRowChange" |
| | | @current-change="currentChange" |
| | | @size-change="sizeChange" |
| | | @refresh-change="refreshChange" |
| | | @on-load="onLoad" |
| | | @tree-load="treeLoad"> |
| | | <template slot="menu" slot-scope="scope"> |
| | | <el-button |
| | | icon="el-icon-download el-icon--right" |
| | | size="small" |
| | | type="text" |
| | | :loading="downloadLoading" |
| | | @click="downLoadLogFile(scope.row)" |
| | | v-if="permissionList.downLoadBtn" |
| | | >下载 |
| | | </el-button> |
| | | </template> |
| | | </avue-crud> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | downLoadLogFile(row){ |
| | | this.downloadLoading = true; |
| | | let logPath = row.hasChildren ? row.logPath:row.logPath+"\\"+row.logName; |
| | | downLoadLog(Object.assign({},row,{logFullPaths:logPath})).then(res=>{ |
| | | func.downloadFileByBlobHandler(res); |
| | | this.downloadLoading = false; |
| | | }).catch((res)=>{ |
| | | //this.$message.warning(res) |
| | | this.downloadLoading = false; |
| | | }) |
| | | <script> |
| | | import {getLazyList, deleteLocalLog,downLoadLog} from "@/api/logs"; |
| | | import func from "@/util/func"; |
| | | import {mapGetters} from "vuex"; |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | form: {}, |
| | | selectionList: [], |
| | | query: {}, |
| | | logPath: "", |
| | | loading: true, |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0 |
| | | }, |
| | | // 行删除 |
| | | rowDel(row, index, done) { |
| | | this.$confirm("确定将选择的日志文件删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | let logPath = row.hasChildren ? row.logPath:row.logPath+"\\"+row.logName; |
| | | return deleteLocalLog(Object.assign({},row,{logFullPaths:logPath})); |
| | | }) |
| | | .then(() => { |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | // 数据回调进行刷新 |
| | | done(row); |
| | | //this.onLoad(); |
| | | }); |
| | | option: { |
| | | height: "auto", |
| | | lazy: true, |
| | | columnBtn: false, |
| | | tip: false, |
| | | searchShow: true, |
| | | searchMenuSpan: 6, |
| | | tree: true, |
| | | border: true, |
| | | index: true, |
| | | selection: true, |
| | | editBtn: false, |
| | | delBtn: true, |
| | | addBtn: false, |
| | | viewBtn: false, |
| | | // menuWidth: 300, |
| | | dialogClickModal: false, |
| | | highlightCurrentRow: true, //行选中时高亮 |
| | | rowKey: "logName", //行数据的 Key,用来优化 Table 的渲染 |
| | | column: [ |
| | | { |
| | | label: "服务名称", |
| | | prop: "serviceName", |
| | | width:'120', |
| | | search: true |
| | | }, |
| | | { |
| | | label: "服务ID", |
| | | prop: "serviceId", |
| | | search: true |
| | | }, |
| | | { |
| | | label: "日志路径", |
| | | prop: "logPath", |
| | | width:'160' |
| | | }, |
| | | { |
| | | label: "日志名称", |
| | | prop: "logName", |
| | | width:'80', |
| | | }, |
| | | { |
| | | label: "日志类型", |
| | | prop: "logType" |
| | | }, |
| | | { |
| | | label: "创建时间", |
| | | prop: "createTime", |
| | | width:'180' |
| | | }, |
| | | { |
| | | label: "最后修改时间", |
| | | prop: "lastModifier", |
| | | width:'180' |
| | | } |
| | | ] |
| | | }, |
| | | searchReset() { |
| | | this.query = {}; |
| | | this.parentId = 0; |
| | | this.onLoad(this.page); |
| | | }, |
| | | searchChange(params, done) { |
| | | this.query = params; |
| | | this.parentId = ''; |
| | | this.page.currentPage = 1; |
| | | this.onLoad(this.page, params); |
| | | done(); |
| | | }, |
| | | clickRowChange(row) { |
| | | this.$refs.crud.toggleSelection(); |
| | | this.selectionList = row; |
| | | this.$refs.crud.setCurrentRow(row); |
| | | this.$refs.crud.toggleRowSelection(row); //选中当前行 |
| | | }, |
| | | selectionChange(list) { |
| | | this.selectionList = list; |
| | | this.$refs.crud.setCurrentRow(this.selectionList[list.length - 1]); |
| | | }, |
| | | selectionClear() { |
| | | this.selectionList = []; |
| | | this.$refs.crud.toggleSelection(); |
| | | }, |
| | | refreshChange() { |
| | | this.onLoad(this.page, this.query); |
| | | }, |
| | | onLoad(page, params = {}) { |
| | | this.loading = true; |
| | | //Object.assign(params, this.query) |
| | | getLazyList({"logPath": this.logPath}).then(res => { |
| | | this.data = res.data.data; |
| | | this.loading = false; |
| | | this.selectionClear(); |
| | | }); |
| | | }, |
| | | treeLoad(tree, treeNode, resolve) { |
| | | const logPath = tree.logPath; |
| | | getLazyList({"logPath": logPath}).then(res => { |
| | | resolve(res.data.data); |
| | | }); |
| | | } |
| | | data: [], |
| | | downloadLoading: false, |
| | | }; |
| | | }, |
| | | computed: { |
| | | ...mapGetters(["permission"]), |
| | | permissionList() { |
| | | return { |
| | | delBtn: this.vaildData(this.permission.localLog.localLog_delete, false), |
| | | downLoadBtn: this.vaildData(this.permission.localLog.localLog_dwonload, false) |
| | | }; |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style> |
| | | </style> |
| | | |
| | | }, |
| | | methods: { |
| | | |
| | | downLoadLogFile(row){ |
| | | this.downloadLoading = true; |
| | | let logPath = row.hasChildren ? row.logPath:row.logPath+"\\"+row.logName; |
| | | downLoadLog(Object.assign({},row,{logFullPaths:logPath})).then(res=>{ |
| | | func.downloadFileByBlobHandler(res); |
| | | this.downloadLoading = false; |
| | | }).catch((res)=>{ |
| | | //this.$message.warning(res) |
| | | this.downloadLoading = false; |
| | | }) |
| | | }, |
| | | // 行删除 |
| | | rowDel(row, index, done) { |
| | | this.$confirm("确定将选择的日志文件删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | let logPath = row.hasChildren ? row.logPath:row.logPath+"\\"+row.logName; |
| | | return deleteLocalLog(Object.assign({},row,{logFullPaths:logPath})); |
| | | }) |
| | | .then(() => { |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | // 数据回调进行刷新 |
| | | done(row); |
| | | //this.onLoad(); |
| | | }); |
| | | }, |
| | | searchReset() { |
| | | this.query = {}; |
| | | this.parentId = 0; |
| | | this.onLoad(this.page); |
| | | }, |
| | | searchChange(params, done) { |
| | | this.query = params; |
| | | this.parentId = ''; |
| | | this.page.currentPage = 1; |
| | | this.onLoad(this.page, params); |
| | | done(); |
| | | }, |
| | | clickRowChange(row) { |
| | | this.$refs.crud.toggleSelection(); |
| | | this.selectionList = row; |
| | | this.$refs.crud.setCurrentRow(row); |
| | | this.$refs.crud.toggleRowSelection(row); //选中当前行 |
| | | }, |
| | | selectionChange(list) { |
| | | this.selectionList = list; |
| | | this.$refs.crud.setCurrentRow(this.selectionList[list.length - 1]); |
| | | }, |
| | | selectionClear() { |
| | | this.selectionList = []; |
| | | this.$refs.crud.toggleSelection(); |
| | | }, |
| | | refreshChange() { |
| | | this.onLoad(this.page, this.query); |
| | | }, |
| | | onLoad(page, params = {}) { |
| | | this.loading = true; |
| | | //Object.assign(params, this.query) |
| | | getLazyList({"logPath": this.logPath}).then(res => { |
| | | this.data = res.data.data; |
| | | this.loading = false; |
| | | this.selectionClear(); |
| | | }); |
| | | }, |
| | | treeLoad(tree, treeNode, resolve) { |
| | | const logPath = tree.logPath; |
| | | getLazyList({"logPath": logPath}).then(res => { |
| | | resolve(res.data.data); |
| | | }); |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style> |
| | | </style> |