diff --git a/src/views/sta/index.vue b/src/views/sta/index.vue
index 79a07a4..75c61a5 100644
--- a/src/views/sta/index.vue
+++ b/src/views/sta/index.vue
@@ -29,7 +29,8 @@
:data="data1" show-summary max-height="650"
default-expand-all
row-key="orgname"
- :tree-props="{ children: 'children' }">
+ :tree-props="{ children: 'children' }"
+ :default-sort="{ prop: 'sum', order: 'descending' }">
@@ -121,12 +122,23 @@ const changeRadio = (e) => {
let start = new Date()
let date = null
switch (e){
- case 2 : break
- case 3 : start.setDate(start.getDate() - 7);break
- case 4 : start.setMonth(start.getMonth() - 1);break
- default : start.setDate(start.getDate() -7)
+ case 2 :
+ start = new Date()
+ end = new Date()
+ break
+ case 3 :
+ start.setDate(start.getDate() - 7)
+ break
+ case 4 :
+ start.setMonth(start.getMonth() - 1)
+ break
+ default :
+ start.setDate(start.getDate() - 7)
}
time.value = [formatDate(start,'YYYY-MM-DD'),formatDate(end,'YYYY-MM-DD')]
+ // 清空现有数据
+ data1.value = []
+ // 重新获取数据
getList()
}
const changeDatePick = () => {
@@ -137,16 +149,23 @@ const changeDatePick = () => {
* 获取统计数据
*/
const getList = async ()=>{
+ // 清空现有数据
+ data1.value = []
+
const params = {
dates: [
dayjs(time.value[0]).format('YYYY-MM-DD'),
dayjs(time.value[1]).format('YYYY-MM-DD')
]
}
- let resp = await PatientApi.getData(params)
- const rawData = toRaw(resp)
- data1.value = dataProcessing(rawData)
- console.log(data1.value)
+ try {
+ let resp = await PatientApi.getData(params)
+ const rawData = toRaw(resp)
+ data1.value = dataProcessing(rawData)
+ console.log(data1.value)
+ } catch (error) {
+ console.error('获取数据失败:', error)
+ }
}
/**
* 统计数据处理