2024-11-30 15:52:42 +08:00
|
|
|
|
<template>
|
|
|
|
|
<div class="wrapTable">
|
|
|
|
|
<div class="RightBtnList">
|
|
|
|
|
<el-tooltip
|
2024-11-30 16:53:14 +08:00
|
|
|
|
class="item"
|
|
|
|
|
effect="dark"
|
|
|
|
|
:content="item.title"
|
|
|
|
|
placement="top"
|
|
|
|
|
v-for="(item, index) in fixedButtonList"
|
|
|
|
|
:key="index"
|
|
|
|
|
trigger="hover"
|
2024-11-30 15:52:42 +08:00
|
|
|
|
>
|
|
|
|
|
<span>
|
|
|
|
|
<el-button
|
2024-11-30 16:53:14 +08:00
|
|
|
|
size="mini"
|
|
|
|
|
:icon="item.icon"
|
|
|
|
|
@click.stop="
|
2024-11-30 15:52:42 +08:00
|
|
|
|
fixedClick(
|
|
|
|
|
item,
|
|
|
|
|
'#mainTable',
|
|
|
|
|
'机台排产表',
|
|
|
|
|
mainTableData,
|
|
|
|
|
mainTableColumn
|
|
|
|
|
)
|
|
|
|
|
"
|
2024-11-30 16:53:14 +08:00
|
|
|
|
style="margin: 0"
|
2024-11-30 15:52:42 +08:00
|
|
|
|
></el-button>
|
|
|
|
|
</span>
|
|
|
|
|
</el-tooltip>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="table">
|
|
|
|
|
<base-table
|
2024-11-30 16:53:14 +08:00
|
|
|
|
v-loading="tableLoading"
|
|
|
|
|
:showIndex="true"
|
|
|
|
|
:tableData="tableData"
|
|
|
|
|
:tableColumn="tableColumn"
|
|
|
|
|
:tableDataMergeList="tableDataMergeList"
|
|
|
|
|
id="mainTable"
|
2024-11-30 15:52:42 +08:00
|
|
|
|
>
|
|
|
|
|
<template #push_status="{row}">
|
|
|
|
|
<div>
|
|
|
|
|
<div>
|
|
|
|
|
<div v-if="row.push_status==='Y'" style="width: 70px;background: yellowgreen;color: #fff">
|
|
|
|
|
成功
|
|
|
|
|
</div>
|
|
|
|
|
<div v-else style="width: 70px;background: red;color: #fff">
|
|
|
|
|
失败
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<template #initiate="{row}">
|
|
|
|
|
<div>
|
|
|
|
|
{{ row.initiate === 'D' ? '钉钉' : 'u8c' }}
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<template #approve="{row}">
|
|
|
|
|
<div>
|
|
|
|
|
<div v-if="row.approve==='Y'" style="width: 70px;background: yellowgreen;color: #fff">
|
|
|
|
|
审核
|
|
|
|
|
</div>
|
|
|
|
|
<div v-else style="width: 70px;background: red;color: #fff">
|
|
|
|
|
拒绝
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<template #operation="{row}">
|
2024-11-30 16:53:14 +08:00
|
|
|
|
<div style="color: blue;cursor: pointer" @click="clickHandle(row)" v-if="row.approve!=='Y'">
|
2024-11-30 15:52:42 +08:00
|
|
|
|
补推
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</base-table>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="page" v-if="pageShow">
|
|
|
|
|
<el-pagination
|
2024-11-30 16:53:14 +08:00
|
|
|
|
@size-change="handleSizeChange"
|
|
|
|
|
@current-change="handleCurrentChange"
|
|
|
|
|
:current-page="pageModel.pageNum"
|
|
|
|
|
:page-sizes="[10, 20, 40, 100]"
|
|
|
|
|
:page-size="pageModel.pageSize"
|
|
|
|
|
layout="total, prev, pager, next,sizes, jumper"
|
|
|
|
|
:total="pageModel.pageTotal"
|
2024-11-30 15:52:42 +08:00
|
|
|
|
>
|
|
|
|
|
</el-pagination>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import baseTable from './baseTable/index.vue'
|
|
|
|
|
//导出excel使用
|
|
|
|
|
import XLSX from 'xlsx'
|
|
|
|
|
import FileSaver from 'file-saver'
|
|
|
|
|
//打印
|
|
|
|
|
import { basePrintJS } from '@/utils/util'
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: 'baseNewTable',
|
|
|
|
|
props: {
|
|
|
|
|
tableData: {
|
|
|
|
|
type: Array,
|
|
|
|
|
default: () => {
|
|
|
|
|
return []
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
tableColumn: {
|
|
|
|
|
type: Array,
|
|
|
|
|
default: () => {
|
|
|
|
|
return []
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
tableLoading: { type: Boolean, default: false },
|
|
|
|
|
exportEventName: { type: String, default: '导出文件名' },
|
|
|
|
|
tableDataMergeList: {
|
|
|
|
|
type: Array,
|
|
|
|
|
default: () => {
|
|
|
|
|
return []
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
pageShow: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: true
|
|
|
|
|
},
|
|
|
|
|
pageModel: {
|
|
|
|
|
type: Object,
|
|
|
|
|
default: () => {
|
|
|
|
|
return {
|
|
|
|
|
page: 1,
|
|
|
|
|
limit: 10,
|
|
|
|
|
pageTotal: 99
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
fixedButtonList: [
|
|
|
|
|
{
|
|
|
|
|
icon: 'el-icon-printer',
|
|
|
|
|
title: '打印'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
icon: 'el-icon-folder',
|
|
|
|
|
title: '导出'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
clickHandle(row) {
|
|
|
|
|
this.$emit('clickHandle', row)
|
|
|
|
|
},
|
|
|
|
|
/*
|
|
|
|
|
* 导出、打印功能
|
|
|
|
|
* item:当前按钮信息
|
|
|
|
|
* boxId:打印表单id(仅导出)
|
|
|
|
|
* name:导出后文件名(仅导出)
|
|
|
|
|
* tableData:传打印表格当前tableData(仅打印)
|
|
|
|
|
* tableColumn:传打印表格当前tableColumn(仅打印)
|
|
|
|
|
* */
|
|
|
|
|
fixedClick(item, boxId, name) {
|
|
|
|
|
if (item.title == '导出') {
|
|
|
|
|
this.exportEvent(name, boxId)
|
|
|
|
|
} else if (item.title == '打印') {
|
|
|
|
|
this.duplicate()
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
//导出功能
|
|
|
|
|
exportEvent(excelName, boxId) {
|
|
|
|
|
let gatherData = {
|
|
|
|
|
raw: true
|
|
|
|
|
}
|
|
|
|
|
let grid = XLSX.utils.table_to_book(
|
2024-11-30 16:53:14 +08:00
|
|
|
|
document.querySelector(boxId),
|
|
|
|
|
gatherData
|
2024-11-30 15:52:42 +08:00
|
|
|
|
)
|
|
|
|
|
let workbook = XLSX.write(grid, {
|
|
|
|
|
bookType: 'xlsx',
|
|
|
|
|
bookSST: true,
|
|
|
|
|
type: 'array'
|
|
|
|
|
})
|
|
|
|
|
try {
|
|
|
|
|
FileSaver.saveAs(
|
2024-11-30 16:53:14 +08:00
|
|
|
|
new Blob([workbook], {
|
|
|
|
|
type: 'application/octet-stream'
|
|
|
|
|
}),
|
|
|
|
|
this.exportEventName + '.xlsx'
|
2024-11-30 15:52:42 +08:00
|
|
|
|
)
|
|
|
|
|
} catch (e) {
|
|
|
|
|
if (typeof console !== 'undefined') console.log(e, workbook)
|
|
|
|
|
}
|
|
|
|
|
return workbook
|
|
|
|
|
},
|
|
|
|
|
//打印
|
|
|
|
|
duplicate() {
|
|
|
|
|
basePrintJS(this.tableData, this.tableColumn)
|
|
|
|
|
},
|
|
|
|
|
//页码size改变
|
|
|
|
|
handleSizeChange(val) {
|
|
|
|
|
console.log(val)
|
|
|
|
|
this.$emit('pageSizeChange', val)
|
|
|
|
|
},
|
|
|
|
|
//页码改变
|
|
|
|
|
handleCurrentChange(val) {
|
|
|
|
|
this.$emit('pageChange', val)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
components: {
|
|
|
|
|
baseTable
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
.wrapTable {
|
|
|
|
|
> .RightBtnList {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: flex-end;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
> .table {
|
|
|
|
|
margin-top: 10px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
> .page {
|
|
|
|
|
margin-top: 10px;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: flex-end;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|