【fix ESLint】src/views/system

This commit is contained in:
danshihao
2023-03-08 11:41:38 +08:00
parent 8c419abbac
commit b0c7848175
16 changed files with 41 additions and 72 deletions
+1 -2
View File
@@ -593,8 +593,7 @@ export default {
if (!value || new RegExp(/^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/).test(value)) {
callback()
} else {
// eslint-disable-next-line standard/no-callback-literal
callback('您的手机号码格式不正确!')
callback(new Error('您的手机号码格式不正确!'))
}
},
onSyncFinally ({ isToLocal }) {
@@ -195,7 +195,6 @@ export default {
SelectUserModal,
RoleModal,
UserModal,
// eslint-disable-next-line vue/no-unused-components
moment
},
data () {
@@ -238,11 +238,9 @@ export default {
} else {
row.children = ''
row.hasChildrenField = '0'
// eslint-disable-next-line prefer-promise-reject-errors
reject()
}
} else {
// eslint-disable-next-line prefer-promise-reject-errors
reject()
}
})
@@ -119,7 +119,6 @@ export default {
components: {
SysCheckRuleModal,
SysCheckRuleTestModal,
// eslint-disable-next-line vue/no-unused-components
JEllipsis
},
data () {
@@ -108,7 +108,6 @@ export default {
name: 'SysDataSourceList',
mixins: [JeroListMixin],
components: {
// eslint-disable-next-line vue/no-unused-components
JEllipsis,
SysDataSourceModal
},
@@ -210,8 +210,7 @@ export default {
if (!value || new RegExp(/^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/).test(value)) {
callback()
} else {
// eslint-disable-next-line standard/no-callback-literal
callback('您的手机号码格式不正确!')
callback(new Error('您的手机号码格式不正确!'))
}
}
}
@@ -166,8 +166,7 @@ export default {
if (value) {
const reg = new RegExp("[`_~!@#$^&*()=|{}'.<>《》/?!¥()—【】‘;:”“。,、?]")
if (reg.test(value)) {
// eslint-disable-next-line standard/no-callback-literal
callback('数据值不能包含特殊字符')
callback(new Error('数据值不能包含特殊字符'))
} else {
// update--begin--autor:lvdandan-----date:20201203------forJT-27【数据字典】字典 - 数据值可重复
getAction('/sys/dictItem/dictItemCheck', param).then((res) => {
@@ -118,8 +118,7 @@ export default {
const confirmpassword = form.getFieldValue('confirmpassword')
console.log('confirmpassword==>', confirmpassword)
if (value && confirmpassword && value !== confirmpassword) {
// eslint-disable-next-line standard/no-callback-literal
callback('两次输入的密码不一样!')
callback(new Error('两次输入的密码不一样!'))
}
if (value && this.confirmDirty) {
form.validateFields(['confirm'], { force: true })
@@ -129,8 +128,7 @@ export default {
compareToFirstPassword (rule, value, callback) {
const form = this.form
if (value && value !== form.getFieldValue('password')) {
// eslint-disable-next-line standard/no-callback-literal
callback('两次输入的密码不一样!')
callback(new Error('两次输入的密码不一样!'))
} else {
callback()
}
@@ -295,8 +295,7 @@ export default {
if (!value || new RegExp(/^[0-9]*[1-9][0-9]*$/).test(value)) {
callback()
} else {
// eslint-disable-next-line standard/no-callback-literal
callback('请输入正整数!')
callback(new Error('请输入正整数!'))
}
},
validatePerms (rule, value, callback) {
@@ -312,8 +311,7 @@ export default {
if (res.success) {
callback()
} else {
// eslint-disable-next-line standard/no-callback-literal
callback('授权标识已存在!')
callback(new Error('授权标识已存在!'))
}
})
} else {
@@ -109,8 +109,7 @@ export default {
},
validateRoleCode (rule, value, callback) {
if (/[\u4E00-\u9FA5]/g.test(value)) {
// eslint-disable-next-line standard/no-callback-literal
callback('角色编码不可输入汉字!')
callback(new Error('角色编码不可输入汉字!'))
} else {
const params = {
tableName: 'sys_role',
@@ -323,8 +323,7 @@ export default {
} else if (moment(value).isBefore(endTime)) {
callback()
} else {
// eslint-disable-next-line standard/no-callback-literal
callback('开始时间需小于结束时间')
callback(new Error('开始时间需小于结束时间'))
}
},
endTimeValidate (rule, value, callback) {
@@ -334,8 +333,7 @@ export default {
} else if (moment(startTime).isBefore(value)) {
callback()
} else {
// eslint-disable-next-line standard/no-callback-literal
callback('结束时间需大于开始时间')
callback(new Error('结束时间需大于开始时间'))
}
},
handleChange (userList) {
@@ -162,7 +162,6 @@ export default {
width: '20%',
type: FormTypes.input,
validateRules: [
// eslint-disable-next-line no-template-curly-in-string
{ required: true, message: '${title}不能为空' }
]
},
@@ -185,7 +184,6 @@ export default {
width: '15%',
type: FormTypes.inputNumber,
validateRules: [
// eslint-disable-next-line no-template-curly-in-string
{ required: true, message: '${title}不能为空' },
{ pattern: /^[1-9]\d*$/, message: '请输入零以上的正整数' }
]
@@ -206,7 +204,6 @@ export default {
width: '20%',
type: FormTypes.input,
validateRules: [
// eslint-disable-next-line no-template-curly-in-string
{ required: true, message: '${title}不能为空' }
]
},
@@ -232,19 +229,18 @@ export default {
methods: {
validatePatternHandler (type, value, row, column, callback) {
let status = null
if (type === 'blur' || type === 'getValues') {
try {
// eslint-disable-next-line no-new
new RegExp(value)
// eslint-disable-next-line standard/no-callback-literal
callback(true)
status = !!new RegExp(value)
callback(status)
} catch (e) {
// eslint-disable-next-line standard/no-callback-literal
callback(false, '请输入正确的正则表达式')
status = false
callback(status, '请输入正确的正则表达式')
}
} else {
// eslint-disable-next-line standard/no-callback-literal
callback(true) // 不填写或者填写 null 代表不进行任何操作
status = true
callback(status) // 不填写或者填写 null 代表不进行任何操作
}
},
@@ -295,18 +291,18 @@ export default {
alwaysResolve(this.$refs.globalTable.getValuesPromise)
]).then(results => {
const [mainResult, designResult, globalResult] = results
let errorInfo = ''
if (mainResult.type === failedSymbol) {
// eslint-disable-next-line prefer-promise-reject-errors
return Promise.reject('主表校验未通过')
errorInfo = '主表校验未通过'
return Promise.reject(errorInfo)
} else if (designResult.type === failedSymbol) {
this.tabs.activeKey = this.tabs.design.key
// eslint-disable-next-line prefer-promise-reject-errors
return Promise.reject('局部规则子表校验未通过')
errorInfo = '局部规则子表校验未通过'
return Promise.reject(errorInfo)
} else if (globalResult.type === failedSymbol) {
this.tabs.activeKey = this.tabs.global.key
// eslint-disable-next-line prefer-promise-reject-errors
return Promise.reject('全局规则子表校验未通过')
errorInfo = '全局规则子表校验未通过'
return Promise.reject(errorInfo)
} else {
// 所有校验已通过,这一步是整合数据
const mainValues = mainResult.data; const globalValues = globalResult.data; const designValues = designResult.data
@@ -104,8 +104,7 @@ export default {
validator: (rule, value, callback) => {
const pattern = /^[a-z|A-Z][a-z|A-Z\d_-]{0,}$/
if (!pattern.test(value)) {
// eslint-disable-next-line standard/no-callback-literal
callback('编码必须以字母开头可包含数字下划线横杠')
callback(new Error('编码必须以字母开头可包含数字下划线横杠'))
} else {
validateDuplicateValue('sys_data_source', 'code', value, this.model.id, callback)
}
@@ -55,20 +55,21 @@ export default {
ruleClass: [{ required: true, message: '规则实现类不能为空' }],
ruleParams: [{
validator: (rule, value, callback) => {
let info = ''
try {
const json = JSON.parse(value)
if (json instanceof Array) {
// eslint-disable-next-line standard/no-callback-literal
callback('只能传递JSON对象不能传递JSON数组')
info = '只能传递JSON对象不能传递JSON数组'
callback(info)
} else if (json instanceof Object) {
callback()
} else {
// eslint-disable-next-line standard/no-callback-literal
callback('请输入JSON字符串')
info = '请输入JSON字符串'
callback(info)
}
} catch {
// eslint-disable-next-line standard/no-callback-literal
callback('请输入JSON字符串')
info = '请输入JSON字符串'
callback(info)
}
}
}]
@@ -54,7 +54,6 @@ export default {
components: {
JFormContainer,
JDate,
// eslint-disable-next-line vue/no-unused-components
JDictSelectTag
},
props: {
@@ -227,9 +227,7 @@ export default {
that.model = Object.assign({}, { selectedroles: '', selecteddeparts: '' }, record)
// 身份为上级显示负责部门,否则不显示
this.departIdShow = this.model.userIdentity === 2
// eslint-disable-next-line no-prototype-builtins
if (record.hasOwnProperty('id')) {
if (Object.prototype.hasOwnProperty.call(record, 'id')) {
that.userId = record.id
that.getUserRoles(record.id)
that.getUserDeparts(record.id)
@@ -386,8 +384,7 @@ export default {
const confirmpassword = this.model.confirmpassword
if (value && confirmpassword && value !== confirmpassword) {
// eslint-disable-next-line standard/no-callback-literal
callback('两次输入的密码不一样')
callback(new Error('两次输入的密码不一样'))
}
if (value && this.confirmDirty) {
this.$refs.form.validateField(['confirmpassword'])
@@ -396,8 +393,7 @@ export default {
},
compareToFirstPassword (rule, value, callback) {
if (value && value !== this.model.password) {
// eslint-disable-next-line standard/no-callback-literal
callback('两次输入的密码不一样')
callback(new Error('两次输入的密码不一样'))
} else {
callback()
}
@@ -417,13 +413,11 @@ export default {
if (res.success) {
callback()
} else {
// eslint-disable-next-line standard/no-callback-literal
callback('手机号已存在!')
callback(new Error('手机号已存在!'))
}
})
} else {
// eslint-disable-next-line standard/no-callback-literal
callback('请输入正确格式的手机号码!')
callback(new Error('请输入正确格式的手机号码!'))
}
}
},
@@ -431,7 +425,6 @@ export default {
if (!value) {
callback()
} else {
// eslint-disable-next-line
if (new RegExp(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/).test(value)) {
const params = {
tableName: 'sys_user',
@@ -444,13 +437,11 @@ export default {
if (res.success) {
callback()
} else {
// eslint-disable-next-line standard/no-callback-literal
callback('邮箱已存在!')
callback(new Error('邮箱已存在!'))
}
})
} else {
// eslint-disable-next-line standard/no-callback-literal
callback('请输入正确格式的邮箱!')
callback(new Error('请输入正确格式的邮箱!'))
}
}
},
@@ -465,8 +456,7 @@ export default {
if (res.success) {
callback()
} else {
// eslint-disable-next-line standard/no-callback-literal
callback('用户名已存在!')
callback(new Error('用户名已存在!'))
}
})
},
@@ -481,8 +471,7 @@ export default {
if (res.success) {
callback()
} else {
// eslint-disable-next-line standard/no-callback-literal
callback('工号已存在!')
callback(new Error('工号已存在!'))
}
})
},