成组采购

This commit is contained in:
liushuai
2019-11-18 19:51:48 +08:00
parent 7ccc5db920
commit fb950f38bd
25 changed files with 1525 additions and 394 deletions

View File

@@ -28,34 +28,35 @@
placeholder="规定到货时间"/>
<el-input v-model="name" placeholder="采购员" size="small" readonly/>
<el-input v-model="taxRate" placeholder="税率" size="small"/>
<el-button type="success" size="small" @click="linkGroup">成组采购</el-button>
<el-button v-show="contractNumType===0" type="success" size="small" @click="linkGroup">成组采购</el-button>
<el-button v-show="contractNumType===1" type="danger" size="small" @click="unLinkGroup">取消成组采购</el-button>
</el-row>
</el-card>
<el-card>
<el-table v-show="contractNumType===1" :data="tableData5" border style="width: 100%" height="100px" size="mini">
<el-table-column label="组件名称" align="center" min-width="100">
<el-table-column label="组件名称" align="center" width="150">
<template slot-scope="scope">
{{ scope.row.组件名称 }}
</template>
</el-table-column>
<el-table-column label="组号" align="center" min-width="100">
<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-column label="数量" align="center" width="120">
<template slot-scope="scope">
<el-input v-model="scope.row.数量" size="mini" style="width:70px" @change="update1(scope.row)"/>
<el-input v-model="scope.row.数量" size="mini" style="width:100%" @change="update1(scope.row)"/>
</template>
</el-table-column>
<el-table-column label="单价" align="center" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.单价" size="mini" style="width:70px" @change="update1(scope.row)"/>
<el-input v-model="scope.row.单价" size="mini" style="width:100%" @change="update1(scope.row)"/>
</template>
</el-table-column>
<el-table-column label="金额" align="center" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.金额" size="mini" style="width:70px"/>
{{ parseInt(scope.row.数量) * parseFloat(scope.row.单价) }}
</template>
</el-table-column>
<el-table-column label="交货期" align="center" width="150">
@@ -66,13 +67,13 @@
type="date"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
style="width: 133px"
style="width:100%"
@change="update1(scope.row)"/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" width="150">
<el-table-column label="备注" align="center" width="250">
<template slot-scope="scope">
<el-input v-model="scope.row.备注" size="mini" style="width: 120px" @change="update1(scope.row)"/>
<el-input v-model="scope.row.备注" size="mini" style="width:100%" @change="update1(scope.row)"/>
</template>
</el-table-column>
</el-table>
@@ -296,7 +297,7 @@
</template>
<script>
import { searchSupplier, update, doneContract, initPurchaseOrder, searchData2, searchContractDemo, initGroupNum } from '@/api/WorkshopProcurement/CreatingProcurementContracts'
import { searchSupplier, update, doneContract, initPurchaseOrder, searchData2, searchContractDemo, initGroupNum, submitGroup, update1, unLinkGroup, searchData1, doneContract1 } from '@/api/WorkshopProcurement/CreatingProcurementContracts'
import { mapGetters } from 'vuex'
export default {
inject: ['reload'],
@@ -345,6 +346,9 @@ export default {
}, {
label: '采购计划',
value: 3
}, {
label: '成组采购',
value: 4
}],
contractValue: 1,
contractNum: [], // 合同号
@@ -409,7 +413,9 @@ export default {
freight: '', // 运费
taxRate: '0.13', // 税率
tableData4: [],
tableData5: [],
groupNum2: [],
groupNum5: [],
group1: '',
group2: '',
group3: '',
@@ -439,17 +445,47 @@ export default {
console.log(this.form3, 111)
this.dialogVisible2 = true
},
submitGroup() {},
submitGroup() {
submitGroup(this.contractNumValue, this.form3.groupNumValue).then(response => {
if (response.data[0].result === '1') {
this.contractNumType = 1
this.dialogVisible2 = false
this.searchData()
this.$message.success('转换成功')
} else {
this.$message.success('转换失败')
}
})
},
update1(row) {
update1(row.组件流水号, row.数量, row.单价, row.物料计划到货时间, row.备注).then(response => {
})
},
unLinkGroup() {
unLinkGroup(this.contractNumValue).then(response => {
if (response.data[0].result === '1') {
this.contractNumType = 0
this.$message.success('转换成功')
} else {
this.$message.success('转换失败')
}
})
},
searchData() {
for (let i = 0; i < this.contractNum.length; i++) {
if (this.contractNum[i].value === this.contractNumValue) {
this.contractNumType = this.contractNum[i].id
}
}
console.log(this.contractNumType, 1111)
searchData1(this.contractNumValue).then(response => {
console.log(response.datas)
this.tableData5 = response.data
}).then(() => {
this.groupNum5 = this.tableData5 // 给中间变量需要时重新push
console.log(this.tableData5)
})
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
this.machineValue = response.data[0].机床流水号
this.form3.机床 = response.data[0].机床图号
@@ -464,7 +500,6 @@ export default {
}
})
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(() => {
@@ -577,49 +612,57 @@ export default {
},
doneContract() { // 生成采购合同
if (this.contractNumValue === '') {
this.$message.error('请选择生成合同的询价单')
this.$message.error('请选择生成合同的请购单')
} else if (this.stipulateArrivalTime === '' || this.stipulateArrivalTime === null) {
this.$message.error('请选择规定到货时间!')
} else {
for (let i = 0; i < this.deliveryDay.length; i++) {
if (parseInt(this.deliveryDay[i]) < 0) {
this.$message.error('规定到货日期不可小于当前日期')
return
if (this.contractNumType === 0) {
this.group1 = ''
this.group2 = ''
this.group3 = ''
this.group7 = ''
this.group8 = ''
this.group9 = ''
this.group10 = ''
this.group11 = ''
this.group12 = ''
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].请购单明细流水号 + ','
this.group11 += this.tableData4[i].单件定额工时 + ','
this.group12 += this.tableData4[i].准结定额工时 + ','
}
}
this.group1 = ''
this.group2 = ''
this.group3 = ''
this.group7 = ''
this.group8 = ''
this.group9 = ''
this.group10 = ''
this.group11 = ''
this.group12 = ''
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].请购单明细流水号 + ','
this.group11 += this.tableData4[i].单件定额工时 + ','
this.group12 += 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
for (let i = 0; i < this.contractNum.length; i++) {
if (this.contractNum[i].value === this.contractNumValue) {
this.RequisitionNumber = this.contractNum[i].label
}
}
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)
doneContract(this.contractNumValue, this.RequisitionNumber, this.contractName, this.planArrivalTime, this.stipulateArrivalTime, this.supplierValue, this.textArea, this.contractValue, this.freight, this.group1, this.group2, this.group3, this.group7, this.group8, this.group9, this.id, this.group11, this.group12, this.AdvanceCharge).then(response => {
if (response.data[0].result === '1') {
this.$message.success('生成合同成功')
this.reload()
} else { this.$message.error('生成合同失败') }
})
} else {
for (let i = 0; i < this.contractNum.length; i++) {
if (this.contractNum[i].value === this.contractNumValue) {
this.RequisitionNumber = this.contractNum[i].label
}
}
doneContract1(this.contractNumValue, this.RequisitionNumber, this.contractName, this.stipulateArrivalTime, this.form3.groupNumValue, this.id, this.supplierValue, this.textArea, this.contractValue, this.freight, this.AdvanceCharge, this.tableData5[0].数量, this.tableData5[0].单价, this.taxRate, this.currencyValue, this.tableData5[0].备注).then(response => {
if (response.data[0].result === '1') {
this.$message.success('生成合同成功')
this.reload()
} else { this.$message.error('生成合同失败') }
})
}
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)
doneContract(this.contractNumValue, this.RequisitionNumber, this.contractName, this.planArrivalTime, this.stipulateArrivalTime, this.supplierValue, this.textArea, this.contractValue, this.freight, this.group1, this.group2, this.group3, this.group7, this.group8, this.group9, this.id, this.group11, this.group12, this.AdvanceCharge).then(response => {
if (response.data[0].result === '1') {
this.$message.success('生成合同成功')
this.reload()
} else { this.$message.error('生成合同失败') }
})
}
},
exportExcel() {}