This commit is contained in:
hedekun
2020-02-08 16:38:29 +08:00
38 changed files with 1608 additions and 1435 deletions

View File

@@ -0,0 +1,186 @@
<template>
<div class="app-container">
<el-button
type="success"
size="small"
style="margin-left:10px"
@click="downloadExcel()">导出Excel模板1</el-button>
<el-button
type="success"
size="small"
style="margin-left:10px"
@click="downloadExce2()">导出Excel模板2</el-button>
<el-button
type="success"
size="small"
style="margin-left:10px"
@click="downloadExce3()">导出Excel模板3</el-button>
<el-button
type="success"
size="small"
style="margin-left:10px"
@click="downloadExce4()">导出Excel模板4</el-button>
<el-button
type="success"
size="small"
style="margin-left:10px"
@click="downloadExce5()">导出Excel模板5</el-button>
<el-button
type="success"
size="small"
style="margin-left:10px"
@click="downloadExce6()">导出Excel模板6</el-button>
<el-button
type="success"
size="small"
style="margin-left:10px"
@click="downloadExce7()">导出Excel模板7</el-button>
<el-button
type="success"
size="small"
style="margin-left:10px"
@click="downloadExcel8()">导出Excel模板8</el-button>
</div>
</template>
<script>
import { ExcelDownLoad } from '@/utils/request'
export default {
data() {
return {
}
},
methods: {
// 模板1
downloadExcel() {
var param = []
param[0] = ['发票流水号', 1]
param[1] = ['供应商名称', 2]
// var data = this.CreateData(1, name: 2, param)
var data = this.CreateData(1, 2, param)
console.log(data)
const _ExcelDownLoad = ExcelDownLoad
this.download(`${_ExcelDownLoad}?Fapiao=${data}`)
},
// 模板2
downloadExce2() {
var param = []
param[0] = ['发票流水号', 1]
param[1] = ['供应商名称', 2]
var data = this.CreateData(1, 2, param)
console.log(data)
const _ExcelDownLoad = ExcelDownLoad
this.download(`${_ExcelDownLoad}?Fapiao=${data}`)
},
// 模板3
downloadExce3() {
var param = []
param[0] = ['发票流水号', 1]
param[1] = ['供应商名称', 2]
var data = this.CreateData(1, 2, param)
console.log(data)
const _ExcelDownLoad = ExcelDownLoad
this.download(`${_ExcelDownLoad}?Fapiao=${data}`)
},
// 模板4
downloadExce4() {
var param = []
param[0] = ['发票流水号', 1]
param[1] = ['供应商名称', 2]
var data = this.CreateData(1, 2, param)
console.log(data)
const _ExcelDownLoad = ExcelDownLoad
this.download(`${_ExcelDownLoad}?Fapiao=${data}`)
},
// 模板5
downloadExce5() {
var param = []
param[0] = ['发票流水号', 1]
param[1] = ['供应商名称', 2]
var data = this.CreateData(1, 2, param)
console.log(data)
const _ExcelDownLoad = ExcelDownLoad
this.download(`${_ExcelDownLoad}?Fapiao=${data}`)
},
// 模板6
downloadExce6() {
var param = []
param[0] = ['发票流水号', 1]
param[1] = ['供应商名称', 2]
var data = this.CreateData(1, 2, param)
console.log(data)
const _ExcelDownLoad = ExcelDownLoad
this.download(`${_ExcelDownLoad}?Fapiao=${data}`)
},
// 模板7
downloadExce7() {
var param = []
param[0] = ['发票流水号', 1]
param[1] = ['供应商名称', 2]
var data = this.CreateData(1, 2, param)
console.log(data)
const _ExcelDownLoad = ExcelDownLoad
this.download(`${_ExcelDownLoad}?Fapiao=${data}`)
},
// 模板8
downloadExcel8() {
var param = []
param[0] = ['发票流水号', 1]
param[1] = ['供应商名称', 2]
var data = this.CreateData(1, 2, param)
console.log(data)
const _ExcelDownLoad = ExcelDownLoad
this.download(`${_ExcelDownLoad}?Fapiao=${data}`)
},
/**
* 下载
* @param {String} url 目标文件地址
* @param {String} filename 想要保存的文件名称
*/
download(url) {
this.getBlob(url, function(blob, filename) {
saveAs(blob, filename)
})
},
getBlob(url, cb) {
var xhr = new XMLHttpRequest()
xhr.open('GET', url, true)
xhr.responseType = 'blob'
xhr.onload = function() {
if (xhr.status === 200) {
console.log(xhr, 1111)
const name = xhr.getResponseHeader('content-disposition').split('=')[1]
cb(xhr.response, name)
}
}
xhr.send()
}
}
}
/**
* 保存
* @param {Blob} blob
* @param {String} filename 想要保存的文件名称
*/
function saveAs(blob, filename = '下载文件.xls') {
if (window.navigator.msSaveOrOpenBlob) {
navigator.msSaveBlob(blob, filename)
} else {
var link = document.createElement('a')
var body = document.querySelector('body')
link.href = window.URL.createObjectURL(blob)
link.download = filename
// fix Firefox
link.style.display = 'none'
body.appendChild(link)
link.click()
body.removeChild(link)
window.URL.revokeObjectURL(link.href)
}
}
</script>
<style scoped>
</style>

