This commit is contained in:
liushuai
2020-02-27 08:35:46 +08:00
parent 7e81b57ab4
commit b740e50051
14 changed files with 568 additions and 458 deletions

View File

@@ -11,9 +11,20 @@
<el-tooltip :open-delay="1200" effect="dark" content="将零件打回重新分配备料计划" placement="top">
<el-button type="danger" size="small" icon="el-icon-download" plain style="margin-left: 10px;float: right;" @click="back">打回重新分配</el-button>
</el-tooltip>
<el-table v-loading="loading1" :data="tableData1" :header-cell-style="{fontFamily:'YouYuan',fontSize:'14px',fontWeight:200}" border stripe highlight-current-row style="width:795px ;margin-top:3px;" height="690" size="mini" @selection-change="handleSelectionChange">
<el-table
v-loading="loading1"
:data="tableData1"
:header-cell-style="{fontFamily:'YouYuan',fontSize:'14px',fontWeight:200}"
border
stripe
highlight-current-row
style="width:795px ;margin-top:3px;"
height="690"
size="mini"
@sort-change="sortChange"
@selection-change="handleSelectionChange">
<el-table-column type="selection" align="center" width="45"/>
<el-table-column label="机床图号" prop="机床图号" width="120" align="center">
<el-table-column label="机床图号" prop="机床图号" width="120" sortable="custom" align="center">
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
@@ -28,7 +39,7 @@
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column label="零件名称" prop="零件名称" width="140" align="center" show-overflow-tooltip>
<el-table-column label="零件名称" prop="零件名称" width="140" sortable="custom" align="center" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
@@ -38,7 +49,7 @@
{{ scope.row.批次数量 }}
</template>
</el-table-column>
<el-table-column label="材料" prop="材料" width="150" align="center" show-overflow-tooltip>
<el-table-column label="材料" prop="材料" width="150" sortable="custom" align="center" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.材料 }}
</template>
@@ -83,7 +94,7 @@
<!--<el-button type="success" size="small" icon="el-icon-search" style="margin-left: 10px" @click="pageCurrent2=1;pageSize2=10;total2=0;searchTable2()">查询</el-button>-->
<!--</el-tooltip>-->
<el-button type="primary" size="small" icon="el-icon-search" plain style="margin-left: 10px" @click="searchTable2">查询</el-button>
<el-button class="button111" size="small" icon="el-icon-circle-plus-outline" style="margin-left: 10px" @click="addPurchaseOrder">新增</el-button>
<el-button class="button111" size="small" icon="el-icon-circle-plus-outline" style="margin-left: 10px" @click="addPurchaseOrder">外购备料</el-button>
<el-tooltip :open-delay="1200" effect="dark" content="向选择的采购计划里添加采购零件" placement="top">
<el-button type="primary" plain size="small" icon="el-icon-download" style="margin-left: 10px" @click="addMateriel">选入</el-button>
</el-tooltip>
@@ -395,6 +406,8 @@ export default {
pageCurrent: 1,
pageSize: 10,
total: null,
partName: '',
order: '',
partDrawingNumber: '',
Buyer: '',
loading1: false,
@@ -482,10 +495,42 @@ export default {
},
created() {
this.searchRawMaterial()
this.getCurrentTime()
this.searchTable2()
// this.searchTable1()
// this.searchTable2()
},
methods: {
getCurrentTime() {
this.dateRange = [this.getTime1(70), this.getTime0(0)]
},
getTime0(num) {
var date0 = new Date()
var date = new Date(date0.getTime() + num * 24 * 60 * 60 * 1000)
var month = this.zeroFill(date.getMonth() + 1)
var day = this.zeroFill(date.getDate())
var hour = this.zeroFill(date.getHours())
var minute = this.zeroFill(date.getMinutes())
var second = this.zeroFill(date.getSeconds())
return date.getFullYear() + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second
},
getTime1(num) {
var date0 = new Date()
var date = new Date(date0.getTime() - num * 24 * 60 * 60 * 1000)
var month = this.zeroFill(date.getMonth() + 1)
var day = this.zeroFill(date.getDate())
var hour = this.zeroFill(date.getHours())
var minute = this.zeroFill(date.getMinutes())
var second = this.zeroFill(date.getSeconds())
return date.getFullYear() + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second
},
zeroFill(i) {
if (i >= 0 && i <= 9) {
return '0' + i
} else {
return i
}
},
// 获取原材料
searchRawMaterial() {
searchSupplier(0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '').then(response => {
@@ -562,6 +607,23 @@ export default {
img.src = url
})
},
sortChange(column, prop, order) {
console.log(column + '-' + column.prop + '-' + column.order, 11111)
if (column.prop === '零件名称') {
this.partName = 1
} else if (column.prop === '机床图号') { this.partName = 2 } else if (column.prop === '材料') {
this.partName = 3
} else {
this.partName = ''
}
console.log(this.ordername, 9990999)
if (column.order === 'ascending') {
this.order = 1
} else if (column.order === 'descending') { this.order = 2 } else {
this.order = ''
}
this.searchTable1()
},
fetchData() {
initPartDrawing(0, this.partDrawingNumberValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
@@ -576,7 +638,7 @@ export default {
this.loading1 = true
this.partDrawingNumber ? this.check1 = 1 : this.check1 = 0
// this.pageCurrent1, this.pageSize1,
searchPurchasedMaterials(this.check1, this.partDrawingNumber).then(response => {
searchPurchasedMaterials(this.check1, this.partDrawingNumber, this.order, this.partName).then(response => {
this.tableData1 = response.data
this.total1 = response.data.total
this.loading1 = false
@@ -706,27 +768,15 @@ export default {
}))
},
exportExcel2(row) {
this.searchTable3(row).then(val => {
console.log(row, 11111)
console.log(this.tableData4)
if (this.tableData4.length !== 0) {
import('@/vendor/Export2Excel').then(excel => {
const tHeader = ['备料状态', '物料编码', '零件名称', '材料', '数量', '成品尺寸', '单位', '备注']
const filterVal = ['备料状态', '物料零件编码', '零件名称', '材料', '总数量', '成品尺寸', '单位', '备注1']
const list = this.tableData4
const data = this.formatJson(filterVal, list)
excel.export_json_to_excel({
header: tHeader,
data,
filename: row.采购单名称 + '-' + row.计划完成日期,
autoWidth: true,
bookType: 'xlsx'
})
})
} else {
this.$message.warning('没有导出内容')
}
})
if (this.tableData4.length !== 0) {
var param = []
param[0] = ['采购计划流水号', row.采购计划流水号]
param[1] = ['供应商', row.供应商名称]
var Data = this.CreateData('2001', '报表_备料管理_采购计划明细_查询数据', param)
this.exportExcel_NPOI(Data)
} else {
this.$message.warning('暂无数据')
}
},
searchTable3(row) { // 查询采购计划明细
this.purchasingOrderNumber = row.采购计划流水号