<template>
|
<!-- 文件变更申请 -->
|
<div class="file-change-request" 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.code"
|
@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" v-if="addPower">
|
<el-button size="small" type="primary" @click="addDialogVisible=true,addInfo={},currentFile={},title='文件变更申请'">文件变更申请</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.pageManageDocumentAlter"
|
:componentData="componentData" :delUrl="$api.manageDocumentList.delManageDocumentAlter" :key="upIndex"/>
|
</div>
|
<el-dialog
|
:title="title"
|
:visible.sync="addDialogVisible"
|
width="950px" top="0vh">
|
<el-row style="max-height: 80vh;overflow-y: auto;">
|
<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-input size="small" placeholder="请输入" clearable v-model="addInfo.code" :disabled="title=='审核'"></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.checkUser" size="small" style="width: 100%;" filterable :disabled="title=='审核'">
|
<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-date-picker
|
v-model="addInfo.expectAlterDate"
|
type="date"
|
size="small"
|
placeholder="选择日期"
|
format="yyyy-MM-dd"
|
value-format="yyyy-MM-dd" style="width: 100%;" :disabled="title=='审核'">
|
</el-date-picker>
|
</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-date-picker
|
v-model="addInfo.actuallyAlterDate"
|
type="date"
|
size="small"
|
placeholder="选择日期"
|
format="yyyy-MM-dd"
|
value-format="yyyy-MM-dd" style="width: 100%;"
|
:disabled="title=='审核'">
|
</el-date-picker>
|
</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.alterBeforeCode" size="small" style="width: 100%;" @change="getCurrentFile" :disabled="title=='审核'" filterable allow-create clearable>
|
<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">
|
<h4 class="title">当前文件信息</h4>
|
</el-col>
|
<el-col :span="8" style="margin-bottom: 16px;">
|
<div class="search_thing" style="width: 100%;">
|
<div class="search_label">文件编号:</div>
|
<div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="currentFile.documentCode" :disabled="title=='审核'"></el-input></div>
|
</div>
|
</el-col>
|
<el-col :span="8" style="margin-bottom: 16px;">
|
<div class="search_thing" style="width: 100%;">
|
<div class="search_label">文件名称:</div>
|
<div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="currentFile.name" :disabled="title=='审核'"></el-input></div>
|
</div>
|
</el-col>
|
<el-col :span="8" style="margin-bottom: 16px;">
|
<div class="search_thing" style="width: 100%;">
|
<div class="search_label">文件版本:</div>
|
<div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="currentFile.version" :disabled="title=='审核'"></el-input></div>
|
</div>
|
</el-col>
|
<el-col :span="8" style="margin-bottom: 16px;">
|
<div class="search_thing" style="width: 100%;">
|
<div class="search_label">提交人:</div>
|
<div class="search_input"><el-select v-model="currentFile.createUser" size="small" style="width: 100%;" disabled 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="8" style="margin-bottom: 16px;">
|
<div class="search_thing" style="width: 100%;">
|
<div class="search_label">审核人:</div>
|
<div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="addInfo.version" disabled></el-input></div>
|
</div>
|
</el-col>
|
<el-col :span="8" style="margin-bottom: 16px;">
|
<div class="search_thing" style="width: 100%;">
|
<div class="search_label">作废人:</div>
|
<div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="addInfo.version" disabled></el-input></div>
|
</div>
|
</el-col> -->
|
<el-col :span="8" style="margin-bottom: 16px;">
|
<div class="search_thing" style="width: 100%;">
|
<div class="search_label">提交时间:</div>
|
<div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="currentFile.createTime" disabled></el-input></div>
|
</div>
|
</el-col>
|
<el-col :span="8" style="margin-bottom: 16px;">
|
<div class="search_thing" style="width: 100%;">
|
<div class="search_label">审核时间:</div>
|
<div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="currentFile.effectiveDate" disabled></el-input></div>
|
</div>
|
</el-col>
|
<!-- <el-col :span="8" style="margin-bottom: 16px;">
|
<div class="search_thing" style="width: 100%;">
|
<div class="search_label">作废时间:</div>
|
<div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="addInfo.version" disabled></el-input></div>
|
</div>
|
</el-col> -->
|
<el-col :span="8" style="margin-bottom: 16px;">
|
<div class="search_thing" style="width: 100%;">
|
<div class="search_label">文件状态:</div>
|
<div class="search_input">
|
<el-select v-model="currentFile.state" size="small" style="width: 100%;" disabled>
|
<el-option
|
v-for="item in fileState"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value">
|
</el-option>
|
</el-select>
|
</div>
|
</div>
|
</el-col>
|
<!-- <el-col :span="8" style="margin-bottom: 16px;">
|
<div class="search_thing" style="width: 100%;">
|
<div class="search_label">文件说明:</div>
|
<div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="addInfo.instructions" type="textarea"
|
:rows="2" disabled></el-input></div>
|
</div>
|
</el-col> -->
|
<el-col :span="24">
|
<h4 class="title">文件变更申请</h4>
|
</el-col>
|
<el-col :span="8" style="margin-bottom: 16px;">
|
<div class="search_thing" style="width: 100%;">
|
<div class="search_label">变更后编号:</div>
|
<div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="addInfo.alterAfterCode" :disabled="title=='审核'"></el-input></div>
|
</div>
|
</el-col>
|
<el-col :span="8" style="margin-bottom: 16px;">
|
<div class="search_thing" style="width: 100%;">
|
<div class="search_label">变更后名称:</div>
|
<div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="addInfo.alterAfterName" :disabled="title=='审核'"></el-input></div>
|
</div>
|
</el-col>
|
<el-col :span="8" style="margin-bottom: 16px;">
|
<div class="search_thing" style="width: 100%;">
|
<div class="search_label">前一版本处理:</div>
|
<div class="search_input">
|
<el-select v-model="addInfo.method" size="small" style="width: 100%;" :disabled="title=='审核'">
|
<el-option label="作废" value="作废"></el-option>
|
<el-option label="存档不可用" value="存档不可用">
|
</el-option>
|
</el-select>
|
</div>
|
</div>
|
</el-col>
|
<el-col :span="8" style="margin-bottom: 16px;">
|
<div class="search_thing" style="width: 100%;">
|
<div class="search_label">变更后版本:</div>
|
<div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="addInfo.alterAfterVersion" :disabled="title=='审核'"></el-input></div>
|
</div>
|
</el-col>
|
<el-col :span="16" style="margin-bottom: 16px;">
|
<div class="search_thing" style="width: 100%;">
|
<div class="search_label">变更说明:</div>
|
<div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="addInfo.alterNote" type="textarea"
|
:rows="2" :disabled="title=='审核'"></el-input></div>
|
</div>
|
</el-col>
|
<el-col :span="24" style="margin-bottom: 16px;" v-if="title!='审核'">
|
<div class="search_thing" style="width: 100%;">
|
<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' :on-change="handleChangeUpload" v-if="addDialogVisible">
|
<el-button size="small" type="primary">上传附件</el-button>
|
</el-upload></div>
|
</div>
|
</el-col>
|
<UpPdfStamp ref="UpPdfStamp" v-if="title=='审核'&&addDialogVisible" @uploadPDF="uploadPDF" :isUpFile="false"></UpPdfStamp>
|
</el-row>
|
<span slot="footer" class="dialog-footer" v-if="title!='审核'">
|
<el-button @click="addDialogVisible = false">取 消</el-button>
|
<el-button type="primary" @click="handleAdd" :loading="addLoading">确 定</el-button>
|
</span>
|
<span slot="footer" class="dialog-footer" v-else>
|
<el-button @click="handleCheckSub('不通过')" :loading="noCheckLoading">不通过</el-button>
|
<el-button type="primary" @click="handleCheckSub('通过')" :loading="checkLoading">通 过</el-button>
|
</span>
|
</el-dialog>
|
<el-dialog
|
title="查看附件"
|
:visible.sync="lookDialogVisible"
|
width="800px" top="5vh" fullscreen>
|
<filePreview v-if="lookDialogVisible" :fileUrl="javaApi+'/word/'+currentInfo.alterAfterUrl"
|
: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'
|
import UpPdfStamp from '../../tool/upPdfStamp.vue'
|
export default {
|
components: {
|
ValueTable,
|
filePreview,
|
UpPdfStamp,
|
},
|
data() {
|
return {
|
title:'文件变更申请',
|
noCheckLoading:false,
|
checkLoading:false,
|
addDialogVisible: false,
|
addInfo:{},
|
componentData: {
|
entity: {
|
code: 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.state=='通过'
|
}
|
},
|
{
|
id: 'delete',
|
font: '删除',
|
type: 'text',
|
method: 'doDiy',
|
disabFun: (row, index) => {
|
return row.state=='通过'
|
}
|
},
|
{
|
id: 'handleCheck',
|
font: '审核',
|
type: 'text',
|
method: 'handleCheck',
|
disabFun: (row, index) => {
|
return row.checkUser!=JSON.parse(localStorage.getItem("user")).userId||row.state=='通过'
|
}
|
},
|
{
|
id: 'handleLook',
|
font: '查看附件',
|
type: 'text',
|
method: 'handleLook'
|
},
|
{
|
id: 'handleDown',
|
font: '下载附件',
|
type: 'text',
|
method: 'handleDown'
|
}],
|
tagField: {
|
state:{
|
select: [
|
{
|
value: '通过',
|
label: '通过'
|
},
|
{
|
value: '不通过',
|
label: '不通过'
|
},
|
]
|
},
|
},
|
selectField: {
|
state:{
|
select: []
|
},
|
signatory:{
|
select: []
|
},
|
},
|
datePicker:['effectiveDate'],
|
addUpload:['signatoryUrl'],
|
requiredAdd: [],
|
requiredUp: [],
|
needSort: [],
|
inputType: ''
|
},
|
entityCopy: {},
|
upIndex: 0,
|
addPower:false,
|
outPower:false,
|
outLoading:false,
|
personList:[],
|
fileList:[],
|
currentFile:{},
|
fileState:[],
|
file:null,
|
addLoading:false,
|
lookDialogVisible:false,
|
currentInfo:{
|
},
|
type:null,
|
fileName:null,
|
}
|
},
|
mounted() {
|
this.entityCopy = this.HaveJson(this.componentData.entity);
|
this.getPower()
|
this.getAuthorizedPerson()
|
this.getFileList()
|
this.selectEnumByCategory()
|
},
|
methods: {
|
getPower(){
|
let power = JSON.parse(sessionStorage.getItem('power'))
|
let up = false
|
let del = false
|
let add = false
|
let out = false
|
for (var i = 0; i < power.length; i++) {
|
if (power[i].menuMethod == 'addManageDocumentAlter') {
|
up = true
|
}
|
if (power[i].menuMethod == 'addManageDocumentAlter') {
|
add = true
|
}
|
if (power[i].menuMethod == 'delManageDocumentAlter') {
|
del = true
|
}
|
if (power[i].menuMethod == 'exportManageDocumentAlter') {
|
out = true
|
}
|
}
|
if (!del) {
|
this.componentData.do.splice(1, 1)
|
}
|
if (!up) {
|
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()
|
},
|
// 导出
|
handleOut(){
|
this.outLoading = true
|
this.$axios.post(this.$api.manageDocumentList.exportManageDocumentAlter, {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();
|
})
|
},
|
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.map(m=>{
|
m.title = m.documentCode +':'+m.name
|
return m
|
})
|
}).catch(err=>{})
|
},
|
// 当前文件
|
getCurrentFile(e){
|
this.currentFile = this.fileList.find(m=>m.documentCode==e)
|
},
|
selectEnumByCategory() {
|
this.$axios.post(this.$api.enums.selectEnumByCategory, {
|
category: "文件状态"
|
}).then(res => {
|
this.fileState = res.data
|
})
|
},
|
handleChangeUpload(file, fileLists){
|
this.file = file
|
this.$set(this.addInfo,'alterAfterName',file.name)
|
},
|
handleAdd(){
|
if(!this.addInfo.code) return this.$message({type:'error',message:"请输入申请编号"})
|
if(!this.addInfo.id){
|
// 新增
|
let fd = new FormData();
|
//文件信息中raw才是真的文件
|
if(this.file){
|
fd.append("file",this.file.raw);
|
}
|
for (let m in this.addInfo){
|
fd.append(m,this.addInfo[m])
|
}
|
let {name,version,documentCode} = this.currentFile;
|
fd.append("alterBeforeName",name);
|
fd.append("alterBeforeVersion",version);
|
// fd.append("alterBeforeCode",documentCode);
|
this.addLoading = true
|
this.$axios.post(this.$api.manageDocumentList.addManageDocumentAlter, fd,{
|
headers: {
|
'Content-Type': 'multipart/form-data'
|
},
|
noQs:true
|
}).then(res => {
|
this.addLoading = false
|
if (res.code == 200) {
|
this.$message({
|
type: 'success',
|
message: '添加成功'
|
})
|
this.refreshTable()
|
this.addDialogVisible = false
|
} else {
|
this.$message({
|
type: 'error',
|
message: '添加失败'
|
})
|
}
|
})
|
}else{
|
// 修改
|
let fd = new FormData();
|
//文件信息中raw才是真的文件
|
if(this.file){
|
fd.append("file",this.file.raw);
|
}
|
let {name,version} = this.currentFile;
|
fd.append("alterBeforeName",name);
|
fd.append("alterBeforeVersion",version);
|
let {code,checkUser,expectAlterDate,actuallyAlterDate,alterAfterCode,method,alterAfterVersion,alterNote,alterAfterName,id} = this.addInfo
|
fd.append("code",code);
|
fd.append("checkUser",checkUser);
|
fd.append("expectAlterDate",expectAlterDate);
|
fd.append("actuallyAlterDate",actuallyAlterDate);
|
fd.append("alterAfterCode",alterAfterCode);
|
fd.append("method",method);
|
fd.append("alterAfterVersion",alterAfterVersion);
|
fd.append("alterNote",alterNote);
|
fd.append("alterAfterName",alterAfterName);
|
fd.append("id",id);
|
this.addLoading = true
|
this.$axios.post(this.$api.manageDocumentList.doManageDocumentAlter, fd,{
|
headers: {
|
'Content-Type': 'multipart/form-data'
|
},
|
noQs:true
|
}).then(res => {
|
this.addLoading = false
|
if (res.code == 200) {
|
this.$message({
|
type: 'success',
|
message: '修改成功'
|
})
|
this.refreshTable()
|
this.addDialogVisible = false
|
} else {
|
this.$message({
|
type: 'error',
|
message: '修改失败'
|
})
|
}
|
})
|
}
|
},
|
// 编辑
|
handleUpdate(row){
|
this.title = '文件变更申请'
|
this.addInfo = this.HaveJson(row)
|
let alterBeforeCode = this.addInfo.alterBeforeCode
|
this.getCurrentFile(alterBeforeCode)
|
this.addDialogVisible = true
|
},
|
// 预览
|
handleLook(row){
|
this.currentInfo = this.HaveJson(row)
|
this.lookDialogVisible = true
|
},
|
// 下载附件
|
handleDown(row){
|
if(!row.alterAfterUrl) return this.$message.warning('文件未上传')
|
let url = this.javaApi+'/word/'+row.alterAfterUrl
|
const link = document.createElement('a');
|
link.href = url;
|
link.click();
|
},
|
// 打开审核弹框
|
handleCheck(row){
|
this.title = '审核'
|
this.fileName = row.alterAfterName
|
if(!row.alterAfterUrl) return this.$message.warning('文件未上传')
|
this.addInfo = this.HaveJson(row)
|
let alterBeforeCode = this.addInfo.alterBeforeCode
|
this.getCurrentFile(alterBeforeCode)
|
this.addDialogVisible = true
|
this.$axios.post(this.$api.manageDocumentList.checkManageDocumentAlterPdf,{id:row.id},{responseType: "blob"}).then(res=>{
|
//
|
const blob = new Blob([res]);
|
const file = new File([blob], row.name, { type: 'application/pdf' })
|
this.$refs.UpPdfStamp.lookFile(file)
|
this.currentInfo = row
|
}).catch(err=>{
|
console.log(err)
|
})
|
},
|
// 审核保存
|
async uploadPDF(pdfBlob){
|
const formData = new FormData();
|
formData.append('file', pdfBlob, this.fileName+'.pdf'); // 文件字段
|
formData.append('id', this.currentInfo.id); // 文件名字段
|
formData.append('state', this.type); // 文件名字段
|
|
let res = await this.$axios.post(this.$api.manageDocumentList.checkManageDocumentAlter, formData,{
|
headers: {
|
'Content-Type': 'multipart/form-data;'
|
},
|
noQs: true
|
})
|
this.checkLoading = false
|
this.noCheckLoading = false
|
if(res.code==200){
|
this.$message({ message: '操作成功', type: 'success' });
|
this.addDialogVisible = false;
|
this.refreshTable()
|
return true
|
}else{
|
this.$message({ message: '操作失败', type: 'error' });
|
return false
|
}
|
},
|
// 提交审核
|
handleCheckSub(type){
|
this.type = type
|
if(type == '通过') {
|
this.checkLoading = true
|
}else{
|
this.noCheckLoading = true
|
}
|
this.addLoading = true
|
this.$refs['UpPdfStamp'].generatePDF()
|
}
|
}
|
}
|
</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;
|
}
|
h4.title{
|
position: relative;
|
height: 30px;
|
line-height: 30px;
|
box-sizing: border-box;
|
padding-left: 16px;
|
margin-left: 10px;
|
margin-bottom: 10px;
|
}
|
h4.title::after{
|
content: '';
|
width: 4px;
|
height: 20px;
|
background: #3A7BFA;
|
position: absolute;
|
top: 5px;
|
left: 0;
|
}
|
</style>
|