文件预览
This commit is contained in:
parent
3f9410c01d
commit
6f77396748
|
|
@ -32,32 +32,28 @@
|
||||||
|
|
||||||
<!-- 空状态 -->
|
<!-- 空状态 -->
|
||||||
<span v-else class="empty-text">--</span>
|
<span v-else class="empty-text">--</span>
|
||||||
<el-dialog v-if="dialogVisible" :visible.sync="dialogVisible" width="50%" class="preview-dialog" title="文件预览">
|
<!-- <el-dialog v-if="dialogVisible" :visible.sync="dialogVisible" width="50%" class="preview-dialog" title="文件预览">
|
||||||
<OnlyOfficeViewer :document-url="documentUrl" :document-title="documentTitle"
|
<OnlyOfficeViewer :document-url="documentUrl" :document-title="documentTitle"
|
||||||
:document-key="documentKey" :mode="mode" :type="type" @document-ready="handleDocumentReady"
|
:document-key="documentKey" :mode="mode" :type="type" @document-ready="handleDocumentReady"
|
||||||
@app-ready="handleAppReady" @error="handleError" @initialized="handleInitialized" :force-save="true"
|
@app-ready="handleAppReady" @error="handleError" @initialized="handleInitialized" :force-save="true"
|
||||||
:save-timeout="15000" />
|
:save-timeout="15000" />
|
||||||
</el-dialog>
|
</el-dialog> -->
|
||||||
|
<ViewFile v-if="dialogVisible" :file="fileData" @closeDialog="handleCloseDialog" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import OnlyOfficeViewer from './OnlyOfficeViewer';
|
import ViewFile from './ViewFile';
|
||||||
export default {
|
export default {
|
||||||
name: 'FileOrImageDisplay',
|
name: 'FileOrImageDisplay',
|
||||||
components: {
|
components: {
|
||||||
OnlyOfficeViewer
|
ViewFile
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
documentUrl: '',
|
fileData: {},
|
||||||
documentTitle: '',
|
|
||||||
documentKey: '',
|
|
||||||
mode: 'view',
|
|
||||||
type: 'desktop',
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
|
@ -141,9 +137,9 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
// 文件点击事件
|
// 文件点击事件
|
||||||
handleFileClick() {
|
handleFileClick() {
|
||||||
this.documentUrl = this.file.filePath
|
console.log(this.file);
|
||||||
this.documentTitle = this.file.name
|
|
||||||
this.documentKey = this.file.id + ''
|
this.fileData = this.file
|
||||||
this.dialogVisible = true
|
this.dialogVisible = true
|
||||||
},
|
},
|
||||||
// 图片点击事件
|
// 图片点击事件
|
||||||
|
|
@ -162,6 +158,10 @@ export default {
|
||||||
handleInitialized() {
|
handleInitialized() {
|
||||||
console.log('初始化完成')
|
console.log('初始化完成')
|
||||||
},
|
},
|
||||||
|
handleCloseDialog() {
|
||||||
|
this.dialogVisible = false
|
||||||
|
this.fileData = {}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -278,20 +278,5 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.preview-dialog ::v-deep .el-dialog {
|
|
||||||
height: 88vh;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.preview-dialog ::v-deep .el-dialog__body {
|
|
||||||
flex: 1;
|
|
||||||
padding: 0;
|
|
||||||
height: 0;
|
|
||||||
/* 重要:让flex布局生效 */
|
|
||||||
}
|
|
||||||
|
|
||||||
.preview-dialog ::v-deep .onlyoffice-container {
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
@ -23,7 +23,7 @@ export default {
|
||||||
dialogVisible: true,
|
dialogVisible: true,
|
||||||
documentUrl: this.file.filePath,
|
documentUrl: this.file.filePath,
|
||||||
documentTitle: this.file.fileName,
|
documentTitle: this.file.fileName,
|
||||||
documentKey: this.file.sourceId + '',
|
documentKey: (this.file?.sourceId || this.file?.id || '') + '',
|
||||||
mode: 'view',
|
mode: 'view',
|
||||||
type: 'desktop',
|
type: 'desktop',
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,8 @@ export default {
|
||||||
name: item.fileName,
|
name: item.fileName,
|
||||||
filePath: item.filePath,
|
filePath: item.filePath,
|
||||||
lsFilePath: item.lsFilePath,
|
lsFilePath: item.lsFilePath,
|
||||||
fileType: item.fileType
|
fileType: item.fileType,
|
||||||
|
id: item.sourceId
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,11 +31,12 @@
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</TableModel>
|
</TableModel>
|
||||||
<el-dialog v-if="dialogVisible" :visible.sync="dialogVisible" width="50%" class="preview-dialog" title="文件预览">
|
<!-- <el-dialog v-if="dialogVisible" :visible.sync="dialogVisible" width="50%" class="preview-dialog" title="文件预览">
|
||||||
<OnlyOfficeViewer :document-url="documentUrl" :document-title="documentTitle" :document-key="documentKey"
|
<OnlyOfficeViewer :document-url="documentUrl" :document-title="documentTitle" :document-key="documentKey"
|
||||||
:mode="mode" :type="type" @document-ready="handleDocumentReady" @app-ready="handleAppReady"
|
:mode="mode" :type="type" @document-ready="handleDocumentReady" @app-ready="handleAppReady"
|
||||||
@error="handleError" @initialized="handleInitialized" :force-save="true" :save-timeout="15000" />
|
@error="handleError" @initialized="handleInitialized" :force-save="true" :save-timeout="15000" />
|
||||||
</el-dialog>
|
</el-dialog> -->
|
||||||
|
<ViewFile v-if="dialogVisible" :file="fileData" @closeDialog="handleCloseDialog" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -44,13 +45,13 @@ import TableModel from '@/components/TableModel2'
|
||||||
import { columnsList, formLabel } from './config'
|
import { columnsList, formLabel } from './config'
|
||||||
import { listAPI, delDataAPI } from '@/api/enterpriseLibrary/technical/technical'
|
import { listAPI, delDataAPI } from '@/api/enterpriseLibrary/technical/technical'
|
||||||
import { encryptWithSM4 } from '@/utils/sm'
|
import { encryptWithSM4 } from '@/utils/sm'
|
||||||
import OnlyOfficeViewer from '@/views/common/OnlyOfficeViewer'
|
import ViewFile from '@/views/common/ViewFile'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'RightTableTechnical',
|
name: 'RightTableTechnical',
|
||||||
components: {
|
components: {
|
||||||
TableModel,
|
TableModel,
|
||||||
OnlyOfficeViewer
|
ViewFile
|
||||||
},
|
},
|
||||||
dicts: ['construction_nature', 'structural_form', 'basic_form'],
|
dicts: ['construction_nature', 'structural_form', 'basic_form'],
|
||||||
props: {
|
props: {
|
||||||
|
|
@ -69,11 +70,7 @@ export default {
|
||||||
columnsList,
|
columnsList,
|
||||||
listAPI,
|
listAPI,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
documentUrl: '',
|
fileData: {},
|
||||||
documentTitle: '',
|
|
||||||
documentKey: '',
|
|
||||||
mode: 'view',
|
|
||||||
type: 'desktop',
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|
@ -157,22 +154,17 @@ export default {
|
||||||
/** 查看文件 */
|
/** 查看文件 */
|
||||||
viewFile(row) {
|
viewFile(row) {
|
||||||
console.log(row);
|
console.log(row);
|
||||||
this.documentTitle = row.technicalName
|
this.fileData = {
|
||||||
this.documentKey = row.resourceFileVoList?.[0]?.sourceId + ''
|
fileName: row.technicalName,
|
||||||
|
id: row.resourceFileVoList?.[0]?.sourceId + ''
|
||||||
|
}
|
||||||
this.dialogVisible = true
|
this.dialogVisible = true
|
||||||
},
|
},
|
||||||
handleDocumentReady() {
|
handleCloseDialog() {
|
||||||
console.log('文档已准备就绪')
|
this.dialogVisible = false
|
||||||
},
|
this.fileData = {}
|
||||||
handleAppReady() {
|
|
||||||
console.log('应用已准备就绪')
|
|
||||||
},
|
|
||||||
handleError(error) {
|
|
||||||
console.log('错误:', error)
|
|
||||||
},
|
|
||||||
handleInitialized() {
|
|
||||||
console.log('初始化完成')
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 删除操作 */
|
/** 删除操作 */
|
||||||
handleDelete(raw) {
|
handleDelete(raw) {
|
||||||
this.$confirm(`确定要删除方案名称"${raw.technicalName}"吗?删除后将无法恢复!`, '操作提示', {
|
this.$confirm(`确定要删除方案名称"${raw.technicalName}"吗?删除后将无法恢复!`, '操作提示', {
|
||||||
|
|
@ -242,21 +234,4 @@ export default {
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.preview-dialog ::v-deep .el-dialog {
|
|
||||||
height: 88vh;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.preview-dialog ::v-deep .el-dialog__body {
|
|
||||||
flex: 1;
|
|
||||||
padding: 0;
|
|
||||||
height: 0;
|
|
||||||
/* 重要:让flex布局生效 */
|
|
||||||
}
|
|
||||||
|
|
||||||
.preview-dialog ::v-deep .onlyoffice-container {
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue