diff --git a/src/components/Crud/crud.js b/src/components/Crud/crud.js index de7f91e..6d8bbb7 100644 --- a/src/components/Crud/crud.js +++ b/src/components/Crud/crud.js @@ -158,7 +158,7 @@ function CRUD(options) { */ toAdd() { crud.resetForm() - if (!(callVmHook(crud, CRUD.HOOK.beforeToAdd, crud.form) && callVmHook(crud, CRUD.HOOK.beforeToCU, crud.form))) { + if (!(callVmHook(crud, CRUD.HOOK.beforeToAdd, crud.form) && callVmHook(crud, CRUD.HOOK.beforeToCU, crud.form, 'add'))) { return } crud.status.add = CRUD.STATUS.PREPARED @@ -171,7 +171,7 @@ function CRUD(options) { */ toEdit(data) { crud.resetForm(JSON.parse(JSON.stringify(data))) - if (!(callVmHook(crud, CRUD.HOOK.beforeToEdit, crud.form) && callVmHook(crud, CRUD.HOOK.beforeToCU, crud.form))) { + if (!(callVmHook(crud, CRUD.HOOK.beforeToEdit, crud.form) && callVmHook(crud, CRUD.HOOK.beforeToCU, crud.form, 'edit'))) { return } crud.status.edit = CRUD.STATUS.PREPARED diff --git a/src/views/archivesConfig/commonFields/index.vue b/src/views/archivesConfig/commonFields/index.vue index 4898d3f..25e356b 100644 --- a/src/views/archivesConfig/commonFields/index.vue +++ b/src/views/archivesConfig/commonFields/index.vue @@ -37,7 +37,7 @@ - 确 定 + 确定验证 @@ -80,46 +80,33 @@ export default { form: { verifyCode: '' }, - formLabelWidth: '110px' + formLabelWidth: '110px', + btn: '', + showVerifyDialog: true } }, methods: { - // 获取数据前设置好接口地址 - // [CRUD.HOOK.beforeToCU]() { - // const h = this.$createElement - // return this.$prompt(h('p', null, [ - // h('span', null, '这里为技术人员维护系统时使用,用户级无需设置。'), - // h('br', null, ''), - // h('span', { style: 'color: red' }, '警告:强行修改会导致系统数据异常或丢失!如因用户强行修改,本系统不负责因此导致的相关后果!') - // ]), '关键提示', { - // confirmButtonText: '确定验证', - // showCancelButton: false, - // customClass: 'validate', - // beforeClose: (action, instance, done) => { - // if (action === 'confirm') { - // if (instance.inputValue === '123') { - // done() - // } else { - // this.$message.error('验证码错误!') - // } - // } else { - // done() - // } - // } - // }).then(({ value }) => { - // // call crud.status.add = CRUD.STATUS.PREPARED - // }).catch(() => { - // return false - // }) - // }, - // 获取数据前设置好接口地址 - [CRUD.HOOK.beforeToCU]() { - this.verifyDialogVisible = true + [CRUD.HOOK.beforeToCU](crud, form, btn) { + console.log(btn) + if (this.showVerifyDialog) { + // 打开输入验证码对话框 + this.verifyDialogVisible = true + this.btn = btn + return false + } }, handleConfirm() { if (this.form.verifyCode === '123') { + // 关闭输入验证码对话框 this.verifyDialogVisible = false this.form.verifyCode = '' + this.showVerifyDialog = false + if (this.btn === 'add') { + this.crud.toAdd() + } else if (this.btn === 'edit') { + this.crud.toEdit(this.crud.selections[0]) + } + this.showVerifyDialog = true } else { this.$message.error('验证码错误!') } @@ -153,12 +140,7 @@ export default { ::v-deep thead .el-table-column--selection .cell { display: none; } -.validate .el-message-box__btns { - text-align: center; -} - - diff --git a/src/views/archivesConfig/dict/dictDetail.vue b/src/views/archivesConfig/dict/dictDetail.vue index d261bb7..efb8748 100644 --- a/src/views/archivesConfig/dict/dictDetail.vue +++ b/src/views/archivesConfig/dict/dictDetail.vue @@ -63,8 +63,7 @@ export default { download: false, group: false }, - queryOnPresenterCreated: false, - debug: true + queryOnPresenterCreated: false }) ] },