将车间采购分为基本件和外购件两张表
This commit is contained in:
@@ -117,21 +117,12 @@
|
||||
<!--</el-select>-->
|
||||
<!--</el-form-item>-->
|
||||
<!--</el-col>-->
|
||||
<el-col :span="6">
|
||||
<el-form-item label="计划到货时间">
|
||||
<el-date-picker
|
||||
v-model="planArrivalTime"
|
||||
size="small"
|
||||
type="date"
|
||||
format="yyyy-MM-dd"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="选择日期"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="规定到货时间">
|
||||
<el-date-picker
|
||||
v-model="stipulateArrivalTime"
|
||||
:picker-options="endDateOpt"
|
||||
:disabled="Boolean(!contractNumValue)"
|
||||
size="small"
|
||||
type="date"
|
||||
format="yyyy-MM-dd"
|
||||
@@ -140,13 +131,13 @@
|
||||
@change="contractChange"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="采购员">
|
||||
<el-input v-model="name" size="small" readonly/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="运费">
|
||||
<el-input v-model="freight" size="small"/>
|
||||
@@ -162,22 +153,59 @@
|
||||
</el-card>
|
||||
|
||||
<el-card>
|
||||
<el-table v-loading="loading" :data="tableData3" border style="width: 100%;max-height: 400px;" height="400px" size="mini">
|
||||
<el-table-column label="参考价格" align="center" width="100">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.参考价格 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单价" align="center" width="100">
|
||||
<el-table :data="tableData4" border style="width: 100%;max-height: 400px;" height="300px" size="mini">
|
||||
<el-table-column label="单价" align="center" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.单价" size="mini" style="width:70px"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="发货天数" align="center" width="100">
|
||||
<!--<el-table-column label="发货天数" align="center" width="150">-->
|
||||
<!--<template slot-scope="scope">-->
|
||||
<!--<el-input v-model="deliveryDay1[scope.$index]" size="mini" style="width:70px"/>-->
|
||||
<!--</template>-->
|
||||
<!--</el-table-column>-->
|
||||
<el-table-column label="零件名称" align="center" min-width="200">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="deliveryDay[scope.$index]" size="mini" style="width:70px"/>
|
||||
{{ scope.row.物料名称 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="零件图号" align="center" min-width="100">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.零件图号 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="材料" align="center" width="200">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.材料 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="订货数量" align="center" width="100">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.零件数量 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="金额" align="center" width="100">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.金额 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="物料计划到货时间" align="center" width="150">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.物料计划到货时间 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-table :data="tableData3" border style="width: 100%;max-height: 400px;" height="300px" size="mini">
|
||||
<el-table-column label="单价" align="center" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.单价" size="mini" style="width:70px"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!--<el-table-column label="发货天数" align="center" width="150">-->
|
||||
<!--<template slot-scope="scope">-->
|
||||
<!--<el-input v-model="deliveryDay[scope.$index]" size="mini" style="width:70px"/>-->
|
||||
<!--</template>-->
|
||||
<!--</el-table-column>-->
|
||||
<el-table-column label="物料名称" align="center" min-width="200">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.物料名称 }}
|
||||
@@ -377,13 +405,21 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { searchSupplier, initPayMethod, initPayTimeNode, searchSheetContract, doneContract, initPurchaseOrder, searchData, searchContractDemo } from '@/api/WorkshopProcurement/CreatingProcurementContracts'
|
||||
import { searchSupplier, initPayMethod, initPayTimeNode, doneContract, initPurchaseOrder, searchData, searchData1, searchData2, searchContractDemo } from '@/api/WorkshopProcurement/CreatingProcurementContracts'
|
||||
import { mapGetters } from 'vuex'
|
||||
export default {
|
||||
inject: ['reload'],
|
||||
data() {
|
||||
return {
|
||||
submitDisable: true, // 不点击表格中的行不让确定
|
||||
minDate: null,
|
||||
endDateOpt: { // 禁用大于规定到货日期和小于当前日期
|
||||
disabledDate: (time) => {
|
||||
if (this.minDate) {
|
||||
return time.getTime() > this.minDate || time.getTime() < new Date()
|
||||
}
|
||||
}
|
||||
},
|
||||
loading: false,
|
||||
dialogVisible1: false,
|
||||
disable2: true,
|
||||
@@ -398,7 +434,9 @@ export default {
|
||||
textArea: '',
|
||||
paramRow: '', // 参数row
|
||||
contractSum: 0,
|
||||
contractSum1: 0,
|
||||
deliveryDay: [],
|
||||
deliveryDay1: [],
|
||||
contractNumValue: '',
|
||||
RequisitionNumber: '',
|
||||
contractNum: [], // 合同号
|
||||
@@ -463,11 +501,12 @@ export default {
|
||||
freight: '', // 运费
|
||||
taxRate: '', // 税率
|
||||
tableData3: [],
|
||||
tableData4: [],
|
||||
groupNum1: [],
|
||||
groupNum2: [],
|
||||
group1: '',
|
||||
group2: '',
|
||||
group3: '',
|
||||
group4: '',
|
||||
group5: '',
|
||||
group6: '',
|
||||
group7: '',
|
||||
@@ -489,7 +528,14 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
searchData() {
|
||||
const numGroup = [] // 空数组,放物料的计划到货时间
|
||||
searchData(this.contractNumValue).then(response => {
|
||||
for (let i = 0; i < response.data.length; i++) {
|
||||
numGroup.push(Date.parse(response.data[i].物料计划到货时间))
|
||||
}
|
||||
this.minDate = new Date(Math.min(...numGroup))
|
||||
})
|
||||
searchData1(this.contractNumValue).then(response => {
|
||||
for (let j = 0; j < response.data.length; j++) {
|
||||
response.data[j].物料计划到货时间 = (response.data[j].物料计划到货时间).split(' ')[0]
|
||||
}
|
||||
@@ -500,19 +546,40 @@ export default {
|
||||
}
|
||||
}).then(() => {
|
||||
this.groupNum1 = this.tableData3 // 给中间变量,需要时重新push
|
||||
console.log(this.tableData3)
|
||||
})
|
||||
searchData2(this.contractNumValue).then(response => {
|
||||
for (let j = 0; j < response.data.length; j++) {
|
||||
response.data[j].物料计划到货时间 = (response.data[j].物料计划到货时间).split(' ')[0]
|
||||
}
|
||||
this.tableData4 = response.data
|
||||
for (let i = 0; i < response.data.length; i++) {
|
||||
this.deliveryDay1[i] = 0
|
||||
this.tableData4[i].金额 = parseFloat(this.tableData4[i].单价) * parseFloat(this.tableData4[i].零件数量)
|
||||
}
|
||||
}).then(() => {
|
||||
this.groupNum2 = this.tableData4 // 给中间变量,需要时重新push
|
||||
console.log(this.tableData4)
|
||||
})
|
||||
},
|
||||
calculateContractSum() { // 计算合同总额
|
||||
this.contractSum = 0
|
||||
this.contractSum1 = 0
|
||||
this.costAccount = 0
|
||||
this.riseFallPoint = 0
|
||||
this.tableData3 = []
|
||||
this.tableData4 = []
|
||||
for (let i = 0; i < this.groupNum1.length; i++) {
|
||||
this.groupNum1[i].金额 = parseFloat(this.groupNum1[i].单价) * parseFloat(this.groupNum1[i].零件数量)
|
||||
this.contractSum += parseFloat(this.groupNum1[i].金额)
|
||||
this.tableData3.push(this.groupNum1[i])
|
||||
}
|
||||
this.contractSum = this.contractSum.toFixed(2)
|
||||
for (let i = 0; i < this.groupNum2.length; i++) {
|
||||
this.groupNum2[i].金额 = parseFloat(this.groupNum2[i].单价) * parseFloat(this.groupNum2[i].零件数量)
|
||||
this.contractSum1 += parseFloat(this.groupNum2[i].金额)
|
||||
this.tableData4.push(this.groupNum2[i])
|
||||
}
|
||||
this.contractSum = (this.contractSum + this.contractSum1).toFixed(2)
|
||||
this.costAccount = this.contractSum
|
||||
if (parseInt(this.costAccount) === 0) {
|
||||
this.$message.error('成本核算不可为0')
|
||||
@@ -533,16 +600,7 @@ export default {
|
||||
})
|
||||
},
|
||||
contractChange() {
|
||||
searchSheetContract(this.inquirySheetFlowNum).then(response => {
|
||||
for (let i = 0; i < this.deliveryDay.length; i++) {
|
||||
this.stipulateArrivalTime
|
||||
? (this.deliveryDay[i] = parseInt((Date.parse(this.stipulateArrivalTime) - new Date()) / (1000 * 60 * 60 * 24)))
|
||||
: (this.deliveryDay[i] = 0)
|
||||
}
|
||||
this.tableData3 = response.data
|
||||
this.calculateContractSum()
|
||||
this.searchDemo(this.paramRow)
|
||||
})
|
||||
this.searchDemo(this.paramRow)
|
||||
},
|
||||
fetchData() {
|
||||
searchContractDemo().then(response => { // 初始化合同模板
|
||||
@@ -663,7 +721,6 @@ export default {
|
||||
this.group1 = ''
|
||||
this.group2 = ''
|
||||
this.group3 = ''
|
||||
this.group4 = ''
|
||||
this.group5 = ''
|
||||
this.group6 = ''
|
||||
this.group7 = ''
|
||||
@@ -674,11 +731,18 @@ export default {
|
||||
this.group1 += this.tableData3[i].物料流水号 + ','
|
||||
this.group2 += this.tableData3[i].零件数量 + ','
|
||||
this.group3 += this.tableData3[i].单价 + ','
|
||||
this.group4 += this.deliveryDay[i] + ','
|
||||
this.group7 += this.taxRate + ','
|
||||
this.group8 += this.currencyValue + ','
|
||||
this.group9 += this.tableData3[i].请购单明细流水号 + ','
|
||||
}
|
||||
for (let i = 0; i < this.tableData4.length; i++) {
|
||||
this.group1 += this.tableData4[i].物料流水号 + ','
|
||||
this.group2 += this.tableData4[i].零件数量 + ','
|
||||
this.group3 += this.tableData4[i].单价 + ','
|
||||
this.group7 += this.taxRate + ','
|
||||
this.group8 += this.currencyValue + ','
|
||||
this.group9 += this.tableData4[i].请购单明细流水号 + ','
|
||||
}
|
||||
for (let i = 0; i < this.contractNum.length; i++) {
|
||||
if (this.contractNum[i].value === this.contractNumValue) {
|
||||
this.RequisitionNumber = this.contractNum[i].label
|
||||
@@ -721,14 +785,13 @@ export default {
|
||||
this.group1 = this.group1.substr(0, this.group1.length - 1)
|
||||
this.group2 = this.group2.substr(0, this.group2.length - 1)
|
||||
this.group3 = this.group3.substr(0, this.group3.length - 1)
|
||||
this.group4 = this.group4.substr(0, this.group4.length - 1)
|
||||
this.group5 = this.group5.substr(0, this.group5.length - 1)
|
||||
this.group6 = this.group6.substr(0, this.group6.length - 1)
|
||||
this.group7 = this.group7.substr(0, this.group7.length - 1)
|
||||
this.group8 = this.group8.substr(0, this.group8.length - 1)
|
||||
this.group9 = this.group9.substr(0, this.group9.length - 1)
|
||||
this.group10 = this.group10.substr(0, this.group10.length - 1)
|
||||
doneContract(this.contractNumValue, this.RequisitionNumber, this.contractName, this.planArrivalTime, this.stipulateArrivalTime, this.payMethodName, this.supplierValue, this.textArea, this.freight, this.group1, this.group2, this.group3, this.group4, this.group5, this.group6, this.group7, this.group8, this.group9, this.id).then(response => {
|
||||
doneContract(this.contractNumValue, this.RequisitionNumber, this.contractName, this.planArrivalTime, this.stipulateArrivalTime, this.payMethodName, this.supplierValue, this.textArea, this.freight, this.group1, this.group2, this.group3, this.group5, this.group6, this.group7, this.group8, this.group9, this.id).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message.success('生成合同成功')
|
||||
this.reload()
|
||||
|
||||
Reference in New Issue
Block a user