| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246 |
- <!-- -->
- <template>
- <div class="template">
- <div class="top">
- <div class="location">数据管理 | 项目资料 | <span>编辑</span></div>
- </div>
- <div class="conten">
- <div class="search">
- <div class="txt">{{ titleName }}</div>
- <ul>
- <li
- v-for="(item, index) in topTab"
- :key="index"
- :class="{ active: topTabInd === index }"
- @click="tabCut(index)"
- >
- {{ item }}
- </li>
- </ul>
- </div>
- <!-- 项目详情 -->
- <div class="tab" v-show="topTabInd === 0">
- <div class="title">项目详情</div>
- <div class="from">
- <el-form
- :model="ruleForm"
- :rules="rules"
- ref="ruleForm"
- label-width="100px"
- class="demo-ruleForm"
- >
- <el-form-item label="项目名称:" prop="name">
- <el-input
- maxlength="32"
- show-word-limit
- v-model="ruleForm.name"
- placeholder="请输入项目名称"
- ></el-input>
- </el-form-item>
- <el-form-item label="项目时间:">
- <el-input
- maxlength="32"
- show-word-limit
- v-model="ruleForm.age"
- placeholder="请输入项目时间"
- ></el-input>
- </el-form-item>
- <el-form-item label="项目分类:">
- <el-select v-model="ruleForm.typeId">
- <el-option
- v-for="item in projectType"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="展示形式:">
- <el-select v-model="ruleForm.application">
- <el-option label="网页端" value="web"></el-option>
- <el-option label="移动端" value="app"></el-option>
- <el-option
- label="网页端 + 移动端"
- value="webAndApp"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="应用技术:">
- <el-select v-model="ruleForm.technology">
- <el-option label="实景拍摄" value="live"></el-option>
- <el-option label="虚拟建模" value="virtual"></el-option>
- <el-option label="四维看看" value="4dkk"></el-option>
- <el-option label="物体建模" value="model"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="保密级别:">
- <el-select v-model="ruleForm.level">
- <el-option label="一般--所有人可查阅" :value="1"></el-option>
- <el-option
- label="秘密--查阅人为公司内部所有员工,经过允许可对外分享"
- :value="2"
- ></el-option>
- <el-option
- label="机密--查阅人为管理员、项目负责人、获得允许的员工"
- :value="3"
- ></el-option>
- <el-option
- label="绝密--查阅人仅为管理员、项目负责人"
- :value="4"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="项目合作方:">
- <el-input
- maxlength="32"
- show-word-limit
- v-model="ruleForm.cooperation"
- placeholder="请输入项目合作方"
- ></el-input>
- </el-form-item>
- </el-form>
- </div>
- </div>
- <!-- 项目网址 -->
- <div class="tab" v-show="topTabInd === 1">
- <div class="title">项目网址</div>
- <div class="row" v-for="(item, index) in tab1Arr" :key="index">
- <el-input
- maxlength="32"
- show-word-limit
- v-model="tab1Arr[index].name"
- placeholder="网址名称"
- style="width: 200px; margin-right: 20px"
- ></el-input>
- <el-input
- maxlength="128"
- show-word-limit
- v-model="tab1Arr[index].url"
- placeholder="URL网址链接"
- style="width: 500px"
- ></el-input>
- <i
- class="el-icon-circle-close"
- @click="tab1Del(index, item.id)"
- v-if="index !== 0"
- ></i>
- <div class="tab_btn" @click="tab1Add" v-else>+ 添加网址</div>
- </div>
- </div>
- <!-- 三维场景 -->
- <div class="tab" v-show="topTabInd === 2">
- <div class="title">三维场景</div>
- <div class="row" v-for="(item, index) in tab2Arr" :key="index">
- <el-input
- maxlength="32"
- show-word-limit
- v-model="tab2Arr[index].name"
- placeholder="网址名称"
- style="width: 200px; margin-right: 20px"
- ></el-input>
- <el-input
- maxlength="128"
- show-word-limit
- v-model="tab2Arr[index].url"
- placeholder="URL网址链接"
- style="width: 500px"
- ></el-input>
- <el-input
- maxlength="32"
- show-word-limit
- v-model="tab2Arr[index].remark"
- placeholder="场景标签"
- style="width: 200px; margin-left: 20px"
- ></el-input>
- <i
- class="el-icon-circle-close"
- @click="tab2Del(index, item.id)"
- v-if="index !== 0"
- ></i>
- <div class="tab_btn" @click="tab2Add" v-else>+ 添加网址</div>
- </div>
- </div>
- <!-- 资料文档 -->
- <div class="tab" v-show="topTabInd === 3">
- <div class="title" style="margin-bottom: 20px">资料文档</div>
- <el-upload
- class="upload-demo"
- drag
- :action="baseURL + '/cms/doc/upload'"
- :headers="{ token }"
- :before-upload="beforeFujian"
- :on-success="successFujian"
- :show-file-list="true"
- multiple
- >
- <i class="el-icon-upload"></i>
- <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
- <div class="el-upload__tip" slot="tip">
- <!-- 只能上传jpg/png文件,且不超过500kb -->
- </div>
- </el-upload>
- <!-- 上传成功后的数组数据 -->
- <div class="upFJSucc">
- <div v-for="(item, index) in fuJianArr" :key="index">
- <span>{{ item.name }}</span>
- <i class="el-icon-close" @click="delFJ(index, item.id)"></i>
- </div>
- </div>
- </div>
- <!-- 文物 -->
- <div class="tab" v-show="topTabInd === 4">
- <div class="title">文物</div>
- <div class="imgBox">
- <div
- v-for="(item, index) in saveAntiqueArr"
- :key="index"
- @mouseenter="moveShowIdn = index"
- @mouseleave="moveShowIdn = null"
- >
- <img :src="baseURL + item.thumb" alt="" :onerror="defaultImg" />{{
- item.name
- }}
- <!-- 鼠标移上去显示的盒子 -->
- <div class="moveShow" v-show="moveShowIdn === index">
- <i class="el-icon-edit" @click="outEditAntique(item.id)"></i>
- <i
- class="el-icon-delete"
- @click="outDelAntique(index, item.id)"
- ></i>
- </div>
- </div>
- <!-- 点击文物+号新增文物 -->
- <div class="uploaImg" @click="addAntique">+</div>
- </div>
- </div>
- </div>
- <!-- 底部按钮 -->
- <div class="button_btn">
- <div @click="$router.go(-1)">返 回</div>
- <div class="edit" @click="outBtnOk(false)">保 存</div>
- </div>
- <!-- 点击 文物 的+号出现弹出层 -->
- <el-dialog
- :title="addForm.id ? '编辑文物' : '添加文物'"
- :visible.sync="addIsShow"
- @close="addBtnX()"
- >
- <el-form
- :model="addForm"
- :rules="addRules"
- ref="addForm"
- label-width="100px"
- class="demo-ruleForm"
- >
- <el-form-item label="名称:" prop="name">
- <el-input
- maxlength="50"
- show-word-limit
- v-model="addForm.name"
- placeholder="请输入名称"
- style="width: 500px"
- ></el-input>
- </el-form-item>
- <el-form-item label="链接:" prop="url">
- <el-input
- maxlength="128"
- show-word-limit
- style="width: 500px"
- v-model="addForm.url"
- placeholder="请输入网址链接"
- ></el-input>
- </el-form-item>
- <el-form-item label="文物类别:">
- <el-select v-model="addForm.goodsTypeId">
- <el-option
- v-for="item in antiqueArr"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="文物标签:">
- <el-input
- maxlength="50"
- show-word-limit
- v-model="addForm.remark"
- placeholder="请输入文物标签"
- style="width: 500px"
- ></el-input>
- </el-form-item>
- <el-form-item label="文物图片:" class="myImgBox">
- <div class="upImgBox">
- <div
- class="imgdiv"
- :class="{ active: fengmianInd === index }"
- v-for="(item, index) in imgList"
- :key="index"
- @mouseenter="imgIconInd = index"
- @mouseleave="imgIconInd = null"
- >
- <img
- style="width: 100%; height: 100%"
- :src="baseURL + item.thumb"
- :onerror="defaultImg"
- />
- <div class="imgIcon" v-show="index === imgIconInd">
- <i class="el-icon-zoom-in" @click="lookImg(item.thumb)"></i>
- <a :href="baseURL + item.thumb" target="_blank" download
- ><i class="el-icon-download"></i
- ></a>
- <i class="el-icon-delete" @click="delImg(index)"></i>
- <span
- @click="modelSetIndex(item.id, index, item.thumb)"
- v-if="fengmianInd !== index"
- >设置封面</span
- >
- </div>
- </div>
- <el-upload
- drag
- class="avatar-uploader"
- :action="baseURL + '/cms/goods/upload'"
- :headers="{ token }"
- :show-file-list="false"
- :before-upload="beforethumbUpload"
- :on-success="upload_thumb_success"
- >
- <div class="upImg">
- <i slot="default" class="el-icon-plus"></i>
- </div>
- </el-upload>
- </div>
- </el-form-item>
- <span style="margin-left: 100px"
- >支持png / jpg / gif / jpeg的图片格式,最大支持20M。</span
- >
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="addBtnX">取 消</el-button>
- <el-button type="primary" @click="addBtnOk">保 存</el-button>
- </div>
- </el-dialog>
- <!-- 点击查看图片 -->
- <div class="lookImg" v-if="dialogImageIshow">
- <img :src="baseURL + dialogImageUrl" alt="" :onerror="defaultImg" />
- <div class="imgBtnX" @click="dialogImageIshow = false">关 闭</div>
- </div>
- </div>
- </template>
- <script>
- import axios from '@/utils/request'
- import {
- getProjectType,
- getDetail,
- projectEdit1,
- editScene,
- editDoc,
- getAntiqueById,
- getGoodsType,
- modelSetIndex,
- modelSave,
- editGoods
- } from '@/apis/tab1'
- export default {
- name: 'tab1_edit',
- components: {},
- data () {
- // 这里存放数据
- return {
- titleName: '', // 标题名字
- topTabInd: 0,
- topTab: ['项目详情', '项目网址', '三维场景', '资料文档', '文物'],
- baseURL: '',
- token: '',
- ruleForm: {
- name: '',
- age: '',
- typeId: '',
- application: '',
- technology: '',
- level: '',
- cooperation: ''
- },
- // 项目分类数组
- projectType: [],
- rules: {
- name: { required: true, message: '请输入项目名称', trigger: 'blur' }
- },
- // 项目网址数据
- tab1Arr: [{ name: '', url: '' }],
- tab1ArrDel: [],
- // 三维场景数据
- tab2Arr: [{ name: '', url: '' }],
- tab2ArrDel: [],
- // 资料文档数据
- fuJianArr: [],
- fuJianArrDel: [],
- // 文物数据
- saveAntiqueArrDel: [],
- saveAntiqueArr: [],
- moveShowIdn: null,
- addIsShow: false,
- // 文物数据---弹窗
- antiqueArr: [],
- fengmianInd: 0,
- imgIconInd: null,
- imgList: [],
- dialogImageIshow: false,
- addForm: {
- fileIds: '', // 图片id, 多个以逗号隔开
- name: '', // 名称
- url: '', // 链接
- goodsTypeId: null, // 文物类型id
- // projectId: '', // 项目id
- remark: '', // 文物标签
- thumb: '' // 封面
- },
- addRules: {
- name: [
- { required: true, message: '不能为空', trigger: 'blur' },
- { max: 50, message: '不能超过50个字', trigger: 'blur' }
- ],
- url: { required: true, message: '不能为空', trigger: 'blur' }
- },
- // 计数监听数据有没有改变
- cuontChange1: 0,
- cuontChange2: 0,
- cuontChange3: 0,
- cuontChange4: 0,
- cuontChange5: 0
- }
- },
- // 监听属性 类似于data概念
- computed: {},
- // 监控data中的数据变化
- watch: {
- ruleForm: {
- handler (newv) {
- this.cuontChange1++
- },
- deep: true
- },
- tab1Arr: {
- handler (newv) {
- this.cuontChange2++
- },
- deep: true
- },
- tab2Arr: {
- handler (newv) {
- this.cuontChange3++
- },
- deep: true
- },
- fuJianArr: {
- handler (newv) {
- this.cuontChange4++
- },
- deep: true
- },
- saveAntiqueArr: {
- handler (newv) {
- this.cuontChange5++
- },
- deep: true
- }
- },
- // 方法集合
- methods: {
- // ----------------文物弹窗里面---------------
- beforethumbUpload (file) {
- // console.log('上传文件前校验', file)
- // 限制图片大小和格式
- const sizeOk = file.size / 1024 / 1024 < 20
- const typeOk =
- file.type === 'image/png' ||
- file.type === 'image/jpeg' ||
- file.type === 'image/gif'
- return new Promise((resolve, reject) => {
- if (!typeOk) {
- this.$message.error('照片格式有误!')
- reject(file)
- } else if (!sizeOk) {
- this.$message.error('照片大小超过20M!')
- reject(file)
- } else if (file.name.length > 32) {
- this.$message.error('照片名字不能超过32个字')
- reject(file)
- } else {
- resolve(file)
- }
- })
- },
- async upload_thumb_success (data) {
- this.$message.success('上传成功')
- // console.log('上传文件成功', data)
- this.imgList.push({
- thumb: data.data.filePath,
- name: data.data.fileName,
- id: data.data.fileId
- })
- // 把第一张的url设置为封面---如果是新增
- // if (!this.addForm.id || this.imgList.length === 1) this.addForm.thumb = this.imgList[0].url
- if (this.imgList.length === 1) {
- await modelSetIndex(data.data.fileId)
- this.fengmianInd = 0
- this.addForm.thumb = this.imgList[0].thumb
- }
- // this.loading = false
- // this.ruleForm.thumb = data.data.filePath
- },
- delImg (index) {
- // 点击删除
- this.$confirm('确定删除吗?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- })
- .then(() => {
- this.imgList.splice(index, 1)
- if (index === this.fengmianInd) {
- // 删除的是封面
- this.fengmianInd = null
- this.addForm.thumb = ''
- }
- this.$message.success('删除成功!')
- })
- .catch(() => {
- this.$message.info('已取消删除')
- })
- },
- // 点击放大镜,查看图片
- lookImg (url) {
- this.dialogImageUrl = url
- this.dialogImageIshow = true
- },
- // 点击设置为封面
- async modelSetIndex (id, index, url) {
- const res = await modelSetIndex(id)
- if (res.code === 0) {
- this.fengmianInd = index
- this.$message.success('设置封面成功')
- this.addForm.thumb = url
- }
- },
- // 点击弹窗里面的保存
- async addBtnOk () {
- if (this.addForm.name.trim() === '') {
- return this.$message.warning('文物名称不能为空')
- }
- if (this.addForm.url.trim() === '') {
- return this.$message.warning('文物链接不能为空')
- }
- const temp = []
- this.imgList.forEach((v) => {
- temp.push(v.id)
- })
- this.addForm.fileIds = temp.join(',')
- // console.log(999, this.addForm)
- const res = await modelSave(this.addForm)
- if (res.code === 0) {
- if (!this.addForm.id) {
- // 新增的push进去
- this.saveAntiqueArr.push({
- id: res.data.id,
- name: res.data.name,
- thumb: res.data.thumb
- })
- } else {
- // 修改的改变之前的数组
- this.saveAntiqueArr.forEach((v) => {
- if (v.id === this.addForm.id) {
- v.name = res.data.name
- v.thumb = res.data.thumb
- }
- })
- }
- this.$message.success('保存成功')
- this.addBtnX()
- }
- // console.log(999, res)
- },
- // 点击弹窗里面的取消
- addBtnX () {
- // 清空情况表单校验
- this.$refs.addForm.resetFields()
- this.addForm = {
- fileIds: '', // 图片id, 多个以逗号隔开
- name: '', // 名称
- url: '', // 链接
- goodsTypeId: null, // 文物类型id
- // projectId: '', // 项目id
- thumb: '' // 封面
- }
- this.imgList = []
- this.addIsShow = false
- },
- // -------------点击外层文物-------------------
- // 点击文物+号新增文物
- async addAntique () {
- this.addIsShow = true
- // 把封面默认变成第一个
- this.fengmianInd = 0
- },
- // 编辑
- async outEditAntique (id) {
- const res = await getAntiqueById(id)
- // console.log(999, res)
- this.addForm = res.data.entity
- res.data.file.forEach((v, i) => {
- this.imgList.push({
- thumb: v.filePath,
- name: v.name,
- id: v.id
- })
- // index为1的是首页图片
- if (v.isIndex === 1) this.fengmianInd = i
- })
- this.addIsShow = true
- },
- // 删除
- outDelAntique (index, id) {
- this.$confirm('确定删除吗?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- })
- .then(() => {
- this.saveAntiqueArr.splice(index, 1)
- this.saveAntiqueArrDel.push(id)
- this.$message.success('删除成功!')
- })
- .catch(() => {
- this.$message.info('已取消删除')
- })
- },
- // --------------附件--------------
- beforeFujian (file) {
- return new Promise((resolve, reject) => {
- if (file.name.length > 32) {
- this.$message.error('附件名字不能超过32个字')
- reject(file)
- } else {
- resolve(file)
- }
- })
- },
- successFujian (file) {
- console.log('上传附件成功', file)
- if (file.code === 0) {
- this.fuJianArr.push({ name: file.data.name, id: file.data.id })
- this.$message.success('上传成功')
- } else if (file.code === -1) {
- this.$message.warning('上传失败,不支持的文件格式')
- }
- },
- // 删除附件
- delFJ (index, id) {
- // 点击删除
- this.$confirm('确定删除吗?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- })
- .then(() => {
- this.fuJianArr.splice(index, 1)
- this.fuJianArrDel.push(id)
- this.$message.success('删除成功!')
- })
- .catch(() => {
- this.$message.info('已取消删除')
- })
- },
- // 项目网址
- tab1Add () {
- if (
- this.tab1Arr[this.tab1Arr.length - 1].name.trim() === '' ||
- this.tab1Arr[this.tab1Arr.length - 1].url.trim() === ''
- ) {
- return this.$message.warning('网址名称或链接不能为空')
- }
- if (this.tab1Arr[this.tab1Arr.length - 1].name.length > 32) {
- return this.$message.warning('网址名称不能超过32个字')
- }
- if (this.tab1Arr[this.tab1Arr.length - 1].url.length > 128) {
- return this.$message.warning('网址链接不能超过128个字')
- }
- this.tab1Arr.push({ name: '', url: '', id: null })
- },
- tab1Del (index, id) {
- this.$confirm('确定删除吗?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- })
- .then(() => {
- this.tab1Arr.splice(index, 1)
- if (id) this.tab1ArrDel.push(id)
- this.$message.success('删除成功!')
- })
- .catch(() => {
- this.$message.info('已取消删除!')
- })
- },
- // 三维场景
- tab2Add () {
- if (
- this.tab2Arr[this.tab2Arr.length - 1].name.trim() === '' ||
- this.tab2Arr[this.tab2Arr.length - 1].url.trim() === ''
- ) {
- return this.$message.warning('网址名称或链接不能为空')
- }
- this.tab2Arr.push({ name: '', url: '', id: null, remark: '' })
- },
- tab2Del (index, id) {
- this.$confirm('确定删除吗?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- })
- .then(() => {
- this.tab2Arr.splice(index, 1)
- if (id) this.tab2ArrDel.push(id)
- this.$message.success('删除成功!')
- })
- .catch(() => {
- this.$message.info('已取消删除!')
- })
- },
- // 点击保存
- async outBtnOk (index) {
- if (this.topTabInd === 0) {
- // console.log('项目详情保存')
- if (this.ruleForm.name.trim() === '') {
- return this.$message.warning('项目名称不能为空')
- }
- const res = await projectEdit1(this.ruleForm)
- if (res.code === 0) {
- this.$message.success('项目详情编辑成功')
- this.topTabInd = 1
- this.getDetail()
- } else this.$message.warning(res.msg)
- } else if (this.topTabInd === 1) {
- // console.log('项目网址保存')
- const temp = []
- let tempBoo = false
- let tempBoo1 = false
- this.tab1Arr.forEach((v, i) => {
- temp.push({
- id: v.id,
- name: v.name,
- projectId: Number(this.$route.query.id),
- type: 'website',
- url: v.url
- })
- if (i !== this.tab1Arr.length - 1) {
- if (v.name.trim() === '' || v.url.trim() === '') tempBoo = true
- }
- if (v.name.trim() === '' && v.url.trim() !== '') tempBoo1 = true
- if (v.name.trim() !== '' && v.url.trim() === '') tempBoo1 = true
- })
- if (tempBoo) return this.$message.warning('项目网址名称和链接不能为空')
- if (tempBoo1) {
- return this.$message.warning('项目网址名称或链接不能为空')
- }
- const res = await editScene({
- delIds: this.tab1ArrDel.join(','),
- dto: temp
- })
- if (res.code === 0) {
- this.$message.success('项目网址编辑成功')
- this.topTabInd = 2
- this.getDetail()
- } else this.$message.warning(res.msg)
- } else if (this.topTabInd === 2) {
- // console.log('三维场景保存')
- const temp = []
- let tempBoo2 = false
- let tempBoo3 = false
- this.tab2Arr.forEach((v, i) => {
- if (v.name !== '' && v.url !== '') {
- temp.push({
- id: v.id,
- name: v.name,
- projectId: Number(this.$route.query.id),
- type: 'scene',
- url: v.url,
- remark: v.remark
- })
- }
- if (i !== this.tab2Arr.length - 1) {
- if (v.name.trim() === '' || v.url.trim() === '') tempBoo2 = true
- }
- if (v.name.trim() === '' && v.url.trim() !== '') tempBoo3 = true
- if (v.name.trim() !== '' && v.url.trim() === '') tempBoo3 = true
- })
- if (tempBoo2) {
- return this.$message.warning('三维场景名称和链接不能为空')
- }
- if (tempBoo3) {
- return this.$message.warning('三维场景名称或链接不能为空')
- }
- const res = await editScene({
- delIds: this.tab2ArrDel.join(','),
- dto: temp
- })
- if (res.code === 0) {
- this.$message.success('三维场景编辑成功')
- this.topTabInd = 3
- this.getDetail()
- } else this.$message.warning(res.msg)
- } else if (this.topTabInd === 3) {
- // console.log('文档资料保存')
- const temp = []
- this.fuJianArr.forEach((v) => {
- temp.push(v.id)
- })
- const obj = {
- editIds: temp.join(','),
- projectId: Number(this.$route.query.id),
- removeIds: this.fuJianArrDel.join(',')
- }
- const res = await editDoc(obj)
- if (res.code === 0) {
- this.$message.success('资料文档编辑成功')
- this.topTabInd = 4
- this.getDetail()
- } else this.$message.warning(res.msg)
- } else if (this.topTabInd === 4) {
- // console.log('文物保存')
- const temp = []
- this.saveAntiqueArr.forEach((v) => {
- temp.push(v.id)
- })
- const obj = {
- editIds: temp.join(','),
- projectId: Number(this.$route.query.id),
- removeIds: this.saveAntiqueArrDel.join(',')
- }
- const res = await editGoods(obj)
- if (res.code === 0) {
- this.$message.success('文物编辑成功')
- // this.$router.push('/layout/tab1')
- } else this.$message.warning(res.msg)
- // console.log(999, res)
- }
- this.$nextTick(() => {
- setTimeout(() => {
- if (index !== false) this.topTabInd = index
- this.cuontChange1 =
- this.cuontChange2 =
- this.cuontChange3 =
- this.cuontChange4 =
- this.cuontChange5 =
- 1
- }, 300)
- })
- },
- // 封装获取详情方法
- async getDetail () {
- // 拿到路由跳转传过来的数据
- const res = await getDetail(this.$route.query.id)
- this.titleName = res.data.entity.name
- this.ruleForm = res.data.entity
- this.tab1Arr = res.data.website
- if (res.data.scene.length) this.tab2Arr = res.data.scene
- else this.tab2Arr = [{ name: '', url: '' }]
- this.fuJianArr = res.data.doc
- this.saveAntiqueArr = res.data.goods
- },
- // 上面的tab栏切换
- tabCut (index) {
- if (index === this.topTabInd) return
- // console.log(999, index)
- if (
- this.cuontChange1 > 1 ||
- this.cuontChange2 > 1 ||
- this.cuontChange3 > 1 ||
- this.cuontChange4 > 1 ||
- this.cuontChange5 > 1
- ) {
- this.$confirm('本次编辑未保存,是否 保存 并跳转页面', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- })
- .then(() => {
- this.outBtnOk(index)
- })
- .catch(() => {
- // this.$message.info('已取消!')
- this.topTabInd = index
- this.getDetail()
- setTimeout(() => {
- this.cuontChange1 =
- this.cuontChange2 =
- this.cuontChange3 =
- this.cuontChange4 =
- this.cuontChange5 =
- 1
- }, 300)
- })
- } else this.topTabInd = index
- // ---------------分割
- }
- },
- // 生命周期 - 创建完成(可以访问当前this实例)
- async created () {
- // 获取项目类型
- const res1 = await getProjectType()
- this.projectType = res1.data
- // 获取服务器前缀地址
- this.baseURL = axios.defaults.baseURL
- // 获取用户token
- this.token = localStorage.getItem('SWKK_token')
- this.getDetail()
- },
- // 生命周期 - 挂载完成(可以访问DOM元素)
- async mounted () {
- // 获取文物类别
- const res = await getGoodsType()
- this.antiqueArr = res.data
- this.antiqueArr.unshift({ id: '', name: '' })
- },
- beforeCreate () {}, // 生命周期 - 创建之前
- beforeMount () {}, // 生命周期 - 挂载之前
- beforeUpdate () {}, // 生命周期 - 更新之前
- updated () {}, // 生命周期 - 更新之后
- beforeDestroy () {}, // 生命周期 - 销毁之前
- destroyed () {}, // 生命周期 - 销毁完成
- activated () {} // 如果页面有keep-alive缓存功能,这个函数会触发
- }
- </script>
- <style lang='less' scoped>
- /deep/.el-upload-list__item .el-progress {
- top: 0;
- }
- /deep/.el-upload-list__item-name {
- display: none;
- }
- /deep/.el-upload-list__item-status-label {
- display: none !important;
- }
- /deep/.el-upload-list {
- width: 360px;
- }
- /deep/.el-select {
- width: 500px;
- }
- .template {
- .upImg {
- width: 135px;
- height: 135px;
- display: flex;
- justify-content: center;
- align-items: center;
- & > i {
- font-size: 50px;
- color: #ccc;
- }
- }
- .lookImg {
- padding-top: 15px;
- display: flex;
- justify-content: center;
- left: 0;
- top: 0;
- width: 100vw;
- height: 100vh;
- position: fixed;
- z-index: 9999;
- background-color: rgba(0, 0, 0, 0.7);
- img {
- max-width: 80vw;
- max-height: 80vh;
- }
- .imgBtnX {
- cursor: pointer;
- width: 100px;
- height: 30px;
- position: absolute;
- left: 50%;
- transform: translateX(-50%);
- bottom: 20px;
- background-color: #fff;
- border-radius: 8px;
- color: black;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- }
- .myImgBox {
- /deep/.el-form-item__content {
- display: flex;
- flex-wrap: wrap;
- }
- /deep/.el-upload-dragger {
- width: 135px;
- height: 135px;
- border: 1px solid #ccc;
- }
- }
- .upImgBox {
- display: flex;
- flex-wrap: wrap;
- .active {
- border: 2px solid #dc3545;
- }
- }
- .imgdiv {
- position: relative;
- margin: 0 10px 10px 0;
- border: 1px solid #ccc;
- width: 135px;
- height: 135px;
- & > img {
- width: 100%;
- height: 100%;
- object-fit: contain;
- }
- .imgIcon {
- justify-content: space-around;
- align-items: center;
- display: flex;
- position: absolute;
- width: 100%;
- height: 100%;
- left: 0;
- top: 0;
- background-color: rgba(0, 0, 0, 0.6);
- i {
- color: #fff;
- font-size: 24px;
- cursor: pointer;
- }
- a {
- i {
- margin-top: 10px;
- }
- }
- i:hover {
- color: #dc3545;
- }
- & > span {
- cursor: pointer;
- color: #fff;
- position: absolute;
- bottom: 0px;
- left: 50%;
- transform: translateX(-50%);
- }
- & > span:hover {
- color: #dc3545;
- }
- }
- }
- position: relative;
- padding: 0px 30px;
- .top {
- display: flex;
- align-items: center;
- height: 58px;
- width: 100%;
- .location {
- font-size: 22px;
- color: #999;
- & > span {
- color: black;
- }
- }
- }
- .conten {
- width: 100%;
- height: 720px;
- .txt {
- font-weight: 700;
- height: 40px;
- border-bottom: 1px solid #a3a2a9;
- }
- .search {
- position: relative;
- padding: 15px 20px 0;
- border-radius: 5px;
- box-shadow: 0px 0px 5px 0px;
- height: 110px;
- background-color: #d8dadc;
- ul {
- margin-top: 15px;
- display: flex;
- li {
- padding-bottom: 5px;
- cursor: pointer;
- margin-right: 100px;
- color: #666;
- }
- li:hover {
- border-bottom: 2px solid #dc3545;
- color: black;
- }
- .active {
- border-bottom: 2px solid #dc3545;
- color: black;
- }
- }
- }
- .tab {
- padding: 15px 30px;
- margin-top: 10px;
- background-color: #fff;
- height: 600px;
- overflow-y: auto;
- .title {
- font-weight: 700;
- padding-bottom: 8px;
- font-size: 20px;
- color: #c82333;
- border-bottom: 1px solid #ccc;
- }
- .from {
- margin-top: 22px;
- width: 600px;
- }
- .tab_btn {
- margin-left: 20px;
- cursor: pointer;
- color: #fff;
- width: 130px;
- height: 40px;
- border-radius: 10px;
- display: flex;
- align-items: center;
- justify-content: center;
- background-color: #dc3545;
- }
- .row {
- display: flex;
- align-items: center;
- margin: 15px 0 0;
- & > div {
- font-weight: 700;
- }
- a {
- background-color: #e7e9eb;
- padding: 5px 10px;
- margin-right: 20px;
- }
- i {
- margin-left: 20px;
- cursor: pointer;
- font-size: 24px;
- }
- }
- .upFJSucc {
- margin-top: 30px;
- width: 360px;
- & > div {
- margin-top: 8px;
- display: flex;
- align-items: center;
- justify-content: space-between;
- i {
- cursor: pointer;
- &:hover {
- color: #dc3545;
- }
- }
- }
- }
- .imgBox {
- display: flex;
- flex-wrap: wrap;
- & > div {
- // cursor: pointer;
- position: relative;
- word-wrap: break-word;
- text-align: center;
- width: 120px;
- margin: 20px 0 0 10px;
- // border: 1px solid #ccc;
- // box-shadow: 1px 1px 3px 0px;
- .moveShow {
- position: absolute;
- left: 0;
- top: 0;
- width: 120px;
- height: 120px;
- background-color: rgba(0, 0, 0, 0.7);
- display: flex;
- justify-content: space-around;
- align-items: center;
- & > i {
- cursor: pointer;
- color: #fff;
- font-size: 24px;
- }
- & > i:hover {
- color: #dc3545;
- }
- }
- }
- img {
- border: 1px solid #ccc;
- box-shadow: 1px 1px 3px 0px;
- padding: 5px;
- width: 120px;
- height: 120px;
- display: block;
- margin: 0 auto;
- margin-bottom: 10px;
- object-fit: contain;
- }
- .uploaImg {
- width: 120px;
- height: 120px;
- cursor: pointer;
- color: #ccc;
- border: 1px solid #ccc;
- font-size: 60px;
- font-weight: 700;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- }
- }
- }
- .button_btn {
- display: flex;
- justify-content: space-between;
- align-items: center;
- position: absolute;
- left: 100px;
- bottom: 30px;
- width: 300px;
- height: 40px;
- div {
- border-radius: 10px;
- display: flex;
- justify-content: center;
- align-items: center;
- width: 100px;
- height: 40px;
- background-color: #fff;
- cursor: pointer;
- }
- .edit {
- margin-left: 50px;
- color: #fff !important;
- background-color: #dc3545 !important;
- }
- }
- }
- </style>
|