Browse Source

1.解决文件预览乱码问题

2.删除文件后,实时刷新数据列表
master
赵宏斌 2 weeks ago
parent
commit
a13510faf5
  1. 28
      src/views/modules/qc/IQCFileTable.vue

28
src/views/modules/qc/IQCFileTable.vue

@ -48,11 +48,22 @@ export default {
return;
}
downLoadObjectFile(row).then(({data}) => {
const blob = new Blob([data], { type: type });
// URL
const fileURL = URL.createObjectURL(blob);
//
const newTab = window.open(fileURL, '_blank')
// const blob = new Blob([data], { type: type });
// // URL
// const fileURL = URL.createObjectURL(blob);
// //
// const newTab = window.open(fileURL, '_blank')
const type = 'text/plain;charset=utf-8'; //
const blob = new Blob([data], { type });
const reader = new FileReader();
reader.onload = function(e) {
const content = e.target.result;
//
const newTab = window.open();
newTab.document.write('<pre>' + content + '</pre>');
};
reader.readAsText(blob, 'utf-8');
})
},
@ -156,7 +167,8 @@ export default {
}).then(() => {
deleteObjectFile(row).then(({data}) => {
if (data && data.code == 0) {
this.getFileContentData(tempData)
// this.getFileContentData(tempData)
this.$emit('refresh')
this.$message({
message: '操作成功',
type: 'success',
@ -210,8 +222,8 @@ export default {
<el-link v-if="scope.row.orderReftype !== 'mes'" style="cursor: pointer" @click="previewFile(scope.row)">预览</el-link>
<el-link v-if="scope.row.orderReftype !== 'mes'" style="cursor: pointer" @click="downloadFile(scope.row)">下载</el-link>
<el-link v-if="scope.row.orderReftype !== 'mes'" style="cursor: pointer" @click="deleteFile(scope.row)">删除</el-link>
<el-link v-if="scope.row.orderReftype === 'mes'" style="cursor: pointer" @click="previewFileMes(scope.row)">预览</el-link>
<el-link v-if="scope.row.orderReftype === 'mes'" style="cursor: pointer" @click="downloadFileMes(scope.row)">下载</el-link>
<!-- <el-link v-if="scope.row.orderReftype === 'mes'" style="cursor: pointer" @click="previewFileMes(scope.row)">预览</el-link>-->
<!-- <el-link v-if="scope.row.orderReftype === 'mes'" style="cursor: pointer" @click="downloadFileMes(scope.row)">下载</el-link>-->
</template>
</el-table-column>
</el-table>

Loading…
Cancel
Save