拆分图片上传问题

This commit is contained in:
caoyang
2022-04-01 18:19:53 +08:00
parent 9fafb83c43
commit c146d817b1
5 changed files with 110 additions and 62 deletions
+5 -5
View File
@@ -28,7 +28,7 @@
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<j-multi-select-tag class="box-input" v-model="formInline[item.db_field_name]"
:disabled="disabled"
:placeholder="$t('selectStatus')" :type="'checkbox'"
:placeholder="$t('PleaseSelect')+item.db_field_txt" :type="'checkbox'"
:triggerChange="false" :dictCode="item.dict_field"/>
</a-form-model-item>
</div>
@@ -91,7 +91,7 @@
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<j-dict-select-tag class="box-input" v-model="formInline[item.db_field_name]"
:disabled="disabled"
:placeholder="$t('selectStatus')" :type="'select'"
:placeholder="$t('PleaseSelect')+item.db_field_txt" :type="'select'"
:triggerChange="false" :dictCode="item.dict_field"/>
</a-form-model-item>
</div>
@@ -107,7 +107,7 @@
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<j-multi-select-tag class="box-input" v-model="formInline[item.db_field_name]"
:disabled="disabled"
:placeholder="$t('selectStatus')" :type="'select'"
:placeholder="$t('PleaseSelect')+item.db_field_txt" :type="'select'"
:triggerChange="false" :dictCode="item.dict_field"/>
</a-form-model-item>
</div>
@@ -121,7 +121,7 @@
<span class="title-text-text">{{item.db_field_txt}}</span>
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<j-dict-select-tag v-model="formInline[item.db_field_name]" :placeholder="$t('selectStatus')"
<j-dict-select-tag v-model="formInline[item.db_field_name]" :placeholder="$t('PleaseSelect')+item.db_field_txt"
:disabled="disabled"
:type="'radio'" :triggerChange="false" :dictCode="item.dict_field"/>
</a-form-model-item>
@@ -136,7 +136,7 @@
<span class="title-text-text">{{item.db_field_txt}}</span>
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<a-textarea :placeholder="$t('selectStatus')"
<a-textarea :placeholder="$t('PleaseSelect')+item.db_field_txt"
:disabled="disabled"
v-model="formInline[item.db_field_name]" :rows="4"/>
</a-form-model-item>
@@ -28,7 +28,7 @@
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<j-multi-select-tag class="box-input" v-model="formInline[item.db_field_name]"
:disabled="disabled"
:placeholder="$t('selectStatus')" :type="'checkbox'"
:placeholder="$t('PleaseSelect')+item.db_field_txt" :type="'checkbox'"
:triggerChange="false" :dictCode="item.dict_field"/>
</a-form-model-item>
</div>
@@ -91,7 +91,7 @@
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<j-dict-select-tag class="box-input" v-model="formInline[item.db_field_name]"
:disabled="disabled"
:placeholder="$t('selectStatus')" :type="'select'"
:placeholder="$t('PleaseSelect')+item.db_field_txt" :type="'select'"
:triggerChange="false" :dictCode="item.dict_field"/>
</a-form-model-item>
</div>
@@ -107,7 +107,7 @@
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<j-multi-select-tag class="box-input" v-model="formInline[item.db_field_name]"
:disabled="disabled"
:placeholder="$t('selectStatus')" :type="'select'"
:placeholder="$t('PleaseSelect')+item.db_field_txt" :type="'select'"
:triggerChange="false" :dictCode="item.dict_field"/>
</a-form-model-item>
</div>
@@ -121,7 +121,7 @@
<span class="title-text-text">{{item.db_field_txt}}</span>
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<j-dict-select-tag v-model="formInline[item.db_field_name]" :placeholder="$t('selectStatus')"
<j-dict-select-tag v-model="formInline[item.db_field_name]" :placeholder="$t('PleaseSelect')+item.db_field_txt"
:disabled="disabled"
:type="'radio'" :triggerChange="false" :dictCode="item.dict_field"/>
</a-form-model-item>
@@ -136,7 +136,7 @@
<span class="title-text-text">{{item.db_field_txt}}</span>
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<a-textarea :placeholder="$t('selectStatus')"
<a-textarea :placeholder="$t('PleaseSelect')+item.db_field_txt"
:disabled="disabled"
v-model="formInline[item.db_field_name]" :rows="4"/>
</a-form-model-item>
@@ -1,6 +1,6 @@
<template>
<div>
<a-modal v-model="visible" :maskClosable="false" :footer="[]" :title="title">
<a-modal v-model="visible" :maskClosable="false" :footer="[]" :title="title" @cancel="handlePreImgCancel">
<a-upload-dragger
:accept='accept'
:disabled="disabled"
@@ -53,7 +53,7 @@
},
mounted() {
this.visible=this.splitVisible
console.log('accept11111',this.accept)
// console.log('accept11111',this.accept)
// console.log(this.thisFileType,this.thisFileSize,this.thisFileUploadUrl);
},
methods: {
@@ -74,7 +74,7 @@
this.fileTypeSatus=false
let fileTypes=this.accept.split('/')
let fileNowTypes=file.type.split('/')
fileFlag=fileTypes[0]==fileTypes[0]?true:false
fileFlag=(fileTypes[0]==fileNowTypes[0])?true:false
// console.log('filetype',fileFlag)
if(!fileFlag){
this.$message.warning(this.$t('fileFormatIncorrect'))
@@ -175,6 +175,9 @@
preview(file) {
// console.log('file111',file)
this.previewImage = file.response.path;
},
handlePreImgCancel(){
this.$emit('coloseHandle',false)
}
}
}
@@ -194,7 +194,7 @@
<j-dict-select-tag v-model="formInline[item.db_field_name]"
:disabled="disabled"
@input="handleInput(item.db_field_name)"
:placeholder="$t('selectStatus')"
:placeholder="$t('PleaseSelect')+item.db_field_txt"
:type="'radio'" :triggerChange="false" :dictCode="item.dict_field"/>
</a-form-model-item>
</div>
@@ -228,7 +228,8 @@
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<j-multi-select-tag class="box-input" v-model="formInline[item.db_field_name]"
:disabled="disabled"
:placeholder="$t('selectStatus')" :type="'checkbox'"
:placeholder="$t('PleaseSelect')+item.db_field_txt"
:type="'checkbox'"
:triggerChange="false" :dictCode="item.dict_field"/>
</a-form-model-item>
</div>
@@ -301,7 +302,7 @@
</div>
</a-modal>
<!-- 上传图片弹框-->
<split-upload v-if="splitVisible" ref="uploadFile2" :disabled="disabled" :title="titleImg" :listType='listType' :splitVisible="splitVisible" @uploadSuccess="uploadSuccess1"></split-upload>
<split-upload v-if="splitVisible" ref="uploadFile2" :disabled="disabled" :title="titleImg" :listType='listType' :splitVisible="splitVisible" :accept="accept" @coloseHandle="coloseHandle" @uploadSuccess="uploadSuccess1"></split-upload>
<!-- 输入表格行数列数-->
<a-modal
@@ -723,7 +724,7 @@
}
}else if(this.selected==2){ //图片类型
// this.$refs.uploadFile2.visible=true
this.splitVisible=true
}else if(this.selected==3){ //表格类型
@@ -741,7 +742,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]
@@ -751,10 +752,12 @@
this.contentList[++this.addIndex]={
id:'',
type:'IMG',
itemContent:item.id
itemContent:item.id,
thumbUrl:item.thumbUrl
}
})
}
// this.$refs.uploadFile2.visible=false
this.splitVisible=false
// console.log('conteend',this.contentList)
},
@@ -770,6 +773,11 @@
//表格确认按钮
handleOkTable(){
this.tableVisible=false
this.contentList[this.addIndex+1]= {
id:'',
type:'TABLE',
itemContent:this.ueContent
}
},
//表格取消按钮
handleCancelTable(){
@@ -788,6 +796,8 @@
//取消行数列数按钮
handleColCancel(){
this.tableColVisible=false
this.rowCount=''
this.colCount=''
},
//确定行数列数按钮
handleColOk(){
@@ -814,14 +824,12 @@
}
tableStr+=`</table>`
this.ueContent=tableStr
this.contentList[this.addIndex+1]= {
id:'',
type:'TABLE',
itemContent:tableStr
}
this.$nextTick(() => {
this.$refs.ueditor.setContent(this.ueContent)
})
this.rowCount=''
this.colCount=''
}
// console.log('cont1111',this.addIndex,this.contentList)
},
@@ -849,6 +857,7 @@
},
/** 上传文件的回调 */
uploadSuccess(data) {
console.log('dataaaaa',data)
let attIdList = []
if (data && data.length > 0) {
data.map(item => {
@@ -859,6 +868,10 @@
this.formInline[this.uploadName] = attIdList.join(',')
this.formInline = { ...this.formInline }
},
//关闭上传
coloseHandle(){
this.splitVisible=false
},
handleInput(value) {
this.$nextTick(() => {
this.formInline = { ...this.formInline }
@@ -957,9 +970,11 @@
this.getForm(() => {
getAction(this.url.getDocumentInfo, { id: item.id }).then((res) => {
if (res.success) {
this.formInline = res.result[0]
this.formInline = res.result
console.log('form11111',this.formInline)
}
})
})
},
add() {
@@ -977,6 +992,7 @@
this.formInline[value + '_id'] = id
this.formInline = { ...this.formInline }
},
//正则替换小数点
limitNumber(value) {
if (typeof value === 'string') {
@@ -1179,4 +1195,13 @@
width: 100%;
}
}
.split-img{
.ant-modal-body{
img{
margin-top: 20px;
width: 470px;
height: 100%;
}
}
}
</style>
@@ -16,10 +16,10 @@
@select="onSelect"
>
<template slot="title" slot-scope="{ title }">
<span v-if="title.indexOf(searchValue) > -1">
<span v-if="title.indexOf(searchValue) > -1" :title="title">
{{ title.substr(0, title.indexOf(searchValue)) }}<span style="color: #f50">{{ searchValue }}</span>{{ title.substr(title.indexOf(searchValue) + searchValue.length) }}
</span>
<span v-else>{{ title }}</span>
<span v-else :title="title">{{ title }}</span>
</template>
</a-tree>
<div v-if="NodeTreeItem" :style="tmpStyle" >
@@ -251,7 +251,7 @@
getAddForm: 'language/switch/getForm', // 表单的字段
addInfo: '/jero-boot/split/sarFileSplitItems/addSplitItems', //新增
updateInfo:'/jero-boot/split/sarFileSplitItems/updateSplitItems', //编辑
getDocumentInfo:'split/sarFileSplitInfo/queryById',
getDocumentInfo:'split/sarFileSplitItems/getSplitItemsById',
importZipUrl: '/split/sarFileSplitItems/importSplitItems',//导入
},
urlBatSet:{
@@ -483,6 +483,7 @@
}
}).finally(()=>{
this.flag=false
this.menuRightVisible=false
})
}
}
@@ -505,6 +506,7 @@
}
}).finally(()=>{
this.flag=false
this.menuRightVisible=false
})
}
},
@@ -550,41 +552,46 @@
infoIds:infoIds.join(','),
menuids:menuIds.join(',')
}
this.$confirm({
title: this.$t('ConfirmReplication'),
content: '',
onOk:
async () => {
axios({
url: '/jero-boot/split/sarFileSplitMenu/copyMenuNotChildrenall',
method: 'get',
params: params,
// transformRequest: [function (data) {
// // Do whatever you want to transform the data
// let ret = ''
// for (let it in data) {
// ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
// }
// return ret
// }],
headers: {
// 'Content-Type': 'application/x-www-form-urlencoded',
'X-Access-Token':this.token
}
})
.then( (res) => {
if(res.data.success){
this.$message.success(this.$t('OperationSuccessful'))
// this.loadData()
this.loadMenuData()
eventBUs.$emit('searchReset')
}else{
this.$message.warning(this.$t('operationFailed'))
if(menuIds&&menuIds.length>0) {
this.$confirm({
title: this.$t('ConfirmReplication'),
content: '',
onOk:
async () => {
axios({
url: '/jero-boot/split/sarFileSplitMenu/copyMenuNotChildrenall',
method: 'get',
params: params,
// transformRequest: [function (data) {
// // Do whatever you want to transform the data
// let ret = ''
// for (let it in data) {
// ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
// }
// return ret
// }],
headers: {
// 'Content-Type': 'application/x-www-form-urlencoded',
'X-Access-Token': this.token
}
})
.then((res) => {
if (res.data.success) {
this.$message.success(this.$t('OperationSuccessful'))
// this.loadData()
this.loadMenuData()
eventBUs.$emit('searchReset')
} else {
this.$message.warning(this.$t('operationFailed'))
}
})
},
onCancel() {
},
onCancel() {},
});
})
}else if(menuIds.length==0){
this.$message.warning(this.$t('PleaseSelectData'))
}
},
//新增
handleAddManage(){
@@ -768,7 +775,7 @@
ids:val.id
}
this.$confirm({
title: this.$t('ConfirmBatchDeletion'),
title: this.$t('areYouSure'),
content: '',
onOk:
async () => {
@@ -958,7 +965,7 @@
display: flex;
justify-content: space-between;
.split-detail-left{
min-width: 260px;
width: 260px;
padding-right: 20px;
border-right: 1px solid #666666;
.menu-item{
@@ -1054,4 +1061,17 @@
text-align: center;
}
}
.split-detail-left{
.ant-tree-treenode-switcher-open{
.ant-tree-node-content-wrapper-normal{
width:200px;
white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;
}
.ant-tree-title{
}
}
}
</style>