This commit is contained in:
lixin
2018-11-29 14:25:46 +08:00
4 changed files with 79 additions and 44 deletions

View File

@@ -29,7 +29,7 @@
</el-table-column>
<el-table-column label="零件投产数量" align="center">
<template slot-scope="scope">
{{ scope.row.已投产数量 }}
{{ scope.row.批次数量 }}
</template>
</el-table-column>
</el-table>
@@ -588,7 +588,7 @@ export default {
total: 0,
tableData: [],
loading: false,
PrNum: '027W191482-0001',
PrNum: '',
tableData2: [],
tableData3: [],
机床号: '',
@@ -617,6 +617,7 @@ export default {
searchData() {
this.loading = true
search(this.pageCurrent, this.pageSize, this.PrNum).then(response => {
console.log(response.data)
this.tableData = response.data.rows
this.total = response.data.total
this.loading = false

View File

@@ -1224,7 +1224,6 @@ export default {
}
}).then(() => {
this.tableData1.push(this.result[i])
console.log(this.tableData1)
selection2(this.工艺计划流水号[this.indexAdjust]).then(response => { // 刷新对话框显示和颜色
for (let i = 0; i < response.data.length; i++) {
this.partType = response.data[i].零件类型
@@ -1473,7 +1472,6 @@ export default {
}).then(() => {
plan(this.tableData1[i].工艺计划流水号).then(response => {
if (this.tableData1[i].平衡次数 !== 0 || this.tableData1[i].是否焊接 !== 1) {
console.log(this.tableData1[i].平衡次数, 111)
this.result1 += parseInt(response.data[0].result)
if (this.result1 === this.length) {
this.$message.success('零件计划制定成功')

View File

@@ -0,0 +1,19 @@
// 导出Excel方法表格id不加扩展名的文件名sheet名
export function exportExcelMethod(tableId, fileName, sheetName) {
tableToExcel(tableId, fileName, sheetName)
}
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;width:100px;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

@@ -46,6 +46,11 @@
icon="el-icon-search"
style="margin-left:10px"
@click="total1=0;pageCurrent1=1;pageSize1=10;searchTable1()">查询</el-button>
<el-button
type="warning"
size="small"
icon="el-icon-download"
@click="download()">导出</el-button>
</el-card>
<el-card>
@@ -126,49 +131,52 @@
</div>
<div style="width:900px;margin: 0 auto">
<el-card>
<table id="1" cellspacing="0px" align="center" border width="100%" style="">
<tr style="height: 40px">
<td colspan="1" align="center" style="font-weight: bold">GAOJING</td>
<td colspan="3" align="center" style="font-weight: bold">产品销售合同</td>
</tr>
<tr style="height: 40px">
<td colspan="1" align="center">需方</td>
<td colspan="1" align="center">江苏高精机电装备有限公司</td>
<td colspan="1" align="center">合同编号</td>
<td colspan="1" align="center">{{ contract }}</td>
</tr>
<tr style="height: 40px">
<td colspan="1" align="center">供方</td>
<td colspan="1" align="center">{{ supplier }}</td>
<td colspan="1" align="center">签订地点</td>
<td colspan="1" align="center">江苏盐城</td>
</tr>
</table>
<div> 产品名称型号数量单价品牌</div>
<table id="2" cellspacing="0px" align="center" border width="100%" style="">
<tbody id="4">
<tr id="tableHead" style="height: 40px">
<td colspan="1" align="center">物料名称</td>
<td colspan="1" align="center">物料规格</td>
<td colspan="1" align="center">物料型号</td>
<td colspan="1" align="center">发货天数</td>
<td colspan="1" align="center">数量</td>
<td colspan="1" align="center">单价</td>
<td colspan="1" align="center">总价</td>
</tr>
</tbody>
<tfoot>
<div id="print" style="width:860px;">
<table id="1" cellspacing="0px" align="center" border width="100%">
<tr style="height: 40px">
<td colspan="6">运费</td>
<td colspan="1" align="center">{{ freight }}</td>
<td colspan="1" align="center" style="font-weight: bold">GAOJING</td>
<td colspan="4" align="center" style="font-weight: bold">产品销售合同</td>
<td colspan="2" rowspan="3" align="center" style="width: 100px"/>
</tr>
<tr style="height: 40px">
<td colspan="6">总价: (人民币){{ RMB }}(含0.17增值税) </td>
<td colspan="1" align="center">{{ TotalAmount }}</td>
<td colspan="1" align="center">需方</td>
<td colspan="2" align="center">江苏高精机电装备有限公司</td>
<td colspan="1" align="center">合同编号</td>
<td colspan="1" align="center">{{ contract }}</td>
</tr>
</tfoot>
</table>
<div id="23"/>
<tr style="height: 40px">
<td colspan="1" align="center">供方</td>
<td colspan="2" align="center">{{ supplier }}</td>
<td colspan="1" align="center">签订地点</td>
<td colspan="1" align="center">江苏盐城</td>
</tr>
</table>
<div> 产品名称型号数量单价品牌</div>
<table id="2" cellspacing="0px" align="center" border width="100%" style="">
<tbody id="4">
<tr id="tableHead" style="height: 40px">
<td colspan="1" align="center">物料名称</td>
<td colspan="1" align="center">物料规格</td>
<td colspan="1" align="center">物料型号</td>
<td colspan="1" align="center">发货天数</td>
<td colspan="1" align="center">数量</td>
<td colspan="1" align="center">单价</td>
<td colspan="1" align="center">总价</td>
</tr>
</tbody>
<tfoot>
<tr style="height: 40px">
<td colspan="6">运费</td>
<td colspan="1" align="center">{{ freight }}</td>
</tr>
<tr style="height: 40px">
<td colspan="6">总价: (人民币){{ RMB }}(含0.17增值税) </td>
<td colspan="1" align="center">{{ TotalAmount }}</td>
</tr>
</tfoot>
</table>
<div id="23"/>
</div>
</el-card>
</div>
@@ -184,6 +192,7 @@
import { initContract, initBuyer, searchTable1, searchTable2 } from '@/api/PurchasingCenter/PurchaseContractSearch'
import { searchFile } from '@/api/PurchasingCenter/CreateContract'
import QRCode from 'qrcode'
import { exportExcelMethod } from './exportExcel'
export default {
data() {
@@ -238,6 +247,13 @@ export default {
this.fetchData()
},
methods: {
download() {
if (this.contract) {
exportExcelMethod('print', '采购合同', '采购合同sheet1')
} else {
this.$message.error('请选择合同')
}
},
useqrcode(contractNum) {
const opts = {
errorCorrectionLevel: 'H',
@@ -247,7 +263,8 @@ export default {
}
}
// const str = 'http://192.168.1.111:8022/searchContract.html?contractNum=' + contractNum
const str = 'http://192.168.1.111:8080/#/ContractInquiry/index?id=' + contractNum
// const str = 'http://192.168.1.111:8080/#/ContractInquiry/index?id=' + contractNum
const str = contractNum
QRCode.toDataURL(str, opts, function(err, url) {
if (err) throw err
const img = document.getElementById('img')