发票按供应商

This commit is contained in:
chenjianan
2018-12-14 19:45:39 +08:00
parent 5d4ec53fa6
commit 859bb90492
10 changed files with 424 additions and 545 deletions

View File

@@ -1,25 +1,25 @@
<template>
<div class="app-container">
<el-card>
<span>项目名称:</span>
<el-select v-model="projectValue" placeholder="项目名称" size="small" filterable clearable>
<span>供应商名称:</span>
<el-select v-model="supplierNumValue" placeholder="供应商" size="small" filterable clearable @change="searchContract1">
<el-option
v-for="item in project"
v-for="item in supplierNum"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>采购合同号:</span>
<el-select v-model="contractNumValue" placeholder="合同号" size="small" filterable clearable>
<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">{{ item.name }}</div>
</el-option>
</el-select>
<!--<span>采购合同号:</span>-->
<!--<el-select v-model="contractNumValue" placeholder="合同号" size="small" filterable clearable>-->
<!--<el-option-->
<!--v-for="item in contractNums"-->
<!--: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">{{ item.name }}</div>-->
<!--</el-option>-->
<!--</el-select>-->
<el-button
type="success"
size="small"
@@ -37,29 +37,39 @@
<el-card>
<el-table v-loading="" :data="tableData1" show-summary size="mini" style="max-height: 400px" height="400px" stripe border highlight-current-row @row-click="searchPic">
<el-table-column align="center" label="采购合同编号" min-width="100px">
<template slot-scope="scope">
{{ scope.row.采购合同编号 }}
</template>
</el-table-column>
<el-table-column align="center" label="采购合同名称" min-width="130px">
<template slot-scope="scope">
{{ scope.row.采购合同名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="合同总额" min-width="80px">
<template slot-scope="scope">
{{ scope.row.合同总额 }}
</template>
</el-table-column>
<el-table-column align="center" label="供应商" min-width="150px">
<template slot-scope="scope">
{{ scope.row.供应商名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="项目名称" min-width="100px">
<el-table-column align="center" label="发票合同详情" min-width="140px">
<template slot-scope="scope">
{{ scope.row.项目名称 ? scope.row.项目名称 : '—' }}
<el-popover placement="right" width="400" trigger="click">
<el-table :data="tableData01" stripe size="mini" show-summary>
<el-table-column width="50" align="center" type="index" label="序号"/>
<el-table-column min-width="100" align="center" label="合同编号">
<template slot-scope="scope">
{{ scope.row.采购合同编号 }}
</template>
</el-table-column>
<el-table-column min-width="100" align="center" label="合同名称">
<template slot-scope="scope">
{{ scope.row.采购合同名称 }}
</template>
</el-table-column>
<el-table-column min-width="80" align="center" label="合同总额" prop="合同总额">
<template slot-scope="scope">
{{ scope.row.合同总额 }}
</template>
</el-table-column>
</el-table>
<el-button slot="reference" type="success" size="mini" icon="el-icon-search" @click="invoiceDetail(scope.row)">查看详情</el-button>
</el-popover>
</template>
</el-table-column>
<el-table-column align="center" label="备注" min-width="150px">
<template slot-scope="scope">
{{ scope.row.备注 ? scope.row.备注 : '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="开票金额" min-width="100px" prop="开票金额">
@@ -117,7 +127,7 @@
icon="el-icon-edit"
@click="handleEdit(scope.row)">编辑</el-button>
<el-button
:disabled="scope.row.接收人"
:disabled="office||!!scope.row.接收人"
type="danger"
size="mini"
icon="el-icon-delete"
@@ -142,10 +152,19 @@
<el-dialog :title="title1" :visible.sync="dialogVisible1" center style="min-height: 300px" width="460px">
<el-form ref="form1" :model="form1" :rules="rules1" label-position="left" label-width="90px">
<el-row>
<el-form-item label="合同编号" prop="contractNumValue">
<el-select v-model="form1.contractNumValue" placeholder="合同编号" size="small" filterable clearable>
<el-form-item label="供应商" prop="supplierNumValue">
<el-select v-model="form1.supplierNumValue" placeholder="供应商" size="small" filterable @change="searchContract2">
<el-option
v-for="item in contractNum"
v-for="item in supplierNum"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="合同编号" prop="contractNumValue">
<el-select v-model="form1.contractNumValue" multiple placeholder="合同编号" size="small" filterable clearable @change="selectContract">
<el-option
v-for="item in contractNums"
:key="item.value"
:label="item.label"
:value="item.value">
@@ -166,6 +185,9 @@
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="备注">
<el-input v-model="form1.remark" size="small" placeholder="备注"/>
</el-form-item>
<el-form-item label="发票扫描件">
<el-upload
id="invoiceScan"
@@ -175,7 +197,7 @@
:before-upload="beforeUpload"
:on-exceed="warningExceed"
:limit="limit"
:action="upload+'?contractNumValue='+form1.contractNumValue+'&money='+form1.money+'&sendPersonValue='+form1.sendPersonValue"
:action="upload+'?contractNumValue='+form1.contractNumValue+'&money='+form1.money+'&sendPersonValue='+form1.sendPersonValue+'&remark='+form1.remark+'&supplierNumValue='+form1.supplierNumValue"
list-type="picture-card">
<i class="el-icon-plus"/>
</el-upload>
@@ -192,17 +214,8 @@
<el-form ref="form1" :model="form1" :rules="rules1" label-position="right" label-width="80px">
<el-row>
<el-col :span="6">
<el-form-item label="合同编号">
<el-select v-model="form1.contractNumValue" placeholder="合同编号" size="small" disabled>
<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">{{ item.name }}</div>
</el-option>
</el-select>
<el-form-item label="供应商">
<el-input v-model="form1.supplierName" size="small" disabled placeholder="供应商"/>
</el-form-item>
</el-col>
<el-col :span="6">
@@ -234,6 +247,11 @@
</el-col>
</el-row>
<el-row>
<el-col :span="6">
<el-form-item label="备注">
<el-input v-model="form1.remark" size="small" disabled placeholder="备注"/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="发票号" prop="invoiceNum">
<el-input v-model="form1.invoiceNum" size="small" placeholder="发票号"/>
@@ -271,44 +289,51 @@
</template>
<script>
import { searchInvoice, editInvoice, deleteInvoice, initSender, initProject, initContract } from '@/api/PurchasingCenter/PurchaseInvoiceDelivery'
import { searchInvoice, editInvoice, deleteInvoice, initSender, initSupplier, searchContract, invoiceDetail } from '@/api/PurchasingCenter/PurchaseInvoiceDelivery'
import { mapGetters } from 'vuex'
import { upload } from '@/utils/request'
import { uploadInvoiceScan } from '@/utils/request'
import request from '@/utils/request'
export default {
name: '', // 采购发票交接
data() {
return {
check1: 0,
office: false,
scanSrc: '',
upload: `http://localhost:8411/submit/uploadInvoiceScan.ashx`,
upload: uploadInvoiceScan,
limit: 1,
sender: [],
contractNumValue: '',
contractNum: [],
projectValue: '',
project: [],
contractNums: [], // options
pageCurrent1: 1,
pageSize1: 10,
total1: 0,
tableData1: [],
tableData01: [],
dialogVisible1: false,
dialogVisible2: false, // 办公室
title1: '',
supplierNumValue: '',
supplierNum: [],
form1: {
supplierNumValue: '',
supplierName: '',
invoiceDeliveryNum: '',
contractNumValue: '',
contractNumValue: [],
contractNumName: [],
contractNum: [],
money: '',
sendPersonValue: '',
receivePersonValue: '',
invoiceNum: '',
bank: '',
invoiceTime: ''
invoiceTime: '',
remark: ''
},
rules1: {
contractNumValue: [
{ required: true, message: '请选择合同号' }
supplierNumValue: [
{ required: true, message: '请选择供应商' }
],
money: [
{ required: true, message: '请填写金额' }
@@ -338,22 +363,17 @@ export default {
this.searchTable1()
},
methods: {
fetchData() { // 初始化数据
console.log(upload)
initContract().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.contractNum.push({
label: response.data[i].采购合同编号,
name: response.data[i].采购合同名称,
value: response.data[i].采购合同流水号
})
}
invoiceDetail(row) {
invoiceDetail(row.发票交接流水号).then(response => {
this.tableData01 = response.data
})
initProject().then(response => {
},
fetchData() { // 初始化数据
initSupplier().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.project.push({
label: response.data[i].项目名称,
value: response.data[i].项目流水号
this.supplierNum.push({
label: response.data[i].供应商名称,
value: response.data[i].供应商流水号
})
}
})
@@ -366,10 +386,46 @@ export default {
}
})
},
searchContract1() { // 根据供应商查合同(外)
this.contractNumValue = ''
this.contractNums = []
searchContract(this.supplierNumValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.contractNums.push({
label: response.data[i].采购合同编号,
name: response.data[i].采购合同名称,
value: response.data[i].采购合同流水号
})
}
})
},
searchContract2() { // 根据供应商查合同(内)
this.form1.contractNumValue = []
this.contractNums = []
searchContract(this.form1.supplierNumValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.contractNums.push({
label: response.data[i].采购合同编号,
name: response.data[i].采购合同名称,
value: response.data[i].采购合同流水号
})
}
})
},
selectContract() {
this.form1.contractNum = []
this.form1.contractNumName = []
for (let i = 0; i < this.form1.contractNumValue.length; i++) {
if (Number(this.form1.contractNumValue[i]) === Number(this.contractNums[i].value)) {
this.form1.contractNum.push(this.contractNums[i].label)
this.form1.contractNumName.push(this.contractNums[i].name)
}
}
},
searchTable1() { // 查询表1
this.projectValue ? this.check1 = 1 : this.check1 = 0
this.supplierNumValue ? this.check1 = 1 : this.check1 = 0
this.contractNumValue ? this.check2 = 1 : this.check2 = 0
searchInvoice(this.pageCurrent1, this.pageSize1, this.check1, this.projectValue, this.check2, this.contractNumValue).then(response => {
searchInvoice(this.pageCurrent1, this.pageSize1, this.check1, this.supplierNumValue, this.check2, this.contractNumValue).then(response => {
this.tableData1 = response.data.rows
this.total1 = response.data.total
})
@@ -389,8 +445,10 @@ export default {
this.$refs['form1'].resetFields()
}
this.title1 = '增加'
this.contractNum = []
this.form1.projectValue = ''
this.form1.contractNumValue = ''
this.form1.supplierNumValue = ''
this.form1.contractNumValue = []
this.form1.money = ''
this.form1.sendPersonValue = Number(this.id)
this.form1.remark = ''
@@ -425,6 +483,7 @@ export default {
this.$message.success('增加成功')
this.dialogVisible1 = false
this.searchTable1()
this.$refs.upload.clearFiles()
} else {
this.$message.error('增加失败')
}
@@ -436,13 +495,14 @@ export default {
this.title1 = '编辑'
this.dialogVisible2 = true
this.form1.invoiceDeliveryNum = row.发票交接流水号
this.form1.contractNumValue = parseInt(row.采购合同流水号)
this.form1.supplierName = row.供应商名称
this.form1.money = row.开票金额
this.form1.sendPersonValue = parseInt(row.传送人流水号)
this.form1.receivePersonValue = Number(this.id)
this.form1.invoiceNum = row.发票号
this.form1.bank = row.开户行
this.form1.invoiceTime = row.开票时间
this.form1.remark = row.备注
},
submitEdit(formName) {
this.$refs[formName].validate((valid) => {