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

文物管理接口联调

上级 43a00b0e
import request from '@/utils/request'
export function getList(params) {
export function getCulturalRelicList(data) {
return request({
url: '/culturalRelic/getList',
url: '/bizCulturalRelic/listByPage',
method: 'post',
data
})
}
export function addCulturalRelic(data) {
return request({
url: '/bizCulturalRelic/add',
method: 'post',
data
})
}
export function editCulturalRelic(data) {
return request({
url: '/bizCulturalRelic/update',
method: 'put',
data
})
}
// 根据文物id查询详情
export function getRCDetailById(params) {
return request({
url: '/bizCulturalRelic/listById',
method: 'get',
params
})
}
......@@ -12,7 +12,7 @@ class Dict {
}
async init(names) {
// console.log('names', names);
console.log('names', names);
// const ps = [];
// 先判断list中的name是否存在,如果不存在,把不存在的放置在一个list中,再对list进行获取
var nonExistentNames = []
......@@ -24,11 +24,7 @@ class Dict {
nonExistentNames.push(name) //存入list中,单独进行处理调用
}
});
// console.log('nonExistentNames', nonExistentNames);
// 拿所有不存在的name去获取字典
// 对所有不存在的name进行遍历,如果里面有literature,则删除该数组中的literature
var index = nonExistentNames.indexOf('literature')
// console.log('index');
if (index != -1) {
// debugger
Vue.set(this.dict, 'literature', []);
......@@ -50,20 +46,28 @@ class Dict {
}
if (nonExistentNames.length > 0) {
// debugger
var res = await getDictCode(nonExistentNames)
nonExistentNames.forEach(n => {
Vue.set(this.dict, n, []);
var arr = []
// var arr = []
var obj = {}
if (res.code == 0) {
res.data.map(item => {
if (item.dictType === n) {
arr.push(item)
// arr.push(item)
// console.log(' obj[item.value]', obj[item.value]);
// console.log(' obj[item.label]', obj[item.label]);
// console.log('item',item);
// debugger
obj[item.value]=item.label
}
})
this.dict[n] = Object.freeze(arr)
this.dict[n] = Object.freeze(obj)
store.commit("dict/SET_DICTS", {
label: n,
value: Object.freeze(arr),
value: Object.freeze(obj),
});
}
})
......
......@@ -40,6 +40,15 @@
</template>
<template v-else-if="item.prop=='type'">
<slot name="type" :scope="scope.row"></slot>
</template>
<template v-else-if="item.prop=='years'">
<slot name="years" :scope="scope.row"></slot>
</template>
<template v-else-if="item.prop=='level'">
<slot name="level" :scope="scope.row"></slot>
</template>
<template v-else-if="item.prop=='textureType'">
<slot name="textureType" :scope="scope.row"></slot>
</template>
<span v-else>{{ scope.row[item.prop] }}</span>
</template>
......
<template>
<div class="images-list">
<el-upload
action
:on-remove="handleRemove"
:on-exceed="handleExceed"
:on-change="handleChange"
:file-list="fileList"
:multiple="fileLimit > 1"
:limit="fileLimit"
:list-type="listType"
:accept="fileAccept"
:auto-upload="false"
>
<i v-if="listType === 'picture-card'" class="el-icon-plus"></i>
<el-button v-else size="small" type="primary">点击上传</el-button>
<div v-if="showTip" slot="tip" class="el-upload__tip">
只能上传{{ fileTypeName || "jpg/png" }}文件,且不超过
{{ fileSize }}MB,最多上传{{ fileLimit }}个文件
</div>
</el-upload>
<!-- <el-upload
action
:before-upload="handleBeforeUpload"
:on-success="handleSuccess"
:on-error="handleUploadError"
:on-remove="handleRemove"
:on-exceed="handleExceed"
:on-change="handleChange"
:file-list="fileList"
:multiple="fileLimit > 1"
:headers="headers"
:limit="fileLimit"
:list-type="listType"
name="files"
:accept="fileAccept"
auto-upload="false"
>
<i v-if="listType === 'picture-card'" class="el-icon-plus"></i>
<el-button v-else size="small" type="primary">点击上传</el-button>
<div v-if="showTip" slot="tip" class="el-upload__tip">
只能上传{{ fileTypeName || "jpg/png" }}文件,且不超过
{{ fileSize }}MB,最多上传{{ fileLimit }}个文件
</div>
</el-upload> -->
</div>
</template>
<script>
import { getToken } from "@/utils/auth";
import { upload } from "@/utils/upload";
import {Debounce} from '@/utils/index'
export default {
name: "RcUploader",
props: {
// 值
// value: [String, Object, Array],
files: {
type: Array,
default: () => [],
},
// 大小限制(MB)
fileSize: {
type: Number,
default: 5,
},
// 文件类型, 例如["doc", "xls", "ppt", "txt", "pdf"]
fileType: {
type: Array,
default: () => ["png", "jpg", "jpeg"],
},
// 文件列表类型 text/picture/picture-card
listType: {
type: String,
default: "picture",
},
// 是否显示提示
isShowTip: {
type: Boolean,
default: true,
},
// 最大允许上传个数
fileLimit: {
type: Number,
default: 99,
},
},
data() {
return {
uploadUrl:
process.env.NODE_ENV === "test" ||
process.env.NODE_ENV === "development"
? "/api/sysFiles/upload"
: process.env.NODE_ENV + "/sysFiles/upload", // 上传的图片服务器地址
headers: {
authorization: getToken(),
},
fileList: [],
// tempFileList: [],
uploadDisabled: false,
upLoadList: [],
};
},
watch: {
files: {
handler: function (newVal, oldVal) {
console.log("newVal", newVal);
this.fileList = newVal;
},
immediate: true,
deep: true,
},
},
computed: {
// 是否显示提示
showTip() {
return this.isShowTip && (this.fileType || this.fileSize);
},
fileTypeName() {
let typeName = "";
this.fileType.forEach((item) => {
typeName += `${item},`;
});
return typeName;
},
fileAccept() {
let fileAccept = "";
this.fileType.forEach((element) => {
fileAccept += `.${element},`;
});
return fileAccept;
},
},
created() {
this.fileList = JSON.parse(JSON.stringify(this.files));
},
methods: {
// 自定义上传实现,用于修改上传后的封面
httpRequest(e) {
var formData = new FormData();
console.log("e", e);
formData.append("files", e.file);
// debugger
// let files = e.file.files;
// let formData = new FormData();
// files = Array.from(files); // files是类数组,需要先转为数组
// files.forEach((file) => {
// formData.append("file", file);
// });
// console.log('formData',formData.get('files'));
upload(formData).then((res) => {
console.log("上传res", res);
if (res.data.code == 0) {
console.log(res);
var file = res.data.data[0];
this.fileList.push({
url: file.url, //pdf封面图片
realUrl: file.url,
fileId: file.fileId,
name: file.name,
//接口返回的pdf文件链接
});
// var last = res.data.substring(res.data.lastIndexOf(".")); //将接口中返回的各文件链接进行截取,来判断属于什么格式文件
// if (last == ".pdf") {
// this.fileList.push({
// url: res.data[0].url, //pdf封面图片
// realUrl: res.data[0].url,
// fileId: res.data[0].fileId,
// name: res.data[0].fileId,
// //接口返回的pdf文件链接
// });
// } else if (
// last == ".png" ||
// last == ".jpg" ||
// last == ".jpeg" ||
// last == ".jfif"
// ) {
// this.fileList.push({
// url: res.data.result,
// realurl: res.data.result,
// fileId: res.data[0].fileId,
// name: res.data[0].fileId,
// });
// } else if (last == ".doc" || last == ".docx") {
// this.fileList.push({
// url: res.data.result,
// realurl: res.data.result,
// fileId: res.data[0].fileId,
// name: res.data[0].fileId,
// });
// } else if (last == ".xls" || last == ".xlsx") {
// this.fileList.push({
// url: res.data.result,
// realurl: res.data.result,
// fileId: res.data[0].fileId,
// name: res.data[0].fileId,
// });
// } else if (last == ".mp4" || last == ".wav") {
// this.fileList.push({
// url: res.data.result,
// realurl: res.data.result,
// fileId: res.data[0].fileId,
// name: res.data[0].fileId,
// });
// }
} else {
this.$message({
message: res.data.msg,
type: "error",
offset: 70,
});
}
});
},
// 上传前校检格式和大小
handleBeforeUpload(file) {
// 校检文件类型
this.$emit("endLoading");
this.$emit("startLoading");
return new Promise((resolve, reject) => {
var isValidated = true;
if (this.fileType && file) {
let fileExtension = "";
if (file.name.lastIndexOf(".") > -1) {
fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1);
}
const isTypeOk = this.fileType.some((type) => {
if (file.raw.type.indexOf(type) > -1) return true;
if (fileExtension && fileExtension.indexOf(type) > -1) return true;
return false;
});
if (!isTypeOk & file) {
this.$message.error(
`文件格式不正确, 请上传${this.fileType.join("/")}格式文件!`
);
this.$emit("endLoading");
isValidated = false;
}
}
// 校检文件大小
if (this.fileSize && file) {
const isLt = file.size / 1024 / 1024 < this.fileSize;
if (!isLt) {
this.$message.error(`上传文件大小不能超过 ${this.fileSize} MB!`);
isValidated = false;
}
}
if (isValidated) {
resolve(file);
} else {
reject("验证失败");
}
});
},
handleUploadError(err) {
this.$message.error("上传失败, 请重试");
},
// 文件个数超出
handleExceed() {
this.$message.error(`超出上传文件个数,请删除以后再上传!`);
},
// // 文件上传成功的钩子
// handleSuccess(res, file, fileList) {
// console.log("res", res);
// console.log("fileList", fileList);
// this.$message.success("上传成功");
// this.$emit("endLoading");
// this.changeFileList(fileList);
// },
// 文件列表移除文件时的钩子
handleRemove(file, fileList) {
this.changeFileList(fileList);
},
handleChange(file, fileList) {
// console.log(fileList);
if (file.status === "ready") {
console.log("ready");
this.handleBeforeUpload(file)
.then((res) => {
console.log("上传验证成功", res);
// this.list.push(file)
Debounce(() => {
this.totalList = fileList;
console.log('this.totalList',this.totalList);
}, 500);
// debugger;
})
.catch((err) => {
console.log("err", err);
});
}
// if (fileList.length == this.fileLimit) {
// this.uploadDisabled = true;
// }
},
// 文件列表改变的时候,更新组件的v-model的文的数据
changeFileList(fileList) {
console.log("fileList", fileList);
const tempFileList = fileList.map((item) => {
let tempItem = {
name: item.name,
url: item.response ? item.response.data[0].url : item.url,
};
return tempItem;
});
this.$emit("endLoading");
this.$emit("handleFileReady", tempFileList);
},
},
};
</script>
<style lang="scss" >
// .images-list{
// border: 1px dashed #d5d5d5;
// padding: 10px;
// border-radius: 4px;
// background: #fff;
// }
.disabled .el-upload--picture-card {
display: none !important;
}
</style>
\ No newline at end of file
......@@ -204,6 +204,7 @@ export default {
// 文件上传成功的钩子
handleSuccess(res, file, fileList) {
console.log("res", res);
console.log("fileList", fileList);
this.$message.success("上传成功");
this.$emit("endLoading");
this.changeFileList(fileList);
......
......@@ -2,16 +2,24 @@ import axios from 'axios'
import {
getToken
} from '@/utils/auth'
var uploadUrl =
process.env.NODE_ENV === "test" ||
process.env.NODE_ENV === "development" ?
"/api/sysFiles/upload" :
process.env.NODE_ENV + "/sysFiles/upload"
/**
* 封装上传文件的post方法
* @param url
* @param data
* @returns {Promise}
*/
export function upload(url, data) {
export function upload(data) {
return new Promise((resolve, reject) => {
axios.post(url, data, {
axios.post(uploadUrl, data, {
headers: {
'Content-Type': 'multipart/form-data;boundary = ' + new Date().getTime(),
'authorization': getToken(),
}
}).then(response => {
......
<template>
<el-dialog
:visible.sync="dialogVisible"
width="50%"
style="height: 98%"
:before-close="handleClose"
top="5vh"
lock-scroll
>
<div class="title" slot="title">
<div class="divider"></div>
<div class="label">{{ title }}</div>
</div>
<div class="dialog-content">
<el-main style="height: 100%">
<el-row v-if="videos.length == 1" style="height: 100%">
<el-col :span="24" style="height: 100%" class="video-container">
<video
:src="videos[0]"
style="height: auto; width: 100%"
controls
muted
loop
></video>
</el-col>
</el-row>
<el-row v-if="videos.length > 1" style="height: 100%" :gutter="16">
<template v-for="(item, index) in videos">
<el-col
:span="16"
:key="item"
v-if="index == 0"
style="height: 100%"
class="video-container"
>
<video
:src="videos[0]"
style="height: auto; width: 100%"
controls
loop
></video>
</el-col>
<el-col :span="8" :key="item" v-else>
<video
:src="videos[index]"
style="height: auto; width: 100%"
class="video-container"
controls
loop
></video>
</el-col>
</template>
</el-row>
</el-main>
<div class="dialog-footer">
<el-button type="primary" @click="handleClose">关闭</el-button>
</div>
</div>
</el-dialog>
</template>
<script>
export default {
name: "PreviewDialog",
components: {},
props: {
visible: {
type: Boolean,
default: false,
},
videos: {
type: Array,
default: () => [],
},
},
computed: {
dialogVisible: {
get: function () {
return this.visible;
},
set: function () {},
},
title() {
return "查看视频";
},
},
dicts: [],
data() {
return {};
},
async created() {
// console.log(this.videos);
},
methods: {
// 取消编辑
cancelForm() {
this.$emit("handleClose");
},
handleClose(done) {
this.$emit("handleClose");
},
},
};
</script>
<style lang='scss' scoped>
.title {
display: flex;
margin-bottom: 16px;
.divider {
width: 8px;
border-left: 4px solid #409eff;
margin-right: 8px;
}
.label {
font-weight: bold;
}
}
.dialog-content {
padding: 0 32px;
display: flex;
flex-direction: column;
.relate {
flex: 1;
}
.dialog-footer {
display: flex;
justify-content: flex-end;
}
}
.video-container {
background-color: #000;
display: flex;
justify-content: center;
}
.el-dialog__body {
padding: 0 20px 30px 20px;
}
</style>
\ No newline at end of file
......@@ -27,46 +27,56 @@
export const title = [{
prop: "name",
label: "名称",
columnAlign: 'center',
},
{
prop: "num",
label: "数量",
columnAlign: 'center',
},
{
prop: "years",
label: "年代",
columnAlign: 'center',
},
{
prop: "type",
label: "类别",
width: 100,
columnAlign: 'center',
},
{
prop: "level",
label: "级别",
columnAlign: 'center',
},
{
prop: "textureType",
label: "质地",
columnAlign: 'center',
},
{
prop: "detailSize",
label: "尺寸",
label: "文物级别",
columnAlign: 'center',
},
// {
// prop: "detailSize",
// label: "尺寸",
// columnAlign: 'center',
// },
// {
// prop: "textureType",
// label: "质地",
// columnAlign: 'center',
// },
// {
// prop: "type",
// label: "类别",
// width: 100,
// columnAlign: 'center',
// },
// {
// prop: "createId",
// label: "创建人",
// columnAlign: 'center',
// },
// {
// prop: "createTime",
// label: "创建时间",
// columnAlign: 'center',
// },
{
prop: "deptName",
label: "收藏馆名称",
columnAlign: 'center',
},
{
prop: "deptId",
prop: "deptName",
label: "馆藏单位",
columnAlign: 'center',
},
{
prop: "regionCode",
prop: "regionName",
label: "所属地",
width: 100,
columnAlign: 'center',
},
{
......@@ -76,15 +86,18 @@ export const title = [{
},
{
prop: "literature",
label: "关联文献",
prop: "themeWord",
label: "主题词",
width: 100,
columnAlign: 'center',
},
{
prop: "collectCount",
label: "收藏量",
prop: "num",
label: "数量",
width: 100,
columnAlign: 'center',
},
{
prop: "loveCount",
label: "点赞量",
......@@ -92,38 +105,41 @@ export const title = [{
columnAlign: 'center',
},
{
prop: "region",
label: "所在地区",
width: 100,
prop: "browseCount",
label: "浏览量",
columnAlign: 'center',
},
{
prop: "remark",
label: "备注",
width: 100,
prop: "collectCount",
label: "收藏量",
columnAlign: 'center',
},
{
prop: "status",
label: "状态",
prop: "sourceWay",
label: "来源方式",
width: 100,
columnAlign: 'center',
isStatus: true
},
{
prop: "themeType",
label: "模板主题",
prop: "status",
label: "上下架状态",
width: 100,
columnAlign: 'center',
isStatus: true
},
{
prop: "videos",
label: "展览视频",
prop: "remark",
label: "备注",
width: 100,
columnAlign: 'center',
},
// directory 文件夹
// flag3d 是否有3d图片
// updateId 更新人
]
export const operates = {
......@@ -149,21 +165,3 @@ export const operations = [{
},
]
export const literatureTableTitle=[
{
prop: "name",
label: "文献名称",
columnAlign: 'center',
},
{
prop: "authors",
label: "作者",
columnAlign: 'center',
},
{
prop: "remark",
label: "备注",
columnAlign: 'center',
},
]
\ No newline at end of file
......@@ -2,13 +2,16 @@
<div class="app-container">
<div class="top-bar">
<SearchBar :config="searchConfig" @search="search" @reset="reset" />
<el-button type="primary" @click.native="handleOpenDialog('add')">
<el-button
type="primary"
@click.native="handleOperation({ type: 'add' })"
>
<i class="el-icon-s-promotion"></i>
发布</el-button
>
</div>
<TablePage
:data="list.record"
:data="list.records"
:tableTitle="tableTitle"
:operates="tableOperates"
>
......@@ -20,6 +23,18 @@
<el-switch slot="reference" :value="data.scope.status"></el-switch>
</el-popconfirm>
</template>
<template v-slot:years="data">
{{ dict.cultural_relic_years[data.scope.years] }}
</template>
<template v-slot:level="data">
{{ dict.cultural_relic_level[data.scope.level] }}
</template>
<template v-slot:textureType="data">
{{ dict.cultural_relic_texture[data.scope.textureType] }}
</template>
<template v-slot:type="data">
{{ dict.cultural_relic_type[data.scope.type] }}
</template>
<template v-slot:operates="scope">
<TableOperation
:operations="tableOperations"
......@@ -51,7 +66,7 @@
import TablePage from "@/components/Table/TablePage.vue";
import TableOperation from "@/components/Table/TableOperation.vue";
import { title, operates, operations } from "./config";
import { getList } from "@/api/display";
import { getCulturalRelicList } from "@/api/culturalRelic";
import InfoEditDialog from "./components/InfoEditDialog";
import SearchBar from "@/components/SearchBar";
......@@ -62,6 +77,12 @@ export default {
InfoEditDialog,
SearchBar,
},
dicts: [
"cultural_relic_years",
"cultural_relic_level",
"cultural_relic_texture",
"cultural_relic_type"
],
data() {
return {
list: {
......@@ -78,7 +99,13 @@ export default {
{
prop: "name",
type: "input",
label: "展览名称",
label: "文物名称",
},
{
prop: "name",
type: "input",
label: "文物级别",
selectOptions:[]
},
{
prop: "status",
......@@ -99,25 +126,42 @@ export default {
drawerVisible: false,
isAdd: true,
form: {
title: "", //标题
type: "", // 类别(待定)--枚举值(社会、生活等)
character: 1, //展览性质(精品展2、布展1、文物展3)--此处填写布展类别
keyword: "", // 关键词
deptId: "", //展览单位id--暂填入用户自己的单位
regionCode: "", // 所在地域--暂填入用户自己的地区
intro: "", //展览介绍,
themeType: "", //模板主题--前端枚举
literature: "", //关联文献。id1,id2,id3--接口查询
name: "", //名称
type: "", //类别(字典值)
level: "", //文物级别(字典值)
textureType: "", //质地(字典值)
detailSize: "", // 具体尺寸
years: "", //年代
num: "", //数量
// deptId:'',//收藏馆id——传当前用户的deptId
intro: "", //馆藏介绍
literature: "", //关联文献。id1,id2,id3
// directory:'',// 文件夹(字母或者数字命名)
// regionCode:'',//所属地(分号分隔的编号)——传当前用户的regionCode
sourceWay: "", //来源方式
sayExplain: "", //讲解词文件。文件id
status: "", //上下架状态(0-下架,1-上架)
// flag3d:'',//是否有3D图片(字典值:1-有;0-无)
themeWord: "", //主题词
url3d: "", //3durl链接
remark: "", //备注
status: false, //上下架状态(0-下架,1-上架)
faceImage: "", // 封面(图片1张)
images: "", //展览图片
videos: "", //展览视频
audios: "", //展览音频
audios: "", //音频文件(文件id)
images: "", //图片文件(文件id,多个以逗号隔开)
videos: "", //视频文件(文件id)
},
loading: false,
};
},
watch: {
dict(value) {
if (value) {
this.dict = value;
this.culturalLevel = []
console.log("this.dict ", this.dict);
}
},
},
computed: {
tableTitle() {
return title;
......@@ -150,7 +194,7 @@ export default {
limit: this.list.size,
...form,
};
let res = await getList(params);
let res = await getCulturalRelicList(params);
if (res.code == 0) {
this.list = res.data;
}
......@@ -166,18 +210,25 @@ export default {
page: this.list.current,
limit: this.list.size,
};
let res = await getList(params);
let res = await getCulturalRelicList(params);
if (res.code == 0) {
// debugger
this.list = res.data;
}
},
handleOperation(value, row) {
async handleOperation(value, row) {
console.log("handleOperation", value, row);
switch (value.type) {
case "add":
this.drawerVisible = true;
break;
case "view":
break;
case "edit":
this.drawerVisible = true;
// 查询接口,并复制给form
// this.loading = true;
// let res = await getRCDetailById;
// this.drawerVisible = true;
break;
// case "delete":
// break;
......
......@@ -274,7 +274,7 @@ export default {
}
},
},
dicts: ["display_character", "display_type"],
dicts: ["display_character", "display_type",'literature'],
data() {
return {
dialogForm: {
......@@ -299,7 +299,6 @@ export default {
console.log("22222this.dict", this.dict);
})
},
dicts: ["literature"],
methods: {
covertStrToArr(name) {
var fileName = "";
......
......@@ -171,16 +171,16 @@ export default {
displayTypes: {},
};
},
watch: {
dict(value) {
if (value) {
console.log("value.display_type", value.display_type);
value.display_type.map((item) => {
this.displayTypes[item.value] = item.label;
});
}
},
},
// watch: {
// dict(value) {
// if (value) {
// // value.display_type.map((item) => {
// // this.displayTypes[item.value] = item.label;
// // });
// }
// },
// },
computed: {
tableTitle() {
return title;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论