【fix ESLint】src/components、src/utils

This commit is contained in:
zhaoxiao
2023-03-06 14:04:51 +08:00
parent 8c5844500b
commit d564f67722
13 changed files with 106 additions and 121 deletions
+16 -20
View File
@@ -38,7 +38,7 @@ export function filterObj (obj) {
for (const key in obj) {
if (obj.hasOwnProperty(key) &&
(obj[key] == null || obj[key] == undefined || obj[key] === '')) {
(obj[key] == null || obj[key] === undefined || obj[key] === '')) {
delete obj[key]
}
}
@@ -84,7 +84,7 @@ export function formatDate (value, fmt) {
// 生成首页路由
export function generateIndexRouter (data) {
const redirectPath = findFirstRoute(data)
const indexRouter = [{
return [{
path: '/',
name: 'dashboard',
// component: () => import('@/components/layouts/BasicLayout'),
@@ -97,7 +97,6 @@ export function generateIndexRouter (data) {
}, {
path: '*', redirect: '/404', hidden: true
}]
return indexRouter
}
// 生成嵌套路由(子路由)
@@ -113,28 +112,28 @@ function generateChildRouters (data) {
}
// eslint-disable-next-line
let URL = (item.meta.url|| '').replace(/{{([^}}]+)?}}/g, (s1, s2) => eval(s2)) // URL支持{{ window.xxx }}占位符变量
if (isURL(URL) || (item.meta.url && item.meta.url.indexOf('{{') == 0)) {
if (isURL(URL) || (item.meta.url && item.meta.url.indexOf('{{') === 0)) {
item.meta.url = URL
}
let componentPath
if (item.component == 'modules/online/cgform/OnlCgformHeadList') {
if (item.component === 'modules/online/cgform/OnlCgformHeadList') {
componentPath = onlineCommons.OnlCgformHeadList
} else if (item.component == 'modules/online/cgform/OnlCgformCopyList') {
} else if (item.component + '' === 'modules/online/cgform/OnlCgformCopyList') {
componentPath = onlineCommons.OnlCgformCopyList
} else if (item.component == 'modules/online/cgform/auto/OnlCgformAutoList') {
} else if (item.component + '' === 'modules/online/cgform/auto/OnlCgformAutoList') {
componentPath = onlineCommons.OnlCgformAutoList
} else if (item.component == 'modules/online/cgform/auto/OnlCgformTreeList') {
} else if (item.component + '' === 'modules/online/cgform/auto/OnlCgformTreeList') {
componentPath = onlineCommons.OnlCgformTreeList
} else if (item.component == 'modules/online/cgform/auto/erp/OnlCgformErpList') {
} else if (item.component + '' === 'modules/online/cgform/auto/erp/OnlCgformErpList') {
componentPath = onlineCommons.OnlCgformErpList
} else if (item.component == 'modules/online/cgform/auto/tab/OnlCgformTabList') {
} else if (item.component + '' === 'modules/online/cgform/auto/tab/OnlCgformTabList') {
componentPath = onlineCommons.OnlCgformTabList
} else if (item.component == 'modules/online/cgform/auto/innerTable/OnlCgformInnerTableList') {
} else if (item.component + '' === 'modules/online/cgform/auto/innerTable/OnlCgformInnerTableList') {
componentPath = onlineCommons.OnlCgformInnerTableList
} else if (item.component == 'modules/online/cgreport/OnlCgreportHeadList') {
} else if (item.component + '' === 'modules/online/cgreport/OnlCgreportHeadList') {
componentPath = onlineCommons.OnlCgreportHeadList
} else if (item.component == 'modules/online/cgreport/auto/OnlCgreportAutoList') {
} else if (item.component + '' === 'modules/online/cgreport/auto/OnlCgreportAutoList') {
componentPath = onlineCommons.OnlCgreportAutoList
} else {
componentPath = resolve => require(['@/' + component + '.vue'], resolve)
@@ -259,10 +258,7 @@ export function underLine2CamelCase (string) {
* @returns {*}
*/
export function showDealBtn (bpmStatus) {
if (bpmStatus != '1' && bpmStatus != '3' && bpmStatus != '4') {
return true
}
return false
return bpmStatus + '' !== '1' && bpmStatus + '' !== '3' && bpmStatus + '' !== '4'
}
/**
@@ -408,12 +404,12 @@ export function pushIfNotExist (array, value, key) {
* 可用于判断是否成功
* @type {symbol}
*/
export const succeedSymbol = Symbol()
export const succeedSymbol = Symbol('')
/**
* 可用于判断是否失败
* @type {symbol}
*/
export const failedSymbol = Symbol()
export const failedSymbol = Symbol('')
/**
* 使 promise 无论如何都会 resolve,除非传入的参数不是一个Promise对象或返回Promise对象的方法
@@ -550,7 +546,7 @@ export function neverNull (value, def) {
export function removeArrayElement (array, prod, value) {
let index = -1
for (let i = 0; i < array.length; i++) {
if (array[i][prod] == value) {
if (array[i][prod] + '' === value + '') {
index = i
break
}