修改 iview弹出message提示框 出错问题

pull/3/head
justin 2021-09-30 00:12:06 +08:00
parent d7acd839f7
commit bcc8d8abb2
11 changed files with 28 additions and 122 deletions

View File

@ -135,7 +135,7 @@ export function createDesigner(vueInstance) {
let wgCategory = evt.draggedContext.element.category let wgCategory = evt.draggedContext.element.category
if (!!evt.to) { if (!!evt.to) {
if ((evt.to.className === 'sub-form-table') && (wgCategory === 'container')) { if ((evt.to.className === 'sub-form-table') && (wgCategory === 'container')) {
//this.$message.info(this.vueInstance.i18nt('designer.hint.onlyFieldWidgetAcceptable')) //this.$Message.info(this.vueInstance.i18nt('designer.hint.onlyFieldWidgetAcceptable'))
return false return false
} }
} }
@ -650,7 +650,7 @@ export function createDesigner(vueInstance) {
}) })
if (spanSum >= 24) { if (spanSum >= 24) {
//this.$message.info('列栅格之和超出24') //this.$Message.info('列栅格之和超出24')
console.log('列栅格之和超出24') console.log('列栅格之和超出24')
gridWidget.cols.push(newGridCol) gridWidget.cols.push(newGridCol)
} else { } else {

View File

@ -48,48 +48,6 @@
</Input> </Input>
</template> </template>
<template v-if="field.type === 'input-composite'">
<Input ref="fieldEditor"
v-model="fieldModel"
:disabled="field.options.disabled"
:readonly="field.options.readonly"
:size="field.options.size||'default'"
class="hide-spin-button"
:type="inputType"
:password ="field.options.showPassword"
:placeholder="field.options.placeholder"
:clearable="field.options.clearable"
:maxlength="field.options.maxLength"
:show-word-limit="field.options.showWordLimit"
:minlength="field.options.minLength"
@change="handleChangeEvent"
@focus="handleFocusCustomEvent"
@blur="handleBlurCustomEvent"
@input="handleInputCustomEvent">
<div slot="prepend" v-if="field.options.prependControl&&field.options.prependControlType=='div'">
<Icon :type="field.options.prependControlIcon" />{{field.options.prependControlText}}
</div>
<div slot="append" v-if="field.options.appendControl&&field.options.appendControlType=='div'">
<Icon :type="field.options.appendControlIcon" />{{field.options.appendControlText}}
</div>
<Button slot="prepend"
v-if="field.options.prependControl&&field.options.prependControlType==='button'"
type="primary"
:disabled="field.options.disabled || field.options.prependControlDisabled"
:icon="field.options.prependControlIcon"
@click.native="emitPrependButtonClick">{{field.options.prependControlText}}</Button>
<Button slot="append"
v-if="field.options.appendControl&&field.options.appendControlType==='button'"
type="primary"
:disabled="field.options.disabled || field.options.appendButtonDisabled"
:icon="field.options.appendControlIcon"
@click.native="emitAppendButtonClick">{{field.options.appendControlText}}</Button>
</Input>
</template>
<template v-if="field.type === 'textarea'"> <template v-if="field.type === 'textarea'">
<Input type="textarea" ref="fieldEditor" v-model="fieldModel" :disabled="field.options.disabled" <Input type="textarea" ref="fieldEditor" v-model="fieldModel" :disabled="field.options.disabled"
:readonly="field.options.readonly" :size="field.options.size||'default'" :readonly="field.options.readonly" :size="field.options.size||'default'"

View File

@ -161,7 +161,7 @@
getWidgetRef(widgetName, showError) { getWidgetRef(widgetName, showError) {
let foundRef = this.widgetRefList[widgetName] let foundRef = this.widgetRefList[widgetName]
if (!foundRef && !!showError) { if (!foundRef && !!showError) {
this.$message.error(this.i18nt('designer.hint.refNotFound') + widgetName) this.$Message.error(this.i18nt('designer.hint.refNotFound') + widgetName)
} }
return foundRef return foundRef
}, },

View File

@ -1554,7 +1554,7 @@
let oldName = this.designer.selectedWidgetName let oldName = this.designer.selectedWidgetName
if (isEmptyStr(newName)) { if (isEmptyStr(newName)) {
this.selectedWidget.options.name = oldName this.selectedWidget.options.name = oldName
this.$message.info(this.i18nt('designer.hint.nameRequired')) this.$Message.info(this.i18nt('designer.hint.nameRequired'))
return return
} }
@ -1563,7 +1563,7 @@
let foundRef = this.designer.formWidget.getWidgetRef(newName) let foundRef = this.designer.formWidget.getWidgetRef(newName)
if (!!foundRef) { if (!!foundRef) {
this.selectedWidget.options.name = oldName this.selectedWidget.options.name = oldName
this.$message.info(this.i18nt('designer.hint.duplicateName') + newName) this.$Message.info(this.i18nt('designer.hint.duplicateName') + newName)
return return
} }
@ -1581,7 +1581,7 @@
spanSum += colItem.options.span spanSum += colItem.options.span
}) })
if (spanSum > 24) { if (spanSum > 24) {
//this.$message.info('24') //this.$Message.info('24')
console.log('列栅格之和超出24') console.log('列栅格之和超出24')
//TODO: //TODO:
} }
@ -1639,7 +1639,7 @@
deleteTabPane(curTabs, tpIdx) { deleteTabPane(curTabs, tpIdx) {
if (curTabs.tabs.length === 1) { if (curTabs.tabs.length === 1) {
this.$message.info(this.i18nt('designer.hint.lastPaneCannotBeDeleted')) this.$Message.info(this.i18nt('designer.hint.lastPaneCannotBeDeleted'))
return return
} }

View File

@ -234,7 +234,7 @@
this.showImportCascaderDialogFlag = false this.showImportCascaderDialogFlag = false
} catch (ex) { } catch (ex) {
this.$message.error(this.i18nt('designer.hint.invalidOptionsData') + ex.message) this.$Message.error(this.i18nt('designer.hint.invalidOptionsData') + ex.message)
} }
}, },

