后台挂载

This commit is contained in:
a0049873 2022-07-08 17:05:55 +08:00
parent dd6e249190
commit 0c7715e1c1
4 changed files with 81 additions and 115 deletions

View File

@ -156,7 +156,7 @@
:close-on-press-escape='false'
:before-close='clear'
width="50%">
<putOnTheShelf :putOnTheShelfList='putOnTheShelfList'></putOnTheShelf>
<putOnTheShelf :putOnTheShelfList='putOnTheShelfList' @changeInfoList='changeInfoList'></putOnTheShelf>
<span slot="footer" class="dialog-footer">
<el-button @click="clear"> </el-button>
<el-button type="primary" @click="submitData"> </el-button>
@ -236,6 +236,10 @@ export default {
this.fullScreen()
},
methods: {
changeInfoList (obj) {
this.submitFrom.infoList = this.submitFrom.infoList.filter((item) => item.attrType !== obj.attrType)
this.submitFrom.infoList.push(obj)
},
reset () {
this.$http
.get(
@ -426,7 +430,7 @@ export default {
showPutOnTheShelfVue () {
this.showPutOnTheShelfFlag = false
this.showPutOnTheShelfFlag2 = true
this.submitFrom.infoList[0] = this.redio
this.submitFrom.infoList[0].attrValue = this.radio
this.putOnTheShelfList = this.insertList.children.filter(item => item.name === this.radio)[0].children
console.log('radio', this.radio)
},

View File

@ -2,45 +2,33 @@
* @Author: hisense.liangjunhua
* @Date: 2022-07-08 14:55:19
* @LastEditors: hisense.liangjunhua
* @LastEditTime: 2022-07-08 15:48:44
* @LastEditTime: 2022-07-08 17:03:42
* @Description: 告诉大家这是什么
-->
<template>
<a-upload
v-model:file-list="fileList"
:action="`${apiURL}/upload`"
list-type="picture"
class="upload-list-inline"
:maxCount="maxCount"
:before-upload="beforeUpload"
@change="handleChange"
@preview="handlePreview"
@remove="handleRemove"
>
<a-button>
<upload-outlined></upload-outlined>
{{ btnName }}
</a-button>
<span
style="
display: inline-block;
margin-left: 10px;
color: #999999;
font-size: 14px;
"
>
{{ tip }}
</span>
</a-upload>
<el-upload
ref='my-upload'
:action="apiURL"
:accept='accept'
:on-change='handleChange'
:on-preview="handlePreview"
:on-remove="handleRemove"
:limit="maxCount"
:file-list="fileList">
<el-button size="small" type="primary">上传{{type}}</el-button>
<div slot="tip" class="el-upload__tip">{{tip}}</div>
</el-upload>
</template>
<script>
import { message, Upload } from 'ant-design-vue'
import Cookies from 'js-cookie'
export default {
name: '',
components: {
},
props: {
title: String,
accept: String,
btnName: String,
type: String,
tip: String,
@ -52,87 +40,57 @@ export default {
},
data () {
return {
apiURL: window.SITE_CONFIG.apiURL,
apiURL: window.SITE_CONFIG.apiURL + '/upload?token=' + Cookies.get('ucsToken'),
fileList: JSON.parse(JSON.stringify(this.list))
}
},
methods: {
beforeUpload (file) {
handleExceed (file) {
console.log(file)
const isLt10M = file.size / 1024 / 1024 < 100
let flag
if (this.type === '图片') {
flag =
file.type === 'image/jpeg' ||
file.type === 'image/jpg' ||
file.type === 'image/png'
} else if (this.type === '视频') {
console.log(file.type === 'video/mp4')
flag =
file.type === 'audio/mpeg' ||
file.type === 'video/mp4' ||
file.type === 'video/mp3'
} else if (this.type === '文件') {
flag =
file.type === 'application/pdf' ||
file.type === 'application/msword' ||
file.type ===
'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
}
console.log(flag)
if (!flag) {
message.error(`${file.name} 不是${this.type}类型`)
}
if (!isLt10M) {
message.error(`${file.name} 超出100M的大小`)
}
return flag || Upload.LIST_IGNORE
},
handError (err, file, fileList) {
console.log(err, file, fileList)
},
handlePreview (file) {
// console.log(file)
console.log(file)
window.open(
window.SITE_CONFIG.previewUrl +
'hisense_office/onlinePreview?url=' +
btoa(encodeURI(file.response.data))
)
},
handleChange (info) {
if (info.file.status !== 'uploading') {
console.log(info.file, info.fileList)
}
if (info.file.status === 'done') {
message.success(`${info.file.name}上传成功`)
this.data.note1 = info.file.response.data
console.log(this.data, this.fileList)
if (this.type === '图片') {
if (!this.emitFlag) {
// mybus.emit('chageImgList', fileList.value)
}
} else if (this.type === '文件') {
console.log('busType', this.busType)
if (this.busType == 2) {
console.log('busType', this.busType)
// mybus.emit('chageFileList2', fileList.value)
} else {
// mybus.emit('chageFileList', fileList.value)
}
} else if (this.type === '视频') {
// mybus.emit('chageVideoList', fileList.value)
handleChange (file, fileList) {
console.log(file, fileList)
if (file.status === 'success') {
if (file.response.msg === 'success') {
this.$message({
message: file.name + '上传成功',
type: 'success'
})
// this.data.note1 = file.response.data
this.$emit('changeInfoList', {
attrType: this.title,
attrValue: file.response.data,
delFlag: 0
})
} else {
this.$message.error(file.name + '上传失败')
this.$refs['my-upload'].clearFiles()
}
} else if (info.file.status === 'error') {
message.error(`${info.file.name}上传失败`)
} else if (file.status === 'error') {
this.$message.error(file.name + '上传失败')
this.$refs['my-upload'].clearFiles()
}
},
handleRemove (file) {
this.data.note1 = ''
this.$emit('changeInfoList', {
attrType: this.title,
attrValue: '',
delFlag: 0
})
}
}
}
</script>
<style lang='scss' scoped>
.ant-upload-list-item-image {
width: 100%;
height: 100%;
object-fit: contain;
}
</style>

View File

@ -2,7 +2,7 @@
* @Author: hisense.liangjunhua
* @Date: 2022-07-08 09:54:50
* @LastEditors: hisense.liangjunhua
* @LastEditTime: 2022-07-08 15:15:02
* @LastEditTime: 2022-07-08 15:57:38
* @Description: 多条数据特殊处理
-->
<template>
@ -29,7 +29,7 @@
</p>
<div class="del">
<i class="delImg" @click="del( index)"></i>
<div @click="del( index)">删除</div>
<div @click="del(configure.name, index)">删除</div>
</div>
</div>
</div>
@ -48,7 +48,7 @@
<!-- <upload :key="showKey" :child='val' limit='1' accept='.jpg,.png' v-else-if="val.type == 'image'"></upload> -->
</div>
<div class="submit">
<a-button type="primary" @click="add()">提交</a-button>
<a-button type="primary" @click="add(configure.name)">提交</a-button>
</div>
</div>
</div>
@ -71,7 +71,7 @@ export default {
}
},
methods: {
add () {
add (title) {
const list = this.configure.list
let flag = true
list.forEach((item) => {
@ -89,11 +89,11 @@ export default {
})
this.data.push(obj)
// console.log(data.value[title])
// mybus.emit('chageDataFrom', {
// attrType: title,
// attrValue: JSON.stringify(data.value[title]),
// delFlag: 0
// })
this.$emit('changeInfoList', {
attrType: title,
attrValue: JSON.stringify(this.data),
delFlag: 0
})
list.forEach((item) => {
item.note1 = ''
})
@ -101,14 +101,15 @@ export default {
} else {
this.$message.warning('请填写完整')
}
} // del (title, index) {
// data.value[title].splice(index, 1)
// mybus.emit('chageDataFrom', {
// attrType: title,
// attrValue: JSON.stringify(data.value[title]),
// delFlag: 0
// })
// }
},
del (title, index) {
this.data.splice(index, 1)
this.$emit('changeInfoList', {
attrType: title,
attrValue: JSON.stringify(this.data),
delFlag: 0
})
}
}
}
</script>

View File

@ -2,7 +2,7 @@
* @Author: hisense.liangjunhua
* @Date: 2022-07-08 09:48:52
* @LastEditors: hisense.liangjunhua
* @LastEditTime: 2022-07-08 15:50:06
* @LastEditTime: 2022-07-08 17:03:12
* @Description: 告诉大家这是什么
-->
<template>
@ -13,18 +13,18 @@
<div class="top">{{child.name}}</div>
<div v-for="item in child.children" :key="item.id" class='item'>
<span>{{ item.name }}</span>
<upload :list="[]" v-if="item.type == 'image'" type="图片" btnName="上传图片" :maxCount="1" :data="item"
<upload @changeInfoList='changeInfoList' :title='item.name' accept='.jpg,.png' :list="[]" v-if="item.type == 'image'" type="图片" btnName="上传图片" :maxCount="1" :dataList="item"
tip="支持图片类型大小不超过100M"></upload>
<upload :list="[]" v-else-if="item.type == 'file' && item.name !== '使用手册'" type="文件" btnName="上传附件" :maxCount="1"
:data="item" tip="支持文件类型大小不超过100M"></upload>
<upload :list="[]" v-else-if="item.name == '使用手册'" type="文件" btnName="上传附件" :maxCount="1" :data="item" :busType="2"
<upload @changeInfoList='changeInfoList' :title='item.name' accept='.pdf,.ppt,.xlsx,.doc,.docx' :list="[]" v-else-if="item.type == 'file' && item.name !== '使用手册'" type="文件" btnName="上传附件" :maxCount="1"
:dataList="item" tip="支持文件类型大小不超过100M"></upload>
<upload @changeInfoList='changeInfoList' :title='item.name' accept='.pdf,.ppt,.xlsx,.doc,.docx' :list="[]" v-else-if="item.name == '使用手册'" type="文件" btnName="上传附件" :maxCount="1" :dataList="item" :busType="2"
tip="支持文件类型大小不超过100M"></upload>
<upload :list="[]" v-else-if="item.type == 'video'" type="视频" btnName="上传视频" :maxCount="1" :data="item"
<upload @changeInfoList='changeInfoList' :title='item.name' accept='.mp4' :list="[]" v-else-if="item.type == 'video'" type="视频" btnName="上传视频" :maxCount="1" :dataList="item"
tip="支持视频类型大小不超过100M"></upload>
</div>
</template>
<template v-else>
<special :configure='judgmentType.filter(item => item.name==child.name)[0]'></special>
<special :configure='judgmentType.filter(item => item.name==child.name)[0]' @changeInfoList='changeInfoList'></special>
</template>
</div>
</div>
@ -154,6 +154,9 @@ export default {
}
},
methods: {
changeInfoList (obj) {
this.$emit('changeInfoList', obj)
}
}
}
</script>