【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
@@ -819,7 +819,8 @@ export default {
/** 获取表格表单里的值 */ /** 获取表格表单里的值 */
getValues (callback, rowIds) { getValues (callback, rowIds) {
const tableData = this.getTableData({ rowIds: rowIds }) const tableData = this.getTableData({ rowIds: rowIds })
callback('', tableData) const msg = ''
callback(msg, tableData)
}, },
/** 获取表格数据 */ /** 获取表格数据 */
getTableData (options = {}) { getTableData (options = {}) {
@@ -34416,7 +34416,7 @@
function r(e) { function r(e) {
return e || (e = "朝阳区"), "北京市 ".concat(e) return e || (e = "朝阳区"), "北京市 ".concat(e)
} }
n.r(t), n.d(t, "demoFieldDefVal_getAddress", (function() { n.r(t), n.d(t, "demoFieldDefValGetAddress", (function() {
return r return r
})) }))
}, },
@@ -137,7 +137,7 @@ export default {
const form = this.form const form = this.form
if (value && value !== form.getFieldValue('password')) { if (value && value !== form.getFieldValue('password')) {
// eslint-disable-next-line standard/no-callback-literal // eslint-disable-next-line standard/no-callback-literal
callback('两次输入的密码不一样') callback(new Error('两次输入的密码不一样'))
} else { } else {
callback() callback()
} }
+6 -5
View File
@@ -23,7 +23,7 @@ const FormTypes = {
slot: 'slot', slot: 'slot',
hidden: 'hidden' hidden: 'hidden'
} }
const VALIDATE_NO_PASSED = Symbol() const VALIDATE_NO_PASSED = Symbol('')
export { FormTypes, VALIDATE_NO_PASSED } export { FormTypes, VALIDATE_NO_PASSED }
/** /**
@@ -56,7 +56,7 @@ export function getRefPromise (vm, name) {
*/ */
export function validateFormAndTables (form, cases) { export function validateFormAndTables (form, cases) {
if (!(form && typeof form.validateFields === 'function')) { if (!(form && typeof form.validateFields === 'function')) {
throw `form 参数需要的是一个form对象而传入的却是${typeof form}` throw new Error(`form 参数需要的是一个form对象而传入的却是${typeof form}`)
} }
const options = {} const options = {}
@@ -80,18 +80,19 @@ export function validateFormAndTables (form, cases) {
/** /**
* 一次性验证主表单和所有的次表单(新版本) * 一次性验证主表单和所有的次表单(新版本)
* @param form 主表单 form 对象 * @param form 主表单 form 对象
* @param values
* @param cases 接收一个数组,每项都是一个JEditableTable实例 * @param cases 接收一个数组,每项都是一个JEditableTable实例
* @returns {Promise<any>} * @returns {Promise<any>}
* @author sunjianlei * @author sunjianlei
*/ */
export function validateFormModelAndTables (form, values, cases) { export function validateFormModelAndTables (form, values, cases) {
if (!(form && typeof form.validate === 'function')) { if (!(form && typeof form.validate === 'function')) {
throw `form 参数需要的是一个form对象而传入的却是${typeof form}` throw new Error(`form 参数需要的是一个form对象而传入的却是${typeof form}`)
} }
const options = {} const options = {}
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// 验证主表表单 // 验证主表表单
form.validate((valid, obj) => { form.validate((valid) => {
valid ? resolve(values) : reject({ error: VALIDATE_NO_PASSED }) valid ? resolve(values) : reject({ error: VALIDATE_NO_PASSED })
}) })
}).then(values => { }).then(values => {
@@ -114,7 +115,7 @@ export function validateFormModelAndTables (form, values, cases) {
*/ */
export function validateTables (cases, deleteTempId) { export function validateTables (cases, deleteTempId) {
if (!(cases instanceof Array)) { if (!(cases instanceof Array)) {
throw `'validateTables'函数的'cases'参数需要的是一个数组而传入的却是${typeof cases}` throw new Error(`'validateTables'函数的'cases'参数需要的是一个数组而传入的却是${typeof cases}`)
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const tables = [] const tables = []
+25 -40
View File
@@ -1,4 +1,4 @@
import { USER_AUTH, SYS_BUTTON_AUTH } from '@/store/mutation-types' import { SYS_BUTTON_AUTH, USER_AUTH } from '@/store/mutation-types'
export function disabledAuthFilter (code, formData) { export function disabledAuthFilter (code, formData) {
if (nodeDisabledAuth(code, formData)) { if (nodeDisabledAuth(code, formData)) {
@@ -13,7 +13,7 @@ function nodeDisabledAuth (code, formData) {
try { try {
if (formData) { if (formData) {
const bpmList = formData.permissionList const bpmList = formData.permissionList
permissionList = bpmList.filter(item => item.type == '2') permissionList = bpmList.filter(item => item.type + '' === '2')
// for (let bpm of bpmList) { // for (let bpm of bpmList) {
// if(bpm.type == '2') { // if(bpm.type == '2') {
// permissionList.push(bpm); // permissionList.push(bpm);
@@ -25,14 +25,14 @@ function nodeDisabledAuth (code, formData) {
} catch (e) { } catch (e) {
// console.log("页面权限异常----", e); // console.log("页面权限异常----", e);
} }
if (permissionList.length == 0) { if (permissionList.length === 0) {
return false return false
} }
console.log('流程节点页面权限禁用--NODE--开始') console.log('流程节点页面权限禁用--NODE--开始')
const permissions = [] const permissions = []
for (const item of permissionList) { for (const item of permissionList) {
if (item.type == '2') { if (item.type + '' === '2') {
permissions.push(item.action) permissions.push(item.action)
} }
} }
@@ -57,24 +57,24 @@ function globalDisabledAuth (code) {
// let authList = Vue.ls.get(USER_AUTH); // let authList = Vue.ls.get(USER_AUTH);
const authList = JSON.parse(sessionStorage.getItem(USER_AUTH) || '[]') const authList = JSON.parse(sessionStorage.getItem(USER_AUTH) || '[]')
for (const auth of authList) { for (const auth of authList) {
if (auth.type == '2') { if (auth.type + '' === '2') {
permissionList.push(auth) permissionList.push(auth)
} }
} }
// console.log("页面禁用权限--Global--",sessionStorage.getItem(SYS_BUTTON_AUTH)); // console.log("页面禁用权限--Global--",sessionStorage.getItem(SYS_BUTTON_AUTH));
const allAuthList = JSON.parse(sessionStorage.getItem(SYS_BUTTON_AUTH) || '[]') const allAuthList = JSON.parse(sessionStorage.getItem(SYS_BUTTON_AUTH) || '[]')
for (const gauth of allAuthList) { for (const gauth of allAuthList) {
if (gauth.type == '2') { if (gauth.type + '' === '2') {
allPermissionList.push(gauth) allPermissionList.push(gauth)
} }
} }
// 设置全局配置是否有命中 // 设置全局配置是否有命中
let gFlag = false// 禁用命中 let gFlag = false// 禁用命中
let invalidFlag = false// 无效命中 let invalidFlag = false// 无效命中
if (allPermissionList != null && allPermissionList != '' && allPermissionList != undefined && allPermissionList.length > 0) { if (allPermissionList != null && allPermissionList !== '' && allPermissionList !== undefined && allPermissionList.length > 0) {
for (const itemG of allPermissionList) { for (const itemG of allPermissionList) {
if (code === itemG.action) { if (code === itemG.action) {
if (itemG.status == '0') { if (itemG.status + '' === '0') {
invalidFlag = true invalidFlag = true
break break
} else { } else {
@@ -92,7 +92,7 @@ function globalDisabledAuth (code) {
} }
const permissions = [] const permissions = []
for (const item of permissionList) { for (const item of permissionList) {
if (item.type == '2') { if (item.type + '' === '2') {
permissions.push(item.action) permissions.push(item.action)
} }
} }
@@ -111,13 +111,9 @@ function globalDisabledAuth (code) {
export function colAuthFilter (columns, pre) { export function colAuthFilter (columns, pre) {
const authList = getNoAuthCols(pre) const authList = getNoAuthCols(pre)
const cols = columns.filter(item => { return columns.filter(item => {
if (hasColoum(item, authList)) { return hasColoum(item, authList)
return true
}
return false
}) })
return cols
} }
/** /**
@@ -130,7 +126,7 @@ export function colAuthFilter (columns, pre) {
*/ */
export function colAuthFilterJEditableTable (columns, pre) { export function colAuthFilterJEditableTable (columns, pre) {
const authList = getAllShowAndDisabledAuthCols(pre) const authList = getAllShowAndDisabledAuthCols(pre)
const cols = columns.filter(item => { return columns.filter(item => {
let oneAuth = authList.find(auth => { let oneAuth = authList.find(auth => {
return auth.action === pre + item.key return auth.action === pre + item.key
}) })
@@ -144,30 +140,23 @@ export function colAuthFilterJEditableTable (columns, pre) {
} }
// 禁用逻辑 // 禁用逻辑
if (oneAuth.type == '2' && !oneAuth.isAuth) { if (oneAuth.type + '' === '2' && !oneAuth.isAuth) {
item.disabled = true item.disabled = true
return true return true
} }
// 隐藏逻辑逻辑 // 隐藏逻辑逻辑
if (oneAuth.type == '1' && !oneAuth.isAuth) { return !(oneAuth.type + '' === '1' && !oneAuth.isAuth)
return false
}
return true
}) })
return cols
} }
function hasColoum (item, authList) { function hasColoum (item, authList) {
if (authList.includes(item.dataIndex)) { return !authList.includes(item.dataIndex)
return false
}
return true
} }
// 权限无效时不做控制,有效时控制,只能控制 显示不显示 // 权限无效时不做控制,有效时控制,只能控制 显示不显示
// 根据授权码前缀获取未授权的列信息 // 根据授权码前缀获取未授权的列信息
export function getNoAuthCols (pre) { export function getNoAuthCols (pre) {
if (!pre || pre.length == 0) { if (!pre || pre.length === 0) {
return [] return []
} }
const permissionList = [] const permissionList = []
@@ -177,7 +166,7 @@ export function getNoAuthCols (pre) {
const authList = JSON.parse(sessionStorage.getItem(USER_AUTH) || '[]') const authList = JSON.parse(sessionStorage.getItem(USER_AUTH) || '[]')
for (const auth of authList) { for (const auth of authList) {
// 显示策略,有效状态 // 显示策略,有效状态
if (auth.type == '1' && startWith(auth.action, pre)) { if (auth.type + '' === '1' && startWith(auth.action, pre)) {
permissionList.push(substrPre(auth.action, pre)) permissionList.push(substrPre(auth.action, pre))
} }
} }
@@ -185,17 +174,13 @@ export function getNoAuthCols (pre) {
const allAuthList = JSON.parse(sessionStorage.getItem(SYS_BUTTON_AUTH) || '[]') const allAuthList = JSON.parse(sessionStorage.getItem(SYS_BUTTON_AUTH) || '[]')
for (const gauth of allAuthList) { for (const gauth of allAuthList) {
// 显示策略,有效状态 // 显示策略,有效状态
if (gauth.type == '1' && gauth.status == '1' && startWith(gauth.action, pre)) { if (gauth.type + '' === '1' && gauth.status + '' === '1' && startWith(gauth.action, pre)) {
allPermissionList.push(substrPre(gauth.action, pre)) allPermissionList.push(substrPre(gauth.action, pre))
} }
} }
const cols = allPermissionList.filter(item => { return allPermissionList.filter(item => {
if (permissionList.includes(item)) { return !permissionList.includes(item)
return false
}
return true
}) })
return cols
} }
/** /**
@@ -242,20 +227,20 @@ function getAllShowAndDisabledAuthCols (pre) {
// 全部权限配置 // 全部权限配置
const allAuthList = JSON.parse(sessionStorage.getItem(SYS_BUTTON_AUTH) || '[]') const allAuthList = JSON.parse(sessionStorage.getItem(SYS_BUTTON_AUTH) || '[]')
const newAllAuthList = allAuthList.map(function (item, index) { return allAuthList.map(function (item) {
const hasAuthArray = userAuthList.filter(u => u.action === item.action) const hasAuthArray = userAuthList.filter(u => u.action === item.action)
if (hasAuthArray && hasAuthArray.length > 0) { if (hasAuthArray && hasAuthArray.length > 0) {
item.isAuth = true item.isAuth = true
} }
return item return item
}) })
return newAllAuthList
} }
function startWith (str, pre) { function startWith (str, pre) {
if (pre == null || pre == '' || str == null || str == '' || str.length == 0 || pre.length > str.length) { return false } if (pre == null || pre + '' === '' || str == null || str + '' === '' || str.length === 0 || pre.length > str.length) {
if (str.substr(0, pre.length) == pre) { return true } else { return false } return false
}
return str.substr(0, pre.length) + '' === pre + ''
} }
function substrPre (str, pre) { function substrPre (str, pre) {
+6 -6
View File
@@ -14,11 +14,11 @@ export function isEdge () {
export function getIEVersion () { export function getIEVersion () {
const userAgent = navigator.userAgent // 取得浏览器的userAgent字符串 const userAgent = navigator.userAgent // 取得浏览器的userAgent字符串
const isIE = isIE() const isIEFlag = isIE()
const isIE11 = isIE11() const isIE11Flag = isIE11()
const isEdge = isEdge() const isEdgeFlag = isEdge()
if (isIE) { if (isIEFlag) {
const reIE = new RegExp('MSIE (\\d+\\.\\d+);') const reIE = new RegExp('MSIE (\\d+\\.\\d+);')
reIE.test(userAgent) reIE.test(userAgent)
const fIEVersion = parseFloat(RegExp.$1) const fIEVersion = parseFloat(RegExp.$1)
@@ -27,9 +27,9 @@ export function getIEVersion () {
} else { } else {
return 6// IE版本<7 return 6// IE版本<7
} }
} else if (isEdge) { } else if (isEdgeFlag) {
return 'edge' return 'edge'
} else if (isIE11) { } else if (isIE11Flag) {
return 11 return 11
} else { } else {
return -1 return -1
@@ -14,7 +14,7 @@
*/ */
/** 字段默认值官方示例:获取地址 */ /** 字段默认值官方示例:获取地址 */
export function demoFieldDefVal_getAddress (arg) { export function demoFieldDefValGetAddress (arg) {
if (!arg) { if (!arg) {
arg = '朝阳区' arg = '朝阳区'
} }
+29 -26
View File
@@ -34,10 +34,11 @@ export function encryption (word, keyStr, ivStr) {
var CryptoJS = CryptoJS || (function (Math, undefined) { var CryptoJS = CryptoJS || (function (Math, undefined) {
/* /*
* Local polyfil of Object.create * Local polyfil of Object.create
*/ * */
var create = Object.create || (function () { var create = Object.create || (function () {
function F () {}; function F () {
}
return function (obj) { return function (obj) {
var subtype var subtype
@@ -79,11 +80,11 @@ var CryptoJS = CryptoJS || (function (Math, undefined) {
* @example * @example
* *
* var MyType = CryptoJS.lib.Base.extend({ * var MyType = CryptoJS.lib.Base.extend({
* field: 'value', * field: 'value',
* *
* method: function () { * method: function () {
* } * }
* }); * });
*/ */
extend: function (overrides) { extend: function (overrides) {
// Spawn // Spawn
@@ -136,10 +137,10 @@ var CryptoJS = CryptoJS || (function (Math, undefined) {
* @example * @example
* *
* var MyType = CryptoJS.lib.Base.extend({ * var MyType = CryptoJS.lib.Base.extend({
* init: function () { * init: function () {
* // ... * // ...
* } * }
* }); * });
*/ */
init: function () { init: function () {
}, },
@@ -152,8 +153,8 @@ var CryptoJS = CryptoJS || (function (Math, undefined) {
* @example * @example
* *
* MyType.mixIn({ * MyType.mixIn({
* field: 'value' * field: 'value'
* }); * });
*/ */
mixIn: function (properties) { mixIn: function (properties) {
for (var propertyName in properties) { for (var propertyName in properties) {
@@ -2602,7 +2603,8 @@ var CryptoJS = CryptoJS || (function (Math, undefined) {
// Compute Constants // Compute Constants
(function () { (function () {
// Compute rho offset constants // Compute rho offset constants
var x = 1; var y = 0 var x = 1
var y = 0
for (var t = 0; t < 24; t++) { for (var t = 0; t < 24; t++) {
RHO_OFFSETS[x + 5 * y] = ((t + 1) * (t + 2) / 2) % 64 RHO_OFFSETS[x + 5 * y] = ((t + 1) * (t + 2) / 2) % 64
@@ -2713,7 +2715,8 @@ var CryptoJS = CryptoJS || (function (Math, undefined) {
// Theta // Theta
for (var x = 0; x < 5; x++) { for (var x = 0; x < 5; x++) {
// Mix column lanes // Mix column lanes
var tMsw = 0; var tLsw = 0 var tMsw = 0
var tLsw = 0
for (var y = 0; y < 5; y++) { for (var y = 0; y < 5; y++) {
var lane = state[x + 5 * y] var lane = state[x + 5 * y]
tMsw ^= lane.high tMsw ^= lane.high
@@ -3772,16 +3775,16 @@ CryptoJS.lib.Cipher || (function (undefined) {
* @example * @example
* *
* var cipherParams = CryptoJS.lib.CipherParams.create({ * var cipherParams = CryptoJS.lib.CipherParams.create({
* ciphertext: ciphertextWordArray, * ciphertext: ciphertextWordArray,
* key: keyWordArray, * key: keyWordArray,
* iv: ivWordArray, * iv: ivWordArray,
* salt: saltWordArray, * salt: saltWordArray,
* algorithm: CryptoJS.algo.AES, * algorithm: CryptoJS.algo.AES,
* mode: CryptoJS.mode.CBC, * mode: CryptoJS.mode.CBC,
* padding: CryptoJS.pad.PKCS7, * padding: CryptoJS.pad.PKCS7,
* blockSize: 4, * blockSize: 4,
* formatter: CryptoJS.format.OpenSSL * formatter: CryptoJS.format.OpenSSL
* }); * });
*/ */
init: function (cipherParams) { init: function (cipherParams) {
this.mixIn(cipherParams) this.mixIn(cipherParams)
+2 -2
View File
@@ -5,8 +5,8 @@ Vue.filter('NumberFormat', function (value) {
if (!value) { if (!value) {
return '0' return '0'
} }
const intPartFormat = value.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') // 将整数部分逢三一断 // 将整数部分逢三一断
return intPartFormat return value.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,')
}) })
Vue.filter('dayjs', function (dataStr, pattern = 'YYYY-MM-DD HH:mm:ss') { Vue.filter('dayjs', function (dataStr, pattern = 'YYYY-MM-DD HH:mm:ss') {
+10 -10
View File
@@ -1,7 +1,7 @@
import { USER_AUTH, SYS_BUTTON_AUTH } from '@/store/mutation-types' import { USER_AUTH, SYS_BUTTON_AUTH } from '@/store/mutation-types'
const hasPermission = { const hasPermission = {
install (Vue, options) { install (Vue) {
Vue.directive('has', { Vue.directive('has', {
inserted: (el, binding, vnode) => { inserted: (el, binding, vnode) => {
// console.time() // console.time()
@@ -24,7 +24,7 @@ export function filterNodePermission (el, binding, vnode) {
if (obj) { if (obj) {
const bpmList = obj.permissionList const bpmList = obj.permissionList
for (const bpm of bpmList) { for (const bpm of bpmList) {
if (bpm.type != '2') { if (bpm.type + '' !== '2') {
permissionList.push(bpm) permissionList.push(bpm)
} }
} }
@@ -42,7 +42,7 @@ export function filterNodePermission (el, binding, vnode) {
console.log('流程节点页面权限--NODE--') console.log('流程节点页面权限--NODE--')
const permissions = [] const permissions = []
for (const item of permissionList) { for (const item of permissionList) {
if (item.type != '2') { if (item.type + '' !== '2') {
permissions.push(item.action) permissions.push(item.action)
} }
} }
@@ -64,30 +64,30 @@ export function filterNodePermission (el, binding, vnode) {
/** /**
* 全局权限控制 * 全局权限控制
*/ */
export function filterGlobalPermission (el, binding, vnode) { export function filterGlobalPermission (el, binding) {
const permissionList = [] const permissionList = []
const allPermissionList = [] const allPermissionList = []
// let authList = Vue.ls.get(USER_AUTH); // let authList = Vue.ls.get(USER_AUTH);
const authList = JSON.parse(sessionStorage.getItem(USER_AUTH) || '[]') const authList = JSON.parse(sessionStorage.getItem(USER_AUTH) || '[]')
for (const auth of authList) { for (const auth of authList) {
if (auth.type != '2') { if (auth.type + '' !== '2') {
permissionList.push(auth) permissionList.push(auth)
} }
} }
// console.log("页面权限--Global--",sessionStorage.getItem(SYS_BUTTON_AUTH)); // console.log("页面权限--Global--",sessionStorage.getItem(SYS_BUTTON_AUTH));
const allAuthList = JSON.parse(sessionStorage.getItem(SYS_BUTTON_AUTH) || '[]') const allAuthList = JSON.parse(sessionStorage.getItem(SYS_BUTTON_AUTH) || '[]')
for (const gauth of allAuthList) { for (const gauth of allAuthList) {
if (gauth.type != '2') { if (gauth.type + '' !== '2') {
allPermissionList.push(gauth) allPermissionList.push(gauth)
} }
} }
// 设置全局配置是否有命中 // 设置全局配置是否有命中
let invalidFlag = false// 无效命中 let invalidFlag = false// 无效命中
if (allPermissionList != null && allPermissionList != '' && allPermissionList != undefined && allPermissionList.length > 0) { if (allPermissionList != null && allPermissionList !== '' && allPermissionList !== undefined && allPermissionList.length > 0) {
for (const itemG of allPermissionList) { for (const itemG of allPermissionList) {
if (binding.value === itemG.action) { if (binding.value === itemG.action) {
if (itemG.status == '0') { if (itemG.status + '' !== '0') {
invalidFlag = true invalidFlag = true
break break
} }
@@ -104,13 +104,13 @@ export function filterGlobalPermission (el, binding, vnode) {
const permissions = [] const permissions = []
for (const item of permissionList) { for (const item of permissionList) {
// 权限策略1显示2禁用 // 权限策略1显示2禁用
if (item.type != '2') { if (item.type + '' !== '2') {
// update--begin--autor:wangshuai-----date:20200729------for:按钮权限,授权标识的提示信息是多个用逗号分隔逻辑处理 gitee#I1OUGU------- // update--begin--autor:wangshuai-----date:20200729------for:按钮权限,授权标识的提示信息是多个用逗号分隔逻辑处理 gitee#I1OUGU-------
if (item.action) { if (item.action) {
if (item.action.includes(',')) { if (item.action.includes(',')) {
const split = item.action.split(',') const split = item.action.split(',')
for (let i = 0; i < split.length; i++) { for (let i = 0; i < split.length; i++) {
if (!split[i] || split[i].length == 0) { if (!split[i] || split[i].length === 0) {
continue continue
} }
permissions.push(split[i]) permissions.push(split[i])
+3 -3
View File
@@ -4,6 +4,7 @@ import store from '@/store'
import { VueAxios } from './axios' import { VueAxios } from './axios'
import router from '@/router/index' import router from '@/router/index'
import { ACCESS_TOKEN, TENANT_ID } from '@/store/mutation-types' import { ACCESS_TOKEN, TENANT_ID } from '@/store/mutation-types'
import { Modal } from 'ant-design-vue'
/** /**
* 【指定 axios的 baseURL】 * 【指定 axios的 baseURL】
@@ -33,8 +34,7 @@ const err = (error) => {
case 500: case 500:
console.log('------error.response------', error.response) console.log('------error.response------', error.response)
// update-begin- --- author:liusq ------ date:20200910 ---- for:处理Blob情况---- // update-begin- --- author:liusq ------ date:20200910 ---- for:处理Blob情况----
const type = error.response.request.responseType if (error.response.request.responseType === 'blob') {
if (type === 'blob') {
blobToJson(data) blobToJson(data)
break break
} }
@@ -112,7 +112,7 @@ service.interceptors.request.use(config => {
} }
config.headers['tenant-id'] = tenantid config.headers['tenant-id'] = tenantid
// update-end-author:taoyan date:2020707 for:多租户 // update-end-author:taoyan date:2020707 for:多租户
if (config.method == 'get') { if (config.method === 'get') {
if (config.url.indexOf('sys/dict/getDictItems') < 0) { if (config.url.indexOf('sys/dict/getDictItems') < 0) {
config.params = { config.params = {
_t: Date.parse(new Date()) / 1000, _t: Date.parse(new Date()) / 1000,
+4 -5
View File
@@ -1,7 +1,7 @@
const validateMobile = (rule, value, callback) => { const validateMobile = (rule, value, callback) => {
const reg = /^1(3|4|5|7|8)\d{9}$/ const reg = /^1(3|4|5|7|8)\d{9}$/
if (!reg.test(value)) { if (!reg.test(value)) {
callback('请输入正确手机号') callback(new Error('请输入正确手机号'))
} else { } else {
callback() callback()
} }
@@ -11,9 +11,9 @@ const validateEn = (rule, value, callback) => {
const reg2 = /^.{4,18}$/ const reg2 = /^.{4,18}$/
// 长度为6到18个字符 // 长度为6到18个字符
if (value !== '' && !reg.test(value)) { if (value !== '' && !reg.test(value)) {
callback('只允许字母数字下划线') callback(new Error('只允许字母数字下划线'))
} else if (value !== '' && !reg2.test(value)) { } else if (value !== '' && !reg2.test(value)) {
callback('长度6到18个字符') callback(new Error('长度6到18个字符'))
} else { } else {
callback() callback()
} }
@@ -79,8 +79,7 @@ export const rules = {
return rule return rule
}, },
select: function () { select: function () {
const rule = [{ required: true, message: '', trigger: 'change' }] return [{ required: true, message: '', trigger: 'change' }]
return rule
}, },
checked: function (min, max) { checked: function (min, max) {
const rule = [{ required: true, type: 'array', message: '', trigger: 'change' }] const rule = [{ required: true, type: 'array', message: '', trigger: 'change' }]
+16 -20
View File
@@ -38,7 +38,7 @@ export function filterObj (obj) {
for (const key in obj) { for (const key in obj) {
if (obj.hasOwnProperty(key) && if (obj.hasOwnProperty(key) &&
(obj[key] == null || obj[key] == undefined || obj[key] === '')) { (obj[key] == null || obj[key] === undefined || obj[key] === '')) {
delete obj[key] delete obj[key]
} }
} }
@@ -84,7 +84,7 @@ export function formatDate (value, fmt) {
// 生成首页路由 // 生成首页路由
export function generateIndexRouter (data) { export function generateIndexRouter (data) {
const redirectPath = findFirstRoute(data) const redirectPath = findFirstRoute(data)
const indexRouter = [{ return [{
path: '/', path: '/',
name: 'dashboard', name: 'dashboard',
// component: () => import('@/components/layouts/BasicLayout'), // component: () => import('@/components/layouts/BasicLayout'),
@@ -97,7 +97,6 @@ export function generateIndexRouter (data) {
}, { }, {
path: '*', redirect: '/404', hidden: true path: '*', redirect: '/404', hidden: true
}] }]
return indexRouter
} }
// 生成嵌套路由(子路由) // 生成嵌套路由(子路由)
@@ -113,28 +112,28 @@ function generateChildRouters (data) {
} }
// eslint-disable-next-line // eslint-disable-next-line
let URL = (item.meta.url|| '').replace(/{{([^}}]+)?}}/g, (s1, s2) => eval(s2)) // URL支持{{ window.xxx }}占位符变量 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 item.meta.url = URL
} }
let componentPath let componentPath
if (item.component == 'modules/online/cgform/OnlCgformHeadList') { if (item.component === 'modules/online/cgform/OnlCgformHeadList') {
componentPath = onlineCommons.OnlCgformHeadList componentPath = onlineCommons.OnlCgformHeadList
} else if (item.component == 'modules/online/cgform/OnlCgformCopyList') { } else if (item.component + '' === 'modules/online/cgform/OnlCgformCopyList') {
componentPath = onlineCommons.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 componentPath = onlineCommons.OnlCgformAutoList
} else if (item.component == 'modules/online/cgform/auto/OnlCgformTreeList') { } else if (item.component + '' === 'modules/online/cgform/auto/OnlCgformTreeList') {
componentPath = onlineCommons.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 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 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 componentPath = onlineCommons.OnlCgformInnerTableList
} else if (item.component == 'modules/online/cgreport/OnlCgreportHeadList') { } else if (item.component + '' === 'modules/online/cgreport/OnlCgreportHeadList') {
componentPath = onlineCommons.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 componentPath = onlineCommons.OnlCgreportAutoList
} else { } else {
componentPath = resolve => require(['@/' + component + '.vue'], resolve) componentPath = resolve => require(['@/' + component + '.vue'], resolve)
@@ -259,10 +258,7 @@ export function underLine2CamelCase (string) {
* @returns {*} * @returns {*}
*/ */
export function showDealBtn (bpmStatus) { export function showDealBtn (bpmStatus) {
if (bpmStatus != '1' && bpmStatus != '3' && bpmStatus != '4') { return bpmStatus + '' !== '1' && bpmStatus + '' !== '3' && bpmStatus + '' !== '4'
return true
}
return false
} }
/** /**
@@ -408,12 +404,12 @@ export function pushIfNotExist (array, value, key) {
* 可用于判断是否成功 * 可用于判断是否成功
* @type {symbol} * @type {symbol}
*/ */
export const succeedSymbol = Symbol() export const succeedSymbol = Symbol('')
/** /**
* 可用于判断是否失败 * 可用于判断是否失败
* @type {symbol} * @type {symbol}
*/ */
export const failedSymbol = Symbol() export const failedSymbol = Symbol('')
/** /**
* 使 promise 无论如何都会 resolve,除非传入的参数不是一个Promise对象或返回Promise对象的方法 * 使 promise 无论如何都会 resolve,除非传入的参数不是一个Promise对象或返回Promise对象的方法
@@ -550,7 +546,7 @@ export function neverNull (value, def) {
export function removeArrayElement (array, prod, value) { export function removeArrayElement (array, prod, value) {
let index = -1 let index = -1
for (let i = 0; i < array.length; i++) { for (let i = 0; i < array.length; i++) {
if (array[i][prod] == value) { if (array[i][prod] + '' === value + '') {
index = i index = i
break break
} }