haiwei-ui 1.3.0 → 1.3.2
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/packages/components/box-small/index.vue +38 -38
- package/packages/components/button-copy/index.vue +48 -46
- package/packages/components/button-delete-batch/index.vue +84 -82
- package/packages/components/checkbox-group/index.vue +89 -87
- package/packages/components/list/index.vue +49 -14
- package/packages/components/map-search/index.vue +75 -73
- package/packages/components/tabs/index.vue +31 -31
- package/packages/components/toolbar/components/skin-toggle/form.vue +61 -59
- package/packages/components/tree-select/mixins.vue +257 -255
- package/packages/components/txt/index.vue +17 -17
- package/packages/components/update-password/index.vue +47 -45
- package/packages/mixins/components/select.js +24 -8
- package/packages/styles/components/box/_index.scss +17 -15
- package/packages/components/list/components/querybar/index copy.vue +0 -227
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<nm-form-dialog ref="form" title="修改密码" class="nm-update-password" width="400px" icon="password" :model="model"
|
|
2
|
+
<nm-form-dialog ref="form" title="修改密码" class="nm-update-password" width="400px" icon="password" :model="model"
|
|
3
|
+
:rules="rules" :action="updatePassword" :visible.sync="visible_" success-msg-text="修改成功" @success="logout">
|
|
3
4
|
<el-alert title="提示" type="warning" description="密码修改成功后,需要重新登录" show-icon :closable="false"></el-alert>
|
|
4
5
|
<el-row>
|
|
5
6
|
<el-col :span="18" :offset="2">
|
|
@@ -17,56 +18,57 @@
|
|
|
17
18
|
</nm-form-dialog>
|
|
18
19
|
</template>
|
|
19
20
|
<script>
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
import visible from '../../mixins/components/visible.js'
|
|
22
|
+
import { mapState, mapActions } from 'vuex'
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
24
|
+
export default {
|
|
25
|
+
name: 'UpdatePassword',
|
|
26
|
+
mixins: [visible],
|
|
27
|
+
data() {
|
|
28
|
+
// 密码验证
|
|
29
|
+
const validator = (rule, value, callback) => {
|
|
30
|
+
if (value === '') {
|
|
31
|
+
callback(new Error('请输入确认密码'))
|
|
32
|
+
} else if (value !== this.model.newPassword) {
|
|
33
|
+
callback(new Error('两次输入密码不一致!'))
|
|
34
|
+
} else {
|
|
35
|
+
callback()
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
model: {
|
|
40
|
+
oldPassword: '',
|
|
41
|
+
newPassword: '',
|
|
42
|
+
confirmPassword: ''
|
|
43
|
+
},
|
|
44
|
+
rules: {
|
|
45
|
+
oldPassword: [{ required: true, message: '请输入原密码' }],
|
|
46
|
+
newPassword: [
|
|
47
|
+
{ required: true, message: '请输入新密码' },
|
|
48
|
+
{ min: 6, message: '密码长度不能小于6' }
|
|
49
|
+
],
|
|
50
|
+
confirmPassword: [{ validator }]
|
|
51
51
|
}
|
|
52
|
-
},
|
|
53
|
-
computed: {
|
|
54
|
-
...mapState('app/system', { updatePassword: s => s.actions.updatePassword })
|
|
55
|
-
},
|
|
56
|
-
methods: {
|
|
57
|
-
...mapActions('app/system', ['logout'])
|
|
58
52
|
}
|
|
53
|
+
},
|
|
54
|
+
computed: {
|
|
55
|
+
...mapState('app/system', { updatePassword: s => s.actions.updatePassword })
|
|
56
|
+
},
|
|
57
|
+
methods: {
|
|
58
|
+
...mapActions('app/system', ['logout'])
|
|
59
59
|
}
|
|
60
|
+
}
|
|
60
61
|
</script>
|
|
61
62
|
<style lang="scss" scoped>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
63
|
+
.nm-update-password {
|
|
64
|
+
.el-alert {
|
|
65
|
+
margin-top: -5px;
|
|
66
|
+
margin-bottom: 10px;
|
|
67
|
+
line-height: 15px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.el-visible__footer {
|
|
71
|
+
line-height: 15px;
|
|
71
72
|
}
|
|
73
|
+
}
|
|
72
74
|
</style>
|
|
@@ -104,6 +104,16 @@ export default {
|
|
|
104
104
|
this.options = options
|
|
105
105
|
this.loading = false
|
|
106
106
|
|
|
107
|
+
// 检查当前值是否在新加载的选项中
|
|
108
|
+
if (this.value_ && options.length > 0) {
|
|
109
|
+
const found = this.findOptionByValue(this.value_)
|
|
110
|
+
if (found) {
|
|
111
|
+
console.log('【nm-select】refresh后找到匹配选项:', found.label, '->', found.value)
|
|
112
|
+
} else {
|
|
113
|
+
console.warn('【nm-select】refresh后未找到匹配选项,当前值:', this.value_)
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
107
117
|
if (this.checkedFirst && !this.hasInit && options.length > 0) {
|
|
108
118
|
this.onChange(options[0].value)
|
|
109
119
|
this.hasInit = true
|
|
@@ -183,15 +193,21 @@ export default {
|
|
|
183
193
|
console.log('【nm-select】value 变化:', oldVal, '->', newVal)
|
|
184
194
|
this.value_ = newVal
|
|
185
195
|
|
|
186
|
-
//
|
|
187
|
-
if (newVal
|
|
188
|
-
|
|
189
|
-
if (
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
196
|
+
// 如果新值不为空,检查新值是否在选项中
|
|
197
|
+
if (newVal) {
|
|
198
|
+
// 如果选项数据已加载,立即检查
|
|
199
|
+
if (this.options.length > 0) {
|
|
200
|
+
const found = this.findOptionByValue(newVal)
|
|
201
|
+
if (!found) {
|
|
202
|
+
console.warn('【nm-select】值', newVal, '不在当前选项列表中,尝试重新加载选项数据')
|
|
203
|
+
// 值不在当前选项中,重新加载选项数据
|
|
204
|
+
this.refresh()
|
|
205
|
+
} else {
|
|
206
|
+
console.log('【nm-select】找到匹配选项:', found.label, '->', found.value)
|
|
207
|
+
}
|
|
193
208
|
} else {
|
|
194
|
-
console.log('【nm-select
|
|
209
|
+
console.log('【nm-select】选项数据尚未加载,等待refresh后检查')
|
|
210
|
+
// 选项数据尚未加载,将在refresh方法中检查
|
|
195
211
|
}
|
|
196
212
|
}
|
|
197
213
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
border-style: solid;
|
|
9
9
|
border-top: 1px solid $border-color2;
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
>#{$prefix}box-header {
|
|
12
12
|
padding: 0 5px;
|
|
13
13
|
display: flex;
|
|
14
14
|
align-items: stretch;
|
|
@@ -62,10 +62,12 @@
|
|
|
62
62
|
|
|
63
63
|
&.is-disabled {
|
|
64
64
|
cursor: not-allowed;
|
|
65
|
+
|
|
65
66
|
span {
|
|
66
67
|
color: #c0c4cc;
|
|
67
68
|
}
|
|
68
69
|
}
|
|
70
|
+
|
|
69
71
|
&:not(.is-disabled):hover {
|
|
70
72
|
color: $text-color1;
|
|
71
73
|
transform: scale(1.2);
|
|
@@ -74,21 +76,21 @@
|
|
|
74
76
|
}
|
|
75
77
|
}
|
|
76
78
|
|
|
77
|
-
|
|
79
|
+
>#{$prefix}box-dialog {
|
|
78
80
|
position: relative;
|
|
79
81
|
border-bottom-left-radius: 3px;
|
|
80
82
|
border-bottom-right-radius: 3px;
|
|
81
83
|
@include flex-column();
|
|
82
84
|
flex-grow: 1;
|
|
83
85
|
|
|
84
|
-
|
|
86
|
+
>#{$prefix}box-content {
|
|
85
87
|
position: relative;
|
|
86
88
|
padding: 10px;
|
|
87
89
|
flex-grow: 1;
|
|
88
90
|
box-sizing: border-box;
|
|
89
91
|
}
|
|
90
92
|
|
|
91
|
-
|
|
93
|
+
>#{$prefix}box-footer {
|
|
92
94
|
padding: 0 10px;
|
|
93
95
|
flex-shrink: 0;
|
|
94
96
|
flex-grow: 0;
|
|
@@ -113,8 +115,8 @@
|
|
|
113
115
|
}
|
|
114
116
|
|
|
115
117
|
&.has-height {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
+
>#{$prefix}box-dialog {
|
|
119
|
+
>#{$prefix}box-content {
|
|
118
120
|
position: absolute;
|
|
119
121
|
padding-left: 0;
|
|
120
122
|
padding-right: 0;
|
|
@@ -124,8 +126,8 @@
|
|
|
124
126
|
#{$prefix}box-wrapper {
|
|
125
127
|
height: 100%;
|
|
126
128
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
+
>&-scrollbar {
|
|
130
|
+
>.el-scrollbar__wrap {
|
|
129
131
|
padding-left: 10px;
|
|
130
132
|
padding-right: 10px;
|
|
131
133
|
}
|
|
@@ -147,13 +149,13 @@
|
|
|
147
149
|
&.page {
|
|
148
150
|
height: 100%;
|
|
149
151
|
|
|
150
|
-
|
|
152
|
+
>#{$prefix}box-dialog {
|
|
151
153
|
padding: 0;
|
|
152
154
|
|
|
153
|
-
|
|
155
|
+
>#{$prefix}box-content {
|
|
154
156
|
padding: 0;
|
|
155
157
|
|
|
156
|
-
|
|
158
|
+
>#{$prefix}box-wrapper {
|
|
157
159
|
position: absolute;
|
|
158
160
|
width: 100%;
|
|
159
161
|
height: 100%;
|
|
@@ -167,11 +169,11 @@
|
|
|
167
169
|
}
|
|
168
170
|
|
|
169
171
|
&.no-padding {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
+
>#{$prefix}box-dialog {
|
|
173
|
+
>#{$prefix}box-content {
|
|
172
174
|
padding: 0 !important;
|
|
173
175
|
|
|
174
|
-
|
|
176
|
+
>#{$prefix}box-wrapper {
|
|
175
177
|
.el-scrollbar__view {
|
|
176
178
|
padding: 0 !important;
|
|
177
179
|
}
|
|
@@ -209,4 +211,4 @@
|
|
|
209
211
|
font-weight: 600;
|
|
210
212
|
}
|
|
211
213
|
}
|
|
212
|
-
}
|
|
214
|
+
}
|
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<!--工具栏-->
|
|
3
|
-
<section class="nm-list-querybar">
|
|
4
|
-
<nm-form ref="normalForm" class="nm-list-querybar-normal" :model="model_" :rules="rules" :size="fontSize" :inline="true">
|
|
5
|
-
<slot />
|
|
6
|
-
<el-form-item v-if="!noSearch">
|
|
7
|
-
<nm-button type="primary" @click="query" :icon="!noSearchButtonIcon ? 'search' : ''" text="查询" />
|
|
8
|
-
</el-form-item>
|
|
9
|
-
<el-form-item v-if="!noReset">
|
|
10
|
-
<nm-button type="info" @click="reset" :icon="!noSearchButtonIcon ? 'refresh' : ''" text="重置" />
|
|
11
|
-
</el-form-item>
|
|
12
|
-
<el-form-item v-if="exportEnabled" v-nm-has="exportBtnCode">
|
|
13
|
-
<nm-button type="primary" @click="onExport" icon="export" text="导出" />
|
|
14
|
-
</el-form-item>
|
|
15
|
-
<el-form-item v-if="advanced_.enabled">
|
|
16
|
-
<nm-button ref="showAdvnacedBtn" type="warning" @click="onAdvancedClick">
|
|
17
|
-
高级查询
|
|
18
|
-
<i class="el-icon--right" :class="[showAdvanced ? 'el-icon-arrow-up' : 'el-icon-arrow-down']"></i>
|
|
19
|
-
</nm-button>
|
|
20
|
-
</el-form-item>
|
|
21
|
-
<!--自定义按钮插槽-->
|
|
22
|
-
<el-form-item>
|
|
23
|
-
<slot name="buttons" />
|
|
24
|
-
</el-form-item>
|
|
25
|
-
</nm-form>
|
|
26
|
-
|
|
27
|
-
<!--高级查询框-->
|
|
28
|
-
<transition name="el-zoom-in-top">
|
|
29
|
-
<section ref="advancedBox" class="nm-list-querybar-advanced" v-if="advanced_.enabled" v-show="showAdvanced" :style="advancedStyle">
|
|
30
|
-
<nm-box page header footer title="高级查询" icon="search">
|
|
31
|
-
<template v-slot:toolbar>
|
|
32
|
-
<nm-button icon="close" @click="showAdvanced = false" />
|
|
33
|
-
</template>
|
|
34
|
-
<!--查询条件-->
|
|
35
|
-
<nm-form ref="advancedForm" :model="model_" :rules="rules" :label-width="advanced_.labelWidth" :inline="advanced_.inline">
|
|
36
|
-
<slot name="advanced" />
|
|
37
|
-
</nm-form>
|
|
38
|
-
<template v-slot:footer>
|
|
39
|
-
<!--查询按钮-->
|
|
40
|
-
<nm-button type="primary" @click="query" text="查询" :icon="!noSearchButtonIcon ? 'search' : ''" />
|
|
41
|
-
<!--重置按钮-->
|
|
42
|
-
<nm-button type="info" @click="reset" text="重置" :icon="!noSearchButtonIcon ? 'refresh' : ''" />
|
|
43
|
-
</template>
|
|
44
|
-
</nm-box>
|
|
45
|
-
<div ref="arrow" class="advanced-arrow" />
|
|
46
|
-
</section>
|
|
47
|
-
</transition>
|
|
48
|
-
</section>
|
|
49
|
-
</template>
|
|
50
|
-
<script>
|
|
51
|
-
const defaultAdvanced = {
|
|
52
|
-
// 是否开启
|
|
53
|
-
enabled: false,
|
|
54
|
-
// 宽度
|
|
55
|
-
width: '400px',
|
|
56
|
-
// 高度
|
|
57
|
-
height: '',
|
|
58
|
-
// 表单标签宽度
|
|
59
|
-
labelWidth: '100px',
|
|
60
|
-
// 内联表单
|
|
61
|
-
inline: false
|
|
62
|
-
}
|
|
63
|
-
export default {
|
|
64
|
-
data() {
|
|
65
|
-
return {
|
|
66
|
-
// 是否显示高级查询
|
|
67
|
-
showAdvanced: false,
|
|
68
|
-
// 动态计算的高度
|
|
69
|
-
dynamicHeight: ''
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
props: {
|
|
73
|
-
/** 输入框的宽度 */
|
|
74
|
-
inputWidth: {
|
|
75
|
-
type: String,
|
|
76
|
-
default: '160px'
|
|
77
|
-
},
|
|
78
|
-
/** 查询模型 */
|
|
79
|
-
model: Object,
|
|
80
|
-
/** 验证规则 */
|
|
81
|
-
rules: Object,
|
|
82
|
-
/** 高级查询属性 */
|
|
83
|
-
advanced: Object,
|
|
84
|
-
/** 不显示按钮图标 */
|
|
85
|
-
noSearchButtonIcon: Boolean,
|
|
86
|
-
/** 不需要查询 */
|
|
87
|
-
noSearch: Boolean,
|
|
88
|
-
/**不显示查询按钮 */
|
|
89
|
-
noReset: Boolean,
|
|
90
|
-
/**显示导出按钮 */
|
|
91
|
-
exportEnabled: Boolean,
|
|
92
|
-
/**导出按钮权限编码 */
|
|
93
|
-
exportBtnCode: String
|
|
94
|
-
},
|
|
95
|
-
computed: {
|
|
96
|
-
model_() {
|
|
97
|
-
return this.model || {}
|
|
98
|
-
},
|
|
99
|
-
/** 高级查询设置 */
|
|
100
|
-
advanced_() {
|
|
101
|
-
const ad = this.$_.merge({}, defaultAdvanced, this.advanced)
|
|
102
|
-
ad.enabled = ad.enabled && !this.noSearch
|
|
103
|
-
return ad
|
|
104
|
-
},
|
|
105
|
-
/** 高级查询框样式 */
|
|
106
|
-
advancedStyle() {
|
|
107
|
-
return {
|
|
108
|
-
width: this.advanced_.width,
|
|
109
|
-
height: this.advanced_.height || this.dynamicHeight
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
methods: {
|
|
114
|
-
query() {
|
|
115
|
-
this.$parent.page.index = 1
|
|
116
|
-
this.$parent.query()
|
|
117
|
-
// 如果高级查询框显示,重新计算高度
|
|
118
|
-
if (this.showAdvanced && !this.advanced_.height) {
|
|
119
|
-
this.$nextTick(() => {
|
|
120
|
-
this.calculateAdvancedHeight()
|
|
121
|
-
})
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
/** 表单重置 */
|
|
125
|
-
reset() {
|
|
126
|
-
if (this.$refs.normalForm) {
|
|
127
|
-
this.$refs.normalForm.reset()
|
|
128
|
-
}
|
|
129
|
-
if (this.$refs.advancedForm) {
|
|
130
|
-
this.$refs.advancedForm.reset()
|
|
131
|
-
}
|
|
132
|
-
this.$emit('reset')
|
|
133
|
-
},
|
|
134
|
-
validate(action) {
|
|
135
|
-
return this.$refs.normalForm.validate(action)
|
|
136
|
-
},
|
|
137
|
-
/** 计算高级查询框高度 */
|
|
138
|
-
calculateAdvancedHeight() {
|
|
139
|
-
if (!this.$refs.advancedBox) return
|
|
140
|
-
|
|
141
|
-
const $box = this.$refs.advancedBox
|
|
142
|
-
const boxHeader = $box.querySelector('.nm-box-header')?.offsetHeight || 0
|
|
143
|
-
const boxFooter = $box.querySelector('.nm-box-footer')?.offsetHeight || 0
|
|
144
|
-
const form = $box.querySelector('.nm-form')
|
|
145
|
-
if (!form) return
|
|
146
|
-
|
|
147
|
-
let boxHeight = form.offsetHeight + boxHeader + boxFooter + 20
|
|
148
|
-
if (!this.advanced_.inline) {
|
|
149
|
-
boxHeight += 20
|
|
150
|
-
}
|
|
151
|
-
$box.style.height = boxHeight + 'px'
|
|
152
|
-
// 保存动态计算的高度,避免后续样式被覆盖
|
|
153
|
-
this.dynamicHeight = boxHeight + 'px'
|
|
154
|
-
},
|
|
155
|
-
|
|
156
|
-
/** 高级查询按钮点击事件 */
|
|
157
|
-
onAdvancedClick() {
|
|
158
|
-
this.showAdvanced = !this.showAdvanced
|
|
159
|
-
|
|
160
|
-
if (this.showAdvanced) {
|
|
161
|
-
this.$nextTick(() => {
|
|
162
|
-
let $box = this.$refs.advancedBox
|
|
163
|
-
let $arrow = this.$refs.arrow
|
|
164
|
-
const boxWidth = $box.offsetWidth
|
|
165
|
-
const { x, y, width, height } = this.$refs.showAdvnacedBtn.$el.getBoundingClientRect()
|
|
166
|
-
let left = x + width / 2 - $box.offsetWidth / 2
|
|
167
|
-
// 判断右侧有没有超出页面
|
|
168
|
-
if (left + boxWidth > document.body.offsetWidth) {
|
|
169
|
-
left = document.body.offsetWidth - boxWidth - 20
|
|
170
|
-
// 计算箭头的位置
|
|
171
|
-
$arrow.style.left = x - left - 10 + width / 2 + 'px'
|
|
172
|
-
} else {
|
|
173
|
-
// 计算箭头的位置
|
|
174
|
-
$arrow.style.left = $box.offsetWidth / 2 + 'px'
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
$box.style.left = left + 'px'
|
|
178
|
-
$box.style.top = y + height + 14 + 'px'
|
|
179
|
-
|
|
180
|
-
// 设置高度
|
|
181
|
-
if (!this.advanced_.height) {
|
|
182
|
-
this.calculateAdvancedHeight()
|
|
183
|
-
}
|
|
184
|
-
})
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
onExport() {
|
|
188
|
-
this.$parent.triggerExport()
|
|
189
|
-
},
|
|
190
|
-
/** 设置输入框宽度 */
|
|
191
|
-
setInputWidths(formRef) {
|
|
192
|
-
if (!this.inputWidth || !formRef || !formRef.$el) return
|
|
193
|
-
|
|
194
|
-
let inputs = formRef.$el.querySelectorAll('.el-input__inner')
|
|
195
|
-
if (inputs) {
|
|
196
|
-
for (let i = 0; i < inputs.length; i++) {
|
|
197
|
-
const input = inputs[i]
|
|
198
|
-
// 检查是否有data-width属性,如果有则使用该值,否则使用inputWidth
|
|
199
|
-
const customWidth = input.getAttribute('data-width')
|
|
200
|
-
input.style.width = customWidth || this.inputWidth
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
},
|
|
205
|
-
mounted() {
|
|
206
|
-
this.$nextTick(() => {
|
|
207
|
-
this.$refs.normalForm.$el.addEventListener('keydown', e => {
|
|
208
|
-
if (e.keyCode === 13) {
|
|
209
|
-
this.query()
|
|
210
|
-
}
|
|
211
|
-
})
|
|
212
|
-
// 设置普通查询栏输入框宽度
|
|
213
|
-
this.setInputWidths(this.$refs.normalForm)
|
|
214
|
-
})
|
|
215
|
-
},
|
|
216
|
-
watch: {
|
|
217
|
-
showAdvanced(newVal) {
|
|
218
|
-
if (newVal && this.$refs.advancedForm) {
|
|
219
|
-
// 高级查询框显示时,设置其中的输入框宽度
|
|
220
|
-
this.$nextTick(() => {
|
|
221
|
-
this.setInputWidths(this.$refs.advancedForm)
|
|
222
|
-
})
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
</script>
|