家里的样式

This commit is contained in:
zhangdingyu
2019-09-18 09:34:02 +08:00
commit 02d1678fff
681 changed files with 133918 additions and 0 deletions

View File

@@ -0,0 +1,205 @@
<template>
<div class="app-container">
<el-card>
<div slot="header">
<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>
</div>
<el-table
v-loading=""
:data="tableData1"
border
highlight-current-row
style="width: 100%;max-height: 250px;"
height="250px"
size="mini"
@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="120">
<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="150">
<template slot-scope="scope">
{{ scope.row.供应商名称 }}
</template>
</el-table-column>
<el-table-column label="采购员" align="center" min-width="70">
<template slot-scope="scope">
{{ scope.row.姓名 }}
</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="scope.row.到货进度 = (100*(Number(scope.row.合同到货总数))/scope.row.合同采购总数) > 100 ? 100 : Number((100*(Number(scope.row.合同到货总数))/scope.row.合同采购总数).toFixed(2))"
status="success"/>
</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"
style="display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/>
</div>
<el-table v-loading="" :data="tableData2" stripe border style="width: 100%;max-height: 300px;margin-top: 10px" height="300px" 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.物料型号 ? 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.物料名称 : scope.row.零件名称 }}
</template>
</el-table-column>
<el-table-column label="规格" align="center" min-width="100">
<template slot-scope="scope">
{{ 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.采购总数量 }}
</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>
</el-card>
</div>
</template>
<script>
import { initArrivalStateContact, searchArrivalState, searchArrivalNum } from '@/api/PurchasingCenter/ArrivalStateSearch'
import { mapGetters } from 'vuex'
export default {
name: '', // 项目总价查询
data() {
return {
check1: 0,
check2: 0,
contractNumValue: '',
contractNum: [],
supplierName: '',
tableData1: [],
pageSize1: 10,
pageCurrent1: 1,
total1: 0,
tableData2: []
}
},
computed: {
...mapGetters([
'sidebar',
'avatar',
'name',
'id' // 人员编号
])
},
created() {
this.fetchData()
this.searchTable1()
},
methods: {
fetchData() {
initArrivalStateContact().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
searchArrivalState(this.pageCurrent1, this.pageSize1, this.check1, this.contractNumValue, this.check2, this.supplierName).then(response => {
this.tableData1 = response.data.rows
this.total1 = response.data.total
})
},
handleSizeChange1(val) {
this.pageSize1 = val
this.pageCurrent1 = 1
this.searchTable1()
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.searchTable1()
},
searchTable2(row) {
searchArrivalNum(row.采购合同流水号).then(response => {
this.tableData2 = response.data
})
}
}
}
</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
}
</style>

View File

@@ -0,0 +1,253 @@
<template>
<div class="app-container">
<el-card>
<div slot="header" class="clearfix">
<el-row style="margin-bottom: 10px">
<span>物料名称</span>
<el-input v-model="materialName" placeholder="物料名称" clearable size="small"/>
<span>物料规格</span>
<el-input v-model="materialSpec" placeholder="物料规格" clearable size="small"/>
</el-row>
<span>物料型号</span>
<el-input v-model="materialModel" placeholder="物料型号" clearable size="small"/>
<el-button size="small" type="success" icon="el-icon-search" style="margin: 0 0 0 10px" @click="pageCurrent1=1;pageSize1=10;total1=0;searchTable1();pageCurrent2=1;pageSize2=10;total2=0;searchTable2()">查询</el-button>
</div>
<h4 style="margin-top: 0">采购件列表</h4>
<el-table :data="tableData1" size="mini" border style="width: 100%;" height="440">
<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="150">
<template slot-scope="scope">
{{ scope.row.物料规格 }}
</template>
</el-table-column>
<el-table-column props="仓库名称" label="仓库名称" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.仓库名称 }}
</template>
</el-table-column>
<el-table-column label="货位名称" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.货位名称 }}
</template>
</el-table-column>
<el-table-column label="货位存量" align="center" width="80">
<template slot-scope="scope">
{{ scope.row.货位存量 }}
</template>
</el-table-column>
<el-table-column label="待出库数量" align="center" width="90">
<template slot-scope="scope">
{{ scope.row.待出库数量 }}
</template>
</el-table-column>
<el-table-column label="可转滞货数量" align="center" width="100">
<template slot-scope="scope">
{{ scope.row.可转滞货数量 = scope.row.货位存量 - scope.row.待出库数量 }}
</template>
</el-table-column>
<el-table-column label="所属机床" align="center" width="100">
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column label="所属分组" align="center" width="80">
<template slot-scope="scope">
{{ scope.row.组号 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100">
<template slot-scope="scope" align="center">
<el-button size="mini" type="primary" @click="turnToBacklogGoods(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"
style="display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/>
</div>
<h4>滞货件列表</h4>
<el-table :data="tableData2" size="mini" border style="width: 100%;" height="440">
<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="120">
<template slot-scope="scope">
{{ scope.row.物料型号 }}
</template>
</el-table-column>
<el-table-column label="规格" align="center" min-width="120">
<template slot-scope="scope">
{{ scope.row.物料规格 }}
</template>
</el-table-column>
<el-table-column label="仓库名称" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.仓库名称 }}
</template>
</el-table-column>
<el-table-column label="货位名称" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.货位名称 }}
</template>
</el-table-column>
<el-table-column label="滞货货位存量" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.货位存量 }}
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent2"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize2"
:total="total2"
style="display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange2"
@current-change="handleCurrentChange2"/>
</div>
</el-card>
<el-dialog :visible.sync="dialogFormVisible" title="转为滞货" center width="380px">
<span>转为滞货数量</span>
<el-input-number :min="0" :max="maxNumber" v-model="number" controls-position="right"/>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible=false">取消</el-button>
<el-button :disabled="Number(number)===0" type="primary" @click="submitTurn()">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { searchMaterialNum, searchBacklogNum, submitTurn } from '@/api/PurchasingCenter/BacklogGoodsAnalysis'
import { mapGetters } from 'vuex'
export default {
name: 'BacklogGoodsAnalysis',
data() {
return {
materialName: '',
materialSpec: '',
materialModel: '',
pageCurrent1: 1,
pageSize1: 10,
total1: 0,
tableData1: [],
number: 0,
maxNumber: 0,
dialogFormVisible: false,
pageCurrent2: 1,
pageSize2: 10,
total2: 0,
tableData2: [],
materialNum: '', // 物料流水号
materialLocalNum: '', // 物料与货位对照流水号
localNum: '' // 货位流水号
}
},
computed: {
...mapGetters([
'name',
'id' // 人员编号
])
},
mounted() {
this.searchTable1()
this.searchTable2()
},
methods: {
searchTable1() {
let check1, check2, check3
this.materialName ? check1 = 1 : check1 = 0
this.materialSpec ? check2 = 1 : check2 = 0
this.materialModel ? check3 = 1 : check3 = 0
searchMaterialNum(this.pageCurrent1, this.pageSize1, check1, this.materialName, check2, this.materialSpec, check3, this.materialModel).then(response => {
this.tableData1 = response.data.rows
this.total1 = response.data.total
})
},
handleSizeChange1(val) {
this.pageSize1 = val
this.pageCurrent1 = 1
this.searchTable1()
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.searchTable1()
},
turnToBacklogGoods(row) {
this.number = 0
this.dialogFormVisible = true
this.maxNumber = row.可转滞货数量
this.materialNum = row.物料流水号
this.materialLocalNum = row.物料与货位对照流水号
this.localNum = row.货位流水号
},
submitTurn() {
submitTurn(this.materialNum, this.number, this.materialLocalNum, this.localNum).then(response => {
if (response.data[0].result === '1') {
this.searchTable1()
this.searchTable2()
this.$message.success('操作成功')
this.dialogFormVisible = false
} else {
this.$message.error('操作失败')
}
})
},
searchTable2() {
let check1, check2, check3
this.materialName ? check1 = 1 : check1 = 0
this.materialSpec ? check2 = 1 : check2 = 0
this.materialModel ? check3 = 1 : check3 = 0
searchBacklogNum(this.pageCurrent2, this.pageSize2, check1, this.materialName, check2, this.materialSpec, check3, this.materialModel).then(response => {
this.tableData2 = response.data.rows
this.total2 = response.data.total
})
},
handleSizeChange2(val) {
this.pageSize2 = val
this.pageCurrent2 = 1
this.searchTable2()
},
handleCurrentChange2(val) {
this.pageCurrent2 = val
this.searchTable2()
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom: 15px;
}
.el-select{
width:200px
}
.el-input{
width:200px
}
span{
margin: 10px 0 10px 10px;
}
</style>

View File

@@ -0,0 +1,283 @@
<template>
<div class="app-container">
<el-card>
<div slot="header" class="clearfix">
<span>关联状态</span>
<el-checkbox-group v-model="connectStatus" :min="1" size="small" style="display: inline-block">
<el-checkbox label="0">未关联</el-checkbox>
<el-checkbox label="1">已关联</el-checkbox>
</el-checkbox-group>
<el-button size="small" type="success" icon="el-icon-search" style="margin: 0 0 0 10px" @click="pageCurrent1=1;pageSize1=10;total1=0;searchTable1();">查询</el-button>
</div>
<h4 style="margin-top: 0">滞货使用情况表</h4>
<el-table :data="tableData1" size="mini" stripe border style="width: 100%;" highlight-current-row height="440" @row-click="searchConnect">
<el-table-column label="关联状态" align="center" width="100">
<template slot-scope="scope">
<el-tag v-if="Number(scope.row.是否关联)===1" type="success" size="small">已关联</el-tag>
<el-tag v-else type="info" size="small">未关联</el-tag>
</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="150">
<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="80">
<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="90">
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
</el-table-column>
<el-table-column label="使用时间" align="center" width="140">
<template slot-scope="scope">
{{ scope.row.操作时间 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100">
<template slot-scope="scope">
<el-button :disabled="Number(scope.row.是否关联)===1" size="mini" type="primary" @click="connectBacklog(scope.row)">关联物料</el-button>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin: 10px 0;">
<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>
<h4>滞货关联明细</h4>
<el-table :data="tableData2" size="mini" border style="width: 100%;" height="220">
<el-table-column label="序号" align="center" type="index" width="80"/>
<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="150">
<template slot-scope="scope">
{{ scope.row.物料规格 }}
</template>
</el-table-column>
<el-table-column props="仓库名称" label="仓库名称" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.仓库名称 }}
</template>
</el-table-column>
<el-table-column label="货位名称" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.货位名称 }}
</template>
</el-table-column>
<el-table-column label="关联数量" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.关联数量 }}
</template>
</el-table-column>
</el-table>
</el-card>
<el-dialog :visible.sync="dialogVisible1" title="关联物料" center style="min-height: 300px;" width="900px">
<el-table :data="tableData01" size="mini" border style="width: 100%;" height="220" show-summary @selection-change="handleSelectionChange">
<el-table-column type="selection" align="center" width="55"/>
<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="150">
<template slot-scope="scope">
{{ scope.row.物料规格 }}
</template>
</el-table-column>
<el-table-column props="仓库名称" label="仓库名称" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.仓库名称 }}
</template>
</el-table-column>
<el-table-column label="货位名称" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.货位名称 }}
</template>
</el-table-column>
<el-table-column label="货位存量" align="center" width="80">
<template slot-scope="scope">
{{ scope.row.货位存量 }}
</template>
</el-table-column>
<el-table-column label="关联数量" align="center" width="120" prop="关联数量">
<template slot-scope="scope">
<el-input-number :min="0" v-model="scope.row.关联数量" size="mini" controls-position="right" style="width: 100%"/>
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button size="small" @click="dialogVisible1=false">取消</el-button>
<el-button type="primary" size="small" @click="submitConnectBacklog">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { searchBacklogUseRecord, searchBacklogLocation, submitConnectBacklog, searchBacklogConnectDetail } from '@/api/PurchasingCenter/BacklogGoodsPrepare'
import { mapGetters } from 'vuex'
export default {
name: 'BacklogGoodsPrepare',
data() {
return {
connectStatus: ['0'],
tableData1: [],
PageCurrent1: 1,
PageSize1: 10,
total1: 0,
tableData2: [],
dialogVisible1: false,
tableData01: [],
multipleSelection: [],
useNumber: '', // 使用数量
useNum: '' // 滞货使用流水号
}
},
computed: {
...mapGetters([
'id'
])
},
mounted() {
this.initData()
this.searchTable1()
},
methods: {
// 初始化数据
initData() {},
// 查询滞货使用记录
searchTable1() {
let status
if (Number(this.connectStatus) === 0) {
status = 0
} else if (Number(this.connectStatus) === 1) {
status = 1
} else {
status = 2
}
searchBacklogUseRecord(this.PageCurrent1, this.PageSize1, status).then(response => {
this.tableData1 = response.data.rows
this.total1 = response.data.total
})
},
handleSizeChange1(val) {
this.pageSize1 = val
this.pageCurrent1 = 1
this.searchTable1()
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.searchTable1()
},
// 查询滞货关联
searchConnect(row) {
searchBacklogConnectDetail(row.滞货使用流水号).then(response => {
this.tableData2 = response.data
})
},
// 关联物料
connectBacklog(row) {
this.dialogVisible1 = true
this.useNumber = row.使用滞货数量
this.useNum = row.滞货使用流水号
searchBacklogLocation(row.物料流水号).then(response => {
this.tableData01 = response.data
this.tableData01.map(v => {
this.$set(v, '关联数量', 0)
return v
})
})
},
// 多选
handleSelectionChange(val) {
this.multipleSelection = val
},
// 提交关联物料
submitConnectBacklog() {
let sum = 0
const numGroup = []
const materialLocalGroup = []
for (let i = 0; i < this.multipleSelection.length; i++) {
sum += this.multipleSelection[i].关联数量
numGroup.push(this.multipleSelection[i].关联数量)
materialLocalGroup.push(this.multipleSelection[i].物料与货位对照流水号)
}
if (sum === Number(this.useNumber)) {
submitConnectBacklog(this.useNum, materialLocalGroup, numGroup).then(response => {
console.log(response.data)
if (response.data[0].result === '1') {
this.$message.success('关联成功')
this.searchTable1()
this.dialogVisible1 = false
} else {
this.$message.error('关联失败')
}
})
} else {
this.$message.error('关联数量有误')
}
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom: 15px;
}
.el-select{
width:200px
}
.el-input{
width:200px
}
span{
margin: 10px 0 10px 10px;
}
.el-tag{
margin: 0
}
</style>

View File

@@ -0,0 +1,224 @@
/* eslint-disable */
require('script-loader!file-saver');
// import XLSX from 'xlsx'
import XLSX from 'xlsx-style'
function generateArray(table) {
var out = [];
var rows = table.querySelectorAll('tr');
var ranges = [];
for (var R = 0; R < rows.length; ++R) {
var outRow = [];
var row = rows[R];
var columns = row.querySelectorAll('td');
for (var C = 0; C < columns.length; ++C) {
var cell = columns[C];
var colspan = cell.getAttribute('colspan');
var rowspan = cell.getAttribute('rowspan');
var cellValue = cell.innerText;
if (cellValue !== "" && cellValue == +cellValue) cellValue = +cellValue;
//Skip ranges
ranges.forEach(function (range) {
if (R >= range.s.r && R <= range.e.r && outRow.length >= range.s.c && outRow.length <= range.e.c) {
for (var i = 0; i <= range.e.c - range.s.c; ++i) outRow.push(null);
}
});
//Handle Row Span
if (rowspan || colspan) {
rowspan = rowspan || 1;
colspan = colspan || 1;
ranges.push({
s: {
r: R,
c: outRow.length
},
e: {
r: R + rowspan - 1,
c: outRow.length + colspan - 1
}
});
};
//Handle Value
outRow.push(cellValue !== "" ? cellValue : null);
//Handle Colspan
if (colspan)
for (var k = 0; k < colspan - 1; ++k) outRow.push(null);
}
out.push(outRow);
}
return [out, ranges];
};
function datenum(v, date1904) {
if (date1904) v += 1462;
var epoch = Date.parse(v);
return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000);
}
function sheet_from_array_of_arrays(data, opts) {
var ws = {};
var range = {
s: {
c: 10000000,
r: 10000000
},
e: {
c: 0,
r: 0
}
};
for (var R = 0; R != data.length; ++R) {
for (var C = 0; C != data[R].length; ++C) {
if (range.s.r > R) range.s.r = R;
if (range.s.c > C) range.s.c = C;
if (range.e.r < R) range.e.r = R;
if (range.e.c < C) range.e.c = C;
var cell = {
v: data[R][C]
};
if (cell.v == null) continue;
var cell_ref = XLSX.utils.encode_cell({
c: C,
r: R
});
if (typeof cell.v === 'number') cell.t = 'n';
else if (typeof cell.v === 'boolean') cell.t = 'b';
else if (cell.v instanceof Date) {
cell.t = 'n';
cell.z = XLSX.SSF._table[14];
cell.v = datenum(cell.v);
} else cell.t = 's';
ws[cell_ref] = cell;
}
}
if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range);
return ws;
}
function Workbook() {
if (!(this instanceof Workbook)) return new Workbook();
this.SheetNames = [];
this.Sheets = {};
}
function s2ab(s) {
var buf = new ArrayBuffer(s.length);
var view = new Uint8Array(buf);
for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
return buf;
}
export function export_table_to_excel(id) {
var theTable = document.getElementById(id);
var oo = generateArray(theTable);
var ranges = oo[1];
/* original data */
var data = oo[0];
var ws_name = "SheetJS";
var wb = new Workbook(),
ws = sheet_from_array_of_arrays(data);
/* add ranges to worksheet */
// ws['!cols'] = ['apple', 'banan'];
ws['!merges'] = ranges;
/* add worksheet to workbook */
wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws;
var wbout = XLSX.write(wb, {
bookType: 'xlsx',
bookSST: false,
type: 'binary'
});
saveAs(new Blob([s2ab(wbout)], {
type: "application/octet-stream"
}), "test.xlsx")
}
export function export_json_to_excel({
headerGroup,
dataGroup,
sheetGroup,
filename,
autoWidth = true,
bookType= 'xlsx'
} = {}) {
var wb = new Workbook()
for (let i = 0; i < dataGroup.length; i++) {
/* original data */
let data = dataGroup[i]
filename = filename || 'excel-list'
data = [...data]
data.unshift(headerGroup[i]);
var ws_name = sheetGroup[i];
var ws = sheet_from_array_of_arrays(data);
if (autoWidth) {
/*设置worksheet每列的最大宽度*/
const colWidth = data.map(row => row.map(val => {
/*先判断是否为null/undefined*/
if (val == null) {
return {
'wch': 10
};
}
/*再判断是否为中文*/
else if (val.toString().charCodeAt(0) > 255) {
return {
'wch': val.toString().length * 2
};
} else {
return {
'wch': val.toString().length
};
}
}))
/*以第一行为初始值*/
let result = colWidth[0];
for (let i = 1; i < colWidth.length; i++) {
for (let j = 0; j < colWidth[i].length; j++) {
if (result[j]['wch'] < colWidth[i][j]['wch']) {
result[j]['wch'] = colWidth[i][j]['wch'];
}
}
}
ws['!cols'] = result;
}
let R = 0;
data.map(item => {
let C = 0;
item.map(itm => {
var cell_ref = XLSX.utils.encode_cell({c:C,r:R});
var cell = {v: itm }
cell.s= {
alignment: {
horizontal: "center"
}
}
ws[cell_ref] = cell;
C++;
})
R++;
})
/* add worksheet to workbook */
wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws;
}
var wbout = XLSX.write(wb, {
bookType: bookType,
bookSST: false,
type: 'binary'
});
saveAs(new Blob([s2ab(wbout)], {
type: "application/octet-stream"
}), `${filename}.${bookType}`);
}

View File

