拆分详情表格增加编辑

This commit is contained in:
caoyang
2022-04-05 19:32:38 +08:00
parent 29e4a3ac4a
commit 78ba4bde0e
10 changed files with 177 additions and 68 deletions
@@ -93,7 +93,6 @@
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<a-date-picker class="box-input"
:placeholder="$t('PleaseSelect')+item.db_field_txt"
@change="dateChange(item)"
format="YYYY-MM-DD"
v-model="formInline[item.db_field_name]"
@@ -251,12 +250,13 @@
<a-row :gutter="24" class="split-content" id="split-content" v-for="(item, index) in contentList" :key="index">
<div class="split-row">
<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')" />
<img v-if="item.type==='IMG'" :src="item.thumbUrl?item.thumbUrl:item.itemContent" alt="" @click="preImg(item)">
<div v-if="item.type==='TABLE'" v-html="item.itemContent" class="item-table"></div>
</div>
<div class="row-right">
<a-button class="row-btn-add" @click="splitAdd(index)">{{$t('Add')}}</a-button>
<a-button class="row-btn-edit" @click="splitEdit(index,item)" v-if="item.type=='TABLE'">{{$t('edit')}}</a-button>
<a-button @click="splitDelete(item,index)">{{$t('delete')}}</a-button>
</div>
</div>
@@ -541,6 +541,7 @@
]
},
numberFlag:false,
itemVal:{}
}
},
props:{
@@ -572,10 +573,10 @@
type:String,
default:''
},
itemVal:{
type:Object,
default:{}
}
// itemVal:{
// type:Object,
// default:{}
// }
},
watch:{
selected(val){
@@ -635,6 +636,14 @@
this.addIndex=val
}
},
//编辑按钮
splitEdit(index,item){
this.tableVisible=true
this.$nextTick(() => {
this.$refs.ueditor.setContent(item.itemContent)
})
console.log('ineciem',index,item)
},
//删除按钮
splitDelete(item,index){
// console.log('itme',item,this.contentList)
@@ -663,6 +672,7 @@
} else {
url = this.url.addInfo
}
let params = JSON.parse(JSON.stringify(this.formInline))
Object.keys(params).forEach(res => {
@@ -671,12 +681,19 @@
}
})
if(JSON.stringify(this.itemVal)=="{}"){
params.info_id=this.infoId
params.menu_id=this.menuId
}
// params.menuId=this.menuId
params.itemValEOList=this.contentList
let contentList=JSON.parse(JSON.stringify(this.contentList))
contentList.forEach((item,index)=>{
if(item.type==='IMG'){
// console.log('img',item)
this.$delete(item,'thumbUrl')
// contentList[index]= { ...item }
}
})
// console.log('contentList',contentList)
params.itemValEOList=contentList
// console.log('paramsformInline',params)
params.delItemIds=this.deleteIds.join(',')
axios({
@@ -767,7 +784,7 @@
},
//上传文件
uploadSuccess1(data,imgs) {
console.log('dataimg',data,imgs)
// console.log('dataimg',data,imgs)
let lengthImg=imgs.length
for(let i = this.contentList.length;i>this.addIndex;i--){
this.contentList[i+lengthImg-1]=this.contentList[i-1]
@@ -803,6 +820,8 @@
type:'TABLE',
itemContent:this.ueContent
}
// this.uEditorChange()
// console.log('this.contentList',this.contentList)
},
//表格取消按钮
handleCancelTable(){
@@ -816,6 +835,7 @@
type:'TABLE',
itemContent:val
}
this.ueContent=val
},
//取消行数列数按钮
@@ -989,6 +1009,7 @@
edit(item) {
this.visible=true
this.type = 'edit'
this.itemVal=item
// this.getForm(() => {
// this.formInline=item
// })
@@ -996,7 +1017,7 @@
getAction(this.url.getDocumentInfo, { id: item.id }).then((res) => {
if (res.success) {
this.formInline = res.result
console.log('form11111',this.formInline)
// console.log('form11111',this.formInline)
}
})
@@ -1006,6 +1027,7 @@
this.getForm()
this.visible=true
this.formInline = {}
this.contentList=[]
this.type = 'add'
},
@@ -1104,7 +1126,7 @@
.row-right{
min-width: 150px;
margin-left: 20px;
.row-btn-add{
.row-btn-add, .row-btn-edit{
margin-right: 20px;
}
}
@@ -1182,7 +1204,10 @@
table.word-table {
width: 100%;
height: 100%;
.wordImg{
width:40px;
height: auto;
}
}
}
}