询价单改数量

This commit is contained in:
chenjianan
2019-03-05 20:20:30 +08:00
parent 33901a68c5
commit 7a6dd84251
3 changed files with 87 additions and 39 deletions

View File

@@ -171,3 +171,15 @@ export function editInquirySheet(num1, num2, num3) {
} }
}) })
} }
// 编辑询价单
export function saveOrder(num1, num2, num3) {
return request({
url: '',
method: 'post',
data: {
type: '2',
name: '采购管理_询价单明细_保存数据',
param: `询价单明细流水号组=${num1}&数量组=${num2}&备注组=${num3}`
}
})
}

View File

@@ -26,8 +26,8 @@
:data="tableData11" :data="tableData11"
:row-class-name="tableRowClassName" :row-class-name="tableRowClassName"
border border
style="width: 100%;max-height: 300px;" style="width: 100%;max-height: 600px;"
height="300px" height="600px"
size="mini" size="mini"
@selection-change="handleSelectionChange1"> @selection-change="handleSelectionChange1">
<el-table-column :selectable="selectable" align="center" width="35" type="selection"/> <el-table-column :selectable="selectable" align="center" width="35" type="selection"/>
@@ -130,8 +130,8 @@
:data="tableData12" :data="tableData12"
:row-class-name="tableRowClassName" :row-class-name="tableRowClassName"
border border
style="width: 100%;max-height: 300px;" style="width: 100%;max-height: 600px;"
height="300px" height="600px"
size="mini" size="mini"
@selection-change="handleSelectionChange2"> @selection-change="handleSelectionChange2">
<el-table-column :selectable="selectable" align="center" width="35" type="selection"/> <el-table-column :selectable="selectable" align="center" width="35" type="selection"/>
@@ -260,11 +260,10 @@
{{ scope.row.电子信箱 }} {{ scope.row.电子信箱 }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" width="300"> <el-table-column label="操作" align="center" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="primary" size="mini" icon="el-icon-edit" @click="editInquirySheet(scope.row)">编辑</el-button> <el-button type="primary" size="mini" icon="el-icon-edit" @click="editInquirySheet(scope.row)">编辑</el-button>
<el-button type="danger" size="mini" icon="el-icon-delete" @click="deleteInquirySheet(scope.row)">删除</el-button> <el-button type="danger" size="mini" icon="el-icon-delete" @click="deleteInquirySheet(scope.row)">删除</el-button>
<el-button type="warning" size="mini" icon="el-icon-download" @click="exportInquirySheet(scope.row)">导出</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -278,8 +277,10 @@
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange2" @size-change="handleSizeChange2"
@current-change="handleCurrentChange2"/> @current-change="handleCurrentChange2"/>
<el-button type="warning" size="mini" style="margin-left:10px;float: right" @click="exportInquirySheet()">导出</el-button>
<el-button type="success" size="mini" style="float: right" @click="saveOrder()">保存</el-button>
</div> </div>
<el-table v-loading="" :data="tableData3" border style="max-height: 300px;" height="300px" size="mini"> <el-table v-loading="" :data="tableData3" border style="max-height: 500px;" height="500px" size="mini">
<el-table-column label="图号" align="center" min-width="200"> <el-table-column label="图号" align="center" min-width="200">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.组件零件流水号 ? scope.row.物料型号 : scope.row.零件图号 }} {{ scope.row.组件零件流水号 ? scope.row.物料型号 : scope.row.零件图号 }}
@@ -295,9 +296,19 @@
{{ scope.row.组件零件流水号 ? scope.row.物料规格 : scope.row.规格 }} {{ scope.row.组件零件流水号 ? scope.row.物料规格 : scope.row.规格 }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="数量" align="center" min-width="90"> <el-table-column label="技术下达数量" align="center" min-width="90">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.数量 }} {{ scope.row.技术下达数量 }}
</template>
</el-table-column>
<el-table-column label="实际采购数量" align="center" min-width="90">
<template slot-scope="scope">
<el-input v-model="scope.row.数量" size="mini" style="width:60px"/>
</template>
</el-table-column>
<el-table-column label="询价备注" align="center" min-width="120">
<template slot-scope="scope">
<el-input v-model="scope.row.备注" size="mini" style="width:100%"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="询价单编号" align="center" min-width="150"> <el-table-column label="询价单编号" align="center" min-width="150">
@@ -523,7 +534,7 @@
<script> <script>
import { searchMaterial, searchPart, searchSupplier, searchCreateInquirySheet, searchCreateInquirySheet2, searchSheetDetail, editInquirySheet, import { searchMaterial, searchPart, searchSupplier, searchCreateInquirySheet, searchCreateInquirySheet2, searchSheetDetail, editInquirySheet,
createInquirySheet, deleteInquirySheet, addInquirySheet1, addInquirySheet2, outInquirySheet, searchAllMaterial, materialChange } from '@/api/PurchasingCenter/CreateInquirySheet' createInquirySheet, deleteInquirySheet, addInquirySheet1, addInquirySheet2, outInquirySheet, searchAllMaterial, materialChange, saveOrder } from '@/api/PurchasingCenter/CreateInquirySheet'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { exportExcelMethod } from './exportExcel' import { exportExcelMethod } from './exportExcel'
@@ -613,7 +624,9 @@ export default {
materialNewValue: '', materialNewValue: '',
groupPartNumValue: '', // 组件零件流水号 groupPartNumValue: '', // 组件零件流水号
standardAndPurchaseValue: '', // 标准件和外购件流水号 standardAndPurchaseValue: '', // 标准件和外购件流水号
title2: '' title2: '',
orderExport: '',
supplierExport: ''
} }
}, },
computed: { computed: {
@@ -629,6 +642,21 @@ export default {
this.searchTable2() // 查表2 this.searchTable2() // 查表2
}, },
methods: { methods: {
saveOrder() { // 保存询价单
const orderNumGroup = []
const numGroup = []
const remarkGroup = []
for (let i = 0; i < this.tableData3.length; i++) {
orderNumGroup.push(this.tableData3[i].询价单明细流水号)
numGroup.push(this.tableData3[i].数量)
remarkGroup.push(this.tableData3[i].备注)
}
saveOrder(orderNumGroup, numGroup, remarkGroup).then(response => {
if (response.data[0].result === '1') {
this.$message.success('保存成功')
} else { this.$message.error('保存失败') }
})
},
selectable(row, index) { // 控制某行是否可选 selectable(row, index) { // 控制某行是否可选
return (parseInt(row.询价状态编号) === 1 && parseInt(row.采购状态编号) === 1 && parseInt(row.是否确认) === 1) // 未询价&&未采购&&确认物料修改 return (parseInt(row.询价状态编号) === 1 && parseInt(row.采购状态编号) === 1 && parseInt(row.是否确认) === 1) // 未询价&&未采购&&确认物料修改
}, },
@@ -791,38 +819,43 @@ export default {
} }
}) })
}, },
exportInquirySheet(row) { // 导出询价单 exportInquirySheet() { // 导出询价单
this.$confirm('确认导出询价单' + row.询价单编号 + '?', '提示', { this.$confirm('确认导出询价单?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
const children = document.getElementsByClassName('tableData') if (this.tableData3.length === 0 && !this.supplierExport) {
const parent = document.getElementsByClassName('inquirySheet')[0] this.$message.error('请选择正确的询价单导出')
if (children.length !== 0) { } else {
for (let i = children.length - 1; i >= 0; i--) { const children = document.getElementsByClassName('tableData')
parent.removeChild(children[i]) const parent = document.getElementsByClassName('inquirySheet')[0]
if (children.length !== 0) {
for (let i = children.length - 1; i >= 0; i--) {
parent.removeChild(children[i])
}
} }
const tr = []
let length = 0
this.tableData3.length < 15 ? length = 15 : length = this.tableData3.length
for (let i = 0; i < length; i++) {
tr[i] = document.createElement('tr')
tr[i].setAttribute('class', 'tableData')
tr[i].innerHTML = `<td width="8.3%" height="30px"/><td height="30px" width="16.6%" colspan="2"/><td height="30px" width="16.6%" colspan="2"/><td height="30px" width="16.6%" colspan="2"/><td height="30px" width="16.6%" colspan="2"/><td height="30px" width="16.6%" colspan="2"/><td height="30px" colspan="3"/>`
document.getElementById('tablehead').after(tr[i])
}
for (let j = 0; j < this.tableData3.length; j++) {
document.getElementsByClassName('tableData')[j].children[0].innerHTML = j + 1
document.getElementsByClassName('tableData')[j].children[1].innerHTML = this.tableData3[j].物料型号 || this.tableData3[j].零件图号
document.getElementsByClassName('tableData')[j].children[2].innerHTML = this.tableData3[j].物料名称 || this.tableData3[j].零件名称
document.getElementsByClassName('tableData')[j].children[3].innerHTML = this.tableData3[j].物料规格 || this.tableData3[j].规格
document.getElementsByClassName('tableData')[j].children[4].innerHTML = this.tableData3[j].数量
document.getElementsByClassName('tableData')[j].children[6].innerHTML = this.tableData3[j].备注
}
document.getElementById('inquirySheetNum').innerHTML = this.orderExport
document.getElementById('supplier').innerHTML = this.supplierExport
exportExcelMethod('inquirySheet', '采购询价单', '采购询价单sheet')
} }
const tr = []
let length = 0
this.tableData3.length < 15 ? length = 15 : length = this.tableData3.length
for (let i = 0; i < length; i++) {
tr[i] = document.createElement('tr')
tr[i].setAttribute('class', 'tableData')
tr[i].innerHTML = `<td width="8.3%" height="30px"/><td height="30px" width="16.6%" colspan="2"/><td height="30px" width="16.6%" colspan="2"/><td height="30px" width="16.6%" colspan="2"/><td height="30px" width="16.6%" colspan="2"/><td height="30px" width="16.6%" colspan="2"/><td height="30px" colspan="3"/>`
document.getElementById('tablehead').after(tr[i])
}
for (let j = 0; j < this.tableData3.length; j++) {
document.getElementsByClassName('tableData')[j].children[0].innerHTML = j + 1
document.getElementsByClassName('tableData')[j].children[1].innerHTML = this.tableData3[j].物料型号 || this.tableData3[j].零件图号
document.getElementsByClassName('tableData')[j].children[2].innerHTML = this.tableData3[j].物料名称 || this.tableData3[j].零件名称
document.getElementsByClassName('tableData')[j].children[3].innerHTML = this.tableData3[j].物料规格 || this.tableData3[j].规格
document.getElementsByClassName('tableData')[j].children[4].innerHTML = this.tableData3[j].数量
}
document.getElementById('inquirySheetNum').innerHTML = row.询价单编号
document.getElementById('supplier').innerHTML = row.供应商名称
exportExcelMethod('inquirySheet', '采购询价单', '采购询价单sheet')
}).catch(res => { }).catch(res => {
console.log(res) console.log(res)
this.$message({ this.$message({
@@ -981,7 +1014,10 @@ export default {
searchTable3(row) { // 查询该询价单中的物料和零件 searchTable3(row) { // 查询该询价单中的物料和零件
this.tableData3 = [] this.tableData3 = []
this.inquirySheetFlowNum = row.询价单流水号 this.inquirySheetFlowNum = row.询价单流水号
this.supplierExport = row.供应商名称
this.orderExport = row.询价单编号
searchSheetDetail(row.询价单流水号).then(response => { searchSheetDetail(row.询价单流水号).then(response => {
console.log(response.data)
this.tableData3 = response.data this.tableData3 = response.data
}) })
}, },

View File

@@ -79,7 +79,7 @@
:data="tableData1" :data="tableData1"
size="mini" size="mini"
style="max-height: 600px" style="max-height: 600px"
height="400px" height="600px"
border border
stripe stripe
@selection-change="handleSelectionChange1"> @selection-change="handleSelectionChange1">
@@ -213,7 +213,7 @@
:data="tableData2" :data="tableData2"
size="mini" size="mini"
style="max-height: 600px" style="max-height: 600px"
height="400px" height="600px"
border border
stripe stripe
@selection-change="handleSelectionChange2"> @selection-change="handleSelectionChange2">