@@ -0,0 +1,24 @@
// 导出Excel方法表格id不加扩展名的文件名sheet名
export function exportExcelMethod(tableId, fileName, sheetName) {
tableToExcel(tableId, fileName, sheetName)
}
const tableToExcel = (function() {
const uri = 'data:application/vnd.ms-excel;base64,'
// 设置导出表格的单元格默认高度/宽度/边框样式/字体颜色/背景颜色/居中网页显示表格宽度建议1240tr/td视情况而定
const template = `<html xmlns:x="urn:schemas-microsoft-com:office:excel"><head><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><meta charset="UTF-8"><style type="text/css">table td {border: 1px solid #000000;height:40px;text-align: center;color: #000000;}</style></head><body><table>{table}</table></body></html>`
const base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) }
const format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p] }) }
return function(table, filename, sheetname) {
if (!table.nodeType) table = document.getElementById(table)
const ctx = { worksheet: sheetname || 'Worksheet', table: table.innerHTML }
const blob = new Blob([format(template, ctx)])
if ('msSaveOrOpenBlob' in navigator) {
window.navigator.msSaveOrOpenBlob(blob, filename + '.xls')
return
}
const aTag = document.createElement('a')
aTag.href = uri + base64(format(template, ctx))
aTag.download = filename
aTag.click()
}
})()

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,836 @@
<template>
<div class="components-container">
<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%" @focus="fetchData" @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">
<el-option
v-for="item in contractNums"
: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-input v-model="contractName" size="small"/>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="是否含税:">
<el-input v-model="taxRate" size="small"/>
</el-form-item>
</el-col>
<el-col :span="1">
<el-tooltip :content="hasTax" placement="top">
<el-switch
v-model="hasTax"
active-color="#13ce66"
inactive-color="#ff4949"
active-value="含税"
inactive-value="未税"
style="margin: 10px"/>
</el-tooltip>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="交货日期:">
<el-input v-model="deliveryDate" :disabled="!contractNumValue" size="small" type="textarea" rows="1" @blur="contractHeaderChange"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="开票信息:">
<el-input v-model="invoiceInfo" :disabled="!contractNumValue" size="small" type="textarea" rows="1" @blur="contractHeaderChange"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="支付日期:">
<el-input v-model="payDate" :disabled="!contractNumValue" size="small" type="textarea" rows="1" @blur="contractHeaderChange"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="支付方式:">
<el-input v-model="payMethod" :disabled="!contractNumValue" size="small" type="textarea" rows="1" @blur="contractHeaderChange"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="21">
<el-form-item label="其他说明:">
<el-input v-model="otherInfo" :disabled="!contractNumValue" size="small" type="textarea" rows="1" @blur="contractHeaderChange"/>
</el-form-item>
</el-col>
<el-col :span="1">
<el-button v-if="quickChangePrice" size="mini" style="margin: 10px 0 0 10px" @click="quickChangePrice=!quickChangePrice">快速修改价格</el-button>
<el-button v-else size="mini" style="margin: 10px 0 0 10px" @click="quickChangePrice=!quickChangePrice">还原</el-button>
</el-col>
</el-row>
</el-form>
<el-table :data="tableData1" border style="margin: 10px 0;max-height: 480px;" height="480px" size="mini" show-summary tooltip-effect="dark">
<el-table-column label="序号" align="center" width="50" type="index"/>
<el-table-column label="交货期" align="center" width="150">
<template slot-scope="scope">
<el-date-picker
v-if="quickChangePrice"
v-model="scope.row.交货期"
size="mini"
type="date"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
style="width:100%"/>
<b v-else>{{ scope.row.交货期.split(' ')[0] || '' }}</b>
</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" width="70">
<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.图号 ? scope.row.图号 : '—' }}
</template>
</el-table-column>
<el-table-column label="规格" align="center" min-width="150">
<template slot-scope="scope">
{{ scope.row.规格 ? scope.row.规格 : '—' }}
</template>
</el-table-column>
<el-table-column label="数量" align="center" width="80">
<template slot-scope="scope">
{{ scope.row.数量 }}
</template>
</el-table-column>
<el-table-column label="单位" align="center" width="70">
<template slot-scope="scope">
{{ scope.row.计量单位 }}
</template>
</el-table-column>
<el-table-column v-show="hasTax==='未税'" label="单价(未税)" align="center" width="120">
<template slot-scope="scope">
<el-input v-direction="{x: 0, y: scope.$index}" v-if="hasTax==='未税'" v-model="scope.row.未税单价" size="mini" style="width:100%" @change="priceChange(scope.row.未税单价, scope.row.物料流水号, scope.row.询价单流水号, scope.row, scope.row.零件名称, scope.row.零件图号, scope.row.规格)"/>
<b v-show="hasTax!=='未税'"></b>
</template>
</el-table-column>
<el-table-column v-show="hasTax==='含税'" label="单价(含税)" align="center" width="120">
<template slot-scope="scope">
<el-input v-direction="{x: 0, y: scope.$index}" v-if="hasTax==='含税'" v-model="scope.row.含税单价" size="mini" style="width:100%" @change="priceChange(scope.row.含税单价, scope.row.物料流水号, scope.row.询价单流水号, scope.row, scope.row.零件名称, scope.row.零件图号, scope.row.规格)"/>
<b v-show="hasTax!=='含税'"></b>
</template>
</el-table-column>
<el-table-column label="总额(未税)" align="center" min-width="100" prop="未税总额">
<template slot-scope="scope">
{{ hasTax==='未税' ? scope.row.未税总额 = (Number(scope.row.数量) * Number(scope.row.未税单价)).toFixed(2) : scope.row.未税总额 = (scope.row.含税总额 / (1+taxRate)).toFixed(2) }}
</template>
</el-table-column>
<el-table-column label="总额(含税)" align="center" min-width="100" prop="含税总额">
<template slot-scope="scope">
{{ hasTax==='含税' ? scope.row.含税总额 = (Number(scope.row.数量) * Number(scope.row.含税单价)).toFixed(2) : scope.row.含税总额 = (scope.row.未税总额 * (1+taxRate)).toFixed(2) }}
</template>
</el-table-column>
<el-table-column label="备注" align="center" min-width="80" show-overflow-tooltip>
<template slot-scope="scope">
<el-input v-direction="{x: 1, y: scope.$index}" v-if="quickChangePrice" v-model="scope.row.备注" size="mini" style="width:100%" @change="remarkChange(scope.row.备注, scope.row.物料流水号, scope.row.询价单流水号, scope.row, scope.row.零件名称, scope.row.零件图号, scope.row.规格)"/>
<b v-else>{{ scope.row.备注 || '' }}</b>
</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"/>
<el-radio-button label="模板2" disabled/>
<!--<el-radio-button label="自定义" disabled/>-->
</el-radio-group>
<el-button type="primary" plain size="small" style="margin-left:10px;" @click="editContract()">预览合同</el-button>
<!--<span>②确认合同总额</span>-->
<!--<el-input v-model="actualTotal" size="small" style="width: 100px"/>-->
<!--<el-button type="primary" size="small" @click="submitTotal()">确认</el-button>-->
<span>②递交审批</span>
<el-button type="success" size="small" @click="generateContract()">递交</el-button>
<hr>
<!--html代码-->
<div v-show="false">{{ content }}</div>
<!--富文本编辑器-->
<div v-show="!preview" id="tinymce" style="height:850px;">
<tinymce ref="tinymce" :height="700" v-model="contentNew" style="width:800px;margin: 0 auto"/>
</div>
<!--网页预览-->
<div v-show="preview" class="editor-content" style="min-height:500px;margin: 0px auto;width:800px;border:1px solid black" v-html="content"/>
</el-card>
</div>
</template>
<script>
import Tinymce from '@/components/Tinymce'
import { initSupplier, searchInquirySheet, searchSheetContract, doneContract, searchBaseInfo, savePrice, saveContractHeader, searchContractHeader, saveRemark } from '@/api/PurchasingCenter/CreatePurchaseContract'
import { convertCurrency } from '@/vendor/int2Chinese'
import { mapGetters } from 'vuex'
import { sleep, groupBy } from '@/utils/tool'
import $ from 'jquery'
export default {
components: { Tinymce },
inject: ['reload'],
data() {
return {
quickChangePrice: true,
supplier: [],
year: '',
month: '',
day: '',
trustee: '', // 受托人
bank1: '',
account1: '',
taxCode1: '',
phone1: '',
fax1: '',
postCode1: '',
bank2: '',
account2: '',
taxCode2: '',
phone2: '',
fax2: '',
postCode2: '',
hasTax: '含税',
taxRate: 0.13,
preview: false, // 预览
demoRadio: '', // 模板radio
content: ``, // 合同格式模板
contentNew: ``, // tinymce的
contractName: '采购合同', // 合同名称
contractNum: '', // 合同编号
contractNums: [], // 合同编号数组
contractNumValue: '', // 合同流水号
supplierName: '', // 供应商名称
supplierValue: '', // 供应商流水号
supplierAddress: '', // 供应商地址
legalPerson: '', // 法人
untaxTotal: '', // 未税合计
tax: '', // 税额
taxTotal: '', // 含税合计
actualTotal: '', // 实际金额
actualTotal_zh: '', // 实际金额大写
payDate: '', // 支付日期
payMethod: '', // 支付方式
deliveryDate: '', // 交货日期
invoiceInfo: '', // 开票信息
otherInfo: '', // 其他说明
tableData1: [],
单价是否含税: '',
组件零件流水号组: [],
组件零件基本件流水号组: [],
数量组: [],
单价组: [],
交货期组: [],
备注组: [],
companyAddress: '',
sendAddress: ''
}
},
computed: {
...mapGetters([
'name',
'id'
])
},
created() {
this.fetchData()
this.initDirection()
},
methods: {
initDirection() {
const direction = this.$getDirection()
direction.on('keyup', function(e, val) {
console.log(val)
if (e.keyCode === 39) {
direction.next()
}
if (e.keyCode === 37) {
direction.previous()
}
if (e.keyCode === 38) {
direction.previousLine()
}
if (e.keyCode === 40) {
direction.nextLine()
}
})
},
// 合同头实时保存
contractHeaderChange() {
if (this.contractNumValue) {
saveContractHeader(this.deliveryDate || '', this.invoiceInfo || '', this.payDate || '', this.payMethod || '', this.otherInfo || '', this.contractNumValue).then(res => {
if (res.data[0].result === '1') {
console.log('合同头实时保存成功')
} else {
console.log('合同头实时保存失败')
}
})
}
},
// 备注实时保存
remarkChange(remark, num1, num2, row, num3, num4, num5) {
this.tableData1.map(v => {
v.物料流水号 = v.物料流水号 || ''
v.零件名称 = v.零件名称 || ''
v.零件图号 = v.零件图号 || ''
v.规格 = v.规格 || ''
row.物料流水号 = row.物料流水号 || ''
row.零件名称 = row.零件名称 || ''
row.零件图号 = row.零件图号 || ''
row.规格 = row.规格 || ''
if (Number(v.物料流水号) === Number(row.物料流水号) && Number(v.询价单流水号) === Number(row.询价单流水号) && v.零件名称 === row.零件名称 && v.零件图号 === row.零件图号 && v.规格 === row.规格) {
v.备注 = row.备注
}
})
const group = this.tableData1
this.tableData1 = []
this.tableData1 = group
remark = remark || ''
num1 = num1 || ''
num3 = num3 || ''
num4 = num4 || ''
num5 = num5 || ''
saveRemark(remark, num1, num2, num3, num4, num5).then(res => {
if (res.data[0].result === '1') {
console.log('备注实时保存成功')
} else {
console.log('备注实时保存失败')
}
})
},
// 价格实时保存
priceChange(price, num1, num2, row, num3, num4, num5) {
this.tableData1.map(v => {
v.物料流水号 = v.物料流水号 || ''
v.零件名称 = v.零件名称 || ''
v.零件图号 = v.零件图号 || ''
v.规格 = v.规格 || ''
row.物料流水号 = row.物料流水号 || ''
row.零件名称 = row.零件名称 || ''
row.零件图号 = row.零件图号 || ''
row.规格 = row.规格 || ''
if (Number(v.物料流水号) === Number(row.物料流水号) && Number(v.询价单流水号) === Number(row.询价单流水号) && v.零件名称 === row.零件名称 && v.零件图号 === row.零件图号 && v.规格 === row.规格) {
v.含税单价 = row.含税单价
v.未税单价 = row.未税单价
}
})
const group = this.tableData1
this.tableData1 = []
this.tableData1 = group
price = price || 0
num1 = num1 || ''
num3 = num3 || ''
num4 = num4 || ''
num5 = num5 || ''
savePrice(price, num1, num2, num3, num4, num5).then(res => {
if (res.data[0].result === '1') {
console.log('单价实时保存成功')
} else {
console.log('单价实时保存失败')
}
})
},
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.companyAddress = res.data[0] ? res.data[0].公司地址 : ''
this.sendAddress = res.data[0] ? res.data[0].送货地址 : ''
this.fax2 = res.data[0] ? res.data[0].传真 : ''
this.postCode2 = '224053'
this.phone2 = res.data[0] ? res.data[0].手机 + '/' + res.data[0].公司电话 : ''
this.taxCode2 = res.data[0] ? res.data[0].税号 : ''
this.account2 = res.data[0] ? res.data[0].帐号 : ''
this.bank2 = res.data[0] ? res.data[0].开户行 : ''
})
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].询价单流水号,
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].货期 || '' // 邮编
})
}
})
},
submitTotal() { // 确定合同总额
// this.$refs.tinymce.destroyTinymce()
this.$refs.tinymce.initTinymce()
document.getElementsByClassName('actualTotal')[0].innerHTML = this.actualTotal
document.getElementsByClassName('actualTotal')[1].innerHTML = this.actualTotal
document.getElementById('actualTotal_zh').innerHTML = convertCurrency(this.actualTotal)
this.contentNew = document.getElementsByClassName('editor-content')[0].innerHTML
setTimeout(() => {
this.$refs.tinymce.setContent(this.contentNew)
}, 1000)
// 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
searchContractHeader(this.contractNumValue).then(response => {
this.deliveryDate = response.data[0].交货日期
this.invoiceInfo = response.data[0].开票信息
this.payDate = response.data[0].支付日期
this.payMethod = response.data[0].支付方式
this.otherInfo = response.data[0].其他说明
})
for (let i = 0; i < this.contractNums.length; i++) {
if (this.contractNums[i].value === this.contractNumValue) {
this.supplierName = this.contractNums[i].supplierName
this.supplierValue = this.contractNums[i].supplierValue
this.supplierAddress = this.contractNums[i].supplierAddress
this.legalPerson = this.contractNums[i].legalPerson
this.contractNum = this.contractNums[i].label
this.trustee = this.contractNums[i].trustee
this.bank1 = this.contractNums[i].bank1
this.account1 = this.contractNums[i].account1
this.taxCode1 = this.contractNums[i].taxCode1
this.phone1 = this.contractNums[i].phone1
this.fax1 = this.contractNums[i].fax1
this.postCode1 = this.contractNums[i].postCode1
}
}
this.searchContractDetail()
},
searchContractDetail() { // 查询合同明细
this.tableData1 = []
searchSheetContract(this.contractNumValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.tableData1.push({
询价单流水号: response.data[i].询价单流水号,
物料流水号: response.data[i].物料流水号,
零件名称: response.data[i].零件名称,
零件图号: response.data[i].零件图号,
询价单明细流水号: response.data[i].询价单明细流水号,
机床图号: response.data[i].机床图号 || response.data[i].基本件机床图号,
组号: response.data[i].组号 || response.data[i].基本件组号,
组件零件流水号: response.data[i].组件零件流水号,
组件零件基本件流水号: response.data[i].组件零件基本件流水号,
交货期: response.data[i].组件零件流水号 ? response.data[i].标准件和外购件交货期 : response.data[i].基本件交货期,
图号: response.data[i].组件零件流水号 ? response.data[i].物料型号 : response.data[i].零件图号,
名称: response.data[i].组件零件流水号 ? response.data[i].物料名称 : response.data[i].零件名称,
规格: response.data[i].组件零件流水号 ? response.data[i].物料规格 : response.data[i].规格,
数量: response.data[i].数量,
计量单位: response.data[i].计量单位,
未税单价: response.data[i].单价,
未税总额: 0,
含税单价: response.data[i].单价,
含税总额: 0,
备注: response.data[i].备注
})
}
})
},
demoChange() { // 模板change
switch (this.demoRadio) {
case '模板1':
this.demo1()
break
case '模板2':
this.demo2()
break
// case '自定义':
// this.customization()
// break
}
},
demo1() { // 选择合同模板1
this.content = `
<h2 style="text-align: center;">
<strong>采购合同</strong>
</h2>
<table style="border-collapse: collapse; width: 100%;" border="1">
<tbody>
<tr>
<td style="width: 25%; text-align: center;" rowspan="2">
<h1>
<strong>GAOJING</strong>
</h1>
</td>
<td style="width: 25%;">
<h4 style="text-align: center;">合同名称:</h4>
</td>
<td id="contractName" style="width: 25%;text-align: center;"></td>
<td style="width: 25%;text-align: center;" rowspan="2"></td>
</tr>
<tr>
<td style="width: 25%;">
<h4 style="text-align: center;">合同编号:</h4>
</td>
<td id="contractNum" style="width: 25%;text-align: center;"></td>
</tr>
</tbody>
</table>
<table style="border-collapse: collapse; width: 100%;" border="1">
<tbody>
<tr>
<td style="width: 15%;">买方:</td>
<td style="width: 35%;">江苏高精机电装配有限公司</td>
<td style="width: 15%;">卖方:</td>
<td id="supplierName" style="width: 35%;"></td>
</tr>
<tr>
<td style="width: 15%;">地址:</td>
<td style="width: 35%;">${this.companyAddress}</td>
<td style="width: 15%;">地址:</td>
<td id="supplierAddress" style="width: 35%;"></td>
</tr>
<tr>
<td style="width: 15%;">法定代表人:</td>
<td style="width: 35%;">徐秀兵</td>
<td style="width: 15%;">法定代表人:</td>
<td id="legalPerson" style="width: 35%;"></td>
</tr>
</tbody>
</table>
<p>根据中华人民共和国合同法及相关法律法规,经买卖双方平等协商,就卖方向买方出售合同项下产品事宜达成一致,签订本合同(明细表及合同通用条款)如下:</p>
<table style="border-collapse: collapse; width: 100%;" border="1">
<tbody>
<tr>
<td style="width: 20%;">合同总额RMB</td>
<td class="actualTotal" style="width: 20%;"></td>
<td style="width: 20%;">大写:</td>
<td id="actualTotal_zh" style="width: 40%;"></td>
</tr>
<tr>
<td style="width: 20%;" rowspan="3">交货地点:</td>
<td style="width: 20%;">地址:</td>
<td style="width: 30%;" colspan="2">${this.sendAddress}</td>
</tr>
<tr>
<td style="width: 20%;">联系人:</td>
<td style="width: 30%;" colspan="2">${this.name}</td>
</tr>
<tr>
<td style="width: 20%;">联系电话:</td>
<td style="width: 30%;" colspan="2">${this.phone2}</td>
</tr>
<tr>
<td style="width: 20%;">交货日期:</td>
<td id="deliveryDate" style="width: 30%;" colspan="3"></td>
</tr>
<tr>
<td style="width: 20%;">开票信息:</td>
<td id="invoiceInfo" style="width: 30%;" colspan="3"></td>
</tr>
<tr>
<td style="width: 20%;">支付日期:</td>
<td id="payDate" style="width: 30%;" colspan="3"></td>
</tr>
<tr>
<td style="width: 20%;">支付方式:</td>
<td id="payMethod" style="width: 30%;" colspan="3"></td>
</tr>
<tr>
<td style="width: 20%;">其他说明:</td>
<td id="otherInfo" style="width: 30%;" colspan="3"></td>
</tr>
</tbody>
</table>
<table style="border-collapse: collapse; width: 100%;" border="1">
<tbody>
<tr>
<td style="width: 50%;">
<span>卖方:${this.supplierName}(盖章)</span><br>
<span>受托人:${this.trustee}</span><br>
<span>开户行:${this.bank1}</span><br>
<span>账号:${this.account1}</span><br>
<span>税号:${this.taxCode1}</span><br>
<span>电话:${this.phone1}</span><br>
<span>传真:${this.fax1}</span><br>
<span>邮编:${this.postCode1}</span>
</td>
<td style="width: 50%;">
<span>买方:江苏高精机电装配有限公司(盖章)</span><br>
<span>受托人:${this.name}</span><br>
<span>开户行:${this.bank2}</span><br>
<span>账号:${this.account2}</span><br>
<span>税号:${this.taxCode2}</span><br>
<span>电话:${this.phone2}</span><br>
<span>传真:${this.fax2}</span><br>
<span>邮编:${this.postCode2}</span>
</td>
</tr>
</tbody>
</table>
<p style="text-align: right;">日期_${this.year}_年_${this.month}_月_${this.day}_日</p>
<hr />
<p style="text-align: center;">
<strong>明细表</strong>
(<strong id="hasTax"></strong>)
</p>
<table style="border-collapse: collapse; width: 100%;" border="1">
<tbody id="tbody">
<tr id="tableHead">
<td>序号</td>
<td>机床号-组号</td>
<td>名称</td>
<td>图号或型号</td>
<td>规格</td>
<td>数量</td>
<td>单位</td>
<td>单价</td>
<td>合计</td>
<td>交货时间</td>
<td>备注</td>
</tr>
</tbody>
</table>
<span>未税合计:</span><span id="untaxTotal"></span><span>元</span><br>
<span>税额:</span><span id="tax"></span><br>
<span>含税总价(税率<span id="taxRate"></span></span><span id="taxTotal"></span><span>元</span><br>
<span>优惠后含税总价:</span><span class="actualTotal"></span><span>元</span>
`
},
async editContract() { // 选择一个询价单,整成合同明细
const date = new Date()
this.year = date.getFullYear()
this.month = date.getMonth() + 1
this.day = date.getDate()
this.demoChange()
await sleep(0)
if (this.contractNumValue) {
if (this.demoRadio) {
// this.$refs.tinymce.destroyTinymce()
document.getElementById('contractName') ? document.getElementById('contractName').innerHTML = this.contractName : ''
document.getElementById('contractNum') ? document.getElementById('contractNum').innerHTML = this.contractNum : ''
document.getElementById('supplierName') ? document.getElementById('supplierName').innerHTML = this.supplierName : ''
document.getElementById('supplierAddress') ? document.getElementById('supplierAddress').innerHTML = this.supplierAddress : ''
document.getElementById('legalPerson') ? document.getElementById('legalPerson').innerHTML = this.legalPerson : ''
document.getElementById('payDate') ? document.getElementById('payDate').innerHTML = this.payDate : ''
document.getElementById('payMethod') ? document.getElementById('payMethod').innerHTML = this.payMethod : ''
document.getElementById('invoiceInfo') ? document.getElementById('invoiceInfo').innerHTML = this.invoiceInfo : ''
document.getElementById('deliveryDate') ? document.getElementById('deliveryDate').innerHTML = this.deliveryDate : ''
document.getElementById('otherInfo') ? document.getElementById('otherInfo').innerHTML = this.otherInfo : ''
document.getElementById('hasTax') ? document.getElementById('hasTax').innerHTML = this.hasTax : ''
document.getElementById('taxRate') ? document.getElementById('taxRate').innerHTML = this.taxRate * 100 + '%' : ''
// 明细表
// 移出旧数据
const children = document.getElementsByClassName('tableData')
const parent = document.getElementById('tbody')
if (children.length !== 0) {
for (let i = children.length - 1; i >= 0; i--) {
parent.removeChild(children[i])
}
}
const merge = []
this.tableData1.map(v => {
if ((this.hasTax === '含税' && Number(v.含税单价)) || (this.hasTax === '未税' && Number(v.未税单价))) { // 筛掉未询到价格的物料
merge.push({
机床图号: v.机床图号,
组号: v.组号,
图号: v.图号,
名称: v.名称,
规格: v.规格,
数量: Number(v.数量),
计量单位: v.计量单位,
单价: this.hasTax === '含税' ? v.含税单价 : v.未税单价,
合计: (Number(v.数量) * (this.hasTax === '含税' ? Number(v.含税单价) : Number(v.未税单价))).toFixed(2),
交货期: v.交货期 ? v.交货期.split(' ')[0] : '',
备注: v.备注
})
}
})
let mergeData = []
mergeData = groupBy(merge, ['图号', '名称', '规格', '计量单位', '单价', '交货期', '备注'])
// 放入新数据
const tr = []
for (let i = 0; i < mergeData.length; i++) {
tr[i] = document.createElement('tr')
tr[i].setAttribute('class', 'tableData')
tr[i].innerHTML = '<td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td>'
const tableHead = $('#tableHead')
tableHead ? tableHead.after(tr[i]) : ''
}
this.actualTotal = 0
this.untaxTotal = 0
this.taxTotal = 0
for (let j = 0; j < this.tableData1.length; j++) {
this.actualTotal += Number(this.tableData1[j].含税总额)
this.untaxTotal += Number(this.tableData1[j].未税总额)
this.taxTotal += Number(this.tableData1[j].含税总额)
}
for (let j = 0; j < mergeData.length; j++) {
if (document.getElementsByClassName('tableData')[j]) {
document.getElementsByClassName('tableData')[j].children[0].innerHTML = j + 1
document.getElementsByClassName('tableData')[j].children[1].innerHTML = mergeData[j].机床图号_组号
document.getElementsByClassName('tableData')[j].children[2].innerHTML = mergeData[j].名称
document.getElementsByClassName('tableData')[j].children[3].innerHTML = mergeData[j].图号
document.getElementsByClassName('tableData')[j].children[4].innerHTML = mergeData[j].规格
document.getElementsByClassName('tableData')[j].children[5].innerHTML = mergeData[j].数量
document.getElementsByClassName('tableData')[j].children[6].innerHTML = mergeData[j].计量单位
document.getElementsByClassName('tableData')[j].children[7].innerHTML = mergeData[j].单价
document.getElementsByClassName('tableData')[j].children[8].innerHTML = (Number(mergeData[j].数量) * Number(mergeData[j].单价)).toFixed(2)
document.getElementsByClassName('tableData')[j].children[9].innerHTML = mergeData[j].交货期
document.getElementsByClassName('tableData')[j].children[10].innerHTML = mergeData[j].备注
}
}
this.actualTotal = this.actualTotal.toFixed(2)
this.untaxTotal = this.untaxTotal.toFixed(2)
this.taxTotal = this.taxTotal.toFixed(2)
this.tax = (this.taxTotal - this.untaxTotal).toFixed(2)
document.getElementById('untaxTotal') ? document.getElementById('untaxTotal').innerHTML = this.untaxTotal : ''
document.getElementById('tax') ? document.getElementById('tax').innerHTML = this.tax : ''
document.getElementById('taxTotal') ? document.getElementById('taxTotal').innerHTML = this.taxTotal : ''
document.getElementsByClassName('actualTotal')[0] ? document.getElementsByClassName('actualTotal')[0].innerHTML = this.actualTotal : ''
document.getElementsByClassName('actualTotal')[1] ? document.getElementsByClassName('actualTotal')[1].innerHTML = this.actualTotal : ''
document.getElementById('actualTotal_zh') ? document.getElementById('actualTotal_zh').innerHTML = this.actualTotal_zh : ''
document.getElementsByClassName('actualTotal')[0].innerHTML = this.actualTotal
document.getElementsByClassName('actualTotal')[1].innerHTML = this.actualTotal
document.getElementById('actualTotal_zh').innerHTML = convertCurrency(this.actualTotal)
this.contentNew = document.getElementsByClassName('editor-content')[0].innerHTML
this.$refs.tinymce.initTinymce()
setTimeout(() => {
this.$refs.tinymce.setContent(this.contentNew)
}, 1000)
} else {
this.$message.warning('请先选择合同模板,再预览')
}
} else {
this.$message.warning('请先选择合同,再预览')
}
},
demo2() {
this.content = `demo2`
},
// customization() { // 自定义
// this.content = `自定义`
// },
generateContract() { // 生成采购合同
this.content = this.contentNew.replace(/&nbsp;/g, '')
this.content = this.content.replace(/\n/g, '')
this.content = this.content.replace(/==/g, '= =') // 更新tinymce中的东西到html中后续会用到
this.组件零件流水号组 = []
this.组件零件基本件流水号组 = []
this.数量组 = []
this.单价组 = []
this.交货期组 = []
this.hasTax === '含税' ? this.单价是否含税 = 1 : this.单价是否含税 = 0
const inquiryDetailNum_old = [] // 需要转移到新询价单的物料的询价单明细流水号
this.tableData1.map(v => {
if ((this.hasTax === '含税' && Number(v.含税单价)) || (this.hasTax === '未税' && Number(v.未税单价))) { // 筛掉未询到价格的物料
this.组件零件流水号组.push(v.组件零件流水号)
this.组件零件基本件流水号组.push(v.组件零件基本件流水号)
this.数量组.push(v.数量)
this.hasTax === '含税' ? this.单价组.push(v.含税单价) : this.单价组.push(v.未税单价)
this.交货期组.push(v.交货期)
this.备注组.push(v.备注)
} else { // 获取未询到价格的物料的询价单明细流水号们
inquiryDetailNum_old.push(v.询价单明细流水号)
}
})
if (this.contractNumValue) {
this.$confirm('此采购合同将递交审批,递交后该合同不可删除,确认完成编辑?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
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, this.taxRate * 100, inquiryDetailNum_old, this.备注组).then(response => {
if (response.data[0].result === '1') {
this.$message.success('合同生成成功')
this.reload()
} else { this.$message.error('生成合同失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消操作'
})
})
} else {
this.$message.warning('请先选择合同进行编辑')
}
}
}
}
</script>
<style scoped>
.editor-content{
margin-top: 20px;
}
span{
margin: 0 0 0 20px;
}
.el-form-item{
margin: 0;
}
</style>

View File

