联调 新增检测脚本
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
</div>
|
||||
<div class="data-check-content">
|
||||
<div class="content-tree">
|
||||
<Tree :scriptId="props.scriptId" />
|
||||
<Tree :formContent="props.formContent" />
|
||||
</div>
|
||||
<div class="content-tree" style="width: 400px">
|
||||
<Commun :options="props.options" />
|
||||
@@ -91,7 +91,13 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<TestProjectPopup ref="testProjectPopup" :options="props.options" :activeName="activeName" @addTab="addTab" />
|
||||
<TestProjectPopup
|
||||
ref="testProjectPopupRef"
|
||||
:options="props.options"
|
||||
:activeName="activeName"
|
||||
@addTab="addTab"
|
||||
:formContent="props.formContent"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -104,9 +110,10 @@ import type { TestScript } from '@/api/device/interface/testScript'
|
||||
import TestProjectPopup from '@/views/machine/testScript/components/testProjectPopup.vue'
|
||||
|
||||
interface TabOption {
|
||||
label: string
|
||||
name: string
|
||||
value: string
|
||||
label?: string
|
||||
name?: string
|
||||
value?: string
|
||||
code?: string
|
||||
children?: TabOption[]
|
||||
}
|
||||
|
||||
@@ -115,13 +122,13 @@ const props = defineProps({
|
||||
type: Array as PropType<TabOption[]>,
|
||||
required: true
|
||||
},
|
||||
scriptId: {
|
||||
type: String,
|
||||
formContent: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
const activeName = ref('')
|
||||
const testProjectPopup = ref()
|
||||
const testProjectPopupRef = ref()
|
||||
const tableData = [
|
||||
{ sort: 1, frequency: 42.5, L1: '电压:57.75V 相角:0°', L2: '电压:57.75V 相角:120°', L3: '电压:57.75V 相角:-120°' },
|
||||
{ sort: 2, frequency: 50, L1: '电压:57.75V 相角:0°', L2: '电压:57.75V 相角:120°', L3: '电压:57.75V 相角:-120°' },
|
||||
@@ -136,38 +143,41 @@ const tabData: any = ref([])
|
||||
const openDialog = (titleType: string, row: Partial<TestScript.ResTestScript> = {}) => {
|
||||
if (titleType == 'add') {
|
||||
}
|
||||
testProjectPopup.value?.open(titleType, row)
|
||||
testProjectPopupRef.value?.open(titleType, row)
|
||||
}
|
||||
// 新增保存
|
||||
const addTab = (row: any) => {
|
||||
let data = JSON.parse(JSON.stringify(row))
|
||||
let flag = true
|
||||
let list: any = {}
|
||||
let childrenList = {}
|
||||
tabData.value.forEach(item => {
|
||||
if (item.value == activeName.value) {
|
||||
// item.children.push(JSON.parse(JSON.stringify(row)))
|
||||
list = item
|
||||
item.children.forEach(k => {
|
||||
if (k.value == row.value) {
|
||||
flag = false
|
||||
childrenList = k
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
if (flag) {
|
||||
list.children.push(data)
|
||||
} else {
|
||||
childrenList.children.push(data)
|
||||
}
|
||||
console.log('🚀 ~ addTab ~ tabData.value:', tabData.value)
|
||||
|
||||
// let data = JSON.parse(JSON.stringify(row))
|
||||
// let flag = true
|
||||
// let list: any = {}
|
||||
// let childrenList: any = {}
|
||||
// tabData.value.forEach(item => {
|
||||
// if (item.value == activeName.value) {
|
||||
// // item.children.push(JSON.parse(JSON.stringify(row)))
|
||||
// list = item
|
||||
// item.children.forEach(k => {
|
||||
// if (k.value == row.value) {
|
||||
// flag = false
|
||||
// childrenList = k
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// })
|
||||
// if (flag) {
|
||||
// list.children.push(data)
|
||||
// } else {
|
||||
// childrenList.children.push(data)
|
||||
// }
|
||||
}
|
||||
onMounted(() => {
|
||||
console.log('🚀 ~ onMounted ~ props.options:', props.options)
|
||||
|
||||
props.options.forEach(item => {
|
||||
tabData.value.push({
|
||||
label: item.label.replace(/准确度|检测/g, ''),
|
||||
value: item.value,
|
||||
code: item.code,
|
||||
children: []
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user