Commit 66c243d5 authored by 旭艳's avatar 旭艳

生产准备检查页面的导出功能

parent 5d47ae28
/**
* element 导出excel
* @Author:fangk
*/
import FileSaver from 'file-saver'
import XLSX from 'xlsx'
/**
*
* @param {Dom元素} element
* @param {导出名称} name
* @returns
* 已知bug1:单元格如有英文逗号则不显示
* 已知bug2:树表格的情况收缩数据不下载
*/
export function exportExcel(element, name) {
/* out-table关联导出的dom节点 */
var wb = XLSX.utils.table_to_book(element)
/* get binary string as output */
var wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'array' })
try {
FileSaver.saveAs(new Blob([wbout], { type: 'application/octet-stream' }), name + '.xlsx')
} catch (e) { if (typeof console !== 'undefined') console.error(e, wbout) }
return wbout
}
<!--
* @Author:fangk
* @Date: 2021-03-23
* @Description: 生产准备检查-生产准备检查
* @setAuthor:fangk 2021-03-22
-->
<template> <template>
<div class="production-preparation-inspection-confirmation"> <div class="production-preparation-inspection-confirmation">
<el-table <el-table
...@@ -70,7 +63,7 @@ ...@@ -70,7 +63,7 @@
</template> </template>
<script> <script>
import { v4 as uuidv4 } from 'uuid' import { v4 as uuidv4 } from 'uuid'
// import { exportExcel } from '@/api/exportExcel-elementUI.js' import { exportExcel } from '@/api/exportExcel-elementUI.js'
export default { export default {
props: { props: {
confirmaData: { confirmaData: {
...@@ -134,16 +127,16 @@ export default { ...@@ -134,16 +127,16 @@ export default {
return dictValue[0].dictValue return dictValue[0].dictValue
} }
return '' return ''
} },
/** /**
* 导出数据 * 导出数据
*/ */
// exportTable() { exportTable() {
// exportExcel(this.$refs[this.onlyUuid].$el, '总装制造执行系统') exportExcel(this.$refs[this.onlyUuid].$el, '总装制造执行系统')
// }, },
// exportTable2() { exportTable2() {
// exportExcel(this.$parent.$refs[this.$parent.onlyUuid].$el, '准备情况') exportExcel(this.$parent.$refs[this.$parent.onlyUuid].$el, '准备情况')
// } }
} }
} }
</script> </script>
...@@ -64,14 +64,6 @@ ...@@ -64,14 +64,6 @@
end-placeholder="结束日期" end-placeholder="结束日期"
/> />
</div> </div>
<!-- <div>
<span>表格显示计划状态:</span>
<el-select v-model="tableShow" placeholder="请选择" size="small">
<el-option value="1" label="合并显示" />
<el-option value="2" label="显示准备情况确认表" />
<el-option value="3" label="显示生产准备确认项表" />
</el-select>
</div> -->
</div> </div>
</div> </div>
<div> <div>
...@@ -126,37 +118,9 @@ ...@@ -126,37 +118,9 @@
</el-tabs> </el-tabs>
<div> <div>
<dee-tools :tools="tools" mode="normal" app-name="tf-mom" :collapse="false" /> <dee-tools :tools="tools" mode="normal" app-name="tf-mom" :collapse="false" />
<!-- <el-button
v-if="conStatus === 'Not'"
class="dee-tools"
size="small"
@click="preparaConfirmation(true)"
>
<img
src="/icons/c-newpart.png"
class="icon"
alt=""
>生产准备确认</el-button>
<el-button
v-else
class="dee-tools"
size="small"
@click="preparaConfirmation(false)"
>
<img
src="/icons/c-newpart.png"
class="icon"
alt=""
>撤销</el-button> -->
<!-- <el-button class="dee-tools" size="small" @click="exportTable">
<img
src="/icons/c-Import.png"
class="icon"
alt=""
>导出</el-button> -->
</div> </div>
</header> </header>
<div v-loading="confirmaLoading" class="table"> <div class="table">
<el-table <el-table
v-if="!confirmaLoading" v-if="!confirmaLoading"
ref="table" ref="table"
...@@ -304,16 +268,7 @@ ...@@ -304,16 +268,7 @@
>{{ item.name }}</el-radio-button> >{{ item.name }}</el-radio-button>
</el-radio-group> </el-radio-group>
<div> <div>
<!-- <el-button <dee-tools :tools="toolsRight" :collapse="false" style="width:100px" />
class="dee-tools"
size="small"
@click="exportTableSituation"
>
<img
src="/icons/c-Import.png"
class="icon"
alt=""
>导出</el-button> -->
<div v-if="conStatus === 'Yes'" class="legnd"> <div v-if="conStatus === 'Yes'" class="legnd">
<div <div
v-for="item in joExecutePlanStateData" v-for="item in joExecutePlanStateData"
...@@ -330,7 +285,7 @@ ...@@ -330,7 +285,7 @@
</div> </div>
</div> </div>
</header> </header>
<div v-loading="preparaLoading" class="table"> <div class="table">
<el-table <el-table
v-if="!preparaLoading" v-if="!preparaLoading"
:ref="onlyUuid" :ref="onlyUuid"
...@@ -582,6 +537,7 @@ ...@@ -582,6 +537,7 @@
import { post } from '@/utils/http' import { post } from '@/utils/http'
import { v4 as uuidv4 } from 'uuid' import { v4 as uuidv4 } from 'uuid'
import exportExcelTable from './exportExcelTable.vue' import exportExcelTable from './exportExcelTable.vue'
import { exportExcel } from '@/api/exportExcel-elementUI.js'
export default { export default {
name: 'StationPlanDetails', name: 'StationPlanDetails',
components: { components: {
...@@ -627,6 +583,17 @@ export default { ...@@ -627,6 +583,17 @@ export default {
icon: '/icons/c-newpart.png' icon: '/icons/c-newpart.png'
} }
], ],
toolsRight: [
{
name: '导出',
icon: '/icons/c-Import.png',
handler: {
click: () => {
this.exportTableSituation()
}
}
}
],
editRow: { editRow: {
id: null, id: null,
parenId: null, parenId: null,
...@@ -996,6 +963,12 @@ export default { ...@@ -996,6 +963,12 @@ export default {
getCheckConfirmYes(status) { getCheckConfirmYes(status) {
var that = this var that = this
that.confirmaLoading = true that.confirmaLoading = true
let state = null
if (status) {
state = status
} else {
state = this.conStatus === 'Not' ? this.conStatus : 'Y'
}
post( post(
'WrProduction/findProductionPrepare', 'WrProduction/findProductionPrepare',
{ {
...@@ -1004,7 +977,7 @@ export default { ...@@ -1004,7 +977,7 @@ export default {
serialNumber: this.AOname, serialNumber: this.AOname,
scheduledStart: (this.date.length && this.date[0]) || '', scheduledStart: (this.date.length && this.date[0]) || '',
scheduledEnd: (this.date.length && this.date[1]) || '', scheduledEnd: (this.date.length && this.date[1]) || '',
state: this.conStatus state: state
} }
) )
.then((res) => { .then((res) => {
...@@ -1430,26 +1403,26 @@ export default { ...@@ -1430,26 +1403,26 @@ export default {
}) })
.catch((err) => console.error(err)) .catch((err) => console.error(err))
.finally(() => {}) .finally(() => {})
} },
/** /**
* 导出数据 * 导出数据
*/ */
// exportTable() { exportTable() {
// this.$refs.exportExcelTable.exportTable() this.$refs.exportExcelTable.exportTable()
// }, },
// exportTableSituation() { exportTableSituation() {
// var title = '' var title = ''
// this.confirmaData.forEach((p) => { this.confirmaData.forEach((p) => {
// p.children.forEach((q) => { p.children.forEach((q) => {
// if (q.highlight) title = q.materNo if (q.highlight) title = q.materNo
// }) })
// }) })
// var label = '' var label = ''
// this.tabsData.forEach((p) => { this.tabsData.forEach((p) => {
// if (this.readyStatus === p.typeName) label = p.name if (this.readyStatus === p.typeName) label = p.name
// }) })
// exportExcel(this.$refs[this.onlyUuid].$el, title + '-' + label) exportExcel(this.$refs[this.onlyUuid].$el, title + '-' + label)
// } }
} }
} }
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment