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

解决Bug

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