@@ -0,0 +1,385 @@
<template>
<div class="app-container">
<el-card>
<h3 style="margin-top: 0">采购合同</h3>
<el-table v-loading="" :data="tableData1" border style="width: 100%;max-height: 300px;" height="300px" size="mini">
<el-table-column label="供应商" align="center" min-width="170">
<template slot-scope="scope">
{{ scope.row.供应商名称 }}
</template>
</el-table-column>
<el-table-column label="请款时间" align="center" min-width="150">
<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" prop="请款金额">
<template slot-scope="scope">
{{ scope.row.请款金额 }}
</template>
</el-table-column>
<el-table-column label="审核" align="center" width="320">
<template slot-scope="scope">
<el-popover placement="right" width="400" trigger="click">
<el-table :data="gridData1" stripe size="mini" highlight-current-row show-summary @row-click="searchContactDetail">
<el-table-column width="50" align="center" type="index" label="序号"/>
<el-table-column min-width="150" align="center" label="采购合同编号">
<template slot-scope="scope">
{{ scope.row.采购合同编号 }}
</template>
</el-table-column>
<el-table-column min-width="100" 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" style="margin-right: 10px" @click="searchTable01(scope.row)">查看详情</el-button>
</el-popover>
<el-button type="primary" size="mini" icon="el-icon-check" @click="yesApproval(scope.row)">通过</el-button>
<el-button type="danger" size="mini" icon="el-icon-close" @click="noApproval(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"
style="display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/>
</div>
</el-card>
<el-card>
<h3 style="margin-top: 0">离线合同</h3>
<el-table v-loading="" :data="tableData2" border style="width: 100%;max-height: 300px;" height="300px" size="mini">
<el-table-column label="供应商" align="center" min-width="170">
<template slot-scope="scope">
{{ scope.row.供应商名称 }}
</template>
</el-table-column>
<el-table-column label="请款时间" align="center" min-width="150">
<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" prop="请款金额">
<template slot-scope="scope">
{{ scope.row.请款金额 }}
</template>
</el-table-column>
<el-table-column label="审核" align="center" width="320">
<template slot-scope="scope">
<el-popover placement="right" width="400" trigger="click">
<el-table :data="gridData2" stripe size="mini" show-summary highlight-current-row @row-click="searchOfflineContactDetail">
<el-table-column width="50" align="center" type="index" label="序号"/>
<el-table-column min-width="150" align="center" label="离线合同编号">
<template slot-scope="scope">
{{ scope.row.离线合同编号 }}
</template>
</el-table-column>
<el-table-column min-width="100" 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" style="margin-right: 10px" @click="searchTable02(scope.row)">查看详情</el-button>
</el-popover>
<el-button type="primary" size="mini" icon="el-icon-check" @click="yesApprovalOffline(scope.row)">通过</el-button>
<el-button type="danger" size="mini" icon="el-icon-close" @click="noApprovalOffline(scope.row)">不通过</el-button>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent2"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize2"
:total="total2"
style="display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange2"
@current-change="handleCurrentChange2"/>
</div>
</el-card>
<h3 style="margin-top: 0">采购合同</h3>
<div id="print" class="print" style="background-color:white;min-height:500px;margin: 0px auto;width:800px;border:1px solid black" v-html="contractDetail1"/>
<h3 style="">离线合同</h3>
<el-table v-loading="" :data="contractDetail2" :summary-method="getSummaries" border style="margin-top:10px;max-height: 500px;" height="500px" size="mini" show-summary>
<el-table-column label="离线合同编号" align="center" min-width="150">
<template slot-scope="scope">
{{ scope.row.离线合同编号 }}
</template>
</el-table-column>
<el-table-column label="物料名称" align="center" min-width="150">
<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="80">
<template slot-scope="scope">
{{ scope.row.数量 }}
</template>
</el-table-column>
<el-table-column label="单价" align="center" min-width="80" prop="单价">
<template slot-scope="scope">
{{ scope.row.单价 }}
</template>
</el-table-column>
<el-table-column label="合计" align="center" min-width="80" prop="合计">
<template slot-scope="scope">
{{ 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">
{{ scope.row.交货期要求 }}
</template>
</el-table-column>
<el-table-column label="备注" align="center" min-width="80" prop="备注">
<template slot-scope="scope">
{{ scope.row.备注 }}
</template>
</el-table-column>
</el-table>
</div>
</template>
<script>
import { initApproval, execApproval, initApprovalOffline, searchRequsetFundDetail1, searchRequsetFundDetail2, execApprovalOffline, searchContactDetail, searchMateriel } from '@/api/PurchasingCenter/FundApproval'
import { mapGetters } from 'vuex'
export default {
name: '', // 管理审核
data() {
return {
contractDetail1: '',
contractDetail2: [],
tableData1: [],
pageSize1: 10,
pageCurrent1: 1,
total1: 0,
tableData2: [],
pageSize2: 10,
pageCurrent2: 1,
total2: 0,
gridData1: [],
gridData2: []
}
},
computed: {
...mapGetters([
'sidebar',
'avatar',
'name',
'id' // 人员编号
])
},
created() {
this.fetchData()
},
methods: {
searchContactDetail(row) {
searchContactDetail(row.采购合同流水号).then(response => {
this.contractDetail1 = response.data[0].合同内容
})
},
searchOfflineContactDetail(row) { // 查询离线合同明细
searchMateriel(row.离线合同流水号).then(response => {
this.contractDetail2 = response.data
})
},
getSummaries(param) { // 合计
const { columns, data } = param
const sums = []
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '总价'
} else if (index === 7) {
const values = data.map(item => Number(parseFloat(item['单价']) * parseInt(item['数量'])))
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)
sums[index] += ' 元'
} else {
sums[index] = 'N/A'
}
}
})
return sums
},
fetchData() {
this.searchTable1()
this.searchTable2()
},
searchTable1() {
initApproval(this.pageCurrent1, this.pageSize1, 0).then(response => {
console.log(response.data)
this.tableData1 = response.data.rows
this.total1 = response.data.total
})
},
handleSizeChange1(val) {
this.pageSize1 = val
this.pageCurrent1 = 1
this.searchTable1()
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.searchTable1()
},
searchTable2() {
initApprovalOffline(this.pageCurrent2, this.pageSize2, 0).then(response => {
console.log(response.data.rows)
this.tableData2 = response.data.rows
this.total2 = response.data.total
})
},
handleSizeChange2(val) {
this.pageSize2 = val
this.pageCurrent2 = 1
this.searchTable2()
},
handleCurrentChange2(val) {
this.pageCurrent2 = val
this.searchTable2()
},
searchTable01(row) { // 查看详情(请款信息包含的合同)
searchRequsetFundDetail1(row.采购合同请款流水号).then(response => {
this.gridData1 = response.data
})
},
searchTable02(row) { // 查看详情(请款信息包含的合同)
searchRequsetFundDetail2(row.离线合同请款流水号).then(response => {
this.gridData2 = response.data
})
},
yesApproval(row) { // 通过审核
this.$confirm('确定审核通过?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
execApproval(row.采购合同请款流水号, 1, '通过', this.id, 0).then(response => {
if (response.data[0].result === '1') {
this.$message.success('执行成功')
this.searchTable1()
} else { this.$message.error('执行失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '取消操作'
})
})
},
noApproval(row) { // 不通过审核
this.$prompt('请输入不通过原因', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(({ value }) => {
execApproval(row.采购合同请款流水号, 2, value, this.id, 0).then(response => {
if (response.data[0].result === '1') {
this.$message.success('执行成功')
this.searchTable1()
} else { this.$message.error('执行失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '取消操作'
})
})
},
yesApprovalOffline(row) { // 通过审核
this.$confirm('确定审核通过?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
execApprovalOffline(row.离线合同请款流水号, 1, '通过', this.id, 0).then(response => {
if (response.data[0].result === '1') {
this.$message.success('执行成功')
this.searchTable2()
} else { this.$message.error('执行失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '取消操作'
})
})
},
noApprovalOffline(row) { // 不通过审核
this.$prompt('请输入不通过原因', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(({ value }) => {
execApprovalOffline(row.离线合同请款流水号, 2, value, this.id, 0).then(response => {
if (response.data[0].result === '1') {
this.$message.success('执行成功')
this.searchTable2()
} else { this.$message.error('执行失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '取消操作'
})
})
}
}
}
</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
}
</style>

View File

@@ -0,0 +1,466 @@
<template>
<div class="app-container">
<el-card>
<h3 style="margin-top: 0">采购合同</h3>
<el-table v-loading="" :data="tableData1" border style="width: 100%;max-height: 300px;" height="300px" size="mini">
<el-table-column label="供应商" align="center" min-width="170">
<template slot-scope="scope">
{{ scope.row.供应商名称 }}
</template>
</el-table-column>
<el-table-column label="请款时间" align="center" min-width="150">
<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" prop="请款金额">
<template slot-scope="scope">
{{ scope.row.请款金额 }}
</template>
</el-table-column>
<el-table-column label="审核" align="center" width="320">
<template slot-scope="scope">
<el-popover placement="right" width="400" trigger="click">
<el-table :data="gridData1" stripe size="mini" highlight-current-row show-summary @row-click="searchContactDetail">
<el-table-column width="50" align="center" type="index" label="序号"/>
<el-table-column min-width="150" align="center" label="采购合同编号">
<template slot-scope="scope">
{{ scope.row.采购合同编号 }}
</template>
</el-table-column>
<el-table-column min-width="100" 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" style="margin-right: 10px" @click="searchTable01(scope.row)">查看详情</el-button>
</el-popover>
<el-button type="primary" size="mini" icon="el-icon-check" @click="yesApproval(scope.row)">通过</el-button>
<el-button type="danger" size="mini" icon="el-icon-close" @click="noApproval(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"
style="display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/>
</div>
</el-card>
<el-card>
<h3 style="margin-top: 0">离线合同</h3>
<el-table v-loading="" :data="tableData2" border style="width: 100%;max-height: 300px;" height="300px" size="mini">
<el-table-column label="供应商" align="center" min-width="170">
<template slot-scope="scope">
{{ scope.row.供应商名称 }}
</template>
</el-table-column>
<el-table-column label="请款时间" align="center" min-width="150">
<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" prop="请款金额">
<template slot-scope="scope">
{{ scope.row.请款金额 }}
</template>
</el-table-column>
<el-table-column label="审核" align="center" width="320">
<template slot-scope="scope">
<el-popover placement="right" width="400" trigger="click">
<el-table :data="gridData2" stripe size="mini" highlight-current-row show-summary @row-click="searchOfflineContactDetail">
<el-table-column width="50" align="center" type="index" label="序号"/>
<el-table-column min-width="150" align="center" label="离线合同编号">
<template slot-scope="scope">
{{ scope.row.离线合同编号 }}
</template>
</el-table-column>
<el-table-column min-width="100" 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" style="margin-right: 10px" @click="searchTable02(scope.row)">查看详情</el-button>
</el-popover>
<el-button type="primary" size="mini" icon="el-icon-check" @click="yesApprovalOffline(scope.row)">通过</el-button>
<el-button type="danger" size="mini" icon="el-icon-close" @click="noApprovalOffline(scope.row)">不通过</el-button>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent2"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize2"
:total="total2"
style="display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange2"
@current-change="handleCurrentChange2"/>
</div>
</el-card>
<h3 id="firstAnchor" style="margin-top: 0">采购合同</h3>
<div id="print" class="print" style="background-color:white;min-height:500px;margin: 0px auto;width:800px;border:1px solid black" v-html="contractDetail1"/><hr>
<h3 id="secondAnchor" style="">离线合同</h3>
<div id="offlineContract" style="background-color:white;min-height:500px;margin: 0 auto;width: 800px;border:1px solid black">
<table v-show="contractDetail2.length > 0" class="offlineContract" cellspacing="0px" align="center" border="1 solid black" width="100%">
<tr>
<th colspan="14"><h1>离线合同</h1></th>
</tr>
<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="2" style="text-align: left;"/>
<td width="80px">供应商</td>
<td id="supplier" colspan="5" style="text-align: left;"/>
<td id="qrCode" colspan="2" rowspan="2"/>
</tr>
<tr>
<td width="80px">合同编号</td>
<td id="contractNum" colspan="2" style="text-align: left;"/>
<td width="80px">采购员</td>
<td id="buyer" colspan="5" style="text-align: left;"/>
</tr>
<tr id="tablehead">
<td width="50px">序号</td>
<td colspan="2">名称</td>
<td>规格</td>
<td colspan="2">型号</td>
<td>数量</td>
<td colspan="2">单价</td>
<td colspan="2">合计</td>
<td>交货期</td>
<td colspan="2">备注</td>
</tr>
<tr>
<td>总计</td>
<td id="remark" colspan="10"/>
<td id="total" colspan="2" style="text-align: left;"/>
<td/>
</tr>
</table>
</div>
<!--
<el-table v-loading="" :data="contractDetail2" :summary-method="getSummaries" border style="margin-top:10px;max-height: 500px;" height="500px" size="mini" show-summary>
<el-table-column label="离线合同编号" align="center" min-width="150">
<template slot-scope="scope">
{{ scope.row.离线合同编号 }}
</template>
</el-table-column>
<el-table-column label="物料名称" align="center" min-width="150">
<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="80">
<template slot-scope="scope">
{{ scope.row.数量 }}
</template>
</el-table-column>
<el-table-column label="单价" align="center" min-width="80" prop="单价">
<template slot-scope="scope">
{{ scope.row.单价 }}
</template>
</el-table-column>
<el-table-column label="合计" align="center" min-width="80" prop="合计">
<template slot-scope="scope">
{{ 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">
{{ scope.row.交货期要求 }}
</template>
</el-table-column>
<el-table-column label="备注" align="center" min-width="80" prop="备注">
<template slot-scope="scope">
{{ scope.row.备注 }}
</template>
</el-table-column>
</el-table>
-->
</div>
</template>
<script>
import { initApproval, execApproval, initApprovalOffline, searchRequsetFundDetail1, searchRequsetFundDetail2, execApprovalOffline, searchContactDetail, searchMateriel } from '@/api/PurchasingCenter/FundApproval'
import { mapGetters } from 'vuex'
import $ from 'jquery'
export default {
name: '', // 管理审批
data() {
return {
contractDetail1: '',
contractDetail2: [],
tableData1: [],
pageSize1: 10,
pageCurrent1: 1,
total1: 0,
tableData2: [],
pageSize2: 10,
pageCurrent2: 1,
total2: 0,
gridData1: [],
gridData2: []
}
},
computed: {
...mapGetters([
'sidebar',
'avatar',
'name',
'id' // 人员编号
])
},
created() {
this.fetchData()
},
methods: {
showOffline(row) {
console.log(row, 222)
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 = []
let length = 0
this.contractDetail2.length < 15 ? length = 15 : length = this.contractDetail2.length
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 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"/>`
$('#tablehead').after(tr[i])
}
let total = 0
for (let j = 0; j < this.contractDetail2.length; j++) {
document.getElementsByClassName('tableData')[j].children[0].innerHTML = j + 1
document.getElementsByClassName('tableData')[j].children[1].innerHTML = this.contractDetail2[j].物料名称
document.getElementsByClassName('tableData')[j].children[2].innerHTML = this.contractDetail2[j].物料规格
document.getElementsByClassName('tableData')[j].children[3].innerHTML = this.contractDetail2[j].物料型号
document.getElementsByClassName('tableData')[j].children[4].innerHTML = this.contractDetail2[j].数量
document.getElementsByClassName('tableData')[j].children[5].innerHTML = this.contractDetail2[j].单价
document.getElementsByClassName('tableData')[j].children[6].innerHTML = (this.contractDetail2[j].数量 * this.contractDetail2[j].单价).toFixed(2)
document.getElementsByClassName('tableData')[j].children[7].innerHTML = this.contractDetail2[j].交货期要求
document.getElementsByClassName('tableData')[j].children[8].innerHTML = this.contractDetail2[j].备注
total += Number(this.contractDetail2[j].数量 * this.contractDetail2[j].单价)
}
total = total.toFixed(2)
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
document.getElementById('remark').innerHTML = row.离线合同备注
},
searchContactDetail(row) {
document.documentElement.scrollTop = this.$el.querySelector('#firstAnchor').offsetTop
searchContactDetail(row.采购合同流水号).then(response => {
this.contractDetail1 = response.data[0].合同内容
})
},
searchOfflineContactDetail(row) { // 查询离线合同明细
document.documentElement.scrollTop = this.$el.querySelector('#secondAnchor').offsetTop
searchMateriel(row.离线合同流水号).then(response => {
this.contractDetail2 = response.data
this.showOffline(row)
})
},
getSummaries(param) { // 合计
const { columns, data } = param
const sums = []
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '总价'
} else if (index === 7) {
const values = data.map(item => Number(parseFloat(item['单价']) * parseInt(item['数量'])))
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)
sums[index] += ' 元'
} else {
sums[index] = 'N/A'
}
}
})
return sums
},
fetchData() {
this.searchTable1()
this.searchTable2()
},
searchTable1() {
initApproval(this.pageCurrent1, this.pageSize1, 1).then(response => {
this.tableData1 = response.data.rows
this.total1 = response.data.total
})
},
handleSizeChange1(val) {
this.pageSize1 = val
this.pageCurrent1 = 1
this.searchTable1()
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.searchTable1()
},
searchTable2() {
initApprovalOffline(this.pageCurrent2, this.pageSize2, 1).then(response => {
this.tableData2 = response.data.rows
this.total2 = response.data.total
})
},
handleSizeChange2(val) {
this.pageSize2 = val
this.pageCurrent2 = 1
this.searchTable2()
},
handleCurrentChange2(val) {
this.pageCurrent2 = val
this.searchTable2()
},
searchTable01(row) { // 查看详情(请款信息包含的合同)
searchRequsetFundDetail1(row.采购合同请款流水号).then(response => {
this.gridData1 = response.data
})
},
searchTable02(row) { // 查看详情(请款信息包含的合同)
searchRequsetFundDetail2(row.离线合同请款流水号).then(response => {
this.gridData2 = response.data
})
},
yesApproval(row) { // 通过审批
this.$confirm('确定审批通过?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
execApproval(row.采购合同请款流水号, 1, '通过', this.id, 1).then(response => {
if (response.data[0].result === '1') {
this.$message.success('执行成功')
this.searchTable1()
} else { this.$message.error('执行失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '取消操作'
})
})
},
noApproval(row) { // 不通过审批
this.$prompt('请输入不通过原因', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(({ value }) => {
execApproval(row.采购合同请款流水号, 2, value, this.id, 1).then(response => {
if (response.data[0].result === '1') {
this.$message.success('执行成功')
this.searchTable1()
} else { this.$message.error('执行失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '取消操作'
})
})
},
yesApprovalOffline(row) { // 通过审核
this.$confirm('确定审核通过?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
execApprovalOffline(row.离线合同请款流水号, 1, '通过', this.id, 1).then(response => {
if (response.data[0].result === '1') {
this.$message.success('执行成功')
this.searchTable2()
} else { this.$message.error('执行失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '取消操作'
})
})
},
noApprovalOffline(row) { // 不通过审核
this.$prompt('请输入不通过原因', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(({ value }) => {
execApprovalOffline(row.离线合同请款流水号, 2, value, this.id, 1).then(response => {
if (response.data[0].result === '1') {
this.$message.success('执行成功')
this.searchTable2()
} else { this.$message.error('执行失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '取消操作'
})
})
}
}
}
</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
}
</style>

View File

@@ -0,0 +1,385 @@
<template>
<div class="app-container">
<el-card>
<h3 style="margin-top: 0">采购合同</h3>
<el-table v-loading="" :data="tableData1" border style="width: 100%;max-height: 300px;" height="300px" size="mini">
<el-table-column label="供应商" align="center" min-width="170">
<template slot-scope="scope">
{{ scope.row.供应商名称 }}
</template>
</el-table-column>
<el-table-column label="请款时间" align="center" min-width="150">
<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" prop="请款金额">
<template slot-scope="scope">
{{ scope.row.请款金额 }}
</template>
</el-table-column>
<el-table-column label="审核" align="center" width="320">
<template slot-scope="scope">
<el-popover placement="right" width="400" trigger="click">
<el-table :data="gridData1" stripe size="mini" show-summary highlight-current-row @row-click="searchContactDetail">
<el-table-column width="50" align="center" type="index" label="序号"/>
<el-table-column min-width="150" align="center" label="采购合同编号">
<template slot-scope="scope">
{{ scope.row.采购合同编号 }}
</template>
</el-table-column>
<el-table-column min-width="100" 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" style="margin-right: 10px" @click="searchTable01(scope.row)">查看详情</el-button>
</el-popover>
<el-button type="primary" size="mini" icon="el-icon-check" @click="yesApproval(scope.row)">通过</el-button>
<el-button type="danger" size="mini" icon="el-icon-close" @click="noApproval(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"
style="display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/>
</div>
</el-card>
<el-card>
<h3 style="margin-top: 0">离线合同</h3>
<el-table v-loading="" :data="tableData2" border style="width: 100%;max-height: 300px;" height="300px" size="mini">
<el-table-column label="供应商" align="center" min-width="170">
<template slot-scope="scope">
{{ scope.row.供应商名称 }}
</template>
</el-table-column>
<el-table-column label="请款时间" align="center" min-width="150">
<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" prop="请款金额">
<template slot-scope="scope">
{{ scope.row.请款金额 }}
</template>
</el-table-column>
<el-table-column label="付款" align="center" width="320">
<template slot-scope="scope">
<el-popover placement="right" width="400" trigger="click">
<el-table :data="gridData2" stripe size="mini" show-summary highlight-current-row @row-click="searchOfflineContactDetail">
<el-table-column width="50" align="center" type="index" label="序号"/>
<el-table-column min-width="150" align="center" label="离线合同编号">
<template slot-scope="scope">
{{ scope.row.离线合同编号 }}
</template>
</el-table-column>
<el-table-column min-width="100" 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" style="margin-right: 10px" @click="searchTable02(scope.row)">查看详情</el-button>
</el-popover>
<el-button type="primary" size="mini" icon="el-icon-check" @click="yesApprovalOffline(scope.row)">通过</el-button>
<el-button type="danger" size="mini" icon="el-icon-close" @click="noApprovalOffline(scope.row)">不通过</el-button>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent2"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize2"
:total="total2"
style="display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange2"
@current-change="handleCurrentChange2"/>
</div>
</el-card>
<h3 style="margin-top: 0">采购合同</h3>
<div id="print" class="print" style="min-height:500px;margin: 0px auto;width:800px;border:1px solid black" v-html="contractDetail1"/>
<h3 style="">离线合同</h3>
<el-table v-loading="" :data="contractDetail2" :summary-method="getSummaries" border style="margin-top:10px;max-height: 500px;" height="500px" size="mini" show-summary>
<el-table-column label="离线合同编号" align="center" min-width="150">
<template slot-scope="scope">
{{ scope.row.离线合同编号 }}
</template>
</el-table-column>
<el-table-column label="物料名称" align="center" min-width="150">
<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="80">
<template slot-scope="scope">
{{ scope.row.数量 }}
</template>
</el-table-column>
<el-table-column label="单价" align="center" min-width="80" prop="单价">
<template slot-scope="scope">
{{ scope.row.单价 }}
</template>
</el-table-column>
<el-table-column label="合计" align="center" min-width="80" prop="合计">
<template slot-scope="scope">
{{ 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">
{{ scope.row.交货期要求 }}
</template>
</el-table-column>
<el-table-column label="备注" align="center" min-width="80" prop="备注">
<template slot-scope="scope">
{{ scope.row.备注 }}
</template>
</el-table-column>
</el-table>
</div>
</template>
<script>
import { initApproval, execApproval, initApprovalOffline, searchRequsetFundDetail1, searchRequsetFundDetail2, execApprovalOffline, searchContactDetail, searchMateriel } from '@/api/PurchasingCenter/FundApproval'
import { mapGetters } from 'vuex'
export default {
name: '', // 出纳付款
data() {
return {
contractDetail1: '',
contractDetail2: [],
tableData1: [],
pageSize1: 10,
pageCurrent1: 1,
total1: 0,
tableData2: [],
pageSize2: 10,
pageCurrent2: 1,
total2: 0,
gridData1: [],
gridData2: []
}
},
computed: {
...mapGetters([
'sidebar',
'avatar',
'name',
'id' // 人员编号
])
},
created() {
this.fetchData()
},
methods: {
searchContactDetail(row) {
searchContactDetail(row.采购合同流水号).then(response => {
this.contractDetail1 = response.data[0].合同内容
})
},
searchOfflineContactDetail(row) { // 查询离线合同明细
searchMateriel(row.离线合同流水号).then(response => {
this.contractDetail2 = response.data
})
},
getSummaries(param) { // 合计
const { columns, data } = param
const sums = []
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '总价'
} else if (index === 7) {
const values = data.map(item => Number(parseFloat(item['单价']) * parseInt(item['数量'])))
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)
sums[index] += ' 元'
} else {
sums[index] = 'N/A'
}
}
})
return sums
},
fetchData() {
this.searchTable1()
this.searchTable2()
},
searchTable1() {
initApproval(this.pageCurrent1, this.pageSize1, 2).then(response => {
this.tableData1 = response.data.rows
this.total1 = response.data.total
})
},
handleSizeChange1(val) {
this.pageSize1 = val
this.pageCurrent1 = 1
this.searchTable1()
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.searchTable1()
},
searchTable2() {
initApprovalOffline(this.pageCurrent2, this.pageSize2, 2).then(response => {
console.log(response.data.rows)
this.tableData2 = response.data.rows
this.total2 = response.data.total
})
},
handleSizeChange2(val) {
this.pageSize2 = val
this.pageCurrent2 = 1
this.searchTable2()
},
handleCurrentChange2(val) {
this.pageCurrent2 = val
this.searchTable2()
},
searchTable01(row) { // 查看详情(请款信息包含的合同)
searchRequsetFundDetail1(row.采购合同请款流水号).then(response => {
this.gridData1 = response.data
})
},
searchTable02(row) { // 查看详情(请款信息包含的合同)
searchRequsetFundDetail2(row.离线合同请款流水号).then(response => {
this.gridData2 = response.data
})
},
yesApproval(row) { // 通过付款
this.$confirm('确定付款通过?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
execApproval(row.采购合同请款流水号, 1, '通过', this.id, 2).then(response => {
if (response.data[0].result === '1') {
this.$message.success('执行成功')
// 记录付款金额及时间
this.searchTable1()
} else { this.$message.error('执行失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '取消操作'
})
})
},
noApproval(row) { // 不通过付款
this.$prompt('请输入不通过原因', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(({ value }) => {
execApproval(row.采购合同请款流水号, 2, value, this.id, 2).then(response => {
if (response.data[0].result === '1') {
this.$message.success('执行成功')
this.searchTable1()
} else { this.$message.error('执行失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '取消操作'
})
})
},
yesApprovalOffline(row) { // 通过审核
this.$confirm('确定审核通过?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
execApprovalOffline(row.离线合同请款流水号, 1, '通过', this.id, 2).then(response => {
if (response.data[0].result === '1') {
this.$message.success('执行成功')
this.searchTable2()
} else { this.$message.error('执行失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '取消操作'
})
})
},
noApprovalOffline(row) { // 不通过审核
this.$prompt('请输入不通过原因', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(({ value }) => {
execApprovalOffline(row.离线合同请款流水号, 2, value, this.id, 2).then(response => {
if (response.data[0].result === '1') {
this.$message.success('执行成功')
this.searchTable2()
} else { this.$message.error('执行失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '取消操作'
})
})
}
}
}
</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
}
</style>

View File

@@ -0,0 +1,701 @@
<template>
<div class="app-container">
<el-card>
<div slot="header">
<span>发票号:</span>
<el-input v-model="invoiceNum" placeholder="发票号" size="small" clearable/>
<el-button type="success" size="small" icon="el-icon-search" style="margin-left:10px" @click="tableData2=[];total1=0;pageCurrent1=1;pageSize1=10;searchTable1()">查询</el-button>
<el-button type="primary" size="small" icon="el-icon-circle-plus-outline" style="margin-left:10px" @click="createOrder()">创建</el-button>
</div>
<h4 style="margin-top: 5px">发票结算申请单</h4>
<el-table id="expandTable" :data="tableData1" border highlight-current-row style="width: 100%;height: 300px;overflow:auto" size="mini" @row-click="searchTable2">
<el-table-column type="expand">
<template slot-scope="scope">
<el-form label-position="left" inline class="demo-table-expand">
<el-row>
<el-col :lg="10" :sm="12">
<viewer>
<img :src="scope.row.scanSrc" alt="发票扫描件" height="120px">
</viewer>
</el-col>
<el-col :span="6">
<el-form-item label="已付款项">
<span>{{ scope.row.已付款项 }}</span>
</el-form-item><br>
<el-form-item label="尚欠金额">
<span>{{ scope.row.尚欠金额 }}</span>
</el-form-item><br>
<el-form-item label="备注">
<span>{{ scope.row.备注 }}</span>
</el-form-item><br>
</el-col>
<el-col :span="6">
<el-form-item label="是否费用类发票">
<span>{{ scope.row.是否费用类 }}</span>
</el-form-item><br>
<el-form-item label="税额">
<span>{{ scope.row.税额 }}</span>
</el-form-item>
</el-col>
</el-row>
</el-form>
</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="90">
<template slot-scope="scope">
{{ scope.row.发票号 }}
</template>
</el-table-column>
<el-table-column label="发票金额" align="center" min-width="70">
<template slot-scope="scope">
{{ scope.row.发票金额 }}
</template>
</el-table-column>
<el-table-column label="申请人" align="center" min-width="60">
<template slot-scope="scope">
{{ scope.row.申请人姓名 ? scope.row.申请人姓名 : '未提交' }}
</template>
</el-table-column>
<el-table-column label="申请时间" align="center" min-width="115">
<template slot-scope="scope">
{{ scope.row.申请时间 ? scope.row.申请时间 : '—' }}
</template>
</el-table-column>
<el-table-column label="采购审批" align="center" min-width="60">
<template slot-scope="scope">
{{ scope.row.审批人1姓名 ? scope.row.审批人1姓名 : '未审批' }}
</template>
</el-table-column>
<el-table-column label="审批时间" align="center" min-width="115">
<template slot-scope="scope">
{{ scope.row.审批1时间 ? scope.row.审批1时间 : '—' }}
</template>
</el-table-column>
<el-table-column label="总经理审批" align="center" min-width="70">
<template slot-scope="scope">
{{ scope.row.审批人4姓名 ? scope.row.审批人4姓名 : '未审批' }}
</template>
</el-table-column>
<el-table-column label="审批时间" align="center" min-width="115">
<template slot-scope="scope">
{{ scope.row.审批4时间 ? scope.row.审批4时间 : '—' }}
</template>
</el-table-column>
<el-table-column label="财务审批" align="center" min-width="60">
<template slot-scope="scope">
{{ scope.row.审批人3姓名 ? scope.row.审批人3姓名 : '未审批' }}
</template>
</el-table-column>
<el-table-column label="审批时间" align="center" min-width="115">
<template slot-scope="scope">
{{ scope.row.审批3时间 ? scope.row.审批3时间 : '—' }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="300">
<template slot-scope="scope">
<el-button :disabled="Number(scope.row.是否提交申请)===1" type="primary" icon="el-icon-edit" size="mini" style="margin-left:10px" @click="handleEdit(scope.row)">编辑</el-button>
<el-button :disabled="Number(scope.row.是否提交申请)===1" type="danger" icon="el-icon-delete" size="mini" style="margin-left:10px" @click="handleDelete(scope.row)">删除</el-button>
<el-button :disabled="Number(scope.row.是否提交申请)===1" type="primary" size="mini" style="margin-left:10px" @click="submitApply(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"
style="display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/>
</div>
</el-card>
<el-card>
<h4 style="margin-top: 5px;display: inline-block;width: 150px;">发票结算申请单明细</h4>
<span>发票号</span>
<el-input v-model="invoiceNumber" size="small" placeholder="请选择发票结算申请单" readonly/>
<el-button :disabled="disabled" type="primary" size="small" icon="el-icon-circle-plus-outline" style="margin-left:10px" @click="addInStoreRecord()">追加入库记录</el-button>
<el-table :data="tableData2" border highlight-current-row style="width: 100%;max-height: 250px;" height="250px" size="mini">
<el-table-column label="名称" align="center" min-width="100">
<template slot-scope="scope">
{{ 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.离线物料型号 || scope.row.采购零件图号 }}
</template>
</el-table-column>
<el-table-column label="规格" align="center" min-width="150">
<template slot-scope="scope">
{{ scope.row.采购物料规格 || scope.row.离线物料规格 || scope.row.采购零件规格 }}
</template>
</el-table-column>
<el-table-column label="供应商" align="center" min-width="150">
<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.采购合同编号 || 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" width="100">
<template slot-scope="scope">
{{ scope.row.到票数量 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100">
<template slot-scope="scope">
<el-button :disabled="disabled" type="danger" size="mini" icon="el-icon-delete" @click="deleteTable2(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<el-dialog :title="title1" :visible.sync="dialogVisible1" center style="min-height: 300px" width="650px">
<el-form ref="form1" :model="form1" :rules="rules1" label-position="right" label-width="90px">
<el-row>
<el-col :span="12">
<el-form-item label="发票号" prop="invoiceNum">
<el-input v-model="form1.invoiceNum" size="small" placeholder="发票号"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="发票金额" prop="money">
<el-input v-model="form1.money" size="small" placeholder="发票金额"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="供应商" prop="supplierValue">
<el-select v-model="form1.supplierValue" :disabled="title1 === '编辑发票结算申请单'" placeholder="供应商" filterable size="small">
<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="12">
<el-form-item label="尚欠金额">
<el-input v-model="form1.unpaid" size="small" placeholder="尚欠金额"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="税额">
<el-input v-model="form1.tax" size="small" placeholder="税额"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="已付款项">
<el-input v-model="form1.paid" size="small" placeholder="已付款项"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="是否费用类">
<el-input v-model="form1.isCost" size="small" placeholder="是否费用类发票"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注">
<el-input v-model="form1.remark" size="small" placeholder="备注"/>
</el-form-item>
</el-col>
<b v-show="title1 === '创建发票结算申请单'" style="float:left;color: #f56c6c;margin-top: 13px">* </b>
<el-form-item v-show="title1 === '创建发票结算申请单'" label="发票扫描件" style="display: inline-block">
<el-upload
id="invoiceScan"
ref="upload"
:auto-upload="false"
:on-success="uploadSuccess"
:before-upload="beforeUpload"
:on-exceed="warningExceed"
:limit="limit"
:action="upload+'?invoiceNum='+form1.invoiceNum+'&money='+form1.money+'&supplierValue='+form1.supplierValue+'&paid='+form1.paid+'&unpaid='+form1.unpaid+'&tax='+form1.tax+'&isCost='+form1.isCost+'&remark='+form1.remark+'&personId='+id"
list-type="picture-card">
<i class="el-icon-plus"/>
</el-upload>
</el-form-item>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button size="small" @click="dialogVisible1 = false">取消</el-button>
<el-button v-if="title1 === '创建发票结算申请单'" size="small" type="primary" @click="submitAdd1()">确定</el-button>
<el-button v-else size="small" type="primary" @click="submitEdit()">确定</el-button>
</div>
</el-dialog>
<el-dialog :title="title2" :visible.sync="dialogVisible2" center style="min-height: 300px" width="900px">
<span>供应商</span>
<el-input v-model="supplierName" size="small" placeholder="请选择供应商发票" style="margin: 0 5px 10px 0;" readonly/>
<el-radio-group v-model="contractType" size="small" @change="searchTable01()">
<el-radio label="采购合同" border/>
<el-radio label="离线合同" border/>
</el-radio-group>
<el-table :data="tableData01" border highlight-current-row style="width: 100%;max-height: 250px;" height="250px" size="mini" @row-click="searchTable02">
<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.采购合同编号 ? 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.采购合同名称 : scope.row.离线合同名称 }}
</template>
</el-table-column>
</el-table>
<el-table ref="multipleTable" :data="tableData02" border style="width: 100%;max-height: 250px;" height="250px" size="mini" @selection-change="handleSelectionChange">
<el-table-column :selectable="selectable" type="selection" align="center" width="35"/>
<el-table-column label="名称" align="center" width="100">
<template slot-scope="scope">
{{ scope.row.物料名称 ? scope.row.物料名称 : scope.row.零件名称 }}
</template>
</el-table-column>
<el-table-column label="图号或型号" align="center" min-width="150">
<template slot-scope="scope">
{{ scope.row.物料型号 ? scope.row.物料型号 : scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column label="规格" align="center" min-width="150">
<template slot-scope="scope">
{{ scope.row.物料规格 ? scope.row.物料规格 : scope.row.规格 }}
</template>
</el-table-column>
<el-table-column label="采购数量" align="center" width="80">
<template slot-scope="scope">
{{ scope.row.数量 }}
</template>
</el-table-column>
<el-table-column label="已到货数量" align="center" width="90">
<template slot-scope="scope">
{{ scope.row.已到货数量 ? scope.row.已到货数量 : scope.row.到货数量 }}
</template>
</el-table-column>
<el-table-column label="已到票数量" align="center" width="90">
<template slot-scope="scope">
{{ scope.row.到票数量 }}
</template>
</el-table-column>
<el-table-column label="本次到票数量" align="center" width="100">
<template slot-scope="scope">
<el-input-number v-model="scope.row.本次到票数量" :min="0" :max="(scope.row.已到货数量||scope.row.到货数量)-scope.row.到票数量" size="mini" controls-position="right" style="width: 100%;"/>
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button size="small" @click="dialogVisible2 = false">取消</el-button>
<el-button :disabled="group.length===0" size="small" type="primary" @click="submitAdd2()">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { searchSupplier, searchTable1, submitEdit, submitDelete, submitApply, searchTable2, searchPurchase, searchOffline, searchPurchaseDetail, searchOfflineDetail,
addTable2, deleteTable2 } from '@/api/PurchasingCenter/InvoiceSettlementApplication'
import { mapGetters } from 'vuex'
import { uploadInvoiceScan, readFile } from '@/utils/request'
import request from '@/utils/request'
export default {
name: '', // 发票结算申请
data() {
return {
disabled: false,
contractType: '采购合同',
invoiceNum: '',
total1: 0,
pageCurrent1: 1,
pageSize1: 10,
tableData1: [],
applyOrderNum: '',
invoiceNumber: '',
title2: '',
dialogVisible2: false,
tableData2: [],
dialogVisible1: false,
title1: '',
supplier: [],
supplierName: '',
supplierValue: '',
form1: {
invoiceNum: '',
money: '',
supplierValue: '',
paid: '',
unpaid: '',
tax: '',
isCost: '',
remark: '',
applyOrderNum: ''
},
rules1: {
invoiceNum: [
{ required: true, message: '请输入发票号' }
],
money: [
{ required: true, message: '请输入开票金额' }
],
supplierValue: [
{ required: true, message: '请选择供应商' }
]
},
upload: uploadInvoiceScan,
limit: 1,
tableData01: [],
tableData02: [],
inboundCardNumber: '', // 入库单号
group: [] // 发票结算申请单明细流水号组
}
},
computed: {
...mapGetters([
'sidebar',
'name',
'id' // 人员编号
])
},
created() {
this.fetchData()
this.searchTable1()
},
methods: {
fetchData() {
this.supplier = []
searchSupplier().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.supplier.push({
label: response.data[i].供应商名称,
value: response.data[i].供应商流水号
})
}
})
},
createOrder() {
if (this.$refs['form1'] !== undefined) {
this.$refs['form1'].resetFields()
}
this.form1.invoiceNum = ''
this.form1.money = ''
this.form1.supplierValue = ''
this.form1.paid = ''
this.form1.unpaid = ''
this.form1.tax = ''
this.form1.isCost = ''
this.form1.remark = ''
this.title1 = '创建发票结算申请单'
this.dialogVisible1 = true
},
searchTable1() {
let check1
this.invoiceNum ? check1 = 1 : check1 = 0
searchTable1(check1, this.invoiceNum, this.pageCurrent1, this.pageSize1).then(response => {
this.tableData1 = response.data.rows
this.tableData1.map(v => {
this.$set(v, 'scanSrc', '')
return v
})
for (let i = 0; i < response.data.rows.length; i++) {
this.tableData1[i].scanSrc = this.searchPic(response.data.rows[i], i)
}
this.total1 = response.data.total
})
},
submitAdd1() { // 提交新增
this.$refs['form1'].validate((valid) => {
if (valid) {
this.$refs.upload.submit() // 上传图片
} else {
console.log('error submit!!')
return false
}
})
},
submitEdit() { // 提交编辑
this.$refs['form1'].validate((valid) => {
if (valid) {
submitEdit(this.form1.invoiceNum, this.form1.money, this.form1.paid, this.form1.unpaid, this.form1.tax, this.form1.isCost, this.form1.remark, this.form1.applyOrderNum).then(response => {
if (response.data[0].result === '修改成功') {
this.$message.success('编辑成功')
this.dialogVisible1 = false
this.searchTable1()
} else if (response.data[0].result === '修改失败') {
this.$message.error('已提交申请,编辑失败')
} else { this.$message.error('编辑失败') }
})
} else {
console.log('error submit!!')
return false
}
})
},
handleEdit(row) {
if (this.$refs['form1'] !== undefined) {
this.$refs['form1'].resetFields()
}
this.form1.invoiceNum = row.发票号
this.form1.money = row.发票金额
this.form1.supplierValue = Number(row.供应商流水号)
this.form1.paid = row.已付款项
this.form1.unpaid = row.尚欠金额
this.form1.tax = row.税额
this.form1.isCost = row.是否费用类
this.form1.remark = row.备注
this.form1.applyOrderNum = row.发票结算申请单流水号
this.title1 = '编辑发票结算申请单'
this.dialogVisible1 = true
},
handleDelete(row) {
this.$confirm('确认删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
submitDelete(row.发票结算申请单流水号).then(response => {
if (response.data[0].result === '删除成功') {
this.$message.success('删除成功')
this.searchTable1()
} else if (response.data[0].result === '删除失败') {
this.$message.error('已提交申请,删除失败')
} else { this.$message.error('删除失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消操作'
})
})
},
async searchPic(row, i) {
const { data } = await request({
url: '',
method: 'post',
data: {
type: '3',
name: `select * from 采购管理_采购发票_附件 where 是否启用 = 1 and 发票交接流水号 = ${row.发票结算申请单流水号}`
}
})
this.tableData1[i].scanSrc = readFile + data[0].文件标识 + '.' + data[0].文件后缀
},
warningExceed() {
this.$message.error('仅可上传一张发票')
},
beforeUpload(file) { // 上传前检测
const isJPG = /^image\/.*/.test(file.type)
const isLt4M = file.size / 1024 / 1024 < 4
if (!isJPG) {
this.$message.error('只能上传图片。。')
}
if (!isLt4M) {
this.$message.error('上传头像图片大小不能超过 4MB!')
}
return isJPG && isLt4M
},
uploadSuccess(res) { // 上传成功回调
if (res[0].result === '1') {
this.$message.success('增加成功')
this.dialogVisible1 = false
this.searchTable1()
this.$refs.upload.clearFiles()
} else {
this.$message.error('增加失败')
}
},
handleSizeChange1(val) {
this.pageCurrent1 = 1
this.pageSize1 = val
this.searchTable1()
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.searchTable1()
},
submitApply(row) {
if (this.tableData2.length === 0) {
this.$message.warning('发票结算申请明细为空!')
} else {
this.$confirm('确认提交申请吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
submitApply(row.发票结算申请单流水号, this.id).then(response => {
if (response.data[0].result === '1') {
this.$message.success('提交成功')
this.searchTable1()
this.tableData2 = []
} else { this.$message.error('提交失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消操作'
})
})
}
},
searchTable2(row) {
this.applyOrderNum = row.发票结算申请单流水号
this.invoiceNumber = row.发票号
this.supplierName = row.供应商名称
this.supplierValue = row.供应商流水号
Number(row.是否提交申请) === 1 ? this.disabled = true : this.disabled = false
searchTable2(row.发票结算申请单流水号).then(response => {
this.tableData2 = response.data
})
},
addInStoreRecord() {
if (this.applyOrderNum) {
this.searchTable01()
this.title2 = '追加入库单'
this.dialogVisible2 = true
} else {
this.$message.error('请选择发票!')
}
},
searchTable01() {
this.tableData01 = []
this.tableData02 = []
if (this.contractType === '采购合同') {
searchPurchase(this.supplierValue).then(response => {
this.tableData01 = response.data
})
} else if (this.contractType === '离线合同') {
searchOffline(this.supplierValue).then(response => {
response.data.map(data => {
if (Number(data.离线合同状态) === 2) {
this.tableData01.push(data)
}
})
})
}
},
searchTable02(row) {
this.tableData02 = []
if (this.contractType === '采购合同') {
searchPurchaseDetail(row.采购合同流水号).then(response => {
response.data.map(data => {
this.$set(data, '本次到票数量', 0)
data.本次到票数量 = data.已到货数量 - data.到票数量
this.tableData02.push(data)
})
})
} else if (this.contractType === '离线合同') {
searchOfflineDetail(row.离线合同流水号).then(response => {
response.data.map(data => {
this.$set(data, '本次到票数量', 0)
data.本次到票数量 = data.到货数量 - data.到票数量
this.tableData02.push(data)
})
})
}
},
handleSelectionChange(val) {
this.group = val
},
submitAdd2() { // 追加入库单
if (this.group.length === 0) {
this.$message.warning('请选择零件或物料')
} else {
const group1 = []
const group2 = []
if (this.contractType === '采购合同') {
for (let i = 0; i < this.group.length; i++) {
group1.push(this.group[i].采购合同明细流水号)
group2.push(this.group[i].本次到票数量)
}
addTable2(this.applyOrderNum, group1, group2, 1).then(response => {
if (response.data[0].result === '1') {
this.$message.success('追加成功')
this.dialogVisible2 = false
searchTable2(this.applyOrderNum).then(response => {
this.tableData2 = response.data
})
} else { this.$message.error('追加失败') }
})
} else if (this.contractType === '离线合同') {
for (let i = 0; i < this.group.length; i++) {
group1.push(this.group[i].离线合同明细流水号)
group2.push(this.group[i].本次到票数量)
}
addTable2(this.applyOrderNum, group1, group2, 2).then(response => {
if (response.data[0].result === '1') {
this.$message.success('追加成功')
this.dialogVisible2 = false
searchTable2(this.applyOrderNum).then(response => {
this.tableData2 = response.data
})
} else { this.$message.error('追加失败') }
})
}
}
},
deleteTable2(row) {
this.$confirm('确认删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteTable2(row.发票结算申请单明细流水号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
searchTable2(this.applyOrderNum).then(response => {
this.tableData2 = response.data
})
} else { this.$message.error('删除失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消操作'
})
})
},
selectable(row) {
return Number(row.本次到票数量) > 0
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom: 15px;
}
.el-select{
width:200px
}
.el-input{
width:200px
}
span{
margin: 10px 0 10px 10px;
}
#expandTable .el-form-item{
margin: 0;
}
</style>

View File

@@ -0,0 +1,280 @@
<template>
<div class="app-container">
<el-card>
<div slot="header">
<span>申请时间:</span>
<el-date-picker v-model="date1" size="small" type="date" format="yyyy-MM-dd" value-format="yyyy-MM-dd" placeholder="选择开始日期"/>&nbsp;~
<el-date-picker v-model="date2" size="small" type="date" format="yyyy-MM-dd" value-format="yyyy-MM-dd" placeholder="选择结束日期"/>
<el-button type="success" size="small" icon="el-icon-search" style="margin-left:10px" @click="total1=0;pageCurrent1=1;pageSize1=10;searchTable1()">查询</el-button>
</div>
<h4 style="margin-top: 5px">发票结算申请单</h4>
<el-table id="expandTable" :data="tableData1" border highlight-current-row height="330px" style="width: 100%;height: 330px;overflow:auto" size="mini" @row-click="searchTable2">
<el-table-column type="expand">
<template slot-scope="scope">
<el-form label-position="left" inline class="demo-table-expand">
<el-row>
<el-col :lg="10" :sm="12">
<viewer>
<img :src="scope.row.scanSrc" alt="发票扫描件" height="120px">
</viewer>
</el-col>
<el-col :span="6">
<el-form-item label="已付款项">
<span>{{ scope.row.已付款项 }}</span>
</el-form-item><br>
<el-form-item label="尚欠金额">
<span>{{ scope.row.尚欠金额 }}</span>
</el-form-item><br>
<el-form-item label="备注">
<span>{{ scope.row.备注 }}</span>
</el-form-item><br>
</el-col>
<el-col :span="6">
<el-form-item label="是否费用类发票">
<span>{{ scope.row.是否费用类 }}</span>
</el-form-item><br>
<el-form-item label="税额">
<span>{{ scope.row.税额 }}</span>
</el-form-item>
</el-col>
</el-row>
</el-form>
</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="90">
<template slot-scope="scope">
{{ scope.row.发票号 }}
</template>
</el-table-column>
<el-table-column label="发票金额" align="center" min-width="70">
<template slot-scope="scope">
{{ scope.row.发票金额 }}
</template>
</el-table-column>
<el-table-column label="申请人" align="center" min-width="60">
<template slot-scope="scope">
{{ scope.row.申请人姓名 ? scope.row.申请人姓名 : '未提交' }}
</template>
</el-table-column>
<el-table-column label="申请时间" align="center" min-width="115">
<template slot-scope="scope">
{{ scope.row.申请时间 ? scope.row.申请时间 : '—' }}
</template>
</el-table-column>
<el-table-column label="采购审批" align="center" min-width="70">
<template slot-scope="scope">
{{ scope.row.审批人1姓名 ? scope.row.审批人1姓名 : '未审批' }}
</template>
</el-table-column>
<el-table-column label="审批时间" align="center" min-width="115">
<template slot-scope="scope">
{{ scope.row.审批1时间 ? scope.row.审批1时间 : '—' }}
</template>
</el-table-column>
<el-table-column label="总经理审批" align="center" min-width="90">
<template slot-scope="scope">
{{ scope.row.审批人4姓名 ? scope.row.审批人4姓名 : '未审批' }}
</template>
</el-table-column>
<el-table-column label="审批时间" align="center" min-width="115">
<template slot-scope="scope">
{{ scope.row.审批4时间 ? scope.row.审批4时间 : '—' }}
</template>
</el-table-column>
<el-table-column label="财务审批" align="center" min-width="70">
<template slot-scope="scope">
{{ scope.row.审批人3姓名 ? scope.row.审批人3姓名 : '未审批' }}
</template>
</el-table-column>
<el-table-column label="审批时间" align="center" min-width="115">
<template slot-scope="scope">
{{ scope.row.审批3时间 ? scope.row.审批3时间 : '—' }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100">
<template slot-scope="scope">
<el-button :disabled="false" type="primary" size="mini" @click="excuteApprove(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"
style="display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/>
</div>
</el-card>
<el-card>
<h4 style="margin-top: 5px;display: inline-block;width: 150px;">发票结算申请单明细</h4>
<span>发票号</span>
<el-input v-model="invoiceNumber" size="small" placeholder="请选择发票结算申请单" readonly/>
<el-table :data="tableData2" border highlight-current-row style="width: 100%;max-height: 250px;" height="250px" size="mini">
<el-table-column label="名称" align="center" min-width="100">
<template slot-scope="scope">
{{ 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.离线物料型号 || scope.row.采购零件图号 }}
</template>
</el-table-column>
<el-table-column label="规格" align="center" min-width="150">
<template slot-scope="scope">
{{ scope.row.采购物料规格 || scope.row.离线物料规格 || scope.row.采购零件规格 }}
</template>
</el-table-column>
<el-table-column label="供应商" align="center" min-width="150">
<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.采购合同编号 || 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" width="100">
<template slot-scope="scope">
{{ scope.row.到票数量 }}
</template>
</el-table-column>
</el-table>
</el-card>
</div>
</template>
<script>
import { searchTable1, searchTable2, excuteApprove } from '@/api/PurchasingCenter/InvoiceSettlementApprove'
import { mapGetters } from 'vuex'
import { readFile } from '@/utils/request'
import request from '@/utils/request'
export default {
name: '', // 发票结算审批
data() {
return {
date1: '',
date2: '',
tableData1: [],
total1: 0,
pageCurrent1: 1,
pageSize1: 10,
invoiceNumber: '',
tableData2: [],
tableData3: []
}
},
computed: {
...mapGetters([
'token',
'sidebar',
'name',
'id' // 人员编号
])
},
created() {
this.fetchData()
this.searchTable1()
},
methods: {
fetchData() {
// console.log(this.token)
},
searchTable1() {
this.date1 && this.date2 ? this.check1 = 1 : (this.check1 = 0, this.date1 = '', this.date2 = '')
searchTable1(this.check1, this.date1, this.date2, this.pageCurrent1, this.pageSize1, this.token).then(response => {
this.tableData1 = response.data.rows
this.tableData1.map(v => {
this.$set(v, 'scanSrc', '')
return v
})
for (let i = 0; i < response.data.rows.length; i++) {
this.tableData1[i].scanSrc = this.searchPic(response.data.rows[i], i)
}
this.total1 = response.data.total
})
},
async searchPic(row, i) {
const { data } = await request({
url: '',
method: 'post',
data: {
type: '3',
name: `select * from 采购管理_采购发票_附件 where 是否启用 = 1 and 发票交接流水号 = ${row.发票结算申请单流水号}`
}
})
this.tableData1[i].scanSrc = readFile + data[0].文件标识 + '.' + data[0].文件后缀
},
handleSizeChange1(val) {
this.pageCurrent1 = 1
this.pageSize1 = val
this.searchTable1()
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.searchTable1()
},
excuteApprove(row) {
this.$confirm('确认审批签字?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
excuteApprove(row.发票结算申请单流水号, this.id, this.token).then(response => {
if (response.data[0].result === '审批成功') {
this.$message.success('审批成功')
this.searchTable1()
} else if (response.data[0].result === '已完成审批') {
this.$message.warning('已完成审批,不可重复审批')
} else { this.$message.error('审批失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消审批'
})
})
},
searchTable2(row) {
this.invoiceNumber = row.发票号
searchTable2(row.发票结算申请单流水号).then(response => {
this.tableData2 = response.data
})
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom: 15px;
}
.el-select{
width:200px
}
.el-input{
width:200px
}
span{
margin: 10px 0 10px 10px;
}
#expandTable .el-form-item{
margin: 0;
}
</style>

View File

@@ -0,0 +1,794 @@
<template>
<div class="app-container">
<el-card>
<el-row>
<el-col style="width: 280px;margin-top: 3px">
<span>物料类别:</span>
<el-select
v-model="MaterialCategoryValue"
placeholder="请选择"
size="small"
clearable
@change="searchMaterialVariety">
<el-option
v-for="item in MaterialCategory"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-col>
<el-col style="width: 280px;margin-top: 3px">
<span>物料品种:</span>
<el-select
v-model="MaterialVarietyValue"
placeholder="请选择"
size="small"
clearable
@change="searchMaterial">
<el-option
v-for="item in MaterialVariety"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-col>
<el-col style="width: 280px;margin-top: 3px">
<span>物料名称:</span>
<el-input v-model="MaterialName" placeholder="物料名称" size="small" clearable />
</el-col>
<el-col style="width: 280px;margin-top: 3px">
<span>物料全称:</span>
<el-input
v-model="FullNameOfMaterial"
placeholder="物料全称"
size="small"
clearable/>
</el-col>
<el-col style="width: 280px;margin-top: 3px">
<span>物料规格:</span>
<el-input
v-model="MaterialSpecification"
placeholder="物料规格"
size="small"
clearable/>
</el-col>
<el-col style="width: 280px;margin-top: 3px">
<span>物料型号:</span>
<el-input
v-model="MaterialModel"
placeholder="物料型号"
size="small"
clearable/>
</el-col>
<el-col style="width: 280px">
<span>计算单位:</span>
<el-select
v-model="MeasurementUnitValue"
placeholder="请选择"
style="margin-bottom: 3px;margin-top: 10px"
size="small"
clearable>
<el-option
v-for="item in MeasurementUnit"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-col>
<el-col style="width: 280px">
<span>物料来源:</span>
<el-select
v-model="MaterialSourceValue"
placeholder="请选择"
style="margin-bottom: 3px;margin-top: 10px"
size="small"
clearable>
<el-option
v-for="item in MaterialSource"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-col>
<el-col style="width: 280px">
<span style="margin-left: 25px">供货商:</span>
<el-input
v-model="supplier"
placeholder="供货商"
size="small"
style="margin-bottom: 3px;margin-top: 10px"
clearable
@dblclick.native="param=0;openSupplier()"/>
</el-col>
<el-col style="width: 330px">
<el-button
type="success"
icon="el-icon-search"
size="small"
style="margin-left: 10px"
@click="pageCurrent=1;searchMaterial()">查询
</el-button>
<el-button :disabled="token !== 11 && token !== 36" type="primary" style="margin-bottom: 3px;margin-top: 10px" icon="el-icon-circle-plus-outline" size="small" @click="handleAdd()">增加</el-button>
<el-button
:disabled="token !== 11 && token !== 36"
type="warning"
icon="el-icon-refresh"
size="small"
style="margin:10px 10px 3px"
@click="CategoryMaintenance">维护物料类别
</el-button>
</el-col>
</el-row>
</el-card>
<el-card>
<el-table
:data="tableData"
style="width: 100%;margin-top: 3px"
height="720"
size="mini"
highlight-current-row
border
stripe>
<el-table-column align="center" label="物料名称">
<template slot-scope="scope">
{{ scope.row.物料名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="物料规格">
<template slot-scope="scope">
{{ scope.row.物料规格 }}
</template>
</el-table-column>
<el-table-column align="center" label="物料型号">
<template slot-scope="scope">
{{ scope.row.物料型号 }}
</template>
</el-table-column>
<el-table-column align="center" label="供货商">
<template slot-scope="scope">
{{ scope.row.供货商 }}
</template>
</el-table-column>
<el-table-column align="center" label="参考价格">
<template slot-scope="scope">
{{ scope.row.参考价格 }}
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="150">
<template slot-scope="scope">
<el-tooltip effect="dark" content="编辑" placement="top">
<div style="display: inline-block">
<el-button
:disabled="token !== 11 && token !== 36"
size="mini"
type="text"
icon="el-icon-edit-outline"
@click="handleEdit(scope.row)"/>
</div>
</el-tooltip>
<el-tooltip effect="dark" content="删除" placement="top">
<div style="display: inline-block">
<el-button
:disabled="token !== 11 && token !== 36"
size="mini"
type="text"
style="margin-left: 20px"
icon="el-icon-delete"
@click="handleDelete(scope.row)"/>
</div>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent"
:page-sizes="[10, 20, 30, 40, 50]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
<el-dialog :visible.sync="dialogFormVisible" title="选择供货商" center width="400px">
<el-input v-model="supplier1" placeholder="供货商" size="small" clearable style="width:200px"/>
<el-button
type="success"
icon="el-icon-search"
size="small"
style="margin-left: 15px; margin-bottom: 10px"
@click="pageCurrent1=1;searchSupplier()">查询
</el-button>
<el-table
:data="tableData1"
size="mini"
highlight-current-row
border
@row-click="selectSupplier">
<el-table-column align="center" label="供货商">
<template slot-scope="scope">
{{ scope.row.供货商 }}
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent1"
:page-sizes="[10, 20, 30]"
:page-size="pageSize1"
:total="total1"
small
layout="sizes, prev, pager, next"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitSupplier">提交</el-button>
</div>
</el-dialog>
<el-dialog :title="title" :visible.sync="dialogFormVisible1" center style="min-height: 300px" width="800px">
<el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="110px" class="demo-ruleForm">
<el-row>
<el-col :span="12">
<el-form-item label="物料类别" prop="物料类别流水号">
<el-select
v-model="form.物料类别流水号"
style="width:200px"
placeholder="请选择"
size="small"
clearable
@change="searchMaterialVariety1">
<el-option
v-for="item in MaterialCategory1"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物料品种" prop="物料品种流水号">
<el-select v-model="form.物料品种流水号" style="width:200px" placeholder="请选择" size="small" clearable>
<el-option
v-for="item in MaterialVariety1"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="物料名称" prop="物料名称">
<el-input v-model="form.物料名称" placeholder="物料名称" size="small" clearable style="width:200px"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物料全名" prop="物料全名">
<el-input v-model="form.物料全名" placeholder="物料全名" size="small" clearable style="width:200px"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="物料规格" prop="物料规格">
<el-input v-model="form.物料规格" placeholder="物料规格" size="small" clearable style="width:200px"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物料型号" prop="物料型号">
<el-input v-model="form.物料型号" placeholder="物料型号" size="small" clearable style="width:200px"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="计量单位" prop="计量单位流水号">
<el-select v-model="form.计量单位流水号" style="width:200px" placeholder="请选择" size="small">
<el-option
v-for="item in MeasurementUnit"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物料来源" prop="物料来源流水号">
<el-select v-model="form.物料来源流水号" style="width:200px" placeholder="请选择" size="small">
<el-option
v-for="item in MaterialSource"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="供货商" prop="供货商">
<el-input
v-model="form.供货商"
placeholder="供货商"
size="small"
clearable
style="width:200px"
@click.native="param=1;openSupplier()"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="常用符号">
Φ × μ δ ±
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel('form')">取消</el-button>
<el-button v-show="title==='增加'" type="primary" @click="submitAdd('form')">确定</el-button>
<el-button v-show="title==='编辑'" type="primary" @click="submitEdit('form')">确定</el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogFormVisible2" title="物料类别维护" center width="1200px">
<div style="width: 47%;display: inline-block">
<el-card>
<span>物料类别:</span>
<el-input v-model="MaterialCategory2" placeholder="物料类别" size="mini" clearable style="width:100px"/>
<span>类别编号:</span>
<el-input v-model="CategoryNumber" placeholder="类别编号" size="mini" clearable style="width:100px"/>
<el-button type="primary" size="mini" style="margin-left: 10px" @click="handleAdd1">增加</el-button>
<el-button type="warning" size="mini" @click="handleEdit1">编辑</el-button>
<br>
</el-card>
<el-card>
<el-table
:data="tableData2"
size="mini"
height="328"
highlight-current-row
border
@row-click="selectMaterialCategory">
<el-table-column align="center" label="物料类别">
<template slot-scope="scope">
{{ scope.row.物料类别 }}
</template>
</el-table-column>
<el-table-column align="center" label="类别编号">
<template slot-scope="scope">
{{ scope.row.类别编号 }}
</template>
</el-table-column>
<el-table-column align="center" label="ID">
<template slot-scope="scope">
{{ scope.row.物料类别ID }}
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button
size="mini"
type="danger"
@click="handleDelete1(scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</div>
<div style="width: 49%;display: inline-block;margin-left: 20px">
<el-card>
<span>品种编号:</span>
<el-input v-model="VarietyNumber" placeholder="品种编号" size="mini" clearable style="width:100px"/>
<span>物料品种:</span>
<el-input v-model="MaterialVariety2" placeholder="物料品种" size="mini" clearable style="width:100px"/>
<span>规格1:</span>
<el-input v-model="Specifications1" placeholder="规格1" size="mini" clearable style="width:100px"/>
<br>
<span style="margin-left: 30px">规格2:</span>
<el-input v-model="Specifications2" placeholder="规格2" size="mini" clearable style="width:100px"/>
<el-button type="primary" size="mini" style="margin-left: 10px" @click="handleAdd2">增加</el-button>
<el-button type="warning" size="mini" @click="handleEdit2">编辑</el-button>
</el-card>
<el-card>
<el-table
:data="tableData3"
size="mini"
height="300"
highlight-current-row
border
@row-click="selectMaterialVariety">
<el-table-column align="center" label="品种编号">
<template slot-scope="scope">
{{ scope.row.品种编号 }}
</template>
</el-table-column>
<el-table-column align="center" label="物料品种">
<template slot-scope="scope">
{{ scope.row.物料品种 }}
</template>
</el-table-column>
<el-table-column align="center" label="规格1">
<template slot-scope="scope">
{{ scope.row.规格1 }}
</template>
</el-table-column>
<el-table-column align="center" label="规格2">
<template slot-scope="scope">
{{ scope.row.规格2 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button
size="mini"
type="danger"
@click="handleDelete2(scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</div>
</el-dialog>
</div>
</template>
<script>
import {
initDepartmentName,
initMaterialCategory,
initMaterialVariety,
initMeasurementUnit,
initMaterialSource,
searchmaterial,
getSupplier,
addData,
editData,
deleteData,
searchCategory,
searchVarieties,
editCategory,
addCategory,
deleteCategory,
editVariety,
addVariety,
deleteVariety
} from '@/api/PurchasingCenter/MaterialManagement'
import { mapGetters } from 'vuex'
export default {
data() {
return {
DepartmentValue: '', // 部门名称
Department: [], // 部门数组
MaterialCategoryValue: '', // 物料类别
MaterialCategory: [], // 物料类别数组
MaterialVarietyValue: '', // 物料品种
MaterialVariety: [], // 物料品种数组
MaterialName: '', // 物料名称
FullNameOfMaterial: '', // 物料全称
MaterialSpecification: '', // 物料规格
MaterialModel: '', // 物料型号
MeasurementUnitValue: '', // 计量单位
MeasurementUnit: [], // 计量单位数组
MaterialSourceValue: '', // 物料来源
MaterialSource: [], // 物料来源数组
supplier: '', // 供货商
supplier1: '', // 供货商(弹框)
supplierValue: '', // 供货商流水号
ReferencePrice: '', // 参考价格
supplierValue1: '',
MaterialCategory1: [],
MaterialVariety1: [],
MaterialCategory2: '', // 物料类别
CategoryNumber: '', // 类别编号
VarietyNumber: '', // 品种编号
MaterialVariety2: '', // 物料品种
Specifications1: '', // 规格1
Specifications2: '', // 规格2
MaterialCategoryNum: '', // 物料类别流水号
MaterialVarietyNum: '', // 物料品种流水号
param: 0,
tableData: [],
pageCurrent: 1,
pageSize: 30,
total: null,
tableData1: [],
pageCurrent1: 1,
pageSize1: 10,
total1: null,
tableData2: [],
tableData3: [],
dialogFormVisible: false,
dialogFormVisible1: false,
dialogFormVisible2: false,
check1: '',
check2: '',
check3: '',
check4: '',
check5: '',
check6: '',
check7: '',
check8: '',
check9: '',
check10: '',
title: '',
form: {
物料流水号: '',
物料类别流水号: '',
物料品种流水号: '',
物料名称: '',
物料全名: '',
物料规格: '',
物料型号: '',
计量单位流水号: '',
物料来源流水号: '',
供货商: ''
},
rules: {
物料名称: [{ required: true, message: '请输入物料名称', trigger: 'blur' }],
供货商: [{ required: true, message: '请选择供货商', trigger: 'change' }],
物料类别流水号: [{ required: true, message: '请选择物料类别', trigger: 'change' }],
物料品种流水号: [{ required: true, message: '请选择物料品种', trigger: 'change' }],
计量单位流水号: [{ required: true, message: '请选择计量单位', trigger: 'change' }],
物料来源流水号: [{ required: true, message: '请选择物料来源', trigger: 'change' }]
}
}
},
computed: {
...mapGetters([
'name',
'id',
'token'
])
},
created() {
this.fetchData()
this.searchMaterialCategory()
},
methods: {
fetchData() {
this.getSelect(initDepartmentName, ['物料部门名称', '物料部门流水号'], 'Department') // 物料部门
this.getSelect(initMeasurementUnit, ['计量单位', '计量单位流水号'], 'MeasurementUnit') // 计量单位
this.getSelect(initMaterialSource, ['物料来源', '物料来源流水号'], 'MaterialSource') // 物料来源
},
searchMaterialCategory() { // 获取物料类别
this.MaterialCategory = []
this.MaterialVariety = []
this.MaterialCategoryValue = ''
this.MaterialVarietyValue = ''
this.getSelect(initMaterialCategory, ['物料类别', '物料类别流水号'], 'MaterialCategory', [0, this.DepartmentValue])
},
searchMaterialVariety() { // 初始化物料品种
this.MaterialVariety = []
this.MaterialVarietyValue = ''
this.getSelect(initMaterialVariety, ['物料品种', '物料品种流水号'], 'MaterialVariety', this.MaterialCategoryValue)
},
searchMaterial() { // 物料查询
this.MaterialName !== '' ? this.check1 = 1 : this.check1 = 0 // 物料名称
this.FullNameOfMaterial !== '' ? this.check2 = 1 : this.check2 = 0 // 物料全称
this.MaterialSpecification !== '' ? this.check3 = 1 : this.check3 = 0 // 物料规格
this.MaterialModel !== '' ? this.check4 = 1 : this.check4 = 0 // 物料型号
this.MaterialCategoryValue !== '' ? this.check5 = 1 : this.check5 = 0 // 物料类别
this.MaterialVarietyValue !== '' ? this.check6 = 1 : this.check6 = 0 // 物料品种
this.MeasurementUnitValue !== '' ? this.check7 = 1 : this.check7 = 0 // 计量单位
this.MaterialSourceValue !== '' ? this.check8 = 1 : this.check8 = 0 // 物料来源
this.supplier !== '' ? this.check9 = 1 : this.check9 = 0 // 供货商
searchmaterial(this.check1, this.MaterialName, this.check2, this.FullNameOfMaterial, this.check3, this.MaterialSpecification, this.check4, this.MaterialModel, this.pageCurrent, this.pageSize, this.check5, this.MaterialCategoryValue, this.check6, this.MaterialVarietyValue, this.check7, this.MeasurementUnitValue, this.check8, this.MaterialSourceValue, this.check9, this.supplierValue).then(response => {
this.tableData = response.data.result
this.total = parseInt(response.data.output[0].ItemCount)
})
},
openSupplier() {
this.dialogFormVisible = true
this.supplier1 = ''
this.check10 = 0
this.pageCurrent1 = 1
this.pageSize1 = 10
this.getTable(getSupplier, [this.check10, this.supplier1, this.pageCurrent1, this.pageSize1], ['tableData1', 'total1'])
},
searchSupplier() {
this.supplier1 !== '' ? this.check10 = 1 : this.check10 = 0
this.getTable(getSupplier, [this.check10, this.supplier1, this.pageCurrent1, this.pageSize1], ['tableData1', 'total1'])
},
selectSupplier(row) {
if (this.param === 0) {
this.supplierValue = row.供货商流水号
} else if (this.param === 1) {
this.supplierValue1 = row.供货商流水号
}
this.supplier1 = row.供货商
},
submitSupplier() {
if (this.param === 0) {
this.supplier = this.supplier1
} else if (this.param === 1) {
this.form.供货商 = this.supplier1
}
this.dialogFormVisible = false
},
cancel() { // 取消
this.dialogFormVisible1 = false
},
searchMaterialVariety1() { // 物料品种
this.MaterialVariety1 = []
this.form.物料品种流水号 = ''
this.getSelect(initMaterialVariety, ['物料品种', '物料品种流水号'], 'MaterialVariety1', this.form.物料类别流水号)
},
handleEdit(row) {
this.supplierValue1 = ''
this.MaterialCategory1 = []
this.MaterialVariety1 = []
this.supplierValue1 = row.供货商流水号
this.getSelect(initMaterialCategory, ['物料类别', '物料类别流水号'], 'MaterialCategory1')
this.getSelect(initMaterialVariety, ['物料品种', '物料品种流水号'], 'MaterialVariety1', row.物料类别流水号)
this.editForm(row, 'form', [this.title = '编辑', this.dialogFormVisible1 = true])
},
submitEdit() {
this.editTable(editData, [this.form.物料流水号, this.form.物料品种流水号, this.form.物料名称, this.form.物料全名, this.form.物料规格, this.form.物料型号, this.form.计量单位流水号, this.form.物料来源流水号, this.supplierValue1], 'form', function() {
this.searchMaterial()
this.dialogFormVisible1 = false
})
},
handleAdd() {
this.supplierValue1 = ''
this.MaterialCategory1 = []
this.MaterialVariety1 = []
this.getSelect(initMaterialCategory, ['物料类别', '物料类别流水号'], 'MaterialCategory1')
this.addForm('form', [this.dialogFormVisible1 = true, this.title = '增加'])
},
submitAdd() { // 提交增加
this.addTable(addData, [this.form.物料品种流水号, this.form.物料名称, this.form.物料全名, this.form.物料规格, this.form.物料型号, this.form.计量单位流水号, this.form.物料来源流水号, this.supplierValue1], 'form', function() {
this.dialogFormVisible1 = false
this.searchMaterial()
})
},
handleDelete(row) { // 删除
this.deleteRow(deleteData, row.物料流水号, function() {
this.searchMaterial()
})
},
CategoryMaintenance() {
this.dialogFormVisible2 = true
this.getData(searchCategory, 'tableData2')
},
selectMaterialCategory(row) {
this.MaterialCategory2 = row.物料类别
this.CategoryNumber = row.类别编号
this.MaterialCategoryNum = row.物料类别流水号
this.getData(searchVarieties, 'tableData3', row.物料类别流水号)
},
selectMaterialVariety(row) {
this.MaterialVarietyNum = row.物料品种流水号
this.VarietyNumber = row.品种编号
this.MaterialVariety2 = row.物料品种
this.Specifications1 = row.规格1
this.Specifications2 = row.规格2
},
handleEdit1() {
editCategory(this.MaterialCategoryNum, this.MaterialCategory2, this.CategoryNumber).then(response => {
if (response.data[0].result === '1') {
this.$message.success('编辑成功')
this.getData(searchCategory, 'tableData2')
this.tableData3 = []
} else {
this.$message.error('编辑失败')
}
})
},
handleAdd1() {
addCategory(this.MaterialCategory2, this.CategoryNumber).then(response => {
if (response.data[0].result === '1') {
this.$message.success('增加成功')
this.getData(searchCategory, 'tableData2')
this.tableData3 = []
} else {
this.$message.error('增加失败')
}
})
},
handleDelete1(row) {
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteCategory(row.物料类别流水号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
this.getData(searchCategory, 'tableData2')
this.tableData3 = []
} else {
this.$message.error('删除失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
handleEdit2() {
editVariety(this.MaterialVarietyNum, this.MaterialCategoryNum, this.MaterialVariety2, this.VarietyNumber, this.Specifications1, this.Specifications2).then(response => {
if (response.data[0].result === '1') {
this.$message.success('编辑成功')
this.getData(searchVarieties, 'tableData3', this.MaterialCategoryNum)
} else {
this.$message.error('编辑失败')
}
})
},
handleAdd2() {
addVariety(this.MaterialCategoryNum, this.MaterialVariety2, this.VarietyNumber, this.Specifications1, this.Specifications2).then(response => {
if (response.data[0].result === '1') {
this.$message.success('增加成功')
this.getData(searchVarieties, 'tableData3', this.MaterialCategoryNum)
} else {
this.$message.error('增加失败')
}
})
},
handleDelete2(row) {
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteVariety(row.物料品种流水号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
this.getData(searchVarieties, 'tableData3', this.MaterialCategoryNum)
} else {
this.$message.error('删除失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
handleSizeChange(val) {
this.pageSize = val
this.pageCurrent = 1
this.searchMaterial()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.searchMaterial()
},
handleSizeChange1(val) {
this.pageSize1 = val
this.pageCurrent1 = 1
this.supplier1 !== '' ? this.check10 = 1 : this.check10 = 0
this.getTable(getSupplier, [this.check10, this.supplier1, this.pageCurrent1, this.pageSize1], ['tableData1', 'total1'])
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.supplier1 !== '' ? this.check10 = 1 : this.check10 = 0
this.getTable(getSupplier, [this.check10, this.supplier1, this.pageCurrent1, this.pageSize1], ['tableData1', 'total1'])
}
}
}
</script>
<style scoped>
span {
margin: 10px 0px 10px 10px;
}
.el-select{
width:190px
}
.el-input{
width:190px
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,558 @@
<template>
<div class="app-container">
<el-card>
<div slot="header">
<span style="margin-left: 0">请款时间:</span>
<el-date-picker
v-model="dateRange"
:picker-options="pickerOptions"
size="small"
type="daterange"
align="center"
style="width: 300px"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"/>
<span>供应商</span>
<el-select v-model="supplierValue" placeholder="供应商" filterable size="small" clearable @change="totalSum=0;totalPay=0;totalDebt=0;">
<el-option
v-for="item in supplier"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-button
type="success"
size="small"
icon="el-icon-search"
style="margin-left: 10px"
@click="pageCurrent1=1;pageSize1=10;total1=0;searchTable1()">查询</el-button>
<el-button type="primary" size="small" icon="el-icon-goods" style="" @click="requestFund">请款</el-button>
</div>
<h3 style="margin-top: 0">请款表</h3>
<el-table v-loading="" :data="tableData1" border style="max-height: 500px;" height="500px" size="mini">
<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" min-width="150">
<template slot-scope="scope">
{{ scope.row.请款时间 }}
</template>
</el-table-column>
<el-table-column label="请款人" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
</el-table-column>
<el-table-column label="请款金额" align="center" min-width="90" prop="请款金额">
<template slot-scope="scope">
{{ scope.row.请款金额 }}
</template>
</el-table-column>
<el-table-column label="请款付款情况" align="center">
<el-table-column label="审核情况内容" width="100" align="center">
<template slot-scope="scope">
<el-tag v-if="Number(scope.row.审核情况流水号)===3" type="primary" size="small">未审核</el-tag>
<el-tag v-if="Number(scope.row.审核情况流水号)===1" type="success" size="small">已通过</el-tag>
<el-tag v-if="Number(scope.row.审核情况流水号)===2" type="danger" size="small">不通过</el-tag>
</template>
</el-table-column>
<el-table-column label="未通过审核原因" width="110" align="center">
<template slot-scope="scope">
{{ scope.row.未通过审核原因 === '通过' ? '—' : scope.row.未通过审核原因 }}
</template>
</el-table-column>
<el-table-column label="审批情况内容" width="100" align="center">
<template slot-scope="scope">
<el-tag v-if="Number(scope.row.审批情况流水号)===3" type="primary" size="small">未审批</el-tag>
<el-tag v-if="Number(scope.row.审批情况流水号)===1" type="success" size="small">已通过</el-tag>
<el-tag v-if="Number(scope.row.审批情况流水号)===2" type="danger" size="small">不通过</el-tag>
</template>
</el-table-column>
<el-table-column label="未通过审批原因" width="110" align="center">
<template slot-scope="scope">
{{ scope.row.未通过审批原因 === '通过' ? '—' : scope.row.未通过审批原因 }}
</template>
</el-table-column>
<el-table-column label="付款情况" width="100" align="center">
<template slot-scope="scope">
<el-tag v-if="Number(scope.row.付款情况流水号)===3" type="primary" size="small">未操作</el-tag>
<el-tag v-if="Number(scope.row.付款情况流水号)===1" type="success" size="small">已同意</el-tag>
<el-tag v-if="Number(scope.row.付款情况流水号)===2" type="danger" size="small">不同意</el-tag>
</template>
</el-table-column>
<el-table-column label="未付款原因" width="100" align="center">
<template slot-scope="scope">
{{ scope.row.未付款原因 === '通过' ? '—' : scope.row.未付款原因 }}
</template>
</el-table-column>
</el-table-column>
<el-table-column label="操作" align="center" width="250">
<template slot-scope="scope">
<el-popover placement="right" width="500" trigger="click">
<el-table :data="gridData" highlight-current-row size="mini" show-summary @row-click="searchTable2">
<el-table-column width="50" align="center" type="index" label="序号"/>
<el-table-column min-width="150" align="center" label="离线合同编号">
<template slot-scope="scope">
{{ scope.row.离线合同编号 }}
</template>
</el-table-column>
<el-table-column min-width="100" align="center" label="已付金额" prop="已付金额">
<template slot-scope="scope">
{{ scope.row.已付金额 }}
</template>
</el-table-column>
<el-table-column min-width="100" 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="searchTable02(scope.row)">查看详情</el-button>
</el-popover>
<el-button :disabled="Number(id)!==Number(scope.row.请款人)||!Number(scope.row.审核情况流水号)!==3" type="danger" size="mini" icon="el-icon-delete" style="margin-left: 10px" @click="cancelRequestFund(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"
style="display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/>
<span v-show="supplierValue">累计合同总额</span>
<el-input v-show="supplierValue" v-model="totalSum" size="mini" style="width: 100px;" readonly/>
<span v-show="supplierValue">累计付款</span>
<el-input v-show="supplierValue" v-model="totalPay" size="mini" style="width: 100px;" readonly/>
<span v-show="supplierValue">累计欠款</span>
<el-input v-show="supplierValue" v-model="totalDebt" size="mini" style="width: 100px;" readonly/>
</div>
</el-card>
<el-card>
<h3 style="margin-top: 0">离线合同明细</h3>
<el-table v-loading="" :data="tableData2" :summary-method="getSummaries" border style="margin-top:10px;max-height: 500px;" height="500px" size="mini" show-summary>
<el-table-column label="离线合同编号" align="center" min-width="150">
<template slot-scope="scope">
{{ scope.row.离线合同编号 }}
</template>
</el-table-column>
<el-table-column label="物料名称" align="center" min-width="150">
<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" prop="单价">
<template slot-scope="scope">
{{ scope.row.单价 }}
</template>
</el-table-column>
<el-table-column label="合计" align="center" min-width="100" prop="合计">
<template slot-scope="scope">
{{ 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">
{{ scope.row.交货期要求 }}
</template>
</el-table-column>
<el-table-column label="备注" align="center" min-width="150" prop="备注">
<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>
</el-card>
<el-dialog :visible.sync="dialogVisible2" title="离线合同请款" center style="min-height: 300px" width="1000px">
<span>供应商</span>
<el-select v-model="supplierValue" placeholder="供应商" filterable clearable size="small">
<el-option
v-for="item in supplier"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-button type="success" size="small" icon="el-icon-search" style="margin: 0 10px 10px 10px" @click="searchTable01()">查询</el-button>
<el-table v-loading="" :data="tableData01" highlight-current-row border style="max-height: 300px;" height="300px" size="mini" @row-click="searchTable03" @selection-change="handleSelectionChange">
<el-table-column :selectable="selectable" type="selection" align="center" width="50"/>
<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="120">
<template slot-scope="scope">
{{ scope.row.离线合同名称 }}
</template>
</el-table-column>
<el-table-column label="供应商" align="center" min-width="180">
<template slot-scope="scope">
{{ scope.row.供应商名称 }}
</template>
</el-table-column>
<el-table-column label="采购员" align="center" width="80">
<template slot-scope="scope">
{{ scope.row.采购员 }}
</template>
</el-table-column>
<el-table-column label="合同总额" align="center" width="80" prop="合同总额">
<template slot-scope="scope">
{{ scope.row.合同总额 }}
</template>
</el-table-column>
<el-table-column label="已付金额" align="center" width="80" prop="已付金额">
<template slot-scope="scope">
{{ scope.row.已付金额 }}
</template>
</el-table-column>
<el-table-column label="请款金额" align="center" min-width="120" prop="请款金额">
<template slot-scope="scope">
<el-input-number :precision="2" v-model="scope.row.请款金额" size="mini" controls-position="right" style="width: 100%;"/>
</template>
</el-table-column>
</el-table>
<span>合计<el-input v-model="SUM" readonly size="mini" style="width: 80px; margin: 10px 10px 0 10px"/></span>
<el-button type="primary" size="small" style="float:right;margin: 10px" icon="el-icon-check" @click="submitRequestFund">确定请款</el-button>
<el-table v-loading="" :data="tableData02" :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.离线合同编号 }}
</template>
</el-table-column>
<el-table-column label="物料名称" align="center" min-width="150">
<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" width="80">
<template slot-scope="scope">
{{ scope.row.数量 }}
</template>
</el-table-column>
<el-table-column label="单价" align="center" width="80" prop="单价">
<template slot-scope="scope">
{{ scope.row.单价 }}
</template>
</el-table-column>
<el-table-column label="合计" align="center" width="80" prop="合计">
<template slot-scope="scope">
{{ 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">
{{ scope.row.交货期要求 }}
</template>
</el-table-column>
<el-table-column label="备注" align="center" min-width="150" prop="备注">
<template slot-scope="scope">
{{ scope.row.备注 }}
</template>
</el-table-column>
<el-table-column label="到货数量" align="center" width="80">
<template slot-scope="scope">
{{ scope.row.到货数量 }}
</template>
</el-table-column>
</el-table>
</el-dialog>
</div>
</template>
<script>
import { searchRequestFund, searchSupplier, searchOfflineContract, submitRequestFund, searchRequsetFundDetail, cancelRequestFund, searchMateriel } from '@/api/PurchasingCenter/OfflineContractRequestFund'
import { mapGetters } from 'vuex'
export default {
name: '', // 离线合同
data() {
return {
totalSum: 0,
totalPay: 0,
totalDebt: 0,
dateRange: '',
pickerOptions: {
shortcuts: [{
text: '上季度',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(end.getTime() - 3600 * 1000 * 24 * 30 * 3)
picker.$emit('pick', [start, end])
}
}, {
text: '过去半年',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(end.getTime() - 3600 * 1000 * 24 * 366 / 2)
picker.$emit('pick', [start, end])
}
}, {
text: '过去一年',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(end.getTime() - 3600 * 1000 * 24 * 365)
picker.$emit('pick', [start, end])
}
}]
},
offlineContract: '',
supplierName0: '',
supplierValue: '',
supplier: [],
pageCurrent1: 1,
pageSize1: 10,
total1: 0,
tableData1: [],
tableData2: [],
pageCurrent2: 1,
pageSize2: 10,
total2: 0,
tableData01: [],
tableData02: [],
dialogVisible2: false,
SUM: 0,
contractGroup: [],
sumGroup: [],
gridData: []
}
},
computed: {
...mapGetters([
'sidebar',
'avatar',
'name',
'id' // 人员编号
])
},
created() {
this.fetchData()
this.searchTable1()
},
methods: {
fetchData() {
this.supplier = []
searchSupplier().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.supplier.push({
label: response.data[i].供应商名称,
value: response.data[i].供应商流水号
})
}
})
},
searchTable1() { // 查询请款表
this.tableData2 = []
let check1, check2
this.dateRange ? check1 = 1 : (check1 = 0, this.dateRange = '')
this.supplierValue ? check2 = 1 : check2 = 0
searchRequestFund(this.pageCurrent1, this.pageSize1, check1, this.dateRange[0], this.dateRange[1], check2, this.supplierValue).then(response => {
this.tableData1 = response.data.rows
this.total1 = response.data.total
})
this.totalSum = 0
this.totalPay = 0
searchOfflineContract(check2, this.supplierValue).then(response => {
response.data.map(data => {
this.totalSum += data.合同总额
this.totalPay += data.已付金额
})
this.totalDebt = this.totalSum - this.totalPay
})
},
handleSizeChange1(val) {
this.pageSize1 = val
this.pageCurrent1 = 1
this.searchTable1()
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.searchTable1()
},
requestFund() { // 请款
this.dialogVisible2 = true
this.supplierValue = ''
this.fetchData() // 重新获取供应商
this.tableData01 = []
this.tableData02 = []
},
searchTable03(row) { // 查询离线合同明细
searchMateriel(row.离线合同流水号).then(response => {
this.tableData02 = response.data
})
},
getSummaries(param) { // 合计
const { columns, data } = param
const sums = []
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '总价'
} else if (index === 7) {
const values = data.map(item => Number(parseFloat(item['单价']) * parseInt(item['数量'])))
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)
sums[index] += ' 元'
} else {
sums[index] = 'N/A'
}
}
})
return sums
},
searchTable01() { // 查询待请款
this.tableData01 = []
if (this.supplierValue) {
this.contractGroup = []
let check
this.supplierValue ? check = 1 : check = 0
searchOfflineContract(check, this.supplierValue).then(response => {
response.data.map(data => {
if (Number(data.离线合同状态) === 2) {
this.tableData01.push(data)
}
})
this.tableData01.map(v => {
this.$set(v, '请款金额', 0)
v.请款金额 = v.合同总额 - v.已付金额
return v
})
})
} else {
this.$message.error('请选择供应商')
}
},
searchTable2(row) { // 查询离线合同明细
searchMateriel(row.离线合同流水号).then(response => {
this.tableData2 = response.data
})
},
handleSelectionChange(val) {
this.SUM = 0
this.contractGroup = []
this.sumGroup = []
console.log(val)
for (let i = 0; i < val.length; i++) {
this.SUM += parseFloat(val[i].请款金额)
this.contractGroup.push(val[i].离线合同流水号)
this.sumGroup.push(val[i].请款金额)
}
},
selectable(row, index) { // 控制某行是否可选
return parseInt(row.已请款) !== 1 // 已经请款
},
submitRequestFund() { // 确认请款
if (this.supplierValue && this.contractGroup.length !== 0) {
submitRequestFund(this.contractGroup, this.sumGroup, this.supplierValue, this.SUM, this.id).then(response => { // 离线合同流水号组=${contractGroup}&合同总额组=${sumGroup}&供应商流水号=${supplier}&请款金额=${money}&请款人=${person
if (response.data[0].result === '1') {
this.$message.success('请款成功')
this.searchTable1()
this.dialogVisible2 = false
} else { this.$message.error('请款失败') }
})
} else {
this.$message.error('请选择需要请款的合同')
}
},
searchTable02(row) { // 查看详情(请款信息包含的合同)
searchRequsetFundDetail(row.离线合同请款流水号).then(response => {
this.gridData = response.data
})
},
cancelRequestFund(row) { // 取消请款
this.$confirm('确定取消请款?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
cancelRequestFund(row.离线合同请款流水号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('操作成功')
this.searchTable1()
} else if (response.data[0].result === '已审批') {
this.searchTable1()
this.$message.error('已审批,操作失败')
} else { this.$message.error('操作失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消操作'
})
})
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom: 15px;
}
.el-date-editor{
width:150px;
}
.el-select{
width:200px
}
.el-input{
width:200px
}
span{
margin: 10px 0 10px 10px;
}
.el-tag{
margin: 0
}
.searchForm .el-form-item{
margin-bottom: 5px;
}
</style>

View File

@@ -0,0 +1,238 @@
<template>
<div class="app-container">
<el-card>
<div slot="header">
<el-row>
<span>合同编号:</span>
<el-input v-model="contractNumber" placeholder="合同编号" size="small" clearable style="width:180px"/>
<span>供应商:</span>
<el-input v-model="supplierName" placeholder="供应商" size="small" clearable style="width:180px"/>
<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-row>
</div>
<el-table
v-loading="loading1"
id="expandTable"
:data="tableData1"
size="mini"
border
style="width: 100%;max-height: 350px;"
height="350px"
highlight-current-row
@row-click="searchTable2">
<el-table-column label="供应商" align="center" min-width="220">
<template slot-scope="scope">
{{ scope.row.供应商名称 }}
</template>
</el-table-column>
<el-table-column label="离线合同名称" align="center" min-width="150">
<template slot-scope="scope">
{{ scope.row.离线合同名称 }}
</template>
</el-table-column>
<el-table-column label="离线合同编号" align="center" min-width="160">
<template slot-scope="scope">
{{ scope.row.离线合同编号 }}
</template>
</el-table-column>
<el-table-column label="采购员" align="center" min-width="60">
<template slot-scope="scope">
{{ scope.row.采购员 }}
</template>
</el-table-column>
<el-table-column label="总金额" align="center" min-width="60">
<template slot-scope="scope">
{{ scope.row.合同总额 }}
</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"
style="display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/>
</div>
</el-card>
<div id="offlineContract" style="background-color:white;min-height:500px;margin: 0 auto;width: 800px;border:1px solid black">
<table v-show="contractDetail.length > 0" class="offlineContract" cellspacing="0px" align="center" border="1 solid black" width="100%">
<tr>
<th colspan="14"><h1>离线合同</h1></th>
</tr>
<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="2" style="text-align: left;"/>
<td width="80px">供应商</td>
<td id="supplier" colspan="5" style="text-align: left;"/>
<td id="qrCode" colspan="2" rowspan="2"/>
</tr>
<tr>
<td width="80px">合同编号</td>
<td id="contractNum" colspan="2" style="text-align: left;"/>
<td width="80px">采购员</td>
<td id="buyer" colspan="5" style="text-align: left;"/>
</tr>
<tr id="tablehead">
<td width="50px">序号</td>
<td colspan="2">名称</td>
<td>规格</td>
<td colspan="2">型号</td>
<td>数量</td>
<td colspan="2">单价</td>
<td colspan="2">合计</td>
<td>交货期</td>
<td colspan="2">备注</td>
</tr>
<tr>
<td>总计</td>
<td id="remark" colspan="10"/>
<td id="total" colspan="2" style="text-align: left;"/>
<td/>
</tr>
</table>
</div>
</div>
</template>
<script>
import { searchOfflineContract, searchOfflineContractContent } from '@/api/PurchasingCenter/OfflineContractSearch'
import QRCode from 'qrcode'
import $ from 'jquery'
export default {
name: 'OfflineContractSearch',
data() {
return {
contractNumber: '',
supplierName: '',
total1: 0,
pageCurrent1: 1,
pageSize1: 10,
tableData1: [],
loading1: false,
contractDetail: []
}
},
created() {
this.searchTable1()
},
methods: {
// 查合同列表
searchTable1() {
let check1, check2
this.contractNumber ? check1 = 1 : check1 = 0
this.supplierName ? check2 = 1 : check2 = 0
this.loading1 = true
searchOfflineContract(this.pageCurrent1, this.pageSize1, check1, this.contractNumber, check2, this.supplierName).then(response => {
this.tableData1 = response.data.rows
this.total1 = response.data.total
this.loading1 = false
})
},
// 离线合同列表分页
handleSizeChange1(val) {
this.pageSize1 = val
this.searchTable1()
},
// 离线合同列表分页
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.searchTable1()
},
searchTable2(row) {
searchOfflineContractContent(row.离线合同流水号).then(response => {
this.contractDetail = response.data
this.showOffline(row)
})
},
showOffline(row) {
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 = []
let length = 0
this.contractDetail.length < 15 ? length = 15 : length = this.contractDetail.length
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 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"/>`
$('#tablehead').after(tr[i])
}
let total = 0
for (let j = 0; j < this.contractDetail.length; j++) {
document.getElementsByClassName('tableData')[j].children[0].innerHTML = j + 1
document.getElementsByClassName('tableData')[j].children[1].innerHTML = this.contractDetail[j].物料名称
document.getElementsByClassName('tableData')[j].children[2].innerHTML = this.contractDetail[j].物料规格
document.getElementsByClassName('tableData')[j].children[3].innerHTML = this.contractDetail[j].物料型号
document.getElementsByClassName('tableData')[j].children[4].innerHTML = this.contractDetail[j].数量
document.getElementsByClassName('tableData')[j].children[5].innerHTML = this.contractDetail[j].单价
document.getElementsByClassName('tableData')[j].children[6].innerHTML = (this.contractDetail[j].数量 * this.contractDetail[j].单价).toFixed(2)
document.getElementsByClassName('tableData')[j].children[7].innerHTML = this.contractDetail[j].交货期要求
document.getElementsByClassName('tableData')[j].children[8].innerHTML = this.contractDetail[j].备注
total += Number(this.contractDetail[j].数量 * this.contractDetail[j].单价)
}
total = total.toFixed(2)
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
document.getElementById('remark').innerHTML = row.离线合同备注
$('#qrCode').html(`<img id="img">`)
this.useqrcode(row.离线合同流水号) // 显示二维码
},
useqrcode(contractNum) { // 二维码
const opts = {
errorCorrectionLevel: 'H',
type: 'image/jpeg',
rendererOpts: {
quality: 0.3
}
}
const str = contractNum
QRCode.toDataURL(str, opts, function(err, url) {
if (err) throw err
const img = document.getElementById('img')
img.src = url
})
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom: 15px;
}
.el-date-editor{
width:200px
}
.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
}
</style>

View File

@@ -0,0 +1,205 @@
<template>
<div class="app-container">
<el-card>
<div slot="header">
<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>
</div>
<el-table v-loading="" :data="tableData1" stripe border style="width: 100%;max-height: 500px;" height="500px" size="mini">
<el-table-column type="expand">
<template slot-scope="scope">
<el-form label-position="left" inline class="demo-table-expand">
<el-row>
<el-form-item label="交货日期">
{{ scope.row.交货日期 }}
</el-form-item>
</el-row>
<el-row>
<el-form-item label="支付日期">
{{ scope.row.支付日期 }}
</el-form-item>
</el-row>
<el-row>
<el-form-item label="支付方式">
{{ scope.row.支付方式 }}
</el-form-item>
</el-row>
<el-row>
<el-form-item label="开票信息">
{{ scope.row.开票信息 }}
</el-form-item>
</el-row>
<el-row>
<el-form-item label="其他说明">
{{ scope.row.其他说明 }}
</el-form-item>
</el-row>
</el-form>
</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="150">
<template slot-scope="scope">
{{ scope.row.供应商名称 }}
</template>
</el-table-column>
<el-table-column label="采购员" align="center" min-width="60">
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
</el-table-column>
<el-table-column label="合同总额" align="center" min-width="70" fixed="right">
<template slot-scope="scope">
{{ scope.row.合同总额 }}
</template>
</el-table-column>
<el-table-column label="欠款金额" align="center" min-width="70" fixed="right">
<template slot-scope="scope">
{{ (Number(scope.row.合同总额)-Number(scope.row.已付金额)).toFixed(2) }}
</template>
</el-table-column>
<el-table-column label="已付金额" align="center" min-width="70" fixed="right">
<template slot-scope="scope">
{{ Number(scope.row.已付金额).toFixed(2) }}
</template>
</el-table-column>
<el-table-column label="付款进度" align="center" min-width="150" fixed="right">
<template slot-scope="scope">
<el-progress
:text-inside="true"
:stroke-width="18"
:percentage="scope.row.付款进度 = (100*(Number(scope.row.已付金额))/scope.row.合同总额) > 100 ? 100 : Number((100*(Number(scope.row.已付金额))/scope.row.合同总额).toFixed(2))"
status="success"/>
</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"
style="display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/>
</div>
</el-card>
</div>
</template>
<script>
import { initPayState, searchPayState } from '@/api/PurchasingCenter/PayStateSearch'
import { mapGetters } from 'vuex'
export default {
name: '', // 付款情况查询
data() {
return {
check1: 0,
check2: 0,
contractNumValue: '',
contractNum: [],
supplierName: '',
tableData1: [],
pageSize1: 10,
pageCurrent1: 1,
total1: 0,
dialogVisible1: false
}
},
computed: {
...mapGetters([
'sidebar',
'avatar',
'name',
'id' // 人员编号
])
},
created() {
this.fetchData()
this.searchTable1()
},
methods: {
fetchData() {
initPayState().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
searchPayState(this.pageCurrent1, this.pageSize1, this.check1, this.contractNumValue, this.check2, this.supplierName).then(response => {
this.tableData1 = response.data.rows
console.log(response.data.rows)
this.total1 = response.data.total
})
},
handleSizeChange1(val) {
this.pageSize1 = val
this.pageCurrent1 = 1
this.searchTable1()
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.searchTable1()
}
}
}
</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-form-item {
margin: 0;
}
</style>

View File

@@ -0,0 +1,209 @@
<template>
<div class="app-container">
<el-card>
<div slot="header">
<span>项目名称:</span>
<el-select v-model="projectValue" style="width:200px" placeholder="项目名称" size="small" filterable clearable @change="projectChange">
<el-option
v-for="item in project"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>机床图号:</span>
<el-select v-model="machineValue" style="width:190px" placeholder="请选择" size="small" clearable filterable @change="machineChange">
<el-option
v-for="item in machine"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>组号:</span>
<el-select v-model="groupValue" style="width:140px" placeholder="请选择" size="small" clearable filterable>
<el-option
v-for="item in group"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-button
type="success"
size="small"
icon="el-icon-search"
style="margin-left:10px"
@click="total1=0;pageCurrent1=1;pageSize1=10;searchTable1()">查询</el-button>
</div>
<el-table v-loading="" :data="tableData1" show-summary stripe border style="width: 100%;max-height: 600px;" height="600px" size="mini">
<el-table-column label="序号" align="center" width="80" type="index"/>
<el-table-column label="项目名称" align="center" min-width="100">
<template slot-scope="scope">
{{ scope.row.项目名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="机床图号" width="100px">
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column align="center" label="组号" width="80px">
<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.规格 }}
</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.优惠后单价 }}
</template>
</el-table-column>
<el-table-column label="优惠后小计(元)" align="center" min-width="100" prop="金额">
<template slot-scope="scope">
{{ scope.row.金额 = (Number(scope.row.优惠后单价) * Number(scope.row.数量)).toFixed(2) }}
</template>
</el-table-column>
</el-table>
</el-card>
</div>
</template>
<script>
import { initProject, searchMachine, searchGroup, searchProjectTotal } from '@/api/PurchasingCenter/ProjectTotalSearch'
import { mapGetters } from 'vuex'
export default {
name: '', // 项目总价查询
data() {
return {
projectValue: '',
project: [],
machineValue: '',
machine: [],
groupValue: '',
group: [],
pageCurrent1: 1,
pageSize1: 10,
total1: 0,
tableData1: []
}
},
computed: {
...mapGetters([
'sidebar',
'avatar',
'name',
'id' // 人员编号
])
},
created() {
this.fetchData()
},
methods: {
fetchData() {
initProject().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.project.push({
label: response.data[i].项目名称,
value: response.data[i].项目流水号
})
}
})
},
projectChange() {
this.machine = []
this.machineValue = ''
this.group = []
this.groupValue = ''
searchMachine(this.projectValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.machine.push({
value: response.data[i].机床流水号,
label: response.data[i].机床图号
})
}
})
},
machineChange() {
this.group = []
this.groupValue = ''
searchGroup(this.machineValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.group.push({
value: response.data[i].组件流水号,
label: response.data[i].组号
})
}
})
},
searchTable1() {
if (this.projectValue) {
let check2, check3
this.machineValue ? check2 = 1 : check2 = 0
this.groupValue ? check3 = 1 : check3 = 0
searchProjectTotal(1, this.projectValue, check2, this.machineValue, check3, this.groupValue).then(response => {
console.log(response.data)
this.tableData1 = response.data
})
} else {
this.$message.error('请选择项目')
}
},
handleSizeChange1(val) {
this.pageSize1 = val
this.pageCurrent1 = 1
this.searchTable1()
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.searchTable1()
}
}
}
</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>

View File

@@ -0,0 +1,325 @@
<template>
<div class="app-container">
<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-select v-model="personValue" placeholder="采购员" clearable size="small" style="width: 100px">
<el-option
v-for="item in person"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>供应商:</span>
<el-input v-model="supplierName" placeholder="供应商" size="small" clearable style="width:180px"/>
<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="loading1"
:data="tableData1"
size="mini"
border
style="width: 100%;max-height: 300px;"
height="300px"
highlight-current-row
@row-click="searchTable2">
<el-table-column type="expand">
<template slot-scope="scope">
<el-form id="table" label-position="left" inline class="demo-table-expand">
<el-row>
<el-form-item label="交货日期">
{{ scope.row.交货日期 }}
</el-form-item>
</el-row>
<el-row>
<el-form-item label="支付日期">
{{ scope.row.支付日期 }}
</el-form-item>
</el-row>
<el-row>
<el-form-item label="支付方式">
{{ scope.row.支付方式 }}
</el-form-item>
</el-row>
<el-row>
<el-form-item label="开票信息">
{{ scope.row.开票信息 }}
</el-form-item>
</el-row>
<el-row>
<el-form-item label="其他说明">
{{ scope.row.其他说明 }}
</el-form-item>
</el-row>
</el-form>
</template>
</el-table-column>
<el-table-column label="采购合同号" align="center" min-width="130">
<template slot-scope="scope">
{{ scope.row.采购合同编号 }}
</template>
</el-table-column>
<el-table-column label="采购合同名称" align="center" min-width="130">
<template slot-scope="scope">
{{ scope.row.采购合同名称 }}
</template>
</el-table-column>
<el-table-column label="供应商" align="center" min-width="150">
<template slot-scope="scope">
{{ scope.row.供应商名称 }}
</template>
</el-table-column>
<el-table-column label="采购员" align="center" min-width="60">
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
</el-table-column>
<el-table-column label="总金额" align="center" min-width="60">
<template slot-scope="scope">
{{ scope.row.合同总额 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" min-width="100" fixed="right">
<template slot-scope="scope">
<el-button type="primary" size="mini" icon="el-icon-edit-outline" @click="Open(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"
style="display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/>
</div>
</el-card>
<div style="background-color:white;min-height:500px;margin: 0px auto;width:800px;border:1px solid black" v-html="returns"/>
<el-dialog :visible.sync="dialogVisible3" title="审批" center style="min-height: 300px;" width="370px">
<el-form ref="form2" :model="form2" :rules="rules2" label-position="left" label-width="110px" class="demo-ruleForm">
<el-form-item label="审批是否通过" prop="审批是否通过" center>
<el-select v-model="form2.审批是否通过" size="small">
<el-option
v-for="item in approval"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="未通过原因" prop="未通过原因">
<el-input v-model="form2.未通过原因" :disabled="form2.审批是否通过!==2" size="small"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button size="small" @click="dialogVisible3=false">取消</el-button>
<el-button type="primary" size="small" @click="submitApproval('form2')">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { initContract, initBuyer, searchTable1, searchTable2, submitApproval } from '@/api/PurchasingCenter/PurchaseContractApproval'
import QRCode from 'qrcode'
import $ from 'jquery'
export default {
data() {
return {
person: [],
personValue: '',
RMB: '',
TotalAmount: '',
check1: 0,
check2: 0,
check3: 0,
check4: 0,
startEndDate: '',
contract: '',
freight: '',
contractNumValue: '',
contractNum: [],
ProcurementContractNum: '',
supplier: '',
supplierName: '',
total1: 0,
pageCurrent1: 1,
pageSize1: 10,
tableData1: [],
loading1: false,
dialogVisible3: false,
returns: '',
tableData01: [],
submitDisable: true,
approval: [
{
value: 1,
label: '是'
},
{
value: 2,
label: '否'
}
],
form2: {
审批是否通过: 1,
未通过原因: ''
},
rules2: {},
tableData2: [],
textarea: ``,
contractValue: '' // 显示表2和变更合同用的变量
}
},
created() {
this.fetchData()
this.searchTable1()
},
methods: {
fetchData() {
this.person = []
initBuyer().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.person.push({
text: response.data[i].姓名,
label: response.data[i].姓名,
value: response.data[i].人员编号
})
}
})
this.contractNum = []
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.tableData2 = []
this.textarea = ``
this.loading1 = true
if (this.startEndDate === '' || this.startEndDate === null || this.startEndDate[0] === '' || this.startEndDate[1] === '') {
this.check1 = 0
this.startEndDate = ''
} else { this.check1 = 1 }
this.contractNumValue ? this.check2 = 1 : this.check2 = 0
this.personValue ? this.check3 = 1 : this.check3 = 0
this.supplierName ? this.check4 = 1 : this.check4 = 0
searchTable1(this.pageCurrent1, this.pageSize1, this.check1, this.startEndDate[0], this.startEndDate[1], this.check2, this.contractNumValue, this.check3, this.personValue, this.check4, this.supplierName).then(response => {
this.loading1 = false
this.tableData1 = response.data.rows
this.total1 = response.data.total
})
},
Open(row) {
this.dialogVisible3 = true
this.ProcurementContractNum = row.采购合同流水号
},
submitApproval(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
submitApproval(this.ProcurementContractNum, this.form2.审批是否通过, this.form2.未通过原因).then(response => {
if (response.data[0].result === '1') {
this.$message.success('审批成功')
this.dialogVisible3 = false
this.fetchData() // 重新初始化
this.contractNumValue = ''
this.personValue = ''
this.supplierName = ''
this.searchTable1()
this.returns = ''
} else { this.$message.error('审批失败') }
})
} else {
console.log('error submit!!')
return false
}
})
},
handleSizeChange1(val) {
this.pageCurrent1 = 1
this.pageSize1 = val
this.searchTable1()
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.searchTable1()
},
searchTable2(row) {
this.contractValue = parseInt(row.采购合同流水号)
searchTable2(this.contractValue).then(response => {
this.returns = response.data[0].合同内容
}).then(() => {
$('#contractName').next('td').html(`<img id="img">`)
this.useqrcode(row.采购合同流水号) // 显示二维码
})
},
useqrcode(contractNum) { // 二维码
const opts = {
errorCorrectionLevel: 'H',
type: 'image/jpeg',
rendererOpts: {
quality: 0.3
}
}
const str = contractNum
QRCode.toDataURL(str, opts, function(err, url) {
if (err) throw err
const img = document.getElementById('img')
img.src = url
})
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom: 15px;
}
.el-date-editor{
width:200px
}
.el-select{
width:200px
}
.el-input{
width:200px
}
span{
margin: 10px 0 10px 10px;
}
.searchForm .el-form-item{
margin-bottom: 5px;
}
</style>
<style>
#table .el-form-item {
margin: 0;
}
</style>

View File

@@ -0,0 +1,484 @@
<template>
<div class="app-container">
<el-card>
<div slot="header">
<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=""
style="width:300px"
start-placeholder="开始日期"
end-placeholder="结束日期"/>
<el-button type="success" size="small" icon="el-icon-search" style="margin-left: 10px" @click="searchTable0()">查询</el-button>
</div>
<h3 style="margin-top: 0">付款计划</h3>
<el-table :data="tableData0" size="mini" border style="max-height: 250px;" height="250px" highlight-current-row @row-click="searchContract">
<el-table-column label="计划状态" width="100" align="center">
<template slot-scope="scope">
<el-tag v-if="timeToStamp(scope.row.计划付款日期) <= getDate" type="danger" size="small">已拖期</el-tag>
<el-tag v-if="timeToStamp(scope.row.计划付款日期) > getDate" type="success" size="small">未拖期</el-tag>
</template>
</el-table-column>
<el-table-column label="计划付款日期" min-width="100" align="center">
<template slot-scope="scope">
{{ scope.row.计划付款日期.split(' ')[0] }}
</template>
</el-table-column>
<el-table-column label="计划付款金额" min-width="100" align="center">
<template slot-scope="scope">
{{ scope.row.计划付款金额 }}
</template>
</el-table-column>
<el-table-column label="计划付款备注" min-width="100" align="center">
<template slot-scope="scope">
{{ scope.row.计划付款备注 }}
</template>
</el-table-column>
<el-table-column label="采购合同编号" min-width="100" align="center">
<template slot-scope="scope">
{{ scope.row.采购合同编号 }}
</template>
</el-table-column>
<el-table-column label="采购合同名称" min-width="100" align="center">
<template slot-scope="scope">
{{ scope.row.采购合同名称 }}
</template>
</el-table-column>
<el-table-column label="供应商" min-width="150" align="center">
<template slot-scope="scope">
{{ scope.row.供应商名称 }}
</template>
</el-table-column>
</el-table>
</el-card>
<el-card>
<div slot="header">
<span>供应商</span>
<el-select v-model="supplierValue" placeholder="供应商" filterable size="small" clearable @change="totalSum=0;totalPay=0;totalDebt=0;">
<el-option
v-for="item in supplier"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-button
type="success"
size="small"
icon="el-icon-search"
style="margin-left: 10px"
@click="pageCurrent1=1;pageSize1=10;total1=0;searchTable1()">查询</el-button>
<el-button type="primary" size="small" icon="el-icon-goods" style="" @click="requestFund">请款</el-button>
<div style="margin-top: 10px">
<span v-show="supplierValue">累计合同总额</span>
<el-input v-show="supplierValue" v-model="totalSum" size="mini" style="width: 100px;" readonly/>
<span v-show="supplierValue">累计付款</span>
<el-input v-show="supplierValue" v-model="totalPay" size="mini" style="width: 100px;" readonly/>
<span v-show="supplierValue">累计欠款</span>
<el-input v-show="supplierValue" v-model="totalDebt" size="mini" style="width: 100px;" readonly/>
</div>
</div>
<h3 style="margin-top: 0">请款表</h3>
<el-table v-loading="" :data="tableData1" border style="max-height: 500px;" height="500px" size="mini">
<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" min-width="150">
<template slot-scope="scope">
{{ scope.row.请款时间 }}
</template>
</el-table-column>
<el-table-column label="请款人" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
</el-table-column>
<el-table-column label="请款金额" align="center" min-width="90" prop="请款金额">
<template slot-scope="scope">
{{ scope.row.请款金额 }}
</template>
</el-table-column>
<el-table-column label="请款付款情况" align="center">
<el-table-column label="审核情况内容" width="100" align="center">
<template slot-scope="scope">
<el-tag v-if="Number(scope.row.审核情况流水号)===3" type="primary" size="small">未审核</el-tag>
<el-tag v-if="Number(scope.row.审核情况流水号)===1" type="success" size="small">已通过</el-tag>
<el-tag v-if="Number(scope.row.审核情况流水号)===2" type="danger" size="small">不通过</el-tag>
</template>
</el-table-column>
<el-table-column label="未通过审核原因" width="110" align="center">
<template slot-scope="scope">
{{ scope.row.未通过审核原因 === '通过' ? '—' : scope.row.未通过审核原因 }}
</template>
</el-table-column>
<el-table-column label="审批情况内容" width="100" align="center">
<template slot-scope="scope">
<el-tag v-if="Number(scope.row.审批情况流水号)===3" type="primary" size="small">未审批</el-tag>
<el-tag v-if="Number(scope.row.审批情况流水号)===1" type="success" size="small">已通过</el-tag>
<el-tag v-if="Number(scope.row.审批情况流水号)===2" type="danger" size="small">不通过</el-tag>
</template>
</el-table-column>
<el-table-column label="未通过审批原因" width="110" align="center">
<template slot-scope="scope">
{{ scope.row.未通过审批原因 === '通过' ? '—' : scope.row.未通过审批原因 }}
</template>
</el-table-column>
<el-table-column label="付款情况" width="100" align="center">
<template slot-scope="scope">
<el-tag v-if="Number(scope.row.付款情况流水号)===3" type="primary" size="small">未操作</el-tag>
<el-tag v-if="Number(scope.row.付款情况流水号)===1" type="success" size="small">已付款</el-tag>
<el-tag v-if="Number(scope.row.付款情况流水号)===2" type="danger" size="small">不同意</el-tag>
</template>
</el-table-column>
<el-table-column label="未付款原因" width="100" align="center">
<template slot-scope="scope">
{{ scope.row.未付款原因 === '通过' ? '—' : scope.row.未付款原因 }}
</template>
</el-table-column>
</el-table-column>
<el-table-column label="操作" align="center" width="250">
<template slot-scope="scope">
<el-popover placement="right" width="500" trigger="click">
<el-table :data="gridData" highlight-current-row size="mini" show-summary @row-click="searchContract">
<el-table-column width="50" align="center" type="index" label="序号"/>
<el-table-column min-width="150" align="center" label="采购合同编号">
<template slot-scope="scope">
{{ scope.row.采购合同编号 }}
</template>
</el-table-column>
<el-table-column min-width="100" align="center" label="已付金额" prop="已付金额">
<template slot-scope="scope">
{{ scope.row.已付金额 }}
</template>
</el-table-column>
<el-table-column min-width="100" 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="searchTable02(scope.row)">查看详情</el-button>
</el-popover>
<el-button :disabled="Number(id)!==Number(scope.row.请款人)||Number(scope.row.审核情况流水号)!==3" type="danger" size="mini" icon="el-icon-delete" style="margin-left: 10px" @click="cancelRequestFund(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"
style="display:inline-block;width:700px"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/>
</div>
</el-card>
<el-dialog :visible.sync="dialogVisible2" title="采购合同请款" center style="min-height: 300px" width="1000px">
<span>供应商</span>
<el-select v-model="supplierValue" placeholder="供应商" filterable clearable size="small">
<el-option
v-for="item in supplier"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-button type="success" size="small" icon="el-icon-search" style="margin: 0 10px 10px 10px" @click="searchTable01()">查询</el-button>
<el-table v-loading="" :data="tableData01" border style="max-height: 300px;" height="300px" size="mini" @row-click="searchContract" @selection-change="handleSelectionChange">
<el-table-column :selectable="selectable" type="selection" align="center" width="50"/>
<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="120">
<template slot-scope="scope">
{{ scope.row.采购合同名称 }}
</template>
</el-table-column>
<el-table-column label="供应商" align="center" min-width="180">
<template slot-scope="scope">
{{ scope.row.供应商名称 }}
</template>
</el-table-column>
<el-table-column label="采购员" align="center" width="80">
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
</el-table-column>
<el-table-column label="合同总额" align="center" width="80" prop="合同总额">
<template slot-scope="scope">
{{ scope.row.合同总额 }}
</template>
</el-table-column>
<el-table-column label="已付金额" align="center" width="80" prop="已付金额">
<template slot-scope="scope">
{{ scope.row.已付金额 }}
</template>
</el-table-column>
<el-table-column label="请款金额" align="center" min-width="120" prop="请款金额">
<template slot-scope="scope">
<el-input-number v-model="scope.row.请款金额" :precision="2" size="mini" controls-position="right" style="width: 100%;"/>
</template>
</el-table-column>
</el-table>
<span>合计<el-input v-model="SUM" readonly size="mini" style="width: 80px; margin: 10px 10px 0 10px"/></span>
<el-button type="primary" size="small" style="float:right;margin: 10px" icon="el-icon-check" @click="submitRequestFund">确定请款</el-button>
</el-dialog>
<div style="min-height:500px;margin: 0px auto;width:800px;border:1px solid black" v-html="returns"/>
</div>
</template>
<script>
import { searchTable0, searchContract, searchSupplier, searchRequestFund, searchPurchaseContract, submitRequestFund, searchRequsetFundDetail, cancelRequestFund } from '@/api/PurchasingCenter/PurchaseContractRequestFund'
import { mapGetters } from 'vuex'
import { getNowTime, timeToStamp } from '@/utils/tool'
export default {
data() {
return {
getDate: null,
tableData0: [],
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])
}
}, {
text: '未来两个月',
onClick(picker) {
const end = new Date()
const start = new Date()
end.setTime(start.getTime() + 3600 * 1000 * 24 * 30 * 2)
picker.$emit('pick', [start, end])
}
}, {
text: '未来三个月',
onClick(picker) {
const end = new Date()
const start = new Date()
end.setTime(start.getTime() + 3600 * 1000 * 24 * 30 * 3)
picker.$emit('pick', [start, end])
}
}, {
text: '未来半年',
onClick(picker) {
const end = new Date()
const start = new Date()
end.setTime(start.getTime() + 3600 * 1000 * 24 * 30 * 6)
picker.$emit('pick', [start, end])
}
}]
},
dateRange: '',
tableData1: [],
total1: 0,
pageCurrent1: 1,
pageSize1: 10,
returns: '',
supplierValue: '',
supplier: [],
totalSum: 0,
totalPay: 0,
totalDebt: 0,
tableData2: [],
dialogVisible2: false,
tableData01: [],
SUM: 0,
contractGroup: [],
gridData: []
}
},
computed: {
...mapGetters([
'sidebar',
'name',
'id'
])
},
created() {
this.fetchData()
this.searchTable0()
this.searchTable1()
},
methods: {
timeToStamp(param) { // 转时间戳
return timeToStamp(param)
},
searchTable0() { // 查询付款计划
this.getDate = timeToStamp(getNowTime()) // 获取当前时间
let check
this.dateRange ? check = 1 : (check = 0, this.dateRange = '')
searchTable0(check, this.dateRange[0], this.dateRange[1]).then(response => {
this.tableData0 = response.data
})
},
fetchData() {
this.supplier = []
searchSupplier().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.supplier.push({
label: response.data[i].供应商名称,
value: response.data[i].供应商流水号
})
}
})
},
searchContract(row) {
searchContract(row.采购合同流水号).then(response => {
this.returns = response.data[0].合同内容
})
},
handleSizeChange1(val) {
this.pageSize1 = val
this.pageCurrent1 = 1
this.searchTable1()
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.searchTable1()
},
searchTable1() { // 查请款信息
let check1, check2
this.dateRange ? check1 = 1 : (check1 = 0, this.dateRange = '')
this.supplierValue ? check2 = 1 : check2 = 0
searchRequestFund(this.pageCurrent1, this.pageSize1, check1, this.dateRange[0], this.dateRange[1], check2, this.supplierValue).then(response => {
this.tableData1 = response.data.rows
this.total1 = response.data.total
})
this.totalSum = 0
this.totalPay = 0
searchPurchaseContract(check2, this.supplierValue).then(response => {
response.data.map(data => {
this.totalSum += data.合同总额
this.totalPay += data.已付金额
})
this.totalDebt = this.totalSum - this.totalPay
})
},
requestFund() { // 请款
this.dialogVisible2 = true
this.supplierValue = ''
this.fetchData() // 重新获取供应商
this.tableData01 = []
},
searchTable01() { // 查询待请款
if (this.supplierValue) {
this.contractGroup = []
let check
this.supplierValue ? check = 1 : check = 0
searchPurchaseContract(check, this.supplierValue).then(response => {
this.tableData01 = response.data
this.tableData01.map(v => {
this.$set(v, '请款金额', 0)
v.请款金额 = v.合同总额 - v.已付金额
return v
})
})
} else {
this.$message.error('请选择供应商')
}
},
selectable(row, index) { // 控制某行是否可选
return parseInt(row.已请款) !== 1 // 已经请款
},
handleSelectionChange(val) {
this.SUM = 0
this.contractGroup = []
this.sumGroup = []
for (let i = 0; i < val.length; i++) {
this.SUM += parseFloat(val[i].请款金额)
this.contractGroup.push(val[i].采购合同流水号)
this.sumGroup.push(val[i].请款金额)
}
},
submitRequestFund() { // 确认请款
if (this.supplierValue && this.contractGroup.length !== 0) {
submitRequestFund(this.contractGroup, this.sumGroup, this.supplierValue, this.SUM, this.id).then(response => { // 采购合同流水号组=${contractGroup}&合同总额组=${sumGroup}&供应商流水号=${supplier}&请款金额=${money}&请款人=${person
if (response.data[0].result === '1') {
this.$message.success('请款成功')
this.searchTable1()
this.dialogVisible2 = false
} else { this.$message.error('请款失败') }
})
} else {
this.$message.error('请选择需要请款的合同')
}
},
searchTable02(row) { // 查看详情(请款信息包含的合同)
searchRequsetFundDetail(row.采购合同请款流水号).then(response => {
this.gridData = response.data
})
},
cancelRequestFund(row) { // 取消请款
this.$confirm('确定取消请款?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
cancelRequestFund(row.采购合同请款流水号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('操作成功')
this.searchTable1()
} else if (response.data[0].result === '已审批') {
this.searchTable1()
this.$message.error('已审批,操作失败')
} else { this.$message.error('操作失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消操作'
})
})
}
}
}
</script>
<style scoped>
.el-tag{
margin: 0
}
.el-card{
margin-bottom: 15px;
}
.el-date-editor{
width:150px;
}
.el-select{
width:200px
}
.el-input{
width:200px
}
span{
margin: 10px 0 10px 10px;
}
.searchForm .el-form-item{
margin-bottom: 5px;
}
</style>

