This commit is contained in:
sjl
2025-02-13 15:40:13 +08:00
parent ddeb84fcfe
commit 475d236b7e
10 changed files with 149 additions and 88 deletions

View File

@@ -22,6 +22,7 @@
"echarts": "^5.4.3", "echarts": "^5.4.3",
"echarts-liquidfill": "^3.1.0", "echarts-liquidfill": "^3.1.0",
"element-plus": "^2.7.8", "element-plus": "^2.7.8",
"html2canvas": "^1.4.1",
"md5": "^2.3.0", "md5": "^2.3.0",
"mitt": "^3.0.1", "mitt": "^3.0.1",
"mkdirp": "^3.0.1", "mkdirp": "^3.0.1",
@@ -41,11 +42,13 @@
"devDependencies": { "devDependencies": {
"@rushstack/eslint-patch": "^1.8.0", "@rushstack/eslint-patch": "^1.8.0",
"@tsconfig/node20": "^20.1.4", "@tsconfig/node20": "^20.1.4",
"@types/html2canvas": "^1.0.0",
"@types/md5": "^2.3.2", "@types/md5": "^2.3.2",
"@types/node": "^20.14.14", "@types/node": "^20.14.14",
"@types/nprogress": "^0.2.0", "@types/nprogress": "^0.2.0",
"@types/qs": "^6.9.8", "@types/qs": "^6.9.8",
"@types/sortablejs": "^1.15.2", "@types/sortablejs": "^1.15.2",
"@types/xlsx": "^0.0.36",
"@typescript-eslint/eslint-plugin": "^6.7.0", "@typescript-eslint/eslint-plugin": "^6.7.0",
"@typescript-eslint/parser": "^6.7.0", "@typescript-eslint/parser": "^6.7.0",
"@vitejs/plugin-vue": "^5.0.5", "@vitejs/plugin-vue": "^5.0.5",

View File

@@ -0,0 +1,11 @@
import type {AuditLog } from '@/api/system/log/interface/log.ts'
import http from '@/api'
/**
* @name 审计日志管理模块
*/
//获取审计日志
export const getAuditLog = (params: AuditLog.ReqAuditLogParams) => {
return http.post(`/sysLog/list`, params)
}

View File

@@ -1,15 +1,36 @@
import type { ReqPage, ResPage } from '@/api/interface'
// 审计日志管理模块 // 审计日志管理模块
export namespace Sys_Log_Audit { export namespace AuditLog {
// 日志列表
export interface Audit_LogList { /**
id: string;//日志表Id * 设备类型数据表格分页查询参数
operate_Type:string;//日志类型 */
export interface ReqAuditLogParams extends ReqPage {
id: string; //审计日志Id 必填
createTime?: string; //创建时间
}
/**
* 设备类型新增、修改、根据id查询返回的对象
*/
export interface ResAuditLog {
id: string;//审计日志Id
operate_Type:string;//操作类型
ip:string;//操作IP ip:string;//操作IP
result: string;//事件结果 result: string;//事件结果
remark: string;//事件描述 remark: string;//事件描述
level:number;//告警等级
warn:number;//告警标志 warn:number;//告警标志
create_By:string;//创建用户 create_By:string;//创建用户
create_Time:string;//创建时间 create_Time:string;//创建时间
sort:number;//排序
} }
/**
* 设备类型表格查询分页返回的对象;
*/
export interface ResAuditLogPage extends ResPage<ResAuditLog> {
}
} }

View File

@@ -6,8 +6,10 @@
clearable clearable
v-model='searchForm.planName' v-model='searchForm.planName'
></el-input> ></el-input>
<el-tooltip content="检测计划列表" placement="top">
<Menu style='width: 26px;height: 26px; margin-left: 8px;cursor: pointer;color:var(--el-color-primary)' <Menu style='width: 26px;height: 26px; margin-left: 8px;cursor: pointer;color:var(--el-color-primary)'
@click.stop='detail()' /> @click.stop='detail()' />
</el-tooltip>
</div> </div>
<div class='tree_container'> <div class='tree_container'>
<el-tree <el-tree
@@ -40,6 +42,7 @@ import { Menu, Platform, CircleCheck,Loading } from '@element-plus/icons-vue'
import { nextTick, onMounted, ref, watch } from 'vue'; import { nextTick, onMounted, ref, watch } from 'vue';
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import {useCheckStore} from "@/stores/modules/check"; import {useCheckStore} from "@/stores/modules/check";
import { ElTooltip } from 'element-plus';
const router = useRouter() const router = useRouter()
const checkStore = useCheckStore() const checkStore = useCheckStore()
@@ -147,7 +150,7 @@ const filterNode = (value: string, data: any) => {
// 点击详情 // 点击详情
const detail = () => { const detail = () => {
router.push('/plan') router.push('/plan/planList')
} }
onMounted(() => { onMounted(() => {
// console.log() // console.log()

View File

@@ -3,7 +3,7 @@
<ProTable <ProTable
ref='proTable' ref='proTable'
:columns='columns' :columns='columns'
:data='logData' :request-api='getTableList'
@selection-change='handleSelectionChange' @selection-change='handleSelectionChange'
type='selection' type='selection'
> >
@@ -21,41 +21,39 @@
<script setup lang='tsx' name='useProTable'> <script setup lang='tsx' name='useProTable'>
// 根据实际路径调整 // 根据实际路径调整
import TimeControl from '@/components/TimeControl/index.vue' import TimeControl from '@/components/TimeControl/index.vue'
import { type Sys_Log_Audit } from '@/api/system/interface/log' import { type AuditLog} from '@/api/system/log/interface/log.ts'
import ProTable from '@/components/ProTable/index.vue' import ProTable from '@/components/ProTable/index.vue'
import { Upload ,DataAnalysis} from '@element-plus/icons-vue' import { Upload ,DataAnalysis} from '@element-plus/icons-vue'
import logDataList from '@/api/system/log/logData'
import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface' import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
import { reactive,ref,watch } from 'vue' import { reactive,ref,watch } from 'vue'
import { useDictStore } from '@/stores/modules/dict' import {
getAuditLog,
} from '@/api/system/log/index.ts'
defineOptions({
name: 'log'
})
let multipleSelection = ref<string[]>([]) // defineOptions({
const logData = logDataList // name: 'log'
const dictStore = useDictStore() // })
// 定义包含和排除的单位
const includedUnits = ['日', '', '月', '自定义']; // 可以根据需要包含的单位 const startDate = ref('')
const excludedUnits = ['季度','']; // 要排除的单位 const endDate = ref('')
const defaultUnits = '日'; // 默认的单位
// ProTable 实例 // ProTable 实例
const proTable = ref<ProTableInstance>() const proTable = ref<ProTableInstance>()
const getTableList = async (params: any) => {
let newParams = JSON.parse(JSON.stringify(params))
newParams.searchEndTime = endDate.value
newParams.searchBeginTime = startDate.value
return getAuditLog(newParams)
}
// 表格配置项 // 表格配置项
const columns = reactive<ColumnProps<Sys_Log_Audit.Audit_LogList>[]>([ const columns = reactive<ColumnProps<AuditLog.ReqAuditLogParams>[]>([
{ type: 'selection', fixed: 'left', width: 70 }, { type: 'selection', fixed: 'left', width: 70 },
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
{ {
prop: 'id', prop: 'createBy',
label: '序号',
width: 70,
},
{
prop: 'create_By',
label: '操作用户', label: '操作用户',
search: { el: 'input' }, search: { el: 'input' },
minWidth: 100, minWidth: 100,
@@ -66,18 +64,17 @@ const columns = reactive<ColumnProps<Sys_Log_Audit.Audit_LogList>[]>([
minWidth: 120, minWidth: 120,
}, },
{ {
prop: 'create_Time', prop: 'createTime',
label: '记录时间', label: '记录时间',
minWidth: 180, minWidth: 180,
search: { search: {
span: 2,
render: () => { render: () => {
return ( return (
<div class='flx-flex-start'> <div class='flx-flex-start'>
<TimeControl <TimeControl
include={includedUnits} include={['日', '周', '月', '自定义']}
exclude={excludedUnits} default={'月'}
default={defaultUnits} onUpdate-dates={handleDateChange}
/> />
</div> </div>
) )
@@ -108,18 +105,17 @@ const columns = reactive<ColumnProps<Sys_Log_Audit.Audit_LogList>[]>([
prop: 'operate_Type', prop: 'operate_Type',
label: '日志类型', label: '日志类型',
width: 100, width: 100,
search: { el: 'select', props: { filterable: true } },
}, },
]) ])
//选中 // 处理日期变化的回调函数
// 处理选择变化 const handleDateChange = (startDateTemp: string, endDateTemp: string) => {
const handleSelectionChange = (selection: Sys_Log_Audit.Audit_LogList[]) => { startDate.value = startDateTemp
multipleSelection.value = selection.map(row => row.id) // 更新选中的行 endDate.value = endDateTemp
} }
</script> </script>
<style scoped> <style scoped>

View File

@@ -50,9 +50,9 @@
<el-select v-model="formContent.reportName" clearable placeholder="请选择报告模版"> <el-select v-model="formContent.reportName" clearable placeholder="请选择报告模版">
<el-option <el-option
v-for="item in dictStore.getDictData('Report_Template')" v-for="item in dictStore.getDictData('Report_Template')"
:key="item.code" :key="item.id"
:label="item.name" :label="item.name"
:value="item.code" :value="item.id"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>

View File

@@ -96,6 +96,8 @@ import type { ICD } from '@/api/device/interface/icd'
prop: 'reportName', prop: 'reportName',
label: '报告模版名称', label: '报告模版名称',
minWidth: 150, minWidth: 150,
enum: dictStore.getDictData('Report_Template'),
fieldNames: { label: 'name', value: 'id' },
}, },
{ {
prop: 'icd', prop: 'icd',
@@ -136,18 +138,15 @@ import type { ICD } from '@/api/device/interface/icd'
} }
// 批量删除设备 // 批量删除设备类型
const batchDelete = async (id: string[]) => { const batchDelete = async (id: string[]) => {
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? ''//获取数据字典中对应的id
await useHandleData(deleteDevType, id, '删除所选设备类型') await useHandleData(deleteDevType, id, '删除所选设备类型')
proTable.value?.clearSelection() proTable.value?.clearSelection()
proTable.value?.getTableList() proTable.value?.getTableList()
} }
// 删除设备 // 删除设备类型
const handleDelete = async (params: DevType.ResPqDevType) => { const handleDelete = async (params: DevType.ResPqDevType) => {
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id//获取数据字典中对应的id
await useHandleData(deleteDevType, [params.id] , `删除【${params.name}】设备类型`) await useHandleData(deleteDevType, [params.id] , `删除【${params.name}】设备类型`)
proTable.value?.getTableList() proTable.value?.getTableList()

View File

@@ -194,7 +194,7 @@ const disabledDate = (time: Date) => {
encryptionFlag: 0, encryptionFlag: 0,
reCheckNum:0, reCheckNum:0,
state: 1, state: 1,
factorFlag:0, factorFlag:1,
icdId:'', icdId:'',
power:'', power:'',
preinvestmentPlan:'' preinvestmentPlan:''
@@ -224,7 +224,7 @@ const disabledDate = (time: Date) => {
encryptionFlag: 0, encryptionFlag: 0,
reCheckNum:0, reCheckNum:0,
state: 1, state: 1,
factorFlag:0, factorFlag:1,
icdId:'', icdId:'',
power:'', power:'',
preinvestmentPlan:'' preinvestmentPlan:''

View File

@@ -29,26 +29,21 @@
</template> </template>
<script setup lang='tsx' name='useRole'> <script setup lang='tsx' name='useRole'>
import TimeControl from '@/components/TimeControl/index.vue'
import { type ICD } from '@/api/device/interface/icd' import { type ICD } from '@/api/device/interface/icd'
import { useHandleData } from '@/hooks/useHandleData' import { useHandleData } from '@/hooks/useHandleData'
import { useDownload } from '@/hooks/useDownload'
import ProTable from '@/components/ProTable/index.vue' import ProTable from '@/components/ProTable/index.vue'
import { type ProTableInstance, type ColumnProps } from '@/components/ProTable/interface' import { type ProTableInstance, type ColumnProps } from '@/components/ProTable/interface'
import { CirclePlus, Delete, EditPen, Download, Upload } from '@element-plus/icons-vue' import { CirclePlus, Delete, EditPen, Download, Upload } from '@element-plus/icons-vue'
import { useDictStore } from '@/stores/modules/dict'
import { import {
getICDList, getICDList,
deleteICD, deleteICD,
} from '@/api/device/icd/index.ts' } from '@/api/device/icd/index.ts'
import { reactive, ref } from 'vue' import { reactive, ref } from 'vue'
import { useModeStore, useAppSceneStore } from '@/stores/modules/mode'
defineOptions({ defineOptions({
name: 'devType', name: 'devType',
}) })
const modeStore = useModeStore()
const dictStore = useDictStore()
// ProTable 实例 // ProTable 实例
const proTable = ref<ProTableInstance>() const proTable = ref<ProTableInstance>()
const icdPopup = ref() const icdPopup = ref()
@@ -101,14 +96,14 @@
} }
// 批量删除设备 // 批量删除icd
const batchDelete = async (id: string[]) => { const batchDelete = async (id: string[]) => {
await useHandleData(deleteICD, id, '删除所选icd') await useHandleData(deleteICD, id, '删除所选icd')
proTable.value?.clearSelection() proTable.value?.clearSelection()
proTable.value?.getTableList() proTable.value?.getTableList()
} }
// 删除设备 // 删除设备icd
const handleDelete = async (params: ICD.ResICD) => { const handleDelete = async (params: ICD.ResICD) => {
await useHandleData(deleteICD, [params.id] , `删除【${params.name}】icd`) await useHandleData(deleteICD, [params.id] , `删除【${params.name}】icd`)
proTable.value?.getTableList() proTable.value?.getTableList()

View File

@@ -7,21 +7,22 @@
> >
<!-- 表格 header 按钮 --> <!-- 表格 header 按钮 -->
<template #tableHeader='scope'> <template #tableHeader='scope'>
<el-button type='primary' :icon='Download' @click='importClick'>导入</el-button> <el-button type='primary' v-auth.plan="'import'" :icon='Download' @click='importClick'>导入</el-button>
<el-button type='primary' :icon='Upload' @click='exportClick'>导出</el-button> <el-button type='primary' v-auth.plan="'export'" :icon='Upload' @click='exportClick'>导出</el-button>
<el-button type='primary' :icon='ScaleToOriginal' :disabled='!(scope.selectedList.length > 1)' @click='combineClick'> <el-button type='primary' v-auth.plan="'combine'" :icon='ScaleToOriginal' :disabled='!(scope.selectedList.length > 1)' @click='combineClick'>
合并 合并
</el-button> </el-button>
<el-button type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button> <el-button type='primary' v-auth.plan="'add'" :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
<el-button type='danger' :icon='Delete' plain :disabled='!scope.isSelected' @click='batchDelete(scope.selectedListIds)'> <el-button type='danger' v-auth.plan="'delete'" :icon='Delete' plain :disabled='!scope.isSelected' @click='batchDelete(scope.selectedListIds)'>
删除 删除
</el-button> </el-button>
</template> </template>
<!-- 表格操作 --> <!-- 表格操作 -->
<template #operation='scope'> <template #operation='scope'>
<el-button type='primary' link :icon='EditPen' @click="openDialog('edit',scope.row)">编辑</el-button> <el-button type='primary' v-auth.plan="'edit'" link :icon='EditPen' @click="openDialog('edit',scope.row)">编辑</el-button>
<el-button type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button> <el-button type='primary' v-auth.plan="'delete'" link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
<!-- <el-button type='primary' link :icon='List' @click='showDeviceOpen(scope.row)'>设备绑定</el-button> --> <!-- <el-button type='primary' link :icon='List' @click='showDeviceOpen(scope.row)'>设备绑定</el-button> -->
<el-button type='primary' v-auth.plan="'analysis'" link :icon='List' @click='statisticalAnalysis(scope.row)'>统计分析</el-button>
</template> </template>
</ProTable> </ProTable>
</div> </div>
@@ -35,6 +36,8 @@
<!-- 查看设备绑定 <!-- 查看设备绑定
<DevTransfer :refresh-table='proTable?.getTableList' ref='devTransferPopup'/> --> <DevTransfer :refresh-table='proTable?.getTableList' ref='devTransferPopup'/> -->
<ImportExcel ref='deviceImportExcel' /> <ImportExcel ref='deviceImportExcel' />
</template> </template>
<script setup lang='tsx' name='useProTable'> <script setup lang='tsx' name='useProTable'>
@@ -63,7 +66,9 @@ import { dictTestState,dictReportState,dictResult } from '@/api/plan/planData.ts
import {getTestSourceById} from '@/api/device/testSource/index' import {getTestSourceById} from '@/api/device/testSource/index'
import ImportExcel from "@/components/ImportExcel/index.vue"; import ImportExcel from "@/components/ImportExcel/index.vue";
import {useDownload} from "@/hooks/useDownload"; import {useDownload} from "@/hooks/useDownload";
import {exportPqDev} from "@/api/device/device"; import {getTestConfig } from '@/api/system/base/index'
import {type Base } from '@/api/system/base/interface'
import { getBoundPqDevList } from '@/api/plan/plan.ts'
// defineOptions({ // defineOptions({
// name: 'planList' // name: 'planList'
@@ -104,7 +109,6 @@ const dataSourceType = computed(() => {
}) })
// 表格配置项 // 表格配置项
const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([ const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
{ type: 'selection', fixed: 'left', width: 70 }, { type: 'selection', fixed: 'left', width: 70 },
@@ -253,14 +257,9 @@ const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
}, },
}, },
{ prop: 'operation', label: '操作', fixed: 'right', width: 200 }, { prop: 'operation', label: '操作', fixed: 'right', width: 300 },
]) ])
const handleSourceClicked = (id: string) => {
};
function isVisible(row: Plan.ReqPlan) { function isVisible(row: Plan.ReqPlan) {
if(!row.hasOwnProperty('sourceName') || !Array.isArray(row.sourceName)){ if(!row.hasOwnProperty('sourceName') || !Array.isArray(row.sourceName)){
@@ -298,7 +297,6 @@ function showTestScript(row: string) {
} }
function handleFiles(event: Event) { function handleFiles(event: Event) {
const target = event.target as HTMLInputElement const target = event.target as HTMLInputElement
const files = target.files const files = target.files
@@ -371,9 +369,6 @@ const combineClick = () => {
}) })
} }
// 打开 drawer(新增、编辑) // 打开 drawer(新增、编辑)
const openDialog = (titleType: string, row: Partial<Plan.ReqPlan> = {}) => { const openDialog = (titleType: string, row: Partial<Plan.ReqPlan> = {}) => {
planPopup.value?.open(titleType, row,modeStore.currentMode) planPopup.value?.open(titleType, row,modeStore.currentMode)
@@ -397,6 +392,44 @@ const showDeviceOpen = (row: Partial<Plan.ReqPlan> = {}) => {
devTransferPopup.value.open(row) devTransferPopup.value.open(row)
} }
const myDict = new Map<string, any[]>();
// 引用图表容器
const chartContainer = ref<HTMLElement | null>(null);
let myChart: echarts.ECharts | null = null;
const statisticalAnalysis = async (row: Partial<Plan.ReqPlan> = {}) => {
// const response = await getTestConfig() as unknown as Base.ResTestConfig
// const maxTime= response.data.maxTime//检测最大次数
// const dev = await getBoundPqDevList({ 'planId': row.id })
// for (let i = 0; i <= maxTime; i++) {
// dev.data.forEach((item: any) => {
// if(item.reCheckNum === i){
// // 向已有的数组中添加元素
// if (myDict.has(i.toString())) {
// myDict.get(i.toString())?.push(item.name);
// }else{
// myDict.set(i.toString(), [item.name]);
// }
// }
// })
// }
// for (let i = 0; i <= maxTime; i++) {
// if (myDict.has(i.toString())) {
// const array = myDict.get(i.toString());
// if (array) {
// for (const value of array) {
// console.log(i + '---'+value);
// }
// }
// }
// }
}
</script> </script>
<style scoped> <style scoped>