<template>
|
<!-- 文件作废申请 -->
|
<div class="file-obsoletion-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.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 class="btns" style="padding-left: 30px;">
|
<el-button size="small" type="primary" @click="addDialogVisible=true,addInfo={}" 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.pageManageDocumentCancel"
|
:componentData="componentData" :delUrl="$api.manageDocumentList.delManageDocumentCancel" :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-select v-model="addInfo.documentCode" size="small" style="width: 100%;" @change="changeFileList" 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;">
|
<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>
|
<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"></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-select v-model="addInfo.state" size="small" style="width: 100%;" >
|
<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;">
|
<div class="search_thing">
|
<div class="search_label">作废方式:</div>
|
<div class="search_input">
|
<el-select v-model="addInfo.method" size="small" style="width: 100%;">
|
<el-option label="作废" value="作废"></el-option>
|
<el-option label="无效" 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.expectCancelDate"
|
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-date-picker
|
v-model="addInfo.actuallyCancelDate"
|
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.cancelNote" 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>
|
</div>
|
</template>
|
|
<script>
|
import ValueTable from '../../tool/value-table.vue'
|
export default {
|
components: {
|
ValueTable
|
},
|
data() {
|
return {
|
addPower: false,
|
outPower:false,
|
addInfo: {},
|
addLoading:false,
|
addDialogVisible: false,
|
componentData: {
|
entity: {
|
documentCode: null,
|
state: 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=='通过'
|
}
|
},],
|
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:[],
|
outLoading:false,
|
fileState:[]
|
}
|
},
|
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 out = false
|
let del = false
|
let add = false
|
// let check = false
|
for (var i = 0; i < power.length; i++) {
|
if (power[i].menuMethod == 'exportManageDocumentCancel') {
|
out = true
|
}
|
if (power[i].menuMethod == 'addManageDocumentCancel') {
|
add = true
|
}
|
if (power[i].menuMethod == 'delManageDocumentCancel') {
|
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=>{})
|
},
|
// 提交
|
handleAdd(){
|
if(!this.addInfo.documentCode){
|
this.$message.error('请输入申请编号')
|
return false
|
}
|
this.addInfo.method = '作废'
|
this.addLoading = true
|
if(!this.addInfo.id){
|
// 新增
|
this.axios.post(this.$api.manageDocumentList.addManageDocumentCancel, this.addInfo,{headers: {
|
'Content-Type': 'application/json'
|
}}).then(res => {
|
this.addLoading = false
|
this.refreshTable()
|
this.$message({
|
type: 'success',
|
message: '提交成功'
|
})
|
this.addDialogVisible = false
|
}).catch(err => {})
|
}else{
|
// 编辑
|
this.axios.post(this.$api.manageDocumentList.doManageDocumentCancel, {
|
id: this.addInfo.id,
|
method: '作废',
|
documentCode: this.addInfo.documentCode,
|
checkUser: this.addInfo.checkUser,
|
name: this.addInfo.name,
|
version: this.addInfo.version,
|
documentState: this.addInfo.documentState,
|
expectCancelDate: this.addInfo.expectCancelDate,
|
actuallyCancelDate: this.addInfo.actuallyCancelDate,
|
cancelNote: this.addInfo.cancelNote,
|
},{headers: {
|
'Content-Type': 'application/json'
|
}}).then(res => {
|
this.addLoading = false
|
this.refreshTable()
|
this.$message({
|
type: 'success',
|
message: '提交成功'
|
})
|
this.addDialogVisible = false
|
}).catch(err => {})
|
}
|
|
},
|
// 选中文件
|
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.documentState = obj.state
|
}
|
},
|
handleUpdate(row){
|
this.addInfo = this.HaveJson(row)
|
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.checkManageDocumentCancel, {id:row.id,state:'通过'}).then(res => {
|
this.refreshTable()
|
done();
|
this.$message({
|
type: 'success',
|
message: '提交成功'
|
})
|
})
|
.catch(err => {
|
|
})
|
} else if (action === 'cancel') {
|
// 点击“取消”按钮,不允许关闭
|
this.$axios.post(this.$api.manageDocumentList.checkManageDocumentCancel, {id:row.id,state:'不通过'}).then(res => {
|
this.refreshTable()
|
done();
|
this.$message({
|
type: 'success',
|
message: '提交成功'
|
})
|
})
|
.catch(err => {
|
|
})
|
console.log("取消按钮点击事件,不关闭弹框");
|
} else if (action === 'close') {
|
// 点击“×”按钮,不允许关闭
|
done();
|
console.log("×按钮点击事件,不关闭弹框");
|
}
|
}
|
})
|
},
|
// 导出
|
handleOut(){
|
this.outLoading = true
|
this.$axios.post(this.$api.manageDocumentList.exportManageDocumentCancel, {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();
|
})
|
}
|
}
|
}
|
</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>
|