This commit is contained in:
home孙 2025-07-01 14:45:34 +08:00
parent 469266bdc9
commit 0943cb5832

View File

@ -28,7 +28,7 @@
<div class="btn blue" @click="search">
{{ $t('imageGallery.query') }}
</div>
<div class="btn blue" @click="download">
<div class="btn blue" @click="downloadFile(0)">
{{ $t('imageGallery.download') }}
</div>
<div class="btn blue" @click="openModel">
@ -82,7 +82,7 @@
<div class="btn blue" @click="search1">
{{ $t('imageGallery.query') }}
</div>
<div class="btn blue" @click="download1">
<div class="btn blue" @click="downloadFile(1)">
{{ $t('imageGallery.download') }}
</div>
</div>
@ -105,6 +105,23 @@
</div>
</el-dialog>
<el-dialog title="" class="vrcode-model confirm-psw" top="30vh" :close-on-click-modal="false" :append-to-body="true" :visible.sync="warnModel"
width="700px">
<div class="vrcode-model-title vrcode-model-title-282">{{ $t('placeholder.fileName') }}</div>
<div class="warning-model" style="padding: 0 30px;">
<div class="flex-view border-none">
<div class="input-main">
<div>{{ $t('placeholder.fileName') }}</div>
<input type="text" v-model="fileName">
</div>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="modelClose">{{$t('index.cancel1')}}</el-button>
<el-button type="success" @click="modelConfirm">{{$t('index.confirm1')}}</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
@ -131,6 +148,10 @@ export default {
pageSize1: 10,
tableList1: [],
total1: 0,
warnModel:false,//
downType:0,
fileName:'',
}
},
watch: {
@ -216,13 +237,36 @@ export default {
this.getData()
}, 0);
},
modelClose(){
this.downType=0
this.warnModel=false
},
modelConfirm(){
if(this.downType==0){
this.download()
}else{
this.download1()
}
},
downloadFile(type){
var store = this.$store.state
var index = store.equipmentIndex;
this.downType=type
this.fileName=store.equipmentList[index - 1].deviceTypeName
this.warnModel=true
},
download1() {
if(!this.fileName){
this.$message.warning( this.$t('message.fileName'));
return
}
this.loading = this.$loading({
lock: true,
text: this.$t('message.loading'),
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
var store = this.$store.state
var index = store.equipmentIndex;
var data = {
@ -234,6 +278,7 @@ export default {
isEquipment: store.equipmentList[index - 1].deviceName == 30 ? 1 : 0
}
this.api.selFsAvgdatadownload(data).then(res => {
this.warnModel=false
// blob
this.loading.close()
const blob = new Blob([res.data], { type: 'text/csv' });
@ -244,7 +289,7 @@ export default {
link.href = url;
//
link.setAttribute('download', 'filename.csv');
link.setAttribute('download', `${this.fileName}.csv`);
//
document.body.appendChild(link);
@ -256,12 +301,17 @@ export default {
})
},
download() {
if(!this.fileName){
this.$message.warning( this.$t('message.fileName'));
return
}
this.loading = this.$loading({
lock: true,
text: this.$t('message.loading'),
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
var store = this.$store.state
var index = store.equipmentIndex;
var data = {
@ -273,6 +323,7 @@ export default {
isEquipment: store.equipmentList[index - 1].deviceName == 30 ? 1 : 0
}
this.api.loadHistorydata(data).then(res => {
this.warnModel=false
// blob
this.loading.close()
const blob = new Blob([res.data], { type: 'text/csv' });
@ -283,7 +334,7 @@ export default {
link.href = url;
//
link.setAttribute('download', 'filename.csv');
link.setAttribute('download', `${this.fileName}.csv`);
//
document.body.appendChild(link);