View File

@ -311,11 +311,11 @@
this.designer.loadFormJson(importObj) this.designer.loadFormJson(importObj)
this.showImportJsonDialogFlag = false this.showImportJsonDialogFlag = false
this.$message.success(this.i18nt('designer.hint.importJsonSuccess')) this.$Message.success(this.i18nt('designer.hint.importJsonSuccess'))
this.designer.emitHistoryChange() this.designer.emitHistoryChange()
} catch (ex) { } catch (ex) {
this.$message.error(ex + '') this.$Message.error(ex + '')
} }
}, },
@ -337,11 +337,11 @@
this.$nextTick(() => { this.$nextTick(() => {
let copyClipboard = new Clipboard('.copy-json-btn') let copyClipboard = new Clipboard('.copy-json-btn')
copyClipboard.on('success', e => { copyClipboard.on('success', e => {
this.$message.success(this.i18nt('designer.hint.copyJsonSuccess')) this.$Message.success(this.i18nt('designer.hint.copyJsonSuccess'))
copyClipboard.destroy() // copyClipboard.destroy() //
}) })
copyClipboard.on('error', e => { // copyClipboard.on('error', e => { //
this.$message.error(this.i18nt('designer.hint.copyJsonFail')) this.$Message.error(this.i18nt('designer.hint.copyJsonFail'))
copyClipboard.destroy() copyClipboard.destroy()
}) })
}) })
@ -354,21 +354,21 @@
this.$nextTick(() => { this.$nextTick(() => {
let vueClipboard = new Clipboard('.copy-vue-btn') let vueClipboard = new Clipboard('.copy-vue-btn')
vueClipboard.on('success', e => { vueClipboard.on('success', e => {
this.$message.success(this.i18nt('designer.hint.copyVueCodeSuccess')) this.$Message.success(this.i18nt('designer.hint.copyVueCodeSuccess'))
vueClipboard.destroy() // vueClipboard.destroy() //
}) })
vueClipboard.on('error', e => { // vueClipboard.on('error', e => { //
this.$message.error(this.i18nt('designer.hint.copyVueCodeFail')) this.$Message.error(this.i18nt('designer.hint.copyVueCodeFail'))
vueClipboard.destroy() vueClipboard.destroy()
}) })
let htmlClipboard = new Clipboard('.copy-html-btn') let htmlClipboard = new Clipboard('.copy-html-btn')
htmlClipboard.on('success', e => { htmlClipboard.on('success', e => {
this.$message.success(this.i18nt('designer.hint.copyHtmlCodeSuccess')) this.$Message.success(this.i18nt('designer.hint.copyHtmlCodeSuccess'))
htmlClipboard.destroy() // htmlClipboard.destroy() //
}) })
htmlClipboard.on('error', e => { // htmlClipboard.on('error', e => { //
this.$message.error(this.i18nt('designer.hint.copyHtmlCodeFail')) this.$Message.error(this.i18nt('designer.hint.copyHtmlCodeFail'))
htmlClipboard.destroy() htmlClipboard.destroy()
}) })
}) })
@ -376,7 +376,7 @@
copyVueCode(e) { copyVueCode(e) {
copyToClipboard(this.vueCode, e, copyToClipboard(this.vueCode, e,
this.$message, this.$Message,
this.i18nt('designer.hint.copyVueCodeSuccess'), this.i18nt('designer.hint.copyVueCodeSuccess'),
this.i18nt('designer.hint.copyVueCodeFail') this.i18nt('designer.hint.copyVueCodeFail')
) )
@ -384,7 +384,7 @@
copyHtmlCode(e) { copyHtmlCode(e) {
copyToClipboard(this.htmlCode, e, copyToClipboard(this.htmlCode, e,
this.$message, this.$Message,
this.i18nt('designer.hint.copyHtmlCodeSuccess'), this.i18nt('designer.hint.copyHtmlCodeSuccess'),
this.i18nt('designer.hint.copyHtmlCodeFail') this.i18nt('designer.hint.copyHtmlCodeFail')
) )
@ -410,7 +410,7 @@
copyV2SFC(e) { copyV2SFC(e) {
copyToClipboard(this.sfcCode, e, copyToClipboard(this.sfcCode, e,
this.$message, this.$Message,
this.i18nt('designer.hint.copySFCSuccess'), this.i18nt('designer.hint.copySFCSuccess'),
this.i18nt('designer.hint.copySFCFail') this.i18nt('designer.hint.copySFCFail')
) )
@ -418,7 +418,7 @@
copyV3SFC(e) { copyV3SFC(e) {
copyToClipboard(this.sfcCodeV3, e, copyToClipboard(this.sfcCodeV3, e,
this.$message, this.$Message,
this.i18nt('designer.hint.copySFCSuccess'), this.i18nt('designer.hint.copySFCSuccess'),
this.i18nt('designer.hint.copySFCFail') this.i18nt('designer.hint.copySFCFail')
) )
@ -447,16 +447,16 @@
this.$nextTick(() => { this.$nextTick(() => {
let copyClipboard = new Clipboard('.copy-form-data-json-btn') let copyClipboard = new Clipboard('.copy-form-data-json-btn')
copyClipboard.on('success', e => { copyClipboard.on('success', e => {
this.$message.success(this.i18nt('designer.hint.copyJsonSuccess')) this.$Message.success(this.i18nt('designer.hint.copyJsonSuccess'))
copyClipboard.destroy() // copyClipboard.destroy() //
}) })
copyClipboard.on('error', e => { // copyClipboard.on('error', e => { //
this.$message.error(this.i18nt('designer.hint.copyJsonFail')) this.$Message.error(this.i18nt('designer.hint.copyJsonFail'))
copyClipboard.destroy() copyClipboard.destroy()
}) })
}) })
}).catch(error => { }).catch(error => {
this.$message.error(error) this.$Message.error(error)
}) })
}, },

