脚本切换
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user