拆分详情增加图片

This commit is contained in:
caoyang
2022-03-30 00:15:26 +08:00
parent 303db5f3fc
commit e0a2262fc4
2 changed files with 28 additions and 14 deletions
@@ -31,7 +31,7 @@
export default { export default {
name: 'file', name: 'file',
props: ['disableds', 'disabled', 'thisFileUploadUrl', 'readonly', 'thisFileType','accept','title','listType','splitVisible'], props: ['disableds', 'disabled', 'thisFileUploadUrl', 'readonly', 'thisFileType','title','listType','splitVisible'],
data() { data() {
return { return {
visible: false, visible: false,
@@ -42,7 +42,8 @@
myfileList: [], myfileList: [],
isLoding: false, isLoding: false,
headers:'', headers:'',
previewImage:{} previewImage:{},
accept:'image/*'
} }
}, },
created() { created() {
@@ -148,6 +149,7 @@
} }
}) })
this.$emit('uploadSuccess', this.fileList,fileList) this.$emit('uploadSuccess', this.fileList,fileList)
console.log('uplossss',this.fileList,fileList)
if (this.myfileList.length > 0) { if (this.myfileList.length > 0) {
this.$message.destroy() this.$message.destroy()
this.$message.success(`${info.file.name} `+this.$t('uploadSuccessful')) this.$message.success(`${info.file.name} `+this.$t('uploadSuccessful'))
@@ -291,11 +291,11 @@
<div class="row-left"> <div class="row-left">
<a-textarea v-if="item.type==='TEXT'" v-model="item.itemContent" :placeholder="$t('pleaseEnter')+$t('content')" auto-size /> <a-textarea v-if="item.type==='TEXT'" v-model="item.itemContent" :placeholder="$t('pleaseEnter')+$t('content')" auto-size />
<img v-if="item.type==='IMG'" :src="item.itemContent" alt="" @click="preImg(item)"> <img v-if="item.type==='IMG'" :src="item.itemContent" alt="" @click="preImg(item)">
<div v-if="item.type==='TABLE'" v-html="item.content" class="item-table"></div> <div v-if="item.type==='TABLE'" v-html="item.itemContent" class="item-table"></div>
</div> </div>
<div class="row-right"> <div class="row-right">
<a-button class="row-btn-add" @click="splitAdd(index)">{{$t('Add')}}</a-button> <a-button class="row-btn-add" @click="splitAdd(index)">{{$t('Add')}}</a-button>
<a-button @click="splitDelete">{{$t('delete')}}</a-button> <a-button @click="splitDelete(item,index)">{{$t('delete')}}</a-button>
</div> </div>
</div> </div>
</a-row> </a-row>
@@ -335,12 +335,12 @@
</div> </div>
<div class="title-num" v-if="selectedNum"> <div class="title-num" v-if="selectedNum">
<span class="title-num-add">{{$t('addQuantity')}}</span> <span class="title-num-add">{{$t('addQuantity')}}</span>
<a-input-number class="title-num-edit" :min="1" v-model="textNumber" :placeholder="$t('enterQuantity')" :formatter="limitNumber" :parser="limitNumber"></a-input-number> <a-input-number class="title-num-edit" :min="1" v-model="textNumber" :placeholder="$t('enterQuantity')" :formatter="limitNumber" :parser="limitNumber" ></a-input-number>
</div> </div>
</div> </div>
</a-modal> </a-modal>
<!-- 上传图片弹框--> <!-- 上传图片弹框-->
<split-upload v-if="splitVisible" ref="uploadFile2" :disabled="disabled" :accept="accept" :title="titleImg" :listType='listType' :splitVisible="splitVisible" @uploadSuccess="uploadSuccess"></split-upload> <split-upload v-if="splitVisible" ref="uploadFile2" :disabled="disabled" :title="titleImg" :listType='listType' :splitVisible="splitVisible" @uploadSuccess="uploadSuccess1"></split-upload>
<!-- 输入表格行数列数--> <!-- 输入表格行数列数-->
<a-modal <a-modal
@@ -353,10 +353,10 @@
> >
<a-form :form="form" :label-col="{ span: 8 }" :wrapper-col="{ span: 14 }"> <a-form :form="form" :label-col="{ span: 8 }" :wrapper-col="{ span: 14 }">
<a-form-item :label="$t('numberRows')"> <a-form-item :label="$t('numberRows')">
<a-input-number v-model="rowCount" :min="1" :max="99999" :placeholder="$t('pleaseEnter')+$t('numberRows')" :formatter="limitNumber" :parser="limitNumber" /> <a-input-number v-model="rowCount" :min="1" :max="99999" :placeholder="$t('pleaseEnter')+$t('numberRows')" :formatter="limitNumber" :parser="limitNumber" style="width: 100%" />
</a-form-item> </a-form-item>
<a-form-item :label="$t('numberColumns')"> <a-form-item :label="$t('numberColumns')">
<a-input-number v-model="colCount" :min="1" :max="99999" :placeholder="$t('pleaseEnter')+$t('numberColumns')" :formatter="limitNumber" :parser="limitNumber" /> <a-input-number v-model="colCount" :min="1" :max="99999" :placeholder="$t('pleaseEnter')+$t('numberColumns')" :formatter="limitNumber" :parser="limitNumber" style="width: 100%" />
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-modal> </a-modal>
@@ -556,6 +556,7 @@
loading:false, loading:false,
token:Vue.ls.get(ACCESS_TOKEN), token:Vue.ls.get(ACCESS_TOKEN),
submitFlag:false, submitFlag:false,
deleteIds:[]
} }
}, },
props:{ props:{
@@ -637,8 +638,17 @@
} }
}, },
//删除按钮 //删除按钮
splitDelete(){ splitDelete(item,index){
console.log('itme',item,this.contentList)
if(item.id){
this.deleteIds.push(item.id)
}
for(let i=index;i<this.contentList.length-1;i++){
this.contentList[index]=this.contentList[index+1]
}
this.contentList.pop()
console.log('this.content',this.contentList)
}, },
//保存 //保存
splitSave(){ splitSave(){
@@ -669,7 +679,7 @@
// params.menuId=this.menuId // params.menuId=this.menuId
params.itemValEOList=this.contentList params.itemValEOList=this.contentList
// console.log('paramsformInline',params) // console.log('paramsformInline',params)
params.delItemIds=this.deleteIds.join(',')
axios({ axios({
url: url, url: url,
method: 'post', method: 'post',
@@ -744,7 +754,7 @@
this.tableColVisible=true this.tableColVisible=true
} }
console.log('conteend',this.contentList)
}, },
handleCancel(){ handleCancel(){
this.addConVisible=false this.addConVisible=false
@@ -754,7 +764,8 @@
}, },
//上传文件 //上传文件
uploadSuccess(data,imgs) { uploadSuccess1(data,imgs) {
console.log('dataimg',data,imgs)
let lengthImg=imgs.length let lengthImg=imgs.length
for(let i = this.contentList.length;i>this.addIndex;i--){ for(let i = this.contentList.length;i>this.addIndex;i--){
this.contentList[i+lengthImg-1]=this.contentList[i-1] this.contentList[i+lengthImg-1]=this.contentList[i-1]
@@ -764,11 +775,12 @@
this.contentList[++this.addIndex]={ this.contentList[++this.addIndex]={
id:'', id:'',
type:'IMG', type:'IMG',
itemContent:item.thumbUrl itemContent:item.url
} }
}) })
} }
this.splitVisible=false this.splitVisible=false
console.log('conteend',this.contentList)
}, },
//点击图片预览 //点击图片预览
preImg(item){ preImg(item){
@@ -828,7 +840,7 @@
this.contentList[this.addIndex+1]= { this.contentList[this.addIndex+1]= {
id:'', id:'',
type:'TABLE', type:'TABLE',
content:tableStr itemContent:tableStr
} }
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.ueditor.setContent(this.ueContent) this.$refs.ueditor.setContent(this.ueContent)