This commit is contained in:
liushuai
2019-11-06 17:12:06 +08:00
parent b1f4fd3368
commit 5e184f8d4e
6 changed files with 227 additions and 230 deletions

View File

@@ -28,23 +28,70 @@
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-row>
</el-card>
<el-card>
<el-table :data="tableData4" border style="width: 100%;max-height: 400px;" height="300px" size="mini">
<el-table-column label="件名称" align="center" min-width="100">
<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">
<template slot-scope="scope">
{{ 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="100">
<template slot-scope="scope">
<el-input v-model="scope.row.数量" size="mini" style="width:70px" @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)"/>
</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"/>
</template>
</el-table-column>
<el-table-column label="交货期" align="center" width="150">
<template slot-scope="scope">
<el-date-picker
v-model="scope.row.物料计划到货时间"
size="small"
type="date"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
style="width: 133px"
@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: 120px" @change="update1(scope.row)"/>
</template>
</el-table-column>
</el-table>
</el-card>
<el-card>
<el-table v-show="contractNumType===0" :data="tableData4" border style="width: 100%;max-height: 400px;" height="300px" size="mini">
<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" min-width="100">
<el-table-column label="图号或型号" align="center" min-width="100">
<template slot-scope="scope">
{{ scope.row.零件图号 }}
{{ scope.row.号或型 }}
</template>
</el-table-column>
<el-table-column label="材料" align="center" width="200">
<el-table-column label="材料或规格" align="center" width="200">
<template slot-scope="scope">
{{ scope.row.材料 }}
{{ scope.row.规格或材料 }}
</template>
</el-table-column>
<el-table-column label="订货数量" align="center" width="100">
@@ -80,55 +127,6 @@
</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" min-width="100">
<template slot-scope="scope">
{{ 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="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">
<template slot-scope="scope">
{{ scope.row.金额 }}
</template>
</el-table-column>
<el-table-column label="交货期" align="center" width="150">
<template slot-scope="scope">
<el-date-picker
v-model="scope.row.物料计划到货时间"
size="small"
type="date"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
style="width: 133px"
@change="update(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="small" style="width: 120px" @change="update(scope.row)"/>
</template>
</el-table-column>
</el-table>
<el-button
type="shengcheng"
size="small"
@@ -266,11 +264,39 @@
</el-table>
</el-form>
</el-dialog>
<el-dialog v-el-drag-dialog :visible.sync="dialogVisible2" title="成组采购" center style="min-height: 200px" width="430px">
<el-form ref="form3" :model="form3" :rules="rules1" label-position="right" label-width="120px">
<el-row>
<el-form-item label="机床" prop="机床">
<el-input v-model="form3.机床" size="small"/>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="组号" prop="groupNumValue">
<el-select v-model="form3.groupNumValue" placeholder="组号" size="small" filterable>
<el-option
v-for="item in groupNum"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button
type="primary"
size="small"
icon="el-icon-check"
@click="submitGroup">转为成组采购</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { searchSupplier, update, doneContract, initPurchaseOrder, searchData1, searchData2, searchContractDemo } from '@/api/WorkshopProcurement/CreatingProcurementContracts'
import { searchSupplier, update, doneContract, initPurchaseOrder, searchData2, searchContractDemo, initGroupNum } from '@/api/WorkshopProcurement/CreatingProcurementContracts'
import { mapGetters } from 'vuex'
export default {
inject: ['reload'],
@@ -279,7 +305,10 @@ export default {
submitDisable: true, // 不点击表格中的行不让确定
AdvanceCharge: '',
loading: false,
groupNum: [],
groupNumValue: '',
dialogVisible1: false,
dialogVisible2: false,
disable2: true,
disable3: true,
disable4: true,
@@ -289,6 +318,14 @@ export default {
tableData2: [], // 合同模板表
form1: {},
form2: {},
form3: {
groupNumValue: '',
机床: ''
},
machineValue: '',
rules1: {
groupNumValue: [{ required: true, message: '请选择组号' }]
},
textArea: '',
paramRow: '', // 参数row
contractSum: 0,
@@ -297,6 +334,7 @@ export default {
deliveryDay: [],
deliveryDay1: [],
contractNumValue: '',
contractNumType: 0,
RequisitionNumber: '',
contract: [{
label: '合同模板1',
@@ -370,9 +408,7 @@ export default {
stipulateArrivalTime: '', // 规定到货时间
freight: '', // 运费
taxRate: '0.13', // 税率
tableData3: [],
tableData4: [],
groupNum1: [],
groupNum2: [],
group1: '',
group2: '',
@@ -399,25 +435,34 @@ export default {
this.fetchData()
},
methods: {
linkGroup() {
console.log(this.form3, 111)
this.dialogVisible2 = true
},
submitGroup() {},
searchData() {
searchData1(this.contractNumValue).then(response => {
for (let j = 0; j < response.data.length; j++) {
response.data[j].物料计划到货时间 = (response.data[j].物料计划到货时间).split(' ')[0]
for (let i = 0; i < this.contractNum.length; i++) {
if (this.contractNum[i].value === this.contractNumValue) {
this.contractNumType = this.contractNum[i].id
}
this.tableData3 = response.data
for (let i = 0; i < response.data.length; i++) {
this.deliveryDay[i] = 0
this.tableData3[i].金额 = parseFloat(this.tableData3[i].单价) * parseFloat(this.tableData3[i].零件数量)
}
}).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
this.machineValue = response.data[0].机床流水号
this.form3.机床 = response.data[0].机床图号
this.form3.groupNumValue = response.data[0].组件流水号
console.log(this.machineValue, 111)
initGroupNum(this.machineValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.groupNum.push({
label: response.data[i].组号,
value: response.data[i].组件流水号
})
}
})
for (let i = 0; i < response.data.length; i++) {
this.deliveryDay1[i] = 0
this.tableData4[i].金额 = parseFloat(this.tableData4[i].单价) * parseFloat(this.tableData4[i].零件数量)
@@ -436,19 +481,13 @@ export default {
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])
}
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.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) {
@@ -462,7 +501,15 @@ export default {
searchContractDemo(1).then(response => {
this.textArea = response.data[0].合同模板内容
})
this.getSelect(initPurchaseOrder, ['请购单编号', '请购单流水号'], 'contractNum')
initPurchaseOrder().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.contractNum.push({
label: response.data[i].请购单编号,
value: response.data[i].请购单流水号,
id: response.data[i].请购类型
})
}
})
},
changeContract() {
searchContractDemo(this.contractValue).then(response => {
@@ -549,16 +596,6 @@ export default {
this.group10 = ''
this.group11 = ''
this.group12 = ''
for (let i = 0; i < this.tableData3.length; i++) {
this.group1 += this.tableData3[i].物料流水号 + ','
this.group2 += this.tableData3[i].零件数量 + ','
this.group3 += this.tableData3[i].单价 + ','
this.group7 += this.taxRate + ','
this.group8 += this.currencyValue + ','
this.group9 += this.tableData3[i].请购单明细流水号 + ','
this.group11 += this.tableData3[i].单件定额工时 + ','
this.group12 += this.tableData3[i].准结定额工时 + ','
}
for (let i = 0; i < this.tableData4.length; i++) {
this.group1 += this.tableData4[i].物料流水号 + ','
this.group2 += this.tableData4[i].零件数量 + ','