<template>
|
<!-- 所有文件(内、外部文件)的发放与回收记录 -->
|
<div class="DistributionRetrievalRecordsAllDocuments">
|
<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.manageRecordIssueRecycle.pageManageRecordIssueRecycle"
|
:delUrl="$api.manageRecordIssueRecycle.delManageRecordIssueRecycle" :componentData="componentData"
|
:upUrl="$api.manageRecordIssueRecycle.doManageRecordIssueRecycle" :key="upIndex" />
|
</div>
|
<el-dialog :title="title" :visible.sync="addDialogVisible" width="400px" top="6vh">
|
<el-row>
|
<el-col :span="24" style="margin-bottom: 16px;">
|
<div class="search_thing">
|
<div class="search_label"><span style="color: red;margin-left: 4px;">* </span>文件编号:</div>
|
<div class="search_input">
|
<el-select v-model="addInfo.documentCode" size="small" style="width: 100%;" @change="getCurrentFile"
|
allow-create clearable filterable>
|
<el-option v-for="item in fileList" :key="item.documentCode" :label="item.title"
|
:value="item.documentCode">
|
</el-option>
|
</el-select>
|
</div>
|
</div>
|
</el-col>
|
<el-col :span="24" 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.documentName"></el-input></div>
|
</div>
|
</el-col>
|
<el-col :span="24" 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.documentVersion"></el-input></div>
|
</div>
|
</el-col>
|
<el-col :span="24" 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.pages"></el-input></div>
|
</div>
|
</el-col>
|
<el-col :span="24" style="margin-bottom: 16px;">
|
<div class="search_thing">
|
<div class="search_label">文件类别:</div>
|
<div class="search_input">
|
<el-select v-model="addInfo.documentType" placeholder="请选择" size="small" style="width: 100%;">
|
<el-option v-for="item in fileType" :key="item.value" :label="item.label" :value="item.value">
|
</el-option>
|
</el-select>
|
</div>
|
</div>
|
</el-col>
|
<el-col :span="24" 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.number"></el-input></div>
|
</div>
|
</el-col>
|
<el-col :span="24" style="margin-bottom: 16px;">
|
<div class="search_thing">
|
<div class="search_label">接受人:</div>
|
<div class="search_input">
|
<el-select v-model="addInfo.receiveUser" placeholder="请选择" 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="24" style="margin-bottom: 16px;">
|
<div class="search_thing">
|
<div class="search_label">接收部门:</div>
|
<div class="search_input">
|
<el-select v-model="addInfo.departLims" placeholder="请选择" size="small" style="width: 100%;">
|
<el-option v-for="item in list" :key="item.name" :label="item.name" :value="item.name">
|
</el-option>
|
</el-select>
|
</div>
|
</div>
|
</el-col>
|
<el-col :span="24" style="margin-bottom: 16px;">
|
<div class="search_thing">
|
<div class="search_label">接受日期:</div>
|
<div class="search_input">
|
<el-date-picker v-model="addInfo.receiveDate" 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-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>
|
</div>
|
</template>
|
|
<script>
|
import ValueTable from '@/components/Table/value-table.vue'
|
import {
|
getYearAndMonthAndDays
|
} from '@/utils/date'
|
import { getToken } from "@/utils/auth";
|
export default {
|
components: {
|
ValueTable
|
},
|
data() {
|
return {
|
addPower: true,
|
outPower: true,
|
upPower: true,
|
outLoading: false,
|
addLoading: false,
|
componentData: {
|
entity: {
|
documentName: null,
|
documentCode: null,
|
orderBy: {
|
field: 'id',
|
order: 'desc'
|
}
|
},
|
isIndex: true,
|
showSelect: false,
|
select: false,
|
// selectMethod: 'handleChangeTask',
|
do: [{
|
id: 'delete',
|
font: '删除',
|
type: 'text',
|
method: 'doDiy',
|
disabFun: (row, index) => {
|
return !!row.signedUser
|
}
|
}, {
|
id: 'handleEdit',
|
font: '修改',
|
type: 'text',
|
method: 'handleEdit',
|
field: [],
|
disabFun: (row, index) => {
|
return !!row.signedUser
|
}
|
}, {
|
id: 'handleBack',
|
font: '回收',
|
type: 'text',
|
method: 'handleBack',
|
disabFun: (row, index) => {
|
return !!row.signedUser
|
}
|
}],
|
tagField: {
|
// documentType:{
|
// select: []
|
// },
|
// receiveUserName:{
|
// select: []
|
// },
|
},
|
selectField: {
|
// documentType:{
|
// select: []
|
// },
|
// receiveUserName:{
|
// select: []
|
// },
|
},
|
addUpload: ['signatoryUrl'],
|
requiredAdd: [],
|
requiredUp: [],
|
datePicker: ['receiveDate'],
|
noHead: ['signedUserName', 'signedDate', 'departLims'],//不参与新增编辑的字段
|
needSort: [],
|
inputType: ''
|
},
|
entityCopy: {},
|
upIndex: 0,
|
title: '新增',
|
addDialogVisible: false,
|
addInfo: {},
|
personList: [],
|
fileType: [],
|
fileList: [],
|
list: []
|
}
|
},
|
// 用于上传文件的信息
|
computed: {
|
headers() {
|
return {
|
'Authorization': "Bearer " + getToken()
|
}
|
},
|
action() {
|
return this.javaApi + this.$api.manageRecordIssueRecycle.exportInManageRecordIssueRecycle
|
}
|
},
|
mounted() {
|
this.entityCopy = this.HaveJson(this.componentData.entity);
|
this.getPower()
|
this.getAuthorizedPerson()
|
this.selectEnumByCategory()
|
this.getFileList()
|
this.selectTreeList()
|
},
|
methods: {
|
getPower() {
|
let power = JSON.parse(sessionStorage.getItem('power'))
|
let add = false
|
let del = false
|
let up = false;
|
let out = false;
|
let edit = false
|
for (var i = 0; i < power.length; i++) {
|
if (power[i].menuMethod == 'addManageRecordIssueRecycle') {
|
add = true
|
}
|
if (power[i].menuMethod == 'delManageRecordIssueRecycle') {
|
del = true
|
}
|
if (power[i].menuMethod == 'exportInManageRecordIssueRecycle') {
|
up = true
|
}
|
if (power[i].menuMethod == 'doManageRecordIssueRecycle') {
|
edit = true
|
}
|
if (power[i].menuMethod == 'exportOutManageRecordIssueRecycle') {
|
out = true
|
}
|
}
|
if (!add) {
|
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.manageRecordIssueRecycle.addManageRecordIssueRecycle);
|
this.addInfo = {}
|
this.title = '新增'
|
this.addDialogVisible = true;
|
},
|
handleEdit(row) {
|
this.addInfo = row
|
this.title = '编辑'
|
this.addDialogVisible = true;
|
},
|
// 导出
|
handleDown() {
|
this.outLoading = true
|
this.$axios.post(this.$api.manageRecordIssueRecycle.exportOutManageRecordIssueRecycle, { entity: this.componentData.entity }, { headers: { 'Content-Type': 'application/json' } }).then(res => {
|
this.outLoading = false
|
if (res.code == 201) return this.$message.error('导出失败')
|
this.$message.success('导出成功')
|
let url = this.javaApi + 'word/' + res.message
|
const link = document.createElement('a');
|
link.href = url;
|
link.download = '文件发放与回收记录';
|
link.click();
|
})
|
},
|
refreshTable() {
|
this.refreshTable()()
|
},
|
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.receiveUserName.select = data
|
// this.componentData.selectField.receiveUserName.select = data
|
this.personList = data
|
})
|
},
|
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.refreshTable()()
|
} else {
|
this.$message.error('上传失败');
|
}
|
},
|
selectEnumByCategory() {
|
this.$axios.post(this.$api.enums.selectEnumByCategory, {
|
category: "文件类别"
|
}).then(res => {
|
// this.componentData.tagField.documentType.select = res.data
|
// this.componentData.selectField.documentType.select = res.data
|
this.fileType = res.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.map(m => {
|
m.title = m.documentCode
|
return m
|
})
|
}).catch(err => { })
|
},
|
getCurrentFile(e) {
|
let obj = this.fileList.find(m => m.documentCode == e)
|
if (obj) {
|
this.$set(this.addInfo, 'documentName', obj.name)
|
this.$set(this.addInfo, 'documentVersion', obj.version)
|
this.$set(this.addInfo, 'documentType', obj.type)
|
}
|
},
|
handleAdd() {
|
if (!this.addInfo.documentCode) return this.$message.error('请输入文件编号')
|
this.addLoading = true
|
let obj = {}
|
if (this.title == '新增') {
|
obj = this.HaveJson(this.addInfo)
|
} else {
|
let { id, documentCode, documentName, documentVersion, pages, documentType, number, receiveUser, receiveDate, departLims } = this.addInfo
|
obj = { id, documentCode, documentName, documentVersion, pages, documentType, number, receiveUser, receiveDate, departLims }
|
}
|
this.$axios.post(this.$api.manageRecordIssueRecycle[this.title == '新增' ? 'addManageRecordIssueRecycle' : 'doManageRecordIssueRecycle'], obj, { headers: { 'Content-Type': 'application/json' }, noQs: true }).then(res => {
|
this.addLoading = false
|
if (res.code == 201) {
|
return
|
}
|
this.addDialogVisible = false
|
this.$message({
|
type: 'success',
|
message: '操作成功!'
|
});
|
this.refreshTable()
|
}).catch(err => { })
|
},
|
// 回收
|
handleBack(row) {
|
this.$confirm('是否确认回收?', "提示", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning"
|
}).then(() => {
|
let obj = {}
|
let { id, documentCode, documentName, documentVersion, pages, documentType, number, receiveUser, receiveDate, departLims } = row
|
obj = { id, documentCode, documentName, documentVersion, pages, documentType, number, receiveUser, receiveDate, departLims, signedDate: getYearAndMonthAndDays(), signedUser: JSON.parse(localStorage.getItem("user")).userId }
|
this.$axios.post(this.$api.manageRecordIssueRecycle.doManageRecordIssueRecycle, obj, { headers: { 'Content-Type': 'application/json' }, noQs: true }).then(res => {
|
this.addLoading = false
|
if (res.code == 201) {
|
return
|
}
|
this.addDialogVisible = false
|
this.$message({
|
type: 'success',
|
message: '操作成功!'
|
});
|
this.refreshTable()
|
}).catch(err => { })
|
}).catch(() => { })
|
},
|
// 查询树形列表
|
selectTreeList() {
|
this.$axios.get(this.$api.personnel.selectCNSAPersonTree).then((res) => {
|
this.list = res.data[0].children;
|
});
|
},
|
}
|
}
|
</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>
|