导出和bug
This commit is contained in:
@@ -7,7 +7,7 @@ export function initArrivalStateContact() {
|
||||
method: 'post',
|
||||
data: {
|
||||
type: '1',
|
||||
name: '采购管理_到货情况_查询数据'
|
||||
name: '采购管理_采购请款表_查询数据'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -14,9 +14,6 @@
|
||||
</el-select>
|
||||
<span>供应商:</span>
|
||||
<el-input v-model="supplierName" placeholder="供应商" size="small" clearable/>
|
||||
<span>提前</span>
|
||||
<el-input-number v-model="warningValue" :min="1" controls-position="right" size="small" style="width: 90px"/>
|
||||
<span>天预警</span>
|
||||
<el-button
|
||||
type="success"
|
||||
size="small"
|
||||
@@ -45,12 +42,12 @@
|
||||
{{ 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.规定到货时间.split(' ')[0] }}
|
||||
{{ scope.row.交货日期 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="供应商" align="center" min-width="250">
|
||||
<el-table-column label="供应商" align="center" min-width="150">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.供应商名称 }}
|
||||
</template>
|
||||
@@ -60,20 +57,12 @@
|
||||
{{ scope.row.姓名 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="到货情况" align="center" min-width="70">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="judge[scope.$index]===1" type="success" size="small">全部到货</el-tag>
|
||||
<el-tag v-if="judge[scope.$index]===2" type="warning" size="small">即将拖期</el-tag>
|
||||
<el-tag v-if="judge[scope.$index]===3" type="danger" size="small">已拖期</el-tag>
|
||||
<el-tag v-if="judge[scope.$index]===4" type="primary" size="small">进度正常</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="到货进度" align="center" min-width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-progress
|
||||
:text-inside="true"
|
||||
:stroke-width="18"
|
||||
:percentage="parseFloat((100*scope.row.合同物料到货总数/scope.row.合同物料采购总数).toFixed(2))"
|
||||
:percentage="parseFloat((100*scope.row.合同到货总数/scope.row.合同采购总数).toFixed(2))"
|
||||
status="success"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -95,29 +84,29 @@
|
||||
{{ 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.物料型号 ? scope.row.物料型号 : 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.物料名称 ? scope.row.物料名称 : 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.物料规格 ? scope.row.物料规格 : scope.row.规格 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<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" min-width="100">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.总到货数量 ? scope.row.总到货数量 : 0 }}
|
||||
{{ scope.row.已到货数量 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -133,7 +122,6 @@ export default {
|
||||
name: '', // 项目总价查询
|
||||
data() {
|
||||
return {
|
||||
warningValue: 3,
|
||||
check1: 0,
|
||||
check2: 0,
|
||||
contractNumValue: '',
|
||||
@@ -143,10 +131,7 @@ export default {
|
||||
pageSize1: 10,
|
||||
pageCurrent1: 1,
|
||||
total1: 0,
|
||||
tableData2: [],
|
||||
now: '',
|
||||
arrival: [],
|
||||
judge: []
|
||||
tableData2: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -159,6 +144,7 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.fetchData()
|
||||
this.searchTable1()
|
||||
},
|
||||
methods: {
|
||||
fetchData() {
|
||||
@@ -173,24 +159,9 @@ export default {
|
||||
})
|
||||
},
|
||||
searchTable1() {
|
||||
this.warningValue ? this.warningValue : this.warningValue = 1
|
||||
this.arrival = [] // 规定到货时间数组
|
||||
this.now = new Date()
|
||||
this.contractNumValue ? this.check1 = 1 : this.check1 = 0
|
||||
this.supplierName ? this.check2 = 1 : this.check2 = 0
|
||||
searchArrivalState(this.pageCurrent1, this.pageSize1, this.check1, this.contractNumValue, this.check2, this.supplierName).then(response => {
|
||||
for (let i = 0; i < response.data.rows.length; i++) {
|
||||
this.arrival.push(new Date(response.data.rows[i].规定到货时间))
|
||||
if (parseInt(response.data.rows[i].合同物料到货总数) === parseInt(response.data.rows[i].合同物料采购总数)) {
|
||||
this.judge[i] = 1 // 全部到货
|
||||
} else if (parseInt(response.data.rows[i].合同物料到货总数) !== parseInt(response.data.rows[i].合同物料采购总数) && (this.arrival[i] - this.now) > 0 && (this.arrival[i] - this.now) < (86400000 * this.warningValue)) {
|
||||
this.judge[i] = 2 // 即将拖期
|
||||
} else if (parseInt(response.data.rows[i].合同物料到货总数) !== parseInt(response.data.rows[i].合同物料采购总数) && (this.arrival[i] - this.now) < 0) {
|
||||
this.judge[i] = 3 // 已拖期
|
||||
} else if (parseInt(response.data.rows[i].合同物料到货总数) !== parseInt(response.data.rows[i].合同物料采购总数) && (this.arrival[i] - this.now) > (86400000 * this.warningValue)) {
|
||||
this.judge[i] = 4 // 进度正常
|
||||
}
|
||||
}
|
||||
this.tableData1 = response.data.rows
|
||||
this.total1 = response.data.total
|
||||
})
|
||||
|
||||
@@ -130,11 +130,20 @@
|
||||
@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-column label="合同状态" align="center" width="80" fixed="left">
|
||||
<el-table-column type="expand" fixed="left">
|
||||
<template slot-scope="scope">
|
||||
<el-form label-position="left" inline class="demo-table-expand">
|
||||
<el-form-item label="离线合同备注">
|
||||
{{ scope.row.离线合同备注 }}
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="合同状态" align="center" width="100" fixed="left">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="Number(scope.row.离线合同状态)===1" type="warning" size="small">编辑中</el-tag>
|
||||
<el-tag v-if="Number(scope.row.离线合同状态)===2" type="success" size="small">已采购</el-tag>
|
||||
<el-tag v-if="Number(scope.row.离线合同状态)===5" type="danger" size="small">已作废</el-tag>
|
||||
<el-tag v-if="Number(scope.row.离线合同状态)===2&&Number(scope.row.总采购数量)!==Number(scope.row.总到货数量)" type="primary" size="small">已采购</el-tag>
|
||||
<el-tag v-if="Number(scope.row.总采购数量)===Number(scope.row.总到货数量)" type="success" size="small">全部到货</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="离线合同编号" align="center" min-width="170">
|
||||
@@ -152,7 +161,7 @@
|
||||
{{ scope.row.供应商名称 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="采购员" align="center" min-width="100">
|
||||
<el-table-column label="采购员" align="center" min-width="80">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.采购员 }}
|
||||
</template>
|
||||
@@ -167,16 +176,11 @@
|
||||
{{ scope.row.规定到货时间.split(' ')[0] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="离线合同备注" align="center" min-width="250">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.离线合同备注 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="200" 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"/>
|
||||
<el-button type="warning" size="mini" icon="el-icon-download" @click="exportExcel(scope.row)"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -414,12 +418,55 @@
|
||||
@click="submitEditOfflineContract">确定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<div id="offlineContract" style="width: 800px;margin: 0 auto;display: none">
|
||||
<table class="offlineContract" cellspacing="0px" align="center" border="1 solid black" width="100%">
|
||||
<tr>
|
||||
<th colspan="8" style="font-size: 30px;font-weight: bold">离线合同</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" rowspan="2" style="text-align:center;font-size: 30px;font-weight: bold">GAOJING</td>
|
||||
<td>合同名称</td>
|
||||
<td id="contractName"/>
|
||||
<td>供应商</td>
|
||||
<td id="supplier"/>
|
||||
<td colspan="2" rowspan="2" style="width: 40px;height: 100px;">二维码粘贴处</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>合同编号</td>
|
||||
<td id="contractNum"/>
|
||||
<td>采购员</td>
|
||||
<td id="buyer"/>
|
||||
</tr>
|
||||
<tr id="tablehead">
|
||||
<td>序号</td>
|
||||
<td>名称</td>
|
||||
<td>规格</td>
|
||||
<td>型号</td>
|
||||
<td>数量</td>
|
||||
<td>单价</td>
|
||||
<td>合计</td>
|
||||
<td>备注</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>总计</td>
|
||||
<td/>
|
||||
<td/>
|
||||
<td/>
|
||||
<td/>
|
||||
<td/>
|
||||
<td id="total"/>
|
||||
<td/>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { searchInventoryNum, searchOfflineContract, searchOfflineContract2, searchSupplier, addOfflineContract, editOfflineContract, deleteOfflineContract, searchMateriel,
|
||||
addMateriel, deleteMateriel, doneOfflineContact, setSafeValue } from '@/api/PurchasingCenter/OfflineContract'
|
||||
import { exportExcelMethod } from './exportExcel'
|
||||
import { mapGetters } from 'vuex'
|
||||
|
||||
export default {
|
||||
@@ -645,7 +692,6 @@ export default {
|
||||
})
|
||||
},
|
||||
editOfflineContract(row) {
|
||||
console.log(row)
|
||||
if (this.$refs['form2'] !== undefined) {
|
||||
this.$refs['form2'].resetFields()
|
||||
}
|
||||
@@ -688,25 +734,25 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
deleteOfflineContract(row) { // 作废离线合同
|
||||
this.$confirm('确定作废该合同?', '提示', {
|
||||
deleteOfflineContract(row) { // 删除离线合同
|
||||
this.$confirm('确定删除该合同?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
deleteOfflineContract(row.离线合同流水号).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
this.$message.success('作废成功')
|
||||
this.$message.success('删除成功')
|
||||
this.searchTable2()
|
||||
searchMateriel(this.offlineContractNum).then(response => {
|
||||
this.tableData3 = response.data
|
||||
})
|
||||
} else { this.$message.error('作废失败') }
|
||||
} else { this.$message.error('数据占用,删除失败') }
|
||||
})
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消作废'
|
||||
message: '已取消删除'
|
||||
})
|
||||
})
|
||||
},
|
||||
@@ -867,6 +913,52 @@ export default {
|
||||
message: '已取消操作'
|
||||
})
|
||||
})
|
||||
},
|
||||
exportExcel(row) {
|
||||
this.$confirm('确定导出该合同?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
const children = document.getElementsByClassName('tableData')
|
||||
const parent = document.getElementsByClassName('offlineContract')[0]
|
||||
if (children.length !== 0) {
|
||||
for (let i = children.length - 1; i >= 0; i--) {
|
||||
parent.removeChild(children[i])
|
||||
}
|
||||
}
|
||||
const tr = []
|
||||
for (let i = 0; i < this.tableData3.length; i++) {
|
||||
tr[i] = document.createElement('tr')
|
||||
tr[i].setAttribute('class', 'tableData')
|
||||
tr[i].innerHTML = `<td/><td/><td/><td/><td/><td/><td/><td/>`
|
||||
document.getElementById('tablehead').after(tr[i])
|
||||
}
|
||||
let total = 0
|
||||
for (let j = 0; j < this.tableData3.length; j++) {
|
||||
document.getElementsByClassName('tableData')[j].children[0].innerHTML = j + 1
|
||||
document.getElementsByClassName('tableData')[j].children[1].innerHTML = this.tableData3[j].物料名称
|
||||
document.getElementsByClassName('tableData')[j].children[2].innerHTML = this.tableData3[j].物料规格
|
||||
document.getElementsByClassName('tableData')[j].children[3].innerHTML = this.tableData3[j].物料型号
|
||||
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 = ''
|
||||
total += this.tableData3[j].数量 * this.tableData3[j].单价
|
||||
}
|
||||
document.getElementById('contractNum').innerHTML = row.离线合同编号
|
||||
document.getElementById('contractName').innerHTML = row.离线合同名称
|
||||
document.getElementById('supplier').innerHTML = row.供应商名称
|
||||
document.getElementById('buyer').innerHTML = row.采购员
|
||||
document.getElementById('total').innerHTML = total
|
||||
exportExcelMethod('offlineContract', '离线合同', '离线合同sheet')
|
||||
}).catch(res => {
|
||||
console.log(res)
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消操作'
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user