View File

@@ -0,0 +1,368 @@
<template>
<div class="app-container">
<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-select v-model="personValue" placeholder="采购员" clearable size="small" style="width: 100px">
<el-option
v-for="item in person"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>供应商:</span>
<el-input v-model="supplierName" placeholder="供应商" size="small" clearable style="width:180px"/>
<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-button
type="primary"
size="small"
icon="el-icon-search"
style="margin-left:10px"
@click="setting()">通知</el-button>
</el-card>
<el-card>
<el-table
v-loading="loading1"
:data="tableData1"
size="mini"
border
style="width: 100%;max-height: 300px;"
height="300px"
highlight-current-row
@row-click="searchTable2">
<el-table-column type="expand">
<template slot-scope="scope">
<el-form id="table" label-position="left" inline class="demo-table-expand">
<el-row>
<el-form-item label="交货日期">
{{ scope.row.交货日期 }}
</el-form-item>
</el-row>
<el-row>
<el-form-item label="支付日期">
{{ scope.row.支付日期 }}
</el-form-item>
</el-row>
<el-row>
<el-form-item label="支付方式">
{{ scope.row.支付方式 }}
</el-form-item>
</el-row>
<el-row>
<el-form-item label="开票信息">
{{ scope.row.开票信息 }}
</el-form-item>
</el-row>
<el-row>
<el-form-item label="其他说明">
{{ scope.row.其他说明 }}
</el-form-item>
</el-row>
</el-form>
</template>
</el-table-column>
<el-table-column label="采购合同号" align="center" min-width="130">
<template slot-scope="scope">
{{ scope.row.采购合同编号 }}
</template>
</el-table-column>
<el-table-column label="采购合同名称" align="center" min-width="130">
<template slot-scope="scope">
{{ scope.row.采购合同名称 }}
</template>
</el-table-column>
<el-table-column label="供应商" align="center" min-width="150">
<template slot-scope="scope">
{{ scope.row.供应商名称 }}
</template>
</el-table-column>
<el-table-column label="采购员" align="center" min-width="60">
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
</el-table-column>
<el-table-column label="总金额" align="center" min-width="60">
<template slot-scope="scope">
{{ scope.row.合同总额 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" min-width="100" fixed="right">
<template slot-scope="scope">
<el-button type="primary" size="mini" icon="el-icon-edit-outline" @click="Open(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"
style="display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/>
</div>
</el-card>
<div style="min-height:500px;margin: 0px auto;width:800px;border:1px solid black" v-html="returns"/>
<el-dialog :visible.sync="dialogFormVisible" title="通知" center style="min-height: 300px;" width="370px">
<el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="110px" class="demo-ruleForm">
<el-form-item label="接收人" prop="接收人" center>
<el-select v-model="form.接收人" size="small">
<el-option
v-for="item in Person"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="内容" prop="内容">
<el-input v-model="form.内容" size="small"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button size="small" @click="dialogFormVisible=false">取消</el-button>
<el-button type="primary" size="small" @click="submit('form')">确定</el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogVisible3" title="审核" center style="min-height: 300px;" width="370px">
<el-form ref="form2" :model="form2" :rules="rules2" label-position="left" label-width="110px" class="demo-ruleForm">
<el-form-item label="审核是否通过" prop="审核是否通过" center>
<el-select v-model="form2.审核是否通过" size="small">
<el-option
v-for="item in approval"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="未通过审核原因" prop="未通过审核原因">
<el-input v-model="form2.未通过审核原因" :disabled="form2.审核是否通过!==2" size="small"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button size="small" @click="dialogVisible3=false">取消</el-button>
<el-button type="primary" size="small" @click="submitApproval('form2')">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { initContract, initBuyer, searchTable1, searchTable2, submitApproval, initPerson } from '@/api/PurchasingCenter/PurchaseContractReview'
import axios from 'axios'
export default {
data() {
return {
person: [],
personValue: '',
RMB: '',
TotalAmount: '',
check1: 0,
check2: 0,
check3: 0,
check4: 0,
startEndDate: '',
contract: '',
freight: '',
contractNumValue: '',
contractNum: [],
ProcurementContractNum: '',
supplier: '',
supplierName: '',
total1: 0,
pageCurrent1: 1,
pageSize1: 10,
tableData1: [],
loading1: false,
dialogVisible3: false,
dialogFormVisible: false,
returns: '',
tableData01: [],
submitDisable: true,
approval: [
{
value: 1,
label: '是'
},
{
value: 2,
label: '否'
}
],
form2: {
审核是否通过: 1,
未通过审核原因: ''
},
rules2: {},
Person: [],
form: {
接收人: '',
内容: '合同审批: 有合同需要您审批【meswork】'
},
rules: {},
tableData2: [],
telephone: '',
text: '',
textarea: ``,
contractValue: '' // 显示表2和变更合同用的变量
}
},
created() {
this.fetchData()
this.searchTable1()
},
methods: {
fetchData() {
this.person = []
initBuyer().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.person.push({
text: response.data[i].姓名,
label: response.data[i].姓名,
value: response.data[i].人员编号
})
}
})
initPerson().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.Person.push({
label: response.data[i].姓名,
value: response.data[i].联系电话
})
}
})
this.contractNum = []
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].采购合同流水号
})
}
})
},
setting() {
this.dialogFormVisible = true
},
submit() {
this.telephone = this.form.接收人
this.text = this.form.内容
this.dialogFormVisible = false
this.sendMessage()
},
// 发送短信
sendMessage() {
axios.get(`http://192.168.1.231:8411/submit/MESSendMessage.ashx?Uid=liuqinghua&Key=liuqinghua123456&smsMob=${this.telephone}&smsText=${this.text}`).then(data => {
if (data.data === 1) {
this.$message.success('通知成功')
}
console.log(data)
})
},
searchTable1() {
this.tableData2 = []
this.textarea = ``
this.loading1 = true
if (this.startEndDate === '' || this.startEndDate === null || this.startEndDate[0] === '' || this.startEndDate[1] === '') {
this.check1 = 0
this.startEndDate = ''
} else { this.check1 = 1 }
this.contractNumValue ? this.check2 = 1 : this.check2 = 0
this.personValue ? this.check3 = 1 : this.check3 = 0
this.supplierName ? this.check4 = 1 : this.check4 = 0
searchTable1(this.pageCurrent1, this.pageSize1, this.check1, this.startEndDate[0], this.startEndDate[1], this.check2, this.contractNumValue, this.check3, this.personValue, this.check4, this.supplierName).then(response => {
this.loading1 = false
this.tableData1 = response.data.rows
this.total1 = response.data.total
})
},
Open(row) {
this.dialogVisible3 = true
this.ProcurementContractNum = row.采购合同流水号
},
submitApproval(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
submitApproval(this.ProcurementContractNum, this.form2.审核是否通过, this.form2.未通过审核原因).then(response => {
if (response.data[0].result === '1') {
this.$message.success('审核成功')
this.dialogVisible3 = false
this.fetchData() // 重新初始化
this.contractNumValue = ''
this.personValue = ''
this.supplierName = ''
this.searchTable1()
this.returns = ''
} else { this.$message.error('审核失败') }
})
} else {
console.log('error submit!!')
return false
}
})
},
handleSizeChange1(val) {
this.pageCurrent1 = 1
this.pageSize1 = val
this.searchTable1()
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.searchTable1()
},
searchTable2(row) {
this.contractValue = parseInt(row.采购合同流水号)
searchTable2(this.contractValue).then(response => {
this.returns = response.data[0].合同内容
})
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom: 15px;
}
.el-date-editor{
width:200px
}
.el-select{
width:200px
}
.el-input{
width:200px
}
span{
margin: 10px 0 10px 10px;
}
.searchForm .el-form-item{
margin-bottom: 5px;
}
</style>
<style>
#table .el-form-item {
margin: 0;
}
</style>

