Commit a6c479ee by 陈岩

fix: 修复系统日志

1 parent 6578b62b
......@@ -179,217 +179,217 @@
<!-- &lt;!&ndash; <moreDialog ref='moreDialogRef'></moreDialog> &ndash;&gt;-->
<!--</template>-->
<!--<script>-->
<!--import {reactive, ref, toRaw} from 'vue'-->
<!--import moment from 'moment'-->
<!--import SystemLogApi from '@/views/SystemLog/SystemLog.js'-->
<!--import {isArray} from '@/PublicUtil/Judgment'-->
<!--import {filterEmptyValueInObject, formatDate, formatTime} from '@/PublicUtil/PublicUtil'-->
<!--import {PlusOutlined} from '@ant-design/icons-vue'-->
<!--import moreDialog from './moreDialog.vue'-->
<!--export default {-->
<!-- components: {-->
<!-- PlusOutlined,-->
<!-- VNodes: (_, {attrs}) => {-->
<!-- return attrs.vnodes-->
<!-- },-->
<!-- moreDialog-->
<!-- },-->
<!-- setup() {-->
<!-- const columns = ref([-->
<!-- {-->
<!-- title: '时间',-->
<!-- dataIndex: 'time',-->
<!-- align: 'center',-->
<!-- width: 220-->
<!-- },-->
<!-- {-->
<!-- title: '线程号',-->
<!-- dataIndex: 'thread',-->
<!-- align: 'center',-->
<!-- width: 120-->
<!-- },-->
<!-- {-->
<!-- title: '日志位置',-->
<!-- dataIndex: 'location',-->
<!-- align: 'center',-->
<!-- width: 300-->
<!-- },-->
<!-- {-->
<!-- title: '日志内容',-->
<!-- dataIndex: 'content',-->
<!-- align: 'center',-->
<!-- customRender:({text,record})=>{-->
<!-- const rawData = toRaw(queryForm)-->
<!-- if (rawData.content_like && rawData.content_like !== '') {-->
<!-- text = text.split(rawData.content_like).join("<span style='color:red;'>" + rawData.content_like + "</span>")-->
<!-- // console.log(str)-->
<!-- // let pHtml = document.createElement("p");-->
<!-- return (<p v-html='str'>{text}</p>)-->
<!-- }else{-->
<!-- return text-->
<!-- }-->
<!-- }-->
<!-- },-->
<!-- // {-->
<!-- // title: '日志标识',-->
<!-- // dataIndex: 'id',-->
<!-- // align: 'center',-->
<!-- // }-->
<!-- ])-->
<!-- //ref-->
<!-- const moreDialogRef = ref()-->
<!-- // scalar-->
<!-- const isLoading = ref(false)-->
<!-- const isSuspended = ref(false)-->
<!-- const pageNum = ref(1)-->
<!-- const pageSize = ref(20)-->
<!-- const total = ref()-->
<!-- // sequence-->
<!-- const dataList = ref([])-->
<!-- const apptypeList = ref([{-->
<!-- value: 'store',-->
<!-- label: 'store',-->
<!-- },{-->
<!-- value: 'mall',-->
<!-- label: 'mall',-->
<!-- }])-->
<!-- const appnameList = ref([{-->
<!-- value: 'process',-->
<!-- label: 'process',-->
<!-- },{-->
<!-- value: 'receive',-->
<!-- label: 'receive',-->
<!-- },{-->
<!-- value: 'report',-->
<!-- label: 'report',-->
<!-- },{-->
<!-- value: 'openapi',-->
<!-- label: 'openapi',-->
<!-- }])-->
<!-- const levelList = ref([{-->
<!-- value: 'info',-->
<!-- label: 'info',-->
<!-- },{-->
<!-- value: 'error',-->
<!-- label: 'error',-->
<!-- },{-->
<!-- value: 'debug',-->
<!-- label: 'debug',-->
<!-- },{-->
<!-- value: 'warn',-->
<!-- label: 'warn',-->
<!-- }])-->
<!-- const queryForm = reactive(-->
<!-- {-->
<!-- // apptype:'store',-->
<!-- appname: 'process',-->
<!-- levels: ['info','error','debug','warn'],-->
<!-- content_like: '',-->
<!-- date: moment(moment().format('YYYY-MM-DD'), 'YYYY-MM-DD'),-->
<!-- startTime: moment('00:00:00', 'HH:mm:ss'),-->
<!-- endTime: moment('23:59:59', 'HH:mm:ss'),-->
<!-- }-->
<!-- )-->
<!-- const onPageNumChange = function(num) {-->
<!-- pageNum.value = num-->
<!-- confirmSearch()-->
<!-- }-->
<!-- -->
<!-- const onPageSizeChange = function(current, size) {-->
<!-- pageNum.value = 1-->
<!-- pageSize.value = size-->
<!-- confirmSearch()-->
<!-- }-->
<!-- const confirmSearch = function(val){-->
<!-- isLoading.value = true-->
<!-- const rawData = toRaw(queryForm)-->
<!-- pageNum.value = val?1:pageNum.value-->
<!-- const data = filterEmptyValueInObject(-->
<!-- {-->
<!-- // apptype: rawData.apptype,-->
<!-- appname: rawData.appname,-->
<!-- levels: rawData.levels?rawData.levels.toString():null,-->
<!-- content_like: rawData.content_like,-->
<!-- startTime: formatDate(rawData.date) + ' ' + formatTime(rawData.startTime),-->
<!-- endTime: formatDate(rawData.date) + ' ' + formatTime(rawData.endTime),-->
<!-- page: pageNum.value,-->
<!-- pageSize: pageSize.value,-->
<!-- }-->
<!-- )-->
<!-- SystemLogApi.getLogSelect(data).then(-->
<!-- (r) => {-->
<!-- isLoading.value = false-->
<!-- dataList.value = []-->
<!-- if(r.code==200){-->
<!-- // r.forEach((item,index)=>{-->
<!-- // item.index = index+1-->
<!-- // })-->
<!-- if(r.data){-->
<!-- dataList.value = r.data.list-->
<!-- total.value = r.data.total-->
<!-- }-->
<!-- -->
<!-- }-->
<!-- -->
<!-- }-->
<!-- )-->
<!-- }-->
<!-- const stringFormatter = function(text){-->
<!-- const rawData = toRaw(queryForm)-->
<!-- if (rawData.content_like && rawData.content_like !== '') {-->
<!-- let str = text.split(rawData.content_like).join("<span style='color:red;'>" + rawData.content_like + "</span>")-->
<!-- return str-->
<!-- }else{-->
<!-- return text-->
<!-- }-->
<!-- }-->
<!-- const contentHeight = ref(0)-->
<!-- const __main = function() {-->
<!-- contentHeight.value = window.innerHeight - 230-->
<!-- // confirmSearch()-->
<!-- }-->
<!-- const confirmSearch1 = function(){-->
<!-- moreDialogRef.value.initDialog();-->
<!-- }-->
<!-- __main()-->
<!-- return {-->
<!-- // scalar-->
<!-- isLoading,-->
<!-- pageNum,-->
<!-- pageSize,-->
<!-- total,-->
<!-- contentHeight,-->
<!-- // sequence-->
<!-- apptypeList,-->
<!-- appnameList,-->
<!-- levelList,-->
<!-- dataList,-->
<!-- queryForm,-->
<!-- columns,-->
<!-- // function-->
<!-- confirmSearch,-->
<!-- confirmSearch1,-->
<!-- stringFormatter,-->
<!-- onPageNumChange,-->
<!-- onPageSizeChange,-->
<!-- //ref-->
<!-- moreDialogRef-->
<!-- }-->
<!-- }-->
<!--}-->
<!--</script>-->
<script lang="jsx">
import {reactive, ref, toRaw} from 'vue'
import moment from 'moment'
import SystemLogApi from '@/views/SystemLog/SystemLog.js'
import {isArray} from '@/PublicUtil/Judgment'
import {filterEmptyValueInObject, formatDate, formatTime} from '@/PublicUtil/PublicUtil'
import {PlusOutlined} from '@ant-design/icons-vue'
import moreDialog from './moreDialog.vue'
export default {
components: {
PlusOutlined,
VNodes: (_, {attrs}) => {
return attrs.vnodes
},
moreDialog
},
setup() {
const columns = ref([
{
title: '时间',
dataIndex: 'time',
align: 'center',
width: 220
},
{
title: '线程号',
dataIndex: 'thread',
align: 'center',
width: 120
},
{
title: '日志位置',
dataIndex: 'location',
align: 'center',
width: 300
},
{
title: '日志内容',
dataIndex: 'content',
align: 'center',
customRender:({text,record})=>{
const rawData = toRaw(queryForm)
if (rawData.content_like && rawData.content_like !== '') {
text = text.split(rawData.content_like).join("<span style='color:red;'>" + rawData.content_like + "</span>")
// console.log(str)
// let pHtml = document.createElement("p");
return (<p v-html='str'>{text}</p>)
}else{
return text
}
}
},
// {
// title: '日志标识',
// dataIndex: 'id',
// align: 'center',
// }
])
//ref
const moreDialogRef = ref()
// scalar
const isLoading = ref(false)
const isSuspended = ref(false)
const pageNum = ref(1)
const pageSize = ref(20)
const total = ref()
// sequence
const dataList = ref([])
const apptypeList = ref([{
value: 'store',
label: 'store',
},{
value: 'mall',
label: 'mall',
}])
const appnameList = ref([{
value: 'process',
label: 'process',
},{
value: 'receive',
label: 'receive',
},{
value: 'report',
label: 'report',
},{
value: 'openapi',
label: 'openapi',
}])
const levelList = ref([{
value: 'info',
label: 'info',
},{
value: 'error',
label: 'error',
},{
value: 'debug',
label: 'debug',
},{
value: 'warn',
label: 'warn',
}])
const queryForm = reactive(
{
// apptype:'store',
appname: 'process',
levels: ['info','error','debug','warn'],
content_like: '',
date: moment(moment().format('YYYY-MM-DD'), 'YYYY-MM-DD'),
startTime: moment('00:00:00', 'HH:mm:ss'),
endTime: moment('23:59:59', 'HH:mm:ss'),
}
)
const onPageNumChange = function(num) {
pageNum.value = num
confirmSearch()
}
const onPageSizeChange = function(current, size) {
pageNum.value = 1
pageSize.value = size
confirmSearch()
}
const confirmSearch = function(val){
isLoading.value = true
const rawData = toRaw(queryForm)
pageNum.value = val?1:pageNum.value
const data = filterEmptyValueInObject(
{
// apptype: rawData.apptype,
appname: rawData.appname,
levels: rawData.levels?rawData.levels.toString():null,
content_like: rawData.content_like,
startTime: formatDate(rawData.date) + ' ' + formatTime(rawData.startTime),
endTime: formatDate(rawData.date) + ' ' + formatTime(rawData.endTime),
page: pageNum.value,
pageSize: pageSize.value,
}
)
SystemLogApi.getLogSelect(data).then(
(r) => {
isLoading.value = false
dataList.value = []
if(r.code==200){
// r.forEach((item,index)=>{
// item.index = index+1
// })
if(r.data){
dataList.value = r.data.list
total.value = r.data.total
}
}
}
)
}
const stringFormatter = function(text){
const rawData = toRaw(queryForm)
if (rawData.content_like && rawData.content_like !== '') {
let str = text.split(rawData.content_like).join("<span style='color:red;'>" + rawData.content_like + "</span>")
return str
}else{
return text
}
}
const contentHeight = ref(0)
const __main = function() {
contentHeight.value = window.innerHeight - 230
// confirmSearch()
}
const confirmSearch1 = function(){
moreDialogRef.value.initDialog();
}
__main()
return {
// scalar
isLoading,
pageNum,
pageSize,
total,
contentHeight,
// sequence
apptypeList,
appnameList,
levelList,
dataList,
queryForm,
columns,
// function
confirmSearch,
confirmSearch1,
stringFormatter,
onPageNumChange,
onPageSizeChange,
//ref
moreDialogRef
}
}
}
</script>
<!--<style lang="less" scoped>-->
<!-- .success {-->
<!-- color: #26ff29;-->
<!-- }-->
<!-- // /deep/.el-table{-->
<!-- // th,tr{-->
<!-- // background-color: #fafafa;-->
<!-- // }-->
<!-- // }-->
<!-- .failed {-->
<!-- color: red;-->
<!-- }-->
<!--</style>-->
<style lang="less" scoped>
.success {
color: #26ff29;
}
// /deep/.el-table{
// th,tr{
// background-color: #fafafa;
// }
// }
.failed {
color: red;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!