方案数据改为列表点击修改测试项,数据绑定修改设备绑定

This commit is contained in:
zhujiyan
2024-09-26 13:42:14 +08:00
parent 6803a04d07
commit 1c9e53869c
3 changed files with 32 additions and 15 deletions

View File

@@ -23,7 +23,7 @@
</el-form>
<!-- 测试项信息&数据绑定页面 -->
<el-tabs type="border-card" v-model="activeName" v-if="popupType != 0 && popupType != 1">
<el-tab-pane label="测试项信息" :name="0">
<el-tab-pane label="测试项信息" :name="0" v-if="openType == 'tree'">
<el-form
:model="form1"
ref="ruleFormRef2"
@@ -167,7 +167,7 @@
</el-form-item>
</el-form>
</el-tab-pane>
<el-tab-pane label="数据绑定" :name="2">
<el-tab-pane label="数据绑定" :name="1" v-if="openType == 'table'">
<TreeTransfers :fromData="unBindList" :toData="bindList" @getData="getData" />
</el-tab-pane>
</el-tabs>
@@ -386,9 +386,19 @@ const title: any = ref('')
const popupType: any = ref(null)
//方案/测试项id
const planId: any = ref('')
//打开的类型
const openType = ref('')
const detailsType = (val: any) => {
openType.value = val
if (val == 'tree') {
activeName.value = 0
}
if (val == 'table') {
activeName.value = 1
}
}
//回显方案、测试项操作
const details = (val: any) => {
console.log(val, '回显方案测试项操作66666')
if (val.records && val.records.length != 0) {
form.value = {
describe: val.describe,
@@ -425,7 +435,6 @@ const open = async (val: any, id: any) => {
title.value = val == 0 ? '新增方案' : val == 1 ? '修改方案' : val == 2 ? '新增测试项' : '修改测试项'
dialogVisible.value = true
planId.value = id
console.log(11111, val, '==============>>>>>>>>')
//新增方案或者测试项数据
if (val == 0 || val == 2) {
initForm()
@@ -444,7 +453,7 @@ const open = async (val: any, id: any) => {
getDeviceList({ id: id, isTrueFlag: 1 }).then(res => {
bindList.value = res.data
})
activeName.value = 0
// activeName.value = 0
}
}
//获取选择的绑定的数据
@@ -558,6 +567,17 @@ const submit = () => {
}
//修改测试项
if (popupType.value == 3) {
let subForm = JSON.parse(JSON.stringify(form1.value))
subForm.list = checkedIdList.value
updateRecord(subForm).then((res: any) => {
if (res.code == 'A0000') {
ElMessage.success('修改测试项成功')
initForm()
emit('onSubmit')
close()
}
})
return
ruleFormRef2.value.validate((valid: any) => {
if (valid) {
let subForm = JSON.parse(JSON.stringify(form1.value))
@@ -576,7 +596,7 @@ const submit = () => {
})
}
}
defineExpose({ open, details })
defineExpose({ open, details, detailsType })
</script>
<style lang="scss" scoped>
::v-deep .el-form-item__content {

View File

@@ -188,20 +188,20 @@ const add = (node: any, data: any) => {
}
/** 编辑树节点 */
const edit = async (node: Node, data: any) => {
console.log(data, '????????????')
planId.value = data.id
await getTestRecordInfo(planId.value)
.then(res => {
console.log(res, '++++++++++++++++++++195========>')
//修改方案
if (data.children) {
dialogRef.value.details(res.data)
dialogRef.value.detailsType("")
handleOpen(1, planId.value)
}
//修改测试项
else {
monitorId.value = data.id
dialogRef.value.details(res.data.records[0])
dialogRef.value.detailsType("tree")
handleOpen(3, planId.value)
}
})