|
@@ -50,6 +50,7 @@
|
|
|
<el-button class="successBorder" @click="form_search">查询</el-button>
|
|
<el-button class="successBorder" @click="form_search">查询</el-button>
|
|
|
<el-button class="successBorder" @click="handleRefresh">重置</el-button>
|
|
<el-button class="successBorder" @click="handleRefresh">重置</el-button>
|
|
|
<el-button class="successBorder" @click="handleGetPastureData">牧场数据获取</el-button>
|
|
<el-button class="successBorder" @click="handleGetPastureData">牧场数据获取</el-button>
|
|
|
|
|
+ <el-button class="export" icon="el-icon-upload2" @click="handleDownLoad">导出</el-button>
|
|
|
</div>
|
|
</div>
|
|
|
<el-row :gutter="10">
|
|
<el-row :gutter="10">
|
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
@@ -624,10 +625,12 @@
|
|
|
import echarts from 'echarts'
|
|
import echarts from 'echarts'
|
|
|
|
|
|
|
|
require('echarts/theme/macarons')
|
|
require('echarts/theme/macarons')
|
|
|
-import { GetDataByName, GetReportform, formatNum,processAnalysist,editWeightHL,editWeightSL,getPastureData } from '@/api/common'
|
|
|
|
|
|
|
+import { GetDataByName, GetReportform, formatNum,processAnalysist,editWeightHL,editWeightSL,getPastureData,processAnalysistDown } from '@/api/common'
|
|
|
import Cookies from 'js-cookie'
|
|
import Cookies from 'js-cookie'
|
|
|
-import { parseTime } from '@/utils/index.js'
|
|
|
|
|
|
|
+import { parseTime ,json2excel} from '@/utils/index.js'
|
|
|
import { MessageBox } from 'element-ui';
|
|
import { MessageBox } from 'element-ui';
|
|
|
|
|
+import axios from 'axios'
|
|
|
|
|
+import { getToken } from '@/utils/auth' // get token from cookie
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
name: 'PastureProcessAnalysis',
|
|
name: 'PastureProcessAnalysis',
|
|
@@ -815,6 +818,48 @@ export default {
|
|
|
this.getList()
|
|
this.getList()
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+
|
|
|
|
|
+ // 导出功能
|
|
|
|
|
+ handleDownLoad(){
|
|
|
|
|
+ if (this.table.getdataListParm.parammaps.inputDatetime !== '' && this.table.getdataListParm.parammaps.inputDatetime !== null) {
|
|
|
|
|
+ this.table.getdataListParm.parammaps.startTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
|
|
|
|
|
+ this.table.getdataListParm.parammaps.stopTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.table.getdataListParm.parammaps.inputDatetime = ''
|
|
|
|
|
+ this.table.getdataListParm.parammaps.startTime = ''
|
|
|
|
|
+ this.table.getdataListParm.parammaps.stopTime = ''
|
|
|
|
|
+ }
|
|
|
|
|
+ const url = Cookies.get('url') + 'authdata/process/excel' // 请求下载文件的地址
|
|
|
|
|
+ console.log(url)
|
|
|
|
|
+ axios({
|
|
|
|
|
+ method: 'POST',
|
|
|
|
|
+ url: url,
|
|
|
|
|
+ data: this.table.getdataListParm,
|
|
|
|
|
+ headers: { token: getToken(), optname: 'insertcustomdoc' },
|
|
|
|
|
+ responseType: 'blob'
|
|
|
|
|
+ }).then(res => {
|
|
|
|
|
+ if (!res) return
|
|
|
|
|
+ this.percentage = 99
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ this.isPercentage = false
|
|
|
|
|
+ }, 2000)
|
|
|
|
|
+ const blob = new Blob([res.data], {
|
|
|
|
|
+ type: 'application/octet-stream;charset=utf-8'
|
|
|
|
|
+ })
|
|
|
|
|
+ const url = window.URL.createObjectURL(blob)
|
|
|
|
|
+ const aLink = document.createElement('a')
|
|
|
|
|
+ aLink.style.display = 'none'
|
|
|
|
|
+ aLink.href = url
|
|
|
|
|
+ const docname = '过程分析.xlsx'
|
|
|
|
|
+ aLink.setAttribute('download', docname) // 下载的文件
|
|
|
|
|
+ document.body.appendChild(aLink)
|
|
|
|
|
+ aLink.click()
|
|
|
|
|
+ document.body.removeChild(aLink)
|
|
|
|
|
+ window.URL.revokeObjectURL(url)
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
// 牧场数据获取
|
|
// 牧场数据获取
|
|
|
handleGetPastureData(){
|
|
handleGetPastureData(){
|
|
|
console.log('牧场数据获取')
|
|
console.log('牧场数据获取')
|