View File

@@ -0,0 +1,423 @@
<template>
<div class="app-container">
<el-card>
<div slot="header">
<!--<span>时间段:</span>-->
<!--<el-date-picker-->
<!--v-model="startEndDate"-->
<!--style="width:250px"-->
<!--size="small"-->
<!--type="daterange"-->
<!--value-format="yyyy-MM-dd"-->
<!--format="yyyy-MM-dd"-->
<!--start-placeholder="开始日期"-->
<!--end-placeholder="结束日期"/>-->
<el-row>
<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>-->
<el-input v-model="contractNumber" placeholder="合同编号" size="small" clearable style="width:180px"/>
<span>供应商:</span>
<el-input v-model="supplierName" placeholder="供应商" size="small" clearable style="width:180px"/>
<span>采购员:</span>
<el-select v-model="personValue" placeholder="采购员" size="small" clearable style="width: 100px">
<el-option
v-for="item in person"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-row>
<el-row style="margin-top: 15px">
<span>审核情况:</span>
<el-select v-model="revieweValue" placeholder="审核情况" size="small" style="width: 100px">
<el-option
v-for="item in reviewe"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>审批情况:</span>
<el-select v-model="approvalValue" placeholder="审批情况" size="small" style="width: 100px">
<el-option
v-for="item in approval"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<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-button
type="warning"
size="small"
icon="el-icon-download"
@click="download()">导出</el-button>
</el-row>
</div>
<el-table
v-loading="loading1"
id="expandTable"
:data="tableData1"
size="mini"
border
style="width: 100%;max-height: 350px;"
height="350px"
highlight-current-row
@row-click="searchTable2">
<el-table-column type="expand">
<template slot-scope="scope">
<el-form label-position="left" inline class="demo-table-expand">
<el-row>
<el-form-item label="交货日期">
{{ scope.row.交货日期 }}
</el-form-item>
</el-row>
<el-row>
<el-form-item label="支付日期">
{{ scope.row.支付日期 }}
</el-form-item>
</el-row>
<el-row>
<el-form-item label="支付方式">
{{ scope.row.支付方式 }}
</el-form-item>
</el-row>
<el-row>
<el-form-item label="开票信息">
{{ scope.row.开票信息 }}
</el-form-item>
</el-row>
<el-row>
<el-form-item label="其他说明">
{{ scope.row.其他说明 }}
</el-form-item>
</el-row>
</el-form>
</template>
</el-table-column>
<el-table-column label="供应商" align="center" min-width="220">
<template slot-scope="scope">
{{ scope.row.供应商名称 }}
</template>
</el-table-column>
<el-table-column label="采购合同名称" align="center" min-width="150">
<template slot-scope="scope">
{{ scope.row.采购合同名称 }}
</template>
</el-table-column>
<el-table-column label="采购合同号" align="center" min-width="160">
<template slot-scope="scope">
{{ scope.row.采购合同编号 }}
</template>
</el-table-column>
<el-table-column label="审核情况" align="center" min-width="80">
<template slot-scope="scope">
<el-tag v-if="scope.row.审核情况内容==='未审核'" type="primary" size="small">未审核</el-tag>
<el-tag v-if="scope.row.审核情况内容==='通过审核'" type="success" size="small">已通过</el-tag>
<el-tag v-if="scope.row.审核情况内容==='未通过审核'" type="danger" size="small">未通过</el-tag>
</template>
</el-table-column>
<el-table-column label="审批情况" align="center" min-width="80">
<template slot-scope="scope">
<el-tag v-if="scope.row.审批情况内容==='未审批'" type="primary" size="small">未审批</el-tag>
<el-tag v-if="scope.row.审批情况内容==='通过审批'" type="success" size="small">已通过</el-tag>
<el-tag v-if="scope.row.审批情况内容==='不通过审批'" type="danger" size="small">未通过</el-tag>
</template>
</el-table-column>
<el-table-column label="未通过审核原因" align="center" min-width="150">
<template slot-scope="scope">
{{ scope.row.未通过审核原因 ? scope.row.未通过审核原因 : '—' }}
</template>
</el-table-column>
<el-table-column label="未通过审批原因" align="center" min-width="150">
<template slot-scope="scope">
{{ scope.row.未通过原因 ? scope.row.未通过原因 : '—' }}
</template>
</el-table-column>
<el-table-column label="审核时间" align="center" min-width="140">
<template slot-scope="scope">
{{ scope.row.审核时间 ? scope.row.审核时间 : '—' }}
</template>
</el-table-column>
<el-table-column label="审批时间" align="center" min-width="140">
<template slot-scope="scope">
{{ scope.row.审批时间 ? scope.row.审核时间 : '—' }}
</template>
</el-table-column>
<el-table-column label="采购员" align="center" min-width="60">
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
</el-table-column>
<el-table-column label="总金额" align="center" min-width="60">
<template slot-scope="scope">
{{ scope.row.合同总额 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" min-width="100">
<template slot-scope="scope">
<el-button :disabled="true" type="danger" size="mini" icon="el-icon-delete" @click="deleteContract(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"
style="display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/>
</div>
</el-card>
<div id="print" class="print" style="background-color:white;min-height:500px;margin: 0px auto;width:800px;border:1px solid black" v-html="returns"/>
<el-card v-show="searchView">
<!--将新一般处理页添加至通讯服务器-->
<div>附件图</div>
<img v-if="searchView" :src="searchView">
</el-card>
</div>
</template>
<script>
import { initContract, initBuyer, searchTable1, searchTable2, deleteContract } from '@/api/PurchasingCenter/PurchaseContractSearch'
import QRCode from 'qrcode'
import $ from 'jquery'
// import { exportExcelMethod } from './exportExcel'
export default {
data() {
return {
contractNumber: '',
searchView: '', // 图片预览
approval: [{
value: 0,
label: '全部'
}, {
value: 1,
label: '已通过'
}, {
value: 2,
label: '未通过'
}, {
value: 3,
label: '未审批'
}],
approvalValue: 0,
reviewe: [{
value: 0,
label: '全部'
}, {
value: 1,
label: '已通过'
}, {
value: 2,
label: '未通过'
}, {
value: 3,
label: '未审核'
}],
revieweValue: 0,
RMB: '',
TotalAmount: '',
check1: 0,
check2: 0,
check3: 0,
check4: 0,
check5: 0,
startEndDate: '',
contract: '',
freight: '',
contractNumValue: '',
contractNum: [],
ProcurementContractNum: '',
personValue: '',
person: [],
supplier: '',
supplierName: '',
total1: 0,
pageCurrent1: 1,
pageSize1: 10,
tableData1: [],
loading1: false,
returns: '',
tableData01: [],
tableData02: [],
submitDisable: true,
disable: [], // 删除按钮禁用
tableData2: [],
textarea: ``,
contractValue: '' // 显示表2和变更合同用的变量
}
},
created() {
this.fetchData()
this.searchTable1()
},
methods: {
deleteContract(row) { // 删除合同
this.$confirm('此操作将永久删除合同所有内容,确定删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteContract(row.采购合同流水号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
this.searchTable1()
this.returns = ''
} else { this.$message.error('删除失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
download() { // 导出打印
if (this.contractValue) {
// exportExcelMethod('print', '采购合同', '采购合同sheet1')
const htmlNode = $('#print').html()
const body = $('body').attr('style', 'padding: 20px;margin: 0 auto;display: block;width: 800px;background: #fff;')
body.children().hide()
const printNode = $(htmlNode)
body.append(printNode)
window.print()
body.removeAttr('style')
body.children().not('script').show()
body.children().not('#app').hide()
printNode.remove()
} else {
this.$message.error('请选择合同')
}
},
useqrcode(contractNum) { // 二维码
const opts = {
errorCorrectionLevel: 'H',
type: 'image/jpeg',
rendererOpts: {
quality: 0.3
}
}
const str = contractNum
QRCode.toDataURL(str, opts, function(err, url) {
if (err) throw err
const img = document.getElementById('img')
img.src = url
})
},
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].采购合同流水号
})
}
})
initBuyer().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.person.push({
text: response.data[i].姓名,
label: response.data[i].姓名,
value: response.data[i].人员编号
})
}
})
},
searchTable1() {
this.tableData2 = []
this.textarea = ``
this.loading1 = true
this.disable = []
if (this.startEndDate === '' || this.startEndDate === null || this.startEndDate[0] === '' || this.startEndDate[1] === '') {
this.check1 = 0
this.startEndDate = ''
} else { this.check1 = 1 }
this.contractNumValue ? this.check2 = 1 : this.check2 = 0
this.personValue ? this.check3 = 1 : this.check3 = 0
this.supplierName ? this.check4 = 1 : this.check4 = 0
if (this.approvalValue === '' || this.approvalValue === 0) {
this.check5 = 0
} else {
this.check5 = 1
}
let check, check2
this.contractNumber ? check = 1 : check = 0
this.revieweValue ? check2 = 1 : check2 = 0
searchTable1(this.pageCurrent1, this.pageSize1, this.check1, this.startEndDate[0], this.startEndDate[1], this.check2, this.contractNumValue, this.check3, this.personValue, this.check4, this.supplierName, this.check5, this.approvalValue, check, this.contractNumber, check2, this.revieweValue).then(response => {
for (let i = 0; i < response.data.rows.length; i++) {
response.data.rows[i].审批情况内容 === '未审批' ? this.disable.push(false) : this.disable.push(true) // 删除按钮禁用
}
this.tableData1 = response.data.rows
this.total1 = response.data.total
this.loading1 = false
})
},
handleSizeChange1(val) {
this.pageCurrent1 = 1
this.pageSize1 = val
this.searchTable1()
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.searchTable1()
},
searchTable2(row) {
this.contractValue = parseInt(row.采购合同流水号)
searchTable2(this.contractValue).then(response => {
this.returns = response.data[0].合同内容
}).then(() => {
$('#contractName').next('td').html(`<img id="img">`)
this.useqrcode(row.采购合同流水号) // 显示二维码
})
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom: 15px;
}
.el-date-editor{
width:200px
}
.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
}
</style>
<style>
#expandTable .el-form-item {
margin: 0;
}
</style>

