修改参考设定值添加单位
This commit is contained in:
@@ -95,7 +95,7 @@
|
||||
? '/'
|
||||
: '' +
|
||||
row.channelList[item.num + 1].famp +
|
||||
(valueCode == 'Absolute' ? 'V' : '%')
|
||||
(valueCode == 'Absolute' ? 'A' : '%')
|
||||
}}
|
||||
</td>
|
||||
<td>
|
||||
@@ -135,36 +135,42 @@
|
||||
<!-- </template>-->
|
||||
<!-- </el-progress>-->
|
||||
<div class="loading-container" v-if="showLoading">
|
||||
<div style="width: 80%; height: 80%;" class="loading-box">
|
||||
<div style="width: 80%; height: 80%" class="loading-box">
|
||||
<div class="loading-circle"></div>
|
||||
<div class="loading-text">Loading...</div>
|
||||
</div>
|
||||
<!-- <div style="color:#fff;width: 80%;text-align: center;">Loading...</div>-->
|
||||
</div>
|
||||
<div class="loading-container" v-else>
|
||||
<div style="width: 80%; height: 80%; " class="loading-box">
|
||||
<div style="width: 80%; height: 80%" class="loading-box">
|
||||
<div class="loading-circle static"></div>
|
||||
<div class="loading-text">Loading</div>
|
||||
</div>
|
||||
<!-- <div style="color:#fff;width: 80%;text-align: center;">Loading...</div>-->
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin-top: 10px;">
|
||||
<div style="margin-top: 10px">
|
||||
<span>标准源加量输出:{{ hour }}时{{ minute }}分{{ second }}秒</span>
|
||||
</div>
|
||||
<div style="margin-top: 10px;">
|
||||
<el-button :icon="VideoPlay"
|
||||
<div style="margin-top: 10px">
|
||||
<el-button
|
||||
:icon="VideoPlay"
|
||||
type="primary"
|
||||
size="large"
|
||||
@click="startLoading"
|
||||
:disabled="pauseDisabled"
|
||||
>启动</el-button>
|
||||
<el-button :icon="VideoPause"
|
||||
>
|
||||
启动
|
||||
</el-button>
|
||||
<el-button
|
||||
:icon="VideoPause"
|
||||
type="primary"
|
||||
size="large"
|
||||
@click="stopLoading"
|
||||
:disabled="pauseDisabled"
|
||||
>停止</el-button>
|
||||
>
|
||||
停止
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -187,7 +193,8 @@
|
||||
v-if="showDialog"
|
||||
/>
|
||||
<!-- 查看 -->
|
||||
<ViewRow ref="viewRowRef"
|
||||
<ViewRow
|
||||
ref="viewRowRef"
|
||||
:activeName="activeName"
|
||||
:formContent="props.formContent"
|
||||
@close="viewDialog = false"
|
||||
@@ -202,7 +209,17 @@ import Tree from './tree.vue'
|
||||
import Commun from '@/views/machine/testScript/components//communication.vue'
|
||||
import { type CascaderOption, ElMessage } from 'element-plus'
|
||||
import { getTreeData } from '@/api/check/test'
|
||||
import {CirclePlus, Delete, Check, CopyDocument, View, EditPen, VideoPlay, VideoPause, Loading} from '@element-plus/icons-vue'
|
||||
import {
|
||||
CirclePlus,
|
||||
Delete,
|
||||
Check,
|
||||
CopyDocument,
|
||||
View,
|
||||
EditPen,
|
||||
VideoPlay,
|
||||
VideoPause,
|
||||
Loading
|
||||
} from '@element-plus/icons-vue'
|
||||
import type { TestScript } from '@/api/device/interface/testScript'
|
||||
import TestProjectPopup from '@/views/machine/testScript/components/testProjectPopup.vue'
|
||||
import { CheckData } from '@/api/check/interface'
|
||||
@@ -248,7 +265,6 @@ const props = defineProps({
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
const showDialog = ref(false)
|
||||
const viewDialog = ref(false)
|
||||
const dictStore = useDictStore()
|
||||
@@ -287,45 +303,45 @@ const second = ref(0)
|
||||
|
||||
const emit = defineEmits(['update:activeName', 'update:activeIndex', 'update:startDisabeld', 'update:pauseDisabled'])
|
||||
|
||||
watch(()=>props.formControl.scriptId,async ()=>{
|
||||
watch(
|
||||
() => props.formControl.scriptId,
|
||||
async () => {
|
||||
if (props.formControl.scriptId != '') {
|
||||
|
||||
nextTick(async () => {
|
||||
await getTree()
|
||||
console.log('props.formControl.scriptId')
|
||||
treeRef.value.checkTree()
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
const controlContent = ref<controlSource.ResControl>({
|
||||
userPageId: '',
|
||||
scriptId: '',
|
||||
scriptIndex: 0,
|
||||
sourceId: '',
|
||||
sourceId: ''
|
||||
})
|
||||
// 获取树
|
||||
const getTree = () => {
|
||||
getTreeData({
|
||||
scriptId: props.formControl.scriptId,
|
||||
scriptId: props.formControl.scriptId
|
||||
}).then(res => {
|
||||
if (res.code === 'A0000') {
|
||||
treeData.value = res.data
|
||||
//console.log('tree',res.data)
|
||||
// 为 treeData 及其子节点添加 id
|
||||
let idCounter = 0;
|
||||
let idCounter = 0
|
||||
const addIdToTree = (nodes: any[]) => {
|
||||
nodes.forEach(node => {
|
||||
node.id = idCounter++; // 为每个节点添加唯一的 id
|
||||
node.id = idCounter++ // 为每个节点添加唯一的 id
|
||||
if (node.children && node.children.length > 0) {
|
||||
node.disabled = true
|
||||
addIdToTree(node.children); // 递归为子节点添加 id
|
||||
addIdToTree(node.children) // 递归为子节点添加 id
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
addIdToTree(treeData.value);
|
||||
addIdToTree(treeData.value)
|
||||
|
||||
// 添加tab子项
|
||||
props.options.forEach((k: any, i: number) => {
|
||||
@@ -335,7 +351,6 @@ const getTree = () => {
|
||||
item.children.forEach((s: any) => {
|
||||
k.children.forEach((P: any) => {
|
||||
if (P.code == s.scriptTypeCode) {
|
||||
|
||||
tabData.value[i].children.push({
|
||||
label: P.label,
|
||||
value: P.code,
|
||||
@@ -364,10 +379,8 @@ const getTree = () => {
|
||||
}
|
||||
})
|
||||
//console.log('获取树')
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 设置树点击tab
|
||||
const setTab = row => {
|
||||
activeName.value = row.activeName
|
||||
@@ -396,8 +409,6 @@ const tabChange = () => {
|
||||
childActiveName.value =
|
||||
tabData.value.filter((item: any) => item.value == activeName.value)[0]?.children[0]?.value || ''
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
inquireTable()
|
||||
}
|
||||
@@ -425,13 +436,11 @@ const inquireTable = () => {
|
||||
//console.log('treeData',treeData.value)
|
||||
}
|
||||
|
||||
|
||||
// 查看
|
||||
const view = (row: Partial<TestScript.ResTestScript> = {}) => {
|
||||
|
||||
getCommunication()
|
||||
//当前点击的一级tab
|
||||
const parentTabName = communicationList.value.find(t => t.id === activeName.value)?.name || '未找到对应名称';
|
||||
const parentTabName = communicationList.value.find(t => t.id === activeName.value)?.name || '未找到对应名称'
|
||||
//当前点击的二级tab
|
||||
const childrenTabName = ref('')
|
||||
tabData.value.forEach((item: any) => {
|
||||
@@ -445,10 +454,8 @@ const view = (row: Partial<TestScript.ResTestScript> = {}) => {
|
||||
})
|
||||
viewDialog.value = true
|
||||
setTimeout(() => {
|
||||
|
||||
viewRowRef.value?.open(row, communicationList.value, parentTabName, childrenTabName.value)
|
||||
}, 0)
|
||||
|
||||
}
|
||||
|
||||
// 定义 startLoading 方法
|
||||
@@ -479,7 +486,6 @@ const stopLoading = async () => {
|
||||
ElMessage.success({ message: '停止中...', duration: 5000 })
|
||||
}
|
||||
|
||||
|
||||
const startTimeCount = () => {
|
||||
// Loading效果展示
|
||||
showLoading.value = true
|
||||
@@ -500,7 +506,7 @@ const secondToTime = (secd: number) => {
|
||||
//将秒数转换成时分秒
|
||||
hour.value = Math.floor(secd / 3600)
|
||||
minute.value = Math.floor((secd - hour.value * 3600) / 60)
|
||||
second.value = Math.floor(secd % 60);
|
||||
second.value = Math.floor(secd % 60)
|
||||
}
|
||||
|
||||
const stopTimeCount = () => {
|
||||
@@ -519,7 +525,6 @@ const addTab = (row: any) => {
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
getTree()
|
||||
props.options.forEach((item: any) => {
|
||||
tabData.value.push({
|
||||
@@ -672,11 +677,13 @@ defineExpose({
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
.hidden-tab {
|
||||
display: none;
|
||||
@@ -690,7 +697,6 @@ defineExpose({
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
<style>
|
||||
input::-webkit-inner-spin-button {
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<el-table-column prop="phase" label="相别" />
|
||||
<el-table-column prop="value" label="参考设定值">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.show">{{ parseFloat((row.value - 0).toFixed(4)) }}</span>
|
||||
<span v-if="row.show">{{ parseFloat((row.value - 0).toFixed(4)) }}{{ setUnit(row) || '' }}</span>
|
||||
<el-input type="number" v-else v-model="row.value" placeholder="请输入值" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -96,6 +96,10 @@ const props = defineProps({
|
||||
form: {
|
||||
type: [Object, Array],
|
||||
required: true
|
||||
},
|
||||
valueCode: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
const emit = defineEmits(['recalculation'])
|
||||
@@ -213,6 +217,112 @@ const isEqual = (obj1: any, obj2: any) => {
|
||||
|
||||
return true
|
||||
}
|
||||
const unit = [
|
||||
{
|
||||
label: '频率',
|
||||
unit: 'Hz'
|
||||
},
|
||||
{
|
||||
label: '相电压有效值',
|
||||
unit: 'V'
|
||||
},
|
||||
{
|
||||
label: '电压偏差',
|
||||
unit: '%'
|
||||
},
|
||||
{
|
||||
label: '电压相角',
|
||||
unit: '°'
|
||||
},
|
||||
{
|
||||
label: '基波电压有效值',
|
||||
unit: ''
|
||||
},
|
||||
{
|
||||
label: '电流有效值',
|
||||
unit: 'A'
|
||||
},
|
||||
{
|
||||
label: '电流相角',
|
||||
unit: '°'
|
||||
},
|
||||
{
|
||||
label: '基波电流有效值',
|
||||
unit: ''
|
||||
},
|
||||
{
|
||||
label: '谐波电压',
|
||||
unit: '%'
|
||||
},
|
||||
{
|
||||
label: '谐波电流',
|
||||
unit: '%'
|
||||
},
|
||||
{
|
||||
label: '谐波电流幅值',
|
||||
unit: 'A'
|
||||
},
|
||||
{
|
||||
label: '谐波有功功率',
|
||||
unit: 'W'
|
||||
},
|
||||
{
|
||||
label: '间谐波电压',
|
||||
unit: '%'
|
||||
},
|
||||
{
|
||||
label: '间谐波电流',
|
||||
unit: '%'
|
||||
},
|
||||
{
|
||||
label: '电压幅值',
|
||||
unit: '%'
|
||||
},
|
||||
{
|
||||
label: '持续时间',
|
||||
unit: '周波'
|
||||
},
|
||||
{
|
||||
label: '三相电压不平衡度',
|
||||
unit: '%'
|
||||
},
|
||||
{
|
||||
label: '三相电流不平衡度',
|
||||
unit: '%'
|
||||
},
|
||||
{
|
||||
label: '闪变',
|
||||
unit: ''
|
||||
},
|
||||
|
||||
{
|
||||
label: '电流',
|
||||
unit: props.valueCode == 'Absolute' ? 'A' : '%'
|
||||
},
|
||||
|
||||
]
|
||||
// 参考设定值添加单位
|
||||
const setUnit = (row: any) => {
|
||||
console.log('🚀 ~ setUnit ~ row:', row)
|
||||
let text = ''
|
||||
if (row.pname == '暂态') {
|
||||
row.name == '电压幅值' ? (text = '%') : ''
|
||||
row.name == '持续时间' ? (text = '周波') : ''
|
||||
} else if (row.pname == '电压') {
|
||||
let o = props.valueCode == 'Absolute' ? 'V' : '%'
|
||||
row.name == '相电压有效值' ? (text = o) : ''
|
||||
row.name == '电压偏差' ? (text = '%') : ''
|
||||
row.name == '电压相角' ? (text = '°') : ''
|
||||
}else if (row.pname == '电流') {
|
||||
let o = props.valueCode == 'Absolute' ? 'A' : '%'
|
||||
row.name == '电流有效值' ? (text = o) : ''
|
||||
row.name == '电流相角' ? (text = '°') : ''
|
||||
} else {
|
||||
text = unit.filter(item => item.label == row.pname)[0]?.unit
|
||||
}
|
||||
|
||||
return text || ''
|
||||
}
|
||||
const save = () => {
|
||||
dialogVisible.value = false
|
||||
}
|
||||
@@ -224,6 +334,7 @@ const getTableData = () => {
|
||||
const close = () => {
|
||||
dialogVisible.value = false
|
||||
}
|
||||
|
||||
onMounted(() => {})
|
||||
|
||||
// 对外映射
|
||||
|
||||
@@ -154,6 +154,7 @@
|
||||
:formContent="props.formContent"
|
||||
:form="form"
|
||||
:key="initial"
|
||||
:valueCode=valueCode
|
||||
@recalculation="recalculation"
|
||||
/>
|
||||
</el-carousel-item>
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
? '/'
|
||||
: '' +
|
||||
row.channelList[item.num + 1].famp +
|
||||
(valueCode == 'Absolute' ? 'V' : '%')
|
||||
(valueCode == 'Absolute' ? 'A' : '%')
|
||||
}}
|
||||
</td>
|
||||
<td>
|
||||
|
||||
Reference in New Issue
Block a user