feat: 新增文件操作日志

This commit is contained in:
jmal 2024-12-26 11:35:19 +08:00
parent 34b9aea589
commit 5630cc65c9
2 changed files with 41 additions and 17 deletions

View File

@ -111,7 +111,10 @@ export default {
label: '登录' label: '登录'
}, { }, {
value: 'OPERATION', value: 'OPERATION',
label: '操作' label: '系统操作'
}, {
value: 'OPERATION_FILE',
label: '文件操作'
}, { }, {
value: 'ARTICLE', value: 'ARTICLE',
label: '文章' label: '文章'
@ -180,17 +183,37 @@ export default {
this.queryCondition.type = this.typeValue this.queryCondition.type = this.typeValue
if (this.typeValue === 'ARTICLE') { if (this.typeValue === 'ARTICLE') {
this.tableHeader[0].disabled = true this.tableHeader[0].disabled = true
this.tableHeader[1].disabled = true this.tableHeader[1].disabled = false
this.tableHeader[3].disabled = true this.tableHeader[2].disabled = true
this.tableHeader[5].minWidth = 200 this.tableHeader[3].disabled = false
this.tableHeader[4].disabled = false
this.tableHeader[5].disabled = false
this.tableHeader[6].disabled = false
this.tableHeader[7].disabled = false
} else if (this.typeValue === 'OPERATION_FILE') {
this.operationFileType()
} else { } else {
this.tableHeader[0].disabled = false this.tableHeader[0].disabled = false
this.tableHeader[1].disabled = false this.tableHeader[1].disabled = false
this.tableHeader[2].disabled = true
this.tableHeader[3].disabled = false this.tableHeader[3].disabled = false
this.tableHeader[5].minWidth = 105 this.tableHeader[4].disabled = false
this.tableHeader[5].disabled = false
this.tableHeader[6].disabled = false
this.tableHeader[7].disabled = false
} }
this.queryLogList() this.queryLogList()
}, },
operationFileType() {
this.tableHeader[0].disabled = false
this.tableHeader[1].disabled = false
this.tableHeader[2].disabled = false
this.tableHeader[3].disabled = false
this.tableHeader[4].disabled = true
this.tableHeader[5].disabled = true
this.tableHeader[6].disabled = true
this.tableHeader[7].disabled = false
},
queryLogList(val) { queryLogList(val) {
this.$refs.tableList.initPageIndex() this.$refs.tableList.initPageIndex()
this.getLogList() this.getLogList()
@ -200,6 +223,9 @@ export default {
this.queryCondition.startTime = this.pickerValue[0].getTime() this.queryCondition.startTime = this.pickerValue[0].getTime()
this.queryCondition.endTime = this.pickerValue[1].getTime() this.queryCondition.endTime = this.pickerValue[1].getTime()
} }
if (this.typeValue === 'OPERATION_FILE') {
this.operationFileType()
}
this.loading = true this.loading = true
logApi.logList({ logApi.logList({
page: this.pagination.pageIndex, page: this.pagination.pageIndex,

View File

@ -63,7 +63,7 @@
<el-button size="small" @click="dialogVisible = false">关闭</el-button> <el-button size="small" @click="dialogVisible = false">关闭</el-button>
</div> </div>
</el-dialog> </el-dialog>
<log-list type="OPERATION" :table-header="tableHeader"></log-list> <log-list type="OPERATION_FILE" :table-header="tableHeader"></log-list>
</div> </div>
</template> </template>
@ -77,15 +77,13 @@ export default {
data() { data() {
return { return {
tableHeader: [ tableHeader: [
{prop: 'username', label: '账号', minWidth: 105, sortable: 'custom'}, {prop: 'username', label: '账号', width: 105, sortable: 'custom'},
{prop: 'showName', label: '用户名', minWidth: 105, sortable: 'custom'}, {prop: 'ip', label: 'IP地址', width: 130, sortable: 'custom'},
{prop: 'ip', label: 'IP地址', minWidth: 105, sortable: 'custom'}, {prop: 'filepath', label: '文件', sortable: 'custom'},
{prop: 'operationModule', label: '操作模块', minWidth: 105, sortable: 'custom'}, {prop: 'operationFun', label: '操作功能', sortable: 'custom'},
{prop: 'operationFun', label: '操作功能', minWidth: 105, sortable: 'custom'}, {prop: 'url', label: '请求地址', sortable: 'custom'},
{prop: 'url', label: '请求地址', minWidth: 105, sortable: 'custom'},
{prop: 'method', label: '方式', minWidth: 75, sortable: 'custom'},
{ {
prop: 'status', minWidth: 75, label: '状态', tag: true, sortable: 'custom', prop: 'status', width: 75, label: '状态', tag: true, sortable: 'custom',
formatData: (status) => { formatData: (status) => {
if (status === 0) { if (status === 0) {
return [{name: '正常', type: 'success'}] return [{name: '正常', type: 'success'}]
@ -95,14 +93,14 @@ export default {
} }
}, },
{ {
prop: 'time', label: '耗时', minWidth: 75, sortable: 'custom', prop: 'time', label: '耗时', width: 100, sortable: 'custom',
formatData: (time) => { formatData: (time) => {
return time + 'ms' return time + 'ms'
} }
}, },
{prop: 'createTime', label: '创建时间', minWidth: 150, sortable: 'custom'}, {prop: 'createTime', label: '时间', width: 170, sortable: 'custom'},
{ {
label: '操作', minWidth: 75, active: [ label: '操作', width: 80, active: [
{name: '详情', icon: 'el-icon-view', handle: (row) => this.details(row)}, {name: '详情', icon: 'el-icon-view', handle: (row) => this.details(row)},
], ],
}, },