1. 修复图片上传组件的大图预览功能;

2. 修复部分拼写错误。
This commit is contained in:
vdpAdmin 2022-08-04 16:01:29 +08:00
parent e6d6167653
commit 5a77167ed4
4 changed files with 32 additions and 11 deletions

View File

@ -8,7 +8,7 @@
: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}"
:limit="field.options.limit" :on-exceed="handlePictureExceed" :limit="field.options.limit" :on-exceed="handlePictureExceed" :on-preview="handlePicturePreview"
:before-upload="beforePictureUpload" :before-upload="beforePictureUpload"
:on-success="handlePictureUpload" :on-error="handleUploadError" :on-success="handlePictureUpload" :on-error="handleUploadError"
:before-remove="handleBeforeRemove" :on-remove="handlePictureRemove"> :before-remove="handleBeforeRemove" :on-remove="handlePictureRemove">
@ -124,6 +124,11 @@
this.$message.warning( this.i18nt('render.hint.uploadExceed').replace('${uploadLimit}', uploadLimit) ) this.$message.warning( this.i18nt('render.hint.uploadExceed').replace('${uploadLimit}', uploadLimit) )
}, },
handlePicturePreview(file) {
this.previewUrl = file.url
this.showPreviewDialogFlag = true
},
beforePictureUpload(file) { beforePictureUpload(file) {
let fileTypeCheckResult = false let fileTypeCheckResult = false
if (!!this.field.options && !!this.field.options.fileTypes) { if (!!this.field.options && !!this.field.options.fileTypes) {

View File

@ -67,6 +67,7 @@
<el-button v-if="false" @click="testLoadForm">Test Load</el-button> <el-button v-if="false" @click="testLoadForm">Test Load</el-button>
<el-button v-if="false" @click="testSetFormJson">Test SFJ</el-button> <el-button v-if="false" @click="testSetFormJson">Test SFJ</el-button>
<el-button v-if="false" @click="testSetFormData">Test SFD</el-button> <el-button v-if="false" @click="testSetFormData">Test SFD</el-button>
<el-button v-if="false" @click="testReloadOptionData">Test ROD</el-button>
</div> </div>
</template> </template>
</el-dialog> </el-dialog>
@ -258,7 +259,13 @@
{label: '01', value: 1}, {label: '01', value: 1},
{label: '22', value: 2}, {label: '22', value: 2},
{label: '333', value: 3}, {label: '333', value: 3},
] ],
'select001': [
{label: '辣椒', value: 1},
{label: '菠萝', value: 2},
{label: '丑橘子', value: 3},
],
}, },
} }
@ -646,6 +653,15 @@
this.$refs.preForm.setFormData(testFD) this.$refs.preForm.setFormData(testFD)
}, },
testReloadOptionData() {
this.testOptionData['select001'].push({
label: 'aaa',
value: 888
})
this.$refs.preForm.reloadOptionData()
},
handleFormChange(fieldName, newValue, oldValue, formModel) { handleFormChange(fieldName, newValue, oldValue, formModel) {
/* /*
console.log('---formChange start---') console.log('---formChange start---')

View File

@ -152,7 +152,7 @@ export function traverseFieldWidgets(widgetList, handler, parent = null) {
}) })
} }
export function traverseContainWidgets(widgetList, handler) { export function traverseContainerWidgets(widgetList, handler) {
widgetList.map(w => { widgetList.map(w => {
if (w.category === 'container') { if (w.category === 'container') {
handler(w) handler(w)
@ -160,22 +160,22 @@ export function traverseContainWidgets(widgetList, handler) {
if (w.type === 'grid') { if (w.type === 'grid') {
w.cols.map(col => { w.cols.map(col => {
traverseContainWidgets(col.widgetList, handler) traverseContainerWidgets(col.widgetList, handler)
}) })
} else if (w.type === 'table') { } else if (w.type === 'table') {
w.rows.map(row => { w.rows.map(row => {
row.cols.map(cell => { row.cols.map(cell => {
traverseContainWidgets(cell.widgetList, handler) traverseContainerWidgets(cell.widgetList, handler)
}) })
}) })
} else if (w.type === 'tab') { } else if (w.type === 'tab') {
w.tabs.map(tab => { w.tabs.map(tab => {
traverseContainWidgets(tab.widgetList, handler) traverseContainerWidgets(tab.widgetList, handler)
}) })
} else if (w.type === 'sub-form') { } else if (w.type === 'sub-form') {
traverseContainWidgets(w.widgetList, handler) traverseContainerWidgets(w.widgetList, handler)
} else if (w.category === 'container') { //自定义容器 } else if (w.category === 'container') { //自定义容器
traverseContainWidgets(w.widgetList, handler) traverseContainerWidgets(w.widgetList, handler)
} }
}) })
} }
@ -286,7 +286,7 @@ export function getAllContainerWidgets(widgetList) {
container: w container: w
}) })
} }
traverseContainWidgets(widgetList, handlerFn) traverseContainerWidgets(widgetList, handlerFn)
return result return result
} }

View File

@ -1,4 +1,4 @@
import {isNotNull, traverseContainWidgets, traverseFieldWidgets} from "@/utils/util"; import {isNotNull, traverseContainerWidgets, traverseFieldWidgets} from "@/utils/util";
import {translate} from "@/utils/i18n"; import {translate} from "@/utils/i18n";
import FormValidators, {getRegExp} from "@/utils/validators"; import FormValidators, {getRegExp} from "@/utils/validators";
@ -79,7 +79,7 @@ export function buildActiveTabs(formConfig, widgetList) {
cw.tabs.length > 0 && resultList.push(`'${cop.name}ActiveTab': '${cw.tabs[0].options.name}',`) cw.tabs.length > 0 && resultList.push(`'${cop.name}ActiveTab': '${cw.tabs[0].options.name}',`)
} }
} }
traverseContainWidgets(widgetList, handlerFn) traverseContainerWidgets(widgetList, handlerFn)
return resultList return resultList
} }