提交 a4ca61a5 authored 作者: 龙菲's avatar 龙菲

修复抠图详情页预览索引错误问题;增加多选抠图失败为不能下载

上级 2af1b167
<template> <template>
<el-dialog <div>
:visible.sync="visible" <el-dialog
top="3vh" :visible.sync="visible"
:before-close="handleClose" top="3vh"
lock-scroll :before-close="handleClose"
width="65vw" lock-scroll
title="抠图详情" width="65vw"
> title="抠图详情"
<div class="dialog-content"> >
<el-descriptions title="详细信息" v-if="infoHasValue"> <div class="dialog-content">
<el-descriptions-item <el-descriptions title="详细信息" v-if="infoHasValue">
:label="item.label" <el-descriptions-item
v-for="(item, index) in tableTitle" :label="item.label"
:key="index" v-for="(item, index) in tableTitle"
>
<span v-if="item.prop == 'status'">
<el-tag
size="mini"
:type="
$constantsTool.getTagTypeByValue('mattingStatus', detail.status)
"
>
{{
$constantsTool.getLabelByValue("mattingStatus", detail.status)
}}
</el-tag>
</span>
<span v-else>{{ detail[item.prop] }}</span>
</el-descriptions-item>
</el-descriptions>
<div class="imgs">
<div class="imgs-title">
<h3>图片列表</h3>
<div class="right" v-if="isImgMultiple">
<el-button
type="text"
style="margin-right: 10px"
@click="toggleShowCheckbox"
>{{ getText }}</el-button
>
<el-checkbox
label="全选"
v-model="isAllChecked"
v-if="isShowCheckbox"
></el-checkbox>
</div>
</div>
<div class="container" :gutter="10">
<div
v-for="(item, index) in mattingImagesPage.records"
:key="index" :key="index"
class="img-item"
> >
<div <span v-if="item.prop == 'status'">
:class="['modal', item.checked ? 'active' : '']" <el-tag
v-if="isShowCheckbox" size="mini"
@click.prevent="toggleItemCheckbox(item)" :type="
> $constantsTool.getTagTypeByValue(
'mattingStatus',
detail.status
)
"
>
{{
$constantsTool.getLabelByValue("mattingStatus", detail.status)
}}
</el-tag>
</span>
<span v-else>{{ detail[item.prop] }}</span>
</el-descriptions-item>
</el-descriptions>
<div class="imgs">
<div class="imgs-title">
<h3>图片列表</h3>
<div class="right" v-if="isImgMultiple">
<el-button
type="text"
style="margin-right: 10px"
@click="toggleShowCheckbox"
>{{ getText }}</el-button
>
<el-checkbox <el-checkbox
class="checkbox" label="全选"
v-model="isAllChecked"
v-if="isShowCheckbox" v-if="isShowCheckbox"
v-model="item.checked"
></el-checkbox> ></el-checkbox>
</div> </div>
<div class="more" @click.prevent="toggleItemCheckbox(item)"> </div>
<el-button <div class="container" :gutter="10">
title="下载" <div
style="margin-right: 12px" v-for="(item, index) in mattingImagesPage.records"
type="text" :key="index"
icon="el-icon-download" class="img-item"
@click="handleDownloadRow(item)" >
></el-button> <div
<el-dropdown> :class="['modal', item.checked ? 'active' : '']"
<i class="el-icon-more" style="color: #409eff"></i> v-if="isShowCheckbox"
<el-dropdown-menu slot="dropdown"> @click.prevent="toggleItemCheckbox(item)"
<el-dropdown-item @click.native="handleDeleteRow(item)" >
>删除</el-dropdown-item <el-checkbox
> class="checkbox"
</el-dropdown-menu> v-if="isShowCheckbox"
</el-dropdown> v-model="item.checked"
</div> ></el-checkbox>
<el-image </div>
style="width: 200px; height: 150px; padding: 10px" <div class="more" @click.prevent="toggleItemCheckbox(item)">
:src="item.pressUrl" <el-tag
fit="contain" :type="
:preview-src-list="srcList" $constantsTool.getTagTypeByValue(
></el-image> 'mattingStatus',
item.status
)
"
size="mini"
style="margin-right: 6px"
>
{{
$constantsTool.getLabelByValue("mattingStatus", item.status)
}}
</el-tag>
<el-button
title="下载"
style="margin-right: 16px"
type="text"
icon="el-icon-download"
@click="handleDownloadRow(item)"
:disabled="isDisabledDownload(item)"
></el-button>
<el-dropdown>
<i class="el-icon-more" style="color: #409eff"></i>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="handleDeleteRow(item)"
>删除</el-dropdown-item
>
</el-dropdown-menu>
</el-dropdown>
</div>
<el-image
style="width: 200px; height: 230px; padding: 10px"
:src="item.pressUrl"
fit="contain"
@click="openElImageViwer(index)"
></el-image>
<div class="name">{{ item.name }}</div> <div class="name">{{ item.name }}</div>
</div>
</div>
<el-pagination
v-if="mattingImagesPage.records.length > 0"
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="Number(mattingImagesPage.current)"
:page-sizes="[10, 20, 40, 50]"
:page-size="Number(mattingImagesPage.size)"
layout="total, sizes, prev, pager, next, jumper"
:total="Number(mattingImagesPage.total)"
class="pagination"
/>
<div class="button">
<PermissionButton
button
perms="bizMattingImages:download"
@click="handleDownload"
:disabled="disabledButton"
plain
type="primary"
icon="el-icon-download"
style="width: 100%"
>下载</PermissionButton
>
</div> </div>
</div>
<el-pagination
v-if="mattingImagesPage.records.length > 0"
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="Number(mattingImagesPage.current)"
:page-sizes="[10, 20, 40, 50]"
:page-size="Number(mattingImagesPage.size)"
layout="total, sizes, prev, pager, next, jumper"
:total="Number(mattingImagesPage.total)"
class="pagination"
/>
<div class="button">
<PermissionButton
button
perms="bizMattingImages:download"
@click="handleDownload"
:disabled="disabledButton"
plain
type="primary"
icon="el-icon-download"
style="width: 100%"
>下载</PermissionButton
>
</div> </div>
</div> </div>
</div> </el-dialog>
</el-dialog> <el-image-viewer
v-if="imgViewerVisible"
:on-close="closeImgViewer"
:url-list="srcList"
:initial-index="initialIndex"
/>
</div>
</template> </template>
<script> <script>
...@@ -130,7 +156,10 @@ import { ...@@ -130,7 +156,10 @@ import {
import { Debounce } from "@/utils/index"; import { Debounce } from "@/utils/index";
export default { export default {
name: "PreviewDialog", name: "PreviewDialog",
components: {}, components: {
"el-image-viewer": () =>
import("element-ui/packages/image/src/image-viewer"),
},
props: { props: {
detail: { detail: {
type: Object, type: Object,
...@@ -150,6 +179,8 @@ export default { ...@@ -150,6 +179,8 @@ export default {
current: 1, current: 1,
total: 0, total: 0,
}, },
imgViewerVisible: false,
initialIndex: 0,
}; };
}, },
computed: { computed: {
...@@ -193,6 +224,11 @@ export default { ...@@ -193,6 +224,11 @@ export default {
} }
return this.mattingImagesPage.total > 1; return this.mattingImagesPage.total > 1;
}, },
isDisabledDownload(item) {
return (item) => {
return item.status != 1;
};
},
}, },
watch: { watch: {
detail(value) { detail(value) {
...@@ -321,6 +357,15 @@ export default { ...@@ -321,6 +357,15 @@ export default {
this.mattingImagesPage.current = current; this.mattingImagesPage.current = current;
this.loadImgs(); this.loadImgs();
}, },
openElImageViwer(index) {
this.imgViewerVisible = true;
this.initialIndex = index;
},
closeImgViewer() {
this.imgViewerVisible = false;
},
}, },
}; };
</script> </script>
...@@ -363,6 +408,7 @@ export default { ...@@ -363,6 +408,7 @@ export default {
top: 0; top: 0;
color: #409eff; color: #409eff;
cursor: pointer; cursor: pointer;
margin-bottom: 10px;
} }
.modal { .modal {
position: absolute; position: absolute;
......
...@@ -260,10 +260,17 @@ export default { ...@@ -260,10 +260,17 @@ export default {
}, },
handleMultiDownload() { handleMultiDownload() {
const ids = this.multiSelection.map((item) => { const hasError = this.multiSelection.some((item) => {
return item.mattingId; return item.status == -1;
}); });
this.downloadByRecordId(ids); if (hasError) {
this.$message.warning("当前只支持下载抠图成功的图片!");
} else {
const ids = this.multiSelection.map((item) => {
return item.mattingId;
});
this.downloadByRecordId(ids);
}
}, },
deleteByRecordsId: Debounce(async function (ids) { deleteByRecordsId: Debounce(async function (ids) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论