Files
JY1.0/src/views/PurchasingCenter/PurchaseContractReview/index.vue
2020-03-11 09:26:23 +08:00

415 lines
14 KiB
Vue

<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="warning"-->
<!-- size="small"-->
<!-- plain-->
<!-- 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 stripe style="width: 60%; max-height: 500px" height="150px" highlight-current-row @row-click="searchTable2">
<el-table-column type="expand" label="详情">
<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="text" size="mini" icon="el-icon-check" @click="yesApproval(scope.row)">通过</el-button>
<el-button type="text" size="mini" icon="el-icon-close" @click="noApproval(scope.row)">不通过</el-button>
<!--<el-button type="text" 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 v-el-drag-dialog :visible.sync="dialogFormVisible" title="合同审批通知" center style="min-height: 300px;" width="370px">
<el-form ref="form" :model="form" :rules="rules" label-position="right" label-width="80px" 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
})
},
// 通过审核
yesApproval(row) {
this.$confirm('确定审核通过?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
submitApproval(this.ProcurementContractNum, 1, '').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('审核失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '取消操作'
})
})
},
// 不通过审核
noApproval(row) {
this.$prompt('请输入不通过原因', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(({ value }) => {
submitApproval(this.ProcurementContractNum, 2, '').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('审核失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '取消操作'
})
})
},
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: 0px;
}
.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>