This commit is contained in:
liushuai
2018-12-24 15:29:44 +08:00
29 changed files with 170 additions and 3885 deletions

View File

@@ -0,0 +1,20 @@
// 导出Excel方法表格id不加扩展名的文件名sheet名
export function exportExcelMethod(tableId, fileName, sheetName) {
tableToExcel(tableId, fileName, sheetName)
return 1
}
const tableToExcel = (function() {
const uri = 'data:application/vnd.ms-excel;base64,'
// 设置导出表格的单元格默认高度/宽度/边框样式/字体颜色/背景颜色/居中网页显示表格宽度建议1240tr/td视情况而定
const template = `<html xmlns:x="urn:schemas-microsoft-com:office:excel"><head><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><meta charset="UTF-8"><style type="text/css">table td {border: 2px solid #000000;height:40px;text-align: center;color: #000000;}</style></head><body><table>{table}</table></body></html>`
const base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) }
const format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p] }) }
return function(table, filename, sheetname) {
if (!table.nodeType) table = document.getElementById(table)
const ctx = { worksheet: sheetname || 'Worksheet', table: table.innerHTML }
const aTag = document.createElement('a')
aTag.href = uri + base64(format(template, ctx))
aTag.download = filename
aTag.click()
}
})()

View File

@@ -6,7 +6,8 @@
<el-input v-model="partName" placeholder="零件图号" size="small" clearable style="width:200px"/>
<el-button size="small" icon="el-icon-search" type="success" style="margin-left: 10px" @click="pageSize=10; pageCurrent=1;searchTable()">查询</el-button>
<el-checkbox v-model="all" size="mini">查询全部</el-checkbox>
<el-button type="primary" size="small" icon="el-icon-download" style="margin-left:10px" @click="downLoad('BL');edit()">导出备料单</el-button>
<el-button type="primary" size="small" icon="el-icon-download" style="margin-left:10px" @click="downLoad('BL')">导出备料单</el-button>
<el-button type="primary" size="small" icon="el-icon-success" style="margin-left:10px" @click="edit()">导出完成</el-button>
</el-row>
</el-card>
@@ -78,10 +79,11 @@
<script>
import { searchtable, searchtable2, edit } from '@/api/ManufacturingCenter/CreatePreparationBill'
import { getExplorer, method5, Cleanup } from '@/vendor/exportExcel'
import { exportExcelMethod } from './exportExcel'
export default {
data() {
return {
a: 0,
tableData2: [],
partName: '',
all: false,
@@ -118,10 +120,11 @@ export default {
for (let i = 0; i < this.Data.length; i++) {
searchtable2(this.Data[i].工艺计划流水号).then(response => {
this.tableData.push({
工艺计划流水号: this.Data[i].工艺计划流水号,
零件名称: this.Data[i].零件名称,
零件图号: this.Data[i].零件图号,
备料打印: this.Data[i].备料打印,
工艺要求: response.data[i].工艺要求
工艺要求: response.data[0].工艺要求
})
})
this.loading = false
@@ -133,18 +136,24 @@ export default {
this.tableData2 = val
},
edit() {
for (let i = 0; i < this.tableData2.length; i++) {
edit(this.tableData2[i].工艺计划流水号)
if (this.tableData2.length === 0) {
this.$message.warning('暂无数据')
} else {
this.a = 0
for (let i = 0; i < this.tableData2.length; i++) {
edit(this.tableData2[i].工艺计划流水号)
this.a = this.a + 1
}
if (this.a === this.tableData2.length) {
this.searchTable()
}
}
},
downLoad(tableid) {
if (this.tableData2.length === 0) {
this.$message.warning('暂无数据')
} else {
this.searchTable()
getExplorer()
method5(tableid)
Cleanup()
exportExcelMethod(tableid, '123', 'asd')
}
},
// 分页

View File

@@ -98,8 +98,8 @@ export default {
零件名称: this.Data[i].零件名称,
零件图号: this.Data[i].零件图号,
备料到货: this.Data[i].备料到货,
工艺要求: response.data[i].工艺要求,
工序流水号: response.data[i].工序流水号
工艺要求: response.data[0].工艺要求,
工序流水号: response.data[0].工序流水号
})
})
this.loading = false

View File

@@ -348,7 +348,6 @@ export default {
},
handleSelectionChange(val) {
this.multipleSelection = val
console.log(this.multipleSelection)
},
save() {
for (let i = 0; i < this.multipleSelection.length; i++) {

View File

@@ -3,7 +3,7 @@
<el-card>
<el-row>
<span>项目名称:</span>
<el-select v-model="project" size="small" filterable clearable placeholder="项目名称" @change="getMachine">
<el-select v-model="project" size="small" filterable clearable placeholder="项目名称" style="width: 180px;" @change="getMachine">
<el-option
v-for="item in projects"
:key="item.value"
@@ -11,7 +11,7 @@
:value="item.value"/>
</el-select>
<span>机床号:</span>
<el-select v-model="Machine" size="small" clearable placeholder="机床号" @change="getGroup">
<el-select v-model="Machine" size="small" clearable placeholder="机床号" style="width: 180px;" @change="getGroup">
<el-option
v-for="item in Machines"
:key="item.value"
@@ -19,7 +19,7 @@
:value="item.value"/>
</el-select>
<span>组号:</span>
<el-select v-model="Group" size="small" clearable placeholder="组号">
<el-select v-model="Group" size="small" clearable placeholder="组号" style="width: 180px;">
<el-option
v-for="item in Groups"
:key="item.value"
@@ -28,16 +28,15 @@
</el-select>
</el-row>
<el-row>
<span>是否外协:</span>
<el-select v-model="part" size="small" placeholder="是否外协">
<el-select v-show="false" v-model="part" size="small" placeholder="是否外协">
<el-option
v-for="item in parts"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>零件号:</span>
<el-input v-model="number" placeholder="零件号" clearable size="small" style="width: 200px;"/>
<span>零件:</span>
<el-input v-model="number" placeholder="零件号" clearable size="small" style="width: 180px;"/>
<el-button type="success" class="el-icon-search" size="small" style="margin: 10px 0 0 10px" @click="getTableData();pageCurrent=1;pageSize=10;total = 0">查询</el-button>
<span>进度颜色</span>
<span style="background-color: red">拖期</span>
@@ -514,7 +513,23 @@ export default {
}
</script>
<style>
<style scoped>
.el-form-item{
margin-bottom: 22px;
}
.el-card{
margin-bottom: 15px;
}
span{
margin: 10px 0 10px 10px;
}
.table h4{
border: 1px solid transparent;
margin: 0;
font-weight: normal;
width: 100px;
height: 24px;
}
.white{
background-color: ghostwhite;
border: 1px solid #1f2d3d;
@@ -544,21 +559,3 @@ export default {
border: 1px solid #1f2d3d;
}
</style>
<style scoped>
.el-form-item{
margin-bottom: 22px;
}
.el-card{
margin-bottom: 15px;
}
span{
margin: 10px 0 10px 10px;
}
.table h4{
border: 1px solid transparent;
margin: 0;
font-weight: normal;
width: 100px;
height: 24px;
}
</style>

View File

@@ -683,7 +683,23 @@ export default {
}
</script>
<style>
<style scoped>
.el-form-item{
margin-bottom: 22px;
}
.el-card{
margin-bottom: 15px;
}
span{
margin: 10px 0 10px 10px;
}
.table h4{
border: 1px solid transparent;
margin: 0;
font-weight: normal;
width: 100px;
height: 24px;
}
.white{
background-color: ghostwhite;
border: 1px solid #1f2d3d;
@@ -708,26 +724,8 @@ export default {
background-color: transparent;
border: 0px solid white;
}
.lightgreen{
.green{
background-color: lightgreen;
border: 1px solid #1f2d3d;
}
</style>
<style scoped>
.el-form-item{
margin-bottom: 22px;
}
.el-card{
margin-bottom: 15px;
}
span{
margin: 10px 0 10px 10px;
}
.table h4{
border: 1px solid transparent;
margin: 0;
font-weight: normal;
width: 100px;
height: 24px;
}
</style>