Files
JY1.0/src/views/WorkshopProcurement/CreatingProcurementContracts/index.vue
liushuai dc9860ef34 更新
2020-03-17 18:45:44 +08:00

864 lines
34 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div class="app-container">
<el-card class="searchContract">
<el-row>
<el-select v-model="contractNumValue" placeholder="请购单号/合同编号" size="small" style="width: 160px" @change="searchData">
<el-option
v-for="item in contractNum"
:key="item.value"
:label="item.label"
:value="item.value">
<div style="float: left">{{ item.label }}</div>
<div style="float: right; color: #8492a6; font-size: 13px;margin-left: 10px">{{ item.name }}</div>
</el-option>
</el-select>
<el-input v-model="contractName" placeholder="合同名称" style="width: 120px" size="small"/>
<!-- <el-input v-model="supplierName" size="small" placeholder="请双击选择供应商" readonly clearable @dblclick.native="dialogVisible1=true;submitDisable=true" @clear="emptySupplierDetail"/>-->
<el-select v-model="supplierValue" placeholder="选择供应商" filterable style="width: 220px" size="small" clearable>
<el-option
v-for="item in supplierValues"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<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"
:key="item.value"
: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-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>
<el-button v-show="contractNumType===1" type="danger" style="margin: 0px" plain size="small" @click="unLinkGroup">取消成组采购</el-button>
</el-row>
</el-card>
<el-card>
<el-table v-show="contractNumType===1" :data="tableData5" border style="width: 1200px" height="100px" size="mini">
<el-table-column align="center" width="50" type="selection"/>
<el-table-column label="组件名称" align="center" width="180">
<template slot-scope="scope">
{{ scope.row.组件名称 }}
</template>
</el-table-column>
<el-table-column label="组号" align="center" width="70">
<template slot-scope="scope">
{{ scope.row.组号 }}
</template>
</el-table-column>
<el-table-column label="数量" align="center" width="90">
<template slot-scope="scope">
<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.单价" positive="'float'" class="editWorkTime" size="mini" style="width:100%" type="number" @blur="filterNuber1(scope.row.单价, scope.$index, '单价')"/>
<!-- @change="update1(scope.row)"-->
</template>
</el-table-column>
<el-table-column label="金额" align="center" width="150">
<template slot-scope="scope">
{{ (parseInt(scope.row.数量) * parseFloat(scope.row.单价)).toFixed(2) }}
</template>
</el-table-column>
<el-table-column label="交货期" align="center" width="160">
<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:100%"
@change="update1(scope.row)"/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" min-width="100">
<template slot-scope="scope">
<el-input v-model="scope.row.备注" size="mini" style="width:100%" @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: 1200px;max-height: 420px;" height="320px" size="mini" @selection-change="handleSelectionChange">
<el-table-column align="center" width="50" type="selection"/>
<el-table-column label="物料名称" align="center" min-width="180">
<template slot-scope="scope">
{{ scope.row.物料名称 }}
</template>
</el-table-column>
<el-table-column label="图号或型号" align="center" min-width="140">
<template slot-scope="scope">
{{ scope.row.图号或型号 }}
</template>
</el-table-column>
<el-table-column label="材料或规格" align="center" width="140">
<template slot-scope="scope">
{{ scope.row.规格或材料 }}
</template>
</el-table-column>
<el-table-column label="订货数量" align="center" width="70">
<template slot-scope="scope">
{{ scope.row.零件数量 }}
</template>
</el-table-column>
<el-table-column label="单价(元)" align="center" width="140">
<template slot-scope="scope">
<el-input v-model="scope.row.单价" positive="'float'" class="editWorkTime" size="mini" type="number" style="width:100px" @blur="filterNuber(scope.row.单价, scope.$index, '单价')"/>
<!--@change="calculateContractSum"-->
</template>
</el-table-column>
<el-table-column label="金额" align="center" width="140">
<template slot-scope="scope">
{{ Number(scope.row.金额).toFixed(2) }}
</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="180">
<template slot-scope="scope">
<el-input v-model="scope.row.备注" size="mini" style="width: 120px" @change="update(scope.row)"/>
</template>
</el-table-column>
</el-table>
<!-- <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" />
<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"/>
<el-select v-model="contractValue" size="small" style="width: 110px;margin-left: 7.5%;margin-top: 10px" @change="changeContract">
<el-option
v-for="item in contract"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-button
type="distribution"
size="small"
style="margin-left: 7.5%; margin-top: 10px"
@click="doneContract">生成采购合同</el-button>
</el-card>
<el-dialog v-el-drag-dialog :visible.sync="dialogVisible1" title="供应商选择" center style="min-height: 300px">
<el-form ref="form1" :model="form1" label-position="left" label-width="90px" class="searchForm">
<el-row>
<el-col :span="12">
<el-form-item label="供应商名称">
<el-input v-model="supplierName" size="small"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="企业性质">
<el-input v-model="enterpriseNature" size="small"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="货期">
<el-input v-model="goodTime" size="small"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="注册资本">
<el-input v-model="registeredCapital" size="small"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="税号">
<el-input v-model="taxNum" size="small"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="电子邮箱">
<el-input v-model="EMail" size="small"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="地址">
<el-input v-model="address" size="small"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="账号">
<el-input v-model="account" size="small"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="开户行">
<el-input v-model="openingBank" size="small"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="电话号码">
<el-input v-model="phone" size="small"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="传真">
<el-input v-model="fax" size="small"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-button
type="success"
size="small"
icon="el-icon-search"
@click="searchSupplier">查询</el-button>
<el-button
:disabled="submitDisable"
type="primary"
size="small"
icon="el-icon-check"
@click="submitSelectSupplier">确定</el-button>
<el-button
type="danger"
size="small"
icon="el-icon-delete"
@click="emptySupplierDetail">清空</el-button>
</el-col>
</el-row>
<el-table :data="tableData01" size="mini" style="width: 97%;max-height: 300px;margin-top:15px" height="200px" border @row-click="showSupplierDetail">
<el-table-column align="center" label="供应商名称" width="200">
<template slot-scope="scope">
{{ scope.row.供应商名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="企业性质">
<template slot-scope="scope">
{{ scope.row.企业性质 }}
</template>
</el-table-column>
<el-table-column align="center" label="创立日期">
<template slot-scope="scope">
{{ scope.row.创立日期&&scope.row.创立日期!=='1900-01-01' ? scope.row.创立日期 : '-' }}
</template>
</el-table-column>
<el-table-column align="center" label="注册资本">
<template slot-scope="scope">
{{ scope.row.注册资本 }}
</template>
</el-table-column>
</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, searchData2, searchContractDemo, initGroupNum, submitGroup, update1, unLinkGroup, searchData1, doneContract1 } from '@/api/WorkshopProcurement/CreatingProcurementContracts'
import { mapGetters } from 'vuex'
export default {
inject: ['reload'],
data() {
return {
submitDisable: true, // 不点击表格中的行不让确定
AdvanceCharge: '',
loading: false,
groupNum: [],
groupNumValue: '',
dialogVisible1: false,
dialogVisible2: false,
disable2: true,
disable3: true,
disable4: true,
disable5: true,
disable6: true,
tableData01: [],
tableData2: [], // 合同模板表
price: [],
form1: {},
form2: {},
form3: {
groupNumValue: '',
机床: ''
},
machineValue: '',
rules1: {
groupNumValue: [{ required: true, message: '请选择组号' }]
},
textArea: '',
paramRow: '', // 参数row
contractSum: 0,
contractSum1: 0,
contractSum2: 0,
deliveryDay: [],
deliveryDay1: [],
contractNumValue: '',
contractNumType: 0,
RequisitionNumber: '',
supplierNames: [],
contract: [{
label: '合同模板1',
value: 1
}, {
label: '合同模板2',
value: 2
}, {
label: '采购计划',
value: 3
}, {
label: '成组采购',
value: 4
}],
contractValue: 1,
contractNum: [], // 合同号
contractName: '产品采购合同', // 合同名称
supplierName: '', // 供应商
supplier: [],
supplierValue: '', // 供应商流水号
supplierValues: [],
enterpriseNature: '', // 企业性质
createDate: '', // 创立日期
registeredCapital: '', // 注册资本
taxNum: '', // 税号
EMail: '', // 电子邮箱
address: '', // 地址
account: '', // 账户
openingBank: '', // 开户行
phone: '', // 电话号码
fax: '', // 传真
goodTime: '', // 货期
supplierCheck1: 0,
supplierCheck2: 0,
supplierCheck3: 0,
supplierCheck4: 0,
supplierCheck5: 0,
supplierCheck6: 0,
supplierCheck7: 0,
supplierCheck8: 0,
supplierCheck9: 0,
supplierCheck10: 0,
supplierCheck11: 0,
supplierCheck12: 0,
payMethod: [], // 付款方式
payMethodValue: 1,
payMethodName: '货到付款',
currency: [{
label: '人民币',
value: 1
}, {
label: '美元',
value: 2
}, {
label: '英镑',
value: 3
}, {
label: '欧元',
value: 4
}], // 币种
currencyValue: 1,
payTime1: [],
payTime1Value: 1,
payTime2: [],
payTime2Value: 1,
payTime3: [],
payTime3Value: 1,
payTime4: [],
payTime4Value: 1,
payTime5: [],
payTime5Value: 1,
payTime6: [],
payTime6Value: 1,
planArrivalTime: '', // 计划到货时间
stipulateArrivalTime: '', // 规定到货时间
freight: '', // 运费
taxRate: '0.13', // 税率
tableData4: [],
tableData5: [],
groupNum2: [],
groupNum5: [],
multipleSelection: [],
Selection: [],
group1: '',
group2: '',
group3: '',
group5: [],
group6: '',
group7: '',
group8: '',
group9: [],
group10: '',
group11: '',
group12: ''
}
},
computed: {
...mapGetters([
'sidebar',
'avatar',
'name',
'id'
])
},
created() {
this.fetchData()
this.searchSupplier()
},
methods: {
linkGroup() {
this.dialogVisible2 = true
},
filterNuber(val, index, date, row) {
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
this.calculateContractSum(row)
},
filterNuber1(val, index, date, row) {
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
this.update1(row)
},
handleSelectionChange(val) {
this.multipleSelection = val
for (let i = 0; i < this.multipleSelection.length; i++) {
this.Selection.push(Number(this.multipleSelection[i].请购单明细流水号))
}
},
submitGroup() {
submitGroup(this.contractNumValue, this.form3.groupNumValue).then(response => {
if (response.data[0].result === '1') {
this.contractNumType = 1
this.contractValue = 4
this.dialogVisible2 = false
this.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].请购类型,
name: response.data[i].备注
})
}
})
this.searchData()
this.$message.success('转换成功')
} else {
this.$message.success('转换失败')
}
})
},
update1(row) {
this.calculateContractSum()
update1(row.组件流水号, row.数量, row.单价, row.物料计划到货时间, row.备注).then(response => {
})
},
unLinkGroup() {
unLinkGroup(this.contractNumValue).then(response => {
if (response.data[0].result === '1') {
this.contractNumType = 0
this.contractValue = 1
this.$message.success('转换成功')
} else {
this.$message.success('转换失败')
}
})
},
searchData() {
this.contractSum = 0.00
this.contractSum2 = 0.00
for (let i = 0; i < this.contractNum.length; i++) {
if (this.contractNum[i].value === this.contractNumValue) {
this.contractNumType = this.contractNum[i].id
}
}
searchData1(this.contractNumValue).then(response => {
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, 'tableData5')
})
searchData2(this.contractNumValue).then(response => {
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].组件流水号
this.groupNum = []
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.tableData4[i].金额 = parseFloat(this.tableData4[i].单价) * parseFloat(this.tableData4[i].零件数量)
}
}).then(() => {
this.groupNum2 = this.tableData4 // 给中间变量需要时重新push
// console.log(this.tableData4, 'tableData4')
})
},
update(row) {
update(row.请购单明细流水号, row.物料计划到货时间, row.备注).then(response => {
})
},
calculateContractSum() { // 计算合同总额
if (this.contractNumType === 0) {
this.contractSum = 0
this.contractSum1 = 0
this.costAccount = 0
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).toFixed(2)
this.costAccount = this.contractSum
if (parseInt(this.costAccount) === 0) {
// this.$message.error('成本核算不可为0')
} else {
this.riseFallPoint = (this.contractSum - this.costAccount) / this.costAccount
this.riseFallPoint = this.riseFallPoint.toFixed(2)
}
} else if (this.contractNumType === 1) {
this.contractSum = 0
this.contractSum1 = 0
this.costAccount = 0
this.riseFallPoint = 0
for (let i = 0; i < this.groupNum5.length; i++) {
this.contractSum1 += parseFloat((parseInt(this.groupNum5[i].数量) * parseFloat(this.groupNum5[i].单价)).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) {
// this.$message.error('成本核算不可为0')
} else {
this.riseFallPoint = (this.contractSum - this.costAccount) / this.costAccount
this.riseFallPoint = this.riseFallPoint.toFixed(2)
}
}
},
fetchData() {
searchContractDemo(1).then(response => {
this.textArea = response.data[0].合同模板内容
})
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].请购类型,
name: response.data[i].备注
})
}
})
},
changeContract() {
searchContractDemo(this.contractValue).then(response => {
this.textArea = response.data[0].合同模板内容
})
},
searchSupplier() { // 查询创立日期和注册资本大于符合条件的数据
this.supplierName ? this.supplierCheck1 = 1 : (this.supplierCheck1 = 0, this.supplierName = '')
this.enterpriseNature ? this.supplierCheck2 = 1 : (this.supplierCheck2 = 0, this.enterpriseNature = '')
this.createDate ? this.supplierCheck3 = 1 : (this.supplierCheck3 = 0, this.createDate = '')
this.registeredCapital ? this.supplierCheck4 = 1 : (this.supplierCheck4 = 0, this.registeredCapital = '')
this.taxNum ? this.supplierCheck5 = 1 : (this.supplierCheck5 = 0, this.taxNum = '')
this.EMail ? this.supplierCheck6 = 1 : (this.supplierCheck6 = 0, this.EMail = '')
this.address ? this.supplierCheck7 = 1 : (this.supplierCheck7 = 0, this.address = '')
this.account ? this.supplierCheck8 = 1 : (this.supplierCheck8 = 0, this.account = '')
this.openingBank ? this.supplierCheck9 = 1 : (this.supplierCheck9 = 0, this.openingBank = '')
this.phone ? this.supplierCheck10 = 1 : (this.supplierCheck10 = 0, this.phone = '')
this.fax ? this.supplierCheck11 = 1 : (this.supplierCheck11 = 0, this.fax = '')
this.goodTime ? this.supplierCheck12 = 1 : (this.supplierCheck12 = 0, this.goodTime = '')
searchSupplier(this.supplierCheck1, this.supplierName, this.supplierCheck2, this.enterpriseNature, this.supplierCheck3, this.createDate, this.supplierCheck4, this.registeredCapital, this.supplierCheck5, this.taxNum, this.supplierCheck6, this.EMail, this.supplierCheck7, this.address, this.supplierCheck8, this.account, this.supplierCheck9, this.openingBank, this.supplierCheck10, this.phone, this.supplierCheck11, this.fax, this.supplierCheck12, this.goodTime).then(response => {
for (let i = 0; i < response.data.length; i++) {
if (response.data[i].创立日期 !== '' && response.data[i].创立日期 !== null) {
response.data[i].创立日期 = response.data[i].创立日期.split(' ')[0]
}
}
for (let i = 0; i < response.data.length; i++) {
this.supplierValues.push({
label: response.data[i].供应商名称,
value: response.data[i].供应商流水号
})
}
this.tableData01 = response.data
})
},
submitSelectSupplier() { // 确定选择供应商
this.dialogVisible1 = false
},
emptySupplierDetail() { // 清空
this.submitDisable = true
this.supplierValue = ''
this.supplierName = ''
this.enterpriseNature = ''
this.createDate = ''
this.registeredCapital = ''
this.taxNum = ''
this.EMail = ''
this.address = ''
this.account = ''
this.openingBank = ''
this.phone = ''
this.fax = ''
this.goodTime = ''
},
showSupplierDetail(row) {
this.submitDisable = false
this.form2.supplierValue = row.供应商流水号
this.form2.supplierName = row.供应商名称
this.supplierValue = row.供应商流水号
this.supplierName = row.供应商名称
this.enterpriseNature = row.企业性质
this.createDate = row.创立日期
this.registeredCapital = row.注册资本
this.taxNum = row.税号
this.EMail = row.电子信箱
this.address = row.地址
this.account = row.帐号
this.openingBank = row.开户行
this.phone = row.电话号码
this.fax = row.传真
this.goodTime = row.货期
},
doneContract() { // 生成采购合同
if (this.contractNumValue === '') {
this.$message.error('请选择生成合同的请购单')
} else if (this.supplierValue === '' || this.supplierValue === null) {
this.$message.error('请选择供应商!')
} else {
if (this.contractNumType === 0) {
this.group1 = ''
this.group2 = ''
this.group3 = ''
this.group5 = []
this.group7 = ''
this.group8 = ''
this.group9 = []
this.group10 = ''
this.group11 = ''
this.group12 = ''
for (let i = 0; i < this.tableData4.length; i++) {
for (let j = 0; j < this.multipleSelection.length; j++) {
if (this.tableData4[i].请购单明细流水号 === this.multipleSelection[j].请购单明细流水号) {
console.log(333333)
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.push(Number(this.tableData4[i].请购单明细流水号))
this.group11 += this.tableData4[i].单件定额工时 + ','
this.group12 += this.tableData4[i].准结定额工时 + ','
} else {
if (this.group5.indexOf(Number(this.tableData4[i].请购单明细流水号)) === -1 && this.Selection.indexOf(Number(this.tableData4[i].请购单明细流水号)) === -1) {
this.group5.push(Number(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
}
}
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, this.group5).then(response => {
if (response.data[0].result === '1') {
this.$message.success('生成合同成功')
this.reload()
} else { this.$message.error('生成合同失败') }
})
} else {
if (this.contractValue === 4) {
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('生成合同失败') }
})
} else {
this.$message.warning('请将模板类型选择为成组采购')
}
}
}
},
exportExcel() {}
}
}
</script>
<style scoped>
.el-date-editor{
width:200px
}
.el-select{
width:150px;
margin-right: 10px;
}
.el-input{
width:150px;
margin-right: 10px;
}
span{
margin: 10px 0 10px 10px;
}
.searchForm .el-form-item{
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>