View File

@@ -0,0 +1,600 @@
<template>
<div class="app-container">
<el-card>
<span>供应商名称:</span>
<el-select v-model="supplierNumValue" placeholder="供应商" size="small" filterable clearable>
<el-option
v-for="item in supplierNum"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<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-button
:disabled="office"
type="primary"
size="small"
icon="el-icon-circle-plus-outline"
style="margin-left: 10px"
@click="handleAdd()">增加</el-button>
</el-card>
<el-card>
<el-table id="expandTable" :data="tableData1" show-summary size="mini" style="max-height: 400px" height="400px" stripe border @row-click="searchPicInner">
<el-table-column type="expand">
<template slot-scope="scope">
<el-form id="table" label-position="left" inline class="demo-table-expand">
<el-row>
<el-col :span="10">
<viewer>
<img :src="scope.row.scanSrc" alt="发票扫描件" height="200px">
</viewer>
</el-col>
<el-col :span="14">
<el-form-item label="接收人">
{{ scope.row.接收人 ? scope.row.接收人 : '—' }}
</el-form-item><br>
<el-form-item label="接收时间">
{{ scope.row.接收时间 ? scope.row.接收时间 : '—' }}
</el-form-item><br>
<el-form-item label="发票号">
{{ scope.row.发票号 ? scope.row.发票号 : '—' }}
</el-form-item><br>
<el-form-item label="开户行">
{{ scope.row.开户行 ? scope.row.开户行 : '—' }}
</el-form-item><br>
<el-form-item label="开票时间">
{{ scope.row.开票时间 ? scope.row.开票时间.split(' ')[0] : '—' }}
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
</el-table-column>
<el-table-column align="center" label="交接状态" min-width="80px">
<template slot-scope="scope">
<el-tag v-if="scope.row.接收人" type="success" size="small">已接收</el-tag>
<el-tag v-else type="warning" size="small">未接收</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="供应商" min-width="200px">
<template slot-scope="scope">
{{ scope.row.供应商名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="相关合同" min-width="80px">
<template slot-scope="scope">
<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.采购合同编号 ? scope.row.采购合同编号 : scope.row.离线合同编号 }}
</template>
</el-table-column>
<el-table-column min-width="100" align="center" label="合同名称">
<template slot-scope="scope">
{{ scope.row.采购合同编号 ? scope.row.采购合同名称 : scope.row.离线合同名称 }}
</template>
</el-table-column>
<el-table-column prop="合同总额" min-width="80" align="center" label="合同总额">
<template slot-scope="scope">
{{ scope.row.采购合同编号 ? scope.row.合同总额 = scope.row.采购合同总额 : scope.row.合同总额 = scope.row.离线合同总额 }}
</template>
</el-table-column>
</el-table>
<el-button slot="reference" plain type="success" size="mini" icon="el-icon-document" @click="invoiceDetail(scope.row)"/>
</el-popover>
</template>
</el-table-column>
<el-table-column align="center" label="开票金额" min-width="100px" prop="开票金额">
<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="135px">
<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.备注 ? scope.row.备注 : '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="操作" fixed="right" width="200px">
<template slot-scope="scope">
<el-button
:disabled="!office"
type="primary"
size="mini"
icon="el-icon-edit"
@click="handleEdit(scope.row)">编辑</el-button>
<el-button
:disabled="office||!!scope.row.接收人"
type="danger"
size="mini"
icon="el-icon-delete"
@click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin: 10px 0;">
<el-pagination
:current-page="pageCurrent1"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize1"
:total="total1"
style="display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/>
</div>
</el-card>
<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="supplierNumValue">
<el-select v-model="form1.supplierNumValue" placeholder="供应商" size="small" filterable @change="searchContract2">
<el-option
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>
<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-tooltip :content="offline" placement="top">
<el-switch
v-model="offline"
active-color="#13ce66"
inactive-color="#ff4949"
active-value="非离线"
inactive-value="离线"
style="margin: 10px"
@change="offlineChange2"/>
</el-tooltip>
</el-form-item>
<el-form-item label="开票金额" prop="money">
<el-input v-model="form1.money" size="small" placeholder="开票金额"/>
</el-form-item>
<el-form-item label="传送人">
<el-select v-model="form1.sendPersonValue" placeholder="传送人" size="small" disabled>
<el-option
v-for="item in sender"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="备注">
<el-input v-model="form1.remark" size="small" placeholder="备注"/>
</el-form-item>
<b style="color: #f56c6c;margin: 0">* </b>
<el-form-item label="发票扫描件" style="display: inline-block">
<el-upload
id="invoiceScan"
ref="upload"
:auto-upload="false"
:on-success="uploadSuccess"
:before-upload="beforeUpload"
:on-exceed="warningExceed"
:limit="limit"
:action="upload+'?contractNumValue='+form1.contractNumValue+'&money='+form1.money+'&sendPersonValue='+form1.sendPersonValue+'&remark='+form1.remark+'&supplierNumValue='+form1.supplierNumValue+'&offline='+offline"
list-type="picture-card">
<i class="el-icon-plus"/>
</el-upload>
</el-form-item>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button size="small" @click="dialogVisible1 = false">取消</el-button>
<el-button size="small" type="primary" @click="submitAdd('form1')">确定</el-button>
</div>
</el-dialog>
<el-dialog :title="title1" :visible.sync="dialogVisible2" center style="min-height: 300px" width="1200px">
<el-form ref="form1" :model="form1" :rules="rules1" label-position="right" label-width="80px">
<el-row>
<el-col style="width: 800px">
<viewer>
<img :src="scanSrc" style="margin: 0 auto" alt="发票扫描件" width="800px">
</viewer>
</el-col>
<el-col :span="6">
<el-form-item label="供应商">
<el-input v-model="form1.supplierName" size="small" disabled placeholder="供应商"/>
</el-form-item>
<el-form-item label="开票金额">
<el-input v-model="form1.money" size="small" disabled placeholder="开票金额"/>
</el-form-item>
<el-form-item label="传送人">
<el-select v-model="form1.sendPersonValue" placeholder="传送人" size="small" disabled>
<el-option
v-for="item in sender"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="接收人">
<el-select v-model="form1.receivePersonValue" placeholder="接收人" size="small" disabled>
<el-option
v-for="item in sender"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="备注">
<el-input v-model="form1.remark" size="small" disabled placeholder="备注"/>
</el-form-item>
<el-form-item label="发票号" prop="invoiceNum">
<el-input v-model="form1.invoiceNum" size="small" placeholder="发票号"/>
</el-form-item>
<el-form-item label="开户行" prop="bank">
<el-input v-model="form1.bank" size="small" placeholder="开户行"/>
</el-form-item>
<el-form-item label="开票时间" prop="invoiceTime">
<el-date-picker
v-model="form1.invoiceTime"
size="small"
type="date"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
placeholder="开票时间"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button size="small" @click="dialogVisible2 = false">取消</el-button>
<el-button size="small" type="primary" @click="submitEdit('form1')">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { searchInvoice, editInvoice, deleteInvoice, initSender, initSupplier, searchContract, searchOffline, invoiceDetail } from '@/api/PurchasingCenter/PurchaseInvoiceDelivery'
import { mapGetters } from 'vuex'
import { uploadInvoiceScan, readFile } from '@/utils/request'
import request from '@/utils/request'
export default {
name: '', // 采购发票交接
data() {
return {
offline: '非离线',
check1: 0,
office: null, // 是否为办公室
scanSrc: '',
upload: uploadInvoiceScan,
limit: 1,
sender: [],
contractNumValue: '',
contractNums: [], // options
pageCurrent1: 1,
pageSize1: 10,
total1: 0,
tableData1: [],
tableData01: [],
dialogVisible1: false,
dialogVisible2: false, // 办公室
title1: '',
supplierNumValue: '',
supplierNum: [],
form1: {
supplierNumValue: '',
supplierName: '',
invoiceDeliveryNum: '',
contractNumValue: [], // 多选select值
money: '',
sendPersonValue: '',
receivePersonValue: '',
invoiceNum: '',
bank: '',
invoiceTime: '',
remark: ''
},
rules1: {
supplierNumValue: [
{ required: true, message: '请选择供应商' }
],
money: [
{ required: true, message: '请填写金额' }
],
invoiceNum: [
{ required: true, message: '请填写发票号' }
],
bank: [
{ required: true, message: '请填写开户行' }
],
invoiceTime: [
{ required: true, message: '请填写开票时间' }
]
}
}
},
computed: {
...mapGetters([
'sidebar',
'avatar',
'name',
'token', // 角色编号
'id' // 人员编号
])
},
created() {
this.fetchData()
this.searchTable1()
console.log(this.token)
Number(this.token) === 1 ? this.office = true : this.office = false // 是否为办公室8是办公室2是采购部
},
methods: {
offlineChange2() { // 切换离线非离线(内)
if (this.offline === '离线') {
this.searchOffline2()
} else {
this.searchContract2()
}
},
invoiceDetail(row) {
invoiceDetail(row.发票交接流水号).then(response => {
this.tableData01 = response.data
})
},
searchOffline1() {}, // 根据供应商查离线合同(外)
searchOffline2() { // 根据供应商查离线合同(内)
this.form1.contractNumValue = []
this.contractNums = []
searchOffline(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].离线合同流水号
})
}
})
},
fetchData() { // 初始化数据
initSupplier().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.supplierNum.push({
label: response.data[i].供应商名称,
value: response.data[i].供应商流水号
})
}
})
initSender().then(response => { // 传送人
for (let i = 0; i < response.data.length; i++) {
this.sender.push({
label: response.data[i].姓名,
value: response.data[i].人员编号
})
}
})
},
// 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].采购合同流水号
})
}
})
},
searchTable1() { // 查询表1
this.supplierNumValue ? this.check1 = 1 : this.check1 = 0
this.contractNumValue ? this.check2 = 1 : this.check2 = 0
searchInvoice(this.pageCurrent1, this.pageSize1, this.check1, this.supplierNumValue, this.check2, this.contractNumValue).then(response => {
this.tableData1 = response.data.rows
this.tableData1.map(v => {
this.$set(v, 'scanSrc', '')
return v
})
for (let i = 0; i < response.data.rows.length; i++) {
this.tableData1[i].scanSrc = this.searchPic(response.data.rows[i], i)
}
this.total1 = response.data.total
})
this.scanSrc = ''
},
handleSizeChange1(val) {
this.pageCurrent1 = 1
this.pageSize1 = val
this.searchTable1()
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.searchTable1()
},
handleAdd() { // 执行新增
if (this.$refs['form1'] !== undefined) {
this.$refs['form1'].resetFields()
}
this.title1 = '增加'
this.contractNum = []
this.form1.projectValue = ''
this.form1.supplierNumValue = ''
this.form1.contractNumValue = []
this.form1.money = ''
this.form1.sendPersonValue = Number(this.id)
this.form1.remark = ''
this.dialogVisible1 = true
},
warningExceed() {
this.$message.error('仅可上传一张发票')
},
submitAdd(formName) { // 提交新增
this.$refs[formName].validate((valid) => {
if (valid) {
this.$refs.upload.submit() // 上传图片
} else {
console.log('error submit!!')
return false
}
})
},
beforeUpload(file) { // 上船前检测
const isJPG = /^image\/.*/.test(file.type)
const isLt4M = file.size / 1024 / 1024 < 4
if (!isJPG) {
this.$message.error('只能上传图片。。')
}
if (!isLt4M) {
this.$message.error('上传头像图片大小不能超过 4MB!')
}
return isJPG && isLt4M
},
uploadSuccess(res) { // 上传成功回调
if (res[0].result === '1') {
this.$message.success('增加成功')
this.dialogVisible1 = false
this.searchTable1()
this.$refs.upload.clearFiles()
} else {
this.$message.error('增加失败')
}
},
handleEdit(row) {
if (this.$refs['form1'] !== undefined) {
this.$refs['form1'].resetFields()
}
this.title1 = '编辑'
this.dialogVisible2 = true
this.form1.invoiceDeliveryNum = 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) => {
if (valid) {
editInvoice(this.form1.invoiceDeliveryNum, this.form1.invoiceNum, this.form1.bank, this.form1.invoiceTime, this.form1.receivePersonValue).then(response => {
if (response.data[0].result === '1') {
this.$message.success('编辑成功')
this.dialogVisible2 = false
this.searchTable1()
} else { this.$message.error('编辑失败') }
})
} else {
console.log('error submit!!')
return false
}
})
},
handleDelete(row) {
this.$confirm('确认删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteInvoice(row.发票交接流水号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
this.dialogVisible1 = false
this.searchTable1()
} else { this.$message.error('删除失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消操作'
})
})
},
async searchPic(row, i) {
const { data } = await request({
url: '',
method: 'post',
data: {
type: '3',
name: `select * from 采购管理_采购发票_附件 where 是否启用 = 1 and 发票交接流水号 = ${row.发票交接流水号}`
}
})
this.tableData1[i].scanSrc = readFile + data[0].文件标识 + '.' + data[0].文件后缀
},
async searchPicInner(row) {
const { data } = await request({
url: '',
method: 'post',
data: {
type: '3',
name: `select * from 采购管理_采购发票_附件 where 是否启用 = 1 and 发票交接流水号 = ${row.发票交接流水号}`
}
})
this.scanSrc = readFile + data[0].文件标识 + '.' + data[0].文件后缀
}
}
}
</script>
<style scoped>
#expandTable .el-form-item{
margin: 0;
}
.el-tag{
margin: 0
}
.el-card{
margin-bottom: 15px;
}
.el-date-editor{
width:150px;
}
.el-select{
width:200px
}
.el-input{
width:200px
}
.searchForm .el-form-item{
margin-top: 1px;
margin-bottom: 1px;
}
</style>

