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