@@ -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(() => {})
// // 对外映射