保养信息维护导出

This commit is contained in:
zhangdingyu
2019-12-12 14:06:52 +08:00
parent 53b8b6c813
commit da58336320
2 changed files with 52 additions and 9 deletions

View File

@@ -1,7 +1,21 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-card> <el-card>
<div>设备对应点检类型维护</div> <div>
<span style="line-height: 25px">设备对应点检类型维护</span>
<div style="float: right;margin: 5px">
<el-select v-model="OPnameValue" filterable size="small" placeholder="工位号" style="width: 110px">
<el-option
v-for="item in OPname"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>选择月份</span>
<el-date-picker v-model="monthssss" size="small" type="month" value-format="yyyy-MM" format="yyyy-MM" style="width: 110px" placeholder="选择月"/>
<el-button size="small" type="primary" style="margin-right: 50px" @click="exportOut()">导出日点检表</el-button>
</div>
</div>
<el-table v-loading="loading1" :data="tableData1" height="200" highlight-current-row border> <el-table v-loading="loading1" :data="tableData1" height="200" highlight-current-row border>
<el-table-column align="center" label="序号" type="index" width="50"/> <el-table-column align="center" label="序号" type="index" width="50"/>
<el-table-column align="center" label="工位号" width="110"> <el-table-column align="center" label="工位号" width="110">
@@ -104,7 +118,6 @@
</el-col> </el-col>
</el-card> </el-card>
<el-card v-show="false" style="width: 1565px"> <el-card v-show="false" style="width: 1565px">
<el-button size="mini" type="primary" @click="exportOut()">导出</el-button>
<div id="dianjianbiao"> <div id="dianjianbiao">
<div style="width: 1541px;font-size: 28px;font-weight: bold;text-align: center;">设备保养点检记录表</div> <div style="width: 1541px;font-size: 28px;font-weight: bold;text-align: center;">设备保养点检记录表</div>
<div> <div>
@@ -452,6 +465,9 @@ export default {
保养项目: [{ required: true, message: '请输入保养项目', trigger: 'blur' }], 保养项目: [{ required: true, message: '请输入保养项目', trigger: 'blur' }],
保养周期: [{ required: true, message: '请选择保养周期', trigger: 'change' }] 保养周期: [{ required: true, message: '请选择保养周期', trigger: 'change' }]
}, },
OPnameValue: '',
OPname: [],
monthssss: '',
tableData: [], tableData: [],
设备名称: '', 设备名称: '',
设备编号: '' 设备编号: ''
@@ -463,9 +479,16 @@ export default {
}, },
methods: { methods: {
getTableData1() { getTableData1() {
this.OPname = []
this.tableData1 = [] this.tableData1 = []
this.loading1 = true this.loading1 = true
getTableData1().then(response => { getTableData1().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.OPname.push({
label: response.data[i].工位号,
value: response.data[i].工位号
})
}
this.tableData1 = response.data this.tableData1 = response.data
this.loading1 = false this.loading1 = false
}) })
@@ -681,12 +704,32 @@ export default {
}) })
}, },
exportOut() { exportOut() {
exportOut('OP1030', 2019, 12).then(response => { this.tableData = []
if (this.OPnameValue) {
if (this.monthssss) {
var year = this.monthssss.split('-')[0]
var month = this.monthssss.split('-')[1]
exportOut(this.OPnameValue, year, month).then(response => {
if (response.data.length !== 0) {
this.设备名称 = response.data[0].设备名称 this.设备名称 = response.data[0].设备名称
this.设备编号 = response.data[0].设备编号 this.设备编号 = response.data[0].设备编号
this.tableData = response.data this.tableData = response.data
console.log(response.data) }
}).then(() => {
if (this.tableData !== []) {
this.Out()
} else {
this.$message.error('暂无该月数据')
}
}) })
} else {
this.$message.error('请选择月份')
}
} else {
this.$message.error('请选择工位')
}
},
Out() {
const htmlNode = $('#dianjianbiao').html() const htmlNode = $('#dianjianbiao').html()
const body = $('body') const body = $('body')
body.children().hide() body.children().hide()