Commit 7d73c86f authored by 裴文涛's avatar 裴文涛

绑定换热站功能调整

parent ca388f4f
......@@ -36,7 +36,9 @@ const bindData = ref({}) // 要绑定的数据
const supplyData = ref([]) // 供热站数据
const transferData = ref([]) // 换热站数据
const selectedTransfer = ref([]) // 被本气象干预方案选中的换热站
const isSaveOper = ref(false)
let optional = '' // 可以选换热站的供热站
let originSupply = '' // 原先绑定的供热站
let loadingInstance = null
const inputStyle = {
color: 'black',
......@@ -68,6 +70,7 @@ function onSubmit() {
updateNullFields: ''
})
})
bindData.value.isAuto = bindData.value.isAuto === '自动模式' ? true : false;
bindData.value.isFixed = bindData.value.isFixed === '固定模式' ? true : false;
bindData.value.updateNullFields = ""
......@@ -93,25 +96,32 @@ async function getTransfer(supplyId, isAvailable = true) {
*/
const result = await getTransferInterface(param)
transferData.value = result.data
if(isAvailable){
// 每次需要为换热站推入数据时,清空已有的数据
selectedTransfer.value.length = 0
}
// if(isAvailable){
// // 每次需要为换热站推入数据时,清空已有的数据
// selectedTransfer.value.length = 0
// }
for (const item of transferData.value) {
if (!isAvailable) {
item.selected = item.selected.toLowerCase() === 'true' ? true : false
item.enabled = false
if (item.selected) {
if(optional !== originSupply && bindData.value.supplyId === originSupply){
continue
}
selectedTransfer.value.push(item.transferId)
}
} else {
item.selected = item.selected.toLowerCase() === 'true' ? true : false
item.enabled = item.enabled.toLowerCase() === 'true' ? true : false
if (item.selected) {
if(optional !== originSupply && bindData.value.supplyId === originSupply){
continue
}
selectedTransfer.value.push(item.transferId)
}
}
}
selectedTransfer.value = [...unique(selectedTransfer.value)]
loadingInstance.close()
}
......@@ -124,6 +134,7 @@ function onOpen() {
if (bindData.value.hasOwnProperty('supplyId')) {
if (bindData.value.supplyId) {
optional = bindData.value.supplyId
originSupply = bindData.value.supplyId
getTransfer(bindData.value.supplyId)
}
}
......@@ -139,10 +150,13 @@ function selectChange(val) {
loadingInstance = ElLoading.service({target: '#bind-dialog'})
if (selectedTransfer.value.length === 0) {
getTransfer(val)
isSaveOper.value = false
} else if (bindData.value.supplyId === optional) {
getTransfer(val)
isSaveOper.value = false
} else {
getTransfer(val, false)
isSaveOper.value = true
}
loadingInstance.close()
}
......@@ -152,8 +166,16 @@ function selectChange(val) {
* @param val
*/
function checkboxChange(val) {
optional = bindData.value.supplyId
// console.log('checkboxChange====>>>===>>>', val)
}
/**
* 过滤器,用于过滤掉重复的换热站ID
*/
function unique(arr){
return new Set(arr)
}
</script>
<template>
<el-dialog
......@@ -207,7 +229,7 @@ function checkboxChange(val) {
</template>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="onSubmit">保存</el-button>
<el-button type="primary" :disabled="isSaveOper" @click="onSubmit">保存</el-button>
<el-button type="primary" @click="emit('onCancel')">关闭</el-button>
</div>
</template>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment