wlwy-package 1.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +43 -0
- package/README.md +46 -0
- package/dist/css/index.d40fc157.css +1 -0
- package/dist/favicon.ico +0 -0
- package/dist/index.html +17 -0
- package/dist/js/chunk-vendors.ce4c2dc8.js +7 -0
- package/dist/js/index.5a56098a.js +1 -0
- package/lib/demo.html +10 -0
- package/lib/index.common.js +39809 -0
- package/lib/index.css +1 -0
- package/lib/index.umd.js +39819 -0
- package/lib/index.umd.min.js +296 -0
- package/package.json +43 -0
- package/utils/config.ts +104 -0
- package/utils/console.ts +16 -0
- package/utils/index.ts +86 -0
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "wlwy-package",
|
|
3
|
+
"author": "sean",
|
|
4
|
+
"version": "1.1.20",
|
|
5
|
+
"description": "sean's npm package",
|
|
6
|
+
"private": false,
|
|
7
|
+
"main": "lib/index.umd.js",
|
|
8
|
+
"module": "lib/index.esm.js",
|
|
9
|
+
"typings": "lib/index.d.ts",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"serve": "vue-cli-service serve",
|
|
13
|
+
"build": "yarn build:clean && yarn build:lib && yarn build:esm-bundle && rimraf lib/demo.html",
|
|
14
|
+
"build:clean": "rimraf lib",
|
|
15
|
+
"build:lib": "vue-cli-service build --target lib --name index --dest ./lib packages/index.ts",
|
|
16
|
+
"build:esm-bundle": "rollup --config ./build/rollup.config.js",
|
|
17
|
+
"docs:dev": "vuepress dev docs",
|
|
18
|
+
"docs:build": "vuepress build docs"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"ant-design-vue": "^1.7.8",
|
|
22
|
+
"axios": "^1.6.7",
|
|
23
|
+
"core-js": "^3.6.5",
|
|
24
|
+
"moment": "^2.30.1",
|
|
25
|
+
"vue": "^2.6.11",
|
|
26
|
+
"vue-class-component": "^7.2.3",
|
|
27
|
+
"vue-i18n": "^8.26.7",
|
|
28
|
+
"vue-property-decorator": "^9.1.2",
|
|
29
|
+
"vuex": "^3.6.2",
|
|
30
|
+
"vxe-table": "^3.4.5",
|
|
31
|
+
"xe-utils": "^3.4.0"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@vue/cli-plugin-babel": "~4.5.0",
|
|
35
|
+
"@vue/cli-plugin-typescript": "~4.5.0",
|
|
36
|
+
"@vue/cli-service": "~4.5.0",
|
|
37
|
+
"less": "^3.0.4",
|
|
38
|
+
"less-loader": "^5.0.0",
|
|
39
|
+
"typescript": "^4.5.5",
|
|
40
|
+
"vue-template-compiler": "^2.6.11",
|
|
41
|
+
"vuepress": "^1.9.7"
|
|
42
|
+
}
|
|
43
|
+
}
|
package/utils/config.ts
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* [公共方法]
|
|
3
|
+
* @Iparams {*|any}
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
class WlwxConfig {
|
|
7
|
+
env(){
|
|
8
|
+
const url = window.location.href
|
|
9
|
+
let _ENV = 'prod_en'
|
|
10
|
+
if (
|
|
11
|
+
url.includes('localhost') ||
|
|
12
|
+
url.includes('127.0.0.1') ||
|
|
13
|
+
url.includes('local') ||
|
|
14
|
+
url.includes('localwlwy')
|
|
15
|
+
) {
|
|
16
|
+
_ENV = 'local'
|
|
17
|
+
} else if (url.includes('192.168.3.20')) {
|
|
18
|
+
_ENV = 'dev'
|
|
19
|
+
} else if (url.includes('wlwytech')) {
|
|
20
|
+
_ENV = 'prod_cn'
|
|
21
|
+
} else if (url.includes('grll.co.uk')) {
|
|
22
|
+
_ENV = 'prod_en'
|
|
23
|
+
}else{
|
|
24
|
+
_ENV = 'prod_en'
|
|
25
|
+
}
|
|
26
|
+
return _ENV
|
|
27
|
+
}
|
|
28
|
+
config(){
|
|
29
|
+
/**
|
|
30
|
+
* [公共方法] uat环境和欧洲生产一样的环境
|
|
31
|
+
* @env {*|any} 环境
|
|
32
|
+
* @getway {*|any} 接口请求的地址
|
|
33
|
+
* @templateBase {*|any} 模板请求的地址
|
|
34
|
+
* @omsLogin {*|any} oms登录的地址
|
|
35
|
+
* @ygLogin {*|any} 员工工作台登录的地址
|
|
36
|
+
* @lanuage {*|any} 语言文件请求的地址 // 这个还是引用环境配置的
|
|
37
|
+
* @cookieDomain {*|any} cookie的域
|
|
38
|
+
* @version {*|any} 版本 没什么用
|
|
39
|
+
*/
|
|
40
|
+
return {
|
|
41
|
+
local : {
|
|
42
|
+
env : 'local',
|
|
43
|
+
getway: 'http://192.168.3.20:9998', // 接口请求的地址
|
|
44
|
+
templateBase: 'http://192.168.3.20/template', // 模板请求的地址
|
|
45
|
+
omsLogin: 'http://192.168.3.20:8875/login', // oms登录的地址
|
|
46
|
+
ygLogin: 'http://192.168.3.20:8877/login', // 员工工作台登录的地址
|
|
47
|
+
lanuage: 'http://192.168.3.20', // 语言文件请求的地址
|
|
48
|
+
cookieDomain:'192.168.3.20', // cookie的域
|
|
49
|
+
version:'1.0.0',
|
|
50
|
+
isChina : true,
|
|
51
|
+
},
|
|
52
|
+
dev: {
|
|
53
|
+
env: 'dev',
|
|
54
|
+
getway: 'http://192.168.3.20:9998', // 请求的地址
|
|
55
|
+
templateBase: 'http://192.168.3.20/template', // 模板请求的地址
|
|
56
|
+
omsLogin: 'http://192.168.3.20:8875/login', // oms登录的地址
|
|
57
|
+
ygLogin: 'http://192.168.3.20:8877/login', // 员工工作台登录的地址
|
|
58
|
+
lanuage: 'http://192.168.3.20', // 语言文件请求的地址
|
|
59
|
+
cookieDomain: '192.168.3.20', // cookie的域
|
|
60
|
+
version: '1.0.0',
|
|
61
|
+
isChina: false,
|
|
62
|
+
},
|
|
63
|
+
prod_cn: {
|
|
64
|
+
env: 'prod_cn',
|
|
65
|
+
getway: 'https://gateway.wlwytech.com', // 请求的地址
|
|
66
|
+
templateBase: 'https://static.wlwytech.com/platform/template/', // 模板请求的地址
|
|
67
|
+
omsLogin: 'https://order.wlwytech.com/login/', // oms登录的地址
|
|
68
|
+
ygLogin: 'https://home.wlwytech.com/login/', // 员工工作台登录的地址
|
|
69
|
+
lanuage: 'https://static.wlwytech.com', // 语言文件请求的地址
|
|
70
|
+
cookieDomain: '.wlwytech.com', // cookie的域
|
|
71
|
+
version: '1.0.0',
|
|
72
|
+
isChina: true,
|
|
73
|
+
},
|
|
74
|
+
prod_en_uat:{
|
|
75
|
+
env: 'prod_en_uat',
|
|
76
|
+
getway: 'https://uat-gateway.grll.co.uk', // 请求的地址
|
|
77
|
+
templateBase: 'https://uat-static.grll.co.uk/template/', // 模板请求的地址
|
|
78
|
+
omsLogin: 'https://order.grll.co.uk/login/', // oms登录的地址
|
|
79
|
+
ygLogin: 'https://home.grll.co.uk/login/', // 员工工作台登录的地址
|
|
80
|
+
lanuage: 'https://static.grll.co.uk', // 语言文件请求的地址
|
|
81
|
+
cookieDomain: '.grll.co.uk', // cookie的域
|
|
82
|
+
version: '1.0.0',
|
|
83
|
+
isChina: false,
|
|
84
|
+
},
|
|
85
|
+
prod_en: {
|
|
86
|
+
env: 'prod_en',
|
|
87
|
+
getway: 'https://gateway.grll.co.uk', // 请求的地址
|
|
88
|
+
templateBase: 'https://static.grll.co.uk/template/', // 模板请求的地址
|
|
89
|
+
omsLogin: 'https://order.grll.co.uk/login/', // oms登录的地址
|
|
90
|
+
ygLogin: 'https://home.grll.co.uk/login/', // 员工工作台登录的地址
|
|
91
|
+
lanuage: 'https://static.grll.co.uk', // 语言文件请求的地址
|
|
92
|
+
cookieDomain: '.grll.co.uk', // cookie的域
|
|
93
|
+
version: '1.0.0',
|
|
94
|
+
isChina: false,
|
|
95
|
+
}
|
|
96
|
+
} as any
|
|
97
|
+
}
|
|
98
|
+
getConfig(){
|
|
99
|
+
return this.config()[this.env()]
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export default WlwxConfig
|
package/utils/console.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* [公共方法]
|
|
4
|
+
* @Iparams {*|any}
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
class Console {
|
|
8
|
+
log(a?: any, b?: any, c?: any, d?: any){
|
|
9
|
+
const env = (window as any).NODE_ENV
|
|
10
|
+
if (env === 'development'){
|
|
11
|
+
console.log.apply(console, arguments as any)
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default Console
|
package/utils/index.ts
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import Console from './console'
|
|
2
|
+
import WlwyConfig from './config'
|
|
3
|
+
import XEUtils from 'xe-utils'
|
|
4
|
+
/**
|
|
5
|
+
* [公共方法]
|
|
6
|
+
* @Iparams {*|any}
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
class WlwyUtils {
|
|
10
|
+
// 自动设置表格的操作栏的方法
|
|
11
|
+
reSetAction(_this: any, tableRef : any,className:any) {
|
|
12
|
+
const _tableRef = tableRef ? _this[tableRef] : _this.xTable
|
|
13
|
+
_this.$nextTick(() => {
|
|
14
|
+
const actionDiv: any = document.getElementsByClassName(className || 'wlwy_action')
|
|
15
|
+
if (!actionDiv.length) {
|
|
16
|
+
return
|
|
17
|
+
}
|
|
18
|
+
let len = actionDiv.length - 1, rowWidthAry: any = []
|
|
19
|
+
while (len >= 0) {
|
|
20
|
+
rowWidthAry.push(actionDiv.item(len).offsetWidth)
|
|
21
|
+
len--
|
|
22
|
+
}
|
|
23
|
+
const maxDivWidth = Math.max(...rowWidthAry)
|
|
24
|
+
const mWidth = maxDivWidth < 80 ? 80 : maxDivWidth
|
|
25
|
+
_tableRef.collectColumn.map((it: any, index: number) => {
|
|
26
|
+
if (it.params && it.params.action && mWidth) {
|
|
27
|
+
_tableRef.collectColumn[index].width = mWidth + 40 + 'px'
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
_tableRef.refreshColumn()
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
// 自动适应表格字段宽度的方法
|
|
34
|
+
resetTableWidth(_this: any, tableRef?: any){
|
|
35
|
+
const _tableRef = tableRef ? _this[tableRef] : _this.xTable
|
|
36
|
+
if(!_tableRef) return
|
|
37
|
+
const language: string = _this.$utils.cookie().get('language') || window.localStorage.getItem('language') || window._CONFIG.initLanguage
|
|
38
|
+
const width: any = { 'zhCn': 20, 'enUs': 12 }, minWidth: any = { 'zhCn': '100px', 'enUs': '70px' }
|
|
39
|
+
_tableRef.collectColumn.map((it: any, index: number) => {
|
|
40
|
+
if (it.type === 'seq') {
|
|
41
|
+
_tableRef.collectColumn[index].width = '60px'
|
|
42
|
+
} else if (it.type === 'checkbox') {
|
|
43
|
+
_tableRef.collectColumn[index].width = '60px'
|
|
44
|
+
} else {
|
|
45
|
+
if (it.title && parseInt(_tableRef.collectColumn[index].minWidth || 0) < it.title.length * width[language]) {
|
|
46
|
+
_tableRef.collectColumn[index].minWidth = it.title.length <= 5 ? minWidth[language] : (it.title.length * width[language] + 'px')
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
_tableRef.refreshColumn()
|
|
51
|
+
}
|
|
52
|
+
getButtonGroupFormAuth(result:any){
|
|
53
|
+
const M: any = {}
|
|
54
|
+
if (result.iconGroup && result.iconGroup.length) {
|
|
55
|
+
result.iconGroup.map((it: any) => { !M[it.permissionNo] && (M[it.permissionNo] = it) })
|
|
56
|
+
}
|
|
57
|
+
result.iconGroup = M
|
|
58
|
+
return result
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
getDefaultLocale() {
|
|
62
|
+
const Locale: string = this.cookie().get('language') || window.localStorage.getItem('language') || '';
|
|
63
|
+
const browserLocale = navigator.language.split('-')[0] === 'zh' ? 'zhCn' : 'enUs'; // Get the language code from the browser language setting
|
|
64
|
+
const language = Locale || browserLocale
|
|
65
|
+
this.cookie().set('language', language)
|
|
66
|
+
window.localStorage.setItem('language', language)
|
|
67
|
+
return language;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
cookie() {
|
|
71
|
+
return {
|
|
72
|
+
set(name: string, value: any) {
|
|
73
|
+
return XEUtils.cookie.set(name, value, { path: '/', domain: window._CONFIG?.domainUrl })
|
|
74
|
+
},
|
|
75
|
+
get(name: string) {
|
|
76
|
+
return XEUtils.cookie.get(name)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
export const $console = Console
|
|
85
|
+
export const $config = new WlwyConfig().getConfig()
|
|
86
|
+
export default WlwyUtils
|