Commit 87b1abf5 authored by hubaoshan's avatar hubaoshan

getData() 父调子方法Bug

parent cdbc9194
...@@ -80,6 +80,9 @@ function getDataNew(item) { ...@@ -80,6 +80,9 @@ function getDataNew(item) {
Page.rows = res.pageSize Page.rows = res.pageSize
}) })
} }
defineExpose({
getData
});
</script> </script>
<template> <template>
......
...@@ -92,6 +92,9 @@ function getDataNew(item) { ...@@ -92,6 +92,9 @@ function getDataNew(item) {
historyPage.rows = res.pageSize historyPage.rows = res.pageSize
}) })
} }
defineExpose({
getData
});
</script> </script>
<template> <template>
......
...@@ -31,7 +31,8 @@ const getData = () => { ...@@ -31,7 +31,8 @@ const getData = () => {
if (childComponentRef.value && childComponentRef.value.getData) { if (childComponentRef.value && childComponentRef.value.getData) {
console.log('能不能成功啊') console.log('能不能成功啊')
childComponentRef.value.getData(); // 调用子组件的 getData 方法 childComponentRef.value.getData(); // 调用子组件的 getData 方法
} }else{
console.log('啊,不行啊')}
}; };
const {proxy} = getCurrentInstance(); const {proxy} = getCurrentInstance();
// 列表 // 列表
...@@ -97,6 +98,13 @@ const search = () => { ...@@ -97,6 +98,13 @@ const search = () => {
beginTime: queryParams.beginTime, beginTime: queryParams.beginTime,
endTime: queryParams.endTime, endTime: queryParams.endTime,
}) })
if(item.alarmStatus === undefined || item.alarmType === undefined || item.beginTime == null || item.endTime == null || item.stationId === undefined){
item.alarmStatus = ''
item.endTime = ''
item.stationId = ''
item.beginTime = ''
item.alarmType = ''
}
if (selectedBtn.value === 1) { if (selectedBtn.value === 1) {
childParams.value = item childParams.value = item
} else if (selectedBtn.value === 2) { } else if (selectedBtn.value === 2) {
...@@ -111,7 +119,6 @@ function getNumber() { ...@@ -111,7 +119,6 @@ function getNumber() {
getAlarmNumData().then(res => { getAlarmNumData().then(res => {
console.log('123123123123-----------', res.data) console.log('123123123123-----------', res.data)
alarmNum.value = res.data alarmNum.value = res.data
iop.value = res.data
}) })
} }
...@@ -167,12 +174,14 @@ const handleExport = () => { ...@@ -167,12 +174,14 @@ const handleExport = () => {
// 重置 // 重置
const resetSearch = () => { const resetSearch = () => {
console.log("怎么不执行重置啊?")
queryParams.alarmStatus = '' queryParams.alarmStatus = ''
queryParams.beginTime = '' queryParams.beginTime = ''
queryParams.endTime = '' queryParams.endTime = ''
queryParams.alarmType = '' queryParams.alarmType = ''
queryParams.stationId = '' queryParams.stationId = ''
searchData.value = {} searchData.value = []
getData()
} }
const loading = ref(true); const loading = ref(true);
...@@ -308,7 +317,7 @@ watch( ...@@ -308,7 +317,7 @@ watch(
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="search" class="add-search-btn">查询</el-button> <el-button type="primary" @click="search" class="add-search-btn">查询</el-button>
<el-button type="primary" @click="resetSearch" class="add-search-btn" v-if="selectedBtn !== 3">重置</el-button> <el-button type="primary" @click="resetSearch()" class="add-search-btn" v-if="selectedBtn !== 3">重置</el-button>
<el-button type="primary" @click="handleExport()" class="add-search-btn">导出</el-button> <el-button type="primary" @click="handleExport()" class="add-search-btn">导出</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
......
...@@ -163,6 +163,9 @@ function getSupplys() { ...@@ -163,6 +163,9 @@ function getSupplys() {
} }
getSupplys() getSupplys()
defineExpose({
getData
});
</script> </script>
<template> <template>
......
...@@ -159,6 +159,9 @@ function getSupplys() { ...@@ -159,6 +159,9 @@ function getSupplys() {
} }
getSupplys() getSupplys()
defineExpose({
getData
});
</script> </script>
<template> <template>
......
...@@ -93,6 +93,13 @@ const search = () => { ...@@ -93,6 +93,13 @@ const search = () => {
beginTime: queryParams.beginTime, beginTime: queryParams.beginTime,
endTime: queryParams.endTime, endTime: queryParams.endTime,
} }
if(item.alarmStatus === undefined || item.alarmType === undefined || item.beginTime == null || item.endTime == null || item.stationId === undefined){
item.alarmStatus = ''
item.endTime = ''
item.stationId = ''
item.beginTime = ''
item.alarmType = ''
}
if (selectedBtn.value === 1) { if (selectedBtn.value === 1) {
childParams.value = item childParams.value = item
} else if (selectedBtn.value === 2) { } else if (selectedBtn.value === 2) {
...@@ -170,7 +177,8 @@ const resetSearch = () => { ...@@ -170,7 +177,8 @@ const resetSearch = () => {
queryParams.endTime = '' queryParams.endTime = ''
queryParams.alarmType = '' queryParams.alarmType = ''
queryParams.stationId = '' queryParams.stationId = ''
searchData.value = {} searchData.value = []
getData()
} }
const loading = ref(true); const loading = ref(true);
......
...@@ -134,6 +134,9 @@ function getSupplys(){ ...@@ -134,6 +134,9 @@ function getSupplys(){
} }
} }
getSupplys() getSupplys()
defineExpose({
getData
});
</script> </script>
<template> <template>
......
...@@ -157,6 +157,9 @@ function getSupplys() { ...@@ -157,6 +157,9 @@ function getSupplys() {
} }
getSupplys() getSupplys()
defineExpose({
getData
});
</script> </script>
<template> <template>
......
...@@ -117,7 +117,13 @@ const search = () => { ...@@ -117,7 +117,13 @@ const search = () => {
beginTime: queryParams.beginTime, beginTime: queryParams.beginTime,
endTime: queryParams.endTime, endTime: queryParams.endTime,
} }
if(item.alarmStatus === undefined || item.alarmType === undefined || item.beginTime == null || item.endTime == null || item.stationId === undefined){
item.alarmStatus = ''
item.endTime = ''
item.stationId = ''
item.beginTime = ''
item.alarmType = ''
}
if (selectedBtn.value === 1) { if (selectedBtn.value === 1) {
childParams.value = item childParams.value = item
} else if (selectedBtn.value === 2) { } else if (selectedBtn.value === 2) {
...@@ -195,7 +201,8 @@ const resetSearch = () => { ...@@ -195,7 +201,8 @@ const resetSearch = () => {
queryParams.endTime = '' queryParams.endTime = ''
queryParams.alarmType = '' queryParams.alarmType = ''
queryParams.stationId = '' queryParams.stationId = ''
searchData.value = {} searchData.value = []
getData()
} }
const options = ref([]); const options = ref([]);
const enterpriseId = ref(); const enterpriseId = ref();
......
...@@ -184,7 +184,7 @@ const resetSearch = () => { ...@@ -184,7 +184,7 @@ const resetSearch = () => {
queryParams.endTime = '' queryParams.endTime = ''
queryParams.alarmType = '' queryParams.alarmType = ''
queryParams.stationId = '' queryParams.stationId = ''
searchData.value = {} searchData.value = []
}; };
const options = ref([]); const options = ref([]);
const enterpriseId = ref(); const enterpriseId = ref();
......
...@@ -156,6 +156,9 @@ function getSupplys() { ...@@ -156,6 +156,9 @@ function getSupplys() {
} }
getSupplys() getSupplys()
defineExpose({
getData
});
</script> </script>
<template> <template>
......
...@@ -159,6 +159,9 @@ function getSupplys() { ...@@ -159,6 +159,9 @@ function getSupplys() {
} }
getSupplys() getSupplys()
defineExpose({
getData
});
</script> </script>
<template> <template>
......
...@@ -125,6 +125,13 @@ const search = () => { ...@@ -125,6 +125,13 @@ const search = () => {
beginTime: queryParams.beginTime, beginTime: queryParams.beginTime,
endTime: queryParams.endTime, endTime: queryParams.endTime,
} }
if(item.alarmStatus === undefined || item.alarmType === undefined || item.beginTime == null || item.endTime == null || item.stationId === undefined){
item.alarmStatus = ''
item.endTime = ''
item.stationId = ''
item.beginTime = ''
item.alarmType = ''
}
if (selectedBtn.value === 1) { if (selectedBtn.value === 1) {
childParams.value = item childParams.value = item
} else if (selectedBtn.value === 2) { } else if (selectedBtn.value === 2) {
...@@ -202,7 +209,8 @@ const resetSearch = () => { ...@@ -202,7 +209,8 @@ const resetSearch = () => {
queryParams.endTime = '' queryParams.endTime = ''
queryParams.alarmType = '' queryParams.alarmType = ''
queryParams.stationId = '' queryParams.stationId = ''
searchData.value = {} searchData.value = []
getData()
}; };
const options = ref([]); const options = ref([]);
const enterpriseId = ref(); const enterpriseId = ref();
......
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