后台挂载

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

View File

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

View File

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

View File

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