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