View File

@@ -58,31 +58,36 @@
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
:current-page="pageCurrent10"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize10"
:total="total10"
style="display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange10"
@current-change="handleCurrentChange10"/>
</div>
<!--<div class="block">-->
<!--<el-pagination-->
<!--:current-page="pageCurrent10"-->
<!--:page-sizes="[10, 20, 30, 40]"-->
<!--:page-size="pageSize10"-->
<!--:total="total10"-->
<!--style="display:inline-block;width:50%"-->
<!--layout="total, sizes, prev, pager, next, jumper"-->
<!--@size-change="handleSizeChange10"-->
<!--@current-change="handleCurrentChange10"/>-->
<!--</div>-->
</el-card>
<el-card style="width: 1137px">
<span>离线备料单号:</span>
<el-input v-model="purchasingOrder" placeholder="离线备料单号" size="small" style="width: 160px" clearable/>
<span style="margin-left: 10px">供应商:</span>
<el-select v-model="supplierName" placeholder="供应商" size="small" style="width: 150px" filterable clearable>
<el-select v-model="supplierName" placeholder="供应商" size="small" style="width: 150px" filterable clearable @change="searchTable">
<el-option
v-for="item in supplierNames"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<<<<<<< HEAD
<el-button type="primary" plain size="small" icon="el-icon-search" style="margin-left: 10px" @click="pageCurrent2=1;pageSize2=10;total2=0;searchTable()">查询</el-button>
<el-button class="button111" size="small" icon="el-icon-plus" style="margin-left: 10px" @click="addPurchaseOrder">创建采购计划单</el-button>
=======
<el-button type="success" size="small" icon="el-icon-search" style="margin-left: 10px" @click="searchTable()">查询</el-button>
<el-button type="primary" size="small" icon="el-icon-plus" style="margin-left: 10px" @click="addPurchaseOrder">创建采购计划单</el-button>
>>>>>>> 6d4033c92a46c968832636b84ef2c64c7b192fe4
<!--<el-tooltip :open-delay="1200" effect="dark" content="保存选中的采购计划单" placement="top">-->
<!--<el-button type="baocun" size="small" icon="el-icon-download" style="margin-left: 10px" @click="saveMateriel">保存采购计划单</el-button>-->
<!--</el-tooltip>-->
@@ -137,17 +142,17 @@
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
:current-page="pageCurrent2"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize2"
:total="total2"
style="display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange2"
@current-change="handleCurrentChange2"/>
</div>
<!--<div class="block">-->
<!--<el-pagination-->
<!--:current-page="pageCurrent2"-->
<!--:page-sizes="[10, 20, 30, 40]"-->
<!--:page-size="pageSize2"-->
<!--:total="total2"-->
<!--style="display:inline-block;width:50%"-->
<!--layout="total, sizes, prev, pager, next, jumper"-->
<!--@size-change="handleSizeChange2"-->
<!--@current-change="handleCurrentChange2"/>-->
<!--</div>-->
</el-card>
<el-card style="width: 1137px">
<el-table v-loading="" :data="tableData3" highlight-current-row border style="width: 100%;max-height: 300px;margin-top: 10px" size="mini">
@@ -402,7 +407,7 @@ export default {
})
}
})
this.getTableData()
// this.getTableData()
}
}, // 获取组号
getGroup() {
@@ -415,7 +420,7 @@ export default {
value: response.data[i].组件流水号
})
}
this.Group = response.data[0].组件流水号
// this.Group = response.data[0].组件流水号
})
this.getTableData()
},
@@ -442,6 +447,10 @@ export default {
// 按条件查询
getTableData() {
this.tableData10 = []
if (!this.Machine && !this.Group && !this.number) {
this.$message.error('请输入筛选条件!')
return
}
if (this.Machine === '') {
this.checkbox_Machine = 0
} else {
@@ -457,21 +466,20 @@ export default {
} else {
this.checkbox_number = 1
}
getTable(this.checkbox_Machine, this.Machine, this.checkbox_Group, this.Group, this.checkbox_number, this.number, '', '', this.pageCurrent10, this.pageSize10, this.ordername, this.order).then(response => {
if (response.data.rows.length !== 0) {
for (let i = 0; i < response.data.rows.length; i++) {
getTable(this.checkbox_Machine, this.Machine, this.checkbox_Group, this.Group, this.checkbox_number, this.number, '', '', this.ordername, this.order).then(response => {
if (response.data.length !== 0) {
for (let i = 0; i < response.data.length; i++) {
this.tableData10.push({
工艺计划流水号: response.data.rows[i].工艺计划流水号,
机床图号: response.data.rows[i].机床图号,
组号: response.data.rows[i].组号,
零件图号: response.data.rows[i].零件图号,
零件名称: response.data.rows[i].零件名称,
批次数量: response.data.rows[i].批次数量,
材料: response.data.rows[i].材料
工艺计划流水号: response.data[i].工艺计划流水号,
机床图号: response.data[i].机床图号,
组号: response.data[i].组号,
零件图号: response.data[i].零件图号,
零件名称: response.data[i].零件名称,
批次数量: response.data[i].批次数量,
材料: response.data[i].材料
})
}
}
this.total10 = response.data.total
this.loading = false
})
},
@@ -492,11 +500,16 @@ export default {
}
},
searchTable() {
this.tableData = []
if (!this.purchasingOrder && !this.supplierName) {
this.$message.error('请输入筛选条件!')
return
}
this.purchasingOrder ? this.check3 = 1 : this.check3 = 0
this.supplierName ? this.check4 = 1 : this.check4 = 0
searchPurchaseOrder(this.pageCurrent2, this.pageSize2, this.check3, this.purchasingOrder, this.check4, this.supplierName).then(response => {
this.tableData = response.data.rows
this.total2 = response.data.total
searchPurchaseOrder(this.check3, this.purchasingOrder, this.check4, this.supplierName).then(response => {
this.tableData = response.data
// this.total2 = response.data.total
})
},
handleSizeChange2(val) { // 采购单列表分页

View File

@@ -1,6 +1,6 @@
<template>
<div class="app-container">
<el-card style="width: 72%">
<el-card style="width: 76%">
<div style="margin-top: 7px; margin-bottom: 7px">
<span>供应商</span>
<el-select v-model="supplierNameValue" style="width:200px" placeholder="供应商" size="small" filterable clearable>
@@ -20,11 +20,29 @@
:label="item.label"
:value="item.value"/>
</el-select>
<<<<<<< HEAD
<el-button icon="el-icon-search" type="primary" plain size="small" @click="pageCurrent = 1;pageSize = 100;getTableData()">查询</el-button>
<el-button type="primary" icon="el-icon-download" plain size="small" @click="exportExcel()">导出</el-button>
=======
<span>备料时间段:</span>
<el-date-picker
v-model="dateRange"
:picker-options="pickerOptions"
size="small"
type="daterange"
align="center"
style="width: 300px;margin: 3px 0"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"/>
<el-button icon="el-icon-search" type="success" size="small" @click="pageCurrent = 1;pageSize = 100;getTableData()">查询</el-button>
<el-button type="primary" icon="el-icon-download" size="small" @click="exportExcel()">导出</el-button>
>>>>>>> 6d4033c92a46c968832636b84ef2c64c7b192fe4
</div>
</el-card>
<el-card style="width: 72%">
<el-card style="width: 76%">
<el-table
v-loading="loading"
:data="tableData"
@@ -33,7 +51,8 @@
stripe
size="mini"
style="width: 100%"
height="760">
height="760"
@sort-change="sortChange">
<el-table-column
label="序号"
align="center"
@@ -52,7 +71,11 @@
<el-table-column
label="供应商"
align="center"
min-width="210px">
min-width="210px"
width="300"
prop="供应商名称"
sortable="custom"
show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.供应商名称 }}</template>
</el-table-column>
<el-table-column
@@ -64,12 +87,16 @@
<el-table-column
label="物料名称"
align="center"
prop="零件名称"
sortable="custom"
width="120px">
<template slot-scope="scope">{{ scope.row.零件名称 }}</template>
</el-table-column>
<el-table-column
label="材料"
width="100"
width="90"
prop="材料"
sortable="custom"
align="center">
<template slot-scope="scope">{{ scope.row.材料 }}</template>
</el-table-column>
@@ -78,7 +105,7 @@
{{ scope.row.采购数量 }}
</template>
</el-table-column>
<el-table-column label="备料时间" align="center" width="100">
<el-table-column label="备料时间" align="center" prop="下单日期" sortable="custom" width="100">
<template slot-scope="scope">
{{ scope.row.下单日期 ? scope.row.下单日期.split(' ')[0] : '' }}
</template>
@@ -122,6 +149,37 @@ export default {
name: 'Index',
data() {
return {
ordername: '',
order: '',
dateRange: '',
expands: [],
pickerOptions: {
shortcuts: [{
text: '上季度',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(end.getTime() - 3600 * 1000 * 24 * 30 * 3)
picker.$emit('pick', [start, end])
}
}, {
text: '过去半年',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(end.getTime() - 3600 * 1000 * 24 * 366 / 2)
picker.$emit('pick', [start, end])
}
}, {
text: '过去一年',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(end.getTime() - 3600 * 1000 * 24 * 365)
picker.$emit('pick', [start, end])
}
}]
},
supplierNameValue: '',
supplierNames: [],
partNumber: '',
@@ -145,7 +203,7 @@ export default {
},
created() {
this.fetchData()
this.getTableData()
// this.getTableData()
},
methods: {
formatJson(filterVal, jsonData) {
@@ -154,7 +212,8 @@ export default {
}))
},
exportExcel() {
let check, check1, check2
let check, check1, check2, check3
this.dateRange ? check3 = 1 : (check3 = 0, this.dateRange = '')
this.supplierNameValue ? check = 1 : check = 0
this.partNumber ? check1 = 1 : check1 = 0
if (this.MaterialsValue !== '' && this.MaterialsValue !== null) {
@@ -162,11 +221,11 @@ export default {
} else {
check2 = 0
}
searchTablesheet(check, this.supplierNameValue, check1, this.partNumber, check2, this.MaterialsValue).then(res => {
searchTablesheet(check, this.supplierNameValue, check1, this.partNumber, check2, this.MaterialsValue, check3, this.dateRange[0], this.dateRange[1], this.ordername, this.order).then(res => {
console.log(res.data, 11)
import('@/vendor/Export2Excel').then(excel => {
const tHeader = ['备料状态', '供应商', '物料编码', '物料名称', '材料', '备件数', '备料时间', '到货件数', '到货时间', '结算时间']
const filterVal = ['是否到货', '供应商名称', '物料编码', '零件名称', '材料', '采购数量', '下单日期', '到货数量', '日期', '开票时间']
const tHeader = ['备料状态', '供应商', '物料编码', '物料名称', '材料', '备件数', '备料时间', '到货件数', '到货时间', '结算时间']
const filterVal = ['备料状态', '供应商名称', '物料编码', '零件名称', '材料', '采购数量', '下单日期', '到货数量', '日期', '开票时间']
const list = res.data
const data = this.formatJson(filterVal, list)
excel.export_json_to_excel({
@@ -189,9 +248,31 @@ export default {
}
})
},
// 按供应商名称,下单日期,零件名称,材料
sortChange(column) {
console.log(column + '-' + column.prop + '-' + column.order, 11111)
if (column.prop === '供应商名称') {
this.ordername = 1
} else if (column.prop === '零件名称') {
this.ordername = 2
} else if (column.prop === '材料') {
this.ordername = 3
} else if (column.prop === '下单日期') {
this.ordername = 4
} else {
this.ordername = ''
}
if (column.order === 'ascending') {
this.order = 1
} else if (column.order === 'descending') { this.order = 2 } else {
this.order = ''
}
this.getTableData()
},
getTableData() {
this.loading = true
let check, check1, check2
let check, check1, check2, check3
this.dateRange ? check3 = 1 : (check3 = 0, this.dateRange = '')
this.supplierNameValue ? check = 1 : check = 0
this.partNumber ? check1 = 1 : check1 = 0
if (this.MaterialsValue !== '' && this.MaterialsValue !== null) {
@@ -199,8 +280,8 @@ export default {
} else {
check2 = 0
}
console.log(this.MaterialsValue, check2, 123)
searchTable(check, this.supplierNameValue, check1, this.partNumber, check2, this.MaterialsValue, this.pageSize, this.pageCurrent).then(response => {
searchTable(check, this.supplierNameValue, check1, this.partNumber, check2, this.MaterialsValue, check3, this.dateRange[0], this.dateRange[1], this.ordername, this.order, this.pageSize, this.pageCurrent).then(response => {
console.log(response)
this.tableData = response.data.rows
this.total = response.data.total
this.loading = false

View File

@@ -301,7 +301,7 @@ export default {
this.searchTable1()
},
requestFund() { // 请款
this.searchTable01()
// this.searchTable01()
this.dialogVisible2 = true
this.supplierValue = ''
this.fetchData() // 重新获取供应商
@@ -334,7 +334,7 @@ export default {
} else { this.$message.error('请款失败') }
})
} else {
this.$message.error('请选择需要请款合同')
this.$message.error('请选择供应商及对应请款合同')
}
},
searchTable02(row) { // 查看详情(请款信息包含的合同)