|
@@ -32,6 +32,7 @@
|
|
|
<div class="month" style="height: 50px;">
|
|
|
<el-button v-if="isMaintenancePlanCopy" type="primary" icon="el-icon-copy-document" @click="handleCopy">复制</el-button>
|
|
|
<el-button v-if="isMaintenancePlanClear" type="danger" icon="el-icon-delete" @click="handleDelate">清空</el-button>
|
|
|
+ <el-button class="filter-item" type="success" icon="el-icon-download" @click="handleDownload">导出</el-button>
|
|
|
<el-upload style="display: inline-block;" :headers="headers" :data="uploadData" :action="uploadExcelUrl" :show-file-list="false" :before-upload="beforeImportExcel" :on-success="handleImportExcelSuccess">
|
|
|
<el-button v-if="isMaintenancePlanUpload" v-waves class="filter-item" type="warning" icon="el-icon-download">导入</el-button>
|
|
|
</el-upload>
|
|
@@ -130,7 +131,7 @@
|
|
|
|
|
|
<script>
|
|
|
// 引入
|
|
|
-import { GetDataByName, GetDataByNames, transData, GetUpkeepPlan, PostDataByName, failproccess, ExecDataByConfig, checkButtons } from '@/api/common'
|
|
|
+import { GetDataByName, GetDataByNames, transData, GetUpkeepPlan, PostDataByName, failproccess, ExecDataByConfig, checkButtons,GetAccount } from '@/api/common'
|
|
|
import waves from '@/directive/waves' // waves directive
|
|
|
import Pagination from '@/components/Pagination'
|
|
|
import { parseTime, json2excel } from '@/utils/index.js'
|
|
@@ -207,6 +208,22 @@ export default {
|
|
|
},
|
|
|
month: parseTime(new Date(), '{y}-{m}')
|
|
|
},
|
|
|
+ getdataListParmSH: {
|
|
|
+ name: 'geteqList',
|
|
|
+ page: 0,
|
|
|
+ offset: 0,
|
|
|
+ pagecount: 0,
|
|
|
+ returntype: 'Map',
|
|
|
+ parammaps: {
|
|
|
+ pastureName: Cookies.get('pasturename'),
|
|
|
+ eqCode: '',
|
|
|
+ eqName: '',
|
|
|
+ typeCode: '',
|
|
|
+ partName: '',
|
|
|
+ statue: 1
|
|
|
+ },
|
|
|
+ month: parseTime(new Date(), '{y}-{m}')
|
|
|
+ },
|
|
|
dialogStatus: '',
|
|
|
dialogFormVisible: false,
|
|
|
dialogStatusBtn: '',
|
|
@@ -1074,7 +1091,82 @@ export default {
|
|
|
]
|
|
|
json2excel(elecExcelDatas, '保养计划模板', true, 'xlsx')
|
|
|
})
|
|
|
- }
|
|
|
+ },
|
|
|
+
|
|
|
+ handleDownload() {
|
|
|
+ this.$alert('保养计划正在导出中,请勿刷新或离开本页面,若导出时间过长,建议缩小导出数据范围重新导出', {})
|
|
|
+ this.isPercentage = true
|
|
|
+ this.percentage = 1
|
|
|
+ var timer = setInterval(() => {
|
|
|
+ this.percentage += 5
|
|
|
+ if (this.percentage > 95) {
|
|
|
+ this.percentage = 99
|
|
|
+ clearInterval(timer)
|
|
|
+ }
|
|
|
+ this.percentage = this.percentage
|
|
|
+ }, 1000)
|
|
|
+ this.getdataListParmSH.month = this.getdataListParm.month
|
|
|
+ this.getdataListParmSH.parammaps = this.getdataListParm.parammaps
|
|
|
+ GetUpkeepPlan(this.getdataListParmSH).then(response => {
|
|
|
+ this.downLoadList = response.data.list
|
|
|
+ if (response.data.list !== '') {
|
|
|
+ this.percentage = 99
|
|
|
+ setTimeout(() => {
|
|
|
+ this.isPercentage = false
|
|
|
+ }, 2000)
|
|
|
+ }
|
|
|
+ console.log('ssssss',this.downLoadList)
|
|
|
+
|
|
|
+ var temp = this.getdataListParmSH.month.split('-')
|
|
|
+ var year = temp[0]
|
|
|
+ var month = temp[1]
|
|
|
+ var d = new Date(year, month, 0)
|
|
|
+ var tHeader = ['月份', '部门名称', '编码', '资产名称', '牧场', '保养人','1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31']
|
|
|
+ this.downLoadList.forEach(row => {
|
|
|
+ row.m1 = (typeof row.m1 === 'undefined') ? '' : row.m1.substr(0,1)
|
|
|
+ row.m2 = (typeof row.m2 === 'undefined') ? '' : row.m2.substr(0,1)
|
|
|
+ row.m3 = (typeof row.m3 === 'undefined') ? '' : row.m3.substr(0,1)
|
|
|
+ row.m4 = (typeof row.m4 === 'undefined') ? '' : row.m4.substr(0,1)
|
|
|
+ row.m5 = (typeof row.m5 === 'undefined') ? '' : row.m5.substr(0,1)
|
|
|
+ row.m6 = (typeof row.m6 === 'undefined') ? '' : row.m6.substr(0,1)
|
|
|
+ row.m7 = (typeof row.m7 === 'undefined') ? '' : row.m7.substr(0,1)
|
|
|
+ row.m8 = (typeof row.m8 === 'undefined') ? '' : row.m8.substr(0,1)
|
|
|
+ row.m9 = (typeof row.m9 === 'undefined') ? '' : row.m9.substr(0,1)
|
|
|
+ row.m10 = (typeof row.m10 === 'undefined') ? '' : row.m10.substr(0,1)
|
|
|
+ row.m11 = (typeof row.m11 === 'undefined') ? '' : row.m11.substr(0,1)
|
|
|
+ row.m12 = (typeof row.m12 === 'undefined') ? '' : row.m12.substr(0,1)
|
|
|
+ row.m13 = (typeof row.m13 === 'undefined') ? '' : row.m13.substr(0,1)
|
|
|
+ row.m14 = (typeof row.m14 === 'undefined') ? '' : row.m14.substr(0,1)
|
|
|
+ row.m15 = (typeof row.m15 === 'undefined') ? '' : row.m15.substr(0,1)
|
|
|
+ row.m16 = (typeof row.m16 === 'undefined') ? '' : row.m16.substr(0,1)
|
|
|
+ row.m17 = (typeof row.m17 === 'undefined') ? '' : row.m17.substr(0,1)
|
|
|
+ row.m18 = (typeof row.m18 === 'undefined') ? '' : row.m18.substr(0,1)
|
|
|
+ row.m19 = (typeof row.m19 === 'undefined') ? '' : row.m19.substr(0,1)
|
|
|
+ row.m20 = (typeof row.m20 === 'undefined') ? '' : row.m20.substr(0,1)
|
|
|
+ row.m21 = (typeof row.m21 === 'undefined') ? '' : row.m21.substr(0,1)
|
|
|
+ row.m22 = (typeof row.m22 === 'undefined') ? '' : row.m22.substr(0,1)
|
|
|
+ row.m23 = (typeof row.m23 === 'undefined') ? '' : row.m23.substr(0,1)
|
|
|
+ row.m24 = (typeof row.m24 === 'undefined') ? '' : row.m24.substr(0,1)
|
|
|
+ row.m25 = (typeof row.m25 === 'undefined') ? '' : row.m25.substr(0,1)
|
|
|
+ row.m26 = (typeof row.m26 === 'undefined') ? '' : row.m26.substr(0,1)
|
|
|
+ row.m27 = (typeof row.m27 === 'undefined') ? '' : row.m27.substr(0,1)
|
|
|
+ row.m28 = (typeof row.m28 === 'undefined') ? '' : row.m28.substr(0,1)
|
|
|
+ row.m29 = (typeof row.m29 === 'undefined') ? '' : row.m29.substr(0,1)
|
|
|
+ row.m30 = (typeof row.m30 === 'undefined') ? '' : row.m30.substr(0,1)
|
|
|
+ row.m31 = (typeof row.m31 === 'undefined') ? '' : row.m31.substr(0,1)
|
|
|
+ });
|
|
|
+ const elecExcelDatas = [
|
|
|
+ {
|
|
|
+ tHeader: tHeader,
|
|
|
+ filterVal: ['month','deptName','eqCode','eqName','pastureName','employeName','m1','m2','m3','m4','m5','m6','m7','m8','m9','m10','m11','m12','m13','m14','m15','m16','m17','m18','m19','m20','m21','m22','m23','m24','m25','m26','m27','m28','m29','m30','m31'],
|
|
|
+ tableDatas: this.downLoadList,
|
|
|
+ sheetName: 'SheetJS'
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ json2excel(elecExcelDatas, '保养计划', true, 'xlsx')
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
</script>
|