This commit is contained in:
chenjianan
2019-05-21 20:13:19 +08:00
parent 8aded86549
commit bbbc1d04ee
4 changed files with 140 additions and 26 deletions

View File

@@ -3,6 +3,17 @@
<el-card>
<el-form label-width="90px" label-position="right">
<el-row>
<el-col :span="6">
<el-form-item label="供应商:">
<el-select v-model="supplierValue" clearable filterable size="small" placeholder="供应商" style="width:100%" @change="supplierChange">
<el-option
v-for="item in supplier"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="合同编号:">
<el-select v-model="contractNumValue" filterable size="small" placeholder="合同编号" style="width:100%" @change="contractChange">
@@ -14,11 +25,6 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="供应商:">
<el-input v-model="supplierName" size="small" readonly/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="合同名称:">
<el-input v-model="contractName" size="small"/>
@@ -129,6 +135,9 @@
</template>
</el-table-column>
</el-table>
<el-tooltip content="一键删除交货期" placement="right">
<el-button type="danger" icon="el-icon-date" size="small" @click="deleteAllDate()"/>
</el-tooltip>
<span>①选择合同模板</span>
<el-radio-group v-model="demoRadio" size="small" @change="demoChange">
<el-radio-button label="模板1"/>
@@ -156,7 +165,7 @@
<script>
import Tinymce from '@/components/Tinymce'
import { searchInquirySheet, searchSheetContract, doneContract, searchBaseInfo } from '@/api/PurchasingCenter/CreatePurchaseContract'
import { initSupplier, searchInquirySheet, searchSheetContract, doneContract, searchBaseInfo } from '@/api/PurchasingCenter/CreatePurchaseContract'
import { convertCurrency } from '@/vendor/int2Chinese'
import { mapGetters } from 'vuex'
import { sleep } from '@/utils/tool'
@@ -167,6 +176,7 @@ export default {
inject: ['reload'],
data() {
return {
supplier: [],
year: '',
month: '',
day: '',
@@ -226,7 +236,21 @@ export default {
this.fetchData()
},
methods: {
deleteAllDate() {
this.tableData1.map(v => {
v.交货期 = ''
})
},
fetchData() {
initSupplier(this.id).then(res => {
this.supplier = []
for (let i = 0; i < res.data.length; i++) {
this.supplier.push({
value: res.data[i].供应商流水号,
label: res.data[i].供应商名称
})
}
})
searchBaseInfo(this.id).then(res => {
this.fax2 = res.data[0] ? res.data[0].传真 : ''
this.postCode2 = '224053'
@@ -235,7 +259,8 @@ export default {
this.account2 = res.data[0] ? res.data[0].帐号 : ''
this.bank2 = res.data[0] ? res.data[0].开户行 : ''
})
searchInquirySheet(0, 0, 0, 0, 1, this.id).then(response => { // 初始化询价单号
searchInquirySheet(0, 0, 0, 0, 1, this.id, 0, 0).then(response => { // 初始化询价单号
this.contractNums = []
for (let i = 0; i < response.data.length; i++) {
this.contractNums.push({
value: response.data[i].询价单流水号,
@@ -263,6 +288,31 @@ export default {
this.contentNew = document.getElementsByClassName('editor-content')[0].innerHTML
this.$refs.tinymce.initTinymce()
},
supplierChange() {
let check
this.supplierValue ? check = 1 : check = 0
searchInquirySheet(0, 0, 0, 0, 1, this.id, check, this.supplierValue).then(response => { // 初始化询价单号
this.contractNums = []
this.contractNumValue = ''
for (let i = 0; i < response.data.length; i++) {
this.contractNums.push({
value: response.data[i].询价单流水号,
label: response.data[i].询价单编号,
supplierName: response.data[i].供应商名称,
supplierValue: response.data[i].供应商流水号,
supplierAddress: response.data[i].地址,
legalPerson: response.data[i].企业性质, // 法人
trustee: response.data[i].注册资本 || '', // 受托人
bank1: response.data[i].开户行 || '', // 开户行
account1: response.data[i].帐号 || '', // 帐号
taxCode1: response.data[i].税号 || '', // 税号
phone1: response.data[i].电话号码 || '', // 电话
fax1: response.data[i].传真 || '', // 传真
postCode1: response.data[i].货期 || '' // 邮编
})
}
})
},
contractChange() { // 选择合同select
for (let i = 0; i < this.contractNums.length; i++) {
if (this.contractNums[i].value === this.contractNumValue) {
@@ -572,7 +622,6 @@ export default {
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
// console.log(this.contractNum, this.contractName, this.deliveryDate, this.payDate, this.payMethod, this.invoiceInfo, this.otherInfo, this.actualTotal, this.id, this.supplierValue, this.单价是否含税, this.组件零件流水号组, this.组件零件基本件流水号组, this.数量组, this.单价组, this.交货期组, this.content)
doneContract(this.contractNum, this.contractName, this.deliveryDate, this.payDate, this.payMethod, this.invoiceInfo, this.otherInfo, this.actualTotal, this.id, this.supplierValue, this.单价是否含税, this.组件零件流水号组, this.组件零件基本件流水号组, this.数量组, this.单价组, this.交货期组, this.content).then(response => {
if (response.data[0].result === '1') {
this.$message.success('合同生成成功')