Commit 1788c804bc23fc7828d24152162e87faee56f3f4

Authored by qianbao
1 parent 78ceab92

上传添加导入添加loading

config/dev.env.js
1 'use strict' 1 'use strict'
2 const merge = require('webpack-merge') 2 const merge = require('webpack-merge')
3 const prodEnv = require('./prod.env') 3 const prodEnv = require('./prod.env')
4 -const isDev = false; 4 +const isDev = true;
5 const ipAddresses = isDev?"weberp.xlyprint.cn":"127.0.0.1:8080"; 5 const ipAddresses = isDev?"weberp.xlyprint.cn":"127.0.0.1:8080";
6 - //window.location.host;  
7 -  
8 module.exports = merge(prodEnv, { 6 module.exports = merge(prodEnv, {
9 NODE_ENV: '"development"', 7 NODE_ENV: '"development"',
10 BASE_API: '"http://'+ipAddresses+'/xlyReport"', 8 BASE_API: '"http://'+ipAddresses+'/xlyReport"',
src/views/bigscreenDesigner/designer/index.vue
@@ -131,6 +131,7 @@ @@ -131,6 +131,7 @@
131 :headers="headers" 131 :headers="headers"
132 accept=".zip" 132 accept=".zip"
133 :on-success="handleUpload" 133 :on-success="handleUpload"
  134 + :before-upload="beforeUpload"
134 :on-error="handleError" 135 :on-error="handleError"
135 :show-file-list="false" 136 :show-file-list="false"
136 :limit="1" 137 :limit="1"
@@ -140,34 +141,42 @@ @@ -140,34 +141,42 @@
140 </el-tooltip> 141 </el-tooltip>
141 </span> 142 </span>
142 <span class="btn border-left" v-permission="'bigScreenManage:import'"> 143 <span class="btn border-left" v-permission="'bigScreenManage:import'">
143 - <ul class="nav">  
144 - <li>  
145 - <i class="iconfont icondaochu"></i  
146 - ><i class="el-icon-arrow-down"></i>  
147 - <ul>  
148 - <li>  
149 - <el-tooltip  
150 - class="item"  
151 - effect="dark"  
152 - content="适合当前系统"  
153 - placement="right"  
154 - >  
155 - <div @click="exportDashboard(1)">导出(包含数据集)</div>  
156 - </el-tooltip>  
157 - </li>  
158 - <li>  
159 - <el-tooltip  
160 - class="item"  
161 - effect="dark"  
162 - content="适合跨系统"  
163 - placement="right"  
164 - >  
165 - <div @click="exportDashboard(0)">导出(不包含数据集)</div>  
166 - </el-tooltip>  
167 - </li>  
168 - </ul>  
169 - </li>  
170 - </ul> 144 + <i class="iconfont icondaochu" @click="exportDashboard(1)"></i>
  145 + <el-tooltip
  146 + class="item"
  147 + effect="dark"
  148 + content="导出"
  149 + placement="right"
  150 + >
  151 + </el-tooltip>
  152 +<!-- <ul class="nav">-->
  153 +<!-- <li>-->
  154 +<!-- <i class="iconfont icondaochu"></i-->
  155 +<!-- ><i class="el-icon-arrow-down"></i>-->
  156 +<!-- <ul>-->
  157 +<!-- <li>-->
  158 +<!-- <el-tooltip-->
  159 +<!-- class="item"-->
  160 +<!-- effect="dark"-->
  161 +<!-- content="适合当前系统"-->
  162 +<!-- placement="right"-->
  163 +<!-- >-->
  164 +<!-- <div @click="exportDashboard(1)">导出(包含数据集)</div>-->
  165 +<!-- </el-tooltip>-->
  166 +<!-- </li>-->
  167 +<!-- <li>-->
  168 +<!-- <el-tooltip-->
  169 +<!-- class="item"-->
  170 +<!-- effect="dark"-->
  171 +<!-- content="适合跨系统"-->
  172 +<!-- placement="right"-->
  173 +<!-- >-->
  174 +<!-- <div @click="exportDashboard(0)">导出(不包含数据集)</div>-->
  175 +<!-- </el-tooltip>-->
  176 +<!-- </li>-->
  177 +<!-- </ul>-->
  178 +<!-- </li>-->
  179 +<!-- </ul>-->
171 </span> 180 </span>
172 </div> 181 </div>
173 <!-- 中间设计--> 182 <!-- 中间设计-->
@@ -301,7 +310,6 @@ @@ -301,7 +310,6 @@
301 import { 310 import {
302 insertDashboard, 311 insertDashboard,
303 detailDashboard, 312 detailDashboard,
304 - importDashboard,  
305 exportDashboard, 313 exportDashboard,
306 } from "@/api/bigscreen"; 314 } from "@/api/bigscreen";
307 import { widgetTools, getToolByCode } from "./tools/index"; 315 import { widgetTools, getToolByCode } from "./tools/index";
@@ -319,7 +327,6 @@ import { debounce } from &#39;@/utils/debounce&#39;; // 引入防抖函数 @@ -319,7 +327,6 @@ import { debounce } from &#39;@/utils/debounce&#39;; // 引入防抖函数
319 import loadingViewerVue from 'loading-view-vue' 327 import loadingViewerVue from 'loading-view-vue'
320 import Vue from "vue"; 328 import Vue from "vue";
321 Vue.use(loadingViewerVue,{mode:"5"}); 329 Vue.use(loadingViewerVue,{mode:"5"});
322 -  
323 export default { 330 export default {
324 name: "Login", 331 name: "Login",
325 components: { 332 components: {
@@ -331,7 +338,7 @@ export default { @@ -331,7 +338,7 @@ export default {
331 }, 338 },
332 data() { 339 data() {
333 return { 340 return {
334 - uploadUrl:process.env.BASE_API +"/reportDashboard/import/" +this.$route.query.reportCode, 341 + uploadUrl :"http://"+window.location.host+"/xlyReport/reportDashboard/import/" +this.$route.query.reportCode,
335 grade: false, 342 grade: false,
336 layerWidget: [], 343 layerWidget: [],
337 widgetTools: widgetTools, // 左侧工具栏的组件图标,将js变量加入到当前作用域 344 widgetTools: widgetTools, // 左侧工具栏的组件图标,将js变量加入到当前作用域
@@ -717,11 +724,11 @@ export default { @@ -717,11 +724,11 @@ export default {
717 // 导出 724 // 导出
718 async exportDashboard(val) { 725 async exportDashboard(val) {
719 const fileName = this.$route.query.reportCode + ".zip"; 726 const fileName = this.$route.query.reportCode + ".zip";
720 -  
721 const param = { 727 const param = {
722 reportCode: this.$route.query.reportCode, 728 reportCode: this.$route.query.reportCode,
723 showDataSet: val, 729 showDataSet: val,
724 }; 730 };
  731 + this.$showLoading();
725 exportDashboard(param).then((res) => { 732 exportDashboard(param).then((res) => {
726 const that = this; 733 const that = this;
727 const type = res.type; 734 const type = res.type;
@@ -734,8 +741,8 @@ export default { @@ -734,8 +741,8 @@ export default {
734 }; 741 };
735 return; 742 return;
736 } 743 }
737 -  
738 const blob = new Blob([res], { type: "application/octet-stream" }); 744 const blob = new Blob([res], { type: "application/octet-stream" });
  745 + this.$hideLoading();
739 if (window.navigator.msSaveOrOpenBlob) { 746 if (window.navigator.msSaveOrOpenBlob) {
740 //msSaveOrOpenBlob方法返回bool值 747 //msSaveOrOpenBlob方法返回bool值
741 navigator.msSaveBlob(blob, fileName); //本地保存 748 navigator.msSaveBlob(blob, fileName); //本地保存
@@ -748,12 +755,17 @@ export default { @@ -748,12 +755,17 @@ export default {
748 } 755 }
749 }); 756 });
750 }, 757 },
  758 + //上传之前
  759 + beforeUpload(){
  760 + this.$showLoading();
  761 + },
751 // 上传成功的回调 762 // 上传成功的回调
752 handleUpload(response, file, fileList) { 763 handleUpload(response, file, fileList) {
753 //清除el-upload组件中的文件 764 //清除el-upload组件中的文件
754 this.$refs.upload.clearFiles(); 765 this.$refs.upload.clearFiles();
755 //刷新大屏页面 766 //刷新大屏页面
756 this.initEchartData(); 767 this.initEchartData();
  768 + this.$hideLoading();
757 if (response.code == "200") { 769 if (response.code == "200") {
758 this.$message({ 770 this.$message({
759 message: "导入成功!", 771 message: "导入成功!",
@@ -767,6 +779,7 @@ export default { @@ -767,6 +779,7 @@ export default {
767 } 779 }
768 }, 780 },
769 handleError(err) { 781 handleError(err) {
  782 + this.$hideLoading();
770 this.$message({ 783 this.$message({
771 message: "上传失败!", 784 message: "上传失败!",
772 type: "error", 785 type: "error",
@@ -941,6 +954,8 @@ export default { @@ -941,6 +954,8 @@ export default {
941 this.widgetOptions = this.deepClone(this.widgets[obj.index]["options"]); 954 this.widgetOptions = this.deepClone(this.widgets[obj.index]["options"]);
942 }, 955 },
943 widgetsClick(index) { 956 widgetsClick(index) {
  957 + console.log("222222",process);
  958 + console.log("222222",window.location.host,reurl);
944 const draggableArr = this.$refs.widgets; 959 const draggableArr = this.$refs.widgets;
945 //判断是否按住了shift键盘 960 //判断是否按住了shift键盘
946 if(this.shiftEnt){ 961 if(this.shiftEnt){