微调
This commit is contained in:
@@ -9,7 +9,7 @@ export namespace controlSource {
|
||||
export interface ResControl {
|
||||
userPageId: string;
|
||||
scriptId: string;
|
||||
scriptIndex: string;
|
||||
scriptIndex: number;
|
||||
sourceId: string;
|
||||
}
|
||||
}
|
||||
@@ -179,6 +179,8 @@ import { useDictStore } from '@/stores/modules/dict'
|
||||
import { useHandleData } from '@/hooks/useHandleData'
|
||||
import { scriptDtlsCheckDataList } from '@/api/device/testScript/index'
|
||||
import ViewRow from '@/views/machine/testScript/components/viewRow.vue'
|
||||
import { startSimulateTest,closeSimulateTest } from '@/api/device/controlSource/index.ts'
|
||||
import { controlSource } from '@/api/device/interface/controlSource'
|
||||
interface TabOption {
|
||||
label?: string
|
||||
name?: string
|
||||
@@ -197,6 +199,10 @@ const props = defineProps({
|
||||
formContent: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
formControl: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
const showDialog = ref(false)
|
||||
@@ -204,6 +210,7 @@ const viewDialog = ref(false)
|
||||
const dictStore = useDictStore()
|
||||
const activeName = ref('')
|
||||
const childActiveName = ref('')
|
||||
const childActiveIndex = ref(0)
|
||||
const firstName = 'first'
|
||||
const viewRowRef = ref()
|
||||
const communicationList = ref([])
|
||||
@@ -226,6 +233,14 @@ const column = ref([
|
||||
num: 4
|
||||
}
|
||||
])
|
||||
|
||||
const emit = defineEmits(['update:activeName','update:activeIndex'])
|
||||
const controlContent = ref<controlSource.ResControl>({
|
||||
userPageId: '',
|
||||
scriptId: '',
|
||||
scriptIndex: 0,
|
||||
sourceId: '',
|
||||
})
|
||||
// 获取树
|
||||
const getTree = () => {
|
||||
getTreeData({
|
||||
@@ -273,7 +288,10 @@ const getTree = () => {
|
||||
const setTab = row => {
|
||||
activeName.value = row.activeName
|
||||
childActiveName.value = row.childActiveName
|
||||
childActiveIndex.value = row.activeIndex
|
||||
getTree()
|
||||
emit('update:activeName', activeName.value) // 触发事件并传递 activeName.value
|
||||
emit('update:activeIndex', row.activeIndex) // 触发事件并传递 activeName.value
|
||||
}
|
||||
const copyActiveName = ref('')
|
||||
// 获取通讯脚本点击
|
||||
@@ -353,6 +371,25 @@ const view = (row: Partial<TestScript.ResTestScript> = {}) => {
|
||||
|
||||
}
|
||||
|
||||
// 定义 startLoading 方法
|
||||
const startLoading = async () => {
|
||||
// 启动加载逻辑
|
||||
controlContent.value.userPageId = 'cdf'
|
||||
controlContent.value.scriptId = '9ff96807cf8c7524587982ed8baa8b57'
|
||||
controlContent.value.scriptIndex = props.formControl.scriptIndex
|
||||
controlContent.value.sourceId = props.formControl.sourceId
|
||||
await startSimulateTest(controlContent.value)
|
||||
}
|
||||
|
||||
// 定义 startLoading 方法
|
||||
const stopLoading = async () => {
|
||||
// 启动加载逻辑
|
||||
controlContent.value.userPageId = 'cdf'
|
||||
controlContent.value.scriptId = '9ff96807cf8c7524587982ed8baa8b57'
|
||||
controlContent.value.scriptIndex = childActiveIndex.value
|
||||
controlContent.value.sourceId = props.formControl.sourceId
|
||||
await closeSimulateTest(controlContent.value)
|
||||
}
|
||||
|
||||
// 获取左边树数据
|
||||
// 新增保存
|
||||
|
||||
@@ -39,8 +39,9 @@ const defaultProps = {
|
||||
}
|
||||
const activeName = ref('')
|
||||
const childActiveName = ref('')
|
||||
const activeIndex = ref()
|
||||
const handleNodeClick = (data, node) => {
|
||||
console.log('handleNodeClick', data, node)
|
||||
console.log('handleNodeClick', props.treeData)
|
||||
let code = ['Base', 'VOL', 'Freq', 'Harm', 'Base_0_10', 'Base_20_85', 'Base_110_200']
|
||||
const parents = getParentNodes(node, [])
|
||||
parents.pop()
|
||||
@@ -54,7 +55,8 @@ const handleNodeClick = (data, node) => {
|
||||
childActiveName.value = childActive
|
||||
emit('setTab', {
|
||||
activeName: active,
|
||||
childActiveName: childActive
|
||||
childActiveName: childActive,
|
||||
activeIndex:data.index
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -98,6 +100,7 @@ function findTargetCodes(data: any[], targetCodes: string[]) {
|
||||
function handleCheckChange(data, checked) {
|
||||
if (checked) {
|
||||
// Uncheck all other nodes
|
||||
console.log('handleCheckChange', data.id)
|
||||
props.treeData.forEach((node) => {
|
||||
if (node.id !== data.id) {
|
||||
node.checked = false;
|
||||
|
||||
@@ -25,12 +25,14 @@
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-card v-if="show">
|
||||
<ControlSourceDetail v-if="secondLevelOptions.length > 0" :options="secondLevelOptions" :formContent="formContent" />
|
||||
<ControlSourceDetail v-if="secondLevelOptions.length > 0" :options="secondLevelOptions" :formContent="formContent" :formControl="controlContent"
|
||||
@update:activeName="handleActiveNameChange"
|
||||
@update:active-index="handleActiveIndexChange"/>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, nextTick, onMounted, onBeforeMount, reactive } from 'vue'
|
||||
import { ref, nextTick, onMounted, onBeforeMount, reactive, watch } from 'vue'
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
import ControlSourceDetail from '@/views/machine/controlSource/components/controlSourceDetail.vue'
|
||||
import { type TestScript } from '@/api/device/interface/testScript'
|
||||
@@ -71,7 +73,7 @@ const formContent = ref<TestScript.ResTestScript>({
|
||||
const controlContent = ref<controlSource.ResControl>({
|
||||
userPageId: '',
|
||||
scriptId: '',
|
||||
scriptIndex: '',
|
||||
scriptIndex: 0,
|
||||
sourceId: '',
|
||||
})
|
||||
//开始创建webSocket客户端
|
||||
@@ -79,6 +81,7 @@ const dataSocket = reactive({
|
||||
socketServe: socketClient.Instance,
|
||||
});
|
||||
const webMsgSend = ref()//webSocket推送的数据
|
||||
|
||||
onMounted(async () => {
|
||||
// 检查 socketClient.Instance 是否存在
|
||||
if (!socketClient.Instance) {
|
||||
@@ -162,7 +165,6 @@ const treeInfo = async (currentMode: string) => {
|
||||
const setAllTree = await setTree(allOptions[0]?.children, result1)
|
||||
secondLevelOptions.push(...(setAllTree || []))
|
||||
modeId.value = dictStore.getDictData('Pattern').find(item => item.name === currentMode)?.id
|
||||
console.log('🚀 ~ treeInfo ~ result1:', currentMode)
|
||||
}
|
||||
|
||||
const setTree = async (data, data1) => {
|
||||
@@ -186,11 +188,21 @@ const convertToOptions = (dictTree: Dict.ResDictTree[]): CascaderOption[] => {
|
||||
}))
|
||||
}
|
||||
|
||||
const scriptId = ref('')
|
||||
const scriptIndex = ref(0)
|
||||
const handleActiveNameChange = (newActiveName: string) => {
|
||||
scriptId.value = newActiveName
|
||||
}
|
||||
|
||||
const handleActiveIndexChange = (newActiveIndex: number) => {
|
||||
|
||||
scriptIndex.value = newActiveIndex
|
||||
}
|
||||
|
||||
const start = async () => {
|
||||
controlContent.value.userPageId = 'cdf'
|
||||
controlContent.value.scriptId = '9ff96807cf8c7524587982ed8baa8b5'
|
||||
controlContent.value.scriptIndex = '1'
|
||||
controlContent.value.scriptId = '9ff96807cf8c7524587982ed8baa8b57'
|
||||
controlContent.value.scriptIndex = scriptIndex.value
|
||||
await checkSimulate(controlContent.value)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user