阻止按钮回车事件

This commit is contained in:
shiziyuan9527 2020-05-07 16:03:40 +08:00
parent 74c8be756a
commit f36c375467
9 changed files with 87 additions and 66 deletions

View File

@ -31,7 +31,7 @@
</el-form>
<template v-slot:footer>
<div class="dialog-footer">
<el-button type="primary" onkeydown="return false;" @click="submit('form')" size="medium">
<el-button type="primary" @keydown.enter.native.prevent @click="submit('form')" size="medium">
{{$t('commons.save')}}
</el-button>
</div>

View File

@ -16,10 +16,10 @@
</el-table-column>
<el-table-column>
<template v-slot:default="scope">
<el-button @click="edit(scope.row)" onkeydown="return false;" type="primary" icon="el-icon-edit" size="mini"
circle/>
<el-button @click="del(scope.row)" onkeydown="return false;" type="danger" icon="el-icon-delete" size="mini"
circle/>
<el-button @click="edit(scope.row)" @keydown.enter.native.prevent type="primary" icon="el-icon-edit"
size="mini" circle/>
<el-button @click="del(scope.row)" @keydown.enter.native.prevent type="danger" icon="el-icon-delete"
size="mini" circle/>
</template>
</el-table-column>
</el-table>
@ -56,8 +56,9 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" onkeydown="return false;"
@click="submitForm('form')" size="medium">{{$t('commons.save')}}</el-button>
<el-button @click="submitForm('form')" @keydown.enter.native.prevent type="primary"
size="medium">{{$t('commons.save')}}
</el-button>
</span>
</template>
</el-dialog>
@ -90,8 +91,9 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" onkeydown="return false;"
@click="updateOrgMember('updateUserForm')" size="medium">{{$t('commons.save')}}</el-button>
<el-button @click="updateOrgMember('updateUserForm')" @keydown.enter.native.prevent type="primary"
size="medium">{{$t('commons.save')}}
</el-button>
</span>
</template>
</el-dialog>

View File

@ -16,10 +16,10 @@
</el-table-column>
<el-table-column>
<template v-slot:default="scope">
<el-button @click="edit(scope.row)" onkeydown="return false;" type="primary" icon="el-icon-edit" size="mini"
circle/>
<el-button @click="del(scope.row)" onkeydown="return false;" type="danger" icon="el-icon-delete" size="mini"
circle/>
<el-button @click="edit(scope.row)" @keydown.enter.native.prevent type="primary" icon="el-icon-edit"
size="mini" circle/>
<el-button @click="del(scope.row)" @keydown.enter.native.prevent type="danger" icon="el-icon-delete"
size="mini" circle/>
</template>
</el-table-column>
</el-table>
@ -38,8 +38,9 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" onkeydown="return false;"
@click="submit('form')" size="medium">{{$t('commons.save')}}</el-button>
<el-button @click="submit('form')" @keydown.enter.native.prevent type="primary"
size="medium">{{$t('commons.save')}}
</el-button>
</span>
</template>
</el-dialog>
@ -60,9 +61,9 @@
</el-table-column>
<el-table-column :label="$t('commons.operating')">
<template v-slot:default="scope">
<el-button @click="editMember(scope.row)" onkeydown="return false;" type="primary" icon="el-icon-edit"
<el-button @click="editMember(scope.row)" @keydown.enter.native.prevent type="primary" icon="el-icon-edit"
size="mini" circle/>
<el-button @click="delMember(scope.row)" onkeydown="return false;" type="danger" icon="el-icon-delete"
<el-button @click="delMember(scope.row)" @keydown.enter.native.prevent type="danger" icon="el-icon-delete"
size="mini" circle/>
</template>
</el-table-column>
@ -105,8 +106,9 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" onkeydown="return false;"
@click="submitForm('form')" size="medium">{{$t('commons.save')}}</el-button>
<el-button @click="submitForm('form')" @keydown.enter.native.prevent type="primary"
size="medium">{{$t('commons.save')}}
</el-button>
</span>
</template>
</el-dialog>
@ -142,8 +144,9 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" onkeydown="return false;"
@click="updateOrgMember('updateUserForm')" size="medium">{{$t('commons.save')}}</el-button>
<el-button @click="updateOrgMember('updateUserForm')" @keydown.enter.native.prevent type="primary"
size="medium">{{$t('commons.save')}}
</el-button>
</span>
</template>
</el-dialog>

View File

