update 校验重复接口调整

This commit is contained in:
danshihao
2023-11-15 17:19:28 +08:00
parent d6ca1c2602
commit 92c3a6f95d
5 changed files with 28 additions and 9 deletions
+8 -1
View File
@@ -643,7 +643,8 @@ export function getConfusionCode (tableName, fieldName) {
email: 'user_email' email: 'user_email'
}, },
sys_role: { sys_role: {
role_code: 'sys_rolecode' role_code: 'sys_rolecode',
role_name: 'sys_rolename'
}, },
sys_dict: { sys_dict: {
dict_code: 'sys_dictcode' dict_code: 'sys_dictcode'
@@ -662,6 +663,12 @@ export function getConfusionCode (tableName, fieldName) {
}, },
sys_sms_template: { sys_sms_template: {
template_code: 'sms_template_code' template_code: 'sms_template_code'
},
sys_permission: {
perms: 'sys_permission_perms'
},
sys_position: {
code: 'sys_position_code'
} }
} }
if (map[tableName] && map[tableName][fieldName]) { if (map[tableName] && map[tableName][fieldName]) {
+6 -2
View File
@@ -58,6 +58,7 @@
<script> <script>
// import pick from 'lodash.pick' // import pick from 'lodash.pick'
import { addDict, editDict, duplicateCheck } from '@/api/api' import { addDict, editDict, duplicateCheck } from '@/api/api'
import { getConfusionCode } from '@/utils/util'
export default { export default {
name: 'DictModal', name: 'DictModal',
@@ -88,10 +89,13 @@ export default {
}, },
methods: { methods: {
validateDictCode (rule, value, callback) { validateDictCode (rule, value, callback) {
const confusionCode = getConfusionCode('sys_dict', 'dict_code')
// 重复校验 // 重复校验
const params = { const params = {
tableName: 'sys_dict', // tableName: 'sys_dict',
fieldName: 'dict_code', // fieldName: 'dict_code',
confusionCode,
fieldVal: value, fieldVal: value,
dataId: this.model.id dataId: this.model.id
} }
+5 -2
View File
@@ -185,6 +185,7 @@
import { addPermission, editPermission, queryTreeList, duplicateCheck } from '@/api/api' import { addPermission, editPermission, queryTreeList, duplicateCheck } from '@/api/api'
import Icons from './icon/Icons' import Icons from './icon/Icons'
import JDictSelectTag from '../../../components/dict/JDictSelectTag' import JDictSelectTag from '../../../components/dict/JDictSelectTag'
import { getConfusionCode } from '@/utils/util'
export default { export default {
name: 'PermissionModal', name: 'PermissionModal',
@@ -311,10 +312,12 @@ export default {
}, },
validatePerms (rule, value, callback) { validatePerms (rule, value, callback) {
if (value && value.length > 0) { if (value && value.length > 0) {
const confusionCode = getConfusionCode('sys_permission', 'perms')
// 校验授权标识是否存在 // 校验授权标识是否存在
const params = { const params = {
tableName: 'sys_permission', // tableName: 'sys_permission',
fieldName: 'perms', // fieldName: 'perms',
confusionCode,
fieldVal: value, fieldVal: value,
dataId: this.model.id dataId: this.model.id
} }
+4 -2
View File
@@ -135,9 +135,11 @@ export default {
if (!value) { if (!value) {
callback(new Error(this.$t('pleaseEnter') + this.$t('roleManage.roleName') + '!')) callback(new Error(this.$t('pleaseEnter') + this.$t('roleManage.roleName') + '!'))
} else { } else {
const confusionCode = getConfusionCode('sys_role', 'role_name')
const params = { const params = {
tableName: 'sys_role', // tableName: 'sys_role',
fieldName: 'role_name', // fieldName: 'role_name',
confusionCode,
fieldVal: value, fieldVal: value,
dataId: this.model.id dataId: this.model.id
} }
@@ -52,6 +52,7 @@
import { httpAction } from '@/api/manage' import { httpAction } from '@/api/manage'
import { duplicateCheck } from '@/api/api' import { duplicateCheck } from '@/api/api'
import JDictSelectTag from '@/components/dict/JDictSelectTag' import JDictSelectTag from '@/components/dict/JDictSelectTag'
import { getConfusionCode } from '@/utils/util'
let validatorCodeTimer = null let validatorCodeTimer = null
@@ -83,9 +84,11 @@ export default {
clearTimeout(validatorCodeTimer) clearTimeout(validatorCodeTimer)
} }
validatorCodeTimer = setTimeout(() => { validatorCodeTimer = setTimeout(() => {
const confusionCode = getConfusionCode('sys_position', 'code')
duplicateCheck({ duplicateCheck({
tableName: 'sys_position', // tableName: 'sys_position',
fieldName: 'code', // fieldName: 'code',
confusionCode,
fieldVal: value, fieldVal: value,
dataId: this.model.id dataId: this.model.id
}).then((res) => { }).then((res) => {