<template>
|
<!-- 发放回收记录 -->
|
<div class="distribution-collection-record" style="height: 100%;">
|
<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.documentCode"
|
@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.name"
|
@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 class="btns" style="padding-left: 30px;">
|
<el-button size="small" type="primary" @click="addDialogVisible=true,addInfo={},radio='发放'" v-if="addPower">添加发放记录</el-button>
|
<el-button size="small" type="primary" v-if="outPower" @click="handleOut" :loading="outLoading">导出</el-button>
|
</div>
|
</div>
|
<div class="table">
|
<ValueTable ref="ValueTable" :url="$api.manageDocumentList.pageManageDocumentIssueRecycle"
|
:componentData="componentData" :delUrl="$api.manageDocumentList.delManageDocumentIssueRecycle" :key="upIndex"/>
|
</div>
|
<el-dialog
|
:title="'添加'+radio+'记录'"
|
:visible.sync="addDialogVisible"
|
width="800px" top="10vh">
|
<el-row>
|
<el-col :span="12" style="margin-bottom: 16px;">
|
<div class="search_thing">
|
<div class="search_label"><span style="color:red;margin-right: 4px;">*</span>申请编号:</div>
|
<div class="search_input">
|
<el-select v-model="addInfo.documentCode" size="small" style="width: 100%;" @change="changeFileList" :disabled="radio=='回收'" filterable allow-create clearable>
|
<el-option
|
v-for="item in fileList"
|
:key="item.documentCode"
|
:label="item.documentCode"
|
:value="item.documentCode">
|
</el-option>
|
</el-select>
|
</div>
|
</div>
|
</el-col>
|
<el-col :span="12" style="margin-bottom: 16px;" v-if="radio=='发放'">
|
<div class="search_thing">
|
<div class="search_label"><span style="color:red;margin-right: 4px;">*</span>发放人:</div>
|
<div class="search_input">
|
<el-select v-model="addInfo.issueUser" size="small" style="width: 100%;" filterable>
|
<el-option
|
v-for="item in personList"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value">
|
</el-option>
|
</el-select>
|
</div>
|
</div>
|
</el-col>
|
<el-col :span="12" style="margin-bottom: 16px;" v-else>
|
<div class="search_thing">
|
<div class="search_label"><span style="color:red;margin-right: 4px;">*</span>回收人:</div>
|
<div class="search_input">
|
<el-select v-model="addInfo.recycleUser" size="small" style="width: 100%;" filterable>
|
<el-option
|
v-for="item in personList"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value">
|
</el-option>
|
</el-select>
|
</div>
|
</div>
|
</el-col>
|
<el-col :span="12" style="margin-bottom: 16px;">
|
<div class="search_thing">
|
<div class="search_label"><span style="color:red;margin-right: 4px;">*</span>审批人:</div>
|
<div class="search_input">
|
<el-select v-model="addInfo.receiveUser" size="small" style="width: 100%;" :disabled="radio!='发放'" filterable>
|
<el-option
|
v-for="item in personList"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value">
|
</el-option>
|
</el-select>
|
</div>
|
</div>
|
</el-col>
|
<el-col :span="12" style="margin-bottom: 16px;">
|
<div class="search_thing">
|
<div class="search_label">文件名称:</div>
|
<div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="addInfo.name" :disabled="radio=='回收'"></el-input></div>
|
</div>
|
</el-col>
|
<el-col :span="12" style="margin-bottom: 16px;">
|
<div class="search_thing">
|
<div class="search_label">文件版本:</div>
|
<div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="addInfo.version" :disabled="radio=='回收'"></el-input></div>
|
</div>
|
</el-col>
|
<el-col :span="12" style="margin-bottom: 16px;">
|
<div class="search_thing">
|
<div class="search_label">文件状态:</div>
|
<div class="search_input">
|
<el-select v-model="addInfo.state" size="small" style="width: 100%;" :disabled="radio=='回收'">
|
<el-option :label="item.label" :value="item.value" v-for="(item,index) in fileState" :key="index"></el-option>
|
</el-select>
|
</div>
|
</div>
|
</el-col>
|
<el-col :span="12" style="margin-bottom: 16px;" v-if="radio=='发放'">
|
<div class="search_thing">
|
<div class="search_label">发放编号:</div>
|
<div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="addInfo.issueCode"></el-input></div>
|
</div>
|
</el-col>
|
<el-col :span="12" style="margin-bottom: 16px;" v-else>
|
<div class="search_thing">
|
<div class="search_label">回收编号:</div>
|
<div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="addInfo.recycleCode"></el-input></div>
|
</div>
|
</el-col>
|
<el-col :span="12" style="margin-bottom: 16px;" v-if="radio=='发放'">
|
<div class="search_thing">
|
<div class="search_label">发放时间:</div>
|
<div class="search_input">
|
<el-date-picker
|
v-model="addInfo.issueDate"
|
type="date"
|
size="small"
|
placeholder="选择日期"
|
format="yyyy-MM-dd"
|
value-format="yyyy-MM-dd" style="width: 100%;">
|
</el-date-picker>
|
</div>
|
</div>
|
</el-col>
|
<el-col :span="12" style="margin-bottom: 16px;" v-else>
|
<div class="search_thing">
|
<div class="search_label">回收时间:</div>
|
<div class="search_input">
|
<el-date-picker
|
v-model="addInfo.recycleDate"
|
type="date"
|
size="small"
|
placeholder="选择日期"
|
format="yyyy-MM-dd"
|
value-format="yyyy-MM-dd" style="width: 100%;">
|
</el-date-picker>
|
</div>
|
</div>
|
</el-col>
|
<el-col :span="12" style="margin-bottom: 16px;" v-if="radio=='发放'">
|
<div class="search_thing">
|
<div class="search_label">发放说明:</div>
|
<div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="addInfo.issueNote" type="textarea"
|
:rows="2"></el-input></div>
|
</div>
|
</el-col>
|
<el-col :span="12" style="margin-bottom: 16px;" v-else>
|
<div class="search_thing">
|
<div class="search_label">回收说明:</div>
|
<div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="addInfo.recycleNote" type="textarea"
|
:rows="2"></el-input></div>
|
</div>
|
</el-col>
|
<el-col :span="12" style="margin-bottom: 16px;" v-if="radio=='发放'">
|
<div class="search_thing">
|
<div class="search_label">上传附件:</div>
|
<div class="search_input"><el-upload
|
style="margin: 8px 0 0px 50px;"
|
action="#"
|
:auto-upload="false"
|
:multiple="false"
|
accept='.pdf,.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx' :on-change="handleChangeUpload">
|
<el-button size="small" type="primary">上传附件</el-button>
|
</el-upload></div>
|
</div>
|
</el-col>
|
</el-row>
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="addDialogVisible = false">取 消</el-button>
|
<el-button type="primary" @click="handleAdd" :loading="addLoading">确 定</el-button>
|
</span>
|
</el-dialog>
|
<el-dialog
|
title="查看附件"
|
:visible.sync="lookDialogVisible"
|
width="800px" top="5vh" fullscreen>
|
<filePreview v-if="lookDialogVisible" :fileUrl="javaApi+'/word/'+currentInfo.url"
|
:currentFile="{}" style="height: 90vh;overflow-y: auto;"/>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import ValueTable from '../../tool/value-table.vue'
|
import filePreview from '../../tool/file-preview.vue'
|
export default {
|
components: {
|
ValueTable,
|
filePreview
|
},
|
data() {
|
return {
|
ddPower: false,
|
outPower:true,
|
addInfo: {},
|
addPower:true,
|
addLoading:false,
|
addDialogVisible: false,
|
outLoading:false,
|
componentData: {
|
entity: {
|
documentCode: null,
|
name: null,
|
orderBy: {
|
field: 'createTime',
|
order: 'desc'
|
}
|
},
|
isIndex: true,
|
showSelect: false,
|
select: false,
|
do: [{
|
id: 'handleUpdate',
|
font: '回收记录',
|
type: 'text',
|
method: 'handleUpdate',
|
field:[],
|
// disabFun: (row, index) => {
|
// return row.documentState=='通过'
|
// }
|
},
|
{
|
id: 'delete',
|
font: '删除',
|
type: 'text',
|
method: 'doDiy',
|
disabFun: (row, index) => {
|
return row.documentState=='通过'
|
}
|
},
|
{
|
id: 'handleLook',
|
font: '查看附件',
|
type: 'text',
|
method: 'handleLook',
|
disabFun: (row, index) => {
|
return !row.url
|
}
|
},
|
{
|
id: 'handleCheck',
|
font: '审核',
|
type: 'text',
|
method: 'handleCheck',
|
disabFun: (row, index) => {
|
return row.receiveUser!=JSON.parse(localStorage.getItem("user")).userId||row.documentState=='通过'
|
}
|
},],
|
tagField: {
|
state:{
|
select: [
|
{
|
value: '通过',
|
label: '通过'
|
},
|
{
|
value: '不通过',
|
label: '不通过'
|
},
|
]
|
},
|
},
|
selectField: {
|
state:{
|
select: [
|
{
|
value: '通过',
|
label: '通过'
|
},
|
{
|
value: '不通过',
|
label: '不通过'
|
},
|
]
|
},
|
signatory:{
|
select: []
|
},
|
},
|
datePicker:['effectiveDate'],
|
addUpload:['signatoryUrl'],
|
requiredAdd: [],
|
requiredUp: [],
|
needSort: [],
|
inputType: ''
|
},
|
entityCopy: {},
|
upIndex: 0,
|
personList:[],
|
fileList:[],
|
fileList0:[],
|
radio:'发放',
|
fileState:[],
|
file:null,
|
currentInfo:{},
|
lookDialogVisible:false
|
}
|
},
|
mounted() {
|
this.entityCopy = this.HaveJson(this.componentData.entity);
|
this.getPower()
|
this.getAuthorizedPerson()
|
this.getFileList()
|
this.getFileList0()
|
this.selectEnumByCategory()
|
},
|
methods:{
|
getPower(){
|
let power = JSON.parse(sessionStorage.getItem('power'))
|
let out = false
|
let del = false
|
let add = false
|
// let check = false
|
for (var i = 0; i < power.length; i++) {
|
if (power[i].menuMethod == 'exportManageDocumentIssueRecycle') {
|
out = true
|
}
|
if (power[i].menuMethod == 'addManageDocumentIssueRecycle') {
|
add = true
|
}
|
if (power[i].menuMethod == 'delManageDocumentIssueRecycle') {
|
del = true
|
}
|
// if (power[i].menuMethod == 'checkManageDocumentControlled') {
|
// check = true
|
// }
|
}
|
// if (!check) {
|
// this.componentData.do.splice(2, 1)
|
// }
|
if (!del) {
|
this.componentData.do.splice(1, 1)
|
}
|
if (!add) {
|
this.componentData.do.splice(0, 1)
|
}
|
this.addPower = add
|
this.outPower = out
|
},
|
refreshTable() {
|
this.$refs['ValueTable'].selectList()
|
},
|
refresh() {
|
this.componentData.entity = this.HaveJson(this.entityCopy)
|
this.upIndex++
|
this.refreshTable()
|
},
|
selectEnumByCategory() {
|
this.$axios.post(this.$api.enums.selectEnumByCategory, {
|
category: "文件状态"
|
}).then(res => {
|
this.fileState = res.data
|
// this.componentData.tagField.state.select = res.data
|
// this.componentData.selectField.state.select = res.data
|
})
|
},
|
// 获取人员列表
|
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.personList = data
|
})
|
},
|
// 获取文件列表--文件清单
|
getFileList(){
|
this.$axios.post(this.$api.manageDocumentList.pageManageDocumentList,{
|
entity: {
|
orderBy: {
|
field: 'createTime',
|
order: 'desc'
|
}
|
},
|
page:{
|
current:-1,
|
size:-1
|
}
|
},{headers: {
|
'Content-Type': 'application/json'
|
}}).then(res=>{
|
this.fileList = res.data.body.records
|
}).catch(err=>{})
|
},
|
// 获取文件列表--作废文件
|
getFileList0(){
|
this.$axios.post(this.$api.manageDocumentList.pageManageDocumentCancel,{
|
entity: {
|
orderBy: {
|
field: 'createTime',
|
order: 'desc'
|
}
|
},
|
page:{
|
current:-1,
|
size:-1
|
}
|
},{headers: {
|
'Content-Type': 'application/json'
|
}}).then(res=>{
|
this.fileList0 = res.data.body.records
|
}).catch(err=>{})
|
},
|
// 导出
|
handleOut(){
|
this.outLoading = true
|
this.$axios.post(this.$api.manageDocumentList.exportManageDocumentIssueRecycle, {entity:this.componentData.entity},{headers: {
|
'Content-Type': 'application/json'
|
},responseType: "blob"},).then(res => {
|
this.outLoading = false
|
this.$message.success('导出成功')
|
const blob = new Blob([res],{ type: 'application/octet-stream' });
|
const url = URL.createObjectURL(blob);
|
const link = document.createElement('a');
|
link.href = url;
|
link.download = '发放回收记录.xlsx';
|
link.click();
|
})
|
},
|
changeFileList(e){
|
if(e){
|
let obj = this.fileList.find(a=>a.documentCode == e)
|
this.addInfo.name = obj.name
|
this.addInfo.version = obj.version
|
this.addInfo.state = obj.state
|
}
|
},
|
// 提交
|
handleAdd(){
|
if(!this.addInfo.documentCode){
|
this.$message.error('请选择文件')
|
return
|
}
|
if(!this.addInfo.receiveUser){
|
this.$message.error('请选择审批人')
|
return
|
}
|
if(this.radio=='发放'){
|
if(!this.addInfo.issueUser){
|
this.$message.error('请选择发放人')
|
return
|
}
|
}else{
|
if(!this.addInfo.recycleUser){
|
this.$message.error('请选择回收人')
|
return
|
}
|
}
|
this.addLoading = true;
|
if(!this.addInfo.id){
|
// 新增发放记录
|
let fd = new FormData();
|
//文件信息中raw才是真的文件
|
if(this.file){
|
fd.append("file",this.file.raw);
|
}
|
for(let key in this.addInfo){
|
fd.append(key,this.addInfo[key])
|
}
|
this.$axios.post(this.$api.manageDocumentList.addManageDocumentIssueRecycle,fd,{
|
headers: {
|
'Content-Type': 'multipart/form-data'
|
},
|
noQs:true
|
}).then(res=>{
|
this.addLoading = false;
|
if(res.code==200){
|
this.$message.success('发放成功')
|
this.addDialogVisible = false
|
this.refreshTable()
|
}
|
})
|
}else{
|
let {documentCode,id,issueUser,recycleUser,receiveUser,name,version,documentState,issueCode,recycleCode,issueDate,recycleDate,issueNote,recycleNote} = this.addInfo
|
// 添加回收记录
|
this.$axios.post(this.$api.manageDocumentList.doManageDocumentIssueRecycle,{
|
documentCode,id,issueUser,recycleUser,receiveUser,name,version,documentState,issueCode,recycleCode,issueDate,recycleDate,issueNote,recycleNote
|
},{headers: {
|
'Content-Type': 'application/json'
|
},noQS:true}).then(res=>{
|
this.addLoading = false;
|
if(res.code==200){
|
this.$message.success('提交成功')
|
this.addDialogVisible = false
|
this.refreshTable()
|
}
|
})
|
}
|
},
|
// 添加回收
|
handleUpdate(row){
|
this.addInfo = this.HaveJson(row)
|
this.radio = '回收'
|
this.addDialogVisible = true
|
},
|
// 审核
|
handleCheck(row){
|
this.$confirm('是否审核通过?', '提示', {
|
confirmButtonText: '通过',
|
cancelButtonText: '不通过',
|
type: 'warning',
|
closeOnClickModal: false, // 禁止点击遮罩层关闭
|
distinguishCancelAndClose: true,
|
beforeClose: (action, instance, done) => {
|
if (action === 'confirm') {
|
// 点击“确定”按钮,允许关闭
|
this.$axios.post(this.$api.manageDocumentList.checkManageDocumentIssueRecycle, {id:row.id,documentState:'通过'}).then(res => {
|
this.refreshTable()
|
done();
|
this.$message({
|
type: 'success',
|
message: '提交成功'
|
})
|
})
|
.catch(err => {
|
|
})
|
} else if (action === 'cancel') {
|
// 点击“取消”按钮,不允许关闭
|
this.$axios.post(this.$api.manageDocumentList.checkManageDocumentIssueRecycle, {id:row.id,documentState:'不通过'}).then(res => {
|
this.refreshTable()
|
done();
|
this.$message({
|
type: 'success',
|
message: '提交成功'
|
})
|
})
|
.catch(err => {
|
|
})
|
console.log("取消按钮点击事件,不关闭弹框");
|
} else if (action === 'close') {
|
// 点击“×”按钮,不允许关闭
|
done();
|
console.log("×按钮点击事件,不关闭弹框");
|
}
|
}
|
})
|
},
|
handleChangeUpload(file, fileLists){
|
this.file = file
|
this.$set(this.addInfo,'name',file.name)
|
},
|
// 查看附件
|
handleLook(row){
|
this.currentInfo = this.HaveJson(row)
|
this.lookDialogVisible = true
|
}
|
}
|
}
|
</script>
|
|
<style scoped>
|
.title {
|
height: 60px;
|
line-height: 60px;
|
}
|
.search {
|
background-color: #fff;
|
height: 40px;
|
display: flex;
|
align-items: center;
|
position: relative;
|
}
|
|
.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 {
|
background-color: #fff;
|
width: calc(100% - 40px);
|
height: calc(100% - 60px - 80px);
|
padding: 20px;
|
}
|
.btns{
|
position: absolute;
|
right: 20px;
|
top: 5px;
|
}
|
</style>
|