diff --git a/src/components/container.vue b/src/components/container.vue
index 36eeebe..6e35a42 100644
--- a/src/components/container.vue
+++ b/src/components/container.vue
@@ -31,53 +31,43 @@
-
diff --git a/src/config/unit.js b/src/config/unit.js
index 9d98616..ca12df5 100644
--- a/src/config/unit.js
+++ b/src/config/unit.js
@@ -2,4 +2,29 @@ export const center=function(lnglat){
var lng=[Math.min(...lnglat.map(v=>v[0])),Math.max(...lnglat.map(v=>v[0]))]
var lat=[Math.min(...lnglat.map(v=>v[1])),Math.max(...lnglat.map(v=>v[1]))]
return [lng[0]+(lng[1]-lng[0])/2, lat[0]+(lat[1]-lat[0])/2]
+}
+
+export const downFile=function(file,type,filename){
+ // 创建blob对象,解析流数据
+ const blob = new Blob([file], {
+ // 设置返回的文件类型
+ // type: 'application/pdf;charset=UTF-8' 表示下载文档为pdf,如果是word则设置为msword,excel为excel
+ type: type
+ })
+ // 这里就是创建一个a标签,等下用来模拟点击事件
+ const a = document.createElement('a')
+ // 兼容webkix浏览器,处理webkit浏览器中href自动添加blob前缀,默认在浏览器打开而不是下载
+ const URL = window.URL || window.webkitURL
+ // 根据解析后的blob对象创建URL 对象
+ const herf = URL.createObjectURL(blob)
+ // 下载链接
+ a.href = herf
+ // 下载文件名,如果后端没有返回,可以自己写a.download = '文件.pdf'
+ a.download = filename
+ document.body.appendChild(a)
+ // 点击a标签,进行下载
+ a.click()
+ // 收尾工作,在内存中移除URL 对象
+ document.body.removeChild(a)
+ window.URL.revokeObjectURL(herf)
}
\ No newline at end of file
diff --git a/src/view/home/index.vue b/src/view/home/index.vue
index 3f71a99..fd88ac7 100644
--- a/src/view/home/index.vue
+++ b/src/view/home/index.vue
@@ -124,7 +124,7 @@
资源动态时间轴
-
+
房间人员信息
@@ -132,8 +132,8 @@
本次查询结果
-
{{data?.chargeAmount||0}}
-
{{data?.workOrderCount||0}}
+
0&&outData('0')">{{data?.chargeAmount||0}}
+
0&&outData('1')">{{data?.workOrderCount||0}}
@@ -144,11 +144,13 @@
import request from '@/config/request'
import { computed, inject, onMounted, onUnmounted, reactive, ref, shallowRef, watch } from 'vue'
import search from './search.vue'
+import {downFile} from '@/config/unit'
var msg=inject("msg")
- var roomId=ref('')//1603212861432179257
+ var roomId=ref('')
var date=ref(null)
+ var type=ref("")
var scrollBoard=ref()
var config=reactive({
@@ -160,8 +162,13 @@ import search from './search.vue'
evenRowBGC:"transpatent",
})
var data=shallowRef({})
- var upData=computed(()=>data.value?.timeInfo?.filter?.((v,k)=>k%2==1)||[])
- var downData=computed(()=>data.value?.timeInfo?.filter?.((v,k)=>k%2==0)||[])
+ var list=computed(()=>{
+ var arr=data.value?.timeInfo?.filter?.(v=>!type.value||v.type==type.value)||[]
+ if(arr.length%2==1)return arr.concat({type:"none"})
+ else return arr
+ })
+ var upData=computed(()=>list.value.filter((v,k)=>k%2==1))
+ var downData=computed(()=>list.value.filter((v,k)=>k%2==0))
function color(status){
if(/已收款/.test(status))return "#1CF162"
@@ -175,7 +182,7 @@ import search from './search.vue'
type:"inside",
startValue:0,
endValue: max.value,
- xAxisIndex: data.value?.timeInfo?.length>12?[0,1]:[],
+ xAxisIndex: list.value.length>12?[0,1]:[],
zoomOnMouseWheel:false,
moveOnMouseMove:true,
moveOnMouseWheel:true,
@@ -203,7 +210,7 @@ import search from './search.vue'
axisLine:{show:false},
axisTick:{show:false},
axisLabel:{show:false},
- max: data.value?.timeInfo?.length>12?null:5,
+ max: upData.value?.length>6?null:5,
data: upData.value.map(v=>'')
},
{
@@ -212,7 +219,7 @@ import search from './search.vue'
axisLine:{show:false},
axisTick:{show:false},
axisLabel:{show:false},
- max: data.value?.timeInfo?.length>12?null:5,
+ max: downData.value?.length>6?null:5,
data: downData.value.map(v=>'')
}
],
@@ -378,9 +385,6 @@ import search from './search.vue'
})
if(res.statu){
data.value=res.data
- if(data.value.timeInfo.length%2==1){
- data.value.timeInfo.push({type:"none"})
- }
}else{
msg.error(res.msg||"获取费用工单失败!")
}
@@ -390,8 +394,21 @@ import search from './search.vue'
})
var echart=ref()
- function toPage(url){
- window.open(url)
+ async function outData(fileType){
+ var res=await request("/fileOutPut",{
+ responseType:"blob",
+ params:{
+ roomId: roomId.value,
+ startData: date.value?.[0]?.format?.('yyyy-MM-dd'),
+ endDate: date.value?.[1]?.format?.('yyyy-MM-dd'),
+ fileType,
+ }
+ })
+ if(res.status==200){
+ downFile(res.data,'excel', '当前欠费.xls')
+ }else{
+ msg.error(res.msg||"导出数据失败!")
+ }
}
onMounted(()=>{
diff --git a/src/view/home/search.vue b/src/view/home/search.vue
index 88f8abe..854fb54 100644
--- a/src/view/home/search.vue
+++ b/src/view/home/search.vue
@@ -72,6 +72,15 @@
end-placeholder="结束时间"
v-model="date"
@change="emit('update:date',$event)"/>
+
+
+
+
重置
@@ -81,6 +90,12 @@ import { inject, onMounted, reactive, ref, shallowRef, watch } from "vue"
var emit=defineEmits()
var msg=inject("msg")
+ var props=defineProps({
+ type:{
+ type:String,
+ default:"",
+ }
+ })
var formData=reactive({
villageId:"",