This commit is contained in:
liushuai
2020-03-14 20:28:29 +08:00
parent 64703a0c64
commit 95fb83f7cc
16 changed files with 326 additions and 190 deletions

View File

@@ -21,7 +21,7 @@
:label="item.label"
:value="item.value"/>
</el-select>
<el-input v-model="AdvanceCharge" size="small" style="width: 120px" placeholder="预付款"/>
<el-input v-model="AdvanceCharge" size="small" style="width: 120px" type="number" placeholder="预付款"/>
<el-select v-model="currencyValue" placeholder="币种" style="width: 100px" size="small" clearable>
<el-option
v-for="item in currency"
@@ -29,13 +29,13 @@
:label="item.label"
:value="item.value"/>
</el-select>
<el-date-picker
v-model="stipulateArrivalTime"
size="small"
type="date"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
placeholder="规定到货时间"/>
<!-- <el-date-picker-->
<!-- v-model="stipulateArrivalTime"-->
<!-- size="small"-->
<!-- type="date"-->
<!-- format="yyyy-MM-dd"-->
<!-- value-format="yyyy-MM-dd"-->
<!-- placeholder="规定到货时间"/>-->
<el-input v-model="name" placeholder="采购员" style="width: 120px" size="small" readonly/>
<el-input v-model="taxRate" placeholder="税率" style="width: 100px" size="small"/>
<el-button v-show="contractNumType===0" type="primary" plain size="small" @click="linkGroup">成组采购</el-button>
@@ -59,9 +59,9 @@
<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">
<el-table-column label="单价(元)" align="center" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.单价" size="mini" style="width:100%" @change="update1(scope.row)"/>
<el-input v-model="scope.row.单价" positive="'float'" class="editWorkTime" size="mini" style="width:100%" type="number" @input="filterNuber1(scope.row.单价, scope.$index, '单价')" @change="update1(scope.row)"/>
</template>
</el-table-column>
<el-table-column label="金额" align="center" width="150">
@@ -110,14 +110,14 @@
{{ scope.row.零件数量 }}
</template>
</el-table-column>
<el-table-column label="单价" align="center" width="140">
<el-table-column label="单价(元)" align="center" width="140">
<template slot-scope="scope">
<el-input v-model="scope.row.单价" size="mini" style="width:100px" @change="calculateContractSum"/>
<el-input v-model="scope.row.单价" positive="'float'" class="editWorkTime" size="mini" type="number" style="width:100px" @input="filterNuber(scope.row.单价, scope.$index, '单价')" @change="calculateContractSum"/>
</template>
</el-table-column>
<el-table-column label="金额" align="center" width="140">
<template slot-scope="scope">
{{ scope.row.金额.toFixed(2) }}
{{ Number(scope.row.金额).toFixed(2) }}
</template>
</el-table-column>
<el-table-column label="交货期" align="center" width="150">
@@ -138,15 +138,17 @@
</template>
</el-table-column>
</el-table>
<el-button
type="distribution"
size="small"
style="margin-top:10px"
@click="calculateContractSum">计算合同总额</el-button>
<!-- <el-button-->
<!-- type="distribution"-->
<!-- size="small"-->
<!-- style="margin-top:10px"-->
<!-- @click="calculateContractSum">计算合同总额</el-button>-->
<span>合同总额(未税):</span>
<el-input v-model="contractSum2" size="small"/>
<span style="margin-left: -10px;"></span>
<span>合同总额(含税):</span>
<el-input v-model="contractSum" size="small"/>
<el-input v-model="contractSum" size="small" />
<span style="margin-left: -10px;"></span>
</el-card>
<el-card>
<el-input :rows="20" v-model="textArea" type="textarea" style="width:calc(99% - 250px);float:right;margin-bottom: 20px" resize="none"/>
@@ -327,6 +329,7 @@ export default {
disable6: true,
tableData01: [],
tableData2: [], // 合同模板表
price: [],
form1: {},
form2: {},
form3: {
@@ -455,9 +458,39 @@ export default {
},
methods: {
linkGroup() {
console.log(this.form3, 111)
this.dialogVisible2 = true
},
filterNuber(val, index, date) {
console.log(index, 6666)
let value = '' + val
value = value
.replace(/[^\d.]/g, '') // 清除“数字”和“.”以外的字符
.replace(/\.{2,}/g, '.') // 只保留第一个. 清除多余的
.replace('.', '$#$')
.replace(/\./g, '')
.replace('$#$', '.')
.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3') // 只能输入两个小数
if (value.indexOf('.') < 0 && value !== '') {
value = parseFloat(value).toFixed(2)
}
console.log(value)
this.tableData4[index][date] = value
},
filterNuber1(val, index, date) {
let value = '' + val
value = value
.replace(/[^\d.]/g, '') // 清除“数字”和“.”以外的字符
.replace(/\.{2,}/g, '.') // 只保留第一个. 清除多余的
.replace('.', '$#$')
.replace(/\./g, '')
.replace('$#$', '.')
.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3') // 只能输入两个小数
if (value.indexOf('.') < 0 && value !== '') {
value = parseFloat(value).toFixed(2)
}
console.log(value)
this.tableData5[index][date] = value
},
submitGroup() {
submitGroup(this.contractNumValue, this.form3.groupNumValue).then(response => {
if (response.data[0].result === '1') {
@@ -482,6 +515,7 @@ export default {
})
},
update1(row) {
this.calculateContractSum()
update1(row.组件流水号, row.数量, row.单价, row.物料计划到货时间, row.备注).then(response => {
})
},
@@ -503,21 +537,63 @@ export default {
this.contractNumType = this.contractNum[i].id
}
}
console.log(this.contractNumType, 1111)
searchData1(this.contractNumValue).then(response => {
console.log(response.datas)
this.tableData5 = response.data
this.tableData5 = []
console.log(response, 'tableData5')
if (response.data.length !== 0) {
for (let i = 0; i < response.data.length; i++) {
this.tableData5.push({
组号: response.data[i].组号,
组件名称: response.data[i].组件名称,
数量: response.data[i].数量,
组件流水号: response.data[i].组件流水号,
单价: Number(response.data[i].单价).toFixed(2),
交货期: response.data[i].交货期,
备注: response.data[i].备注,
请购单流水号: response.data[i].请购单流水号,
已到货数量: response.data[i].已到货数量
})
}
}
}).then(() => {
this.groupNum5 = this.tableData5 // 给中间变量需要时重新push
console.log(this.tableData5)
// console.log(this.tableData5, 'tableData5')
})
searchData2(this.contractNumValue).then(response => {
console.log(response, 2233)
this.tableData4 = response.data
this.tableData4 = []
console.log(response, 'tableData4')
if (response.data.length !== 0) {
for (let i = 0; i < response.data.length; i++) {
this.tableData4.push({
请购单明细流水号: response.data[i].请购单明细流水号,
项目名称: response.data[i].项目名称,
机床图号: response.data[i].机床图号,
组号: response.data[i].组号,
物料名称: response.data[i].物料名称,
物料代码: response.data[i].物料代码,
规格或材料: response.data[i].规格或材料,
图号或型号: response.data[i].图号或型号,
零件数量: response.data[i].零件数量,
零件类型: response.data[i].零件类型,
请购单流水号: response.data[i].请购单流水号,
基本件流水号: response.data[i].基本件流水号,
标准件和外购件流水号: response.data[i].标准件和外购件流水号,
物料流水号: response.data[i].物料流水号,
物料计划到货时间: response.data[i].物料计划到货时间,
单价: Number(response.data[i].单价).toFixed(2),
发货天数: response.data[i].发货天数,
税率: response.data[i].税率,
币种流水号: response.data[i].币种流水号,
备注: response.data[i].备注,
机床流水号: response.data[i].机床流水号,
组件流水号: response.data[i].组件流水号,
金额: response.data[i].金额 ? response.data[i].金额 : (Number(response.data[i].单价) * Number(response.data[i].零件数量)).toFixed(2)
})
}
}
this.machineValue = response.data[0].机床流水号
this.form3.机床 = response.data[0].机床图号
this.form3.groupNumValue = response.data[0].组件流水号
console.log(this.machineValue, 111)
this.groupNum = []
initGroupNum(this.machineValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
@@ -532,7 +608,7 @@ export default {
}
}).then(() => {
this.groupNum2 = this.tableData4 // 给中间变量需要时重新push
console.log(this.tableData4)
// console.log(this.tableData4, 'tableData4')
})
},
update(row) {
@@ -547,15 +623,18 @@ export default {
this.riseFallPoint = 0
this.tableData4 = []
for (let i = 0; i < this.groupNum2.length; i++) {
if (this.groupNum2[i].单价 === '') {
this.groupNum2[i].单价 = 0.00
}
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.contractSum1).toFixed(2)
this.contractSum2 = parseInt(this.contractSum * (1 - parseFloat(this.taxRate)) * 100) / 100
this.contractSum2 = (parseInt(this.contractSum * (1 - parseFloat(this.taxRate)) * 100) / 100).toFixed(2)
this.costAccount = this.contractSum
if (parseInt(this.costAccount) === 0) {
this.$message.error('成本核算不可为0')
// this.$message.error('成本核算不可为0')
} else {
this.riseFallPoint = (this.contractSum - this.costAccount) / this.costAccount
this.riseFallPoint = this.riseFallPoint.toFixed(2)
@@ -568,12 +647,11 @@ export default {
for (let i = 0; i < this.groupNum5.length; i++) {
this.contractSum1 += parseFloat((parseInt(this.groupNum5[i].数量) * parseFloat(this.groupNum5[i].单价)).toFixed(2))
}
console.log(this.contractSum1, this.groupNum5, 898989)
this.contractSum = (this.contractSum1).toFixed(2)
this.contractSum2 = parseInt(this.contractSum * (1 - parseFloat(this.taxRate)) * 100) / 100
this.costAccount = this.contractSum
if (parseInt(this.costAccount) === 0) {
this.$message.error('成本核算不可为0')
// this.$message.error('成本核算不可为0')
} else {
this.riseFallPoint = (this.contractSum - this.costAccount) / this.costAccount
this.riseFallPoint = this.riseFallPoint.toFixed(2)
@@ -668,8 +746,8 @@ export default {
doneContract() { // 生成采购合同
if (this.contractNumValue === '') {
this.$message.error('请选择生成合同的请购单')
} else if (this.stipulateArrivalTime === '' || this.stipulateArrivalTime === null) {
this.$message.error('请选择规定到货时间')
} else if (this.supplierValue === '' || this.supplierValue === null) {
this.$message.error('请选择供应商')
} else {
if (this.contractNumType === 0) {
this.group1 = ''
@@ -744,4 +822,12 @@ export default {
margin-bottom: 5px;
}
</style>
<style>
.editWorkTime input::-webkit-outer-spin-button, input::-webkit-inner-spin-button {
-webkit-appearance: none;
text-align: center;
}
.editWorkTime input[type="number"]{
-moz-appearance: textfield;
}
</style>