【fix ESLint】components/jero、components/layouts、components/tools、utils、views/account/center、views/demo、views/system

This commit is contained in:
zhaoxiao
2023-03-08 15:20:31 +08:00
parent e37d7c0c4e
commit 5bad1fef61
36 changed files with 98 additions and 70 deletions
@@ -117,7 +117,7 @@ export default {
const data = this.pcaa[value]
if (data) {
for (const key in data) {
if (data.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(data, key)) {
options.push({ value: key, label: data[key] })
}
}
+17 -12
View File
@@ -946,7 +946,9 @@ export default {
showClearSelectButton () {
let count = 0
for (const key in this.disabledRows) {
if (this.disabledRows.hasOwnProperty(key)) count++
if (Object.prototype.hasOwnProperty.call(this.disabledRows, key)) {
count++
}
}
return count > 0
},
@@ -1318,7 +1320,8 @@ export default {
// 解析disabledRows
for (const columnKey in this.disabledRows) {
// 判断是否有该属性
if (this.disabledRows.hasOwnProperty(columnKey) && data.hasOwnProperty(columnKey)) {
// if (this.disabledRows.hasOwnProperty(columnKey) && data.hasOwnProperty(columnKey)) {
if (Object.prototype.hasOwnProperty.call(this.disabledRows, columnKey) && Object.prototype.hasOwnProperty.call(data, columnKey)) {
if (disabled !== true) {
const temp = this.disabledRows[columnKey]
// 禁用规则可以是一个数组
@@ -1659,7 +1662,8 @@ export default {
if (asyncCount === 0) {
clearInterval(timer)
if (typeof callback === 'function') {
callback({ error, values })
const params = { error, values }
callback(params)
}
}
}, 10)
@@ -1741,7 +1745,7 @@ export default {
let { rowKey, values: newValues } = item
rowKey = this.getCleanId(rowKey)
for (const newValueKey in newValues) {
if (newValues.hasOwnProperty(newValueKey)) {
if (Object.prototype.hasOwnProperty.call(newValues, newValueKey)) {
let edited = false // 已被修改
for (const column of this.columns) {
if (column.key === newValueKey) {
@@ -1749,7 +1753,7 @@ export default {
this.inputValues.forEach(value => {
// 在inputValues中找到了该字段
if (rowKey === this.getCleanId(value.id)) {
if (value.hasOwnProperty(newValueKey)) {
if (Object.prototype.hasOwnProperty.call(value, newValueKey)) {
edited = true
value[newValueKey] = newValue
}
@@ -1839,10 +1843,10 @@ export default {
},
valuesHasOwnProperty (values, ownProperty) {
const key = ownProperty
if (values.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(values, key)) {
return key
}
if (values.hasOwnProperty(key + this.tempId)) {
if (Object.prototype.hasOwnProperty.call(values, key + this.tempId)) {
return key + this.tempId
}
return null
@@ -1900,7 +1904,8 @@ export default {
}
if (typeof callback === 'function') {
callback([tooltips[inputId], notPassedIds])
const param = [tooltips[inputId], notPassedIds]
callback(param)
}
}
@@ -2026,7 +2031,7 @@ export default {
const { idx } = tr.dataset
const value = this.inputValues[idx]
for (const key in value) {
if (value.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(value, key)) {
const elid = `${key}${value.id}`
const el = document.getElementById(elid)
if (el) {
@@ -2052,7 +2057,7 @@ export default {
// 重新计算单个统计列
recalcOneStatisticsColumn (key) {
if (this.hasStatisticsColumn) {
if (this.statisticsColumns.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(this.statisticsColumns, key)) {
// 计算合计值
let count = 0
this.inputValues.forEach(item => {
@@ -2073,7 +2078,7 @@ export default {
/** 获取某个统计字段的值 */
getStatisticsValue (key) {
if (this.hasStatisticsColumn) {
if (this.statisticsColumns.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(this.statisticsColumns, key)) {
return this.statisticsColumns[key]
}
}
@@ -2707,7 +2712,7 @@ export default {
// 解析props
if (typeof col.props === 'object') {
for (const prop in col.props) {
if (col.props.hasOwnProperty(prop)) {
if (Object.prototype.hasOwnProperty.call(col.props, prop)) {
props[prop] = this.replaceProps(col, col.props[prop])
}
}
+2 -2
View File
@@ -101,11 +101,11 @@ export default {
.drag_bg{
background-color: #7ac23c;
height: 34px;
width: 0px;
width: 0;
}
.drag_text{
position: absolute;
top: 0px;
top: 0;
width: 100%;text-align: center;
-moz-user-select: none;
-webkit-user-select: none;
@@ -178,7 +178,7 @@ export default {
}
// slot 组件特殊处理
if (column.$type === JVXETypes.slot) {
if (this.$scopedSlots.hasOwnProperty(column.slotName)) {
if (Object.prototype.hasOwnProperty.call(this.$scopedSlots, column.slotName)) {
renderOptions.slot = this.$scopedSlots[column.slotName]
renderOptions.target = this
}
@@ -264,7 +264,7 @@ export default {
// 用户传递的事件,进行合并操作
Object.keys(this.$listeners).forEach(key => {
let listen = this.$listeners[key]
if (events.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(events, key)) {
if (Array.isArray(listen)) {
listen.push(events[key])
} else {
@@ -1,5 +1,5 @@
import Vue from 'vue'
import { getEventPath } from '@/utils/util'
import { getEventPath, evil } from '@/utils/util'
import JVxeTable, { AllCells, JVXETypes } from './index'
import './less/j-vxe-table.less'
// 引入 vxe-table
@@ -14,7 +14,7 @@ import { getEnhancedMixins, installAllCell, installOneCell } from '@/components/
const VxeGridMethodsMap = {}
Object.keys(Grid.methods).forEach(key => {
// 使用eval可以避免闭包(但是要注意不要写es6的代码)
VxeGridMethodsMap[key] = eval(`(function(){return this.$refs.vxe.${key}.apply(this.$refs.vxe,arguments)})`)
VxeGridMethodsMap[key] = evil(`(function(){return this.$refs.vxe.${key}.apply(this.$refs.vxe,arguments)})`)
})
// 将Grid所有的方法都映射(继承)到JVxeTable上
JVxeTable.methods = Object.assign({}, VxeGridMethodsMap, JVxeTable.methods)
@@ -105,7 +105,9 @@ export default {
const res = this.enhanced.translate.handler.call(this, value)
// 异步翻译,目前仅【多级联动】使用
if (res instanceof Promise) {
res.then(value => this.innerValue = value)
res.then(value => {
this.innerValue = value
})
} else {
this.innerValue = res
}
@@ -99,7 +99,7 @@ export function getEnhancedMixins (type, name) {
if (enhanced) {
Object.keys(defEnhanced).forEach(key => {
const def = defEnhanced[key]
if (enhanced.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(enhanced, key)) {
// 方法如果存在就不覆盖
if (typeof def !== 'function' && typeof def !== 'string') {
enhanced[key] = Object.assign({}, def, enhanced[key])
+3
View File
@@ -34,6 +34,8 @@ import JSelectRole from '../jerobiz/JSelectRole.vue'
import JSelectUserByDep from '../jerobiz/JSelectUserByDep.vue'
// 引入需要全局注册的js函数和变量
import { Modal, notification, message } from 'ant-design-vue'
// eslint-disable-next-line camelcase
import lodash_object from 'lodash'
import debounce from 'lodash/debounce'
import pick from 'lodash.pick'
@@ -81,6 +83,7 @@ export default {
Vue.prototype.$Jnotification = notification
Vue.prototype.$Jmodal = Modal
Vue.prototype.$Jmessage = message
// eslint-disable-next-line camelcase
Vue.prototype.$Jlodash = lodash_object
Vue.prototype.$Jdebounce = debounce
Vue.prototype.$Jpick = pick
@@ -1,7 +1,5 @@
<template>
<iframe :id="id" :src="url" frameborder="0" width="100%" height="800px" scrolling="auto"></iframe>
<iframe :id="id" :src="url" frameborder="0" width="100%" height="800px" scrolling="auto"></iframe>
</template>
<script>
@@ -39,6 +37,7 @@ export default {
if (url !== null && url !== undefined) {
// -----------------------------------------------------------------------------------------
// url支持通过 ${token}方式传递当前登录TOKEN
// eslint-disable-next-line no-template-curly-in-string
const tokenStr = '${token}'
if (url.indexOf(tokenStr) !== -1) {
const token = Vue.ls.get(ACCESS_TOKEN)
@@ -217,7 +217,7 @@ export default {
},
websocketOnmessage: function (e) {
console.log('-----接收消息-------', e.data)
const data = eval('(' + e.data + ')') // 解析对象
const data = JSON.parse(e.data) // 解析对象
if (data.cmd + '' === 'topic') {
// 系统通知
this.loadData()
+1
View File
@@ -64,6 +64,7 @@ const updateTheme = primaryColor => {
const lessConfigNode = document.createElement('script')
const lessScriptNode = document.createElement('script')
lessStyleNode.setAttribute('rel', 'stylesheet/less')
// eslint-disable-next-line camelcase,no-undef
lessStyleNode.setAttribute('href', __webpack_public_path__ + 'color.less')
lessConfigNode.innerHTML = `
window.less = {