<template>
|
<div>
|
<div class="search-background">
|
<span class="search-group">
|
<span style="width: 160px">评审地点:</span>
|
<el-input v-model="searchForm.judgingLocation" clearable size="small"></el-input>
|
<el-button size="medium" style="margin-left: 10px" @click="resetSearchForm">重 置</el-button>
|
<el-button size="medium" type="primary" @click="searchList">查 询</el-button>
|
</span>
|
<span class="search-group">
|
<el-button size="medium" type="primary" @click="openFormDia('add')">新 增</el-button>
|
</span>
|
</div>
|
<div class="table">
|
<ZTTable
|
:column="tableColumn"
|
:height="'calc(100vh - 20em)'"
|
:table-data="tableData"
|
:table-loading="tableLoading"
|
style="padding: 0 10px;margin-bottom: 16px">
|
</ZTTable>
|
<el-pagination :current-page="1" :page-size="page.size" :page-sizes="[10, 20, 30, 50, 100]"
|
:total="total" layout="->,total, sizes, prev, pager, next, jumper"
|
@size-change="handleSizeChange"
|
@current-change="handleCurrentChange">
|
</el-pagination>
|
</div>
|
<management-form-d-ia v-if="managementFormDIa" ref="managementFormDIa" @closeImplementDia="closeImplementDia"></management-form-d-ia>
|
<el-dialog :visible.sync="listDialogVisible" top="15vh"
|
title="文件查看"
|
width="400px">
|
<div style="max-height:60vh;overflow-y: auto;">
|
<p v-for="(item,index) in fileList" :key="index">
|
<span>{{ item.fileName }}</span>
|
<el-button size="small" type="text" icon="el-icon-view" @click="lookFile(item.url,item.fileName)" style="margin-left: 20px;">预览</el-button>
|
<el-button size="small" type="text" icon="el-icon-bottom" @click="handleDown0(item.url,item.fileName)" style="margin-left: 20px;">下载</el-button>
|
</p>
|
</div>
|
</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 ZTTable from '../../caorui/ZTTable/index.vue';
|
import ManagementFormDIa from './managementFormDIa.vue';
|
import filePreview from '../../tool/file-preview.vue'
|
|
export default {
|
name: 'managementReviewPlan',
|
// import 引入的组件需要注入到对象中才能使用
|
components: { ManagementFormDIa, ZTTable,filePreview },
|
data() {
|
// 这里存放数据
|
return {
|
searchForm: {
|
judgingLocation: '',
|
},
|
listDialogVisible:false,
|
lookDialogVisible:false,
|
fileList:[],
|
currentInfo:{},
|
tableColumn: [
|
{
|
label: '评审时间',
|
prop: 'reviewTime',
|
},
|
{
|
label: '评审地点',
|
prop: 'judgingLocation',
|
},
|
{
|
label: '评审目的',
|
prop: 'judgingPurpose',
|
},
|
{
|
label: '评审方式',
|
prop: 'judgingMethod',
|
},
|
{
|
label: '评审范围',
|
prop: 'judgingScope',
|
},
|
// {
|
// dataType: 'tag',
|
// label: '批准状态',
|
// prop: 'approve',
|
// minWidth: '100',
|
// formatData: (params) => {
|
// if (params === 0) {
|
// return '不通过';
|
// } else if (params === 1) {
|
// return '通过';
|
// } else {
|
// return null;
|
// }
|
// },
|
// formatType: (params) => {
|
// if (params === 0) {
|
// return 'danger';
|
// } else if (params === 1) {
|
// return 'success';
|
// } else {
|
// return null;
|
// }
|
// }
|
// },
|
{
|
dataType: 'action',
|
minWidth: '110',
|
label: '操作',
|
operation: [
|
{
|
name: '编辑',
|
type: 'text',
|
clickFun: (row) => {
|
this.openFormDia('edit', row);
|
},
|
disabled: (row) => {
|
return !!row.approve
|
},
|
},
|
{
|
name: '上传',
|
type: 'upload',
|
multiple:true,
|
limit:20,
|
accept:'.doc,.docx,.xls,.xlsx,.jpg,.jpeg,.png,.pdf',
|
clickFun: async (row,file, fileList) => {
|
const formData = new FormData();
|
formData.append('file',file.raw); // 文件字段
|
formData.append('id', row.id); // 文件名字段
|
let res = await this.$axios.post(this.$api.manageReviewProgram.addReviewProgramFile, formData,{
|
headers: {
|
'Content-Type': 'multipart/form-data;'
|
},
|
noQs: true
|
})
|
if(res.code==200){
|
this.$message({ message: '上传成功', type: 'success' });
|
// this.searchList()
|
return
|
}else{
|
this.$message({ message: '上传失败', type: 'error' });
|
return
|
}
|
},
|
disabled: (row) => {
|
return !!row.approve
|
},
|
},
|
{
|
name: '查看附件',
|
type: 'text',
|
clickFun: (row) => {
|
this.$axios.get(this.$api.manageReviewProgram.selectReviewProgramFile + '?id='+row.id).then(res => {
|
this.listDialogVisible = true;
|
this.fileList = res.data.fileList
|
});
|
},
|
},
|
{
|
name: '批准',
|
type: 'text',
|
clickFun: (row) => {
|
this.openFormDia('ratify', row);
|
},
|
disabled: (row) => {
|
return !!row.approve
|
},
|
},
|
{
|
name: '删除',
|
type: 'text',
|
color: '#f56c6c',
|
clickFun: (row) => {
|
this.delPlan(row)
|
},
|
disabled: (row) => {
|
if (row.qualityStatus === 1) {
|
return true
|
} else {
|
return false
|
}
|
},
|
},
|
{
|
name: '下载',
|
type: 'text',
|
clickFun: (row) => {
|
this.handleDown(row)
|
}
|
},
|
]
|
}
|
],
|
tableData: [],
|
tableLoading: false,
|
page: {
|
size: 20,
|
current: 1,
|
},
|
total: 0,
|
managementFormDIa: false,
|
};
|
},
|
mounted() {
|
this.searchList()
|
},
|
// 方法集合
|
methods: {
|
// 查询列表
|
searchList () {
|
this.tableLoading = true
|
this.$axios.get(this.$api.manageReviewProgram.getPageReviewProgram + '?judgingLocation=' + this.searchForm.judgingLocation + '&pages=' + this.page.current + '&size=' + this.page.size).then(res => {
|
this.tableLoading = false
|
if (res.code === 201) return
|
this.tableData = res.data.records
|
this.total = res.data.total
|
}).catch(err => {
|
console.log('err---', err);
|
this.tableLoading = false
|
})
|
},
|
// 新增,编辑,批准弹框
|
openFormDia (type, row) {
|
this. managementFormDIa = true
|
this.$nextTick(() => {
|
this.$refs. managementFormDIa.openDia(type, row)
|
})
|
},
|
closeImplementDia () {
|
this. managementFormDIa = false
|
this.searchList()
|
},
|
// 重置查询条件
|
resetSearchForm () {
|
this.searchForm.judgingLocation = '';
|
this.searchList()
|
},
|
// 删除
|
delPlan (row) {
|
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
this.tableLoading = true
|
this.$axios.delete(this.$api.manageReviewProgram.deleteReviewProgram + '?id=' + row.id).then(res => {
|
this.tableLoading = false
|
if (res.code === 201) return
|
this.$message.success('删除成功')
|
this.searchList()
|
}).catch(err => {
|
this.tableLoading = false
|
console.log('err---', err);
|
})
|
}).catch(() => {
|
this.$message({
|
type: 'info',
|
message: '已取消删除'
|
});
|
});
|
},
|
// 分页
|
handleSizeChange(val) {
|
this.page.size = val;
|
this.searchList();
|
},
|
handleCurrentChange(val) {
|
this.page.current = val;
|
this.searchList();
|
},
|
handleDown(row){
|
this.$axios.post(this.$api.manageReviewProgram.exportReviewProgram,{id:row.id},{responseType: "blob"}).then(res => {
|
if(res.code == 201){
|
this.$message.error(res.message)
|
return
|
}
|
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 = '评审计划.docx';
|
link.click();
|
})
|
},
|
lookFile(url,name){
|
this.currentInfo.url = url
|
this.currentInfo.name = name
|
this.lookDialogVisible = true
|
},
|
handleDown0(url,name){
|
if(!url) return this.$message.warning('文件未上传')
|
let url0 = this.javaApi+'/word/'+url
|
const link = document.createElement('a');
|
link.href = url0;
|
link.target = '_blank';
|
link.click();
|
}
|
}
|
};
|
</script>
|
|
<style scoped>
|
.search-background {
|
width: 100%;
|
height: 60px;
|
line-height: 60px;
|
display: flex;
|
justify-content: space-between;
|
}
|
.search-group {
|
display: flex;
|
align-items: center;
|
margin: 0 20px;
|
}
|
</style>
|