<template>
|
<!-- 文件审批记录 -->
|
<div class="DocumentApprovalRecords">
|
<el-row class="title">
|
<el-col :span="12" style="padding-left: 20px;text-align: left;">文件审批记录</el-col>
|
<el-col :span="12" style="text-align: right;">
|
<el-button size="medium" type="primary" @click="openAdd" v-if="addPower">新增</el-button>
|
<el-upload :action="action" :multiple="false"
|
:show-file-list="false"
|
accept='.doc,.docx' :headers="headers" :on-change="beforeUpload"
|
:on-error="onError" ref='upload' v-if="upPower" :on-success="handleSuccessUp" style="display:inline-block;margin-left: 20px;">
|
<el-button type="primary" size="medium">导入</el-button></el-upload>
|
<el-button size="medium" type="primary" @click="handleDown" :loading="outLoading" v-if="outPower" style="display:inline-block;margin-left: 20px;">导出</el-button>
|
</el-col>
|
</el-row>
|
<div class="search">
|
<div class="search_thing">
|
<div class="search_label">文件名称:</div>
|
<div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="componentData.entity.documentName"
|
@keyup.enter.native="refreshTable()"></el-input></div>
|
</div>
|
<div class="search_thing">
|
<div class="search_label">文件编号:</div>
|
<div class="search_input">
|
<el-input size="small" placeholder="请输入" clearable v-model="componentData.entity.documentCode"
|
@keyup.enter.native="refreshTable()"></el-input>
|
</div>
|
</div>
|
<div class="search_thing" style="padding-left: 30px;">
|
<el-button size="small" @click="refresh()">重 置</el-button>
|
<el-button size="small" type="primary" @click="refreshTable()">查 询</el-button>
|
</div>
|
</div>
|
<div class="table">
|
<ValueTable ref="ValueTable" :url="$api.manageRecordCheck.pageManageRecordCheck"
|
:delUrl="$api.manageRecordCheck.delManageRecordCheck"
|
:componentData="componentData" :dateFormat="'yyyy-MM-dd'" :upUrl="$api.manageRecordCheck.doManageRecordCheck" :key="upIndex"/>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import ValueTable from '../tool/value-table.vue'
|
export default {
|
components: {
|
ValueTable
|
},
|
data(){
|
return{
|
addPower:true,
|
outPower:true,
|
upPower:true,
|
outLoading:false,
|
componentData: {
|
entity: {
|
documentName: null,
|
documentCode: null,
|
orderBy: {
|
field: 'id',
|
order: 'desc'
|
}
|
},
|
init:false,
|
isIndex: true,
|
showSelect: false,
|
select: false,
|
// selectMethod: 'handleChangeTask',
|
do: [{
|
id: 'delete',
|
font: '删除',
|
type: 'text',
|
method: 'doDiy',
|
disabFun: (row, index) => {
|
return row.checkState=='通过'||row.ratifyState=='通过'
|
}
|
}, {
|
id: 'update',
|
font: '修改',
|
type: 'text',
|
method: 'doDiy',
|
field:[],
|
disabFun: (row, index) => {
|
return row.checkState=='通过'||row.ratifyState=='通过'
|
}
|
},{
|
id: 'handleCheck',
|
font: '审核',
|
type: 'text',
|
method: 'handleCheck',
|
disabFun: (row, index) => {
|
return row.checkState=='通过'||row.ratifyState=='通过'
|
}
|
},{
|
id: 'handleApproval',
|
font: '批准',
|
type: 'text',
|
method: 'handleApproval',
|
disabFun: (row, index) => {
|
return row.ratifyState=='通过'
|
}
|
}],
|
tagField: {
|
writeUser:{
|
select: []
|
},
|
checkUser:{
|
select: []
|
},
|
ratifyUser:{
|
select: []
|
},
|
},
|
selectField: {
|
writeUser:{
|
select: []
|
},
|
checkUser:{
|
select: []
|
},
|
ratifyUser:{
|
select: []
|
},
|
},
|
addUpload:['signatoryUrl'],
|
requiredAdd: [],
|
requiredUp: [],
|
datePicker:['ratifyDate'],
|
needSort: [],
|
inputType:''
|
},
|
entityCopy: {},
|
upIndex: 0,
|
}
|
},
|
// 用于上传文件的信息
|
computed: {
|
headers() {
|
return {
|
'token': sessionStorage.getItem('token')
|
}
|
},
|
action() {
|
return this.javaApi +this.$api.manageRecordCheck.exportInManageRecordCheck
|
}
|
},
|
mounted() {
|
this.entityCopy = this.HaveJson(this.componentData.entity);
|
this.getPower()
|
this.getAuthorizedPerson()
|
},
|
methods:{
|
getPower(){
|
let power = JSON.parse(sessionStorage.getItem('power'))
|
let add = false
|
let del = false
|
let up = false;
|
let out = false;
|
let check = false
|
let ratify = false
|
for (var i = 0; i < power.length; i++) {
|
if (power[i].menuMethod == 'addManageRecordCheck') {
|
add = true
|
}
|
if (power[i].menuMethod == 'delManageRecordCheck') {
|
del = true
|
}
|
if (power[i].menuMethod == 'exportInManageRecordCheck') {
|
up = true
|
}
|
if (power[i].menuMethod == 'checkManageRecordCheck') {
|
check = true
|
}
|
if (power[i].menuMethod == 'ratifyManageRecordCheck') {
|
ratify = true
|
}
|
if (power[i].menuMethod == 'exportOutManageRecordCheck') {
|
out = true
|
}
|
}
|
if (!ratify) {
|
this.componentData.do.splice(3, 1)
|
}
|
if (!check) {
|
this.componentData.do.splice(2, 1)
|
}
|
if (!add) {
|
this.componentData.do.splice(1, 1)
|
}
|
if (!del) {
|
this.componentData.do.splice(0, 1)
|
}
|
this.addPower = add
|
this.outPower = out
|
this.upPower = up
|
},
|
// 新增
|
openAdd(){
|
this.$refs.ValueTable.openAddDia(this.$api.manageRecordCheck.addManageRecordCheck);
|
},
|
// 导出
|
handleDown(){
|
this.outLoading = true
|
this.$axios.get(this.$api.manageRecordCheck.exportOutManageRecordCheck + '?documentName=' + this.componentData.entity.documentName + '&documentCode='+ this.componentData.entity.documentCode,{responseType: "blob"}).then(res => {
|
this.outLoading = false
|
if(res.code==201) return this.$message.error('导出失败')
|
this.$message.success('导出成功')
|
const blob = new Blob([res],{ type: 'application/msword' });
|
const url = URL.createObjectURL(blob);
|
const link = document.createElement('a');
|
link.href = url;
|
link.download = '文件审批记录.docx';
|
link.click();
|
})
|
},
|
refreshTable() {
|
this.$refs['ValueTable'].selectList()
|
},
|
refresh() {
|
this.componentData.entity = this.HaveJson(this.entityCopy)
|
// this.upIndex++
|
this.refreshTable()
|
},
|
getAuthorizedPerson() {
|
this.$axios.get(this.$api.user.getUserMenu).then(res => {
|
let data = []
|
res.data.forEach(a => {
|
data.push({
|
label: a.name,
|
value: a.id
|
})
|
})
|
this.componentData.tagField.writeUser.select = data
|
this.componentData.selectField.writeUser.select = data
|
this.componentData.tagField.checkUser.select = data
|
this.componentData.selectField.checkUser.select = data
|
this.componentData.tagField.ratifyUser.select = data
|
this.componentData.selectField.ratifyUser.select = data
|
this.$refs['ValueTable'].selectList()
|
})
|
},
|
// 审核
|
handleCheck(row){
|
this.$confirm('是否审核通过?', '提示', {
|
confirmButtonText: '通过',
|
cancelButtonText: '不通过',
|
type: 'warning',
|
closeOnClickModal: false, // 禁止点击遮罩层关闭
|
distinguishCancelAndClose: true,
|
beforeClose: (action, instance, done) => {
|
if (action === 'confirm') {
|
// 点击“确定”按钮,允许关闭
|
this.$axios.post(this.$api.manageRecordCheck.checkManageRecordCheck, {id:row.id,checkState:'通过'}).then(res => {
|
if (res.code === 201) return
|
this.refreshTable()
|
done();
|
this.$message({
|
type: 'success',
|
message: '提交成功'
|
})
|
})
|
.catch(err => {
|
|
})
|
} else if (action === 'cancel') {
|
// 点击“取消”按钮,不允许关闭
|
this.$axios.post(this.$api.manageRecordCheck.checkManageRecordCheck, {id:row.id,checkState:'不通过'}).then(res => {
|
if (res.code === 201) return
|
this.refreshTable()
|
done();
|
this.$message({
|
type: 'success',
|
message: '提交成功'
|
})
|
})
|
.catch(err => {
|
|
})
|
console.log("取消按钮点击事件,不关闭弹框");
|
} else if (action === 'close') {
|
// 点击“×”按钮,不允许关闭
|
done();
|
console.log("×按钮点击事件,不关闭弹框");
|
}
|
}
|
})
|
},
|
// 批准
|
handleApproval(row){
|
this.$confirm('是否批准通过?', '提示', {
|
confirmButtonText: '通过',
|
cancelButtonText: '不通过',
|
type: 'warning',
|
closeOnClickModal: false, // 禁止点击遮罩层关闭
|
distinguishCancelAndClose: true,
|
beforeClose: (action, instance, done) => {
|
if (action === 'confirm') {
|
// 点击“确定”按钮,允许关闭
|
this.$axios.post(this.$api.manageRecordCheck.ratifyManageRecordCheck, {id:row.id,ratifyState:'通过'}).then(res => {
|
if (res.code === 201) return
|
this.refreshTable()
|
done();
|
this.$message({
|
type: 'success',
|
message: '提交成功'
|
})
|
})
|
.catch(err => {
|
|
})
|
} else if (action === 'cancel') {
|
// 点击“取消”按钮,不允许关闭
|
this.$axios.post(this.$api.manageRecordCheck.ratifyManageRecordCheck, {id:row.id,ratifyState:'不通过'}).then(res => {
|
if (res.code === 201) return
|
this.refreshTable()
|
done();
|
this.$message({
|
type: 'success',
|
message: '提交成功'
|
})
|
})
|
.catch(err => {
|
|
})
|
console.log("取消按钮点击事件,不关闭弹框");
|
} else if (action === 'close') {
|
// 点击“×”按钮,不允许关闭
|
done();
|
console.log("×按钮点击事件,不关闭弹框");
|
}
|
}
|
})
|
},
|
beforeUpload(file) {
|
if (file.size > 1024 * 1024 * 10) {
|
this.$message.error('上传文件不超过10M');
|
this.$refs.upload.clearFiles()
|
return false;
|
} else {
|
// this.upLoading = true;
|
return true;
|
}
|
},
|
onError(err, file, fileList) {
|
this.$message.error('上传失败')
|
this.$refs.upload.clearFiles()
|
},
|
handleSuccessUp(response) {
|
this.upLoading = false;
|
if (response.code == 200) {
|
this.$message.success('上传成功');
|
this.$refs['ValueTable'].selectList()
|
}else{
|
this.$message.error('上传失败');
|
}
|
},
|
}
|
}
|
</script>
|
|
<style scoped>
|
.title {
|
height: 60px;
|
line-height: 60px;
|
}
|
.search {
|
background-color: #fff;
|
height: 80px;
|
display: flex;
|
align-items: center;
|
}
|
|
.search_thing {
|
width: 350px;
|
display: flex;
|
align-items: center;
|
}
|
|
.search_label {
|
width: 110px;
|
font-size: 14px;
|
text-align: right;
|
}
|
|
.search_input {
|
width: calc(100% - 110px);
|
}
|
|
.table {
|
margin-top: 10px;
|
background-color: #fff;
|
width: calc(100% - 40px);
|
height: calc(100% - 60px - 80px - 10px - 40px);
|
padding: 20px;
|
}
|
</style>
|