Merge branch 'main' of http://192.168.1.22:3000/zcy/canneng-admin
# Conflicts: # src/views/govern/device/planData/index.vue
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
v-model="dialogVisible"
|
||||
:title="title"
|
||||
draggable
|
||||
:style="{ width: activeFormIndex == 0 || activeFormIndex == 1 ? '500px' : '1100px' }"
|
||||
:style="{ width: popupType == 0 || popupType == 1 ? '500px' : '1100px' }"
|
||||
>
|
||||
<!-- 新增方案数据 -->
|
||||
<el-form
|
||||
@@ -12,7 +12,7 @@
|
||||
label-width="140px"
|
||||
:rules="rules1"
|
||||
ref="ruleFormRef1"
|
||||
v-if="activeFormIndex == 0 || activeFormIndex == 1"
|
||||
v-if="popupType == 0 || popupType == 1"
|
||||
>
|
||||
<el-form-item label="方案名称:" prop="itemName">
|
||||
<el-input v-model="form.itemName" placeholder="请输入方案名称" />
|
||||
@@ -22,7 +22,8 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- 测试项信息&数据绑定页面 -->
|
||||
<el-tabs type="border-card" v-model="activeName" v-if="activeFormIndex != 0 && activeFormIndex != 1">
|
||||
{{ popupType }}
|
||||
<el-tabs type="border-card" v-model="activeName" v-if="popupType != 0 && popupType != 1">
|
||||
<el-tab-pane label="测试项信息" :name="0">
|
||||
<el-form
|
||||
:model="form1"
|
||||
@@ -386,24 +387,24 @@ const rules2 = ref({
|
||||
//弹框标题
|
||||
const title: any = ref('')
|
||||
//判断页面显示条件
|
||||
const activeFormIndex: any = ref(null)
|
||||
const popupType: any = ref(null)
|
||||
//方案/测试项id
|
||||
const planId: any = ref('')
|
||||
//回显方案、测试项操作
|
||||
const details = (val: any) => {
|
||||
//修改方案回显
|
||||
if (activeFormIndex.value == 1) {
|
||||
if (popupType.value == 1) {
|
||||
form.value = JSON.parse(JSON.stringify(val))
|
||||
}
|
||||
//修改测试项回显
|
||||
if (activeFormIndex.value == 3) {
|
||||
if (popupType.value == 3) {
|
||||
if (val.records[0] && val.records.length != 0) {
|
||||
form1.value = JSON.parse(JSON.stringify(val.records[0]))
|
||||
} else {
|
||||
initForm()
|
||||
}
|
||||
}
|
||||
if (activeFormIndex.value != 1 && activeFormIndex.value != 3) {
|
||||
if (popupType.value != 1 && popupType.value != 3) {
|
||||
initForm()
|
||||
}
|
||||
}
|
||||
@@ -413,10 +414,11 @@ const unBindList = ref([])
|
||||
const bindList = ref([])
|
||||
//0 新增方案 1 修改方案 2 新增测试项 3 修改测试项 4 设备信息
|
||||
const open = async (val: any, id: any) => {
|
||||
activeFormIndex.value = val
|
||||
popupType.value = val
|
||||
title.value = val == 0 ? '新增方案' : val == 1 ? '修改方案' : val == 2 ? '新增测试项' : '修改测试项'
|
||||
dialogVisible.value = true
|
||||
planId.value = id
|
||||
console.log(11111, val, '==============>>>>>>>>')
|
||||
//新增方案或者测试项数据
|
||||
if (val == 0 || val == 2) {
|
||||
initForm()
|
||||
@@ -429,12 +431,10 @@ const open = async (val: any, id: any) => {
|
||||
//0未绑定数据 1 已绑定数据
|
||||
//获取未绑定树形数据
|
||||
getDeviceList({ id: id, isTrueFlag: 0 }).then(res => {
|
||||
// deviceInfoTreeRef1.value.getTreeList(res.data)
|
||||
unBindList.value = res.data
|
||||
})
|
||||
//获取已绑定树形数据
|
||||
getDeviceList({ id: id, isTrueFlag: 1 }).then(res => {
|
||||
// deviceInfoTreeRef2.value.getTreeList(res.data)
|
||||
bindList.value = res.data
|
||||
})
|
||||
activeName.value = 0
|
||||
@@ -476,7 +476,7 @@ const close = () => {
|
||||
}
|
||||
|
||||
//取消表单校验状态
|
||||
if (activeFormIndex.value == 0 || activeFormIndex.value == 1) {
|
||||
if (popupType.value == 0 || popupType.value == 1) {
|
||||
ruleFormRef1.value && ruleFormRef1.value.resetFields()
|
||||
} else {
|
||||
ruleFormRef2.value && ruleFormRef2.value?.resetFields()
|
||||
@@ -490,7 +490,7 @@ const close = () => {
|
||||
//提交
|
||||
const submit = () => {
|
||||
//新增方案
|
||||
if (activeFormIndex.value == 0) {
|
||||
if (popupType.value == 0) {
|
||||
ruleFormRef1.value.validate(valid => {
|
||||
if (valid) {
|
||||
const subForm = {
|
||||
@@ -512,7 +512,7 @@ const submit = () => {
|
||||
})
|
||||
}
|
||||
//修改方案
|
||||
if (activeFormIndex.value == 1) {
|
||||
if (popupType.value == 1) {
|
||||
ruleFormRef1.value.validate((valid: boolean) => {
|
||||
if (valid) {
|
||||
const subForm = {
|
||||
@@ -529,7 +529,7 @@ const submit = () => {
|
||||
})
|
||||
}
|
||||
//新增测试项
|
||||
if (activeFormIndex.value == 2) {
|
||||
if (popupType.value == 2) {
|
||||
ruleFormRef2.value.validate((valid: boolean) => {
|
||||
if (valid) {
|
||||
let subForm = {
|
||||
@@ -550,19 +550,12 @@ const submit = () => {
|
||||
})
|
||||
}
|
||||
//修改测试项
|
||||
if (activeFormIndex.value == 3) {
|
||||
if (popupType.value == 3) {
|
||||
ruleFormRef2.value.validate((valid: any) => {
|
||||
if (valid) {
|
||||
// const subForm = {
|
||||
// id: planId.value,
|
||||
// ...form1.value
|
||||
// }
|
||||
let subForm = JSON.parse(JSON.stringify(form1.value))
|
||||
// subForm.list = tableData.value.map(item => {
|
||||
// return item.id
|
||||
// })
|
||||
subForm.list = checkedIdList.value
|
||||
updateRecord(subForm).then((res:any) => {
|
||||
updateRecord(subForm).then((res: any) => {
|
||||
if (res.code == 'A0000') {
|
||||
ElMessage.success('修改测试项成功')
|
||||
initForm()
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
size="18"
|
||||
class="fold ml10 menu-collapse"
|
||||
style="cursor: pointer"
|
||||
v-if="true"
|
||||
/>
|
||||
</div>
|
||||
<el-tree
|
||||
@@ -42,7 +41,6 @@
|
||||
ref="treRef"
|
||||
@node-click="clickNode"
|
||||
:expand-on-click-node="false"
|
||||
|
||||
>
|
||||
<template #default="{ node, data }">
|
||||
<span class="custom-tree-node">
|
||||
@@ -211,7 +209,7 @@ const del = (node: Node, data: any) => {
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
delRecord({ id: data.id }).then(res => {
|
||||
delRecord({ id: data.id }).then((res: any) => {
|
||||
if (res.code == 'A0000') {
|
||||
ElMessage.success('删除成功')
|
||||
getTreeList()
|
||||
@@ -231,6 +229,9 @@ const clickNode = (e: anyObj) => {
|
||||
e.children ? (planId.value = e.id) : (planId.value = e.pid)
|
||||
emit('nodeChange', e)
|
||||
}
|
||||
const setCheckedNode = (e: anyObj) => {
|
||||
treRef.value.setCurrentKey(e)
|
||||
}
|
||||
watch(
|
||||
() => planData.value,
|
||||
(val, oldVal) => {
|
||||
@@ -249,7 +250,7 @@ watch(
|
||||
deep: true
|
||||
}
|
||||
)
|
||||
defineExpose({ treeRef, getPlanData, getTreeList })
|
||||
defineExpose({ treeRef, getPlanData, getTreeList, setCheckedNode })
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.cn-tree {
|
||||
@@ -294,13 +295,13 @@ defineExpose({ treeRef, getPlanData, getTreeList })
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.left{
|
||||
span{
|
||||
.left {
|
||||
span {
|
||||
margin-left: 2px;
|
||||
}
|
||||
}
|
||||
.right{
|
||||
a{
|
||||
.right {
|
||||
a {
|
||||
margin-left: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user