程志平 3 лет назад
Родитель
Сommit
97440052e5
3 измененных файлов с 24 добавлено и 3 удалено
  1. 1 1
      config/index.js
  2. 22 1
      src/components/congzhijilu/congzhijilu.vue
  3. 1 1
      static/interface/index.js

+ 1 - 1
config/index.js

@@ -12,7 +12,7 @@ module.exports = {
 		// 后端请求地址代理,配置后testIp再之后的页面调用时就直接指代 http://197.82.15.15:8088
 		proxyTable: {
 			'/jxch-smartmp': {
-				target: 'https://jtishfw.ncjti.edu.cn/jxch-smartmp/', // 你请求的第三方接口
+				target: 'https://chtech.ncjti.edu.cn/jxch-smartmp/', // 你请求的第三方接口
 				// target: 'http://baibai.natapp1.cc', // 你请求的第三方接口
 				changeOrigin: true, // 在本地会创建一个虚拟服务端,然后发送请求的数据,并同时接收请求的数据,这样服务端和服务端进行数据的交互就不会有跨域问题
 				pathRewrite: { // 路径重写,

+ 22 - 1
src/components/congzhijilu/congzhijilu.vue

@@ -401,7 +401,28 @@
 			 * 导出为Excel表格
 			 */
 			onExport() {
-				console.log('onExport');
+				var _this = this;
+				let formData = new FormData();
+				if (typeof _this.startTime != 'undefined' && _this.startTime != '') {
+					formData.append("begin_time", _this.startTime);
+				}
+				if (typeof _this.endTime != 'undefined' && _this.endTime != '') {
+					formData.append("end_time", _this.endTime);
+				}
+				this.$axios.post('/jxch-smartmp/HotWaters/waterre_toExcel.action', formData)
+					.then(res => {
+						if (typeof res.data.downurl != 'undefined' && res.data.downurl != '' && JSON
+							.stringify(res.data) != '{}') {
+							// console.log(res.data.downurl);
+							window.open('https://jtishfw.ncjti.edu.cn/jxch-smartmp' + res.data.downurl);
+						} else {
+							_this.$message.error(res.data.message);
+						}
+					})
+					.catch(err => {
+						// console.log(err);
+						_this.$message.error('【导出表格】请求异常: ' + err);
+					})
 			},
 			/**
 			 * 获取查看记录列表

+ 1 - 1
static/interface/index.js

@@ -1,6 +1,6 @@
 // 配置主机地址和端口号(可以有多个,需要测试那个环境字节打开那个base即可)
 let base = "https://jtishfw.ncjti.edu.cn/jxch-smartmp"
-// let base = "https://chtech.ncjti.edu.cn/shuidian"
+// let base = "https://chtech.ncjti.edu.cn/jxch-smartmp"
 // let base = "http://192.168.1.34:8080/HotWaters/"
 
 // 在线api接口路径,需要和项目后台确认