From 64f5e99714650f54b56a69cc58c823b46c21a54e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E7=95=85?= Date: Sun, 12 Sep 2021 00:35:39 +0800 Subject: [PATCH] add --- src/views/sce/sceInfo/index.vue | 375 +++++++++++++++++++++++--------- src/views/sce/tips/index.vue | 21 +- src/views/user/index.vue | 250 +++++++++++++++++---- 3 files changed, 500 insertions(+), 146 deletions(-) diff --git a/src/views/sce/sceInfo/index.vue b/src/views/sce/sceInfo/index.vue index 8f377c5..59e3b36 100644 --- a/src/views/sce/sceInfo/index.vue +++ b/src/views/sce/sceInfo/index.vue @@ -112,10 +112,7 @@

剧本图片

- - - +

剧本简介

- + - +

开本流程

新建新增

剧本资源

@@ -240,13 +242,12 @@

-

- {{ item.processName }} +
+
+ 关联流程
@@ -310,6 +314,8 @@ 新建新增
@@ -373,7 +379,7 @@
@@ -382,13 +388,19 @@

- {{ item.processName }} +
+
+ 关联流程
@@ -443,6 +455,8 @@ 新建新增
@@ -509,7 +523,7 @@
@@ -524,7 +538,13 @@

- {{ item.processName }} +
+
+ 关联流程
@@ -579,6 +599,8 @@ 新建新增 @@ -706,7 +728,8 @@ export default { title: [{ required: true, message: "请输入标题名称", trigger: "blur" }], labelName: [ { required: true, message: "请输入标签名称", trigger: "blur" } - ] + ], + cover: [{ required: true, message: "请选择封面", trigger: "blur" }] }, dialog: { title: "新增剧本", @@ -741,7 +764,14 @@ export default { Visible: false }, list: {}, - typeUrl: "" + typeUrl: "", + imgType: false, + musicType: false, + videoType: false, + imgIndex: "", + musicIdnex: "", + videoIndex: "", + dataList: {} }; }, mounted() { @@ -756,6 +786,15 @@ export default { } } }, + ForChannel(e) { + console.log(e); + console.log(this.ruleForm.processesList); + for (var i = 0; i < this.ruleForm.processesList.length; i++) { + if (this.ruleForm.processesList[i].code == e) { + return this.ruleForm.processesList[i].title; + } + } + }, //获取列表 async queryList() { this.loading = true; @@ -805,17 +844,60 @@ export default { this.ruleForm.radioImg = []; this.ruleForm.radioMusic = []; this.ruleForm.radioVideo = []; - let a = res.data.resourcesList.map(n => { - if (n.mediaType == 1) { - this.ruleForm.radioImg.push(n); + res.data.resourcesList.map(n => { + var a = [] + var b = [] + var c = [] + if (n.mediaType == 1 && n.sourceType == 2) { + a.push(n) + this.ruleForm.radioImg = a.map(n => { + return { + mediaType: n.mediaType, + sourceType: n.sourceType, + title: n.title, + url: n.url, + processId: n.processId.split(',') + }; + }); + this.radioImg = n.sourceType; + } else if (n.mediaType == 1 && n.sourceType == 1) { + a.push(n); + this.imgData = a this.radioImg = n.sourceType; } - if (n.mediaType == 2) { - this.ruleForm.radioMusic.push(n); + if (n.mediaType == 2 && n.sourceType == 1) { + b.push(n) + this.musicData = b + this.radioMusic = n.sourceType; + } else if (n.mediaType == 2 && n.sourceType == 2) { + console.log('进来了1') + b.push(n) + this.ruleForm.radioMusic = b.map(n => { + return { + mediaType: n.mediaType, + sourceType: n.sourceType, + title: n.title, + url: n.url, + processId: n.processId.split(',') + }; + }); this.radioMusic = n.sourceType; } - if (n.mediaType == 3) { - this.ruleForm.radioVideo.push(n); + if (n.mediaType == 3 && n.sourceType == 1) { + c.push(n) + this.videoData = c + this.radioVideo = n.sourceType; + } else if (n.mediaType == 3 && n.sourceType == 2) { + c.push(n) + this.ruleForm.radioVideo = c.map(n => { + return { + mediaType: n.mediaType, + sourceType: n.sourceType, + title: n.title, + url: n.url, + processId: n.processId.split(',') + }; + }); this.radioVideo = n.sourceType; } }); @@ -842,34 +924,102 @@ export default { this.dialog.title = "新增剧本"; }, async subMit() { + console.log(this.imgType, this.musicType, this.videoType); + console.log(this.radioImg, this.radioMusic, this.radioVideo); + if (this.imgType == true && this.radioImg == 1) { + this.$message({ + message: "请绑定图片相关流程", + type: "error" + }); + return false; + } + if (this.musicType == true && this.radioMusic == 1) { + this.$message({ + message: "请绑定音频相关流程", + type: "error" + }); + return false; + } + if (this.videoType == true && this.radioVideo == 1) { + this.$message({ + message: "请绑定视频相关流程", + type: "error" + }); + return false; + } this.ruleForm.imgUrl = this.dataImg.join(","); - this.ruleForm.resourcesList = this.ruleForm.resourcesList - .concat(this.ruleForm.radioImg) + if (this.radioImg == 1) { + this.ruleForm.radioImg = this.imgData; + } + if (this.radioMusic == 1) { + this.ruleForm.radioMusic = this.musicData; + } + if (this.radioVideo == 1) { + this.ruleForm.radioVideo = this.videoData; + } + let data = this.ruleForm.radioImg .concat(this.ruleForm.radioMusic) .concat(this.ruleForm.radioVideo); + let list = []; + data.map(n => { + if (n.url != "") { + list.push(n); + } + }); + this.ruleForm.resourcesList = list.map(n => { + return { + mediaType: n.mediaType, + sourceType: n.sourceType, + title: n.title, + url: n.url, + processId: n.processId.join(",") + }; + }); + console.log(this.imgData, "有变化吗"); console.log(this.ruleForm, "参数"); - // try { - // let res = await addJbInfo(this.ruleForm); - // if (res.code == 200) { - // this.$message.success("新增成功"); - // this.dialog.Visible = false; - // this.queryList(); - // } else { - // this.$message({ - // message: res.msg, - // type: "error" - // }); - // } - // } catch (err) { - // console.log(err); - // } + try { + this.$refs["ruleForm"].validate(async valid => { + if (valid) { + if (this.type == "add") { + var res = await addJbInfo(this.ruleForm); + } else if (this.type == "edit") { + var res = await updateJbInfo(this.ruleForm); + } + if (res.code == 200) { + this.$message.success("新增成功"); + this.dialog.Visible = false; + this.queryList(); + } else { + this.$message({ + message: res.msg, + type: "error" + }); + } + } + }); + } catch (err) { + console.log(err); + } + }, + dealRdata(attchments, keyname) { + //attchments:数组,键值 + let list = [...attchments]; + let result = []; + let obj = {}; + for (let i = 0; i < list.length; i++) { + if (!obj[list[i][keyname]]) { + result.push(list[i]); + obj[list[i].wjDx] = true; + } + } + return result; }, // 编辑 handleEdit(row) { - console.log(row); + this.queryListDetail(row.id); this.dialog.Visible = true; + this.type = "edit"; this.dialog.title = "编辑剧本"; - this.ruleForm = row; }, // 查看 handleView(row) { @@ -983,19 +1133,34 @@ export default { }, changeImg(val) { this.radioImg = val; + this.ruleForm.radioImg = []; + this.imgData = []; }, changeMusic(val) { this.radioMusic = val; + this.ruleForm.radioMusic = []; + this.musicData = []; }, changeVideo(val) { this.radioVideo = val; + this.ruleForm.radioVideo = []; + this.videoData = []; + }, + changePro(type) { + if (type == "img") { + this.imgType = false; + } else if (type == "music") { + this.musicType = false; + } else if (type == "video") { + this.videoType = false; + } }, //新增图片资源 handleAddImg() { this.ruleForm.radioImg.push({ title: "", url: "", - processId: "", + processId: [], mediaType: 1, sourceType: this.radioImg }); @@ -1004,7 +1169,7 @@ export default { this.ruleForm.radioMusic.push({ title: "", url: "", - processId: "", + processId: [], mediaType: 2, sourceType: this.radioMusic }); @@ -1013,7 +1178,7 @@ export default { this.ruleForm.radioVideo.push({ title: "", url: "", - processId: "", + processId: [], mediaType: 3, sourceType: this.radioVideo }); @@ -1023,45 +1188,39 @@ export default { const formdata = new FormData(); formdata.append("file", file); formdata.append("type", "product"); - uploadFile(formdata).then(res => { - this.imgData.push(res.data.wjUrl); - // this.ruleForm.radioImg.push({ - // title:'图片', - // url: res.data.wjUrl, - // mediaType: 1, - // sourceType: this.radioImg - // }); + this.imgData.push({ + url: res.data.wjUrl, + processName: "", + title: "" + }); + this.imgType = true; }); }, labeluploadmusic({ file }) { const formdata = new FormData(); formdata.append("file", file); formdata.append("type", "product"); - uploadFile(formdata).then(res => { - this.musicData.push(res.data.wjUrl); - // this.ruleForm.radioMusic.push({ - // title:'音乐', - // url: res.data.wjUrl, - // mediaType: 2, - // sourceType: this.radioMusic - // }); + this.musicData.push({ + url: res.data.wjUrl, + processName: "", + title: "" + }); + this.musicType = true; }); }, labeluploadvideo({ file }) { const formdata = new FormData(); formdata.append("file", file); formdata.append("type", "product"); - uploadFile(formdata).then(res => { - this.videoData.push(res.data.wjUrl); - // this.ruleForm.radioVideo.push({ - // title:'视频', - // url: res.data.wjUrl, - // mediaType: 3, - // sourceType: this.radioVideo - // }); + this.videoData.push({ + url: res.data.wjUrl, + processName: "", + title: "" + }); + this.musicType = true; }); }, // 图片删除 @@ -1077,57 +1236,63 @@ export default { this.videoData.splice(index, 1); } console.log(item); - delFile({ wjUrl: item }).then(res => { + delFile({ wjUrl: item.url }).then(res => { if (res.code == 200) { this.$message.success("删除成功"); } }); }, //关联流程 - setLc(item, type) { + setLc(item, i, type) { + console.log(item, i, this.imgData); + if (this.ruleForm.processesList.length == 0) { + this.$message({ + message: "请新建流程", + type: "error" + }); + return false; + } + if (type == "img") { + this.imgIndex = i; + } else if (type == "music") { + this.musicIdnex = i; + } else if (type == "video") { + this.videoIndex = i; + } this.list = item; this.typeUrl = type; - console.log(this.typeUrl); this.processId = ""; this.process.Visible = true; }, subMitLc() { this.process.Visible = false; if (this.typeUrl == "img") { - let data = { - title: "", - url: this.list, - processId: this.processId, - mediaType: 1, - sourceType: this.radioImg - }; - this.ruleForm.radioImg.push(data); + this.imgType = false; + this.imgData[this.imgIndex].processName = this.ForChannel( + this.processId + ); + this.imgData[this.imgIndex].processId = [this.processId]; + this.imgData[this.imgIndex].mediaType = 1; + this.imgData[this.imgIndex].sourceType = this.radioImg; } if (this.typeUrl == "music") { - let data = { - title: "", - url: this.list, - processId: this.processId, - mediaType: 2, - sourceType: this.radioMusic - }; - this.ruleForm.radioMusic.push(data); + this.musicType = false; + this.musicData[this.imgIndex].processName = this.ForChannel( + this.processId + ); + this.musicData[this.musicIndex].processId = [this.processId]; + this.musicData[this.musicIndex].mediaType = 2; + this.musicData[this.musicIndex].sourceType = this.radioImg; } if (this.typeUrl == "video") { - let data = { - title: "", - url: this.list, - processId: this.processId, - mediaType: 3, - sourceType: this.radioVideo - }; - this.ruleForm.radioVideo.push(data); + this.videoType = false; + this.videoData[this.videoIndex].processName = this.ForChannel( + this.processId + ); + this.videoData[this.videoIndex].processId = [this.processId]; + this.videoData[this.videoIndex].mediaType = 3; + this.videoData[this.videoIndex].sourceType = this.radioImg; } - console.log( - this.ruleForm.radioImg, - this.ruleForm.radioVideo, - this.ruleForm.radioMusic - ); } } }; diff --git a/src/views/sce/tips/index.vue b/src/views/sce/tips/index.vue index 44dc977..6c3530e 100644 --- a/src/views/sce/tips/index.vue +++ b/src/views/sce/tips/index.vue @@ -8,6 +8,8 @@ v-model="queryParams.query.scenarioId" clearable placeholder="请选择剧本标题" + @change="chageLc" + @visible-change='foucsLc' >
- 搜索 重置 - + + + - - + + + + + +