添加日志功能
This commit is contained in:
@@ -142,3 +142,11 @@ export function updateRunFlagManage(data: any) {
|
||||
data
|
||||
})
|
||||
}
|
||||
//设置终端日志
|
||||
export function getList(data: any) {
|
||||
return createAxios({
|
||||
url: '/device-boot/pqsTerminalLogs/getList',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
<template>
|
||||
<el-dialog draggable v-model="dialogVisible" v-if="dialogVisible" :title="title" width="1000px" @close="emit('close')">
|
||||
<div class="mb10 flex ">
|
||||
<DatePicker ref="datePickerRef" ></DatePicker>
|
||||
<el-button type="primary" icon="el-icon-Search" @click="source">查询</el-button>
|
||||
</div>
|
||||
<div v-loading="loading">
|
||||
<vxe-table v-bind="defaultAttribute" height="400" :data="tableData">
|
||||
<vxe-column field="logsType" title="日志类型" width="150">
|
||||
<template #default="{ row }">
|
||||
{{ fontdveoption.find((item: any) => item.id == row.logsType)?.name }}
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="createBy" title="更改人员" width="150"></vxe-column>
|
||||
<vxe-column field="updateTime" title="更改时间" width="150"></vxe-column>
|
||||
<vxe-column field="terminalDescribe" title="描述"></vxe-column>
|
||||
</vxe-table>
|
||||
<el-pagination
|
||||
class="mt10"
|
||||
:currentPage="form.pageNum"
|
||||
:page-size="form.pageSize"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
background
|
||||
:layout="'sizes,total, ->, prev, pager, next, jumper'"
|
||||
:total="total"
|
||||
@size-change="onTableSizeChange"
|
||||
@current-change="onTableCurrentChange"
|
||||
></el-pagination>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive } from 'vue'
|
||||
import { defaultAttribute } from '@/components/table/defaultAttribute'
|
||||
import { getList } from '@/api/device-boot/Business'
|
||||
import { useDictData } from '@/stores/dictData'
|
||||
import DatePicker from '@/components/form/datePicker/index.vue'
|
||||
const emit = defineEmits(['close'])
|
||||
const title = ref('')
|
||||
const total = ref(0)
|
||||
const datePickerRef = ref()
|
||||
const dialogVisible = ref(false)
|
||||
const tableData = ref([])
|
||||
const dictData = useDictData()
|
||||
const fontdveoption = dictData.getBasicData('Dev_Ops')
|
||||
const form = reactive({
|
||||
id: '',
|
||||
pageNum: 1,
|
||||
pageSize: 10
|
||||
})
|
||||
const loading = ref(false)
|
||||
const open = (e: any) => {
|
||||
title.value = e.name + '_日志'
|
||||
form.id = e.id
|
||||
|
||||
dialogVisible.value = true
|
||||
setTimeout(() => {
|
||||
source()
|
||||
}, 500)
|
||||
}
|
||||
const source = () => {
|
||||
loading.value = true
|
||||
getList({
|
||||
...form,
|
||||
searchBeginTime: datePickerRef.value.timeValue[0],
|
||||
searchEndTime: datePickerRef.value.timeValue[1]
|
||||
}).then(res => {
|
||||
total.value = res.data.total
|
||||
tableData.value = res.data.records
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
// 分页
|
||||
const onTableSizeChange = (val: number) => {
|
||||
form.pageSize = val
|
||||
source()
|
||||
}
|
||||
|
||||
const onTableCurrentChange = (val: number) => {
|
||||
form.pageNum = val
|
||||
source()
|
||||
}
|
||||
|
||||
const cancel = () => {
|
||||
dialogVisible.value = false
|
||||
}
|
||||
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.flex{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
</style>
|
||||
@@ -82,10 +82,13 @@
|
||||
min-width="200"
|
||||
tree-node
|
||||
></vxe-column>
|
||||
<vxe-column field="devType" title="终端型号"></vxe-column>
|
||||
<vxe-column field="devType" title="终端型号">
|
||||
<template #default="{ row }">
|
||||
{{ teriminaloption.find((item: any) => item.id === row.devType)?.name }}
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="version" title="版本信息"></vxe-column>
|
||||
<vxe-column field="ip" title="网络参数"></vxe-column>
|
||||
<vxe-column field="devType" title="终端型号"></vxe-column>
|
||||
<vxe-column field="baseFlowMeal" title="基础套餐(MB)"></vxe-column>
|
||||
<vxe-column field="reamFlowMeal" title="扩展套餐(MB)"></vxe-column>
|
||||
<vxe-column title="剩余流量(MB)">
|
||||
@@ -122,29 +125,24 @@
|
||||
</template>
|
||||
</vxe-column>
|
||||
|
||||
<!-- <vxe-column title="操作" width="160">
|
||||
<vxe-column title="操作" width="160">
|
||||
<template #default="{ row }">
|
||||
<el-button v-if="row.level === 4" type="primary" size="small" link @click="uesdealia(row)">
|
||||
<!-- <el-button v-if="row.level === 4" type="primary" size="small" link @click="uesdealia(row)">
|
||||
终端详情
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.level === 4"
|
||||
:disabled="row.state == 1 ? true : false"
|
||||
type="primary"
|
||||
size="small"
|
||||
link
|
||||
@click="queryview(row)"
|
||||
>
|
||||
流量详情
|
||||
</el-button> -->
|
||||
<el-button v-if="row.level === 4" type="primary" size="small" link @click="log(row)">
|
||||
查看日志
|
||||
</el-button>
|
||||
</template>
|
||||
</vxe-column> -->
|
||||
</vxe-column>
|
||||
</vxe-table>
|
||||
</div>
|
||||
<!-- 终端详情 -->
|
||||
<detail ref="detailRef" />
|
||||
<!-- 配置 -->
|
||||
<disposition ref="dispositionRef" @onSubmit="tableStore.index()" />
|
||||
<!-- 日志 -->
|
||||
<Log ref="logRef" v-if="logFlag" @close="logFlag = false" />
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
@@ -156,8 +154,10 @@ import { ElMessage } from 'element-plus'
|
||||
import { getDevTypeList } from '@/api/device-boot/modelManage'
|
||||
import XEUtils from 'xe-utils'
|
||||
import { debounce } from 'lodash-es'
|
||||
|
||||
import disposition from './components/disposition.vue'
|
||||
import detail from './components/detail.vue'
|
||||
import Log from './components/log.vue'
|
||||
import { useDictData } from '@/stores/dictData'
|
||||
|
||||
defineOptions({
|
||||
@@ -165,8 +165,9 @@ defineOptions({
|
||||
})
|
||||
const dispositionRef = ref()
|
||||
const detailRef = ref()
|
||||
const logRef = ref()
|
||||
const dictData = useDictData()
|
||||
|
||||
const logFlag = ref(false)
|
||||
const teriminaloption: any = ref([])
|
||||
|
||||
const teriminalstatusoption = ref([
|
||||
@@ -180,7 +181,6 @@ const stateoption = ref([
|
||||
{ name: '正常', id: 1 },
|
||||
{ name: '中断', id: 0 }
|
||||
])
|
||||
|
||||
const treeData: any = ref([])
|
||||
const treeDataCopy: any = ref([])
|
||||
|
||||
@@ -233,6 +233,7 @@ onMounted(() => {
|
||||
getDevTypeList().then(res => {
|
||||
teriminaloption.value = res.data
|
||||
})
|
||||
|
||||
tableStore.index()
|
||||
})
|
||||
|
||||
@@ -269,7 +270,12 @@ const uesdealia = (row: any) => {
|
||||
detailRef.value.open(row)
|
||||
}
|
||||
// 流量详情
|
||||
const queryview = (row: any) => {}
|
||||
const log = (row: any) => {
|
||||
logFlag.value = true
|
||||
setTimeout(() => {
|
||||
logRef.value.open(row)
|
||||
}, 100)
|
||||
}
|
||||
|
||||
// 表格过滤
|
||||
const searchEvent = debounce(() => {
|
||||
|
||||
@@ -6,15 +6,19 @@
|
||||
v-model:file-list="reportPath"
|
||||
ref="uploadRef"
|
||||
action=""
|
||||
accept=""
|
||||
:limit="1"
|
||||
accept=".xml"
|
||||
:on-exceed="handleExceed"
|
||||
:auto-upload="false"
|
||||
:on-remove="removeFile"
|
||||
:on-change="choose"
|
||||
>
|
||||
<template #trigger>
|
||||
<el-button type="primary">上传文件</el-button>
|
||||
</template>
|
||||
<template #tip>
|
||||
<div>请上传xml文件</div>
|
||||
</template>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@@ -64,9 +68,37 @@ const open = (text: string, data?: any) => {
|
||||
form.id = data?.id
|
||||
form.filePath = data?.path
|
||||
}
|
||||
// 上传报告
|
||||
const uploadRef = ref()
|
||||
/**
|
||||
* 选择待上传文件
|
||||
*/
|
||||
const choose = (e: any) => {
|
||||
const file = e.raw
|
||||
if (!isValidFile(file)) {
|
||||
uploadRef.value!.clearFiles()
|
||||
form.filePath = []
|
||||
return
|
||||
}
|
||||
form.filePath.file = file
|
||||
}
|
||||
/**
|
||||
* 文件校验函数
|
||||
*/
|
||||
const isValidFile = (file: UploadRawFile) => {
|
||||
const validExtensions = ['.xml']
|
||||
const fileExtension = file.name.slice(((file.name.lastIndexOf('.') - 1) >>> 0) + 2)
|
||||
if (!validExtensions.includes(`.${fileExtension}`)) {
|
||||
ElMessage.error('文件类型不支持,请选择 .xml')
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
// 上传报告
|
||||
|
||||
const handleExceed: UploadProps['onExceed'] = files => {
|
||||
console.log('🚀 ~ files:', files)
|
||||
|
||||
uploadRef.value!.clearFiles()
|
||||
const file = files[0] as UploadRawFile
|
||||
file.uid = genFileId()
|
||||
@@ -89,8 +121,8 @@ const submit = async () => {
|
||||
form.fileName = res.data.fileName.split('.')[0]
|
||||
form.filePath = res.data.name
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (title.value == '新增icd文件') {
|
||||
await addIcdPath(form).then(res => {
|
||||
ElMessage.success('新增成功!')
|
||||
|
||||
@@ -42,7 +42,7 @@ import TableStore from '@/utils/tableStore'
|
||||
import Table from '@/components/table/index.vue'
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
import taskForm from './form.vue'
|
||||
import { getFileNameAndFilePath } from '@/api/system-boot/file'
|
||||
import { downloadFile } from '@/api/system-boot/file'
|
||||
import { ElMessage, ElMessageBox, ElDatePicker } from 'element-plus'
|
||||
import { timerRun, runTimer, deleteTimer, stop, start } from '@/api/system-boot/csDictData'
|
||||
import { delIcdPath } from '@/api/device-boot/icd'
|
||||
@@ -59,7 +59,7 @@ const taskFormFlag = ref(false)
|
||||
const tableStore: any = new TableStore({
|
||||
url: '/device-boot/icd/pageIcdList',
|
||||
method: 'POST',
|
||||
isWebPaging: true,
|
||||
// isWebPaging: true,
|
||||
column: [
|
||||
{
|
||||
title: '序号',
|
||||
@@ -100,13 +100,17 @@ const tableStore: any = new TableStore({
|
||||
icon: 'el-icon-EditPen',
|
||||
render: 'basicButton',
|
||||
click: async row => {
|
||||
getFileNameAndFilePath({ filePath: row.path }).then(res => {
|
||||
downloadFile({ filePath: row.path }).then(res => {
|
||||
let blob = new Blob([res], {
|
||||
type: 'application/xml'
|
||||
})
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const link = document.createElement('a')
|
||||
link.href = res.data.url
|
||||
link.download = res.data.name
|
||||
link.href = url
|
||||
link.download = row.name
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link)
|
||||
link.remove()
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
@@ -60,7 +60,7 @@ const dialogVisible = ref(false)
|
||||
const tableStore: any = new TableStore({
|
||||
url: '/device-boot/devType/pageDevTypeList',
|
||||
method: 'POST',
|
||||
isWebPaging: true,
|
||||
// isWebPaging: true,
|
||||
column: [
|
||||
{
|
||||
title: '序号',
|
||||
|
||||
Reference in New Issue
Block a user