n20-common-lib 1.3.36 → 1.3.39
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/package.json +2 -2
- package/src/assets/css/_coreLib.scss +0 -1
- package/src/assets/css/alert.scss +2 -5
- package/src/assets/css/cl-form-item.scss +24 -10
- package/src/assets/css/normalize.scss +125 -5
- package/src/assets/getJsonc.js +4 -1
- package/src/assets/realUrl.js +2 -1
- package/src/components/Anchor/AnchorItem.vue +1 -1
- package/src/components/Button/button-group.vue +0 -6
- package/src/components/DatePicker/index.vue +6 -0
- package/src/components/DatePicker/por.vue +2 -0
- package/src/components/ECharts/index.vue +0 -1
- package/src/components/EventBubble/demo/a.vue +1 -1
- package/src/components/EventBubble/demo/b.vue +1 -1
- package/src/components/EventBubble/demo/c.vue +2 -2
- package/src/components/FileImport/index.vue +101 -2
- package/src/components/Filters/form-item-input.vue +0 -1
- package/src/components/Filters/indexO.vue +14 -12
- package/src/components/FlowStep/index.vue +50 -27
- package/src/components/InputNumber/index.vue +6 -1
- package/src/components/InputNumber/numberRange.vue +17 -2
- package/src/components/Layout/HeaderWrap/index.vue +1 -7
- package/src/components/Layout/TabsNav/index.vue +1 -2
- package/src/components/Layout/index.vue +1 -1
- package/src/components/LoginTemporary/index.vue +43 -32
- package/src/components/LoginTemporary/retrievePw.vue +6 -3
- package/src/components/MoreTab/index.vue +1 -4
- package/src/components/PageHeader/index.vue +5 -2
- package/src/components/SecondaryTab/index.vue +0 -1
- package/src/components/SelectLazy/index.vue +2 -2
- package/src/components/Sifting/index.vue +1 -2
- package/src/components/Step/index.vue +0 -1
- package/src/components/TertiaryTab/index.vue +0 -1
- package/src/components/Upload/index.vue +17 -5
- package/src/components/Upload/uploadMsg.vue +114 -0
- package/src/directives/VClickOutside/index.js +11 -3
- package/src/directives/VDrag/index.js +12 -8
- package/src/directives/VMove/index.js +3 -3
- package/src/directives/VRuleKey/index.js +201 -0
- package/src/index.js +2 -0
- package/src/utils/auth.js +3 -1
- package/src/utils/axios.js +3 -1
- package/src/utils/repairElementUI.js +32 -8
- package/src/utils/xls2json.js +1 -1
- package/style/index.css +1 -1
- package/style/index.css.map +1 -1
- package/theme/blue.css +1 -1
- package/theme/green.css +1 -1
- package/theme/lightBlue.css +1 -1
- package/theme/orange.css +1 -1
- package/theme/purple.css +1 -1
- package/theme/red.css +1 -1
- package/theme/yellow.css +1 -1
- package/src/components/FileImport/_index.vue +0 -201
- package/src/components/Search/index.vue +0 -485
- package/src/components/Search/style.scss +0 -93
- package/src/directives/VRules/index.js +0 -10
|
@@ -38,17 +38,23 @@
|
|
|
38
38
|
<template slot="tip">
|
|
39
39
|
<slot name="tip"></slot>
|
|
40
40
|
</template>
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
<uploadMsg
|
|
42
|
+
:visible.sync="progressV"
|
|
43
|
+
:percent-type="percentType"
|
|
44
|
+
:percent-msg="percentMsg"
|
|
45
|
+
:percent="percent"
|
|
46
|
+
:validate-result="validateResult"
|
|
47
|
+
/>
|
|
46
48
|
</el-upload>
|
|
47
49
|
</template>
|
|
48
50
|
|
|
49
51
|
<script>
|
|
52
|
+
import uploadMsg from './uploadMsg.vue'
|
|
50
53
|
export default {
|
|
51
54
|
name: 'Upload',
|
|
55
|
+
components: {
|
|
56
|
+
uploadMsg
|
|
57
|
+
},
|
|
52
58
|
props: {
|
|
53
59
|
fileName: {
|
|
54
60
|
type: String,
|
|
@@ -127,6 +133,10 @@ export default {
|
|
|
127
133
|
showClear: {
|
|
128
134
|
type: Boolean,
|
|
129
135
|
default: true
|
|
136
|
+
},
|
|
137
|
+
validateResult: {
|
|
138
|
+
type: Object,
|
|
139
|
+
default: undefined
|
|
130
140
|
}
|
|
131
141
|
},
|
|
132
142
|
data() {
|
|
@@ -168,6 +178,8 @@ export default {
|
|
|
168
178
|
}
|
|
169
179
|
},
|
|
170
180
|
beforeUploadFn(file) {
|
|
181
|
+
this.$emit('update:validateResult', undefined)
|
|
182
|
+
|
|
171
183
|
let size = this.size
|
|
172
184
|
let sizeNum
|
|
173
185
|
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-dialog v-drag :visible.sync="progressV" :title="title" append-to-body>
|
|
3
|
+
<template v-if="!hidePercent">
|
|
4
|
+
<p v-if="!percentType">系统处理中,请稍等......</p>
|
|
5
|
+
<p v-else>{{ percentMsg }}</p>
|
|
6
|
+
<el-progress class="m-b" :percentage="percent" :status="percentType" />
|
|
7
|
+
</template>
|
|
8
|
+
<!-- 错误数据行提示 -->
|
|
9
|
+
<template v-if="validateResult">
|
|
10
|
+
<div>
|
|
11
|
+
<span class="m-r">导入统计</span>
|
|
12
|
+
<span>共计导入{{ validateResult.totalNum }}条, </span>
|
|
13
|
+
<span class="m-r-s">
|
|
14
|
+
其中有效数据
|
|
15
|
+
<span class="color-primary">{{ validateResult.successNum }}</span
|
|
16
|
+
>条,
|
|
17
|
+
</span>
|
|
18
|
+
<span>
|
|
19
|
+
无效数据
|
|
20
|
+
<span class="color-danger">{{ validateResult.errorList.length }}</span
|
|
21
|
+
>条。
|
|
22
|
+
</span>
|
|
23
|
+
</div>
|
|
24
|
+
<template v-if="validateResult.errorList.length">
|
|
25
|
+
<div class="m-t m-b">无效数据详情</div>
|
|
26
|
+
<el-table :data="errorList">
|
|
27
|
+
<el-table-column
|
|
28
|
+
v-for="column in columnsList"
|
|
29
|
+
:key="column.prop"
|
|
30
|
+
:prop="column.prop"
|
|
31
|
+
:label="column.label"
|
|
32
|
+
>
|
|
33
|
+
<template slot-scope="scope">
|
|
34
|
+
<!-- eslint-disable-next-line vue/no-v-html -->
|
|
35
|
+
<span v-html="scope.row[column.prop]"></span>
|
|
36
|
+
</template>
|
|
37
|
+
</el-table-column>
|
|
38
|
+
</el-table>
|
|
39
|
+
<div class="color-warning m-t-s">
|
|
40
|
+
上述数据输入有误,请修改导入文件中相关信息!
|
|
41
|
+
</div>
|
|
42
|
+
</template>
|
|
43
|
+
<span slot="footer">
|
|
44
|
+
<el-button type="primary" @click="progressV = false">确定</el-button>
|
|
45
|
+
</span>
|
|
46
|
+
</template>
|
|
47
|
+
</el-dialog>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<script>
|
|
51
|
+
export default {
|
|
52
|
+
props: {
|
|
53
|
+
title: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: '提示'
|
|
56
|
+
},
|
|
57
|
+
visible: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: false
|
|
60
|
+
},
|
|
61
|
+
percentType: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: undefined
|
|
64
|
+
},
|
|
65
|
+
percentMsg: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: undefined
|
|
68
|
+
},
|
|
69
|
+
percent: {
|
|
70
|
+
type: Number,
|
|
71
|
+
default: undefined
|
|
72
|
+
},
|
|
73
|
+
validateResult: {
|
|
74
|
+
type: Object,
|
|
75
|
+
default: undefined
|
|
76
|
+
},
|
|
77
|
+
hidePercent: {
|
|
78
|
+
type: Boolean,
|
|
79
|
+
default: false
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
computed: {
|
|
83
|
+
progressV: {
|
|
84
|
+
get() {
|
|
85
|
+
return this.visible
|
|
86
|
+
},
|
|
87
|
+
set(v) {
|
|
88
|
+
this.$emit('update:visible', v)
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
columnsList() {
|
|
92
|
+
return (this.validateResult && this.validateResult.columnsList) || []
|
|
93
|
+
},
|
|
94
|
+
errorList() {
|
|
95
|
+
let errorList = this.validateResult && this.validateResult.errorList
|
|
96
|
+
if (errorList) {
|
|
97
|
+
let _errorList = []
|
|
98
|
+
errorList.forEach((item) => {
|
|
99
|
+
const temp = { ...item }
|
|
100
|
+
if (item.errorList) {
|
|
101
|
+
item.errorList.forEach((eK) => {
|
|
102
|
+
temp[eK] = `<span class="color-danger">${temp[eK]}</span>`
|
|
103
|
+
})
|
|
104
|
+
}
|
|
105
|
+
_errorList.push(temp)
|
|
106
|
+
})
|
|
107
|
+
return _errorList
|
|
108
|
+
} else {
|
|
109
|
+
return undefined
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
</script>
|
|
@@ -5,13 +5,21 @@ directive.install = (Vue) => {
|
|
|
5
5
|
bind: function (el, binding, node) {
|
|
6
6
|
el.clickOutsideEvent = function (event) {
|
|
7
7
|
if (!(el === event.target || el.contains(event.target))) {
|
|
8
|
-
|
|
8
|
+
binding.value(event)
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
document.body.addEventListener(
|
|
11
|
+
document.body.addEventListener(
|
|
12
|
+
'click',
|
|
13
|
+
el.clickOutsideEvent,
|
|
14
|
+
binding.arg === 'capture'
|
|
15
|
+
)
|
|
12
16
|
},
|
|
13
17
|
unbind: function (el, binding) {
|
|
14
|
-
document.body.removeEventListener(
|
|
18
|
+
document.body.removeEventListener(
|
|
19
|
+
'click',
|
|
20
|
+
el.clickOutsideEvent,
|
|
21
|
+
binding.arg === 'capture'
|
|
22
|
+
)
|
|
15
23
|
}
|
|
16
24
|
})
|
|
17
25
|
}
|
|
@@ -6,12 +6,14 @@
|
|
|
6
6
|
// 封装全局弹窗拖拽指令 v-drag
|
|
7
7
|
function dialogMoveFn(_this) {
|
|
8
8
|
var dialogDom = _this.parentNode
|
|
9
|
-
dialogDom.style.top =
|
|
10
|
-
|
|
9
|
+
dialogDom.style.top =
|
|
10
|
+
parseFloat(dialogDom.style.top || '0') + _this.pageYc + 'px'
|
|
11
|
+
dialogDom.style.left =
|
|
12
|
+
parseFloat(dialogDom.style.left || '0') + _this.pageXc + 'px'
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
const dialogMove = {
|
|
14
|
-
install: function(Vue) {
|
|
16
|
+
install: function (Vue) {
|
|
15
17
|
Vue.directive('drag', {
|
|
16
18
|
update(el, binding) {
|
|
17
19
|
if (el.style.display === 'none') {
|
|
@@ -21,14 +23,14 @@ const dialogMove = {
|
|
|
21
23
|
dialogDom.style.top = ''
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
|
-
Vue.nextTick(function() {
|
|
26
|
+
Vue.nextTick(function () {
|
|
25
27
|
var dialogHeader = el.querySelector('.el-dialog__header')
|
|
26
28
|
if (dialogHeader && !dialogHeader._hasMoveDir) {
|
|
27
29
|
var _this, pvrPageX, pvrPageY
|
|
28
30
|
dialogHeader._hasMoveDir = true
|
|
29
31
|
dialogHeader.style.cursor = 'move'
|
|
30
32
|
|
|
31
|
-
dialogHeader.addEventListener('mousedown', function(evt) {
|
|
33
|
+
dialogHeader.addEventListener('mousedown', function (evt) {
|
|
32
34
|
var ev = evt || event
|
|
33
35
|
this.pageXc = this.pageYc = 0
|
|
34
36
|
_this = this
|
|
@@ -38,7 +40,7 @@ const dialogMove = {
|
|
|
38
40
|
document.addEventListener('mouseup', mouseupThisMove)
|
|
39
41
|
})
|
|
40
42
|
|
|
41
|
-
var mousemoveThisMove = function(evt) {
|
|
43
|
+
var mousemoveThisMove = function (evt) {
|
|
42
44
|
var ev = evt || event
|
|
43
45
|
ev.stopPropagation()
|
|
44
46
|
ev.preventDefault()
|
|
@@ -51,14 +53,16 @@ const dialogMove = {
|
|
|
51
53
|
_this.pageXc = ev.pageX - pvrPageX
|
|
52
54
|
_this.pageYc = ev.pageY - pvrPageY
|
|
53
55
|
if (_this.pageXc !== 0 || _this.pageYc !== 0) {
|
|
54
|
-
binding.value
|
|
56
|
+
binding.value
|
|
57
|
+
? binding.value(_this, binding.arg)
|
|
58
|
+
: dialogMoveFn(_this)
|
|
55
59
|
}
|
|
56
60
|
pvrPageX = ev.pageX
|
|
57
61
|
pvrPageY = ev.pageY
|
|
58
62
|
}
|
|
59
63
|
}
|
|
60
64
|
|
|
61
|
-
var mouseupThisMove = function() {
|
|
65
|
+
var mouseupThisMove = function () {
|
|
62
66
|
document.removeEventListener('mousemove', mousemoveThisMove)
|
|
63
67
|
document.removeEventListener('mouseup', mouseupThisMove)
|
|
64
68
|
}
|
|
@@ -4,7 +4,7 @@ directive.install = (Vue) => {
|
|
|
4
4
|
Vue.directive('move', {
|
|
5
5
|
bind(el, binding) {
|
|
6
6
|
var _this, pvrPageX, pvrPageY
|
|
7
|
-
var mousemoveThisMove = function(evt) {
|
|
7
|
+
var mousemoveThisMove = function (evt) {
|
|
8
8
|
var ev = evt || event
|
|
9
9
|
ev.stopPropagation()
|
|
10
10
|
ev.preventDefault()
|
|
@@ -16,11 +16,11 @@ directive.install = (Vue) => {
|
|
|
16
16
|
pvrPageX = ev.pageX
|
|
17
17
|
pvrPageY = ev.pageY
|
|
18
18
|
}
|
|
19
|
-
var mouseupThisMove = function() {
|
|
19
|
+
var mouseupThisMove = function () {
|
|
20
20
|
document.removeEventListener('mousemove', mousemoveThisMove)
|
|
21
21
|
document.removeEventListener('mouseup', mouseupThisMove)
|
|
22
22
|
}
|
|
23
|
-
el.addEventListener('mousedown', function(evt) {
|
|
23
|
+
el.addEventListener('mousedown', function (evt) {
|
|
24
24
|
var ev = evt || event
|
|
25
25
|
this.pageXc = this.pageYc = 0
|
|
26
26
|
_this = this
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
const VD = '_v-rule-key_validate_'
|
|
2
|
+
|
|
3
|
+
function getRules(rules, evType) {
|
|
4
|
+
if (rules) {
|
|
5
|
+
let _rules = []
|
|
6
|
+
if (Array.isArray(rules)) {
|
|
7
|
+
_rules = rules
|
|
8
|
+
} else if (typeof rules === 'object') {
|
|
9
|
+
_rules.push(rules)
|
|
10
|
+
}
|
|
11
|
+
if (evType === 'submit') {
|
|
12
|
+
return _rules
|
|
13
|
+
} else {
|
|
14
|
+
return _rules.filter((r) => r.trigger.includes(evType))
|
|
15
|
+
}
|
|
16
|
+
} else {
|
|
17
|
+
return []
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function validateRoule(rule, value) {
|
|
22
|
+
return new Promise(function (resolve, reject) {
|
|
23
|
+
if (rule.required) {
|
|
24
|
+
if (
|
|
25
|
+
value === undefined ||
|
|
26
|
+
value === null ||
|
|
27
|
+
value === '' ||
|
|
28
|
+
(Array.isArray(value) && value.length === 0)
|
|
29
|
+
) {
|
|
30
|
+
reject(rule.message)
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (rule.type === 'string') {
|
|
35
|
+
if (typeof value !== 'string') {
|
|
36
|
+
reject(rule.message)
|
|
37
|
+
return
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (rule.type === 'number') {
|
|
41
|
+
if (typeof value !== 'number') {
|
|
42
|
+
reject(rule.message)
|
|
43
|
+
return
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (rule.type === 'boolean') {
|
|
47
|
+
if (typeof value !== 'boolean') {
|
|
48
|
+
reject(rule.message)
|
|
49
|
+
return
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (rule.type === 'array') {
|
|
53
|
+
if (!(Array.isArray(value) && value.length > 0)) {
|
|
54
|
+
reject(rule.message)
|
|
55
|
+
return
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (rule.type === 'date') {
|
|
59
|
+
if (new Date(value).toString() === 'Invalid Date') {
|
|
60
|
+
reject(rule.message)
|
|
61
|
+
return
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (rule.min !== undefined || rule.max !== undefined) {
|
|
65
|
+
if (value === undefined || value === null) {
|
|
66
|
+
reject(rule.message)
|
|
67
|
+
return
|
|
68
|
+
} else {
|
|
69
|
+
let _v = value.toString()
|
|
70
|
+
if (_v.length < rule.min || _v.length > rule.max) {
|
|
71
|
+
reject(rule.message)
|
|
72
|
+
return
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (rule.regexp) {
|
|
77
|
+
if (new RegExp(rule.regexp).test(value)) {
|
|
78
|
+
reject(rule.message)
|
|
79
|
+
return
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (!rule.validator) {
|
|
83
|
+
resolve()
|
|
84
|
+
return
|
|
85
|
+
}
|
|
86
|
+
if (rule.validator) {
|
|
87
|
+
rule.validator(rule, value, (err) => {
|
|
88
|
+
if (err === undefined || err === false) {
|
|
89
|
+
resolve()
|
|
90
|
+
return
|
|
91
|
+
} else {
|
|
92
|
+
reject(err === true ? rule.message : err)
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
}
|
|
96
|
+
})
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function showErr(el, err = '', rErr) {
|
|
100
|
+
el.classList.add('rule-key__is-error')
|
|
101
|
+
|
|
102
|
+
if (rErr) {
|
|
103
|
+
let msgEl = el.querySelector('.rule-key__error_msg')
|
|
104
|
+
if (!msgEl) {
|
|
105
|
+
let msgEl = document.createElement('div')
|
|
106
|
+
msgEl.classList.add('rule-key__error_msg')
|
|
107
|
+
msgEl.innerText = err.toString()
|
|
108
|
+
el.appendChild(msgEl)
|
|
109
|
+
} else if (msgEl) {
|
|
110
|
+
msgEl.innerText = err.toString()
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function hideErr(el, rErr) {
|
|
115
|
+
el.classList.remove('rule-key__is-error')
|
|
116
|
+
|
|
117
|
+
if (rErr) {
|
|
118
|
+
let msgEl = el.querySelector('.rule-key__error_msg')
|
|
119
|
+
if (msgEl) {
|
|
120
|
+
el.removeChild(msgEl)
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const directive = {}
|
|
126
|
+
directive.install = (Vue) => {
|
|
127
|
+
Vue.directive('rule-key', {
|
|
128
|
+
bind(el, binding, node) {
|
|
129
|
+
let _this = node.child
|
|
130
|
+
|
|
131
|
+
let ruleForm = _this.$attrs['rule-form'] || _this.$attrs['ruleForm']
|
|
132
|
+
ruleForm && el.classList.add(ruleForm)
|
|
133
|
+
|
|
134
|
+
let rErr =
|
|
135
|
+
_this.$attrs['rule-error-hide'] || _this.$attrs['ruleErrorHide']
|
|
136
|
+
rErr = rErr !== 'true' && rErr !== true
|
|
137
|
+
|
|
138
|
+
el[VD] = (val, type) => {
|
|
139
|
+
let _val = _this[binding.value || 'value']
|
|
140
|
+
let _rules = getRules(_this.$attrs['rules'], type)
|
|
141
|
+
if (_rules.length > 0) {
|
|
142
|
+
return Promise.all(_rules.map((rule) => validateRoule(rule, _val)))
|
|
143
|
+
.then(() => {
|
|
144
|
+
hideErr(el, rErr)
|
|
145
|
+
})
|
|
146
|
+
.catch((err) => {
|
|
147
|
+
showErr(el, err, rErr)
|
|
148
|
+
})
|
|
149
|
+
} else {
|
|
150
|
+
return Promise.resolve()
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
_this.$on('change', () => {
|
|
155
|
+
setTimeout(() => el[VD](undefined, 'change'))
|
|
156
|
+
})
|
|
157
|
+
// el.addEventListener('change', () => {
|
|
158
|
+
// el[VD](undefined, 'change')
|
|
159
|
+
// })
|
|
160
|
+
|
|
161
|
+
_this.$on('blur', () => {
|
|
162
|
+
setTimeout(() => el[VD](undefined, 'blur'))
|
|
163
|
+
})
|
|
164
|
+
// el.addEventListener('blur', () => {
|
|
165
|
+
// el[VD](undefined, 'blur')
|
|
166
|
+
// })
|
|
167
|
+
}
|
|
168
|
+
})
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function rulesValidateForm(query, fn) {
|
|
172
|
+
let nodeList = document.querySelectorAll('.' + query)
|
|
173
|
+
if (nodeList.length) {
|
|
174
|
+
let validateList = []
|
|
175
|
+
nodeList.forEach((el) => {
|
|
176
|
+
typeof el[VD] === 'function' &&
|
|
177
|
+
validateList.push(el[VD](undefined, 'submit'))
|
|
178
|
+
})
|
|
179
|
+
return Promise.all(validateList)
|
|
180
|
+
.then(() => {
|
|
181
|
+
fn && fn(true)
|
|
182
|
+
})
|
|
183
|
+
.catch(() => {
|
|
184
|
+
fn && fn(false)
|
|
185
|
+
})
|
|
186
|
+
} else {
|
|
187
|
+
fn && fn(true)
|
|
188
|
+
return Promise.resolve()
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
function rulesValidateFormClear(query) {
|
|
192
|
+
let nodeList = document.querySelectorAll('.' + query)
|
|
193
|
+
nodeList.forEach((el) => {
|
|
194
|
+
hideErr(el, true)
|
|
195
|
+
})
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
window.rulesValidateForm = rulesValidateForm
|
|
199
|
+
window.rulesValidateFormClear = rulesValidateFormClear
|
|
200
|
+
|
|
201
|
+
export default directive
|
package/src/index.js
CHANGED
|
@@ -67,6 +67,7 @@ import DialogO from './components/Dialog/indexO.vue'
|
|
|
67
67
|
import VTitle from './directives/VTitle/index.js'
|
|
68
68
|
import VDrag from './directives/VDrag/index.js'
|
|
69
69
|
import VMove from './directives/VMove/index.js'
|
|
70
|
+
import VRuleKey from './directives/VRuleKey/index.js'
|
|
70
71
|
import VClickOutside from './directives/VClickOutside/index.js'
|
|
71
72
|
import VHas from './directives/VHas/index.js'
|
|
72
73
|
|
|
@@ -165,6 +166,7 @@ const install = function (Vue, opts = { prefix: 'Cl', i18nConfig: {} }) {
|
|
|
165
166
|
Vue.use(VTitle)
|
|
166
167
|
Vue.use(VDrag)
|
|
167
168
|
Vue.use(VMove)
|
|
169
|
+
Vue.use(VRuleKey)
|
|
168
170
|
Vue.use(VClickOutside)
|
|
169
171
|
Vue.use(VHas)
|
|
170
172
|
|
package/src/utils/auth.js
CHANGED
|
@@ -44,7 +44,9 @@ auth.cokenKey = 'Admin-Token'
|
|
|
44
44
|
let ownLoginPath = '/login'
|
|
45
45
|
function toLogin() {
|
|
46
46
|
let hrefOld = window.location.href
|
|
47
|
-
let loginHref = window.__POWERED_BY_QIANKUN__
|
|
47
|
+
let loginHref = window.__POWERED_BY_QIANKUN__
|
|
48
|
+
? window.location.origin + '/login'
|
|
49
|
+
: ownLoginPath
|
|
48
50
|
if (hrefOld !== loginHref) {
|
|
49
51
|
history.pushState(null, null, loginHref)
|
|
50
52
|
window.location.reload()
|
package/src/utils/axios.js
CHANGED
|
@@ -60,7 +60,9 @@ const axios = _axios.create(config)
|
|
|
60
60
|
axios.interceptors.request.use((opt) => {
|
|
61
61
|
let token = auth.getToken()
|
|
62
62
|
let headers = {
|
|
63
|
-
Authorization: token
|
|
63
|
+
Authorization: token
|
|
64
|
+
? 'Bearer ' + token
|
|
65
|
+
: 'Basic TlNUQzpWVkIxVG1sVlVURlNMemxyTkhoc2VtNXdObFJaUVQwOQ==',
|
|
64
66
|
OperationDesc: opt.OperationDesc ? encodeURI(opt.OperationDesc) : 'default',
|
|
65
67
|
timestamp: Date.now(),
|
|
66
68
|
requestKey: Date.now()
|
|
@@ -6,7 +6,8 @@ import FilterPanel from './tableheaderFilterpanel.vue'
|
|
|
6
6
|
|
|
7
7
|
function hasClass(el, cls) {
|
|
8
8
|
if (!el || !cls) return false
|
|
9
|
-
if (cls.indexOf(' ') !== -1)
|
|
9
|
+
if (cls.indexOf(' ') !== -1)
|
|
10
|
+
throw new Error('className should not contain space.')
|
|
10
11
|
if (el.classList) {
|
|
11
12
|
return el.classList.contains(cls)
|
|
12
13
|
} else {
|
|
@@ -32,14 +33,29 @@ function repairPopper() {
|
|
|
32
33
|
Popper.prototype.repairR = true
|
|
33
34
|
|
|
34
35
|
let __getBoundaries = Popper.prototype._getBoundaries
|
|
35
|
-
Popper.prototype._getBoundaries = function (
|
|
36
|
-
|
|
36
|
+
Popper.prototype._getBoundaries = function (
|
|
37
|
+
data,
|
|
38
|
+
padding,
|
|
39
|
+
boundariesElement
|
|
40
|
+
) {
|
|
41
|
+
const boundaries = __getBoundaries.call(
|
|
42
|
+
this,
|
|
43
|
+
data,
|
|
44
|
+
padding,
|
|
45
|
+
boundariesElement
|
|
46
|
+
)
|
|
37
47
|
|
|
38
48
|
if (this._options.boundariesElement === 'viewport') {
|
|
39
49
|
const root = window
|
|
40
50
|
const body = root.document.body
|
|
41
51
|
const html = root.document.documentElement
|
|
42
|
-
let width = Math.max(
|
|
52
|
+
let width = Math.max(
|
|
53
|
+
body.scrollWidth,
|
|
54
|
+
body.offsetWidth,
|
|
55
|
+
html.clientWidth,
|
|
56
|
+
html.scrollWidth,
|
|
57
|
+
html.offsetWidth
|
|
58
|
+
)
|
|
43
59
|
let height = Math.max(
|
|
44
60
|
body.scrollHeight,
|
|
45
61
|
body.offsetHeight,
|
|
@@ -48,8 +64,12 @@ function repairPopper() {
|
|
|
48
64
|
html.offsetHeight
|
|
49
65
|
)
|
|
50
66
|
|
|
51
|
-
boundaries.right =
|
|
52
|
-
|
|
67
|
+
boundaries.right =
|
|
68
|
+
boundaries.right - root.document.documentElement.clientWidth + width
|
|
69
|
+
boundaries.bottom =
|
|
70
|
+
boundaries.bottom -
|
|
71
|
+
root.document.documentElement.clientHeight +
|
|
72
|
+
height
|
|
53
73
|
}
|
|
54
74
|
return boundaries
|
|
55
75
|
}
|
|
@@ -96,12 +116,16 @@ export default function (ElementUI) {
|
|
|
96
116
|
let label = column.label || ''
|
|
97
117
|
let sortable = column.sortable ? 24 : 0
|
|
98
118
|
let filters = column.filters ? 16 : 0
|
|
99
|
-
column.minWidth = Math.max(
|
|
119
|
+
column.minWidth = Math.max(
|
|
120
|
+
80,
|
|
121
|
+
label.length * 14 + 22 + sortable + filters
|
|
122
|
+
)
|
|
100
123
|
} else {
|
|
101
124
|
column.minWidth = 80
|
|
102
125
|
}
|
|
103
126
|
}
|
|
104
|
-
column.realWidth =
|
|
127
|
+
column.realWidth =
|
|
128
|
+
column.width === undefined ? column.minWidth : column.width
|
|
105
129
|
return column
|
|
106
130
|
}
|
|
107
131
|
})
|
package/src/utils/xls2json.js
CHANGED
|
@@ -13,7 +13,7 @@ export default function toJson(file, name) {
|
|
|
13
13
|
})
|
|
14
14
|
} else if (file instanceof ArrayBuffer) {
|
|
15
15
|
try {
|
|
16
|
-
const workbook = read(
|
|
16
|
+
const workbook = read(file, { type: 'array', cellDates: true })
|
|
17
17
|
resolve(workbook)
|
|
18
18
|
} catch (err) {
|
|
19
19
|
reject(err)
|