【fix ESLint】src/components/jero/JVxeTable/utils、src/mixins
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { getVmParentByName } from '@/utils/util'
|
||||
import { JVXETypes } from '@comp/jero/JVxeTable'
|
||||
|
||||
export const VALIDATE_FAILED = Symbol()
|
||||
export const VALIDATE_FAILED = Symbol('')
|
||||
|
||||
/**
|
||||
* 获取指定的 $refs 对象
|
||||
|
||||
@@ -20,7 +20,8 @@ export const JEditableTableMixin = {
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 18 }
|
||||
}
|
||||
},
|
||||
addDefaultRowNum: null // 这个变量应该是一个数字,但是为了保留原本代码中的提示逻辑,定义为null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -72,7 +73,7 @@ export const JEditableTableMixin = {
|
||||
},
|
||||
/** 当点击了编辑(修改)按钮时调用此方法 */
|
||||
edit (record) {
|
||||
if (record && JSON.stringify(record) != '{}') {
|
||||
if (record && JSON.stringify(record) !== '{}') {
|
||||
this.tableReset()
|
||||
}
|
||||
if (typeof this.editBefore === 'function') this.editBefore(record)
|
||||
@@ -107,7 +108,9 @@ export const JEditableTableMixin = {
|
||||
}
|
||||
}
|
||||
tab.dataSource = dataSource
|
||||
typeof success === 'function' ? success(res) : ''
|
||||
if (typeof success === 'function') {
|
||||
success(res)
|
||||
}
|
||||
}).finally(() => {
|
||||
tab.loading = false
|
||||
})
|
||||
|
||||
@@ -19,7 +19,9 @@ export const JEditableTableModelMixin = {
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 18 }
|
||||
}
|
||||
},
|
||||
addDefaultRowNum: null, // 这个变量应该是一个数字,但是为了保留原本代码中的提示逻辑,定义为null
|
||||
refKeys: null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -70,7 +72,7 @@ export const JEditableTableModelMixin = {
|
||||
},
|
||||
/** 当点击了编辑(修改)按钮时调用此方法 */
|
||||
edit (record) {
|
||||
if (record && JSON.stringify(record) != '{}' && record.id) {
|
||||
if (record && JSON.stringify(record) !== '{}' && record.id) {
|
||||
this.tableReset()
|
||||
}
|
||||
if (typeof this.editBefore === 'function') this.editBefore(record)
|
||||
@@ -105,7 +107,9 @@ export const JEditableTableModelMixin = {
|
||||
}
|
||||
}
|
||||
tab.dataSource = dataSource
|
||||
typeof success === 'function' ? success(res) : ''
|
||||
if (typeof success === 'function') {
|
||||
success(res)
|
||||
}
|
||||
}).finally(() => {
|
||||
tab.loading = false
|
||||
})
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { VALIDATE_FAILED, getRefPromise, validateFormAndTables } from '@/components/jero/JVxeTable/utils/vxeUtils.js'
|
||||
import { getRefPromise, validateFormAndTables } from '@/components/jero/JVxeTable/utils/vxeUtils.js'
|
||||
import { httpAction, getAction } from '@/api/manage'
|
||||
|
||||
const VALIDATE_NO_PASSED = ''
|
||||
|
||||
export const JVxeTableMixin = {
|
||||
data () {
|
||||
return {
|
||||
@@ -17,7 +19,9 @@ export const JVxeTableMixin = {
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 18 }
|
||||
}
|
||||
},
|
||||
refKeys: null,
|
||||
addDefaultRowNum: null // 这个变量应该是一个数字,但是为了保留原本代码中的提示逻辑,定义为null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -92,14 +96,17 @@ export const JVxeTableMixin = {
|
||||
}
|
||||
}
|
||||
tab.dataSource = dataSource
|
||||
typeof success === 'function' ? success(res) : ''
|
||||
if (typeof success === 'function') {
|
||||
success(res)
|
||||
}
|
||||
}).finally(() => {
|
||||
tab.loading = false
|
||||
})
|
||||
},
|
||||
/** 发起请求,自动判断是执行新增还是修改操作 */
|
||||
request (formData) {
|
||||
let url = this.url.add; let method = 'post'
|
||||
let url = this.url.add
|
||||
let method = 'post'
|
||||
if (this.model.id) {
|
||||
url = this.url.edit
|
||||
method = 'put'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { VALIDATE_FAILED, getRefPromise, validateFormAndTables, validateFormModelAndTables } from '@/components/jero/JVxeTable/utils/vxeUtils.js'
|
||||
import { VALIDATE_FAILED, getRefPromise, validateFormModelAndTables } from '@/components/jero/JVxeTable/utils/vxeUtils.js'
|
||||
import { httpAction, getAction } from '@/api/manage'
|
||||
|
||||
export const JVxeTableModelMixin = {
|
||||
@@ -16,7 +16,9 @@ export const JVxeTableModelMixin = {
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 18 }
|
||||
}
|
||||
},
|
||||
refKeys: null,
|
||||
addDefaultRowNum: null // 这个变量应该是一个数字,但是为了保留原本代码中的提示逻辑,定义为null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -94,7 +96,9 @@ export const JVxeTableModelMixin = {
|
||||
}
|
||||
}
|
||||
tab.dataSource = dataSource
|
||||
typeof success === 'function' ? success(res) : ''
|
||||
if (typeof success === 'function') {
|
||||
success(res)
|
||||
}
|
||||
}).finally(() => {
|
||||
tab.loading = false
|
||||
})
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* data中url定义 list为查询列表 delete为删除单条记录 deleteBatch为批量删除
|
||||
*/
|
||||
import { filterObj } from '@/utils/util'
|
||||
import { deleteAction, getAction, downFile, getFileAccessHttpUrl } from '@/api/manage'
|
||||
import { deleteAction, downFile, getAction, getFileAccessHttpUrl } from '@/api/manage'
|
||||
import Vue from 'vue'
|
||||
import { ACCESS_TOKEN, TENANT_ID } from '@/store/mutation-types'
|
||||
import store from '@/store'
|
||||
@@ -79,7 +79,7 @@ export const JeroListMixin = {
|
||||
if (arg === 1) {
|
||||
this.ipagination.current = 1
|
||||
}
|
||||
var params = this.getQueryParams()// 查询条件
|
||||
const params = this.getQueryParams()// 查询条件
|
||||
this.loading = true
|
||||
getAction(this.url.list, params).then((res) => {
|
||||
if (res.success) {
|
||||
@@ -120,7 +120,7 @@ export const JeroListMixin = {
|
||||
sqp.superQueryParams = encodeURI(this.superQueryParams)
|
||||
sqp.superQueryMatchType = this.superQueryMatchType
|
||||
}
|
||||
var param = Object.assign(sqp, this.queryParam, this.isorter, this.filters)
|
||||
const param = Object.assign(sqp, this.queryParam, this.isorter, this.filters)
|
||||
param.field = this.getQueryField()
|
||||
param.pageNo = this.ipagination.current
|
||||
param.pageSize = this.ipagination.pageSize
|
||||
@@ -128,7 +128,7 @@ export const JeroListMixin = {
|
||||
},
|
||||
getQueryField () {
|
||||
// TODO 字段权限控制
|
||||
var str = 'id,'
|
||||
let str = 'id,'
|
||||
this.columns.forEach(function (value) {
|
||||
str += ',' + value.dataIndex
|
||||
})
|
||||
@@ -164,11 +164,11 @@ export const JeroListMixin = {
|
||||
if (this.selectedRowKeys.length <= 0) {
|
||||
this.$message.warning('请选择一条记录!')
|
||||
} else {
|
||||
var ids = ''
|
||||
for (var a = 0; a < this.selectedRowKeys.length; a++) {
|
||||
let ids = ''
|
||||
for (let a = 0; a < this.selectedRowKeys.length; a++) {
|
||||
ids += this.selectedRowKeys[a] + ','
|
||||
}
|
||||
var that = this
|
||||
const that = this
|
||||
this.$confirm({
|
||||
title: '确认删除',
|
||||
content: '是否删除选中数据?',
|
||||
@@ -196,7 +196,7 @@ export const JeroListMixin = {
|
||||
this.$message.error('请设置url.delete属性!')
|
||||
return
|
||||
}
|
||||
var that = this
|
||||
const that = this
|
||||
deleteAction(that.url.delete, { id: id }).then((res) => {
|
||||
if (res.success) {
|
||||
// 重新计算分页问题
|
||||
@@ -233,7 +233,7 @@ export const JeroListMixin = {
|
||||
// 分页、排序、筛选变化时触发
|
||||
if (Object.keys(sorter).length > 0) {
|
||||
this.isorter.column = sorter.field
|
||||
this.isorter.order = sorter.order == 'ascend' ? 'asc' : 'desc'
|
||||
this.isorter.order = sorter.order === 'ascend' ? 'asc' : 'desc'
|
||||
}
|
||||
this.ipagination = pagination
|
||||
this.loadData()
|
||||
@@ -259,8 +259,7 @@ export const JeroListMixin = {
|
||||
/* 导出 */
|
||||
handleExportXls2 () {
|
||||
const paramsStr = encodeURI(JSON.stringify(this.getQueryParams()))
|
||||
const url = `${window._CONFIG.domianURL}/${this.url.exportXlsUrl}?paramsStr=${paramsStr}`
|
||||
window.location.href = url
|
||||
window.location.href = `${window._CONFIG.domianURL}/${this.url.exportXlsUrl}?paramsStr=${paramsStr}`
|
||||
},
|
||||
handleExportXls (fileName) {
|
||||
if (!fileName || typeof fileName !== 'string') {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { formatDate } from '@/utils/util'
|
||||
import Area from '@/components/_util/Area'
|
||||
import { postAction } from '@/api/manage'
|
||||
|
||||
const onlUtil = {
|
||||
data () {
|
||||
|
||||
@@ -15,14 +15,14 @@ export const WebsocketMixin = {
|
||||
const token = Vue.ls.get(ACCESS_TOKEN)
|
||||
console.log('------------WebSocket连接成功')
|
||||
// WebSocket与普通的请求所用协议有所不同,ws等同于http,wss等同于https
|
||||
var userId = store.getters.userInfo.id
|
||||
const userId = store.getters.userInfo.id
|
||||
if (!this.socketUrl.startsWith('/')) {
|
||||
this.socketUrl = '/' + this.socketUrl
|
||||
}
|
||||
if (!this.socketUrl.endsWith('/')) {
|
||||
this.socketUrl = this.socketUrl + '/'
|
||||
}
|
||||
var url = window._CONFIG.domianURL.replace('https://', 'wss://').replace('http://', 'ws://') + this.socketUrl + userId + '/' + token
|
||||
const url = window._CONFIG.domianURL.replace('https://', 'wss://').replace('http://', 'ws://') + this.socketUrl + userId + '/' + token
|
||||
this.websock = new WebSocket(url)
|
||||
this.websock.onopen = this.websocketOnopen
|
||||
this.websock.onerror = this.websocketOnerror
|
||||
@@ -32,11 +32,11 @@ export const WebsocketMixin = {
|
||||
websocketOnopen: function () {
|
||||
console.log('WebSocket连接成功')
|
||||
},
|
||||
websocketOnerror: function (e) {
|
||||
websocketOnerror: function () {
|
||||
console.log('WebSocket连接发生错误')
|
||||
this.reconnect()
|
||||
},
|
||||
websocketOnclose: function (e) {
|
||||
websocketOnclose: function () {
|
||||
this.reconnect()
|
||||
},
|
||||
websocketSend (text) {
|
||||
@@ -48,7 +48,7 @@ export const WebsocketMixin = {
|
||||
}
|
||||
},
|
||||
reconnect () {
|
||||
var that = this
|
||||
const that = this
|
||||
if (that.lockReconnect) return
|
||||
that.lockReconnect = true
|
||||
// 没连接上会一直重连,设置延迟避免请求过多
|
||||
|
||||
Reference in New Issue
Block a user