【fix ESLint】src/components、src/utils
This commit is contained in:
@@ -23,7 +23,7 @@ const FormTypes = {
|
||||
slot: 'slot',
|
||||
hidden: 'hidden'
|
||||
}
|
||||
const VALIDATE_NO_PASSED = Symbol()
|
||||
const VALIDATE_NO_PASSED = Symbol('')
|
||||
export { FormTypes, VALIDATE_NO_PASSED }
|
||||
|
||||
/**
|
||||
@@ -56,7 +56,7 @@ export function getRefPromise (vm, name) {
|
||||
*/
|
||||
export function validateFormAndTables (form, cases) {
|
||||
if (!(form && typeof form.validateFields === 'function')) {
|
||||
throw `form 参数需要的是一个form对象,而传入的却是${typeof form}`
|
||||
throw new Error(`form 参数需要的是一个form对象,而传入的却是${typeof form}`)
|
||||
}
|
||||
|
||||
const options = {}
|
||||
@@ -80,18 +80,19 @@ export function validateFormAndTables (form, cases) {
|
||||
/**
|
||||
* 一次性验证主表单和所有的次表单(新版本)
|
||||
* @param form 主表单 form 对象
|
||||
* @param values
|
||||
* @param cases 接收一个数组,每项都是一个JEditableTable实例
|
||||
* @returns {Promise<any>}
|
||||
* @author sunjianlei
|
||||
*/
|
||||
export function validateFormModelAndTables (form, values, cases) {
|
||||
if (!(form && typeof form.validate === 'function')) {
|
||||
throw `form 参数需要的是一个form对象,而传入的却是${typeof form}`
|
||||
throw new Error(`form 参数需要的是一个form对象,而传入的却是${typeof form}`)
|
||||
}
|
||||
const options = {}
|
||||
return new Promise((resolve, reject) => {
|
||||
// 验证主表表单
|
||||
form.validate((valid, obj) => {
|
||||
form.validate((valid) => {
|
||||
valid ? resolve(values) : reject({ error: VALIDATE_NO_PASSED })
|
||||
})
|
||||
}).then(values => {
|
||||
@@ -114,7 +115,7 @@ export function validateFormModelAndTables (form, values, cases) {
|
||||
*/
|
||||
export function validateTables (cases, deleteTempId) {
|
||||
if (!(cases instanceof Array)) {
|
||||
throw `'validateTables'函数的'cases'参数需要的是一个数组,而传入的却是${typeof cases}`
|
||||
throw new Error(`'validateTables'函数的'cases'参数需要的是一个数组,而传入的却是${typeof cases}`)
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
const tables = []
|
||||
|
||||
Reference in New Issue
Block a user