|
|
@ -181,6 +181,29 @@ |
|
|
|
prop="rectificationResponsibleUnit" |
|
|
|
min-width="120" |
|
|
|
/> |
|
|
|
<el-table-column |
|
|
|
label="文档附件" |
|
|
|
align="left" |
|
|
|
prop="hazardAttachment" |
|
|
|
min-width="180" |
|
|
|
> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<div |
|
|
|
v-for="(item, index) in JSON.parse( |
|
|
|
scope.row.hazardAttachment |
|
|
|
)" |
|
|
|
:key="item + index" |
|
|
|
> |
|
|
|
<i class="el-icon-document"></i> |
|
|
|
{{ item.name }} |
|
|
|
<i |
|
|
|
class="el-icon-download" |
|
|
|
@click="downloadFile1(scope, index)" |
|
|
|
style="cursor: pointer" |
|
|
|
></i> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column |
|
|
|
label="操作" |
|
|
|
align="right" |
|
|
@ -339,6 +362,43 @@ |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
<el-row :gutter="15" class="pad12"> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item |
|
|
|
label="照片" |
|
|
|
prop="acceptDocumentAttachment" |
|
|
|
> |
|
|
|
<!-- <el-input |
|
|
|
v-model="form.acceptDocumentAttachment" |
|
|
|
placeholder="请输入规划项目验收文档附件" |
|
|
|
/> --> |
|
|
|
<el-upload |
|
|
|
class="upload-demo" |
|
|
|
action="thinking/common/upload" |
|
|
|
accept="image/png, image/gif, image/jpeg, image/bmp" |
|
|
|
:headers="headers" |
|
|
|
:before-upload=" |
|
|
|
(file) => $fileBeforeUpload(file, 'acceptDocumentFileList') |
|
|
|
" |
|
|
|
:on-preview="handlePreview" |
|
|
|
:on-remove="handleRemove" |
|
|
|
:before-remove="beforeRemove" |
|
|
|
multiple |
|
|
|
:on-exceed="handleExceed" |
|
|
|
:on-success="submitAcceptDocumentUpload" |
|
|
|
:file-list="acceptDocumentFileList" |
|
|
|
> |
|
|
|
<el-button size="small" type="primary" plain> |
|
|
|
<i class="el-icon-upload el-icon--right"></i> |
|
|
|
点击上传 |
|
|
|
</el-button> |
|
|
|
<div slot="tip" class="el-upload__tip"> |
|
|
|
支持jpg/png文件等 |
|
|
|
</div> |
|
|
|
</el-upload> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
</el-form> |
|
|
|
</el-row> |
|
|
|
<div class="dialog-footer" slot="footer"> |
|
|
@ -439,6 +499,8 @@ export default { |
|
|
|
headers: { |
|
|
|
jianwei: "jwtech " + getToken(), |
|
|
|
}, |
|
|
|
// 专题项目文档附件 |
|
|
|
acceptDocumentFileList: [], |
|
|
|
// 是否字典 |
|
|
|
whetherOptions: [], |
|
|
|
}; |
|
|
@ -546,6 +608,12 @@ export default { |
|
|
|
this.reset(); |
|
|
|
const id = row.id || this.ids; |
|
|
|
getRecord(id).then((response) => { |
|
|
|
if (response.data.hazardAttachment) { |
|
|
|
this.acceptDocumentFileList = JSON.parse( |
|
|
|
response.data.hazardAttachment |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
this.form = response.data; |
|
|
|
}); |
|
|
|
this.open = true; |
|
|
@ -584,6 +652,7 @@ export default { |
|
|
|
hazardLevel: null, |
|
|
|
rectificationDeadline: null, |
|
|
|
rectificationResponsibleUnit: null, |
|
|
|
hazardAttachment: null |
|
|
|
}; |
|
|
|
this.resetForm("form"); |
|
|
|
}, |
|
|
@ -648,6 +717,10 @@ export default { |
|
|
|
if (valid) { |
|
|
|
this.form.proNo = this.proNo; |
|
|
|
this.form.proCode = this.proCode; |
|
|
|
// 合同附件 |
|
|
|
this.form.hazardAttachment = JSON.stringify( |
|
|
|
this.acceptDocumentFileList |
|
|
|
); |
|
|
|
|
|
|
|
console.log("this.formthis.form", this.form); |
|
|
|
if (this.form.id != null) { |
|
|
@ -691,6 +764,58 @@ export default { |
|
|
|
this.$message.warning("请选择要删除的数据!!"); |
|
|
|
} |
|
|
|
}, |
|
|
|
// 表格中下载 |
|
|
|
downloadFile1(scope, index) { |
|
|
|
// console.log(scope); |
|
|
|
let file = JSON.parse(scope.row.hazardAttachment)[index]; |
|
|
|
this.handlePreview(file); |
|
|
|
}, |
|
|
|
// 点击预览的文件进行下载 |
|
|
|
handlePreview(file) { |
|
|
|
// console.log(file); |
|
|
|
getFileStream({ fileName: file.fileName }).then((res) => { |
|
|
|
const blob = new Blob([res], { |
|
|
|
// type类型后端返回来的数据中会有,根据自己实际进行修改 |
|
|
|
// 表格下载为 application/xlsx,压缩包为 application/zip等, |
|
|
|
type: "application/xlsx", |
|
|
|
}); //excel,pdf等 |
|
|
|
const href = URL.createObjectURL(blob); //创建新的URL表示指定的blob对象 |
|
|
|
const a = document.createElement("a"); //创建a标签 |
|
|
|
a.style.display = "none"; |
|
|
|
a.href = href; // 指定下载链接 |
|
|
|
a.download = file.name; //指定下载文件名 |
|
|
|
a.click(); //触发下载 |
|
|
|
URL.revokeObjectURL(a.href); //释放URL对象 |
|
|
|
}); |
|
|
|
}, |
|
|
|
handleRemove(file, fileList) { |
|
|
|
// console.log(file, fileList); |
|
|
|
let index = this.acceptDocumentFileList.findIndex( |
|
|
|
(item) => item.uid === file.uid |
|
|
|
); |
|
|
|
// 删除文件 |
|
|
|
this.acceptDocumentFileList.splice(index, 1); |
|
|
|
}, |
|
|
|
beforeRemove(file, fileList) { |
|
|
|
return this.$confirm(`确定移除 ${file.name}?`); |
|
|
|
}, |
|
|
|
handleExceed(files, fileList) { |
|
|
|
this.$message.warning( |
|
|
|
`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${ |
|
|
|
files.length + fileList.length |
|
|
|
} 个文件` |
|
|
|
); |
|
|
|
}, |
|
|
|
// 上传附件 |
|
|
|
submitAcceptDocumentUpload(_, fileList) { |
|
|
|
console.log("fileList", fileList); |
|
|
|
this.acceptDocumentFileList.push({ |
|
|
|
name: fileList.name, |
|
|
|
fileName: fileList.response.fileName, |
|
|
|
url: fileList.response.url, |
|
|
|
uid: fileList.uid, |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
</script> |
|
|
|