Commit a69eeefe authored by 裴文涛's avatar 裴文涛

解决Bug

parent a0d51f39
......@@ -17,7 +17,7 @@ const dataBackup = ref([]);
const reviseWindowOpen = ref(false) // 修改按钮弹窗状态
const bindWindowOpen = ref(false) // 绑定按钮弹窗状态
const addWindowOpen = ref(false) // 新增按钮弹窗状态
const dependentSub = ref({}) // 修改和绑定弹窗数据依赖
const dependentSub = ref('') // 修改和绑定弹窗数据依赖
const tableHeaderClass = data => { // 表头样式
return 'table-header-class'
}
......@@ -51,7 +51,9 @@ function search() {
}
}
const revise = (row) => { // 修改按钮单击事件
dependentSub.value = row
console.log('row的值:',row)
dependentSub.value = data.value[row]
// console.log('dependentSub的值:', dependentSub.value)
reviseWindowOpen.value = true
}
const bind = (row) => { // 绑定按钮单击事件
......@@ -60,6 +62,7 @@ const bind = (row) => { // 绑定按钮单击事件
}
const cancelRevise = ()=>{
reviseWindowOpen.value = false
reset()
getData()
}
const confirmRevise = val => { // 修改弹窗确认按钮事件
......@@ -135,6 +138,7 @@ function getData() {
getWeatherMagData().then(res => {
data.value = res.data
dataBackup.value = [...data.value];
console.log('获取到的所有数据',data.value)
})
}
function handleAddWinOpenClose(){
......@@ -194,6 +198,26 @@ function getOrganizationStructure() {
ElMessage.error('接口异常,获取数据失败.')
})
} // 获取组织结构
function reset(){
dependentSub.value = {
allowPagingId:"",
temperature:"",
wind:"",
illumination:"",
diffPercentage:"",
timeoutMin:"",
tempRegulation:"",
sort:"",
customizeName:"",
supplyName:"",
customizeId:"",
isFixed:"",
isAuto:"",
supplyId:"",
operateTime:"",
updateNullFields:''
}
}
function resetSearch(){
isAutoSearchKey.value = ''
supplySearchKey.value = ''
......@@ -230,7 +254,7 @@ function resetSearch(){
border
style="width: 100%"
height="720px"
:default-sort="{ prop: 'operateTime', order: 'descending' }"
:header-cell-class-name="tableHeaderClass"
:row-class-name="tableBodyClass">
<el-table-column prop="allowPagingId" label="编号" align="center" width="60"/>
......@@ -249,7 +273,7 @@ function resetSearch(){
<el-table-column label="操作" fixed="right" width="200">
<template #default="scope">
<div class="table-operate-column">
<el-button link @click="revise(scope.row)" type="primary">修改</el-button>
<el-button link @click="revise(scope.$index)" type="primary">修改</el-button>
<el-button link @click="bind(scope.row)" type="primary">绑定换热站</el-button>
</div>
</template>
......
......@@ -23,7 +23,24 @@ const emit = defineEmits({
return true
}
})
const reviseData = ref({})
const reviseData = ref({
allowPagingId:"",
temperature:"",
wind:"",
illumination:"",
diffPercentage:"",
timeoutMin:"",
tempRegulation:"",
sort:"",
customizeName:"",
supplyName:"",
customizeId:"",
isFixed:"",
isAuto:"",
supplyId:"",
operateTime:"",
updateNullFields:''
})
const formRef = ref()
......@@ -51,9 +68,9 @@ const rules = reactive({
});
watchEffect(() => {
// reviseData.value = {...props.data}
props.data.transfers = []
props.data.updateNullFields = ''
reviseData.value = cloneDeep(props.data) // 深拷贝数据
// props.data.transfers = []
reviseData.value = props.data // 深拷贝数据
// console.log('>>>>>>>>>>>',props.data)
})
const inputStyle = {
color: 'black',
......@@ -72,6 +89,8 @@ const switchingisAuto = computed({
}
}) // 可写计算属性,手动、自动模式切换
function onOpen() {
// console.log('点击弹窗:',reviseData.value)
// console.log('props的值:', props.data)
formRef.value.resetFields()
}
......@@ -96,19 +115,43 @@ async function handleConfirm() {
formRef.value.validate(valid => {
if (valid) {
emit('onConfirm', reviseData.value)
reset()
}
})
})
}
}
}
function onClose(){
emit('onCancel')
reset()
}
function reset(){
reviseData.value = {
allowPagingId:"",
temperature:"",
wind:"",
illumination:"",
diffPercentage:"",
timeoutMin:"",
tempRegulation:"",
sort:"",
customizeName:"",
supplyName:"",
customizeId:"",
isFixed:"",
isAuto:"",
supplyId:"",
operateTime:"",
updateNullFields:''
}
}
</script>
<template>
<el-dialog v-model="props.open" width="1000px" title="自定义修改" @close="emit('onCancel')" @open="onOpen">
<el-dialog v-model="props.open" width="1000px" title="自定义修改" @close="onClose" @open="onOpen">
<template #default>
<div class="dialog-content">
<el-form ref="formRef" :model="reviseData" :rules="rules" label-width="auto">
......@@ -198,7 +241,7 @@ async function handleConfirm() {
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="handleConfirm">保存</el-button>
<el-button type="primary" @click="emit('onCancel')">关闭</el-button>
<el-button type="primary" @click="onClose">关闭</el-button>
</div>
</template>
</el-dialog>
......
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