微调
This commit is contained in:
24
frontend/src/api/device/controlSource/index.ts
Normal file
24
frontend/src/api/device/controlSource/index.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
import type { controlSource } from '@/api/device/interface/controlSource'
|
||||
import http from '@/api'
|
||||
|
||||
/**
|
||||
* @name 程控源管理模块
|
||||
*/
|
||||
|
||||
//通讯校验
|
||||
export const checkSimulate = (params: controlSource.ResControl) => {
|
||||
return http.post(`/prepare/ytxCheckSimulate`,params)
|
||||
}
|
||||
|
||||
//启动
|
||||
export const startSimulateTest = (params: controlSource.ResControl) => {
|
||||
return http.post(`prepare/startSimulateTest`,params)
|
||||
}
|
||||
|
||||
//停止
|
||||
export const closeSimulateTest = (params: controlSource.ResControl) => {
|
||||
return http.post(`/prepare/closeSimulateTest`,params)
|
||||
}
|
||||
|
||||
|
||||
15
frontend/src/api/device/interface/controlSource.ts
Normal file
15
frontend/src/api/device/interface/controlSource.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import type { ReqPage,ResPage } from '@/api/interface'
|
||||
|
||||
// 被检设备模块
|
||||
export namespace controlSource {
|
||||
|
||||
/**
|
||||
* 被检设备新增、修改、根据id查询返回的对象
|
||||
*/
|
||||
export interface ResControl {
|
||||
userPageId: string;
|
||||
scriptId: string;
|
||||
scriptIndex: string;
|
||||
sourceId: string;
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,10 @@
|
||||
:props="defaultProps"
|
||||
style="width: 100%"
|
||||
:expand-on-click-node="false"
|
||||
:highlight-current="true"
|
||||
@node-click="handleNodeClick"
|
||||
show-checkbox
|
||||
show-checkbox
|
||||
@check-change="handleCheckChange"
|
||||
>
|
||||
<template #default="{ node, data }">
|
||||
<el-tooltip effect="dark" :content="data.sourceDesc || data.scriptTypeName" placement="top" :hide-after="0">
|
||||
@@ -38,6 +40,7 @@ const defaultProps = {
|
||||
const activeName = ref('')
|
||||
const childActiveName = ref('')
|
||||
const handleNodeClick = (data, node) => {
|
||||
console.log('handleNodeClick', data, node)
|
||||
let code = ['Base', 'VOL', 'Freq', 'Harm', 'Base_0_10', 'Base_20_85', 'Base_110_200']
|
||||
const parents = getParentNodes(node, [])
|
||||
parents.pop()
|
||||
@@ -92,7 +95,16 @@ function findTargetCodes(data: any[], targetCodes: string[]) {
|
||||
// return result
|
||||
}
|
||||
|
||||
onMounted(() => {})
|
||||
function handleCheckChange(data, checked) {
|
||||
if (checked) {
|
||||
// Uncheck all other nodes
|
||||
props.treeData.forEach((node) => {
|
||||
if (node.id !== data.id) {
|
||||
node.checked = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
// // 对外映射
|
||||
// defineExpose({ init })
|
||||
</script>
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
ref="dialogFormRef"
|
||||
class="form-five"
|
||||
>
|
||||
<el-form-item label='检测源' prop='sourceIds' >
|
||||
<el-select v-model="sourceValue" collapse-tags placeholder="请选择检测源">
|
||||
<el-form-item label='检测源' prop='sourceId' >
|
||||
<el-select v-model="controlContent.sourceId" collapse-tags placeholder="请选择检测源">
|
||||
<el-option
|
||||
v-for="(option, index) in pqSourceArray"
|
||||
:key="index"
|
||||
@@ -19,7 +19,7 @@
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<div class="formBut">
|
||||
<el-button type="primary" :icon="Select" >通讯校验</el-button>
|
||||
<el-button type="primary" :icon="Select" @click="start()">通讯校验</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@@ -44,6 +44,8 @@ import { CascaderOption, ElMessage } from 'element-plus'
|
||||
import { useRouter } from 'vue-router'
|
||||
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'
|
||||
const show = ref(false)
|
||||
const router = useRouter()
|
||||
const modeId = ref()
|
||||
@@ -65,6 +67,13 @@ const formContent = ref<TestScript.ResTestScript>({
|
||||
standardTime: '2025',
|
||||
state: 1
|
||||
})
|
||||
|
||||
const controlContent = ref<controlSource.ResControl>({
|
||||
userPageId: '',
|
||||
scriptId: '',
|
||||
scriptIndex: '',
|
||||
sourceId: '',
|
||||
})
|
||||
//开始创建webSocket客户端
|
||||
const dataSocket = reactive({
|
||||
socketServe: socketClient.Instance,
|
||||
@@ -118,20 +127,25 @@ onMounted(async () => {
|
||||
label: item.name || '',
|
||||
value: item.id
|
||||
}));
|
||||
|
||||
|
||||
nextTick(async () => {
|
||||
|
||||
await treeInfo(modeStore.currentMode)
|
||||
formContent.value.pattern = modeId.value
|
||||
console.log( formContent.value);
|
||||
show.value = true
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
|
||||
watch(webMsgSend, function (newValue, oldValue) {
|
||||
switch (newValue.requestId) {
|
||||
case 'connect':
|
||||
switch (newValue.operateCode) {
|
||||
case "Source":
|
||||
ElMessage.error('源服务端连接失败')
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
// 获取树字典
|
||||
const treeInfo = async (currentMode: string) => {
|
||||
const data: Dict.ResDictTree = {
|
||||
@@ -172,6 +186,14 @@ const convertToOptions = (dictTree: Dict.ResDictTree[]): CascaderOption[] => {
|
||||
}))
|
||||
}
|
||||
|
||||
|
||||
const start = async () => {
|
||||
controlContent.value.userPageId = 'cdf'
|
||||
controlContent.value.scriptId = '9ff96807cf8c7524587982ed8baa8b5'
|
||||
controlContent.value.scriptIndex = '1'
|
||||
await checkSimulate(controlContent.value)
|
||||
}
|
||||
|
||||
// 对外映射
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
|
||||
@@ -417,8 +417,8 @@ const view = (row: Partial<TestScript.ResTestScript> = {}) => {
|
||||
}
|
||||
// 删除
|
||||
const deleteRow = async (row: any) => {
|
||||
await useHandleData(deleteDtls, { enable: row.enable, index: row.index, scriptId: row.scriptId }, `删除`)
|
||||
getTree()
|
||||
await useHandleData(deleteDtls, { enable: row.enable, index: row.index, scriptId: row.scriptId }, `删除`)
|
||||
getTree()
|
||||
}
|
||||
// 启用
|
||||
const enableRow = async (row: any) => {
|
||||
|
||||
Reference in New Issue
Block a user