提交代码

main
姜玉琦 2024-10-17 12:57:22 +08:00
parent 3233a2de54
commit 7648480dcd
2 changed files with 39 additions and 5 deletions

View File

@ -39,11 +39,10 @@ const updateDataSet = (id, data) => {
}); });
} }
//下载图像文件 //下载图像文件
const downloadFile = (id) => { const downloadFile = (id,fileName) => {
return request({ return request({
url: `/dataset/raw/${id}/download`, url: `/dataset/raw/${id}/download?fileName=${fileName}`,
method: 'get', method: 'get'
params: data
}) })
} }
//删除指定的图像文件 //删除指定的图像文件

View File

@ -103,7 +103,7 @@
<el-button type="primary" style="position: absolute; right: 30px" @click="handleRemoveAll" <el-button type="primary" style="position: absolute; right: 30px" @click="handleRemoveAll"
:disabled="imageList.length == 0"><i-ep-delete />清空全部</el-button> :disabled="imageList.length == 0"><i-ep-delete />清空全部</el-button>
</template> </template>
<el-upload v-model:file-list="imageList" class="upload-demo upload-demo-2" :before-remove="beforeRemove" /> <el-upload v-model:file-list="imageList" class="upload-demo upload-demo-2" :before-remove="beforeRemove" :on-preview="handlePreview"/>
<el-empty v-if="imageList.length == 0" description="暂 无 数 据" /> <el-empty v-if="imageList.length == 0" description="暂 无 数 据" />
</el-card> </el-card>
<el-card class="card-footer"> <el-card class="card-footer">
@ -135,6 +135,20 @@
</div> </div>
</template> </template>
</el-dialog> </el-dialog>
<div class="demo-image__preview">
<el-image
class="imgPreView"
:src="imgPreSrc"
:zoom-rate="1.2"
:max-scale="7"
:min-scale="0.2"
:preview-src-list="imgPreSrcList"
:initial-index="4"
style="width: 1px; height: 1px"
fit="cover"
/>
</div>
</div> </div>
</template> </template>
@ -154,6 +168,10 @@ const codeHtml = ref(""); // 文件信息
const jsonData = reactive({ const jsonData = reactive({
data: {} data: {}
}) })
const imgViewer = ref(false);
const imgPreSrc = ref("");
const imgPreSrcList = ref([]);
const imgViewerRef = ref(""); //
const imgCount = ref(0); // const imgCount = ref(0); //
const imageList = ref([]); // const imageList = ref([]); //
const remImageList = ref([]); // const remImageList = ref([]); //
@ -450,6 +468,23 @@ function closeBack() {
router.push({ path: "/dataMgr/datas" }); router.push({ path: "/dataMgr/datas" });
} }
/** 预览图片 */
function handlePreview(file) {
imgPreSrcList.value = [];
DataSetApi.downloadFile(ID.value,file.name).then(res =>{
console.log(res)
if(res.data.code==0){
imgPreSrc.value = "data:image/gif;base64," + res.data.data.file_content;
imgPreSrcList.value.push(imgPreSrc.value);
setTimeout(() => {
console.log("点击事件===>");
imgViewer.value = true;
document.getElementsByClassName("imgPreView")[0].children[0].click();
}, 50);
}
});
}
// //
const initData = () => { const initData = () => {
let id = route.query.id; let id = route.query.id;