|
|
@ -55,9 +55,10 @@ |
|
|
<el-upload class="upload-demo" :action="uploadFileUrl" :on-preview="handlePreview" |
|
|
<el-upload class="upload-demo" :action="uploadFileUrl" :on-preview="handlePreview" |
|
|
:headers="headers" |
|
|
:headers="headers" |
|
|
:on-remove="handleRemove" :before-remove="beforeRemove" multiple :limit="10" |
|
|
:on-remove="handleRemove" :before-remove="beforeRemove" multiple :limit="10" |
|
|
|
|
|
:on-success="handleSuccess" |
|
|
:on-exceed="handleExceed" :file-list="fileList"> |
|
|
:on-exceed="handleExceed" :file-list="fileList"> |
|
|
<el-button size="small" type="primary">点击上传</el-button> |
|
|
<el-button size="small" type="primary">点击上传</el-button> |
|
|
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div> |
|
|
|
|
|
|
|
|
<div slot="tip" class="el-upload__tip">支持扩展名:.rar .zip .doc .docx .pdf .jpg</div> |
|
|
</el-upload> |
|
|
</el-upload> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
@ -213,12 +214,6 @@ export default { |
|
|
watch: { |
|
|
watch: { |
|
|
value(newVal) { |
|
|
value(newVal) { |
|
|
this.inputValue = newVal; |
|
|
this.inputValue = newVal; |
|
|
// 当type为clickable时,值变化时调用保存记录方法 |
|
|
|
|
|
// if (this.item.type === 'clickable') { |
|
|
|
|
|
// this.$nextTick(() => { |
|
|
|
|
|
// this.onCommonHandleSaveRecord(newVal); |
|
|
|
|
|
// }); |
|
|
|
|
|
// } |
|
|
|
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
filters: { |
|
|
filters: { |
|
|
@ -226,6 +221,13 @@ export default { |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
mounted() { |
|
|
mounted() { |
|
|
|
|
|
if(this.item.type === 'attachment'){ |
|
|
|
|
|
try{ |
|
|
|
|
|
this.fileList = JSON.parse(this.value); |
|
|
|
|
|
}catch(e){ |
|
|
|
|
|
this.fileList = []; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
EventBus.$on('onExternalFieldUpdate', this.handleExternalFieldUpdate); |
|
|
EventBus.$on('onExternalFieldUpdate', this.handleExternalFieldUpdate); |
|
|
EventBus.$on('onEditSignCancel', this.handleEditSignCancel); |
|
|
EventBus.$on('onEditSignCancel', this.handleEditSignCancel); |
|
|
EventBus.$on('onEditSignCallback', this.handleEditSignCallback); |
|
|
EventBus.$on('onEditSignCallback', this.handleEditSignCallback); |
|
|
@ -245,11 +247,65 @@ export default { |
|
|
EventBus.$off("onMixReagentSubmit", this.onMixReagentSubmit) |
|
|
EventBus.$off("onMixReagentSubmit", this.onMixReagentSubmit) |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
|
|
|
handleSuccess(res, file, fileList) { |
|
|
|
|
|
if(res.code == 200){ |
|
|
|
|
|
this.fileList = fileList; |
|
|
|
|
|
// 更新inputValue为文件路径列表,方便后续保存 |
|
|
|
|
|
this.inputValue = JSON.stringify(this.getFileList(fileList)); |
|
|
|
|
|
this.$emit("change",this.inputValue) |
|
|
|
|
|
this.onCommonHandleSaveRecord(); |
|
|
|
|
|
this.$message.success('文件上传成功'); |
|
|
|
|
|
} else { |
|
|
|
|
|
this.$message.error(res.message || '文件上传失败'); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
getFileList(fileList) { |
|
|
|
|
|
const list = []; |
|
|
|
|
|
fileList.forEach(item => { |
|
|
|
|
|
const o = {name:item.name}; |
|
|
|
|
|
if(item.url){//回填的数据 |
|
|
|
|
|
o.url = item.url |
|
|
|
|
|
}else{//新上传的 |
|
|
|
|
|
o.url = item.response.data.url |
|
|
|
|
|
} |
|
|
|
|
|
list.push(o) |
|
|
|
|
|
}) |
|
|
|
|
|
return list; |
|
|
|
|
|
}, |
|
|
handleRemove(file, fileList) { |
|
|
handleRemove(file, fileList) { |
|
|
console.log(file, fileList); |
|
|
|
|
|
|
|
|
// 从列表中移除文件 |
|
|
|
|
|
const index = fileList.indexOf(file); |
|
|
|
|
|
if (index > -1) { |
|
|
|
|
|
fileList.splice(index, 1); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 更新inputValue为剩余文件路径列表 |
|
|
|
|
|
this.inputValue = JSON.stringify(this.getFileList(fileList)); |
|
|
|
|
|
this.$emit("change",this.inputValue) |
|
|
|
|
|
|
|
|
|
|
|
// 触发保存记录 |
|
|
|
|
|
this.onCommonHandleSaveRecord(); |
|
|
|
|
|
|
|
|
|
|
|
this.$message.info(`文件 ${file.name} 已移除`); |
|
|
}, |
|
|
}, |
|
|
handlePreview(file) { |
|
|
handlePreview(file) { |
|
|
console.log(file); |
|
|
|
|
|
|
|
|
// 预览文件,如果是图片则直接打开,否则下载 |
|
|
|
|
|
if (file.url) { |
|
|
|
|
|
const fileType = file.type || file.name.split('.').pop().toLowerCase(); |
|
|
|
|
|
const imageTypes = ['jpg', 'jpeg', 'png', 'gif', 'bmp']; |
|
|
|
|
|
|
|
|
|
|
|
if (imageTypes.includes(fileType)) { |
|
|
|
|
|
// 图片类型,新建窗口预览 |
|
|
|
|
|
window.open(process.env.VUE_APP_FILE_DOMAIN + file.url, '_blank'); |
|
|
|
|
|
} else { |
|
|
|
|
|
// 非图片类型,下载文件 |
|
|
|
|
|
const link = document.createElement('a'); |
|
|
|
|
|
link.href = file.url; |
|
|
|
|
|
link.download = file.name; |
|
|
|
|
|
link.target = '_blank'; |
|
|
|
|
|
link.click(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
handleExceed(files, fileList) { |
|
|
handleExceed(files, fileList) { |
|
|
this.$message.warning(`当前限制选择 10 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`); |
|
|
this.$message.warning(`当前限制选择 10 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`); |
|
|
@ -262,7 +318,7 @@ export default { |
|
|
if (data.uuid !== this.uuid) return; |
|
|
if (data.uuid !== this.uuid) return; |
|
|
this.inputValue = data.selectedId; |
|
|
this.inputValue = data.selectedId; |
|
|
this.selectRegentInfo = data; |
|
|
this.selectRegentInfo = data; |
|
|
this.onCommonHandleSaveRecord(); |
|
|
|
|
|
|
|
|
this.onCommonHandleSaveRecord(this.inputValue); |
|
|
// this.inputValue = this.item.label; |
|
|
// this.inputValue = this.item.label; |
|
|
}, |
|
|
}, |
|
|
//统一处理试剂/供试品等弹窗 |
|
|
//统一处理试剂/供试品等弹窗 |
|
|
@ -566,12 +622,12 @@ export default { |
|
|
if (this.templateFillType === "actFill") {//只有实际填报的时候才记录修改记录 |
|
|
if (this.templateFillType === "actFill") {//只有实际填报的时候才记录修改记录 |
|
|
this.updateZdxgjl(record); |
|
|
this.updateZdxgjl(record); |
|
|
} |
|
|
} |
|
|
setTimeout(() => { |
|
|
|
|
|
|
|
|
this.$nextTick(()=>{ |
|
|
EventBus.$emit('onModifyRecord', params,) |
|
|
EventBus.$emit('onModifyRecord', params,) |
|
|
if (this.regentType.includes(this.item.type)) { |
|
|
if (this.regentType.includes(this.item.type)) { |
|
|
this.$emit("onRegentSubmit", this.selectRegentInfo); |
|
|
this.$emit("onRegentSubmit", this.selectRegentInfo); |
|
|
} |
|
|
} |
|
|
}, 10); |
|
|
|
|
|
|
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
//判断两个值是否相等 |
|
|
//判断两个值是否相等 |
|
|
|