@ -27,8 +27,10 @@
</el-table-column>
</el-table>
<el-dialog :title="$t('member.modify_personal_info')" :visible.sync="updateVisible" width="30%" :destroy-on-close="true" @close="closeFunc">
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule" ref="updateUserForm">
<el-dialog :title="$t('member.modify_personal_info')" :visible.sync="updateVisible" width="30%"
:destroy-on-close="true" @close="closeFunc">
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule"
ref="updateUserForm">
<el-form-item label="ID" prop="id">
<el-input v-model="form.id" autocomplete="off" :disabled="true"/>
</el-form-item>
@ -44,8 +46,9 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" onkeydown="return false;"
@click="updateUser('updateUserForm')" size="medium">{{$t('commons.save')}}</el-button>
<el-button @click="updateUser('updateUserForm')" @keydown.enter.native.prevent type="primary"
size="medium">{{$t('commons.save')}}
</el-button>
</span>
</template>
</el-dialog>
@ -68,7 +71,7 @@
rule: {
name: [
{required: true, message: this.$t('member.input_name'), trigger: 'blur'},
{ min: 2, max: 10, message: this.$t('commons.input_limit', [2, 10]), trigger: 'blur' },
{min: 2, max: 10, message: this.$t('commons.input_limit', [2, 10]), trigger: 'blur'},
{
required: true,
pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/,
@ -85,7 +88,7 @@
}
],
email: [
{ required: true, message: this.$t('member.input_email'), trigger: 'blur' },
{required: true, message: this.$t('member.input_email'), trigger: 'blur'},
{
required: true,
pattern: /^([A-Za-z0-9_\-.])+@([A-Za-z0-9]+\.)+[A-Za-z]{2,6}$/,
@ -112,7 +115,7 @@
updateUser(updateUserForm) {
this.$refs[updateUserForm].validate(valide => {
if (valide) {
this.result = this.$post(this.updatePath, this.form,response => {
this.result = this.$post(this.updatePath, this.form, response => {
this.$success(this.$t('commons.modify_success'));
localStorage.setItem(TokenKey, JSON.stringify(response.data));
this.updateVisible = false;

View File

@ -19,10 +19,10 @@
</el-table-column>
<el-table-column :label="$t('commons.operating')">
<template v-slot:default="scope">
<el-button @click="edit(scope.row)" onkeydown="return false;" type="primary" icon="el-icon-edit" size="mini"
circle/>
<el-button @click="del(scope.row)" onkeydown="return false;" type="danger" icon="el-icon-delete" size="mini"
circle/>
<el-button @click="edit(scope.row)" @keydown.enter.native.prevent type="primary" icon="el-icon-edit"
size="mini" circle/>
<el-button @click="del(scope.row)" @keydown.enter.native.prevent type="danger" icon="el-icon-delete"
size="mini" circle/>
</template>
</el-table-column>
</el-table>
@ -46,9 +46,9 @@
</el-table-column>
<el-table-column :label="$t('commons.operating')">
<template v-slot:default="scope">
<el-button @click="editMember(scope.row)" onkeydown="return false;" type="primary" icon="el-icon-edit"
<el-button @click="editMember(scope.row)" @keydown.enter.native.prevent type="primary" icon="el-icon-edit"
size="mini" circle/>
<el-button @click="delMember(scope.row)" onkeydown="return false;" type="danger" icon="el-icon-delete"
<el-button @click="delMember(scope.row)" @keydown.enter.native.prevent type="danger" icon="el-icon-delete"
size="mini" circle/>
</template>
</el-table-column>
@ -72,8 +72,9 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" onkeydown="return false;"
@click="createOrganization('createOrganization')" size="medium">{{$t('commons.save')}}</el-button>
<el-button @click="createOrganization('createOrganization')" @keydown.enter.native.prevent type="primary"
size="medium">{{$t('commons.save')}}
</el-button>
</span>
</template>
</el-dialog>
@ -93,9 +94,9 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" onkeydown="return false;"
@click="updateOrganization('updateOrganizationForm')"
size="medium">{{$t('organization.modify')}}</el-button>
<el-button @click="updateOrganization('updateOrganizationForm')" @keydown.enter.native.prevent type="primary"
size="medium">{{$t('organization.modify')}}
</el-button>
</span>
</template>
</el-dialog>
@ -133,8 +134,9 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" onkeydown="return false;"
@click="submitForm('form')" size="medium">{{$t('commons.save')}}</el-button>
<el-button @click="submitForm('form')" @keydown.enter.native.prevent type="primary"
size="medium">{{$t('commons.save')}}
</el-button>
</span>
</template>
</el-dialog>
@ -170,8 +172,9 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" onkeydown="return false;"
@click="updateOrgMember('updateUserForm')" size="medium">{{$t('commons.save')}}</el-button>
<el-button @click="updateOrgMember('updateUserForm')" @keydown.enter.native.prevent type="primary"
size="medium">{{$t('commons.save')}}
</el-button>
</span>
</template>
</el-dialog>

View File

@ -50,7 +50,7 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" onkeydown="return false;" @click="submit('form')" size="medium">{{$t('commons.save')}}</el-button>
<el-button type="primary" @keydown.enter.native.prevent @click="submit('form')" size="medium">{{$t('commons.save')}}</el-button>
</span>
</template>
</el-dialog>
@ -78,7 +78,7 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" @click="updateWorkspace('updateForm')" onkeydown="return false;"
<el-button type="primary" @click="updateWorkspace('updateForm')" @keydown.enter.native.prevent
size="medium">{{$t('commons.save')}}</el-button>
</span>
</template>
@ -101,9 +101,9 @@
</el-table-column>
<el-table-column :label="$t('commons.operating')">
<template v-slot:default="scope">
<el-button @click="editMember(scope.row)" onkeydown="return false;" type="primary" icon="el-icon-edit"
<el-button @click="editMember(scope.row)" @keydown.enter.native.prevent type="primary" icon="el-icon-edit"
size="mini" circle/>
<el-button @click="delMember(scope.row)" onkeydown="return false;" type="danger" icon="el-icon-delete"
<el-button @click="delMember(scope.row)" @keydown.enter.native.prevent type="danger" icon="el-icon-delete"
size="mini" circle/>
</template>
</el-table-column>
@ -146,7 +146,9 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" onkeydown="return false;" @click="submitForm('form')" size="medium">{{$t('commons.save')}}</el-button>
<el-button type="primary" @keydown.enter.native.prevent @click="submitForm('form')" size="medium">
{{$t('commons.save')}}
</el-button>
</span>
</template>
</el-dialog>
@ -182,8 +184,9 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" @click="updateOrgMember('updateUserForm')" onkeydown="return false;"
size="medium">{{$t('commons.save')}}</el-button>
<el-button type="primary" @click="updateOrgMember('updateUserForm')" @keydown.enter.native.prevent
size="medium">{{$t('commons.save')}}
</el-button>
</span>
</template>

View File

@ -122,9 +122,10 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" onkeydown="return false;"
@click="createTestResourcePool('createTestResourcePoolForm')"
size="medium">{{$t('commons.create')}}</el-button>
<el-button @click="createTestResourcePool('createTestResourcePoolForm')" @keydown.enter.native.prevent
type="primary"
size="medium">{{$t('commons.create')}}
</el-button>
</span>
</template>
</el-dialog>
@ -202,9 +203,10 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" onkeydown="return false;"
@click="updateTestResourcePool('updateTestResourcePoolForm')"
size="medium">{{$t('commons.save')}}</el-button>
<el-button @click="updateTestResourcePool('updateTestResourcePoolForm')" @keydown.enter.native.prevent
type="primary"
size="medium">{{$t('commons.save')}}
</el-button>
</span>
</template>
</el-dialog>

View File

@ -59,8 +59,8 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" onkeydown="return false;"
@click="createUser('createUserForm')" size="medium">创建</el-button>
<el-button @click="createUser('createUserForm')" @keydown.enter.native.prevent type="primary"
size="medium">{{$t('commons.save')}}</el-button>
</span>
</template>
</el-dialog>
@ -83,8 +83,9 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" onkeydown="return false;"
@click="updateUser('updateUserForm')" size="medium">{{$t('commons.save')}}</el-button>
<el-button @click="updateUser('updateUserForm')" @keydown.enter.native.prevent type="primary"
size="medium">{{$t('commons.save')}}
</el-button>
</span>
</template>
</el-dialog>

View File

@ -16,9 +16,11 @@
</el-table-column>
<el-table-column>
<template v-slot:default="scope">
<el-button @click="edit(scope.row)" onkeydown="return false;" type="primary" icon="el-icon-edit" size="mini"
<el-button @click="edit(scope.row)" type="primary" icon="el-icon-edit" size="mini"
@keydown.enter.native.prevent
circle v-permission="['test_manager']"/>
<el-button @click="del(scope.row)" onkeydown="return false;" type="danger" icon="el-icon-delete" size="mini"
<el-button @click="del(scope.row)" type="danger" icon="el-icon-delete" size="mini"
@keydown.enter.native.prevent
circle v-permission="['test_manager']"/>
</template>
</el-table-column>
@ -56,8 +58,9 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" onkeydown="return false;"
@click="submitForm('form')" size="medium">{{$t('commons.save')}}</el-button>
<el-button @click="submitForm('form')" @keydown.enter.native.prevent type="primary"
size="medium">{{$t('commons.save')}}
</el-button>
</span>
</template>
</el-dialog>
@ -90,8 +93,9 @@
</el-form>
<template v-slot:footer>
<span class="dialog-footer">
<el-button type="primary" onkeydown="return false;"
@click="updateWorkspaceMember('updateUserForm')" size="medium">{{$t('commons.save')}}</el-button>
<el-button @click="updateWorkspaceMember('updateUserForm')" @keydown.enter.native.prevent type="primary"
size="medium">{{$t('commons.save')}}
</el-button>
</span>
</template>
</el-dialog>