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

增加复制功能

上级 588793f0
...@@ -9,9 +9,9 @@ ...@@ -9,9 +9,9 @@
empty-text="暂无数据" empty-text="暂无数据"
:highlight-current-row="true" :highlight-current-row="true"
@selection-change="handleSelectionChange" @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 <el-table-column
v-for="(item, index) in tableTitle" v-for="(item, index) in tableTitle"
:key="index" :key="index"
...@@ -94,13 +94,22 @@ export default { ...@@ -94,13 +94,22 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
hasMultiSelection: {
type: Boolean,
default: false,
},
}, },
methods: { methods: {
handleSelectionChange(val) { handleSelectionChange(val) {
if (this.hasSelection) { if (this.hasMultiSelection) {
this.$emit("handleSelectionChange", val); this.$emit("handleSelectionChange", val);
} }
}, },
handleCurrentChange(val) {
if (this.hasSelection) {
this.$emit("handleCurrentChange", val);
}
},
}, },
}; };
</script> </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,7 +257,40 @@ export default { ...@@ -257,7 +257,40 @@ export default {
handler: function (value) { handler: function (value) {
if (value) { if (value) {
this.dialogForm = JSON.parse(JSON.stringify(value)); this.dialogForm = JSON.parse(JSON.stringify(value));
if (this.dialogForm.exhibitionId) { if (
(this.dialogForm.exhibitionUnits &&
this.dialogForm.exhibitionUnits.length == 0) ||
!this.dialogForm.exhibitionUnits
) {
this.dialogForm.exhibitionUnits = [
{
euId: 1, //后期去掉
// unit: "", //单元名称,如前言、第一单元,暂时忽略
title: "", //单元标题,类似主题名称
intro: "", //单元介绍
images: "", //图片id集合
videos: "", //视频id集合
crIds: [], //关联文物集合
// 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) { if (this.dialogForm.faceImageUrl) {
this.faceImage = [ this.faceImage = [
...@@ -283,7 +316,11 @@ export default { ...@@ -283,7 +316,11 @@ export default {
this.dialogForm.status = Boolean(Number(this.dialogForm.status)); this.dialogForm.status = Boolean(Number(this.dialogForm.status));
// 回填文献 // 回填文献
this.literatureValues = []; this.literatureValues = [];
if (this.dialogForm.literatureVo.length > 0) {
if (
this.dialogForm.literatureVo &&
this.dialogForm.literatureVo.length > 0
) {
this.literatureList = this.dialogForm.literatureVo; this.literatureList = this.dialogForm.literatureVo;
this.dialogForm.literatureVo.forEach((lt) => { this.dialogForm.literatureVo.forEach((lt) => {
if (this.literatureValues) { if (this.literatureValues) {
...@@ -291,41 +328,9 @@ export default { ...@@ -291,41 +328,9 @@ export default {
} }
}); });
} }
// // 回填布展单元中的文物、增加显示媒体的字段 // if (this.dialogForm.exhibitionUnits.length > 0) {
// // 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 {
// 新增
// 初始化布展单元
this.dialogForm.exhibitionUnits = [
{
euId: 1, //后期去掉
// unit: "", //单元名称,如前言、第一单元,暂时忽略
title: "", //单元标题,类似主题名称
intro: "", //单元介绍
images: "", //图片id集合
videos: "", //视频id集合
crIds: [], //关联文物集合
// showMediaUploader: false,
},
];
}
} }
}, },
immediate: true, immediate: true,
...@@ -523,8 +528,6 @@ export default { ...@@ -523,8 +528,6 @@ export default {
filesObj[key] = ids; filesObj[key] = ids;
} }
} }
console.log("successFilesObj", successFilesObj);
console.log("filesObj", filesObj);
// return; // return;
// 2、回填布展自带的媒体文件 // 2、回填布展自带的媒体文件
mediaArr.forEach((media) => { mediaArr.forEach((media) => {
...@@ -608,25 +611,6 @@ export default { ...@@ -608,25 +611,6 @@ export default {
this.reload(); this.reload();
} }
} else { } 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 { const {
exhibitionId, exhibitionId,
title, title,
......
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
@click.native="handleOperation({ type: 'add' })" @click.native="handleOperation({ type: 'add' })"
icon="el-icon-s-promotion" icon="el-icon-s-promotion"
> >
发布</el-button 发布</el-button
> >
<el-button type="primary" @click.native="handleCopy">复制</el-button>
</div> </div>
<TablePage <TablePage
:data="list.records" :data="list.records"
...@@ -93,6 +93,12 @@ ...@@ -93,6 +93,12 @@
@handleClose="handleClosePreviewDialog" @handleClose="handleClosePreviewDialog"
:videos="previewVideos" :videos="previewVideos"
/> />
<CopyDialog
:visible="copyDialogVisible"
@handleClose="handleCloseCopyDialog"
@handleCopySelect="handleCopySelect"
:list="list"
/>
<el-image-viewer <el-image-viewer
v-if="imgViewerVisible" v-if="imgViewerVisible"
:on-close="closeImgViewer" :on-close="closeImgViewer"
...@@ -108,6 +114,7 @@ import { title, operates, operations } from "./config"; ...@@ -108,6 +114,7 @@ import { title, operates, operations } from "./config";
import { getList, deleteDisplay, getDisplayById } from "@/api/display"; import { getList, deleteDisplay, getDisplayById } from "@/api/display";
import InfoEditDialog from "./components/InfoEditDialog"; import InfoEditDialog from "./components/InfoEditDialog";
import PreviewDialog from "./components/PreviewDialog"; import PreviewDialog from "./components/PreviewDialog";
import CopyDialog from "./components/CopyDialog";
import SearchBar from "@/components/SearchBar"; import SearchBar from "@/components/SearchBar";
export default { export default {
...@@ -117,6 +124,7 @@ export default { ...@@ -117,6 +124,7 @@ export default {
InfoEditDialog, InfoEditDialog,
PreviewDialog, PreviewDialog,
SearchBar, SearchBar,
CopyDialog,
"el-image-viewer": () => "el-image-viewer": () =>
import("element-ui/packages/image/src/image-viewer"), import("element-ui/packages/image/src/image-viewer"),
}, },
...@@ -176,6 +184,7 @@ export default { ...@@ -176,6 +184,7 @@ export default {
loading: false, loading: false,
imgViewerVisible: false, imgViewerVisible: false,
previewDialogVisible: false, previewDialogVisible: false,
copyDialogVisible: false,
previewVideos: [], previewVideos: [],
displayTypes: {}, displayTypes: {},
}; };
...@@ -322,6 +331,21 @@ export default { ...@@ -322,6 +331,21 @@ export default {
handleClosePreviewDialog() { handleClosePreviewDialog() {
this.previewDialogVisible = false; 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> </script>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论