View File

@@ -0,0 +1,169 @@
<template>
<div class="app-container">
<el-card>
<el-table :data="tableData1" highlight-current-row height="810" style="width: 100%;" size="mini" border stripe>
<el-table-column label="序号" type="index" align="center" width="50"/>
<el-table-column label="项目名称" align="center" width="200px">
<template slot-scope="scope">
{{ scope.row.项目名称 }}
</template>
</el-table-column>
<el-table-column label="申请人" align="center" width="80px">
<template slot-scope="scope">
{{ scope.row.申请人姓名 }}
</template>
</el-table-column>
<el-table-column label="原物料" align="center">
<el-table-column label="原物料名称" align="center" min-width="150px">
<template slot-scope="scope">
{{ scope.row.原物料名称 }}
</template>
</el-table-column>
<el-table-column label="原物料规格" align="center" min-width="150px">
<template slot-scope="scope">
{{ scope.row.原物料规格 }}
</template>
</el-table-column>
<el-table-column label="原物料型号" align="center" min-width="150px">
<template slot-scope="scope">
{{ scope.row.原物料型号 }}
</template>
</el-table-column>
</el-table-column>
<el-table-column label="新物料" align="center">
<el-table-column label="新物料名称" align="center" min-width="150px">
<template slot-scope="scope">
{{ scope.row.新物料名称 }}
</template>
</el-table-column>
<el-table-column label="新物料规格" align="center" min-width="150px">
<template slot-scope="scope">
{{ scope.row.新物料规格 }}
</template>
</el-table-column>
<el-table-column label="新物料型号" align="center" min-width="150px">
<template slot-scope="scope">
{{ scope.row.新物料型号 }}
</template>
</el-table-column>
</el-table-column>
<el-table-column label="是否同意修改" width="200px" align="center" fixed="right">
<template slot-scope="scope">
<el-button
size="mini"
type="primary"
class="el-icon-edit"
@click="handleEdit1(scope.$index, scope.row)">同意</el-button>
<el-button
size="mini"
type="danger"
class="el-icon-edit"
@click="handleEdit2(scope.$index, scope.row)">不同意</el-button>
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
v-if="!loading1"
: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-card>
</div>
</template>
<script>
import { searchTable, edit } from '@/api/PurchasingCenter/PurchaseMaterielModify'
import { mapGetters } from 'vuex'
export default {
name: '', // 采购物料修改
data() {
return {
loading1: false,
tableData1: [], // 表格数据
total1: null, // 总条数
pageSize1: 30, // 每页显示条数
pageCurrent1: 1
}
},
computed: {
...mapGetters([
'sidebar',
'avatar',
'name',
'id' // 人员编号
])
},
created() {
this.searchTable()
},
methods: {
searchTable() {
this.loading1 = true
this.tableData1 = []
searchTable(this.pageCurrent1, this.pageSize1).then(response => {
console.log(response.data)
if (response.data.total === 0) {
this.loading1 = false
} else {
this.tableData1 = response.data.rows
this.total1 = response.data.total
}
}).then(() => {
this.loading1 = false
})
},
handleEdit1(index, row) {
edit(row.组件零件流水号, row.标准件和外购件流水号, row.物料变更记录流水号, 1, this.id, row.原物料流水号).then(response => {
if (response.data[0].result === '1') {
this.$message({
type: 'success',
message: '信息更新成功!'
})
this.searchTable()
} else {
this.$message.error('信息更新失败')
}
})
},
handleEdit2(index, row) {
edit(row.组件零件流水号, row.标准件和外购件流水号, row.物料变更记录流水号, 2, this.id, row.原物料流水号).then(response => {
if (response.data[0].result === '1') {
this.$message({
type: 'success',
message: '信息更新成功!'
})
this.searchTable()
} else {
this.$message.error('信息更新失败')
}
})
},
handleSizeChange1(val) {
this.pageCurrent1 = 1
this.pageSize1 = val
this.searchTable()
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.searchTable()
}
}
}
</script>
<style scoped>
span{
margin: 10px 0 10px 10px;
}
.el-card{
margin-bottom: 15px;
}
</style>

View File

@@ -0,0 +1,224 @@
/* eslint-disable */
require('script-loader!file-saver');
// import XLSX from 'xlsx'
import XLSX from 'xlsx-style'
function generateArray(table) {
var out = [];
var rows = table.querySelectorAll('tr');
var ranges = [];
for (var R = 0; R < rows.length; ++R) {
var outRow = [];
var row = rows[R];
var columns = row.querySelectorAll('td');
for (var C = 0; C < columns.length; ++C) {
var cell = columns[C];
var colspan = cell.getAttribute('colspan');
var rowspan = cell.getAttribute('rowspan');
var cellValue = cell.innerText;
if (cellValue !== "" && cellValue == +cellValue) cellValue = +cellValue;
//Skip ranges
ranges.forEach(function (range) {
if (R >= range.s.r && R <= range.e.r && outRow.length >= range.s.c && outRow.length <= range.e.c) {
for (var i = 0; i <= range.e.c - range.s.c; ++i) outRow.push(null);
}
});
//Handle Row Span
if (rowspan || colspan) {
rowspan = rowspan || 1;
colspan = colspan || 1;
ranges.push({
s: {
r: R,
c: outRow.length
},
e: {
r: R + rowspan - 1,
c: outRow.length + colspan - 1
}
});
};
//Handle Value
outRow.push(cellValue !== "" ? cellValue : null);
//Handle Colspan
if (colspan)
for (var k = 0; k < colspan - 1; ++k) outRow.push(null);
}
out.push(outRow);
}
return [out, ranges];
};
function datenum(v, date1904) {
if (date1904) v += 1462;
var epoch = Date.parse(v);
return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000);
}
function sheet_from_array_of_arrays(data, opts) {
var ws = {};
var range = {
s: {
c: 10000000,
r: 10000000
},
e: {
c: 0,
r: 0
}
};
for (var R = 0; R != data.length; ++R) {
for (var C = 0; C != data[R].length; ++C) {
if (range.s.r > R) range.s.r = R;
if (range.s.c > C) range.s.c = C;
if (range.e.r < R) range.e.r = R;
if (range.e.c < C) range.e.c = C;
var cell = {
v: data[R][C]
};
if (cell.v == null) continue;
var cell_ref = XLSX.utils.encode_cell({
c: C,
r: R
});
if (typeof cell.v === 'number') cell.t = 'n';
else if (typeof cell.v === 'boolean') cell.t = 'b';
else if (cell.v instanceof Date) {
cell.t = 'n';
cell.z = XLSX.SSF._table[14];
cell.v = datenum(cell.v);
} else cell.t = 's';
ws[cell_ref] = cell;
}
}
if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range);
return ws;
}
function Workbook() {
if (!(this instanceof Workbook)) return new Workbook();
this.SheetNames = [];
this.Sheets = {};
}
function s2ab(s) {
var buf = new ArrayBuffer(s.length);
var view = new Uint8Array(buf);
for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
return buf;
}
export function export_table_to_excel(id) {
var theTable = document.getElementById(id);
var oo = generateArray(theTable);
var ranges = oo[1];
/* original data */
var data = oo[0];
var ws_name = "SheetJS";
var wb = new Workbook(),
ws = sheet_from_array_of_arrays(data);
/* add ranges to worksheet */
// ws['!cols'] = ['apple', 'banan'];
ws['!merges'] = ranges;
/* add worksheet to workbook */
wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws;
var wbout = XLSX.write(wb, {
bookType: 'xlsx',
bookSST: false,
type: 'binary'
});
saveAs(new Blob([s2ab(wbout)], {
type: "application/octet-stream"
}), "test.xlsx")
}
export function export_json_to_excel({
headerGroup,
dataGroup,
sheetGroup,
filename,
autoWidth = true,
bookType= 'xlsx'
} = {}) {
var wb = new Workbook()
for (let i = 0; i < dataGroup.length; i++) {
/* original data */
let data = dataGroup[i]
filename = filename || 'excel-list'
data = [...data]
data.unshift(headerGroup[i]);
var ws_name = sheetGroup[i];
var ws = sheet_from_array_of_arrays(data);
if (autoWidth) {
/*设置worksheet每列的最大宽度*/
const colWidth = data.map(row => row.map(val => {
/*先判断是否为null/undefined*/
if (val == null) {
return {
'wch': 10
};
}
/*再判断是否为中文*/
else if (val.toString().charCodeAt(0) > 255) {
return {
'wch': val.toString().length * 2
};
} else {
return {
'wch': val.toString().length
};
}
}))
/*以第一行为初始值*/
let result = colWidth[0];
for (let i = 1; i < colWidth.length; i++) {
for (let j = 0; j < colWidth[i].length; j++) {
if (result[j]['wch'] < colWidth[i][j]['wch']) {
result[j]['wch'] = colWidth[i][j]['wch'];
}
}
}
ws['!cols'] = result;
}
let R = 0;
data.map(item => {
let C = 0;
item.map(itm => {
var cell_ref = XLSX.utils.encode_cell({c:C,r:R});
var cell = {v: itm }
cell.s= {
alignment: {
horizontal: "center"
}
}
ws[cell_ref] = cell;
C++;
})
R++;
})
/* add worksheet to workbook */
wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws;
}
var wbout = XLSX.write(wb, {
bookType: bookType,
bookSST: false,
type: 'binary'
});
saveAs(new Blob([s2ab(wbout)], {
type: "application/octet-stream"
}), `${filename}.${bookType}`);
}

View File

