采购、装配

This commit is contained in:
hedekun
2018-11-14 09:22:04 +08:00
parent f7eb22e5bb
commit 666c65dd0f
101 changed files with 14504 additions and 266 deletions

View File

@@ -0,0 +1,397 @@
<template>
<div class="app-container">
<el-card>
<span>时间段:</span>
<el-date-picker
v-model="dateRange"
:picker-options="pickerOptions"
size="small"
type="daterange"
align="center"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"/>
<el-button
type="success"
size="small"
icon="el-icon-search"
style="margin-left: 10px"
@click="searchTable3()">查询</el-button>
</el-card>
<el-card>
<el-table
v-loading=""
:data="tableData3"
:summary-method="getSummaries"
border
show-summary
style="width: 100%;max-height: 250px;margin-top: 10px"
height="250px"
size="mini">
<el-table-column label="采购合同编号" align="center" min-width="100">
<template slot-scope="scope">
{{ scope.row.采购合同编号 }}
</template>
</el-table-column>
<el-table-column label="付款时间节点" align="center" min-width="100">
<template slot-scope="scope">
{{ scope.row.付款时间节点名称 }}
</template>
</el-table-column>
<el-table-column label="预付款时间" align="center" min-width="100">
<template slot-scope="scope">
{{ scope.row.预付时间 }}
</template>
</el-table-column>
<el-table-column label="付款比例" align="center" min-width="100">
<template slot-scope="scope">
{{ scope.row.付款比例.toFixed(1) }}
</template>
</el-table-column>
<el-table-column label="付款预算(元)" align="center" min-width="100" prop="预付金额">
<template slot-scope="scope">
{{ scope.row.预付金额.toFixed(2) }}
</template>
</el-table-column>
</el-table>
</el-card>
<el-card>
<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-input v-model="supplierName" placeholder="供应商" size="small" clearable/>
<el-button
type="success"
size="small"
icon="el-icon-search"
style="margin-left:10px"
@click="total1=0;pageCurrent1=1;pageSize1=10;searchTable1()">查询</el-button>
</el-card>
<el-card>
<el-table
v-loading=""
:data="tableData1"
border
style="width: 100%;max-height: 250px;"
height="250px"
size="mini"
highlight-current-row
@row-click="searchTable2">
<el-table-column label="采购合同编号" align="center" min-width="100">
<template slot-scope="scope">
{{ scope.row.采购合同编号 }}
</template>
</el-table-column>
<el-table-column label="采购合同名称" align="center" min-width="100">
<template slot-scope="scope">
{{ scope.row.采购合同名称 }}
</template>
</el-table-column>
<el-table-column label="供应商" align="center" min-width="200">
<template slot-scope="scope">
{{ scope.row.供应商名称 }}
</template>
</el-table-column>
<el-table-column label="付款方式" align="center" min-width="100">
<template slot-scope="scope">
{{ scope.row.付款方式内容 }}
</template>
</el-table-column>
<el-table-column label="合同生效日期" align="center" min-width="100">
<template slot-scope="scope">
{{ scope.row.审批时间.split(' ')[0] }}
</template>
</el-table-column>
<el-table-column label="规定到货日期" align="center" min-width="100">
<template slot-scope="scope">
{{ scope.row.规定到货时间.split(' ')[0] }}
</template>
</el-table-column>
<el-table-column label="项目预验收日期" align="center" min-width="110">
<template slot-scope="scope">
{{ scope.row.项目预验收日期.split(' ')[0] }}
</template>
</el-table-column>
<el-table-column label="项目终验收日期" align="center" min-width="110">
<template slot-scope="scope">
{{ scope.row.项目终验收日期.split(' ')[0] }}
</template>
</el-table-column>
<el-table-column label="发货日期" align="center" min-width="100">
<template slot-scope="scope">
{{ scope.row.发货日期.split(' ')[0] }}
</template>
</el-table-column>
<el-table-column label="货到用户现场日期" align="center" min-width="120">
<template slot-scope="scope">
{{ scope.row.货到用户现场日期.split(' ')[0] }}
</template>
</el-table-column>
<el-table-column label="用户现场开通日期" align="center" min-width="120">
<template slot-scope="scope">
{{ scope.row.用户现场开通日期.split(' ')[0] }}
</template>
</el-table-column>
<el-table-column label="日期设置" align="center" width="100" fixed="right">
<template slot-scope="scope">
<el-button type="primary" size="mini" icon="el-icon-edit" @click="editDate(scope.row)">设置</el-button>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent1"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize1"
:total="total1"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/>
</div>
<el-table v-loading="" :data="tableData2" border style="width: 100%;max-height: 180px;margin-top: 10px" size="mini">
<el-table-column label="采购合同编号" align="center" min-width="100">
<template slot-scope="scope">
{{ scope.row.采购合同编号 }}
</template>
</el-table-column>
<el-table-column label="付款时间节点" align="center" min-width="100">
<template slot-scope="scope">
{{ scope.row.付款时间节点名称 }}
</template>
</el-table-column>
<el-table-column label="付款时间" align="center" min-width="100">
<template slot-scope="scope">
{{ scope.row.预付时间 }}
</template>
</el-table-column>
<el-table-column label="付款比例" align="center" min-width="100">
<template slot-scope="scope">
{{ scope.row.付款比例.toFixed(1) }}
</template>
</el-table-column>
<el-table-column label="付款预算" align="center" min-width="100">
<template slot-scope="scope">
{{ scope.row.预付金额.toFixed(2) }}
</template>
</el-table-column>
</el-table>
</el-card>
<el-dialog :visible.sync="dialogVisible1" title="设置日期" center style="min-height: 300px" width="500px">
<el-form ref="form1" :model="form1" label-position="left" label-width="130px">
<el-form-item label="项目预验收日期">
<el-date-picker v-model="form1.项目预验收日期" value-format="yyyy-MM-dd" format="yyyy-MM-dd" type="date" placeholder="选择日期"/>
</el-form-item>
<el-form-item label="项目终验收日期">
<el-date-picker v-model="form1.项目终验收日期" value-format="yyyy-MM-dd" format="yyyy-MM-dd" type="date" placeholder="选择日期"/>
</el-form-item>
<el-form-item label="发货日期">
<el-date-picker v-model="form1.发货日期" value-format="yyyy-MM-dd" format="yyyy-MM-dd" type="date" placeholder="选择日期"/>
</el-form-item>
<el-form-item label="货到用户现场日期">
<el-date-picker v-model="form1.货到用户现场日期" value-format="yyyy-MM-dd" format="yyyy-MM-dd" type="date" placeholder="选择日期"/>
</el-form-item>
<el-form-item label="用户现场开通日期">
<el-date-picker v-model="form1.用户现场开通日期" value-format="yyyy-MM-dd" format="yyyy-MM-dd" type="date" placeholder="选择日期"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button
type="primary"
size="small"
icon="el-icon-check"
@click="submitEdit">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { initContract, searchPayTimeNode, searchPayTimeNodeMoney, editPayTimeNodeOther, searchPurchaseBudget } from '@/api/PurchasingCenter/PurchaseBudgetSearch'
import { mapGetters } from 'vuex'
export default {
name: '', // 采购预算查询
data() {
return {
check: 0,
check1: 0,
check2: 0,
contractNumValue: '',
contractNum: [],
supplierName: '',
pickerOptions: {
shortcuts: [{
text: '未来一周',
onClick(picker) {
const end = new Date()
const start = new Date()
end.setTime(start.getTime() + 3600 * 1000 * 24 * 7)
picker.$emit('pick', [start, end])
}
}, {
text: '未来一个月',
onClick(picker) {
const end = new Date()
const start = new Date()
end.setTime(start.getTime() + 3600 * 1000 * 24 * 30)
picker.$emit('pick', [start, end])
}
}]
},
dateRange: '',
tableData1: [],
pageCurrent1: 1,
pageSize1: 10,
total1: 0,
tableData2: [],
dialogVisible1: false,
form1: {
采购合同流水号: '',
项目预验收日期: '',
项目终验收日期: '',
发货日期: '',
货到用户现场日期: '',
用户现场开通日期: ''
},
tableData3: []
}
},
computed: {
...mapGetters([
'sidebar',
'avatar',
'name',
'id' // 人员编号
])
},
created() {
this.fetchData()
},
methods: {
fetchData() {
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].采购合同流水号
})
}
})
},
searchTable1() {
this.contractNumValue ? this.check1 = 1 : this.check1 = 0
this.supplierName ? this.check2 = 1 : this.check2 = 0
searchPayTimeNode(this.pageCurrent1, this.pageSize1, this.check1, this.contractNumValue, this.check2, this.supplierName).then(response => {
this.tableData1 = response.data.rows
this.total1 = response.data.total
})
},
searchTable2(row) {
searchPayTimeNodeMoney(row.采购合同流水号).then(response => {
this.tableData2 = response.data
})
},
handleSizeChange1(val) {
this.pageSize1 = val
this.pageCurrent1 = 1
this.searchTable1()
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.searchTable1()
},
editDate(row) {
this.form1.采购合同流水号 = row.采购合同流水号
this.form1.项目预验收日期 = row.项目预验收日期
this.form1.项目终验收日期 = row.项目终验收日期
this.form1.发货日期 = row.发货日期
this.form1.货到用户现场日期 = row.货到用户现场日期
this.form1.用户现场开通日期 = row.用户现场开通日期
this.dialogVisible1 = true
},
submitEdit() {
editPayTimeNodeOther(this.form1.采购合同流水号, this.form1.项目预验收日期, this.form1.项目终验收日期, this.form1.发货日期, this.form1.货到用户现场日期, this.form1.用户现场开通日期).then(response => {
if (response.data[0].result === '1') {
this.$message.success('设置成功')
this.dialogVisible1 = false
this.searchTable1()
this.tableData2 = []
} else { this.$message.error('设置失败') }
})
},
searchTable3() {
this.dateRange ? this.check = 1 : (this.check = 0, this.dateRange = '')
searchPurchaseBudget(this.check, this.dateRange[0], this.dateRange[1]).then(response => {
this.tableData3 = response.data
})
},
getSummaries(param) { // 合计
const { columns, data } = param
const sums = []
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '总价'
} else if (index === 4) {
const values = data.map(item => Number(item[column.property]))
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0)
} else {
sums[index] = 'N/A'
}
}
})
if (!isNaN(sums[4])) {
sums[4] = sums[4].toFixed(2)
}
return sums
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom: 15px;
}
.el-select{
width:200px
}
.el-input{
width:200px
}
span{
margin: 10px 0 10px 10px;
}
.searchForm .el-form-item{
margin-bottom: 5px;
}
.el-tag{
margin: 0
}
.el-date-editor{
width:300px
}
</style>