From 5fd97ebe725b480aa42a0c33efa9c3bcaec9d583 Mon Sep 17 00:00:00 2001 From: sjl <1716605279@qq.com> Date: Thu, 14 Nov 2024 20:36:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/IpAddress/index.vue | 2 +- .../resource/components/resourcePopup.vue | 94 ++++--------------- .../src/views/authority/resource/index.vue | 19 ++-- frontend/src/views/authority/role/index.vue | 2 - frontend/src/views/log/index.vue | 2 - .../machine/device/components/devicePopup.vue | 76 ++++++++------- frontend/src/views/machine/device/index.vue | 3 +- .../system/dictionary/dictTree/index.vue | 2 - .../system/dictionary/dictType/index.vue | 5 +- 9 files changed, 79 insertions(+), 126 deletions(-) diff --git a/frontend/src/components/IpAddress/index.vue b/frontend/src/components/IpAddress/index.vue index 340c20f..5e5a357 100644 --- a/frontend/src/components/IpAddress/index.vue +++ b/frontend/src/components/IpAddress/index.vue @@ -313,7 +313,7 @@ border: 1px solid #dcdfe6; border-radius: 4px; line-height: 40px; - width: 120%; + width: 100%; height: 35px; padding-inline-start: 0px; padding-left: 10px; diff --git a/frontend/src/views/authority/resource/components/resourcePopup.vue b/frontend/src/views/authority/resource/components/resourcePopup.vue index 7fd5eea..963f942 100644 --- a/frontend/src/views/authority/resource/components/resourcePopup.vue +++ b/frontend/src/views/authority/resource/components/resourcePopup.vue @@ -3,13 +3,12 @@ @@ -64,79 +63,15 @@ import {addFunction,updateFunction,getFunctionListNoButton} from '@/api/function/index.ts' import IconSelect from '@/components/SelectIcon/index.vue' import { functionList } from '@/api/function/functionExample.ts' -import { min } from 'lodash'; + import { min } from 'lodash'; +import { Console } from 'console'; const value = ref() + // 树形节点配置 + const defaultProps = { + children: 'children', + label: 'name', + }; -const data = [ - { - value: '1', - label: 'Level one 1', - children: [ - { - value: '1-1', - label: 'Level two 1-1', - children: [ - { - value: '1-1-1', - label: 'Level three 1-1-1', - }, - ], - }, - ], - }, - { - value: '2', - label: 'Level one 2', - children: [ - { - value: '2-1', - label: 'Level two 2-1', - children: [ - { - value: '2-1-1', - label: 'Level three 2-1-1', - }, - ], - }, - { - value: '2-2', - label: 'Level two 2-2', - children: [ - { - value: '2-2-1', - label: 'Level three 2-2-1', - }, - ], - }, - ], - }, - { - value: '3', - label: 'Level one 3', - children: [ - { - value: '3-1', - label: 'Level two 3-1', - children: [ - { - value: '3-1-1', - label: 'Level three 3-1-1', - }, - ], - }, - { - value: '3-2', - label: 'Level two 3-2', - children: [ - { - value: '3-2-1', - label: 'Level three 3-2-1', - }, - ], - }, - ], - }, -] const dictStore = useDictStore() // 定义弹出组件元信息 const dialogFormRef = ref() @@ -190,7 +125,9 @@ const resetFormContent = () => { const rules : Ref>> = ref({ name :[{required:true,trigger:'blur',message:'菜单名称必填!'}], path :[{required:true,trigger:'blur',message:'菜单路径必填!'}], - type :[{required:true,trigger:'change',message:'菜单类型必选!'}] + type :[{required:true,trigger:'change',message:'菜单类型必选!'}], + component :[{required:true,trigger:'blur',message:'组件地址必填!'}], + code :[{required:true,trigger:'blur',message:'编码必填!'}] }) // 关闭弹窗 @@ -207,7 +144,7 @@ const close = () => { try { console.log(formContent.value) dialogFormRef.value?.validate(async (valid: boolean) => { - console.log(valid) + if (valid) { if (formContent.value.id) { await updateFunction(formContent.value); @@ -225,8 +162,11 @@ const close = () => { } } + const functionList = ref([]) // 打开弹窗,可能是新增,也可能是编辑 const open = async (sign: string, data: Function.ResFunction) => { + const response = await getFunctionListNoButton() + functionList.value = response.data as unknown as Function.ResFunction[] titleType.value = sign dialogVisible.value = true if (data.id) { diff --git a/frontend/src/views/authority/resource/index.vue b/frontend/src/views/authority/resource/index.vue index 2dac0d1..5a46726 100644 --- a/frontend/src/views/authority/resource/index.vue +++ b/frontend/src/views/authority/resource/index.vue @@ -56,10 +56,19 @@ prop: 'type', label: '类型', width: 100, - enum: dictStore.getDictData('resourceType'), - search: { el: 'select', props: { filterable: true } }, - fieldNames: { label: 'label', value: 'code' }, - }, + render: (scope) => { + const typeMap: { [key: number]: { label: string; type: string } } = { + 0: { label: '菜单', type: 'info' }, + 1: { label: '按钮', type: 'warning' }, + 2: { label: '公共资源', type: 'success' }, + 3: { label: '服务间调用资源', type: 'primary' }, + }; + const typeInfo = typeMap[scope.row.type] || { label: '未知', type: 'danger' }; + return ( + {typeInfo.label} + ); + }, +}, { prop: 'icon', label: '图标', @@ -85,8 +94,6 @@ prop: 'state', label: '权限资源状态', minWidth: 100, - enum: dictStore.getDictData('status'), - fieldNames: { label: 'label', value: 'code' }, render: scope => { return ( {scope.row.state ? '正常' : '禁用'} diff --git a/frontend/src/views/authority/role/index.vue b/frontend/src/views/authority/role/index.vue index 459255c..a464fb6 100644 --- a/frontend/src/views/authority/role/index.vue +++ b/frontend/src/views/authority/role/index.vue @@ -88,8 +88,6 @@ const columns = reactive[]>([ prop: 'state', label: '状态', minWidth: 100, - enum: dictStore.getDictData('state'), - fieldNames: { label: 'label', value: 'code' }, render: scope => { return ( {scope.row.state ? '正常' : '删除'} diff --git a/frontend/src/views/log/index.vue b/frontend/src/views/log/index.vue index 9de5aa8..a846ea9 100644 --- a/frontend/src/views/log/index.vue +++ b/frontend/src/views/log/index.vue @@ -88,9 +88,7 @@ const columns = reactive[]>([ { prop: 'warn', label: '告警标志', - enum: dictStore.getDictData('status'), minWidth: 100, - fieldNames: { label: 'label', value: 'code' }, render: scope => { return ( {scope.row.warn ? '告警' : '未告警'} diff --git a/frontend/src/views/machine/device/components/devicePopup.vue b/frontend/src/views/machine/device/components/devicePopup.vue index b688e7f..2aab9c1 100644 --- a/frontend/src/views/machine/device/components/devicePopup.vue +++ b/frontend/src/views/machine/device/components/devicePopup.vue @@ -6,12 +6,12 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -136,7 +136,7 @@ - + @@ -144,24 +144,24 @@ - + - + - + - + - + - + - + @@ -256,9 +256,9 @@ import { el } from 'element-plus/es/locale' name: '', pattern:'模拟式', devType:'', - devChns:0, - devVolt:0, - devCurr:0, + devChns:1, + devVolt:57.74, + devCurr:1, manufacturer: '', createDate: '', createId: '', @@ -266,7 +266,7 @@ import { el } from 'element-plus/es/locale' softwareVersion: '', protocol: '', ip: '', - port: 0, + port: 102, encryptionFlag: 1, reCheckNum:0, state: 1, @@ -282,9 +282,9 @@ import { el } from 'element-plus/es/locale' name: '', pattern:'模拟式', devType:'', - devChns:0, - devVolt:0, - devCurr:0, + devChns:1, + devVolt:57.74, + devCurr:1, manufacturer: '', createDate: '', createId: '', @@ -292,13 +292,14 @@ import { el } from 'element-plus/es/locale' softwareVersion: '', protocol: '', ip: '', - port: 0, + port: 102, encryptionFlag: 1, reCheckNum:0, state: 1, } } + let dialogTitle = computed(() => { return titleType.value === 'add' ? '新增被检设备' : '编辑被检设备' }) @@ -324,11 +325,13 @@ import { el } from 'element-plus/es/locale' ip:[{ required: true, message: 'IP地址必填!', trigger: 'blur' } , { pattern: /^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/, message: 'IP地址格式错误', trigger: 'blur' }], port:[{ required: true, message: '端口号必填!', trigger: 'blur' }, - { pattern: /^\d+$/, message: '端口号格式错误', trigger: 'blur' }], + { pattern: /^(6553[0-5]|655[0-2][0-9]|64[0-9]{3}|[1-5]?[0-9]{1,4})$/, message: '端口号范围0到65535的整数', trigger: 'blur' }], manufacturer: [{ required: true, message: '生产厂家必选!', trigger: 'change' }], encryptionFlag: [{ required: true, message: '是否加密必选!', trigger: 'change' }], protocol: [{ required: true, message: '通讯协议必选!', trigger: 'change' }], - }) + series: [], + devKey: [] +}) // 关闭弹窗 const close = () => { @@ -407,14 +410,23 @@ import { el } from 'element-plus/es/locale' // 根据是否加密来显示或隐藏识别码和密钥 if(value === 1){ IsPasswordShow.value = true + rules.value.series = [ + { required: true, message: '请输入识别码', trigger: 'blur' } + ]; + rules.value.devKey = [ + { required: true, message: '请输入密钥', trigger: 'blur' } + ]; }else { IsPasswordShow.value = false formContent.value.series = '' formContent.value.devKey = '' + rules.value.series = []; + rules.value.devKey = []; } // 如果选择"是",则显示;否则隐藏 + dialogFormRef.value?.clearValidate(); // 清除验证状态 } // 表格配置项 diff --git a/frontend/src/views/machine/device/index.vue b/frontend/src/views/machine/device/index.vue index 571b230..ba770e0 100644 --- a/frontend/src/views/machine/device/index.vue +++ b/frontend/src/views/machine/device/index.vue @@ -84,7 +84,6 @@ const columns = reactive[]>([ return (
@@ -157,7 +156,7 @@ const downloadFile = async () => { searchParam.searchBeginTime = startDate.value; searchParam.searchEndTime = endDate.value; - ElMessageBox.confirm('确认导出被检设备?', '温馨提示', { type: 'warning' }).then(() => + ElMessageBox.confirm('确认导出被检设备?', '温馨提示', { type: 'warning' }).then(() => useDownload(exportPqDev,'被检设备导出数据', proTable.value?.searchParam, false,'.xlsx'), ) } diff --git a/frontend/src/views/system/dictionary/dictTree/index.vue b/frontend/src/views/system/dictionary/dictTree/index.vue index fe3af77..66a795a 100644 --- a/frontend/src/views/system/dictionary/dictTree/index.vue +++ b/frontend/src/views/system/dictionary/dictTree/index.vue @@ -63,8 +63,6 @@ label: '状态', minWidth:30, isShow:false, - enum: dictStore.getDictData('state'), - fieldNames: { label: 'label', value: 'code' }, render: scope => { return ( diff --git a/frontend/src/views/system/dictionary/dictType/index.vue b/frontend/src/views/system/dictionary/dictType/index.vue index 91eb497..7dfc2b9 100644 --- a/frontend/src/views/system/dictionary/dictType/index.vue +++ b/frontend/src/views/system/dictionary/dictType/index.vue @@ -27,13 +27,14 @@