shijiplus-web-plugin 0.1.16 → 0.1.18
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/README.md +2 -1
- package/package.json +1 -1
- package/src/libs/util.js +73 -2
package/README.md
CHANGED
package/package.json
CHANGED
package/src/libs/util.js
CHANGED
|
@@ -1,7 +1,78 @@
|
|
|
1
|
+
|
|
2
|
+
import { forEach, hasOneOf, oneOf, objEqual } from './tools'
|
|
3
|
+
|
|
1
4
|
import { export_json_to_excel as exportJsonToExcel, exportJsonToExcelBlob } from './excel'
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
|
|
6
|
+
|
|
7
|
+
export const createBtn = (h, { props, directives, txt, callback, danger, style, icon }) => {
|
|
8
|
+
return h('Button', {
|
|
9
|
+
directives: directives,
|
|
10
|
+
style: style,
|
|
11
|
+
props: {
|
|
12
|
+
type: danger ? 'error' : 'primary',
|
|
13
|
+
size: 'small',
|
|
14
|
+
icon: icon,
|
|
15
|
+
ghost: true,
|
|
16
|
+
...props
|
|
17
|
+
},
|
|
18
|
+
on: {
|
|
19
|
+
click: () => {
|
|
20
|
+
if (callback) {
|
|
21
|
+
callback()
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}, txt)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const btn = (h, txt, callback, danger) => {
|
|
29
|
+
return h('Button', {
|
|
30
|
+
props: {
|
|
31
|
+
type: danger ? 'error' : 'primary',
|
|
32
|
+
size: 'small',
|
|
33
|
+
ghost: true
|
|
34
|
+
},
|
|
35
|
+
on: {
|
|
36
|
+
click: () => {
|
|
37
|
+
callback()
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}, txt)
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* @param {String} url
|
|
44
|
+
* @description 从URL中解析参数
|
|
45
|
+
*/
|
|
46
|
+
export const getParams = url => {
|
|
47
|
+
const keyValueArr = url.split('?')[1].split('&')
|
|
48
|
+
let paramObj = {}
|
|
49
|
+
keyValueArr.forEach(item => {
|
|
50
|
+
const keyValue = item.split('=')
|
|
51
|
+
paramObj[keyValue[0]] = keyValue[1]
|
|
52
|
+
})
|
|
53
|
+
return paramObj
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* 按属性名称和value搜索列表内容
|
|
59
|
+
* @param arr
|
|
60
|
+
* @param attrName
|
|
61
|
+
* @param attrVal
|
|
62
|
+
* @returns {null|*}
|
|
63
|
+
*/
|
|
64
|
+
export const searchInObjArray = (arr, attrName, attrVal) => {
|
|
65
|
+
if (arr && attrName && attrVal) {
|
|
66
|
+
for (let i = 0; i < arr.length; ++i) {
|
|
67
|
+
if (arr[i] && arr[i][attrName] && arr[i][attrName] === attrVal) {
|
|
68
|
+
return arr[i]
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
let rtn = {}
|
|
72
|
+
rtn[attrName] = attrVal
|
|
73
|
+
return rtn
|
|
74
|
+
}
|
|
75
|
+
return null
|
|
5
76
|
}
|
|
6
77
|
|
|
7
78
|
export const exportTableExcelBlob = (tableData, tableColumn, fileName) => {
|