<template>
|
<!-- 文件受控记录 -->
|
<div class="controlled-file-application" 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.createUserName"
|
@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;" v-if="addPower">
|
<el-button size="small" type="primary" @click="addDialogVisible=true,addInfo={},file=null">文件受控申请</el-button>
|
</div>
|
</div>
|
<div class="table">
|
<ValueTable ref="ValueTable" :url="$api.manageDocumentList.pageManageDocumentControlled"
|
:componentData="componentData" :delUrl="$api.manageDocumentList.delManageDocumentControlled" :key="upIndex"/>
|
</div>
|
<el-dialog
|
title="文件受控申请"
|
: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-input size="small" placeholder="请输入" clearable v-model="addInfo.documentCode"></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.dutyUser" 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">文件类别:</div>
|
<div class="search_input">
|
<el-select v-model="addInfo.type" 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="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"></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"></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-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>
|
<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.writer"></el-input> -->
|
<el-select v-model="addInfo.writer" size="small" style="width: 100%;" filterable>
|
<el-option
|
v-for="item in personList"
|
:key="item.value"
|
:label="item.label"
|
:value="item.label">
|
</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.submitDate"
|
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;">
|
<div class="search_thing">
|
<div class="search_label">说明:</div>
|
<div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="addInfo.instructions" type="textarea"
|
:rows="2"></el-input></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>
|
<el-dialog
|
title="审核"
|
:visible.sync="checkDialogVisible"
|
width="1000px" top="5vh">
|
<UpPdfStamp ref="UpPdfStamp" v-if="checkDialogVisible" @uploadPDF="uploadPDF" :isUpFile="false" style="max-height: 80vh;overflow-y: auto;"></UpPdfStamp>
|
<span slot="footer" class="dialog-footer">
|
<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="checkStampDialogVisible"
|
width="600px" top="5vh">
|
<div class="stamp-list">
|
<img :src="'../../../../static/img/stamps/'+item+'.png'" alt="" v-for="(item,index) in stampsList" :key="index" style="width: 120px;height: 80px;margin: 6px;" class="stamp" :class="{active:currentStamp==item}" @click="currentStamp=item">
|
</div>
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="checkStampDialogVisible=false" >取 消</el-button>
|
<el-button type="primary" @click="handleCheck0(currentInfo)">确 定</el-button>
|
</span>
|
</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 {
|
upLoading: false,
|
addPower:false,
|
addDialogVisible:false,
|
addLoading:false,
|
lookDialogVisible:false,
|
checkDialogVisible:false,
|
checkStampDialogVisible:false,
|
componentData: {
|
entity: {
|
documentCode: null,
|
// createUserName: 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.dutyUserName&&!row.dutyUserName.includes(JSON.parse(localStorage.getItem("user")).name))||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,
|
addInfo:{},
|
personList:[],
|
fileType:[],
|
file:null,
|
currentInfo:{},
|
checkLoading:false,
|
noCheckLoading:false,
|
type:'',
|
stampsList:['主任','质量负责人','技术负责人','综合室','通信','电力','装备','储能','射频'],
|
currentStamp:'主任'
|
}
|
},
|
mounted() {
|
this.entityCopy = this.HaveJson(this.componentData.entity);
|
this.getPower()
|
this.getAuthorizedPerson()
|
this.selectEnumByCategory()
|
},
|
methods: {
|
getPower(){
|
let power = JSON.parse(sessionStorage.getItem('power'))
|
let up = false
|
let del = false
|
let add = false
|
// let check = false
|
for (var i = 0; i < power.length; i++) {
|
if (power[i].menuMethod == 'addManageDocumentControlled') {
|
up = true
|
}
|
if (power[i].menuMethod == 'addManageDocumentControlled') {
|
add = true
|
}
|
if (power[i].menuMethod == 'delManageDocumentControlled') {
|
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 (!up) {
|
this.componentData.do.splice(0, 1)
|
}
|
this.addPower = add
|
},
|
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.personList = data
|
})
|
},
|
selectEnumByCategory() {
|
this.$axios.post(this.$api.enums.selectEnumByCategory, {
|
category: "文件类别"
|
}).then(res => {
|
this.fileType = res.data
|
})
|
},
|
// 提交
|
handleAdd(){
|
if(!this.addInfo.documentCode) 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])
|
}
|
this.addLoading = true
|
this.$axios.post(this.$api.manageDocumentList.addManageDocumentControlled, 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 {id,documentCode,dutyUser,type,name,version,writer,submitDate,instructions} = this.addInfo
|
let fd = new FormData();
|
//文件信息中raw才是真的文件
|
if(this.file){
|
fd.append("file",this.file.raw);
|
}
|
fd.append("id",id);
|
fd.append("documentCode",documentCode);
|
fd.append("dutyUser",dutyUser);
|
fd.append("type",type);
|
fd.append("name",name);
|
fd.append("version",version);
|
fd.append("writer",writer);
|
fd.append("submitDate",submitDate);
|
fd.append("instructions",instructions);
|
this.addLoading = true
|
this.$axios.post(this.$api.manageDocumentList.doManageDocumentControlled, fd,{
|
headers: {
|
'Content-Type': 'multipart/form-data'
|
},
|
noQs:true
|
}).then(res => {
|
this.addLoading = false
|
if (res.code == 200) {
|
this.refreshTable()
|
this.addDialogVisible = false
|
} else {
|
this.$message({
|
type: 'error',
|
message: '添加失败'
|
})
|
}
|
})
|
}
|
},
|
handleChangeUpload(file, fileLists){
|
this.file = file
|
this.$set(this.addInfo,'name',file.name)
|
},
|
// 编辑
|
handleUpdate(row){
|
this.title='文件变更申请'
|
this.addInfo = this.HaveJson(row)
|
this.addDialogVisible = true
|
},
|
// 查看附件
|
handleLook(row){
|
this.currentInfo = row
|
this.lookDialogVisible = true
|
},
|
// 审核
|
handleCheck(row){
|
this.title='审核'
|
this.currentInfo = row
|
if(!row.url) return this.$message.warning('文件未上传')
|
this.checkStampDialogVisible=true
|
},
|
handleCheck0(row){
|
this.checkStampDialogVisible=false
|
this.checkDialogVisible = true
|
this.$axios.post(this.$api.manageDocumentList.checkManageDocumentControlledPdf,{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.currentStamp)
|
}).catch(err=>{
|
console.log(err)
|
})
|
},
|
handleDown(row){
|
if(!row.url) return this.$message.warning('文件未上传')
|
let url = this.javaApi+'/word/'+row.url
|
const link = document.createElement('a');
|
link.href = url;
|
link.click();
|
},
|
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); // 文件名字段
|
formData.append('writer', this.currentInfo.writer); // 文件名字段
|
|
let res = await this.$axios.post(this.$api.manageDocumentList.checkManageDocumentControlled, 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.checkDialogVisible = 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;
|
}
|
.stamp{
|
cursor: pointer;
|
border: #fff 1px solid;
|
}
|
.stamp:hover{
|
border: #3A7BFA 1px solid;
|
box-shadow: inset 0px 0px 15px #3A7BFA;
|
}
|
.stamp.active{
|
border: #3A7BFA 1px solid;
|
box-shadow: inset 0px 0px 15px #3A7BFA;
|
}
|
</style>
|