<template>
|
<!-- 外来文件确认记录 -->
|
<div class="ExternalDocumentConfirmationRecords">
|
<el-row class="title">
|
<el-col :span="20" style="padding-left: 20px;text-align: left;">外来文件确认记录</el-col>
|
</el-row>
|
<el-tabs type="border-card" v-model="activeName" style="height: 100%;">
|
<el-tab-pane label="填写" name="填写" style="height: 100%;">
|
<div style="display: flex;align-items: center;justify-content: flex-end;margin-right: 20px;">
|
<el-button size="small" type="primary" @click="handleAdd0" style="margin-left: 20px;"
|
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 size="small" type="primary" :loading="upLoading">导入</el-button></el-upload>
|
</div>
|
<div class="table" style="height: calc(100% - 200px)">
|
<ValueTable ref="ValueTable0" :url="$api.manageRecordTotal.pageManageRecordVerify"
|
:componentData="componentData0" :key="upIndex0" :delUrl="$api.manageRecordTotal.delManageRecordVerify"
|
:upUrl="$api.manageRecordTotal.doManageRecordVerify" />
|
</div>
|
</el-tab-pane>
|
<el-tab-pane label="历史记录" name="历史记录" style="height: 100%;">
|
<div class="search">
|
<div class="search_thing">
|
<div class="search_label">年:</div>
|
<div class="search_input">
|
<el-date-picker v-model="componentData.entity.year" type="year" placeholder="选择年" format="yyyy"
|
value-format="yyyy" size="small" @change="refreshTable()">
|
</el-date-picker>
|
</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.manageRecordTotal.pageManageRecordTotal"
|
:componentData="componentData" :key="upIndex" />
|
</div>
|
</el-tab-pane>
|
</el-tabs>
|
<!-- 详情/下载/审核 -->
|
<el-dialog :title="title0" :visible.sync="lookDialogVisible" width="800px" :class="{ downPdf: title0 == '下载' }"
|
:modal="title0 != '下载'" top="5vh">
|
<filePreview v-if="lookDialogVisible" :fileUrl="javaApi + '/word/' + currentInfo.url" :currentFile="{}"
|
style="max-height: 70vh;overflow-y: auto;" />
|
<span slot="footer" class="dialog-footer" v-if="title0 == '审核' || title0 == '批准'">
|
<el-button @click="submitCheck('不通过')" :loading="noCheckLoading">不通过</el-button>
|
<el-button type="primary" @click="submitCheck('通过')" :loading="checkLoading">通 过</el-button>
|
</span>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import filePreview from '@/components/Preview/filePreview.vue'
|
import ValueTable from '@/components/Table/value-table.vue'
|
import { getToken } from "@/utils/auth";
|
export default {
|
components: {
|
ValueTable,
|
filePreview,
|
},
|
data() {
|
return {
|
title0: '查看',
|
activeName: '填写',
|
lookDialogVisible: false,
|
noCheckLoading: false,
|
checkLoading: false,
|
componentData: {
|
entity: {
|
year: null,
|
orderBy: {
|
field: 'id',
|
order: 'desc'
|
}
|
},
|
isIndex: true,
|
showSelect: false,
|
select: false,
|
do: [{
|
id: 'handleLook',
|
font: '查看',
|
type: 'text',
|
method: 'handleLook',
|
disabFun: (row, index) => {
|
return !row.url
|
}
|
}, {
|
id: 'handleDown0',
|
font: '下载',
|
type: 'text',
|
method: 'handleDown0',
|
disabFun: (row, index) => {
|
return !row.url
|
}
|
},
|
{
|
id: 'handleSubmit',
|
font: '提交',
|
type: 'text',
|
method: 'handleSubmit',
|
disabFun: (row, index) => {
|
return !!row.submitUserName
|
}
|
}, {
|
id: 'handleApproval',
|
font: '批准',
|
type: 'text',
|
method: 'handleApproval',
|
disabFun: (row, index) => {
|
return !row.submitUserName || !!row.ratifyUserName
|
}
|
}],
|
tagField: {},
|
selectField: {},
|
requiredAdd: [],
|
requiredUp: [],
|
needSort: [],
|
inputType: ''
|
},
|
// 样品列表
|
componentData0: {
|
entity: {
|
manageRecordTotalId: null,
|
orderBy: {
|
field: 'id',
|
order: 'desc'
|
}
|
},
|
isIndex: true,
|
showSelect: false,
|
select: false,
|
do: [{
|
id: 'update',
|
font: '修改',
|
type: 'text',
|
method: 'doDiy'
|
}, {
|
id: 'delete',
|
font: '删除',
|
type: 'text',
|
method: 'doDiy'
|
}],
|
tagField: {},
|
selectField: {},
|
requiredAdd: ['documentName', 'documentCode'],
|
requiredUp: ['documentName', 'documentCode'],
|
datePicker: ['effectiveDate', 'cancelDate'],
|
needSort: [],
|
inputType: ''
|
},
|
upIndex0: 100,
|
entityCopy: {},
|
upIndex: 0,
|
addPower: true,
|
upPower: true,
|
currentInfo: {},
|
upLoading: false,
|
}
|
},
|
// 用于上传文件的信息
|
computed: {
|
headers() {
|
return {
|
'Authorization': "Bearer " + getToken()
|
}
|
},
|
action() {
|
return this.javaApi + this.$api.manageRecordTotal.exportManageRecordVerify
|
}
|
},
|
mounted() {
|
this.entityCopy = this.HaveJson(this.componentData.entity);
|
this.getPower()
|
},
|
methods: {
|
getPower() {
|
let power = JSON.parse(sessionStorage.getItem('power'))
|
let add = false
|
let del = false
|
let up = false;
|
let sub = false
|
let ratify = false
|
for (var i = 0; i < power.length; i++) {
|
if (power[i].menuMethod == 'addManageRecordVerify') {
|
add = true
|
}
|
if (power[i].menuMethod == 'delManageRecordVerify') {
|
del = true
|
}
|
if (power[i].menuMethod == 'exportManageRecordVerify') {
|
up = true
|
}
|
if (power[i].menuMethod == 'submitManageRecordTotal') {
|
sub = true
|
}
|
if (power[i].menuMethod == 'ratifyManageRecordTotal') {
|
ratify = true
|
}
|
}
|
if (!ratify) {
|
this.componentData.do.splice(3, 1)
|
}
|
if (!sub) {
|
this.componentData.do.splice(2, 1)
|
}
|
if (!del) {
|
this.componentData0.do.splice(1, 1)
|
}
|
if (!add) {
|
this.componentData0.do.splice(0, 1)
|
}
|
this.addPower = add
|
this.upPower = up
|
},
|
handleAdd0() {
|
this.$refs.ValueTable0.openAddDia(this.$api.manageRecordTotal.addManageRecordVerify);
|
},
|
refreshTable() {
|
this.refreshTable()()
|
},
|
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.$refs['ValueTable0'].selectList()
|
} else {
|
this.$message.error('上传失败');
|
}
|
},
|
refresh() {
|
this.componentData.entity = this.HaveJson(this.entityCopy)
|
this.upIndex++
|
this.refreshTable()
|
},
|
submitCheck(type) { },
|
// 查看
|
handleLook(row) {
|
this.title0 = '查看'
|
this.commonFun(row)
|
},
|
// 公用方法
|
commonFun(row, callbanck) {
|
this.currentInfo = row
|
this.componentData0.entity.manageRecordTotalId = row.id
|
this.$axios.post(this.$api.manageRecordTotal.pageManageRecordVerify, {
|
entity: this.componentData0.entity,
|
page: {
|
current: -1,
|
size: -1
|
}
|
}, {
|
headers: {
|
'Content-Type': 'application/json'
|
}, noQs: true
|
}).then(res => {
|
this.currentInfo.arr = res.data.body.records
|
this.lookDialogVisible = true
|
if (callbanck) {
|
callbanck()
|
}
|
}).catch(err => { });
|
},
|
handleDown0(row) {
|
let url = this.javaApi + 'word/' + row.url
|
const link = document.createElement('a');
|
link.href = url;
|
link.download = row.month + ' 外来文件确认记录';
|
link.click();
|
},
|
// 提交
|
handleSubmit(row) {
|
this.$confirm('是否提交 ' + row.year + ' 年的数据', '提交', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
this.$axios.post(this.$api.manageRecordTotal.submitManageRecordTotal, {
|
id: row.id
|
}).then(res => {
|
this.$message({
|
type: 'success',
|
message: '提交成功!'
|
});
|
this.refreshTable()()
|
}).catch(err => { });
|
})
|
},
|
// 批准
|
handleApproval(row) {
|
this.title0 = '批准'
|
this.commonFun(row)
|
},
|
// 提交审核/批准
|
submitCheck(state) {
|
if (state == '通过') {
|
this.checkLoading = true
|
} else {
|
this.noCheckLoading = true
|
}
|
this.$axios.post(this.$api.manageRecordTotal.ratifyManageRecordTotal, {
|
id: this.currentInfo.id,
|
ratifyState: state
|
}).then(res => {
|
this.checkLoading = false
|
this.noCheckLoading = false
|
if (res.code === 201) return
|
this.$message({
|
type: 'success',
|
message: '操作成功!'
|
});
|
this.refreshTable()()
|
this.lookDialogVisible = false
|
}).catch(err => { });
|
},
|
}
|
}
|
</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 - 140px);
|
padding: 20px;
|
}
|
|
>>>.el-tabs__content {
|
height: 100%;
|
}
|
</style>
|