This commit is contained in:
sjl
2025-03-10 20:00:03 +08:00
4 changed files with 41 additions and 18 deletions

View File

@@ -11,6 +11,5 @@ export namespace controlSource {
scriptId: string;
scriptIndex: number;
sourceId: string;
valueType:number // 1为绝对值脚本、2为相对值脚本
}
}

View File

@@ -72,6 +72,7 @@ export default class SocketService {
// 得到服务端发送过来的数据
this.ws.onmessage = (event) => {
// console.log('🚀 ~ SocketService ~ connect ~ event:', event)
if(event.data == 'over') {
//心跳消息处理
this.lastResponseHeartTime = Date.now();

View File

@@ -138,7 +138,13 @@
<div style="width: 80%;height: 80%;" class="loading-box">
<Loading style="color: #003078;"/>
</div>
<div style="color:#fff;width: 80%;text-align: center;">Loading...</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%;font-size: 30px;">
<Loading style="color: #003078;"/>
</div>
<!-- <div style="color:#fff;width: 80%;text-align: center;">Loading...</div>-->
</div>
</div>
<div style="margin-top: 10px;">
@@ -212,6 +218,8 @@ interface TabOption {
code?: string
children?: TabOption[]
}
const communRef = ref()
const treeData = ref<CheckData.TreeItem[]>([])
const valueCode = ref('') //Absolute绝对值
@@ -281,12 +289,11 @@ const controlContent = ref<controlSource.ResControl>({
scriptId: '',
scriptIndex: 0,
sourceId: '',
valueType:-1
})
// 获取树
const getTree = () => {
getTreeData({
scriptId: '9ff96807cf8c7524587982ed8baa8b57'
scriptId: props.formControl.scriptId,
}).then(res => {
if (res.code === 'A0000') {
treeData.value = res.data
@@ -420,10 +427,9 @@ const startLoading = async () => {
ElMessage.success({message:'启动中...',duration:5000})
// 启动加载逻辑
controlContent.value.userPageId = 'cdf'
controlContent.value.scriptId = '9ff96807cf8c7524587982ed8baa8b57'
//controlContent.value.scriptId = '9ff96807cf8c7524587982ed8baa8b57'
controlContent.value.scriptIndex = childActiveIndex.value
controlContent.value.sourceId = props.formControl.sourceId
controlContent.value.valueType = 2
setTimeout(async () => {
await startSimulateTest(controlContent.value)
},3000)
@@ -433,10 +439,9 @@ const startLoading = async () => {
const stopLoading = async () => {
// 启动加载逻辑
controlContent.value.userPageId = 'cdf'
controlContent.value.scriptId = '9ff96807cf8c7524587982ed8baa8b57'
//controlContent.value.scriptId = '9ff96807cf8c7524587982ed8baa8b57'
controlContent.value.scriptIndex = childActiveIndex.value
controlContent.value.sourceId = props.formControl.sourceId
controlContent.value.valueType = 2
await closeSimulateTest(controlContent.value)
emit('update:pauseDisabled', true)
emit('update:startDisabeld', true)

View File

@@ -17,10 +17,20 @@
/>
</el-select>
</el-form-item>
<el-form-item label='检测脚本' prop='scriptId'>
<el-select v-model="controlContent.scriptId" collapse-tags placeholder="请选择检测脚本">
<el-option
v-for="(option, index) in scriptArray"
:key="index"
:label="option.label"
:value="option.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<div class="formBut">
<!-- <div class="formBut">-->
<el-button type="primary" :icon="Select" @click="start()" :disabled="connectDisabeld">通讯校验</el-button>
</div>
<!-- </div>-->
</el-form-item>
</el-form>
</el-card>
@@ -54,6 +64,8 @@ import { useModeStore } from '@/stores/modules/mode' // 引入模式 store
import socketClient from '@/utils/webSocketClient'
import { checkSimulate } from '@/api/device/controlSource/index.ts'
import { controlSource } from '@/api/device/interface/controlSource'
import {getPqScriptList} from '@/api/plan/plan.ts'
const show = ref(false)
const router = useRouter()
const modeId = ref()
@@ -65,6 +77,7 @@ const dictStore = useDictStore()
const pqSourceList=ref<TestSource.ResTestSource[]>([])//获取指定模式下所有检测源
const modeStore = useModeStore()
const pqSourceArray = ref<{ label: string; value: string; }[]>()
const scriptArray = reactive<{label: string, value: string}[]>([])
const formContent = ref<TestScript.ResTestScript>({
id : '9ff96807cf8c7524587982ed8baa8b57',
name: '测试',
@@ -85,7 +98,6 @@ const controlContent = ref<controlSource.ResControl>({
scriptId: '',
scriptIndex: 0,
sourceId: '',
valueType: -1,
})
//开始创建webSocket客户端
const dataSocket = reactive({
@@ -142,6 +154,14 @@ onMounted(async () => {
value: item.id
}));
controlContent.value.sourceId = pqSourceArray.value[0].value
const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id //获取数据字典中对应的id
const {data} = await getPqScriptList({pattern:patternId})
scriptArray.push(...data.map(item => ({ label: item.name, value: item.id})))
if(scriptArray.length > 0){
controlContent.value.scriptId = scriptArray[0].value
}
nextTick(async () => {
await treeInfo(modeStore.currentMode)
formContent.value.pattern = modeId.value
@@ -275,9 +295,7 @@ const handleActiveIndexChange = (newActiveIndex: number) => {
const start = async () => {
controlContent.value.userPageId = 'cdf'
controlContent.value.scriptId = '9ff96807cf8c7524587982ed8baa8b57'
controlContent.value.scriptIndex = scriptIndex.value
controlContent.value.valueType = 2
await checkSimulate(controlContent.value)
}
@@ -293,11 +311,11 @@ defineExpose({ open })
padding: 20px 0 0 20px;
}
}
.formBut {
width: 50%;
display: flex;
justify-content: end;
}
//.formBut {
// width: 50%;
// display: flex;
// justify-content: end;
//}
.form-five {
display: flex;
flex-wrap: wrap;