提交 8d5ca676 authored 作者: 龙菲's avatar 龙菲

增加复制功能

上级 588793f0
......@@ -9,9 +9,9 @@
empty-text="暂无数据"
:highlight-current-row="true"
@selection-change="handleSelectionChange"
@current-change="handleCurrentChange"
>
<el-table-column v-if="hasSelection" type="selection" width="55" />
<el-table-column v-if="hasMultiSelection" type="selection" width="55" />
<el-table-column
v-for="(item, index) in tableTitle"
:key="index"
......@@ -40,7 +40,7 @@
<template v-else-if="item.isStatus">
<slot name="status" :scope="scope.row"></slot>
</template>
<template v-else-if="item.prop == 'years'">
<slot name="years" :scope="scope.row"></slot>
</template>
......@@ -94,13 +94,22 @@ export default {
type: Boolean,
default: false,
},
hasMultiSelection: {
type: Boolean,
default: false,
},
},
methods: {
handleSelectionChange(val) {
if (this.hasSelection) {
if (this.hasMultiSelection) {
this.$emit("handleSelectionChange", val);
}
},
handleCurrentChange(val) {
if (this.hasSelection) {
this.$emit("handleCurrentChange", val);
}
},
},
};
</script>
......
<!-- -->
<template>
<el-dialog
:visible.sync="dialogVisible"
width="80%"
style="height: 98%"
:before-close="handleClose"
top="5vh"
lock-scroll
>
<div class="title" slot="title">
<div class="divider"></div>
<div class="label">选择需要复制的条目</div>
</div>
<div class="dialog-content">
<TablePage
:data="list.records"
:tableTitle="tableTitle"
hasSelection
@handleCurrentChange="handleCurrentChange"
>
<!-- <template v-slot:displayType="data">
{{ dict.display_type[data.scope.type] }}
</template> -->
<template v-slot:faceImageUrl="data">
<img
:src="data.scope.faceImageUrl"
alt="查看大图"
v-if="data.scope.faceImageUrl"
style="cursor: pointer"
width="100px"
@click="handelPreviewImages(data.scope.faceImageUrl)"
/>
</template>
</TablePage>
<div class="dialog-footer">
<el-button type="primary" @click="handleClose">关闭</el-button>
</div>
</div>
</el-dialog>
</template>
<script>
import { title, operates, operations } from "../config";
import TablePage from "@/components/Table/TablePage.vue";
export default {
components: {
TablePage,
},
data() {
return {};
},
props: {
visible: {
type: Boolean,
default: false,
},
list: {
type: Object,
default: () => ({}),
},
},
computed: {
tableTitle() {
return title;
},
dialogVisible: {
get: function () {
return this.visible;
},
set: function () {},
},
},
mounted() {},
methods: {
handleClose() {
this.$emit("handleClose");
},
handleCurrentChange(value) {
this.handleClose();
this.$emit("handleCopySelect",value);
},
},
};
</script>
<style lang="scss" scoped>
</style>
......@@ -257,62 +257,11 @@ export default {
handler: function (value) {
if (value) {
this.dialogForm = JSON.parse(JSON.stringify(value));
if (this.dialogForm.exhibitionId) {
// 回填媒体资源
if (this.dialogForm.faceImageUrl) {
this.faceImage = [
{
name: "",
url: this.dialogForm.faceImageUrl,
fileId: this.dialogForm.faceImage,
},
];
}
if (this.dialogForm.imagesVo) {
this.images = this.dialogForm.imagesVo;
}
if (this.dialogForm.videosVo) {
this.videos = this.dialogForm.videosVo;
}
if (this.dialogForm.audiosVo) {
this.audios = this.dialogForm.audiosVo;
}
// 编辑
// 回填状态
this.dialogForm.status = Boolean(Number(this.dialogForm.status));
// 回填文献
this.literatureValues = [];
if (this.dialogForm.literatureVo.length > 0) {
this.literatureList = this.dialogForm.literatureVo;
this.dialogForm.literatureVo.forEach((lt) => {
if (this.literatureValues) {
this.literatureValues.push(lt.literatureId);
}
});
}
// // 回填布展单元中的文物、增加显示媒体的字段
// // TODO:
if (this.dialogForm.exhibitionUnits.length > 0) {
loopUnit(this.dialogForm.exhibitionUnits);
function loopUnit(arr) {
arr.forEach((unit) => {
if (unit.length > 0) {
// this.$set(unit, "showMediaUploader", true); //设置展示图片单元的为展开
// 如果有文物,回填文物
if (unit.culturalRelics && uni.culturalRelics.length > 0) {
this.$set(unit, "crIds", unit.culturalRelics);
}
if (unit.children) {
loopUnit(unit.children);
}
}
});
}
}
} else {
// 新增
// 初始化布展单元
if (
(this.dialogForm.exhibitionUnits &&
this.dialogForm.exhibitionUnits.length == 0) ||
!this.dialogForm.exhibitionUnits
) {
this.dialogForm.exhibitionUnits = [
{
euId: 1, //后期去掉
......@@ -325,7 +274,63 @@ export default {
// showMediaUploader: false,
},
];
} else {
loopUnit(this.dialogForm.exhibitionUnits);
function loopUnit(arr) {
arr.forEach((unit) => {
if (unit.length > 0) {
// this.$set(unit, "showMediaUploader", true); //设置展示图片单元的为展开
// 如果有文物,回填文物
if (unit.culturalRelics && uni.culturalRelics.length > 0) {
this.$set(unit, "crIds", unit.culturalRelics);
}
if (unit.children) {
loopUnit(unit.children);
}
}
});
}
}
// 回填媒体资源
if (this.dialogForm.faceImageUrl) {
this.faceImage = [
{
name: "",
url: this.dialogForm.faceImageUrl,
fileId: this.dialogForm.faceImage,
},
];
}
if (this.dialogForm.imagesVo) {
this.images = this.dialogForm.imagesVo;
}
if (this.dialogForm.videosVo) {
this.videos = this.dialogForm.videosVo;
}
if (this.dialogForm.audiosVo) {
this.audios = this.dialogForm.audiosVo;
}
// 编辑
// 回填状态
this.dialogForm.status = Boolean(Number(this.dialogForm.status));
// 回填文献
this.literatureValues = [];
if (
this.dialogForm.literatureVo &&
this.dialogForm.literatureVo.length > 0
) {
this.literatureList = this.dialogForm.literatureVo;
this.dialogForm.literatureVo.forEach((lt) => {
if (this.literatureValues) {
this.literatureValues.push(lt.literatureId);
}
});
}
// if (this.dialogForm.exhibitionUnits.length > 0) {
// }
}
},
immediate: true,
......@@ -397,7 +402,7 @@ export default {
cancelForm() {
this.reload();
},
async handleSubmit() {
var that = this;
let formData = new FormData();
......@@ -523,8 +528,6 @@ export default {
filesObj[key] = ids;
}
}
console.log("successFilesObj", successFilesObj);
console.log("filesObj", filesObj);
// return;
// 2、回填布展自带的媒体文件
mediaArr.forEach((media) => {
......@@ -608,25 +611,6 @@ export default {
this.reload();
}
} else {
/**
* form: {
title: "", //标题
type: "", // 类别(待定)--枚举值(社会、生活等)
displayCharacter: 1, //展览性质(精品展2、布展1、文物展3)--此处填写布展类别
keyword: "", // 关键词
deptId: "", //展览单位id--暂填入用户自己的单位
regionCode: "", // 所在地域--暂填入用户自己的地区
intro: "", //展览介绍,
themeType: "", //模板主题--前端枚举
literature: "", //关联文献。id1,id2,id3--接口查询
remark: "", //备注
status: false, //上下架状态(0-下架,1-上架)
faceImage: "", // 封面(图片1张)
images: "", //展览图片
videos: "", //展览视频
audios: "", //展览音频
},
*/
const {
exhibitionId,
title,
......
......@@ -5,11 +5,11 @@
<el-button
type="primary"
@click.native="handleOperation({ type: 'add' })"
icon="el-icon-s-promotion"
icon="el-icon-s-promotion"
>
发布</el-button
>
<el-button type="primary" @click.native="handleCopy">复制</el-button>
</div>
<TablePage
:data="list.records"
......@@ -93,6 +93,12 @@
@handleClose="handleClosePreviewDialog"
:videos="previewVideos"
/>
<CopyDialog
:visible="copyDialogVisible"
@handleClose="handleCloseCopyDialog"
@handleCopySelect="handleCopySelect"
:list="list"
/>
<el-image-viewer
v-if="imgViewerVisible"
:on-close="closeImgViewer"
......@@ -108,6 +114,7 @@ import { title, operates, operations } from "./config";
import { getList, deleteDisplay, getDisplayById } from "@/api/display";
import InfoEditDialog from "./components/InfoEditDialog";
import PreviewDialog from "./components/PreviewDialog";
import CopyDialog from "./components/CopyDialog";
import SearchBar from "@/components/SearchBar";
export default {
......@@ -117,6 +124,7 @@ export default {
InfoEditDialog,
PreviewDialog,
SearchBar,
CopyDialog,
"el-image-viewer": () =>
import("element-ui/packages/image/src/image-viewer"),
},
......@@ -176,6 +184,7 @@ export default {
loading: false,
imgViewerVisible: false,
previewDialogVisible: false,
copyDialogVisible: false,
previewVideos: [],
displayTypes: {},
};
......@@ -322,6 +331,21 @@ export default {
handleClosePreviewDialog() {
this.previewDialogVisible = false;
},
handleCopy() {
this.copyDialogVisible = true;
},
handleCloseCopyDialog() {
this.copyDialogVisible = false;
},
async handleCopySelect(value) {
const { exhibitionId } = value;
let res = await getDisplayById({ exhibitionId });
delete res.data.exhibitionId;
this.form = {...res.data};
this.editDialogVisible = true;
console.log('this.form',this.form);
},
},
};
</script>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论