@@ -0,0 +1,558 @@
<template>
<div class="app-container">
<el-card>
<el-row>
<span>机床编号:</span>
<el-select v-model="machineNumberValue" filterable placeholder="机床编号" size="small" clearable @change="machineChange">
<el-option
v-for="item in machineNumber"
: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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</span>
<el-select v-model="groupNumberValue" placeholder="组号" size="small" clearable>
<el-option
v-for="item in groupNumber"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</span>
<el-input v-model="Name" placeholder="名称" size="small" clearable style="width:200px"/>
</el-row>
<el-row style="margin-top:10px">
<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</span>
<el-input v-model="spec" placeholder="规格" size="small" clearable style="width:200px"/>
<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</span>
<el-input v-model="model" placeholder="型号" size="small" clearable style="width:200px"/>
<el-button type="success" size="small" icon="el-icon-search" style="margin-left: 15px" @click="searchTable()">查询</el-button>
<el-button type="warning" size="small" icon="el-icon-download" style="margin-left: 15px" @click="exportDetail()">导出</el-button>
</el-row>
</el-card>
<el-tabs v-model="PartType" type="border-card" @tab-click="searchTable()">
<el-tab-pane label="标准件" name="标准件">
<el-table :data="tableData0" size="mini" style="max-height: 600px" height="600px" border stripe>
<el-table-column align="center" label="采购情况" width="80px">
<template slot-scope="scope">
<el-tag v-if="!scope.row.人员编号" type="primary" size="small">未分配</el-tag>
<el-tag v-if="parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!==''" type="warning" size="small">未询价</el-tag>
<el-tag v-if="parseInt(scope.row.询价状态编号)===3&&parseInt(scope.row.采购状态编号)!==3" type="success" size="small">已询价</el-tag>
<el-tag v-if="parseInt(scope.row.询价状态编号)===3&&parseInt(scope.row.采购状态编号)===3" type="info" size="small">已采购</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="机床图号" width="100px">
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column align="center" label="组号" width="80px">
<template slot-scope="scope">
{{ scope.row.组号 }}
</template>
</el-table-column>
<el-table-column align="center" label="名称" width="100px">
<template slot-scope="scope">
{{ scope.row.物料名称 }}
</template>
</el-table-column>
<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="200px">
<template slot-scope="scope">
{{ scope.row.物料规格 }}
</template>
</el-table-column>
<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="100px">
<template slot-scope="scope">
{{ scope.row.备注 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="技术下达数量" width="100px">
<template slot-scope="scope">
{{ scope.row.零件数量 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="合同采购数量" width="100px">
<template slot-scope="scope">
{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.数量 || scope.row.离线采购数量 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="到货数量" width="100px">
<template slot-scope="scope">
{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.已到货数量 || scope.row.离线到货数量 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="供应商" min-width="150px">
<template slot-scope="scope">
{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.供应商名称 || scope.row.离线合同供应商名称 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="合同编号" min-width="100px">
<template slot-scope="scope">
{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.采购合同编号 || scope.row.离线合同编号 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="采购员" width="100px">
<template slot-scope="scope">
{{ scope.row.姓名 || '—' }}
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
:current-page="pageCurrent0"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize0"
:total="total0"
style="margin-top:10px;display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange0"
@current-change="handleCurrentChange0"/>
</div>
</el-tab-pane>
<el-tab-pane label="外购件" name="外购件">
<el-table :data="tableData1" size="mini" style="max-height: 600px" height="600px" border stripe>
<el-table-column align="center" label="采购情况" width="80px">
<template slot-scope="scope">
<el-tag v-if="!scope.row.人员编号" type="primary" size="small">未分配</el-tag>
<el-tag v-if="parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!==''" type="warning" size="small">未询价</el-tag>
<el-tag v-if="parseInt(scope.row.询价状态编号)===3&&parseInt(scope.row.采购状态编号)!==3" type="success" size="small">已询价</el-tag>
<el-tag v-if="parseInt(scope.row.询价状态编号)===3&&parseInt(scope.row.采购状态编号)===3" type="info" size="small">已采购</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="机床图号" width="100px">
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column align="center" label="组号" width="80px">
<template slot-scope="scope">
{{ scope.row.组号 }}
</template>
</el-table-column>
<el-table-column align="center" label="名称" width="100px">
<template slot-scope="scope">
{{ scope.row.物料名称 }}
</template>
</el-table-column>
<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="200px">
<template slot-scope="scope">
{{ scope.row.物料规格 }}
</template>
</el-table-column>
<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="100px">
<template slot-scope="scope">
{{ scope.row.备注 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="技术下达数量" width="100px">
<template slot-scope="scope">
{{ scope.row.零件数量 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="合同采购数量" width="100px">
<template slot-scope="scope">
{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.数量 || scope.row.离线采购数量 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="到货数量" width="100px">
<template slot-scope="scope">
{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.已到货数量 || scope.row.离线到货数量 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="供应商" min-width="150px">
<template slot-scope="scope">
{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.供应商名称 || scope.row.离线合同供应商名称 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="合同编号" min-width="100px">
<template slot-scope="scope">
{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.采购合同编号 || scope.row.离线合同编号 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="采购员" width="100px">
<template slot-scope="scope">
{{ scope.row.姓名 || '—' }}
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
:current-page="pageCurrent1"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize1"
:total="total1"
style="margin-top:10px;display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/>
</div>
</el-tab-pane>
<el-tab-pane label="基本件" name="基本件">
<el-table :data="tableData2" size="mini" style="max-height: 600px" height="600px" border stripe>
<el-table-column align="center" label="采购情况" width="80px">
<template slot-scope="scope">
<el-tag v-if="!scope.row.人员编号" type="primary" size="small">未分配</el-tag>
<el-tag v-if="parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!==''" type="warning" size="small">未询价</el-tag>
<el-tag v-if="parseInt(scope.row.询价状态编号)===3&&parseInt(scope.row.采购状态编号)!==3" type="success" size="small">已询价</el-tag>
<el-tag v-if="parseInt(scope.row.询价状态编号)===3&&parseInt(scope.row.采购状态编号)===3" type="info" size="small">已采购</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="机床图号" width="100px">
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column align="center" label="组号" width="80px">
<template slot-scope="scope">
{{ scope.row.组号 }}
</template>
</el-table-column>
<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="100px">
<template slot-scope="scope">
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<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="100px">
<template slot-scope="scope">
{{ scope.row.材料 }}
</template>
</el-table-column>
<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="100px">
<template slot-scope="scope">
{{ scope.row.备注 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="技术下达数量" width="100px">
<template slot-scope="scope">
{{ scope.row.零件数量 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="采购数量" width="100px">
<template slot-scope="scope">
{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.数量 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="到货数量" width="100px">
<template slot-scope="scope">
{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.已到货数量 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="供应商" min-width="100px">
<template slot-scope="scope">
{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.供应商名称 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="采购合同编号" min-width="100px">
<template slot-scope="scope">
{{ parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='' ? '—' : scope.row.采购合同编号 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="采购员" width="100px">
<template slot-scope="scope">
{{ scope.row.姓名 || '—' }}
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
:current-page="pageCurrent2"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize2"
:total="total2"
style="margin-top:10px;display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange2"
@current-change="handleCurrentChange2"/>
</div>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import { initMachineProject, searchgroup, searchTable1, searchTable2, searchTable1Export, searchTable2Export } from '@/api/PurchasingCenter/PurchaseSituationSearch'
import { mapGetters } from 'vuex'
export default {
name: '', // 采购件采购查询
data() {
return {
Name: '',
spec: '',
model: '',
machineNumberValue: '',
machineNumber: [],
groupNumberValue: '',
groupNumber: [],
PartType: '标准件',
tableData0: [],
tableData1: [],
tableData2: [],
tableData3: [],
pageCurrent0: 1,
pageSize0: 20,
total0: 0,
pageCurrent1: 1,
pageSize1: 20,
total1: 0,
pageCurrent2: 1,
pageSize2: 20,
total2: 0
}
},
computed: {
...mapGetters([
'name',
'id' // 人员编号
])
},
created() {
this.fetchData()
this.searchTable()
},
methods: {
// 导出采购物料执行情况
exportDetail() {
let check1, check2
this.machineNumberValue ? check1 = 1 : check1 = 0
this.groupNumberValue ? check2 = 1 : check2 = 0
searchTable1Export(check1, this.machineNumberValue, check2, this.groupNumberValue, 1).then(res1 => { // 标准件
searchTable1Export(check1, this.machineNumberValue, check2, this.groupNumberValue, 2).then(res2 => { // 外购件
searchTable2Export(check1, this.machineNumberValue, check2, this.groupNumberValue).then(res3 => { // 基本件
import('./Export2Excel').then(excel => {
const dataGroup = []
const filterVal1 = ['机床图号', '组号', '物料名称', '物料型号', '物料规格', '零件数量', ['数量', '离线采购数量'], ['已到货数量', '离线到货数量'], ['供应商名称', '离线合同供应商名称'], ['采购合同编号', '离线合同编号'], '姓名', '供货商', '备注'] // tableData0里的属性名
const filterVal2 = ['机床图号', '组号', '物料名称', '物料型号', '物料规格', '零件数量', ['数量', '离线采购数量'], ['已到货数量', '离线到货数量'], ['供应商名称', '离线合同供应商名称'], ['采购合同编号', '离线合同编号'], '姓名', '供货商', '备注'] // tableData1里的属性名
const filterVal3 = ['机床图号', '组号', '零件名称', '零件图号', '规格', '材料', '零件数量', '数量', '已到货数量', '供应商名称', '采购合同编号', '姓名', '供货商', '备注'] // tableData2里的属性名
const data1 = res1.data.map(v => filterVal1.map(j => {
if (typeof (j) === 'string') {
return v[j] || '—'
} else {
return v[j[0]] || v[j[1]] || '—'
}
}))
data1.map(v => {
v.push('') // 物料状态
if (v[10] === '—') {
v[13] = '未分配'
} else if (v[6] === '—') {
v[13] = '未采购'
} else if (v[6] !== '—' && v[6] !== v[7]) {
v[13] = '未全部到货'
} else if (v[6] !== '—' && v[6] === v[7]) {
v[13] = '全部到货'
}
})
dataGroup.push(data1)
const data2 = res2.data.map(v => filterVal2.map(j => {
if (typeof (j) === 'string') {
return v[j] || '—'
} else {
return v[j[0]] || v[j[1]] || '—'
}
}))
data2.map(v => {
v.push('') // 物料状态
if (v[10] === '—') {
v[13] = '未分配'
} else if (v[6] === '—') {
v[13] = '未采购'
} else if (v[6] !== '—' && v[6] !== v[7]) {
v[13] = '未全部到货'
} else if (v[6] !== '—' && v[6] === v[7]) {
v[13] = '全部到货'
}
})
dataGroup.push(data2)
const data3 = res3.data.map(v => filterVal3.map(j => {
if (typeof (j) === 'string') {
return v[j] || '—'
} else {
return v[j[0]] || v[j[1]] || '—'
}
}))
data3.map(v => {
v.push('') // 物料状态
if (v[11] === '—') {
v[14] = '未分配'
} else if (v[7] === '—') {
v[14] = '未采购'
} else if (v[7] !== '—' && v[7] !== v[8]) {
v[14] = '未全部到货'
} else if (v[7] !== '—' && v[7] === v[8]) {
v[14] = '全部到货'
}
})
dataGroup.push(data3)
const headerGroup = [['机床号', '组号', '名称', '图号或型号', '规格', '技术下达数量', '合同采购数量', '到货数量', '供应商', '合同编号', '采购员', '供货商', '备注', '物料状态'],
['机床号', '组号', '名称', '图号或型号', '规格', '技术下达数量', '合同采购数量', '到货数量', '供应商', '合同编号', '采购员', '供货商', '备注', '物料状态'],
['机床号', '组号', '名称', '图号或型号', '规格', '材料', '技术下达数量', '合同采购数量', '到货数量', '供应商', '合同编号', '采购员', '供货商', '备注', '物料状态']]
const sheetGroup = ['标准件', '外购件', '基本件']
excel.export_json_to_excel({
headerGroup: headerGroup,
dataGroup: dataGroup,
sheetGroup: sheetGroup,
filename: '采购物料执行情况',
autoWidth: true,
bookType: 'xlsx'
})
})
})
})
})
},
fetchData() {
initMachineProject().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.machineNumber.push({
label: response.data[i].机床图号,
name: response.data[i].项目名称,
value: response.data[i].机床流水号
})
}
})
},
machineChange() {
this.groupNumberValue = ''
this.groupNumber = []
searchgroup(this.machineNumberValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.groupNumber.push({
label: response.data[i].组号,
value: response.data[i].组件流水号
})
}
})
},
searchTable() {
if (this.PartType === '标准件') {
this.searchTable0()
} else if (this.PartType === '外购件') {
this.searchTable1()
} else if (this.PartType === '基本件') {
this.searchTable2()
}
},
handleSizeChange0(val) {
this.pageSize0 = val
this.pageCurrent0 = 1
this.searchTable0()
},
handleCurrentChange0(val) {
this.pageCurrent0 = val
this.searchTable0()
},
handleSizeChange1(val) {
this.pageSize1 = val
this.pageCurrent1 = 1
this.searchTable1()
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.searchTable1()
},
handleSizeChange2(val) {
this.pageSize2 = val
this.pageCurrent2 = 1
this.searchTable2()
},
handleCurrentChange2(val) {
this.pageCurrent2 = val
this.searchTable2()
},
searchTable0() { // 查询标准件
let check1, check2, check3, check4, check5
this.machineNumberValue ? check1 = 1 : check1 = 0
this.groupNumberValue ? check2 = 1 : check2 = 0
this.Name ? check3 = 1 : check3 = 0
this.spec ? check4 = 1 : check4 = 0
this.model ? check5 = 1 : check5 = 0
searchTable1(check1, this.machineNumberValue, check2, this.groupNumberValue, this.pageCurrent0, this.pageSize0, 1, check3, this.Name, check4, this.spec, check5, this.model).then(response => {
console.log(this.tableData0)
this.tableData0 = response.data.rows
this.total0 = response.data.total
})
},
searchTable1() { // 查询外购件
let check1, check2, check3, check4, check5
this.machineNumberValue ? check1 = 1 : check1 = 0
this.groupNumberValue ? check2 = 1 : check2 = 0
this.Name ? check3 = 1 : check3 = 0
this.spec ? check4 = 1 : check4 = 0
this.model ? check5 = 1 : check5 = 0
searchTable1(check1, this.machineNumberValue, check2, this.groupNumberValue, this.pageCurrent1, this.pageSize1, 2, check3, this.Name, check4, this.spec, check5, this.model).then(response => {
this.tableData1 = response.data.rows
this.total1 = response.data.total
})
},
searchTable2() { // 查询基本件
let check1, check2, check3, check4, check5
this.machineNumberValue ? check1 = 1 : check1 = 0
this.groupNumberValue ? check2 = 1 : check2 = 0
this.Name ? check3 = 1 : check3 = 0
this.spec ? check4 = 1 : check4 = 0
this.model ? check5 = 1 : check5 = 0
searchTable2(check1, this.machineNumberValue, check2, this.groupNumberValue, this.pageCurrent2, this.pageSize2, check3, this.Name, check4, this.spec, check5, this.model).then(response => {
this.tableData2 = response.data.rows
this.total2 = response.data.total
})
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom: 15px;
}
.el-select{
width:200px
}
.el-input{
width:200px
}
span{
margin: 10px 0 10px 10px;
}
.el-tag{
margin: 0
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,199 @@
<template>
<div class="app-container receiveCheck">
<el-card>
<div slot="header">
<span>项目名称:</span>
<el-select v-model="projectValue" style="width:200px" placeholder="请选择" size="small" clearable filterable @change="projectChange">
<el-option
v-for="item in project"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>机床图号:</span>
<el-select v-model="machineValue" style="width:190px" placeholder="请选择" size="small" clearable filterable @change="machineChange">
<el-option
v-for="item in machine"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>组号:</span>
<el-select v-model="groupValue" style="width:140px" placeholder="请选择" size="small" clearable filterable>
<el-option
v-for="item in group"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-button type="success" icon="el-icon-search" size="small" style="margin-left: 10px" @click="searchProject()">查询</el-button>
</div>
<el-table
:data="tableData1"
:summary-method="getSummaries"
style="width: 100%"
height="650"
size="mini"
show-summary
stripe
border>
<el-table-column align="center" label="序号" type="index"/>
<el-table-column align="center" label="项目名称">
<template slot-scope="scope">
{{ scope.row.项目名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="机床图号" width="100px">
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column align="center" label="组号" width="80px">
<template slot-scope="scope">
{{ scope.row.组号 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="物料名称">
<template slot-scope="scope">
{{ scope.row.物料名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="物料规格">
<template slot-scope="scope">
{{ scope.row.物料规格 }}
</template>
</el-table-column>
<el-table-column align="center" label="物料型号">
<template slot-scope="scope">
{{ scope.row.物料型号 }}
</template>
</el-table-column>
<el-table-column align="center" label="小计(元)" prop="小计">
<template slot-scope="scope">
{{ scope.row.小计 ? scope.row.小计.toFixed(2) : 0 }}
</template>
</el-table-column>
<el-table-column align="center" label="单价">
<template slot-scope="scope">
{{ scope.row.单价 }}
</template>
</el-table-column>
<el-table-column align="center" label="领用数量">
<template slot-scope="scope">
{{ scope.row.出库数量 }}
</template>
</el-table-column>
<el-table-column align="center" label="领用时间">
<template slot-scope="scope">
{{ scope.row.出库时间 }}
</template>
</el-table-column>
</el-table>
</el-card>
</div>
</template>
<script>
import { initProject, searchMachine, searchGroup, searchReceiveCheck } from '@/api/PurchasingCenter/ReceiveCheck'
export default {
data() {
return {
projectValue: '', // 项目名称
project: [],
machineValue: '',
machine: [],
groupValue: '',
group: [],
tableData1: [],
check1: '',
pageCurrent: 1,
pageSize: 10,
total: 0
}
},
created() {
this.fetchData()
},
methods: {
fetchData() {
this.getSelect(initProject, ['项目名称', '项目流水号'], 'project')
},
projectChange() {
this.machine = []
this.machineValue = ''
this.group = []
this.groupValue = ''
searchMachine(this.projectValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.machine.push({
value: response.data[i].机床流水号,
label: response.data[i].机床图号
})
}
})
},
machineChange() {
this.group = []
this.groupValue = ''
searchGroup(this.machineValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.group.push({
value: response.data[i].组件流水号,
label: response.data[i].组号
})
}
})
},
getSummaries(param) {
const { columns, data } = param
const sums = []
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '总价'
return
}
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)
sums[index] = sums[index].toFixed(2)
sums[index] += ' 元'
} else {
sums[index] = ''
}
})
return sums
},
searchProject() { // 查询
if (!this.projectValue) {
this.$message.error('请选择项目')
} else {
let check2, check3
this.machineValue ? check2 = 1 : check2 = 0
this.groupValue ? check3 = 1 : check3 = 0
searchReceiveCheck(1, this.projectValue, check2, this.machineValue, check3, this.groupValue).then(response => {
this.tableData1 = response.data
})
}
}
}
}
</script>
<style scoped>
.el-select{
width:200px
}
.el-input{
width:200px
}
span{
margin: 10px 0 10px 10px;
}
</style>

View File

@@ -0,0 +1,295 @@
<template>
<div class="app-container">
<el-card>
<div slot="header">
<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>
</div>
<el-table
v-loading=""
id="expandTable"
:data="tableData1"
:row-key="getRowKeys"
:expand-row-keys="expands"
border
style="width: 100%;max-height: 250px;"
height="250px"
size="mini"
@row-click="searchContract"
@expand-change="searchPlan">
<el-table-column type="expand">
<template slot-scope="props">
<el-table v-loading="" v-show="tableData01.length!==0" :data="tableData01" border size="mini">
<el-table-column label="序号" align="center" type="index"/>
<el-table-column label="计划付款日期" align="center">
<template slot-scope="scope">
{{ scope.row.计划付款日期.split(' ')[0] }}
</template>
</el-table-column>
<el-table-column label="计划付款金额" align="center">
<template slot-scope="scope">
{{ scope.row.计划付款金额 }}
</template>
</el-table-column>
<el-table-column label="备注" align="center">
<template slot-scope="scope">
{{ scope.row.计划付款备注 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button type="danger" size="mini" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</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="200">
<template slot-scope="scope">
{{ scope.row.供应商名称 }}
</template>
</el-table-column>
<el-table-column label="设置计划" align="center" min-width="100" fixed="right">
<template slot-scope="scope">
<el-button type="primary" size="mini" icon="el-icon-circle-plus-outline" @click="handleSetPayPlan(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-card>
<div style="min-height:500px;margin: 0px auto;width:800px;border:1px solid black" v-html="returns"/>
<el-dialog :visible.sync="dialogVisible1" title="增加付款计划" center style="min-height: 300px" width="400px">
<el-form ref="form1" :model="form1" :rules="rules1" label-position="left" label-width="110px">
<el-form-item label="计划付款日期" prop="计划付款日期">
<el-date-picker v-model="form1.计划付款日期" value-format="yyyy-MM-dd" format="yyyy-MM-dd" size="small" type="date" placeholder="选择日期"/>
</el-form-item>
<el-form-item label="计划付款金额" prop="计划付款金额">
<el-input v-model="form1.计划付款金额" placeholder="填写金额" size="small" clearable/>
</el-form-item>
<el-form-item label="计划付款备注">
<el-input v-model="form1.计划付款备注" placeholder="填写备注" size="small" clearable/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button size="small" @click="dialogVisible1=false">取消</el-button>
<el-button type="primary" size="small" @click="submitSetPayPlan">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { initContract, searchTable1, searchTable01, addTable01, deleteTable01, searchTable2 } from '@/api/PurchasingCenter/SetPayPlan'
import { mapGetters } from 'vuex'
export default {
name: '', // 采购预算查询
data() {
return {
expands: [],
contractNumValue: '',
contractNum: [],
supplierName: '',
tableData1: [],
pageCurrent1: 1,
pageSize1: 10,
total1: 0,
returns: '',
tableData01: [],
dialogVisible1: false,
form1: {
采购合同流水号: '',
计划付款日期: '',
计划付款金额: '',
计划付款备注: ''
},
rules1: {
计划付款日期: [{ required: true, message: '请选择计划付款日期' }],
计划付款金额: [{ required: true, message: '请输入计划付款金额' }]
}
}
},
computed: {
...mapGetters([
'sidebar',
'avatar',
'name',
'id' // 人员编号
])
},
created() {
this.fetchData()
this.searchTable1()
},
methods: {
getRowKeys(row) {
return row.采购合同流水号
},
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.tableData1 = []
this.returns = ''
this.contractNumValue ? this.check1 = 1 : this.check1 = 0
this.supplierName ? this.check2 = 1 : this.check2 = 0
searchTable1(this.pageCurrent1, this.pageSize1, this.check1, this.contractNumValue, this.check2, this.supplierName).then(response => {
this.tableData1 = response.data.rows
this.total1 = response.data.total
})
},
handleSizeChange1(val) {
this.pageSize1 = val
this.pageCurrent1 = 1
this.searchTable1()
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.searchTable1()
},
searchPlan(row, expandedRows) {
this.form1.采购合同流水号 = row.采购合同流水号
searchTable01(row.采购合同流水号).then(response => {
if (expandedRows.length > 1) {
this.expands = []
expandedRows.shift()
}
this.tableData01 = response.data
this.expands.indexOf(row.采购合同流水号) === -1 ? this.expands.push(row.采购合同流水号) : this.expands = []
})
},
handleSetPayPlan(row) { // 设置付款计划
if (this.$refs['form1'] !== undefined) {
this.$refs['form1'].resetFields()
}
searchTable01(row.采购合同流水号).then(response => {
this.tableData01 = response.data
}).then(() => {
this.expands.indexOf(row.采购合同流水号) === -1 ? this.expands.push(row.采购合同流水号) : true
})
this.form1.采购合同流水号 = row.采购合同流水号
this.form1.计划付款日期 = ''
this.form1.计划付款金额 = ''
this.form1.计划付款备注 = ''
this.dialogVisible1 = true
},
submitSetPayPlan() { // 提交设置
this.$refs['form1'].validate((valid) => {
if (valid) {
addTable01(this.form1.采购合同流水号, this.form1.计划付款日期, this.form1.计划付款金额, this.form1.计划付款备注).then(response => {
if (response.data[0].result === '1') {
this.$message.success('设置成功')
searchTable01(this.form1.采购合同流水号).then(response => {
this.tableData01 = response.data
this.expands.indexOf(this.form1.采购合同流水号) === -1 ? this.expands.push(this.form1.采购合同流水号) : true
})
this.dialogVisible1 = false
} else {
this.$message.error('设置失败')
}
})
}
})
},
handleDelete(row) {
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteTable01(row.付款计划流水号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
searchTable01(this.form1.采购合同流水号).then(response => {
this.tableData01 = response.data
this.expands.indexOf(this.form1.采购合同流水号) === -1 ? this.expands.push(this.form1.采购合同流水号) : true
})
} else {
this.$message.error('删除失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
searchContract(row) {
searchTable2(row.采购合同流水号).then(response => {
this.returns = response.data[0].合同内容
})
}
}
}
</script>
<style>
#expandTable .el-table__expanded-cell{
padding: 5px 50px;
}
</style>
<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
}
</style>

View File

@@ -0,0 +1,663 @@
<template>
<div class="app-container">
<el-card>
<el-form ref="form1" :model="form1" label-position="right" label-width="70px" class="searchForm">
<el-row>
<el-col style="width: 250px">
<el-form-item label="供应商">
<el-input v-model="supplierName" placeholder="供应商名称" size="small" clearable/>
</el-form-item>
</el-col>
<el-col style="width: 250px">
<el-form-item label="法人">
<el-input v-model="businessNature" placeholder="法人" size="small" clearable/>
</el-form-item>
</el-col>
<el-col style="width: 250px">
<el-form-item label="受托人">
<el-input v-model="registeredCapital" placeholder="受托人" size="small" clearable/>
</el-form-item>
</el-col>
<el-col style="width: 250px">
<el-form-item label="邮编">
<el-input v-model="deliveryPeriod" placeholder="邮编" size="small" clearable/>
</el-form-item>
</el-col>
<el-col style="width: 250px">
<el-form-item label="税号">
<el-input v-model="taxNumber" placeholder="税号" size="small" clearable/>
</el-form-item>
</el-col>
<el-col style="width: 250px">
<el-form-item label="电子信箱">
<el-input v-model="email" placeholder="电子信箱" size="small" clearable/>
</el-form-item>
</el-col>
<el-col style="width: 250px">
<el-form-item label="电话号码">
<el-input v-model="telephone" placeholder="电话号码" size="small" clearable/>
</el-form-item>
</el-col>
<el-col style="width: 250px">
<el-form-item label="开户行">
<el-input v-model="bank" placeholder="开户行" size="small" clearable/>
</el-form-item>
</el-col>
<el-col style="width: 250px">
<el-form-item label="帐号">
<el-input v-model="account" placeholder="帐号" size="small" clearable/>
</el-form-item>
</el-col>
<el-col style="width: 250px">
<el-form-item label="地址">
<el-input v-model="address" placeholder="地址" size="small" clearable/>
</el-form-item>
</el-col>
<el-col style="width: 250px">
<el-form-item label="传真">
<el-input v-model="fax" placeholder="传真" size="small" clearable/>
</el-form-item>
</el-col>
<el-col style="width: 250px">
<el-form-item label="主要产品">
<el-input v-model="mainProduction" placeholder="主要产品" size="small" clearable/>
</el-form-item>
</el-col>
<el-col style="width: 250px;margin:2px 0 0 15px">
<el-button type="success" size="small" icon="el-icon-search" @click="pageCurrent = 1;fetchData()">查询</el-button>
<el-button type="primary" size="small" icon="el-icon-circle-plus-outline" style="margin-left:10px" @click="handleAdd()">增加</el-button>
</el-col>
</el-row>
</el-form>
</el-card>
<el-card>
<div style="display: inline-block;margin-bottom: 20px">供应商列表</div>
<el-table :data="List" highlight-current-row border style="width: 100%;max-height: 600px;" height="600" size="mini" @row-click="rowClick">
<el-table-column label="供应商名称" align="center" fixed="left" min-width="250">
<template slot-scope="scope">
{{ scope.row.供应商名称 }}
</template>
</el-table-column>
<el-table-column label="主要产品" align="center" min-width="150">
<template slot-scope="scope">
{{ scope.row.主要产品 }}
</template>
</el-table-column>
<el-table-column label="开户行" align="center" min-width="150">
<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="120">
<template slot-scope="scope">
{{ scope.row.电话号码 }}
</template>
</el-table-column>
<el-table-column label="电子信箱" align="center" min-width="120">
<template slot-scope="scope">
{{ scope.row.电子信箱 }}
</template>
</el-table-column>
<el-table-column label="地址" align="center" min-width="150">
<template slot-scope="scope">
{{ scope.row.地址 }}
</template>
</el-table-column>
<el-table-column label="传真" align="center" min-width="120">
<template slot-scope="scope">
{{ scope.row.传真 }}
</template>
</el-table-column>
<el-table-column label="法人" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.企业性质 }}
</template>
</el-table-column>
<el-table-column label="受托人" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.注册资本 }}
</template>
</el-table-column>
<el-table-column label="邮编" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.货期 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" fixed="right" width="190">
<template slot-scope="scope">
<el-button type="primary" size="mini" icon="el-icon-edit" @click="handleEdit(scope.row)">编辑</el-button>
<el-button type="danger" size="mini" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
<el-card>
<div style="display: inline-block;margin-bottom: 20px;width:90%">供应商联系人列表</div>
<el-button type="primary" size="small" icon="el-icon-circle-plus-outline" style="margin-bottom:10px;float:right" @click="handleAdd2()">增加</el-button>
<el-table :data="List1" border size="mini">
<el-table-column label="姓名" align="center">
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
</el-table-column>
<el-table-column label="职务" align="center">
<template slot-scope="scope">
{{ scope.row.职务 }}
</template>
</el-table-column>
<el-table-column label="电话" align="center" >
<template slot-scope="scope">
{{ scope.row.电话 }}
</template>
</el-table-column>
<el-table-column label="手机" align="center" >
<template slot-scope="scope">
{{ scope.row.手机 }}
</template>
</el-table-column>
<el-table-column label="传真" align="center" >
<template slot-scope="scope">
{{ scope.row.传真 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" fixed="right" width="200">
<template slot-scope="scope">
<el-button type="primary" size="mini" icon="el-icon-edit" style="margin-left:10px" @click="handleEdit2(scope.row)">编辑</el-button>
<el-button type="danger" size="mini" icon="el-icon-delete" @click="handleDelete2(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<el-dialog :title="title" :visible.sync="dialogFormVisible" center style="min-height: 300px" width="800px">
<el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="110px" class="demo-ruleForm">
<el-row>
<el-col :span="12">
<el-form-item label="供应商名称" prop="供应商名称">
<el-input
v-model="form.供应商名称"
size="small"
style="width: 200px;"
clearable/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="法人" prop="企业性质">
<el-input
v-model="form.企业性质"
size="small"
style="width: 200px;"
clearable/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="邮编" prop="货期">
<el-input
v-model="form.货期"
size="small"
style="width: 200px;"
clearable/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="受托人" prop="注册资本">
<el-input
v-model="form.注册资本"
size="small"
style="width: 200px;"
clearable/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="税号" prop="税号">
<el-input
v-model="form.税号"
size="small"
style="width: 200px;"
clearable/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="开户行" prop="开户行">
<el-input
v-model="form.开户行"
size="small"
style="width: 200px;"
clearable/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="帐号" prop="帐号">
<el-input
v-model="form.帐号"
size="small"
style="width: 200px;"
clearable/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="电子信箱" prop="电子信箱">
<el-input
v-model="form.电子信箱"
size="small"
style="width: 200px;"
clearable/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="地址" prop="地址">
<el-input
v-model="form.地址"
size="small"
style="width: 200px;"
clearable/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="电话号码" prop="电话号码">
<el-input
v-model="form.电话号码"
size="small"
style="width: 200px;"
clearable/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="传真" prop="传真">
<el-input
v-model="form.传真"
size="small"
style="width: 200px;"
clearable/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel">取消</el-button>
<el-button v-show="title==='增加'" type="primary" @click="submitAdd('form')">确定</el-button>
<el-button v-show="title==='编辑'" type="primary" @click="submitEdit('form')">确定</el-button>
</div>
</el-dialog>
<el-dialog :title="title2" :visible.sync="dialogFormVisible2" center style="min-height: 300px" width="400px">
<el-form ref="form2" :model="form2" :rules="rules2" label-position="right" label-width="80px" class="demo-ruleForm">
<el-form-item label="姓名" prop="姓名">
<el-input v-model="form2.姓名" size="small" clearable/>
</el-form-item>
<el-form-item label="职务" prop="职务">
<el-input v-model="form2.职务" size="small" clearable/>
</el-form-item>
<el-form-item label="电话" prop="电话">
<el-input v-model="form2.电话" size="small" clearable/>
</el-form-item>
<el-form-item label="手机" prop="手机">
<el-input v-model="form2.手机" size="small" clearable/>
</el-form-item>
<el-form-item label="传真" prop="传真">
<el-input v-model="form2.传真" size="small" clearable/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel">取消</el-button>
<el-button v-show="title2==='增加'" type="primary" @click="submitAdd2('form2')">确定</el-button>
<el-button v-show="title2==='编辑'" type="primary" @click="submitEdit2('form2')">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { searchData, addTable, editTable, deleteData, getName, addPerson, editPerson, deletePerson } from '@/api/PurchasingCenter/SupplierManagement'
export default {
data() {
return {
mainProduction: '', // 主要产品
form1: {},
supplierName: '',
businessNature: '',
creationDate: '',
registeredCapital: '',
taxNumber: '',
email: '',
address: '',
account: '',
bank: '',
telephone: '',
fax: '',
deliveryPeriod: '',
check1: 0,
check2: 0,
check3: 0,
check4: 0,
check5: 0,
check6: 0,
check7: 0,
check8: 0,
check9: 0,
check10: 0,
check11: 0,
check12: 0,
List: [],
pageCurrent: 1,
pageSize: 10,
total: 0,
title: '',
dialogFormVisible: false,
form: {
供应商名称: '',
企业性质: '',
创立日期: '',
注册资本: '',
税号: '',
开户行: '',
帐号: '',
电子信箱: '',
地址: '',
电话号码: '',
传真: '',
货期: ''
},
rules: {
供应商名称: [{ required: true, message: '请填写供应商名称', change: 'blur' }]
},
supplierSerialNumber: '',
List1: [],
dialogFormVisible2: false,
title2: '',
form2: {
姓名: '',
职务: '',
电话: '',
手机: '',
传真: '',
供应商流水号: '',
供应商联系人流水号: ''
},
rules2: {
姓名: [{ required: true, message: '请填写联系人姓名', change: 'blur' }]
}
}
},
mounted() {
this.fetchData()
},
methods: {
fetchData() {
let check1
this.List1 = []
this.supplierName ? this.check1 = 1 : this.check1 = 0
this.businessNature ? this.check2 = 1 : this.check2 = 0
this.creationDate ? this.check3 = 1 : this.check3 = 0
this.registeredCapital ? this.check4 = 1 : this.check4 = 0
this.taxNumber ? this.check5 = 1 : this.check5 = 0
this.bank ? this.check6 = 1 : this.check6 = 0
this.account ? this.check7 = 1 : this.check7 = 0
this.email ? this.check8 = 1 : this.check8 = 0
this.address ? this.check9 = 1 : this.check9 = 0
this.telephone ? this.check10 = 1 : this.check10 = 0
this.fax ? this.check11 = 1 : this.check11 = 0
this.deliveryPeriod ? this.check12 = 1 : this.check12 = 0
this.mainProduction ? check1 = 1 : check1 = 0
searchData(this.check1, this.supplierName, this.check2, this.businessNature, this.check3, this.creationDate, this.check4, this.registeredCapital, this.check5, this.taxNumber, this.check6, this.bank, this.check7, this.account, this.check8, this.email, this.check9, this.address, this.check10, this.telephone, this.check11, this.fax, this.check12, this.deliveryPeriod, this.pageCurrent, this.pageSize, check1, this.mainProduction).then(response => {
this.List = response.data.rows
this.total = response.data.total
})
},
handleAdd() {
if (this.$refs['form'] !== undefined) {
this.$refs['form'].resetFields()
}
this.dialogFormVisible = true
this.title = '增加'
this.form.供应商名称 = ''
this.form.企业性质 = ''
this.form.创立日期 = ''
this.form.注册资本 = ''
this.form.税号 = ''
this.form.开户行 = ''
this.form.帐号 = ''
this.form.电子信箱 = ''
this.form.地址 = ''
this.form.电话号码 = ''
this.form.传真 = ''
this.form.货期 = ''
this.supplierSerialNumber = ''
},
submitAdd(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
addTable(this.form.供应商名称, this.form.企业性质, this.form.创立日期, this.form.注册资本, this.form.税号, this.form.开户行, this.form.帐号, this.form.电子信箱, this.form.地址, this.form.电话号码, this.form.传真, this.form.货期).then(response => {
if (Number(response.data.output[0].output1) === 0) {
this.$message.warning('该供应商已存在')
} else if (response.data.result[0].result === '1') {
this.$message.success('增加成功')
this.dialogFormVisible = false
this.pageCurrent = 1
this.pageSize = 10
this.fetchData()
} else { this.$message.error('增加失败') }
})
} else {
console.log('error submit!!')
return false
}
})
},
handleEdit(row) {
console.log(row)
if (this.$refs['form'] !== undefined) {
this.$refs['form'].resetFields()
}
this.dialogFormVisible = true
this.title = '编辑'
this.form.供应商名称 = row.供应商名称
this.form.企业性质 = row.企业性质
this.form.创立日期 = row.创立日期
this.form.注册资本 = row.注册资本
this.form.税号 = row.税号
this.form.开户行 = row.开户行
this.form.帐号 = row.帐号
this.form.电子信箱 = row.电子信箱
this.form.地址 = row.地址
this.form.电话号码 = row.电话号码
this.form.传真 = row.传真
this.form.货期 = row.货期
this.supplierSerialNumber = row.供应商流水号
},
submitEdit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
editTable(this.form.供应商名称, this.form.企业性质, this.form.创立日期, this.form.注册资本, this.form.税号, this.form.开户行, this.form.帐号, this.form.电子信箱, this.form.地址, this.supplierSerialNumber, this.form.传真, this.form.货期, this.form.电话号码).then(response => {
if (response.data[0].result === '1') {
this.$message.success('编辑成功')
this.dialogFormVisible = false
this.pageCurrent = 1
this.pageSize = 10
this.fetchData()
} else { this.$message.error('编辑失败') }
})
} else {
console.log('error submit!!')
return false
}
})
},
cancel() { // 取消
this.dialogFormVisible = false
},
handleDelete(row) {
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteData(row.供应商流水号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
this.pageCurrent = 1
this.pageSize = 10
this.fetchData()
} else { this.$message.error('删除失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
handleSizeChange(val) {
this.pageSize = val
this.pageCurrent = 1
this.fetchData()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.fetchData()
},
rowClick(row) {
this.List1 = []
this.form2.供应商流水号 = row.供应商流水号
getName(this.form2.供应商流水号).then(response => {
this.List1 = response.data
})
},
handleAdd2() {
if (this.$refs['form2'] !== undefined) {
this.$refs['form2'].resetFields()
}
this.dialogFormVisible2 = true
this.title2 = '增加'
this.form2.姓名 = ''
this.form2.职务 = ''
this.form2.电话 = ''
this.form2.手机 = ''
this.form2.传真 = ''
},
submitAdd2(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
addPerson(this.form2.姓名, this.form2.职务, this.form2.电话, this.form2.手机, this.form2.传真, this.form2.供应商流水号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('增加成功')
this.dialogFormVisible2 = false
getName(this.form2.供应商流水号).then(response => {
this.List1 = response.data
})
} else { this.$message.error('增加失败') }
})
} else {
console.log('error submit!!')
return false
}
})
},
handleEdit2(row) {
if (this.$refs['form2'] !== undefined) {
this.$refs['form2'].resetFields()
}
this.dialogFormVisible2 = true
this.title2 = '编辑'
this.form2.姓名 = row.姓名
this.form2.职务 = row.职务
this.form2.电话 = row.电话
this.form2.手机 = row.手机
this.form2.传真 = row.传真
this.form2.供应商联系人流水号 = row.供应商联系人流水号
},
submitEdit2(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
editPerson(this.form2.姓名, this.form2.职务, this.form2.电话, this.form2.手机, this.form2.传真, this.form2.供应商联系人流水号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('编辑成功')
this.dialogFormVisible2 = false
getName(this.form2.供应商流水号).then(response => {
this.List1 = response.data
})
} else { this.$message.error('编辑失败') }
})
} else {
console.log('error submit!!')
return false
}
})
},
handleDelete2(row) {
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deletePerson(row.供应商联系人流水号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
getName(this.form2.供应商流水号).then(response => {
this.List1 = response.data
})
} else { this.$message.error('删除失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom: 15px;
}
.el-date-editor{
width:200px
}
.el-select{
width:200px
}
.el-input{
width:170px
}
span{
margin: 10px 0 10px 10px;
}
.searchForm .el-form-item{
margin-bottom: 5px;
}
</style>