@@ -25,7 +25,7 @@
:activeName="activeName"
:formContent="props.formContent"
:options="props.options"
- style="width: 400px"
+ style="width: 360px"
:disabled="tab.children.length == 0 ? false : true"
ref="communRef"
/>
@@ -54,11 +54,11 @@
}"
stripe
:cell-style="{ textAlign: 'center' }"
- height="calc(100vh - 515px)"
+ height="calc(100vh - 480px)"
style="width: 100%"
>
-
+
-
+
-
+
{
}
})
}
+// 设置树点击tab
+const setTab = row => {
+ activeName.value = row.activeName
+ childActiveName.value = row.childActiveName
+ getTree()
+}
const copyActiveName = ref('')
// 获取通讯脚本点击
const getCommunication = () => {
@@ -415,11 +421,11 @@ onMounted(() => {
}
.content-tree {
- width: 300px;
- height: calc(100vh - 335px);
+ width: 260px;
+ height: calc(100vh - 315px);
border: 1px solid #dcdfe6;
border-radius: 4px;
- margin-right: 10px;
+ // margin-right: 10px;
overflow: auto; /* 同时启用垂直和水平滚动 */
overflow-x: hidden;
}
@@ -479,4 +485,10 @@ input::-webkit-inner-spin-button {
input::-webkit-outer-spin-button {
-webkit-appearance: none !important;
}
+.el-divider--horizontal {
+ margin: 4px 0 24px 0;
+}
+.el-tabs--border-card > .el-tabs__content {
+ padding: 10px;
+}
diff --git a/frontend/src/views/machine/testScript/components/testScriptHarmTab.vue b/frontend/src/views/machine/testScript/components/testScriptHarmTab.vue
index 15eb5fa..af1af5a 100644
--- a/frontend/src/views/machine/testScript/components/testScriptHarmTab.vue
+++ b/frontend/src/views/machine/testScript/components/testScriptHarmTab.vue
@@ -36,8 +36,8 @@
/>
- 确定
- 清空列表
+ 确定
+ 清空表格
@@ -46,23 +46,13 @@
-
+
{{ row.famp }}%
-
+
{{ row.fphase }}°
@@ -86,35 +76,6 @@
-
@@ -155,7 +116,7 @@
确定
- 清空列表
+ 清空表格
@@ -164,23 +125,13 @@
-
+
{{ row.famp }}%
-
+
{{ row.fphase }}°
@@ -325,25 +276,6 @@ const onSubmit1 = () => {
const HarmFlagDelete = (index: number, number: number) => {
props.childForm[index].harmList.splice(number, 1)
}
-
-// 定义并初始化 tableData
-const tableData1 = ref
([])
-const tableData2 = ref([])
-
-for (let i = 2; i <= 25; i++) {
- tableData1.value.push({
- date: i.toString(),
- harmonicRate: `谐波含有率${i}`,
- harmonicPhase: `谐波相角${i}`
- })
-}
-for (let i = 26; i <= 50; i++) {
- tableData2.value.push({
- date: i.toString(),
- harmonicRate: `谐波含有率${i}`,
- harmonicPhase: `谐波相角${i}`
- })
-}
diff --git a/frontend/src/views/machine/testScript/components/testScriptPopup.vue b/frontend/src/views/machine/testScript/components/testScriptPopup.vue
index c45cba4..ed8da26 100644
--- a/frontend/src/views/machine/testScript/components/testScriptPopup.vue
+++ b/frontend/src/views/machine/testScript/components/testScriptPopup.vue
@@ -189,7 +189,6 @@ const treeInfo = async (currentMode: string) => {
onMounted(() => {
let data: any = router.options.history.state
- console.log('🚀 ~ onMounted ~ data:', data)
if (data.title == null) return
nextTick(async () => {
await treeInfo(data.mode)
diff --git a/frontend/src/views/machine/testScript/components/tree.vue b/frontend/src/views/machine/testScript/components/tree.vue
index 4832dc7..2026203 100644
--- a/frontend/src/views/machine/testScript/components/tree.vue
+++ b/frontend/src/views/machine/testScript/components/tree.vue
@@ -1,5 +1,13 @@
-
+
@@ -19,12 +27,61 @@ const props = defineProps({
required: true
}
})
+const emit = defineEmits(['setTab'])
const dataTree = ref
([])
const defaultProps = {
children: 'children',
label: 'scriptTypeName',
pid: 'pid'
}
+const handleNodeClick = (data, node) => {
+ let code = ['Base', 'VOL', 'Freq', 'Harm', 'Base_0_10', 'Base_20_85', 'Base_110_200']
+ const parents = getParentNodes(node, [])
+ parents.pop()
+ parents.unshift(node.data)
+ parents.reverse()
+ // 获取当前节点的直接父节点
+
+ emit('setTab', {
+ activeName: parents[0].scriptTypeCode,
+ childActiveName: findTargetCodes(parents, code)[0] || ''
+ })
+}
+// 返回父级
+const getParentNodes = (node, parents) => {
+ if (node.parent) {
+ // 将父节点添加到数组中
+ parents.push(node.parent.data)
+ // 递归获取更高层级的父节点
+ getParentNodes(node.parent, parents)
+ }
+ return parents
+}
+// 判断childActiveName值
+function findTargetCodes(data: any[], targetCodes: string[]) {
+ let result: string[] = []
+ data.forEach(item => {
+ if (item.scriptTypeCode != null) {
+ if (targetCodes.includes(item.scriptTypeCode)) {
+ result.push(item.scriptTypeCode)
+ }
+ }
+ })
+ return result
+ // for (let item of data) {
+ // // 判断当前项的 scriptTypeCode 是否包含目标值
+ // if (item.scriptTypeCode !=null && targetCodes.includes(item.scriptTypeCode)) {
+ // console.log("🚀 ~ findTargetCodes ~ targetCodes.includes(item.scriptTypeCode):",item.scriptTypeCode, targetCodes.includes(item.scriptTypeCode))
+ // result.push(item.scriptTypeCode)
+ // return result
+ // }
+ // // 如果存在 children,递归检查
+ // if (item.children && item.children.length > 0) {
+ // result = result.concat(findTargetCodes(item.children, targetCodes))
+ // }
+ // }
+ // return result
+}
onMounted(() => {})
// // 对外映射
From 30382fb34df2977a1173873b87952cb2b611e157 Mon Sep 17 00:00:00 2001
From: GGJ <357021191@qq.com>
Date: Thu, 27 Feb 2025 16:24:13 +0800
Subject: [PATCH 3/4] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=80=E9=94=AE?=
=?UTF-8?q?=E9=87=8D=E7=AE=97=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../testScript/components/communication.vue | 17 +++-
.../testScript/components/scriptForm.ts | 16 +---
.../testScript/components/setValueTable.vue | 82 ++++++++++++-------
.../components/testProjectPopup.vue | 5 ++
4 files changed, 77 insertions(+), 43 deletions(-)
diff --git a/frontend/src/views/machine/testScript/components/communication.vue b/frontend/src/views/machine/testScript/components/communication.vue
index 81de5ec..2e52967 100644
--- a/frontend/src/views/machine/testScript/components/communication.vue
+++ b/frontend/src/views/machine/testScript/components/communication.vue
@@ -118,7 +118,14 @@ const info = async () => {
pid: item.id,
name: k.name,
pname: item.name,
- dataType: item.name == '闪变' ? 'avg' : item.name == '暂态' ? 'avg' : 'real',
+ dataType:
+ item.name == '谐波有功功率'
+ ? 'avg'
+ : item.name == '闪变'
+ ? 'avg'
+ : item.name == '暂态'
+ ? 'avg'
+ : 'real',
show: true,
errorFlag: childrenList[0].errorFlag,
enable: childrenList[0].enable
@@ -130,7 +137,13 @@ const info = async () => {
name: k.name,
disabled: false,
pname: item.name,
- dataType: item.name == '闪变' ? 'avg' : item.name == '暂态' ? 'avg' : 'real',
+ dataType: '谐波有功功率'
+ ? 'avg'
+ : item.name == '闪变'
+ ? 'avg'
+ : item.name == '暂态'
+ ? 'avg'
+ : 'real',
show: true,
errorFlag: 0,
enable: 0
diff --git a/frontend/src/views/machine/testScript/components/scriptForm.ts b/frontend/src/views/machine/testScript/components/scriptForm.ts
index 6bfb3be..5af44d1 100644
--- a/frontend/src/views/machine/testScript/components/scriptForm.ts
+++ b/frontend/src/views/machine/testScript/components/scriptForm.ts
@@ -1,3 +1,5 @@
+import { log } from 'console'
+
let scriptForm: any = {
subType: '', //tabcode
ffreq: 50, //频率
@@ -191,16 +193,6 @@ let scriptForm: any = {
]
}
// 追加谐波
-function getScriptForm() {
- for (let i = 2; i < 51; i++) {
- scriptForm.channelList.forEach(item => {
- item.harmList.push({
- harm: i, //谐波次数
- famp: 0, //谐波含有率
- fphase: 0 // 谐波相角
- })
- })
- }
-}
-// getScriptForm()
+
+
export default scriptForm
diff --git a/frontend/src/views/machine/testScript/components/setValueTable.vue b/frontend/src/views/machine/testScript/components/setValueTable.vue
index 6bc09dc..ee42e1a 100644
--- a/frontend/src/views/machine/testScript/components/setValueTable.vue
+++ b/frontend/src/views/machine/testScript/components/setValueTable.vue
@@ -1,5 +1,9 @@
+
+ 一键重算
+
+
{{ row.harmNum ? `(${row.harmNum}次)` : '' }} {{ row.name }}
-
+
+
+
+
+
+
+ {{ typeList.find(item => item.value == row.dataType)?.label || row.dataType }}
+
+
+
{{ row.value }}
-
+
@@ -68,7 +75,7 @@
-
+
diff --git a/frontend/src/views/machine/testScript/components/testProjectPopup.vue b/frontend/src/views/machine/testScript/components/testProjectPopup.vue
index 810d84b..3178f78 100644
--- a/frontend/src/views/machine/testScript/components/testProjectPopup.vue
+++ b/frontend/src/views/machine/testScript/components/testProjectPopup.vue
@@ -154,6 +154,7 @@
:formContent="props.formContent"
:form="form"
:key="initial"
+ @recalculation="recalculation"
/>
@@ -333,6 +334,10 @@ const next = () => {
}, 100)
// 切换轮播图
}
+// 重新计算
+const recalculation = () => {
+ setValueTableRef.value?.open(props.communicationList, {})
+}
// 判断够选通道
const checkFlags = () => {
From 82e8bf2e0b142df7e2d544173154b42e74aafa35 Mon Sep 17 00:00:00 2001
From: GGJ <357021191@qq.com>
Date: Fri, 28 Feb 2025 09:00:15 +0800
Subject: [PATCH 4/4] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=A3=80=E6=B5=8B?=
=?UTF-8?q?=E8=84=9A=E6=9C=AC=E6=A0=B7=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
frontend/src/api/device/testScript/index.ts | 3 ++-
.../api/system/dictionary/dictTree/index.ts | 9 ++++-----
.../machine/testScript/components/tree.vue | 20 +++++++++++++------
3 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/frontend/src/api/device/testScript/index.ts b/frontend/src/api/device/testScript/index.ts
index 396773c..55bf0a3 100644
--- a/frontend/src/api/device/testScript/index.ts
+++ b/frontend/src/api/device/testScript/index.ts
@@ -1,5 +1,6 @@
import type { TestScript } from '@/api/device/interface/testScript'
import http from '@/api'
+import { Loading } from '@element-plus/icons-vue'
/**
* @name 检测脚本管理模块
@@ -48,5 +49,5 @@ export const scriptDtlsCheckDataList = (params: any) => {
}
// 通讯脚本回显
export const checkDataList = (params: any) => {
- return http.post(`/pqScript/checkDataList`, params)
+ return http.post(`/pqScript/checkDataList`, params, { loading: true })
}
diff --git a/frontend/src/api/system/dictionary/dictTree/index.ts b/frontend/src/api/system/dictionary/dictTree/index.ts
index 4abe467..bc2e4de 100644
--- a/frontend/src/api/system/dictionary/dictTree/index.ts
+++ b/frontend/src/api/system/dictionary/dictTree/index.ts
@@ -1,15 +1,15 @@
import http from '@/api'
import { type Dict } from '@/api/system/dictionary/interface'
-import {c} from "vite/dist/node/types.d-aGj9QkWt";
+import { c } from 'vite/dist/node/types.d-aGj9QkWt'
//获取字典类型
export const getDictTreeByCode = (params: Dict.ResDictTree) => {
- const code = params.code || '';
- return http.get(`/dictTree/getTreeByCode?code=${code}`)
+ const code = params.code || ''
+ return http.get(`/dictTree/getTreeByCode?code=${code}`, { loading: true })
}
export const getDictTreeByName = (params: Dict.ResDictTree) => {
- const name = params.name || '';
+ const name = params.name || ''
return http.get(`/dictTree/getTreeByName?name=${name}`)
}
@@ -27,4 +27,3 @@ export const updateDictTree = (params: Dict.ResDictTree) => {
export const deleteDictTree = (params: Dict.ResDictTree) => {
return http.post(`/dictTree/delete?id=${params.id}`)
}
-
diff --git a/frontend/src/views/machine/testScript/components/tree.vue b/frontend/src/views/machine/testScript/components/tree.vue
index 2026203..f12ae11 100644
--- a/frontend/src/views/machine/testScript/components/tree.vue
+++ b/frontend/src/views/machine/testScript/components/tree.vue
@@ -9,7 +9,7 @@
@node-click="handleNodeClick"
>
-
+
{{ data.scriptTypeName || data.sourceDesc }}
@@ -34,19 +34,27 @@ const defaultProps = {
label: 'scriptTypeName',
pid: 'pid'
}
+const activeName = ref('')
+const childActiveName = ref('')
const handleNodeClick = (data, node) => {
let code = ['Base', 'VOL', 'Freq', 'Harm', 'Base_0_10', 'Base_20_85', 'Base_110_200']
const parents = getParentNodes(node, [])
parents.pop()
parents.unshift(node.data)
parents.reverse()
+ let active = parents[0].scriptTypeCode
+ let childActive = findTargetCodes(parents, code)[0] || ''
// 获取当前节点的直接父节点
-
- emit('setTab', {
- activeName: parents[0].scriptTypeCode,
- childActiveName: findTargetCodes(parents, code)[0] || ''
- })
+ if (activeName.value != active || childActiveName.value != childActive) {
+ activeName.value = active
+ childActiveName.value = childActive
+ emit('setTab', {
+ activeName: active,
+ childActiveName: childActive
+ })
+ }
}
+
// 返回父级
const getParentNodes = (node, parents) => {
if (node.parent) {