脚本切换
This commit is contained in:
@@ -11,6 +11,5 @@ export namespace controlSource {
|
|||||||
scriptId: string;
|
scriptId: string;
|
||||||
scriptIndex: number;
|
scriptIndex: number;
|
||||||
sourceId: string;
|
sourceId: string;
|
||||||
valueType:number // 1为绝对值脚本、2为相对值脚本
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -72,6 +72,7 @@ export default class SocketService {
|
|||||||
|
|
||||||
// 得到服务端发送过来的数据
|
// 得到服务端发送过来的数据
|
||||||
this.ws.onmessage = (event) => {
|
this.ws.onmessage = (event) => {
|
||||||
|
// console.log('🚀 ~ SocketService ~ connect ~ event:', event)
|
||||||
if(event.data == 'over') {
|
if(event.data == 'over') {
|
||||||
//心跳消息处理
|
//心跳消息处理
|
||||||
this.lastResponseHeartTime = Date.now();
|
this.lastResponseHeartTime = Date.now();
|
||||||
|
|||||||
@@ -125,7 +125,13 @@
|
|||||||
<div style="width: 80%;height: 80%;" class="loading-box">
|
<div style="width: 80%;height: 80%;" class="loading-box">
|
||||||
<Loading style="color: #003078;"/>
|
<Loading style="color: #003078;"/>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
<div style="margin-top: 10px;">
|
<div style="margin-top: 10px;">
|
||||||
@@ -199,6 +205,8 @@ interface TabOption {
|
|||||||
code?: string
|
code?: string
|
||||||
children?: TabOption[]
|
children?: TabOption[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const communRef = ref()
|
const communRef = ref()
|
||||||
const treeData = ref<CheckData.TreeItem[]>([])
|
const treeData = ref<CheckData.TreeItem[]>([])
|
||||||
const valueCode = ref('') //Absolute绝对值
|
const valueCode = ref('') //Absolute绝对值
|
||||||
@@ -268,12 +276,11 @@ const controlContent = ref<controlSource.ResControl>({
|
|||||||
scriptId: '',
|
scriptId: '',
|
||||||
scriptIndex: 0,
|
scriptIndex: 0,
|
||||||
sourceId: '',
|
sourceId: '',
|
||||||
valueType:-1
|
|
||||||
})
|
})
|
||||||
// 获取树
|
// 获取树
|
||||||
const getTree = () => {
|
const getTree = () => {
|
||||||
getTreeData({
|
getTreeData({
|
||||||
scriptId: '9ff96807cf8c7524587982ed8baa8b57'
|
scriptId: props.formControl.scriptId,
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.code === 'A0000') {
|
if (res.code === 'A0000') {
|
||||||
treeData.value = res.data
|
treeData.value = res.data
|
||||||
@@ -407,10 +414,9 @@ const startLoading = async () => {
|
|||||||
ElMessage.success({message:'启动中...',duration:5000})
|
ElMessage.success({message:'启动中...',duration:5000})
|
||||||
// 启动加载逻辑
|
// 启动加载逻辑
|
||||||
controlContent.value.userPageId = 'cdf'
|
controlContent.value.userPageId = 'cdf'
|
||||||
controlContent.value.scriptId = '9ff96807cf8c7524587982ed8baa8b57'
|
//controlContent.value.scriptId = '9ff96807cf8c7524587982ed8baa8b57'
|
||||||
controlContent.value.scriptIndex = childActiveIndex.value
|
controlContent.value.scriptIndex = childActiveIndex.value
|
||||||
controlContent.value.sourceId = props.formControl.sourceId
|
controlContent.value.sourceId = props.formControl.sourceId
|
||||||
controlContent.value.valueType = 2
|
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
await startSimulateTest(controlContent.value)
|
await startSimulateTest(controlContent.value)
|
||||||
},3000)
|
},3000)
|
||||||
@@ -420,10 +426,9 @@ const startLoading = async () => {
|
|||||||
const stopLoading = async () => {
|
const stopLoading = async () => {
|
||||||
// 启动加载逻辑
|
// 启动加载逻辑
|
||||||
controlContent.value.userPageId = 'cdf'
|
controlContent.value.userPageId = 'cdf'
|
||||||
controlContent.value.scriptId = '9ff96807cf8c7524587982ed8baa8b57'
|
//controlContent.value.scriptId = '9ff96807cf8c7524587982ed8baa8b57'
|
||||||
controlContent.value.scriptIndex = childActiveIndex.value
|
controlContent.value.scriptIndex = childActiveIndex.value
|
||||||
controlContent.value.sourceId = props.formControl.sourceId
|
controlContent.value.sourceId = props.formControl.sourceId
|
||||||
controlContent.value.valueType = 2
|
|
||||||
await closeSimulateTest(controlContent.value)
|
await closeSimulateTest(controlContent.value)
|
||||||
emit('update:pauseDisabled', true)
|
emit('update:pauseDisabled', true)
|
||||||
emit('update:startDisabeld', true)
|
emit('update:startDisabeld', true)
|
||||||
|
|||||||
@@ -17,10 +17,20 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</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>
|
<el-form-item>
|
||||||
<div class="formBut">
|
<!-- <div class="formBut">-->
|
||||||
<el-button type="primary" :icon="Select" @click="start()" :disabled="connectDisabeld">通讯校验</el-button>
|
<el-button type="primary" :icon="Select" @click="start()" :disabled="connectDisabeld">通讯校验</el-button>
|
||||||
</div>
|
<!-- </div>-->
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-card>
|
</el-card>
|
||||||
@@ -54,6 +64,8 @@ import { useModeStore } from '@/stores/modules/mode' // 引入模式 store
|
|||||||
import socketClient from '@/utils/webSocketClient'
|
import socketClient from '@/utils/webSocketClient'
|
||||||
import { checkSimulate } from '@/api/device/controlSource/index.ts'
|
import { checkSimulate } from '@/api/device/controlSource/index.ts'
|
||||||
import { controlSource } from '@/api/device/interface/controlSource'
|
import { controlSource } from '@/api/device/interface/controlSource'
|
||||||
|
import {getPqScriptList} from '@/api/plan/plan.ts'
|
||||||
|
|
||||||
const show = ref(false)
|
const show = ref(false)
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const modeId = ref()
|
const modeId = ref()
|
||||||
@@ -65,6 +77,7 @@ const dictStore = useDictStore()
|
|||||||
const pqSourceList=ref<TestSource.ResTestSource[]>([])//获取指定模式下所有检测源
|
const pqSourceList=ref<TestSource.ResTestSource[]>([])//获取指定模式下所有检测源
|
||||||
const modeStore = useModeStore()
|
const modeStore = useModeStore()
|
||||||
const pqSourceArray = ref<{ label: string; value: string; }[]>()
|
const pqSourceArray = ref<{ label: string; value: string; }[]>()
|
||||||
|
const scriptArray = reactive<{label: string, value: string}[]>([])
|
||||||
const formContent = ref<TestScript.ResTestScript>({
|
const formContent = ref<TestScript.ResTestScript>({
|
||||||
id : '9ff96807cf8c7524587982ed8baa8b57',
|
id : '9ff96807cf8c7524587982ed8baa8b57',
|
||||||
name: '测试',
|
name: '测试',
|
||||||
@@ -85,7 +98,6 @@ const controlContent = ref<controlSource.ResControl>({
|
|||||||
scriptId: '',
|
scriptId: '',
|
||||||
scriptIndex: 0,
|
scriptIndex: 0,
|
||||||
sourceId: '',
|
sourceId: '',
|
||||||
valueType: -1,
|
|
||||||
})
|
})
|
||||||
//开始创建webSocket客户端
|
//开始创建webSocket客户端
|
||||||
const dataSocket = reactive({
|
const dataSocket = reactive({
|
||||||
@@ -142,6 +154,14 @@ onMounted(async () => {
|
|||||||
value: item.id
|
value: item.id
|
||||||
}));
|
}));
|
||||||
controlContent.value.sourceId = pqSourceArray.value[0].value
|
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 () => {
|
nextTick(async () => {
|
||||||
await treeInfo(modeStore.currentMode)
|
await treeInfo(modeStore.currentMode)
|
||||||
formContent.value.pattern = modeId.value
|
formContent.value.pattern = modeId.value
|
||||||
@@ -275,9 +295,7 @@ const handleActiveIndexChange = (newActiveIndex: number) => {
|
|||||||
|
|
||||||
const start = async () => {
|
const start = async () => {
|
||||||
controlContent.value.userPageId = 'cdf'
|
controlContent.value.userPageId = 'cdf'
|
||||||
controlContent.value.scriptId = '9ff96807cf8c7524587982ed8baa8b57'
|
|
||||||
controlContent.value.scriptIndex = scriptIndex.value
|
controlContent.value.scriptIndex = scriptIndex.value
|
||||||
controlContent.value.valueType = 2
|
|
||||||
await checkSimulate(controlContent.value)
|
await checkSimulate(controlContent.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -293,11 +311,11 @@ defineExpose({ open })
|
|||||||
padding: 20px 0 0 20px;
|
padding: 20px 0 0 20px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.formBut {
|
//.formBut {
|
||||||
width: 50%;
|
// width: 50%;
|
||||||
display: flex;
|
// display: flex;
|
||||||
justify-content: end;
|
// justify-content: end;
|
||||||
}
|
//}
|
||||||
.form-five {
|
.form-five {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
|||||||
Reference in New Issue
Block a user