历史趋势修改
This commit is contained in:
@@ -98,7 +98,7 @@ const tableData = ref([])
|
||||
defineOptions({
|
||||
name: 'govern/tourist/index'
|
||||
})
|
||||
const treeIds: any = ref(['-1'])
|
||||
const treeIds: any = ref([])
|
||||
//树节点选择变化的时候处理树节点选中数据
|
||||
const checkChange = async (data: any) => {
|
||||
if (data.checked) {
|
||||
@@ -602,15 +602,18 @@ const details = (val: any) => {
|
||||
}
|
||||
//修改测试项回显
|
||||
if (activeFormIndex.value == 3) {
|
||||
form1.value = val.records[0]
|
||||
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) {
|
||||
initForm()
|
||||
}
|
||||
}
|
||||
//0 新增方案 1 修改方案 2 新增测试项 3 修改测试项 4 设备信息
|
||||
const open = (val: any, id: any) => {
|
||||
console.log(id, '8888888')
|
||||
const open = async (val: any, id: any) => {
|
||||
activeFormIndex.value = val
|
||||
title.value = val == 0 ? '新增方案' : val == 1 ? '修改方案' : val == 2 ? '新增测试项' : '修改测试项'
|
||||
dialogVisible.value = true
|
||||
@@ -632,7 +635,8 @@ const open = (val: any, id: any) => {
|
||||
//查绑定测试项列表
|
||||
getSelectedTable(id)
|
||||
//查新增列表
|
||||
tableStore.index()
|
||||
await tableStore.index()
|
||||
activeName.value = 0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -642,25 +646,37 @@ const tableData = ref([])
|
||||
defineOptions({
|
||||
name: 'govern/tourist/index'
|
||||
})
|
||||
const treeIds: any = ref(['-1'])
|
||||
const treeIds: any = ref([])
|
||||
const pids: any = ref([])
|
||||
//树节点选择变化的时候处理树节点选中数据
|
||||
const checkChange = async (data: any) => {
|
||||
if (defaultCheckedKeys.value.length == 0) {
|
||||
treeIds.value[0] = '-1'
|
||||
}
|
||||
if (data.checked) {
|
||||
defaultCheckedKeys.value.push(data.data.id)
|
||||
data.data.children?.map((item: any) => {
|
||||
treeIds.value.push(item.id)
|
||||
treeIds.value = []
|
||||
pids.value = []
|
||||
// if (data.checked) {
|
||||
// defaultCheckedKeys.value.push(data.data.id)
|
||||
// data.data.children?.map((item: any) => {
|
||||
// treeIds.value.push(item.id)
|
||||
// pids.value.push(item.pid)
|
||||
// })
|
||||
// } else {
|
||||
// defaultCheckedKeys.value.splice(defaultCheckedKeys.value.indexOf(data.data.id), 1)
|
||||
// data.data.children?.map((item: any) => {
|
||||
// treeIds.value.splice(defaultCheckedKeys.value.indexOf(item.id), 1)
|
||||
// })
|
||||
// }
|
||||
if (data.data && data.data.length != 0) {
|
||||
data.data?.map((item: any) => {
|
||||
if (item.pid) {
|
||||
treeIds.value.push(item.id)
|
||||
pids.value.push(item.pid)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
defaultCheckedKeys.value.splice(defaultCheckedKeys.value.indexOf(data.data.id), 1)
|
||||
data.data.children?.map((item: any) => {
|
||||
treeIds.value.splice(defaultCheckedKeys.value.indexOf(item.id), 1)
|
||||
})
|
||||
treeIds.value = []
|
||||
pids.value.push = []
|
||||
}
|
||||
treeIds.value = [...new Set(treeIds.value)]
|
||||
treeIds.value[0] = '-1'
|
||||
pids.value = [...new Set(pids.value)]
|
||||
await tableStore.index()
|
||||
}
|
||||
const deviceInfoTreeRef = ref()
|
||||
@@ -672,7 +688,6 @@ const getSelectedTable = async (id: any) => {
|
||||
//新增传0已绑定传1
|
||||
await getDeviceList({ id: id, isTrueFlag: 1, pageNum: 1, pageSize: 1000 }).then(res => {
|
||||
tableData.value = res.data.records
|
||||
activeName.value = tableData.value.length == 0 ? 0 : 2
|
||||
})
|
||||
}
|
||||
//新增设备列表
|
||||
@@ -695,9 +710,11 @@ const tableStore = new TableStore({
|
||||
//新增传0已绑定传1
|
||||
tableStore.table.params.isTrueFlag = 0
|
||||
tableStore.table.params.treeIds = treeIds.value
|
||||
tableStore.table.params.pids = pids.value
|
||||
}
|
||||
})
|
||||
tableStore.table.params.treeIds = ['-1']
|
||||
tableStore.table.params.treeIds = []
|
||||
tableStore.table.params.pids = []
|
||||
provide('tableStore', tableStore)
|
||||
const tableRef = ref()
|
||||
//删除设备
|
||||
@@ -756,6 +773,7 @@ const handleDelete = (row: any) => {
|
||||
delDevice({ id: selectId.value, list: list }).then(res => {
|
||||
if (res.code == 'A0000') {
|
||||
ElMessage.success('移除成功')
|
||||
activeName.value = tableData.value.length == 0 ? 0 : 2
|
||||
getSelectedTable(selectId.value)
|
||||
}
|
||||
})
|
||||
@@ -801,6 +819,7 @@ const submit = () => {
|
||||
}
|
||||
addPlan(subForm).then(res => {
|
||||
ElMessage.success('新增方案成功')
|
||||
initForm()
|
||||
emit('onSubmit')
|
||||
close()
|
||||
})
|
||||
@@ -840,6 +859,7 @@ const submit = () => {
|
||||
})
|
||||
addRecord(subForm).then(res => {
|
||||
ElMessage.success('新增测试项成功')
|
||||
initForm()
|
||||
emit('onSubmit')
|
||||
close()
|
||||
})
|
||||
@@ -848,20 +868,19 @@ const submit = () => {
|
||||
}
|
||||
//修改测试项
|
||||
if (activeFormIndex.value == 3) {
|
||||
console.log(66666, ruleFormRef2.value.validate)
|
||||
ruleFormRef2.value.validate((valid: any) => {
|
||||
console.log(valid, '------')
|
||||
if (valid) {
|
||||
// const subForm = {
|
||||
// id: planId.value,
|
||||
// ...form1.value
|
||||
// }
|
||||
let subForm = form1.value
|
||||
let subForm = JSON.parse(JSON.stringify(form1.value))
|
||||
subForm.list = tableData.value.map(item => {
|
||||
return item.id
|
||||
})
|
||||
updateRecord(subForm).then(res => {
|
||||
ElMessage.success('修改测试项成功')
|
||||
initForm()
|
||||
emit('onSubmit')
|
||||
close()
|
||||
})
|
||||
|
||||
@@ -236,7 +236,6 @@ watch(
|
||||
(val, oldVal) => {
|
||||
if (val && dialogRef.value) {
|
||||
const obj = JSON.parse(JSON.stringify(val))
|
||||
console.log(obj,"88888888888");
|
||||
obj.records = [
|
||||
val.records.find(item => {
|
||||
return item.id == monitorId.value
|
||||
|
||||
Reference in New Issue
Block a user