文件编辑可配置

This commit is contained in:
XaoLi717 2024-09-25 16:29:51 +08:00
parent d178a4451b
commit 5695aebc97
3 changed files with 31 additions and 13 deletions

View File

@ -35,7 +35,7 @@
<template #file="row"> <template #file="row">
<div class="flex items-center"> <div class="flex items-center">
<span>{{ row.file.name }}</span> <span>{{ row.file.name }}</span>
<div class="ml-10px" > <div v-if="dataT=='001'||dataT=='005'||dataT=='007'" class="ml-10px" >
<el-link <el-link
:underline="false" :underline="false"
@click="handleView(row.file)" @click="handleView(row.file)"
@ -44,7 +44,7 @@
>预览 >预览
</el-link> </el-link>
</div> </div>
<div class="ml-10px" > <div v-if="dataT=='003'||dataT=='006'||dataT=='007'" class="ml-10px" >
<el-link <el-link
:underline="false" :underline="false"
@click="edit(row)" @click="edit(row)"
@ -53,7 +53,7 @@
>编辑 >编辑
</el-link> </el-link>
</div> </div>
<div class="ml-10px"> <div v-if="dataT=='002'||dataT=='005'||dataT=='007'" class="ml-10px">
<el-link <el-link
:underline="false" :underline="false"
@click="downloadFile(row.file)" @click="downloadFile(row.file)"
@ -62,7 +62,7 @@
>原文件下载 >原文件下载
</el-link> </el-link>
</div> </div>
<div class="ml-10px"> <div v-if="dataT=='004'||dataT=='006'||dataT=='007'" class="ml-10px">
<el-link <el-link
:underline="false" :underline="false"
target="_blank" target="_blank"
@ -90,6 +90,7 @@ import {onlyofApi} from "@/api/only/only";
import axios from "axios"; import axios from "axios";
import {ref} from "vue"; import {ref} from "vue";
import {integer} from "vue-types"; import {integer} from "vue-types";
import {getConfigKey} from "@/api/infra/config";
defineOptions({ name: 'UploadFile' }) defineOptions({ name: 'UploadFile' })
@ -314,13 +315,11 @@ const handleView = (file)=> {
if (!url) { if (!url) {
console.error("文件不可预览"); console.error("文件不可预览");
} }
const file2 = url.substring(url.length-5,url.length).trim().toLowerCase() const fileExt = url.substring(url.length-5,url.length).trim().toLowerCase()
console.log(file2) console.log(fileExt)
//使 if (fileExt==="docx"||fileExt==="xlsx"||fileExt==="pptx"){
// <i-frame :src="row.file.url" width="100%" height="100%"/>
if (file2==="docx"||file2==="xlsx"||file2==="pptx"){
window.open("https://view.officeapps.live.com/op/view.aspx?src="+encodeURIComponent(url),'_blank') window.open("https://view.officeapps.live.com/op/view.aspx?src="+encodeURIComponent(url),'_blank')
}else if(file2===".txt"||file2===".pdf"){ }else if(fileExt===".txt"||fileExt===".pdf"){
window.open(url, '_blank'); window.open(url, '_blank');
} }
} }
@ -422,7 +421,16 @@ const emitUpdateModelValue2 = () => {
// 便 // 便
MysqlUrl.value = [] MysqlUrl.value = []
} }
const dataT = ref(null)
onMounted( () => {
getConfigKey("file:open:controller").then((res) => {
if (!res || res.length === 0){
return
}
dataT.value = res;
console.log("data",dataT.value)
})
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.upload-file-uploader { .upload-file-uploader {

View File

@ -197,6 +197,7 @@ import {dateFormatter, dateFormatter2} from '@/utils/formatTime'
import download from '@/utils/download' import download from '@/utils/download'
import { imgApi, imgVO } from '@/api/home/homeimg' import { imgApi, imgVO } from '@/api/home/homeimg'
import imgForm from './imgForm.vue' import imgForm from './imgForm.vue'
import {getConfigKey} from "@/api/infra/config";
/** 公告管理 列表 */ /** 公告管理 列表 */
defineOptions({ name: 'Homeimg' }) defineOptions({ name: 'Homeimg' })
@ -281,9 +282,18 @@ const handleExport = async () => {
exportLoading.value = false exportLoading.value = false
} }
} }
/** 初始化 **/ /** 初始化 **/
onMounted(() => { onMounted(() => {
getList() getList()
// const dataT = ref(null)
// getConfigKey("test4").then((res) => {
// if (!res || res.length === 0){
// return
// }
// dataT.value = res;
// console.log("data",dataT.value)
// }).finally( () => {
// loading.value = false
// })
}) })
</script> </script>

View File

@ -1,5 +1,5 @@
<template> <template>
<Dialog v-model="dialogVisible" :title="dialogTitle"> <Dialog v-model="dialogVisible" style="width: 80%" :title="dialogTitle">
<el-form <el-form
ref="formRef" ref="formRef"
v-loading="formLoading" v-loading="formLoading"