|
|
@ -21,7 +21,7 @@ |
|
|
|
accept=".pdf" |
|
|
|
action="" |
|
|
|
> |
|
|
|
<el-button slot="trigger" size="middle" type="primary"> |
|
|
|
<el-button slot="trigger" type="primary"> |
|
|
|
上传文件 |
|
|
|
</el-button> |
|
|
|
</el-upload> |
|
|
@ -36,8 +36,10 @@ |
|
|
|
> |
|
|
|
<el-table-column slot="operation" align="center" width="200" label="操作"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-button type="text" @click="downLoad(scope.row)"> 预览 </el-button> |
|
|
|
<el-button type="text" @click="downLoadFn(scope.row)"> |
|
|
|
<el-button v-permission="['document-list:view']" type="text" @click="downLoad(scope.row)"> |
|
|
|
预览 |
|
|
|
</el-button> |
|
|
|
<el-button v-permission="['document-list:download']" type="text" @click="downLoadFn(scope.row)"> |
|
|
|
下载 |
|
|
|
</el-button> |
|
|
|
<el-button type="text" @click="checkHistory(scope.row)"> |
|
|
@ -86,179 +88,181 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import CRUD, { header, presenter } from "@/components/Crud/crud"; |
|
|
|
import Query from "@/components/Crud/Query"; |
|
|
|
import CustomTable from "@/components/Crud/Table"; |
|
|
|
import Pagination from "@/components/Crud/Pagination"; |
|
|
|
import CrudDocumentArchives from "@/api/document_archives"; |
|
|
|
import { uploadFileFn, updateInspectionSystemFile } from "@/api/common"; |
|
|
|
import { downloadFileUrl } from "@/utils"; |
|
|
|
import download from "downloadjs"; |
|
|
|
import preview from "@/utils/preview"; |
|
|
|
import CRUD, { header, presenter } from '@/components/Crud/crud' |
|
|
|
import Query from '@/components/Crud/Query' |
|
|
|
import CustomTable from '@/components/Crud/Table' |
|
|
|
import Pagination from '@/components/Crud/Pagination' |
|
|
|
import CrudDocumentArchives from '@/api/document_archives' |
|
|
|
import { uploadFileFn, updateInspectionSystemFile } from '@/api/common' |
|
|
|
import { downloadFileUrl } from '@/utils' |
|
|
|
import download from 'downloadjs' |
|
|
|
import preview from '@/utils/preview' |
|
|
|
|
|
|
|
// crud交由presenter持有 |
|
|
|
const defaultCrud = presenter( |
|
|
|
CRUD({ |
|
|
|
title: "检验机构体系文件管理", |
|
|
|
url: "/inspectionSystemFile/list", |
|
|
|
orderBy: ["id desc"], |
|
|
|
title: '检验机构体系文件管理', |
|
|
|
url: '/inspectionSystemFile/list', |
|
|
|
orderBy: ['id desc'], |
|
|
|
api: preview, |
|
|
|
crudMethod: { ...CrudDocumentArchives }, |
|
|
|
crudMethod: { ...CrudDocumentArchives } |
|
|
|
}) |
|
|
|
); |
|
|
|
) |
|
|
|
|
|
|
|
export default { |
|
|
|
name: "DocumentArchivesList", |
|
|
|
name: 'DocumentArchivesList', |
|
|
|
components: { Pagination, Query, CustomTable }, |
|
|
|
mixins: [defaultCrud, header()], |
|
|
|
data() { |
|
|
|
return { |
|
|
|
action: this.preview.baseURL + "/inspectionSystemFile", |
|
|
|
action: this.preview.baseURL + '/inspectionSystemFile', |
|
|
|
fileList: [], |
|
|
|
colConfigs: [ |
|
|
|
{ prop: "filename", label: "文件名", align: "center" }, |
|
|
|
{ prop: 'filename', label: '文件名', align: 'center' }, |
|
|
|
{ |
|
|
|
prop: "createBy", |
|
|
|
label: "创建人", |
|
|
|
align: "center", |
|
|
|
formatter: this.formatter.getChineseName, |
|
|
|
prop: 'createBy', |
|
|
|
label: '创建人', |
|
|
|
align: 'center', |
|
|
|
formatter: this.formatter.getChineseName |
|
|
|
}, |
|
|
|
{ prop: "createTime", label: "创建时间", align: "center" }, |
|
|
|
{ prop: 'createTime', label: '创建时间', align: 'center' }, |
|
|
|
{ |
|
|
|
prop: "updateBy", |
|
|
|
label: "更新人", |
|
|
|
align: "center", |
|
|
|
formatter: this.formatter.getChineseName, |
|
|
|
prop: 'updateBy', |
|
|
|
label: '更新人', |
|
|
|
align: 'center', |
|
|
|
formatter: this.formatter.getChineseName |
|
|
|
}, |
|
|
|
{ |
|
|
|
prop: "updateTime", |
|
|
|
label: "更新时间", |
|
|
|
align: "center", |
|
|
|
formatter: this.formatter.formatterDepartmentName, |
|
|
|
prop: 'updateTime', |
|
|
|
label: '更新时间', |
|
|
|
align: 'center', |
|
|
|
formatter: this.formatter.formatterDepartmentName |
|
|
|
}, |
|
|
|
{ slot: "operation" }, |
|
|
|
{ slot: 'operation' } |
|
|
|
], |
|
|
|
permission: { |
|
|
|
add: ["documentArchives:add"], |
|
|
|
edit: ["documentArchives:update"], |
|
|
|
del: ["documentArchives:delete"], |
|
|
|
add: ['documentArchives:add'], |
|
|
|
edit: ['documentArchives:update'], |
|
|
|
del: ['documentArchives:delete'] |
|
|
|
}, |
|
|
|
dialogTableVisible: false, |
|
|
|
params: { |
|
|
|
inspectionSystemFileId: "", |
|
|
|
inspectionSystemFileId: '', |
|
|
|
pageNum: 1, |
|
|
|
pageSize: 10, |
|
|
|
pageSize: 10 |
|
|
|
}, |
|
|
|
gridData: [], |
|
|
|
subTotal: 0, |
|
|
|
url: |
|
|
|
process.env.VUE_APP_PREVIEW_API + |
|
|
|
process.env.VUE_APP_PROJECT_NAME + |
|
|
|
"/inspectionSystemFile", |
|
|
|
}; |
|
|
|
'/inspectionSystemFile' |
|
|
|
} |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
console.log(this.$store.getters.permissions) |
|
|
|
}, |
|
|
|
mounted() {}, |
|
|
|
methods: { |
|
|
|
handleRemove(file, fileList) { |
|
|
|
console.log(file, fileList); |
|
|
|
console.log(file, fileList) |
|
|
|
}, |
|
|
|
handlePreview(file) { |
|
|
|
console.log(file); |
|
|
|
console.log(file) |
|
|
|
}, |
|
|
|
checkHistory(row) { |
|
|
|
this.dialogTableVisible = true; |
|
|
|
this.params.inspectionSystemFileId = row.id; |
|
|
|
this.getSubList(); |
|
|
|
this.dialogTableVisible = true |
|
|
|
this.params.inspectionSystemFileId = row.id |
|
|
|
this.getSubList() |
|
|
|
}, |
|
|
|
getSubList() { |
|
|
|
this.preview({ |
|
|
|
url: "/inspectionSystemFileLog/list", |
|
|
|
method: "get", |
|
|
|
params: this.params, |
|
|
|
url: '/inspectionSystemFileLog/list', |
|
|
|
method: 'get', |
|
|
|
params: this.params |
|
|
|
}).then((res) => { |
|
|
|
this.gridData = res.list; |
|
|
|
this.subTotal = res.total; |
|
|
|
}); |
|
|
|
this.gridData = res.list |
|
|
|
this.subTotal = res.total |
|
|
|
}) |
|
|
|
}, |
|
|
|
handleCurrentChange(val) { |
|
|
|
this.params.pageNum = val; |
|
|
|
this.getSubList(); |
|
|
|
this.params.pageNum = val |
|
|
|
this.getSubList() |
|
|
|
}, |
|
|
|
handleExceed(files, fileList) { |
|
|
|
this.$message.warning( |
|
|
|
`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${ |
|
|
|
files.length + fileList.length |
|
|
|
} 个文件` |
|
|
|
); |
|
|
|
) |
|
|
|
}, |
|
|
|
// EXCEL上传方法 |
|
|
|
beforeUpload(file) { |
|
|
|
if (this.$refs.customTable.$refs.table.selection.length > 1) { |
|
|
|
this.$notify.warning("请选择单份体系文件进行更新上传!"); |
|
|
|
return false; |
|
|
|
this.$notify.warning('请选择单份体系文件进行更新上传!') |
|
|
|
return false |
|
|
|
} |
|
|
|
const fd = new FormData(); |
|
|
|
fd.append("file", file); |
|
|
|
const fd = new FormData() |
|
|
|
fd.append('file', file) |
|
|
|
if (this.$refs.customTable.$refs.table.selection.length) { |
|
|
|
fd.append("id", this.$refs.customTable.$refs.table.selection[0].id); |
|
|
|
fd.append('id', this.$refs.customTable.$refs.table.selection[0].id) |
|
|
|
updateInspectionSystemFile(fd).then(() => { |
|
|
|
this.$notify.success("体系更新成功。"); |
|
|
|
this.crud.toQuery(); |
|
|
|
}); |
|
|
|
this.$notify.success('体系更新成功。') |
|
|
|
this.crud.toQuery() |
|
|
|
}) |
|
|
|
} else { |
|
|
|
uploadFileFn(fd).then(() => { |
|
|
|
this.$notify.success("体系上传成功。"); |
|
|
|
this.crud.toQuery(); |
|
|
|
}); |
|
|
|
this.$notify.success('体系上传成功。') |
|
|
|
this.crud.toQuery() |
|
|
|
}) |
|
|
|
} |
|
|
|
return false; |
|
|
|
return false |
|
|
|
}, |
|
|
|
downLoad(item) { |
|
|
|
const data = this.url + "/" + item.id + item.suffix; |
|
|
|
const data = this.url + '/' + item.id + item.suffix |
|
|
|
this.$router.push({ |
|
|
|
path: |
|
|
|
"/preview/document?src=" + |
|
|
|
'/preview/document?src=' + |
|
|
|
this.$store.getters.prodName + |
|
|
|
"/static/web/viewer.html?file=" + |
|
|
|
encodeURIComponent(data), |
|
|
|
}); |
|
|
|
'/static/web/viewer.html?file=' + |
|
|
|
encodeURIComponent(data) |
|
|
|
}) |
|
|
|
}, |
|
|
|
viewHistoryFile(item) { |
|
|
|
downloadFileUrl( |
|
|
|
this.url + |
|
|
|
"/" + |
|
|
|
'/' + |
|
|
|
item.inspectionSystemFileId + |
|
|
|
"_" + |
|
|
|
'_' + |
|
|
|
item.id + |
|
|
|
item.suffix, |
|
|
|
item.filename, |
|
|
|
item.suffix |
|
|
|
); |
|
|
|
) |
|
|
|
}, |
|
|
|
downLoadFn(item) { |
|
|
|
const data = this.url + "/" + item.id + item.suffix; |
|
|
|
download(data, item.filename); |
|
|
|
const data = this.url + '/' + item.id + item.suffix |
|
|
|
download(data, item.filename) |
|
|
|
}, |
|
|
|
beforeRemove(file, fileList) { |
|
|
|
return this.$confirm(`确定移除 ${file.name}?`); |
|
|
|
return this.$confirm(`确定移除 ${file.name}?`) |
|
|
|
}, |
|
|
|
closeReportDialog() { |
|
|
|
this.$refs["reportForm"].resetFields(); |
|
|
|
this.$refs['reportForm'].resetFields() |
|
|
|
}, |
|
|
|
formatterFlowName(row, column, cellValue) { |
|
|
|
switch (cellValue) { |
|
|
|
case 0: |
|
|
|
return "保存"; |
|
|
|
return '保存' |
|
|
|
case 1: |
|
|
|
return "更新"; |
|
|
|
return '更新' |
|
|
|
case 2: |
|
|
|
return "删除"; |
|
|
|
return '删除' |
|
|
|
default: |
|
|
|
break; |
|
|
|
break |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
<style scoped> |
|
|
|
.searchBox { |
|
|
|