工程优化

This commit is contained in:
xuliangzhan
2020-02-21 19:37:46 +08:00
parent 44f91141ae
commit 21075d6cce
4 changed files with 41 additions and 32 deletions

View File

@@ -8,16 +8,17 @@ Vue.prototype.$ajax = XEAjax
/**
* 生成模拟数据
*/
var dataCacheList = []
var colCacheList = []
var treeCacheList = []
var dataIndex = 0
var colIndex = 0
var dataID = 2000000
const dataCacheList = []
const colCacheList = []
const treeCacheList = []
let dataIndex = 0
let colIndex = 0
let dataID = 2000000
function mockColumns (size) {
for (var index = colIndex; index < size; index++) {
var colItem = {
let index = colIndex
for (; index < size; index++) {
const colItem = {
field: index % 2 === 0 ? 'age' : (index % 3 === 0 ? 'rate' : 'name'),
title: 'col_' + index,
width: index % 6 === 0 ? 340 : index % 4 === 0 ? 260 : index % 3 === 0 ? 120 : 160,
@@ -47,10 +48,10 @@ function mockColumns (size) {
}
function mockChildData (size, hasChild) {
var rest = []
for (var index = 0; index < size; index++) {
const rest = []
for (let index = 0; index < size; index++) {
dataID++
var item = {
const item = {
id: dataID,
name: 'Name - ' + dataID,
nickname: 'Nickname - ' + dataID,
@@ -65,13 +66,14 @@ function mockChildData (size, hasChild) {
}
function mockData (size, hasChild) {
var currTime = Date.now()
var nameList = XEUtils.shuffle(['a', 'T', 'b', 'v', 'G', 'k', 'r', 'H', 'x', 'z', 'c', 'd', 'e', 'p', 'U', 'f', 's', 'N'])
var nickList = XEUtils.shuffle(['徐', '李', '雷', '赵', '马', '孙', '钱', '蒋', '老', '蔡', '吕', '项', '徐', '杨', '胡', '杜', '嬴', '叼'])
for (var index = dataIndex; index < size; index++) {
var date = new Date(currTime)
var item
const currTime = Date.now()
const nameList = XEUtils.shuffle(['a', 'T', 'b', 'v', 'G', 'k', 'r', 'H', 'x', 'z', 'c', 'd', 'e', 'p', 'U', 'f', 's', 'N'])
const nickList = XEUtils.shuffle(['徐', '李', '雷', '赵', '马', '孙', '钱', '蒋', '老', '蔡', '吕', '项', '徐', '杨', '胡', '杜', '嬴', '叼'])
let index = dataIndex
for (; index < size; index++) {
dataID++
const date = new Date(currTime)
let item
if (hasChild) {
item = {
id: dataID,

View File

@@ -66,25 +66,25 @@
"vue-i18n": "^8.15.3",
"vue-router": "^3.1.5",
"vue-template-compiler": "^2.6.11",
"vxe-table-plugin-antd": "^1.6.2",
"vxe-table-plugin-antd": "^1.6.5",
"vxe-table-plugin-charts": "^1.1.1",
"vxe-table-plugin-element": "^1.6.2",
"vxe-table-plugin-element": "^1.6.6",
"vxe-table-plugin-excel": "^1.3.0",
"vxe-table-plugin-export-pdf": "^1.2.0",
"vxe-table-plugin-export-xlsx": "^1.2.0",
"vxe-table-plugin-iview": "^1.6.2",
"vxe-table-plugin-export-pdf": "^1.2.1",
"vxe-table-plugin-export-xlsx": "^1.2.1",
"vxe-table-plugin-iview": "^1.6.5",
"vxe-table-plugin-menus": "^1.2.0",
"vxe-table-plugin-renderer": "^1.1.0",
"vxe-table-plugin-shortcut-key": "^1.1.4",
"vxe-table-plugin-virtual-tree": "0.1.1",
"xe-ajax": "^4.0.1",
"xe-ajax-mock": "^1.9.3",
"xe-ajax": "^4.0.3",
"xe-ajax-mock": "^1.9.4",
"xe-clipboard": "^1.7.2",
"xe-utils": "^2.3.1",
"xlsx": "^0.15.1"
"xe-utils": "^2.3.2",
"xlsx": "^0.15.5"
},
"peerDependencies": {
"vue": ">=2.6.10",
"vue": ">=2.6.0",
"xe-utils": ">=2.2.0"
},
"postcss": {

View File

@@ -3,26 +3,27 @@ import VXEModal from './src/modal'
import queue from './src/queue'
import VXETable from '../v-x-e-table'
var AlertController = null
var AllActivedModal = []
let AlertController = null
const AllActivedModal = []
export function Modal (options) {
return new Promise(resolve => {
if (options && options.id && queue.some(comp => comp.id === options.id)) {
resolve('exist')
} else {
let events = options.events || {}
const events = options.events || {}
options.events = Object.assign({}, events, {
hide (params) {
if (events.hide) {
events.hide.call(this, params)
}
/* eslint-disable @typescript-eslint/no-use-before-define */
setTimeout(() => $modal.$destroy(), $modal.isMsg ? 500 : 100)
XEUtils.remove(AllActivedModal, item => item === $modal)
resolve(params.type)
}
})
let $modal = new AlertController({
const $modal = new AlertController({
el: document.createElement('div'),
propsData: options
})
@@ -33,7 +34,7 @@ export function Modal (options) {
}
['alert', 'confirm', 'message'].forEach((type, index) => {
let defOpts = index === 2 ? {
const defOpts = index === 2 ? {
mask: false,
lockView: false,
showHeader: false

View File

@@ -8,6 +8,7 @@ import { UtilTools } from '../tools'
const installedPlugins = []
function use (Plugin, options) {
/* eslint-disable @typescript-eslint/no-use-before-define */
if (Plugin && Plugin.install) {
if (installedPlugins.indexOf(Plugin) === -1) {
Plugin.install(VXETable, options)
@@ -21,6 +22,7 @@ function use (Plugin, options) {
* 检测模块的安装顺序是否正确
*/
function reg (key) {
/* eslint-disable @typescript-eslint/no-use-before-define */
if (VXETable.Table) {
UtilTools.error('vxe.error.useErr', [key])
}
@@ -34,17 +36,21 @@ class VXEStore {
constructor () {
this.store = {}
}
mixin (map) {
Object.assign(this.store, map)
return VXEStore
}
get (type) {
return this.store[type]
}
add (type, render) {
this.store[type] = render
return VXEStore
}
delete (type) {
delete this.store[type]
return VXEStore