View File

@ -138,59 +138,7 @@ export const basicFields = [
onBlur: '', onBlur: '',
onValidate: '', onValidate: '',
}, },
}, },
{
type: 'input-composite',
icon: 'text-field',
formItemFlag: true,
options: {
name: '',
label: '',
labelAlign: '',
type: 'text',
defaultValue: '',
placeholder: '',
columnWidth: '200px',
size: '',
labelWidth: null,
labelHidden: false,
readonly: false,
disabled: false,
hidden: false,
clearable: true,
showPassword: false,
required: false,
validation: '',
validationHint: '',
//-------------------
customClass: '', //自定义css类名
labelIconClass: null,
labelIconPosition: 'rear',
labelTooltip: null,
// minLength: null,
maxLength: null,
showWordLimit: false,
prependControl: true,
prependControlDisabled: false,
prependControlText:"", //后置按钮文字
prependControlIcon: 'ios-person', //后置按钮文字
prependControlType: 'button',
appendControl: true,
appendControlDisabled: false,
appendControlText:"", //后置按钮文字
appendControlIcon: 'ios-search', //后置按钮文字
appendControlType: 'button',
//-------------------
onCreated: '',
onMounted: '',
onInput: '',
onChange: '',
onFocus: '',
onBlur: '',
onValidate: '',
},
},
{ {
type: 'textarea', type: 'textarea',
icon: 'textarea-field', icon: 'textarea-field',

View File

@ -472,7 +472,7 @@
//TODO: //TODO:
return this.formModel[this.widget.options.name] return this.formModel[this.widget.options.name]
} else { } else {
this.$message.error(this.i18nt('render.hint.nonSubFormType')) this.$Message.error(this.i18nt('render.hint.nonSubFormType'))
} }
}, },

View File

@ -288,7 +288,7 @@
getWidgetRef(widgetName, showError = false) { getWidgetRef(widgetName, showError = false) {
let foundRef = this.widgetRefList[widgetName] let foundRef = this.widgetRefList[widgetName]
if (!foundRef && !!showError) { if (!foundRef && !!showError) {
this.$message.error(this.i18nt('render.hint.refNotFound') + widgetName) this.$Message.error(this.i18nt('render.hint.refNotFound') + widgetName)
} }
return foundRef return foundRef
}, },

View File

@ -9,7 +9,7 @@ export default {
getWidgetRef(widgetName, showError) { getWidgetRef(widgetName, showError) {
let foundRef = this.refList[widgetName] let foundRef = this.refList[widgetName]
if (!foundRef && !!showError) { if (!foundRef && !!showError) {
this.$message.error(this.i18nt('render.hint.refNotFound') + widgetName) this.$Message.error(this.i18nt('render.hint.refNotFound') + widgetName)
} }
return foundRef return foundRef
}, },

View File

@ -80,7 +80,7 @@ export const generateCode = function(formJson, codeType= 'vue') {
alert( JSON.stringify(formData) ) alert( JSON.stringify(formData) )
}).catch(error => { }).catch(error => {
// Form Validation failed // Form Validation failed
this.$message.error(error) this.$Message.error(error)
}) })
} }
} }