Commit 2a6e4cf8 authored by 张伯涛's avatar 张伯涛
parents 088c53c8 be8f6869
...@@ -40,6 +40,7 @@ function selectRow(row) { ...@@ -40,6 +40,7 @@ function selectRow(row) {
const index = RecyclePumpData.value.indexOf(row) const index = RecyclePumpData.value.indexOf(row)
selectedRow.value = row; selectedRow.value = row;
selectedRowIndex.value = index; selectedRowIndex.value = index;
// playAudio()
} }
const audioPlayer = ref(null); const audioPlayer = ref(null);
...@@ -148,7 +149,6 @@ function playAudio() { ...@@ -148,7 +149,6 @@ function playAudio() {
loading.value = false loading.value = false
}) })
} }
playAudio()
// 初始化时选中第一行 // 初始化时选中第一行
watch( watch(
()=>RecyclePumpData.value, ()=>RecyclePumpData.value,
...@@ -178,8 +178,9 @@ watch( ...@@ -178,8 +178,9 @@ watch(
} }
) )
getData() // getData()
function getData() { function getData() {
console.log('历史datadata')
const item = reactive({ const item = reactive({
page: Page.page, page: Page.page,
size: Page.rows, size: Page.rows,
...@@ -280,7 +281,8 @@ const handleSortChange = (data) => { ...@@ -280,7 +281,8 @@ const handleSortChange = (data) => {
}; };
defineExpose({ defineExpose({
getData getData,
playAudio
}); });
</script> </script>
......
...@@ -33,13 +33,12 @@ const handleSizeChange = (val) => { ...@@ -33,13 +33,12 @@ const handleSizeChange = (val) => {
// 当前页改变时触发 // 当前页改变时触发
const handleCurrentChange = (val) => { const handleCurrentChange = (val) => {
Page.page = val; Page.page = val;
console.log('Page.page:',Page.page)
getDataByParams() getDataByParams()
}; };
const selectedRow = ref({}); const selectedRow = ref({});
const selectedRowIndex = ref(); const selectedRowIndex = ref();
// 高亮行
function selectRow(row) { function selectRow(row) {
const index = RecyclePumpData.value.indexOf(row) const index = RecyclePumpData.value.indexOf(row)
selectedRow.value = row; selectedRow.value = row;
...@@ -85,6 +84,7 @@ function zoom(zoomLevel) { ...@@ -85,6 +84,7 @@ function zoom(zoomLevel) {
function playAudio() { function playAudio() {
loading.value = true loading.value = true
// 如果有波形图,则摧毁现有波形图,渲染新的波形图 // 如果有波形图,则摧毁现有波形图,渲染新的波形图
console.log('wavesurfer.value',wavesurfer.value)
if (wavesurfer.value) { if (wavesurfer.value) {
wavesurfer.value.destroy(); wavesurfer.value.destroy();
} }
...@@ -147,9 +147,6 @@ function playAudio() { ...@@ -147,9 +147,6 @@ function playAudio() {
}) })
} }
playAudio()
// 初始化时选中第一行 // 初始化时选中第一行
watch( watch(
()=>RecyclePumpData.value, ()=>RecyclePumpData.value,
...@@ -168,7 +165,7 @@ const props = defineProps({ ...@@ -168,7 +165,7 @@ const props = defineProps({
required: true required: true
} }
}); });
// 监听父组件传值(搜索条件)变化
watch( watch(
() => props.queryParams, () => props.queryParams,
(newData) => { (newData) => {
...@@ -179,11 +176,13 @@ watch( ...@@ -179,11 +176,13 @@ watch(
} }
) )
// if(localStorage.getItem('AIToken')){
// getData() // getData()
if(localStorage.getItem('AIToken')){ // playAudio()
getData() // }
} // 查找最新数据
function getData(){ function getData(){
console.log('getData')
const item = reactive({ const item = reactive({
page: Page.page, page: Page.page,
size: Page.rows, size: Page.rows,
...@@ -199,6 +198,7 @@ function getData(){ ...@@ -199,6 +198,7 @@ function getData(){
Page.rows = res.pageSize Page.rows = res.pageSize
}) })
} }
// 根据父传子的搜索条件 查数据(分页使用)
function getDataByParams(){ function getDataByParams(){
const item = { const item = {
page: Page.page, page: Page.page,
...@@ -225,7 +225,7 @@ function getDataByParams(){ ...@@ -225,7 +225,7 @@ function getDataByParams(){
Page.rows = res.pageSize Page.rows = res.pageSize
}) })
} }
/** 根据父传子的搜索条件 查数据*/
function getDataNew(item) { function getDataNew(item) {
getRecycleListNewData(item).then(res => { getRecycleListNewData(item).then(res => {
RecyclePumpData.value = res.rows RecyclePumpData.value = res.rows
...@@ -283,9 +283,10 @@ const handleSortChange = (data) => { ...@@ -283,9 +283,10 @@ const handleSortChange = (data) => {
Page.total = res.total Page.total = res.total
}) })
}; };
// 暴露方法名
defineExpose({ defineExpose({
getData getData,
playAudio
}); });
</script> </script>
......
...@@ -40,8 +40,11 @@ const handleTabClick = (tab, event) => { ...@@ -40,8 +40,11 @@ const handleTabClick = (tab, event) => {
if (selectedItem) { if (selectedItem) {
selectedComponent.value = selectedItem.component; selectedComponent.value = selectedItem.component;
selectedBtn.value = selectedItem.id; selectedBtn.value = selectedItem.id;
setTimeout(function () {
resetSearch(); resetSearch();
search() search()
playAudio()
}, 1000)
} }
}; };
...@@ -69,7 +72,7 @@ const queryParams = reactive({ ...@@ -69,7 +72,7 @@ const queryParams = reactive({
beginTime: '', beginTime: '',
endTime: '', endTime: '',
}); });
// 搜索
const Page = reactive({total: 0, rows: 20, page: 1}); const Page = reactive({total: 0, rows: 20, page: 1});
const searchData = ref({}); const searchData = ref({});
const search = () => { const search = () => {
...@@ -102,7 +105,7 @@ const search = () => { ...@@ -102,7 +105,7 @@ const search = () => {
} }
console.log('查询:', item); console.log('查询:', item);
}; };
// 获取报警数量
function getNumber() { function getNumber() {
getRecycleAlarmNumber().then(res => { getRecycleAlarmNumber().then(res => {
console.log('123123123123-----------', res.data) console.log('123123123123-----------', res.data)
...@@ -193,12 +196,19 @@ const resetSearch = () => { ...@@ -193,12 +196,19 @@ const resetSearch = () => {
getData() getData()
}; };
const childComponentRef = ref(null); const childComponentRef = ref(null);
// 子组件getData()方法
const getData = () => { 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 方法
} }
}; };
// 子组件playAudio()方法
const playAudio = () => {
if (childComponentRef.value && childComponentRef.value.playAudio) {
childComponentRef.value.playAudio(); // 调用子组件的 playAudio 方法
}
};
const route = useRoute() const route = useRoute()
watch( watch(
() => route.path, // 只监听路径变化 () => route.path, // 只监听路径变化
...@@ -214,6 +224,7 @@ watch( ...@@ -214,6 +224,7 @@ watch(
if (localStorage.getItem('AIToken')) { if (localStorage.getItem('AIToken')) {
clearInterval(checkAIToken); // 停止轮询 clearInterval(checkAIToken); // 停止轮询
getNumber(); getNumber();
playAudio();
// getData(); // getData();
resetSearch() resetSearch()
} }
...@@ -223,6 +234,7 @@ watch( ...@@ -223,6 +234,7 @@ watch(
}, },
{ immediate: true } // 只在路径变化时触发 { immediate: true } // 只在路径变化时触发
) )
// 获取换热站信息
const options = ref([]); const options = ref([]);
const enterpriseId = ref(); const enterpriseId = ref();
const props = {multiple: true, emitPath: false} const props = {multiple: true, emitPath: false}
...@@ -287,7 +299,6 @@ function getSupplys() { ...@@ -287,7 +299,6 @@ function getSupplys() {
} }
getSupplys(); getSupplys();
</script> </script>
<template> <template>
<div class="app-content"> <div class="app-content">
......
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