This commit is contained in:
zhangdingyu
2019-05-30 15:42:19 +08:00
parent a799b12ecb
commit feb2529e7e
8 changed files with 1876 additions and 134 deletions

View File

@@ -1,75 +1,69 @@
<template>
<div class="app-container">
<el-card>
<div slot="header">
<span>零件图号:</span>
<el-select v-model="partDrawingNumberValue" placeholder="零件图号" size="small" clearable>
<el-option
v-for="item in partDrawingNumber"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-button
type="success"
size="small"
icon="el-icon-search"
style="margin-left: 10px"
@click="pageCurrent1=1;pageSize1=10;total1=0;searchTable1()">查询</el-button>
</div>
<div v-show="showMaterialTable">
<el-table
v-loading="loading1"
:data="tableData1"
border
style="width: 100%;max-height: 460px;"
height="330"
size="mini"
@selection-change="handleSelectionChange">
<el-col :span="9">
<span>原材料名称:</span>
<el-input v-model="RawMaterialName" placeholder="原材料名称" size="mini" clearable style="width: 120px"/>
<el-button type="success" icon="el-icon-search" size="mini" style="margin-left: 10px" @click="pageCurrent=1;searchRawMaterial()">查询</el-button>
<el-button type="primary" size="small" icon="el-icon-download" style="margin-left: 10px" @click="addMateriel2">选入原材料</el-button>
<el-table :data="tableData" border style="width: 100%;height: 460px;margin-top: 15px;" height="330" size="mini" @selection-change="handleSelectionChange2">
<el-table-column type="selection" align="center" width="55"/>
<el-table-column label="零件图号" min-width="150" align="center">
<el-table-column label="原材料名称" min-width="100" align="center">
<template slot-scope="scope">
{{ scope.row.原材料名称 }}
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;margin-bottom: 10px;">
<el-pagination
:current-page="pageCurrent"
:page-size="pageSize"
:total="total"
style="display:inline-block;width:50%"
layout="total, prev, pager, next"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/>
</div>
</el-col>
<el-col :span="14" style="margin-left: 20px">
<span>零件图号:</span>
<el-input v-model="partDrawingNumber" placeholder="零件图号" size="mini" clearable style="width: 120px"/>
<el-button type="success" size="mini" icon="el-icon-search" style="margin-left: 10px" @click="pageCurrent1=1;pageSize1=10;total1=0;searchTable1()">查询</el-button>
<el-button type="primary" size="small" icon="el-icon-download" style="margin-left: 10px" @click="addMateriel">选入物料</el-button>
<el-table v-loading="loading1" :data="tableData1" border style="width: 100%;height: 460px;margin-top: 15px;" height="330" size="mini" @selection-change="handleSelectionChange">
<el-table-column type="selection" align="center" width="55"/>
<el-table-column label="零件图号" min-width="100" align="center">
<template slot-scope="scope">
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column label="零件名称" min-width="150" align="center">
<el-table-column label="零件名称" min-width="100" align="center">
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
</el-table-column>
<el-table-column label="数量" min-width="150" align="center">
<el-table-column label="数量" width="80" align="center">
<template slot-scope="scope">
{{ scope.row.批次数量 }}
</template>
</el-table-column>
<el-table-column label="材料" min-width="150" align="center">
<el-table-column label="材料" width="80" align="center">
<template slot-scope="scope">
{{ scope.row.材料 }}
</template>
</el-table-column>
<el-table-column label="规格" min-width="90" align="center">
<template slot-scope="scope">
{{ scope.row.原材料规格 }}
</template>
</el-table-column>
<el-table-column label="重量" min-width="90" align="center">
<template slot-scope="scope">
{{ scope.row.重量 }}
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<div class="block" style="margin-top: 10px;margin-bottom: 10px;">
<el-pagination
:current-page="pageCurrent1"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize1"
:total="total1"
style="display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
layout="total, prev, pager, next"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/>
</div>
</div>
</el-col>
</el-card>
<el-card>
@@ -78,30 +72,9 @@
<el-input v-model="purchasingOrder" placeholder="采购单号" size="small" clearable/>
<span>供应商:</span>
<el-input v-model="supplierName0" placeholder="供应商" size="small" clearable/>
<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-button
type="primary"
size="small"
icon="el-icon-plus"
style="margin-left: 10px"
@click="addPurchaseOrder">创建采购单</el-button>
<el-button
type="primary"
size="small"
icon="el-icon-download"
style="margin-left: 10px"
@click="addMateriel">选入物料</el-button>
<el-button
type="primary"
size="small"
icon="el-icon-download"
style="margin-left: 10px"
@click="saveMateriel">保存</el-button>
<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-button type="primary" size="small" icon="el-icon-plus" style="margin-left: 10px" @click="addPurchaseOrder">创建采购单</el-button>
<el-button type="primary" size="small" icon="el-icon-download" style="margin-left: 10px" @click="saveMateriel">保存</el-button>
</div>
<el-table v-loading="" :data="tableData2" border style="max-height: 460px;" height="230px" size="mini" highlight-current-row @row-click="searchTable3">
<el-table-column label="单号状态" align="center" width="100" fixed="left">
@@ -161,9 +134,14 @@
@current-change="handleCurrentChange2"/>
</div>
<el-table v-loading="" :data="tableData3" border style="max-height: 300px;" height="300px" size="mini">
<el-table-column label="零件图号" align="center" min-width="150">
<el-table-column label="物料编码" align="center" min-width="150">
<template slot-scope="scope">
{{ scope.row.零件图号 }}
{{ scope.row.物料零件编码 }}
</template>
</el-table-column>
<el-table-column label="原材料名称" align="center" min-width="150">
<template slot-scope="scope">
{{ scope.row.原材料名称 }}
</template>
</el-table-column>
<el-table-column label="零件名称" align="center" min-width="150">
@@ -176,11 +154,6 @@
{{ scope.row.材料 }}
</template>
</el-table-column>
<el-table-column label="单位" align="center" min-width="100">
<template slot-scope="scope">
<el-input v-model="scope.row.单位" :disabled="disable" size="mini" style="width:70px"/>
</template>
</el-table-column>
<el-table-column label="数量" align="center" min-width="100">
<template slot-scope="scope">
{{ scope.row.批次数量 }}
@@ -414,8 +387,9 @@
</div>
</template>
<script>import { initPartDrawing, searchPurchasedMaterials, searchPurchaseOrder, searchSupplier, addPurchaseOrder, editPurchaseOrder, deletePurchaseOrder, searchMateriel,
addMateriel, deleteMateriel, saveMateriel } from '@/api/WorkshopProcurement/CreatingPurchasingMaterials'
<script>
import { initPartDrawing, searchPurchasedMaterials, searchPurchaseOrder, searchSupplier, addPurchaseOrder, editPurchaseOrder, deletePurchaseOrder, searchMateriel,
addMateriel, deleteMateriel, saveMateriel, searchRawMaterial, addMateriel2 } from '@/api/WorkshopProcurement/CreatingPurchasingMaterials'
import QRCode from 'qrcode'
import $ from 'jquery'
import { mapGetters } from 'vuex'
@@ -423,10 +397,14 @@ export default {
name: '', // 采购计划
data() {
return {
partDrawingNumberValue: '',
partDrawingNumber: [],
RawMaterialGroup: [],
RawMaterialName: '',
tableData: [],
pageCurrent: 1,
pageSize: 10,
total: null,
partDrawingNumber: '',
Buyer: '',
showMaterialTable: true,
loading1: false,
title2: '',
check1: 0,
@@ -509,11 +487,43 @@ export default {
])
},
created() {
this.fetchData()
this.searchRawMaterial()
this.searchTable1()
this.searchTable2()
},
methods: {
// 获取原材料
searchRawMaterial() {
searchRawMaterial(this.RawMaterialName, this.pageCurrent, this.pageSize).then(response => {
this.tableData = response.data.rows
this.total = parseInt(response.data.total)
})
},
addMateriel2() { // 将材料选入请购单
if (!this.purchasingOrderNumber) {
this.$message.warning('请选择采购单')
} else if (this.RawMaterialGroup.length === 0) {
this.$message.warning('请勾选原材料')
} else {
addMateriel2(this.purchasingOrderNumber, this.RawMaterialGroup).then(response => {
if (response.data[0].result === '1') {
this.$message.success('选入成功')
this.searchTable1()
this.searchRawMaterial()
searchMateriel(this.purchasingOrderNumber).then(response => {
this.tableData3 = response.data
})
} else { this.$message.error('选入失败') }
})
}
},
handleSelectionChange2(val) {
this.RawMaterialGroup = []
for (let i = 0; i < val.length; i++) {
this.RawMaterialGroup.push(val[i].原材料流水号)
}
},
// ///////////////////////////////////////////////////////////////////////////////////////0529新加↑
useqrcode(contractNum) {
const opts = {
errorCorrectionLevel: 'H',
@@ -540,8 +550,8 @@ export default {
},
searchTable1() { // 查询外购备料
this.loading1 = true
this.partDrawingNumberValue ? this.check1 = 1 : this.check1 = 0
searchPurchasedMaterials(this.pageCurrent1, this.pageSize1, this.check1, this.partDrawingNumberValue).then(response => {
this.partDrawingNumber ? this.check1 = 1 : this.check1 = 0
searchPurchasedMaterials(this.pageCurrent1, this.pageSize1, this.check1, this.partDrawingNumber).then(response => {
this.tableData1 = response.data.rows
this.total1 = response.data.total
this.loading1 = false
@@ -600,7 +610,6 @@ export default {
} else { this.$message.error('新建采购单失败') }
})
} else {
console.log('error submit!!')
return false
}
})
@@ -620,7 +629,6 @@ export default {
submitEditPurchaseOrder() {
this.$refs['form2'].validate((valid) => {
if (valid) {
console.log(this.form2.采购计划流水号, this.form2.采购单名称, this.form2.供应商流水号, this.form2.计划完成日期)
editPurchaseOrder(this.form2.采购计划流水号, this.form2.采购单名称, this.form2.供应商流水号, this.form2.计划完成日期).then(response => {
if (response.data[0].result === '1') {
this.$message.success('修改采购单成功')
@@ -629,7 +637,6 @@ export default {
} else { this.$message.error('修改采购单失败') }
})
} else {
console.log('error submit!!')
return false
}
})
@@ -717,7 +724,6 @@ export default {
this.计划完成日期 = row.计划完成日期.split(' ')[0]
this.下单日期 = row.下单日期.split(' ')[0]
searchMateriel(this.purchasingOrderNumber).then(response => {
console.log(response.data)
this.tableData3 = response.data
})
},
@@ -773,7 +779,6 @@ export default {
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
console.log(row)
deleteMateriel(row.采购计划明细流水号, row.工艺计划流水号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('移除成功')
@@ -807,7 +812,6 @@ export default {
body.children().not('#app').hide()
printNode.remove()
}).catch(res => {
console.log(res)
this.$message({
type: 'info',
message: '已取消操作'