图片、文件上传地址增加DSV变量支持。
parent
6d66308fbb
commit
949a75ea29
|
@ -5,7 +5,7 @@
|
||||||
<!-- el-upload增加:name="field.options.name"后,会导致又拍云上传失败!故删除之!! -->
|
<!-- el-upload增加:name="field.options.name"后,会导致又拍云上传失败!故删除之!! -->
|
||||||
<el-upload ref="fieldEditor" :disabled="field.options.disabled"
|
<el-upload ref="fieldEditor" :disabled="field.options.disabled"
|
||||||
:style="styleVariables" class="dynamicPseudoAfter"
|
:style="styleVariables" class="dynamicPseudoAfter"
|
||||||
:action="field.options.uploadURL" :headers="uploadHeaders" :data="uploadData"
|
:action="realUploadURL" :headers="uploadHeaders" :data="uploadData"
|
||||||
:with-credentials="field.options.withCredentials"
|
:with-credentials="field.options.withCredentials"
|
||||||
:multiple="field.options.multipleSelect" :file-list="fileList"
|
:multiple="field.options.multipleSelect" :file-list="fileList"
|
||||||
:show-file-list="field.options.showFileList" :class="{'hideUploadDiv': uploadBtnHidden}"
|
:show-file-list="field.options.showFileList" :class="{'hideUploadDiv': uploadBtnHidden}"
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
import FormItemWrapper from './form-item-wrapper'
|
import FormItemWrapper from './form-item-wrapper'
|
||||||
import emitter from '@/utils/emitter'
|
import emitter from '@/utils/emitter'
|
||||||
import i18n, {translate} from "@/utils/i18n";
|
import i18n, {translate} from "@/utils/i18n";
|
||||||
import {deepClone} from "@/utils/util";
|
import {deepClone, evalFn} from "@/utils/util";
|
||||||
import fieldMixin from "@/components/form-designer/form-widget/field-widget/fieldMixin";
|
import fieldMixin from "@/components/form-designer/form-widget/field-widget/fieldMixin";
|
||||||
import SvgIcon from "@/components/svg-icon/index";
|
import SvgIcon from "@/components/svg-icon/index";
|
||||||
|
|
||||||
|
@ -100,6 +100,16 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
realUploadURL() {
|
||||||
|
let uploadURL = this.field.options.uploadURL
|
||||||
|
if (!!uploadURL && ((uploadURL.indexOf('DSV.') > -1) || (uploadURL.indexOf('DSV[') > -1))) {
|
||||||
|
let DSV = this.getGlobalDsv()
|
||||||
|
console.log('test DSV: ', DSV) //防止DSV被打包工具优化!!!
|
||||||
|
return evalFn(this.field.options.uploadURL, DSV)
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.field.options.uploadURL
|
||||||
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
beforeCreate() {
|
beforeCreate() {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
:sub-form-row-index="subFormRowIndex" :sub-form-col-index="subFormColIndex" :sub-form-row-id="subFormRowId">
|
:sub-form-row-index="subFormRowIndex" :sub-form-col-index="subFormColIndex" :sub-form-row-id="subFormRowId">
|
||||||
<!-- el-upload增加:name="field.options.name"后,会导致又拍云上传失败!故删除之!! -->
|
<!-- el-upload增加:name="field.options.name"后,会导致又拍云上传失败!故删除之!! -->
|
||||||
<el-upload ref="fieldEditor" :disabled="field.options.disabled"
|
<el-upload ref="fieldEditor" :disabled="field.options.disabled"
|
||||||
:action="field.options.uploadURL" :headers="uploadHeaders" :data="uploadData"
|
:action="realUploadURL" :headers="uploadHeaders" :data="uploadData"
|
||||||
:with-credentials="field.options.withCredentials"
|
:with-credentials="field.options.withCredentials"
|
||||||
:multiple="field.options.multipleSelect" :file-list="fileList" :show-file-list="field.options.showFileList"
|
:multiple="field.options.multipleSelect" :file-list="fileList" :show-file-list="field.options.showFileList"
|
||||||
list-type="picture-card" :class="{'hideUploadDiv': uploadBtnHidden}"
|
list-type="picture-card" :class="{'hideUploadDiv': uploadBtnHidden}"
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
import FormItemWrapper from './form-item-wrapper'
|
import FormItemWrapper from './form-item-wrapper'
|
||||||
import emitter from '@/utils/emitter'
|
import emitter from '@/utils/emitter'
|
||||||
import i18n, {translate} from "@/utils/i18n";
|
import i18n, {translate} from "@/utils/i18n";
|
||||||
import {deepClone} from "@/utils/util";
|
import {deepClone, evalFn} from "@/utils/util";
|
||||||
import fieldMixin from "@/components/form-designer/form-widget/field-widget/fieldMixin";
|
import fieldMixin from "@/components/form-designer/form-widget/field-widget/fieldMixin";
|
||||||
import SvgIcon from "@/components/svg-icon/index";
|
import SvgIcon from "@/components/svg-icon/index";
|
||||||
|
|
||||||
|
@ -118,7 +118,19 @@
|
||||||
computed: {
|
computed: {
|
||||||
previewList() {
|
previewList() {
|
||||||
return this.fileList.map(el => el.url);
|
return this.fileList.map(el => el.url);
|
||||||
|
},
|
||||||
|
|
||||||
|
realUploadURL() {
|
||||||
|
let uploadURL = this.field.options.uploadURL
|
||||||
|
if (!!uploadURL && ((uploadURL.indexOf('DSV.') > -1) || (uploadURL.indexOf('DSV[') > -1))) {
|
||||||
|
let DSV = this.getGlobalDsv()
|
||||||
|
console.log('test DSV: ', DSV) //防止DSV被打包工具优化!!!
|
||||||
|
return evalFn(this.field.options.uploadURL, DSV)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return this.field.options.uploadURL
|
||||||
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
beforeCreate() {
|
beforeCreate() {
|
||||||
/* 这里不能访问方法和属性!! */
|
/* 这里不能访问方法和属性!! */
|
||||||
|
|
|
@ -37,6 +37,12 @@ export const overwriteObj = function(obj1, obj2) { /* 浅拷贝对象属性,o
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 用Function对象实现eval函数功能 */
|
||||||
|
export const evalFn = function (fn, DSV = null, VFR = null) {
|
||||||
|
let f = new Function('DSV', 'VFR', 'return ' + fn);
|
||||||
|
return f(DSV, VFR);
|
||||||
|
};
|
||||||
|
|
||||||
export const addWindowResizeHandler = function (handler) {
|
export const addWindowResizeHandler = function (handler) {
|
||||||
let oldHandler = window.onresize
|
let oldHandler = window.onresize
|
||||||
if (typeof window.onresize != 'function') {
|
if (typeof window.onresize != 'function') {
|
||||||
|
|
Loading…
Reference in New Issue