diff --git a/frontend/src/api/system/dictionary/interface/index.ts b/frontend/src/api/system/dictionary/interface/index.ts index c23a43d..48a5497 100644 --- a/frontend/src/api/system/dictionary/interface/index.ts +++ b/frontend/src/api/system/dictionary/interface/index.ts @@ -62,6 +62,7 @@ export namespace Dict { name: string; // 名称 code: string; // 编码 sort: number; // 排序 + openValue?: number | null; level?: number | null; // 事件等级:0-普通;1-中等;2-严重 (默认为0) algoDescribe?: number | null; // 与高级算法内部Id描述对应 value?: string | null; // 字典针对电压等级 diff --git a/frontend/src/views/home/components/table.vue b/frontend/src/views/home/components/table.vue index 983ef6a..3f0f631 100644 --- a/frontend/src/views/home/components/table.vue +++ b/frontend/src/views/home/components/table.vue @@ -142,21 +142,21 @@ --> - 报告下载 - + --> 报告生成 + @@ -266,16 +267,10 @@ const findPlanById = (plans: Plan.ReqPlan[], id: string): Plan.ReqPlan | undefin return undefined } -const getPieData = async (id: string) => { - currentId.value = id // 设置当前ID - // 初始化计数对象 - const checkStateCount: { [key: number]: number } = { 0: 0, 1: 0, 2: 0, 3: 0 } - const checkResultCount: { [key: number]: number } = { 0: 0, 1: 0, 2: 0 } - const reportStateCount: { [key: number]: number } = { 0: 0, 1: 0, 2: 0 } - if (id) { - const boundPqDevList = ref([])//根据检测计划id查询出所有已绑定的设备 - const plan = findPlanById(planList.value?.data || [], id) - planName.value = '所选计划:' + plan.name + +const updateData = (id: string) => { + getPieData(id);//刷新饼图 + //获取点击树的父节点名字 const parentNodeName = ref('') for (let i = 0; i < planList.value.data.length; i++) { @@ -293,6 +288,19 @@ const getPieData = async (id: string) => { }else{ handleCheckFunction(0) } +} + +const getPieData = async (id: string) => { + currentId.value = id // 设置当前ID + // 初始化计数对象 + const checkStateCount: { [key: number]: number } = { 0: 0, 1: 0, 2: 0, 3: 0 } + const checkResultCount: { [key: number]: number } = { 0: 0, 1: 0, 2: 0 } + const reportStateCount: { [key: number]: number } = { 0: 0, 1: 0, 2: 0 } + if (id) { + const boundPqDevList = ref([])//根据检测计划id查询出所有已绑定的设备 + const plan = findPlanById(planList.value?.data || [], id) + planName.value = '所选计划:' + plan.name + select_Plan.value = plan if (plan) { @@ -302,6 +310,7 @@ const getPieData = async (id: string) => { // 处理未找到计划的情况 isTimeCheck.value = false // 或者其他默认值 } + console.log('饼图getBoundPqDevList') const pqDevList_Result2 = await getBoundPqDevList({ 'planId': id, 'checkStateList': [0, 1, 2, 3] }) boundPqDevList.value = pqDevList_Result2.data as Device.ResPqDev[] // 遍历 boundPqDevList 并更新计数对象 @@ -431,7 +440,8 @@ const resizeObserver = new ResizeObserver(entries => { } }) -onBeforeMount(async () => { + +const initPlan = async () => { const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? ''//获取数据字典中对应的id const reqPlan: Plan.ReqPlan = { pattern: patternId, @@ -455,8 +465,10 @@ onBeforeMount(async () => { state: 0, } planList.value = (await getPlanListByPattern(reqPlan)) as ResultData +} - console.log(planList.value.data) +onBeforeMount(async () => { + await initPlan() for (let i = 0; i < planList.value.data.length; i++) { if (Array.isArray(planList.value.data[i].children) && planList.value.data[i].children.length > 0) { currentId.value = planList.value.data[i].children[0].id; // 直接赋值第一个 children 的 id @@ -483,11 +495,13 @@ onUnmounted(() => { } }) -const handleBatchGenerate = () => { +const handleBatchGenerate = async () => { console.log('批量生成按钮被点击了'); // 在这里添加其他逻辑,比如显示对话框、更新状态等 + await initPlan() + treeRef.value.clickTableToTree(planList.value.data,currentId.value) getPieData(currentId.value) - + if (form.value.activeTabs === 0)//设备检测 { const tabledata = deviceData.filter((item) => item.document_State === '未归档') diff --git a/frontend/src/views/machine/device/components/devicePopup.vue b/frontend/src/views/machine/device/components/devicePopup.vue index de610d6..c298d8d 100644 --- a/frontend/src/views/machine/device/components/devicePopup.vue +++ b/frontend/src/views/machine/device/components/devicePopup.vue @@ -344,6 +344,13 @@ const rules = computed(() => { { formContent.value.arrivedDate = dayjs(formContent.value.arrivedDate).format('YYYY-MM-DD'); } + + //保存时判是否加密,把识别码密钥字段清空 + if(formContent.value.encryptionFlag === 0){ + formContent.value.series = null + formContent.value.devKey = null + } + if (formContent.value.id) { await updatePqDev(formContent.value); ElMessage.success({ message: `${dialogTitle.value}成功!` }) diff --git a/frontend/src/views/system/dictionary/dictData/components/dataPopup.vue b/frontend/src/views/system/dictionary/dictData/components/dataPopup.vue index 14a118b..eea20e0 100644 --- a/frontend/src/views/system/dictionary/dictData/components/dataPopup.vue +++ b/frontend/src/views/system/dictionary/dictData/components/dataPopup.vue @@ -12,10 +12,16 @@ - - + + + + + - + + + + @@ -42,7 +48,7 @@ import {dialogSmall} from "@/utils/elementBind"; import {addDictData, updateDictData} from "@/api/system/dictionary/dictData/index.ts"; import {Dict} from "@/api/system/dictionary/interface"; import {ElMessage, FormItemRule} from "element-plus"; -import type {Ref} from "vue"; +import {computed, Ref} from "vue"; const rules: Ref>> = ref({ name: [{required: true, message: '类型名称必填!', trigger: 'blur'}], @@ -63,10 +69,11 @@ function useMetaInfo() { name: "", code: "", value: "", - dictValue: "", + //dictValue: "", level: 0, sort: 100, state: 1, + openValue:0 }) return {dialogVisible, titleType, formContent, dictTypeName}; @@ -83,13 +90,21 @@ const resetFormContent = () => { name: "", code: "", value: "", - dictValue: "", + //dictValue: "", level: 0, sort: 100, state: 1, + openValue:0 } } + + const handleOpenValueChange = ()=> { + if(formContent.value.openValue == 0){ + formContent.value.value = null + } + } + const close = () => { dialogVisible.value = false resetFormContent() @@ -106,15 +121,18 @@ const open = (sign: string, typeId: string, name: string, data: Dict.ResDictData dialogVisible.value = true if (data.id) { formContent.value = {...data} - formContent.value.dictValue = data.value + //formContent.value.dictValue = data.value } } const save = () => { try { dialogFormRef.value?.validate(async (valid: boolean) => { + if(formContent.value.openValue === 0){ + formContent.value.value = null + } + if (valid) { - formContent.value.value = formContent.value.dictValue if (formContent.value.id) { await updateDictData(formContent.value) } else { diff --git a/frontend/src/views/system/dictionary/dictData/index.vue b/frontend/src/views/system/dictionary/dictData/index.vue index 5a722da..8630848 100644 --- a/frontend/src/views/system/dictionary/dictData/index.vue +++ b/frontend/src/views/system/dictionary/dictData/index.vue @@ -33,6 +33,7 @@ import {useHandleData} from '@/hooks/useHandleData' import {deleteDictData, getDictDataListByTypeId, exportDictData} from "@/api/system/dictionary/dictData/index"; import {useDownload} from "@/hooks/useDownload"; import {exportDictType} from "@/api/system/dictionary/dictType"; +import { isShallow } from 'vue'; defineOptions({ name: 'dict' }) @@ -80,7 +81,13 @@ const columns = reactive[]>([ { prop: 'value', label: '值', - minWidth: 180 + minWidth: 180, + render: (scope) => { + if (scope.row.openValue === 0 || scope.row.value === null || scope.row.value === '') { + return /; // 使用 JSX 返回 VNode + } + return {scope.row.value}; // 使用 JSX 返回 VNode + } }, { prop: 'level', diff --git a/frontend/src/views/system/dictionary/dictType/components/typePopup.vue b/frontend/src/views/system/dictionary/dictType/components/typePopup.vue index 6635ffb..f6874ae 100644 --- a/frontend/src/views/system/dictionary/dictType/components/typePopup.vue +++ b/frontend/src/views/system/dictionary/dictType/components/typePopup.vue @@ -8,13 +8,13 @@ - + - +