离线合同bug

This commit is contained in:
chenjianan
2019-03-05 16:10:02 +08:00
parent 70ec28997f
commit d30253b6d9
2 changed files with 87 additions and 21 deletions

View File

@@ -129,7 +129,7 @@
style="margin-left: 10px"
@click="addMateriel">选入物料</el-button>
</div>
<el-table v-loading="" :data="tableData2" border style="max-height: 460px;" height="460px" size="mini" highlight-current-row @row-click="searchTable3">
<el-table v-loading="" :data="tableData2" border style="max-height: 460px;" height="300px" size="mini" highlight-current-row @row-click="searchTable3">
<el-table-column type="expand" fixed="left">
<template slot-scope="scope">
<el-form label-position="left" inline class="demo-table-expand">
@@ -176,11 +176,11 @@
{{ scope.row.规定到货时间.split(' ')[0] }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="200" fixed="right">
<el-table-column label="操作" align="center" width="240" fixed="right">
<template slot-scope="scope">
<el-button :disabled="parseInt(scope.row.离线合同状态)!==1" type="primary" size="mini" icon="el-icon-edit" @click="editOfflineContract(scope.row)"/>
<el-button :disabled="parseInt(scope.row.离线合同状态)!==1" type="danger" size="mini" icon="el-icon-delete" @click="deleteOfflineContract(scope.row)"/>
<el-button type="warning" size="mini" icon="el-icon-download" @click="exportExcel(scope.row)"/>
<el-button :disabled="parseInt(scope.row.离线合同状态)!==1" type="primary" size="mini" @click="editOfflineContract(scope.row)">编辑</el-button>
<el-button :disabled="parseInt(scope.row.离线合同状态)!==1" type="danger" size="mini" @click="deleteOfflineContract(scope.row)">删除</el-button>
<el-button type="warning" size="mini" @click="exportExcel(scope.row)">导出</el-button>
</template>
</el-table-column>
</el-table>
@@ -194,9 +194,10 @@
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange2"
@current-change="handleCurrentChange2"/>
<el-button :disabled="disable" type="success" size="mini" style="float:right" icon="el-icon-circle-check-outline" @click="doneOfflineContact">生成离线合同</el-button>
<el-button type="success" size="mini" style="float:right;margin-left:10px" @click="doneOfflineContact">生成</el-button>
<el-button type="info" size="mini" style="float:right" @click="saveContract">保存</el-button>
</div>
<el-table v-loading="" :data="tableData3" :summary-method="getSummaries" border style="max-height: 300px;" height="300px" size="mini" show-summary>
<el-table v-loading="" :data="tableData3" :summary-method="getSummaries" border style="max-height: 500px;" height="500px" size="mini" show-summary>
<el-table-column label="离线合同编号" align="center" min-width="150">
<template slot-scope="scope">
{{ scope.row.离线合同编号 }}
@@ -237,6 +238,16 @@
{{ parseFloat(scope.row.单价||0) * parseInt(scope.row.数量||0) }}
</template>
</el-table-column>
<el-table-column label="交货期要求" align="center" min-width="100" prop="交货期要求">
<template slot-scope="scope">
<el-input v-model="scope.row.交货期要求" :disabled="disable" size="mini" style="width:70px"/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" min-width="150" prop="备注">
<template slot-scope="scope">
<el-input v-model="scope.row.备注" :disabled="disable" size="mini" style="width:120px"/>
</template>
</el-table-column>
<el-table-column v-if="disable" label="到货数量" align="center" min-width="100">
<template slot-scope="scope">
{{ scope.row.到货数量 }}
@@ -427,30 +438,31 @@
<tr>
<td colspan="3" rowspan="2" style="text-align:center;font-size: 30px;font-weight: bold">GAOJING</td>
<td width="80px">合同名称</td>
<td id="contractName" colspan="3" style="text-align: left;"/>
<td id="contractName" colspan="2" style="text-align: left;"/>
<td width="80px">供应商</td>
<td id="supplier" colspan="4" style="text-align: left;"/>
<td id="supplier" colspan="5" style="text-align: left;"/>
<td id="qrCode" colspan="2" rowspan="2">二维码粘贴处</td>
</tr>
<tr>
<td width="80px">合同编号</td>
<td id="contractNum" colspan="3" style="text-align: left;"/>
<td id="contractNum" colspan="2" style="text-align: left;"/>
<td width="80px">采购员</td>
<td id="buyer" colspan="4" style="text-align: left;"/>
<td id="buyer" colspan="5" style="text-align: left;"/>
</tr>
<tr id="tablehead">
<td>序号</td>
<td colspan="2">名称</td>
<td colspan="2">规格</td>
<td>规格</td>
<td colspan="2">型号</td>
<td colspan="2">数量</td>
<td>数量</td>
<td colspan="2">单价</td>
<td colspan="2">合计</td>
<td>备注</td>
<td>交货期</td>
<td colspan="2">备注</td>
</tr>
<tr>
<td>总计</td>
<td colspan="10"/>
<td id="remark" colspan="10"/>
<td id="total" colspan="2" style="text-align: left;"/>
<td/>
</tr>
@@ -461,7 +473,7 @@
<script>
import { searchInventoryNum, searchOfflineContract, searchOfflineContract2, searchSupplier, addOfflineContract, editOfflineContract, deleteOfflineContract, searchMateriel,
addMateriel, deleteMateriel, doneOfflineContact, setSafeValue } from '@/api/PurchasingCenter/OfflineContract'
addMateriel, deleteMateriel, saveOfflineContact, doneOfflineContact, setSafeValue } from '@/api/PurchasingCenter/OfflineContract'
import QRCode from 'qrcode'
import $ from 'jquery'
import { mapGetters } from 'vuex'
@@ -893,6 +905,42 @@ export default {
})
})
},
saveContract() {
this.$confirm('确定保存合同?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.totalPrice = 0
this.partGroup = []
this.numGroup = []
this.priceGroup = []
const dateGroup = []
const remarkGroup = []
for (let i = 0; i < this.tableData3.length; i++) {
this.totalPrice += this.tableData3[i].数量 * this.tableData3[i].单价
this.partGroup.push(this.tableData3[i].离线合同明细流水号)
this.numGroup.push(this.tableData3[i].数量)
this.priceGroup.push(this.tableData3[i].单价)
dateGroup.push(this.tableData3[i].交货期要求)
remarkGroup.push(this.tableData3[i].备注)
}
saveOfflineContact(this.offlineContractNum, this.totalPrice, this.partGroup, this.numGroup, this.priceGroup, dateGroup, remarkGroup).then(response => {
if (response.data[0].result === '1') {
this.$message.success('离线合同保存成功')
this.searchTable2()
searchMateriel(this.offlineContractNum).then(response => {
this.tableData3 = response.data
})
} else { this.$message.error('离线合同保存失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消操作'
})
})
},
doneOfflineContact() { // 生成离线合同
this.$confirm('确定生成合同?', '提示', {
confirmButtonText: '确定',
@@ -903,13 +951,17 @@ export default {
this.partGroup = []
this.numGroup = []
this.priceGroup = []
const dateGroup = []
const remarkGroup = []
for (let i = 0; i < this.tableData3.length; i++) {
this.totalPrice += this.tableData3[i].数量 * this.tableData3[i].单价
this.partGroup.push(this.tableData3[i].离线合同明细流水号)
this.numGroup.push(this.tableData3[i].数量)
this.priceGroup.push(this.tableData3[i].单价)
dateGroup.push(this.tableData3[i].交货期要求)
remarkGroup.push(this.tableData3[i].备注)
}
doneOfflineContact(this.offlineContractNum, this.totalPrice, this.partGroup, this.numGroup, this.priceGroup).then(response => {
doneOfflineContact(this.offlineContractNum, this.totalPrice, this.partGroup, this.numGroup, this.priceGroup, dateGroup, remarkGroup).then(response => {
if (response.data[0].result === '1') {
this.$message.success('离线合同生成成功')
this.searchTable2()
@@ -945,7 +997,7 @@ export default {
for (let i = 0; i < length; i++) {
tr[i] = document.createElement('tr')
tr[i].setAttribute('class', 'tableData')
tr[i].innerHTML = `<td style="height: 40px"/><td colspan="2" style="height: 40px"/><td colspan="2" style="height: 40px"/><td colspan="2" style="height: 40px"/><td colspan="2" style="height: 40px"/><td colspan="2" style="height: 40px"/><td colspan="2" style="height: 40px"/><td style="height: 40px"/>`
tr[i].innerHTML = `<td style="height: 40px"/><td colspan="2" style="height: 40px"/><td style="height: 40px"/><td colspan="2" style="height: 40px"/><td style="height: 40px"/><td colspan="2" style="height: 40px"/><td colspan="2" style="height: 40px"/><td style="height: 40px"/><td colspan="2" style="height: 40px"/>`
document.getElementById('tablehead').after(tr[i])
}
let total = 0
@@ -957,7 +1009,8 @@ export default {
document.getElementsByClassName('tableData')[j].children[4].innerHTML = this.tableData3[j].数量
document.getElementsByClassName('tableData')[j].children[5].innerHTML = this.tableData3[j].单价
document.getElementsByClassName('tableData')[j].children[6].innerHTML = this.tableData3[j].数量 * this.tableData3[j].单价
document.getElementsByClassName('tableData')[j].children[7].innerHTML = ''
document.getElementsByClassName('tableData')[j].children[7].innerHTML = this.tableData3[j].交货期要求
document.getElementsByClassName('tableData')[j].children[8].innerHTML = this.tableData3[j].备注
total += this.tableData3[j].数量 * this.tableData3[j].单价
}
document.getElementById('contractNum').innerHTML = row.离线合同编号
@@ -965,6 +1018,7 @@ export default {
document.getElementById('supplier').innerHTML = row.供应商名称
document.getElementById('buyer').innerHTML = row.采购员
document.getElementById('total').innerHTML = total
document.getElementById('remark').innerHTML = row.离线合同备注
$('#qrCode').html(`<img id="img" style="display: block;margin: 0 auto">`)
this.useqrcode(row.离线合同流水号) // 显示二维码
}).then(() => {