mali-applet-ui 0.0.45 → 0.0.48
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/components/ml-amount-input/ml-amount-input.vue +25 -5
- package/components/ml-approval-record/ml-approval-record.vue +7 -7
- package/components/ml-approval-select/ml-approval-select.vue +13 -3
- package/components/ml-date-picker/ml-date-picker.vue +1 -1
- package/components/ml-form/ml-form.vue +16 -43
- package/components/ml-form-group/ml-form-group.vue +17 -3
- package/components/ml-form-item/ml-form-item.vue +118 -37
- package/components/ml-input/ml-input.vue +2 -1
- package/components/ml-textarea/ml-textarea.vue +2 -0
- package/components/ml-upload/ml-upload.vue +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
+
<view v-if="isFromReadonly" class="ml-amount-input is-readonly">
|
|
3
|
+
<view class="ml-amount-input-readonly-content">¥{{ amountLabel }}</view>
|
|
4
|
+
</view>
|
|
2
5
|
<input
|
|
6
|
+
v-else
|
|
3
7
|
class="ml-amount-input"
|
|
4
8
|
v-model="inpVal"
|
|
5
9
|
type="digit"
|
|
@@ -14,7 +18,7 @@
|
|
|
14
18
|
|
|
15
19
|
<script>
|
|
16
20
|
import XEUtils from 'xe-utils'
|
|
17
|
-
import {
|
|
21
|
+
import { toAmountString, toWanAmountString } from '../../utils'
|
|
18
22
|
|
|
19
23
|
export default {
|
|
20
24
|
name: 'MlAmountInput',
|
|
@@ -47,17 +51,29 @@ export default {
|
|
|
47
51
|
},
|
|
48
52
|
className: String
|
|
49
53
|
},
|
|
54
|
+
inject: {
|
|
55
|
+
form: {
|
|
56
|
+
from: 'mlForm',
|
|
57
|
+
default: null
|
|
58
|
+
}
|
|
59
|
+
},
|
|
50
60
|
data () {
|
|
51
61
|
return {
|
|
52
62
|
inpVal: ''
|
|
53
63
|
}
|
|
54
64
|
},
|
|
55
65
|
computed: {
|
|
66
|
+
isFromReadonly () {
|
|
67
|
+
return this.form ? this.form.readonly : false
|
|
68
|
+
},
|
|
56
69
|
currAmountNum () {
|
|
57
70
|
return this.value === '' ? '' : Number(this.value || 0)
|
|
58
71
|
},
|
|
59
|
-
|
|
60
|
-
|
|
72
|
+
amountLabel () {
|
|
73
|
+
if (this.simplify) {
|
|
74
|
+
return toWanAmountString(this.value)
|
|
75
|
+
}
|
|
76
|
+
return toAmountString(this.value)
|
|
61
77
|
},
|
|
62
78
|
minNum () {
|
|
63
79
|
if (XEUtils.isNumber(this.min) || this.min) {
|
|
@@ -108,8 +124,9 @@ export default {
|
|
|
108
124
|
this.$emit('blur')
|
|
109
125
|
},
|
|
110
126
|
inputEvent () {
|
|
111
|
-
|
|
112
|
-
this.$emit('
|
|
127
|
+
const value = this.inpVal
|
|
128
|
+
this.$emit('input', value)
|
|
129
|
+
this.$emit('change', { value })
|
|
113
130
|
}
|
|
114
131
|
}
|
|
115
132
|
}
|
|
@@ -128,4 +145,7 @@ export default {
|
|
|
128
145
|
border-radius: 10rpx;
|
|
129
146
|
}
|
|
130
147
|
}
|
|
148
|
+
.ml-amount-input-readonly-content {
|
|
149
|
+
padding: 20rpx 4rpx;
|
|
150
|
+
}
|
|
131
151
|
</style>
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
<view class="ml-approval-record-header-title">审批记录</view>
|
|
5
5
|
</view>
|
|
6
6
|
<view class="ml-approval-record-body">
|
|
7
|
-
<view class="ml-approval-record-list" v-for="(group,
|
|
7
|
+
<view class="ml-approval-record-list" v-for="(group, gIndex) in options" :key="gIndex">
|
|
8
8
|
<view class="ml-approval-record-flow-line"></view>
|
|
9
9
|
<view class="ml-approval-record-item">
|
|
10
10
|
<view class="ml-approval-record-item-title">{{ group.name }}</view>
|
|
11
11
|
</view>
|
|
12
12
|
<view class="ml-approval-record-users">
|
|
13
|
-
<view class="ml-approval-record-user-item" v-for="(item,
|
|
13
|
+
<view class="ml-approval-record-user-item" v-for="(item, uIndex) in group.users" :key="uIndex">
|
|
14
14
|
<view class="ml-approval-record-user-item-info">
|
|
15
15
|
<view class="ml-approval-record-user-item-left">
|
|
16
16
|
<image class="ml-approval-record-user-picture" :src="item.picture" mode="scaleToFill"></image>
|
|
@@ -70,17 +70,17 @@ export default {
|
|
|
70
70
|
&::before {
|
|
71
71
|
content: "";
|
|
72
72
|
position: absolute;
|
|
73
|
-
top:
|
|
74
|
-
left: -
|
|
75
|
-
width:
|
|
76
|
-
height:
|
|
73
|
+
top: 12rpx;
|
|
74
|
+
left: -10rpx;
|
|
75
|
+
width: 24rpx;
|
|
76
|
+
height: 24rpx;
|
|
77
77
|
border-radius: 50%;
|
|
78
78
|
background: #D9D9D9;
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
&:first-child {
|
|
82
82
|
.ml-approval-record-flow-line {
|
|
83
|
-
top:
|
|
83
|
+
top: 12rpx;
|
|
84
84
|
&::before {
|
|
85
85
|
top: 0;
|
|
86
86
|
}
|
|
@@ -4,19 +4,19 @@
|
|
|
4
4
|
<view class="ml-approval-select-header-title">审批流程</view>
|
|
5
5
|
</view>
|
|
6
6
|
<view class="ml-approval-select-body">
|
|
7
|
-
<view class="ml-approval-select-list" v-for="(group,
|
|
7
|
+
<view class="ml-approval-select-list" v-for="(group, gIndex) in options" :key="gIndex">
|
|
8
8
|
<view class="ml-approval-select-item">
|
|
9
9
|
<view class="ml-approval-select-item-title">{{ group.name }}</view>
|
|
10
10
|
</view>
|
|
11
11
|
<view class="ml-approval-select-users">
|
|
12
|
-
<view class="ml-approval-select-user-item" v-for="(item,
|
|
12
|
+
<view class="ml-approval-select-user-item" v-for="(item, uIndex) in group.users" :key="uIndex">
|
|
13
13
|
<image class="ml-approval-select-user-picture" :src="item.picture" mode="scaleToFill"></image>
|
|
14
14
|
<view class="ml-approval-select-user-name">{{ item.name }}</view>
|
|
15
15
|
<view class="ml-approval-select-user-remove">
|
|
16
16
|
<ml-icon name="close"></ml-icon>
|
|
17
17
|
</view>
|
|
18
18
|
</view>
|
|
19
|
-
<view class="ml-approval-select-user-add">
|
|
19
|
+
<view class="ml-approval-select-user-add" @click="openAddUser">
|
|
20
20
|
<view class="ml-approval-select-user-add-icon">
|
|
21
21
|
<ml-icon name="add"></ml-icon>
|
|
22
22
|
</view>
|
|
@@ -24,6 +24,11 @@
|
|
|
24
24
|
</view>
|
|
25
25
|
</view>
|
|
26
26
|
</view>
|
|
27
|
+
|
|
28
|
+
<uni-popup ref="popup" type="bottom">
|
|
29
|
+
<text>Popup</text>
|
|
30
|
+
<button @click="close">关闭</button>
|
|
31
|
+
</uni-popup>
|
|
27
32
|
</view>
|
|
28
33
|
</template>
|
|
29
34
|
|
|
@@ -33,6 +38,11 @@ export default {
|
|
|
33
38
|
props: {
|
|
34
39
|
value: Array,
|
|
35
40
|
options: Array
|
|
41
|
+
},
|
|
42
|
+
methods: {
|
|
43
|
+
openAddUser () {
|
|
44
|
+
this.$refs.popup.open()
|
|
45
|
+
}
|
|
36
46
|
}
|
|
37
47
|
}
|
|
38
48
|
</script>
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="ml-form" :class="[className || '']">
|
|
3
|
-
<
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
<ml-form-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
</slot>
|
|
12
|
-
</uni-forms>
|
|
2
|
+
<view class="ml-form" :class="[className || '', {'is-border': border}]">
|
|
3
|
+
<slot>
|
|
4
|
+
<view v-for="(item, index) in items" :key="index">
|
|
5
|
+
<ml-form-group v-if="item.children && item.children.length" :title="item.title">
|
|
6
|
+
<ml-form-item v-for="(cItem, cIndex) in item.children" :key="cIndex" :title="cItem.title" :field="cItem.field" :itemRender="cItem.itemRender" @modelvalue="updateModel"></ml-form-item>
|
|
7
|
+
</ml-form-group>
|
|
8
|
+
<ml-form-item v-else :title="item.title" :field="item.field" :itemRender="item.itemRender" @modelvalue="updateModel"></ml-form-item>
|
|
9
|
+
</view>
|
|
10
|
+
</slot>
|
|
13
11
|
</view>
|
|
14
12
|
</template>
|
|
15
13
|
|
|
16
14
|
<script>
|
|
17
|
-
import XEUtils from 'xe-utils'
|
|
18
|
-
|
|
19
15
|
export default {
|
|
20
16
|
name: 'MlForm',
|
|
21
17
|
options: {
|
|
@@ -26,6 +22,9 @@ export default {
|
|
|
26
22
|
data: Object,
|
|
27
23
|
items: Array,
|
|
28
24
|
rules: Object,
|
|
25
|
+
align: String,
|
|
26
|
+
titleAlign: String,
|
|
27
|
+
border: Boolean,
|
|
29
28
|
readonly: Boolean,
|
|
30
29
|
vertical: Boolean,
|
|
31
30
|
labelWidth: String,
|
|
@@ -38,43 +37,17 @@ export default {
|
|
|
38
37
|
},
|
|
39
38
|
data () {
|
|
40
39
|
return {
|
|
41
|
-
fKey: 1
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
computed: {
|
|
45
|
-
formRules () {
|
|
46
|
-
const rest = {}
|
|
47
|
-
XEUtils.each(this.rules, (rules, field) => {
|
|
48
|
-
rest[field] = {
|
|
49
|
-
rules: rules.map(item => {
|
|
50
|
-
return { ...item, errorMessage: item.message }
|
|
51
|
-
})
|
|
52
|
-
}
|
|
53
|
-
})
|
|
54
|
-
return rest
|
|
55
40
|
}
|
|
56
41
|
},
|
|
57
|
-
created () {
|
|
58
|
-
this.$nextTick(() => {
|
|
59
|
-
this.fKey++
|
|
60
|
-
})
|
|
61
|
-
},
|
|
62
42
|
methods: {
|
|
63
|
-
getProp (item, prop, defultValue) {
|
|
64
|
-
return (item.itemRender.props ? item.itemRender.props[prop] : null) || defultValue
|
|
65
|
-
},
|
|
66
43
|
validate () {
|
|
67
|
-
return
|
|
68
|
-
|
|
69
|
-
}).catch(() => {
|
|
70
|
-
return {}
|
|
44
|
+
return new Promise(resolve => {
|
|
45
|
+
resolve()
|
|
71
46
|
})
|
|
72
47
|
},
|
|
73
48
|
validateField (fields) {
|
|
74
|
-
return
|
|
75
|
-
|
|
76
|
-
}).catch(() => {
|
|
77
|
-
return {}
|
|
49
|
+
return new Promise(resolve => {
|
|
50
|
+
resolve()
|
|
78
51
|
})
|
|
79
52
|
},
|
|
80
53
|
updateModel ({ field, value }) {
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="ml-form-group" :class="className">
|
|
3
|
-
<
|
|
3
|
+
<view v-if="title || $slots.title" class="ml-form-group-title">
|
|
4
|
+
<slot name="title">
|
|
5
|
+
<text>{{ title }}</text>
|
|
6
|
+
</slot>
|
|
7
|
+
</view>
|
|
8
|
+
<view class="ml-form-group-content">
|
|
9
|
+
<slot></slot>
|
|
10
|
+
</view>
|
|
4
11
|
</view>
|
|
5
12
|
</template>
|
|
6
13
|
|
|
@@ -11,6 +18,7 @@ export default {
|
|
|
11
18
|
virtualHost: true
|
|
12
19
|
},
|
|
13
20
|
props: {
|
|
21
|
+
title: String,
|
|
14
22
|
className: String
|
|
15
23
|
}
|
|
16
24
|
}
|
|
@@ -18,9 +26,15 @@ export default {
|
|
|
18
26
|
|
|
19
27
|
<style lang="scss">
|
|
20
28
|
.ml-form-group {
|
|
21
|
-
margin:
|
|
22
|
-
padding: 20rpx;
|
|
29
|
+
margin: 20rpx 0;
|
|
23
30
|
border-radius: 10rpx;
|
|
24
31
|
background: #ffffff;
|
|
32
|
+
.ml-form-group-title {
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
min-height: 80rpx;
|
|
36
|
+
padding: 0 20rpx;
|
|
37
|
+
border-bottom: 1px solid #e5e5e5;
|
|
38
|
+
}
|
|
25
39
|
}
|
|
26
40
|
</style>
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="ml-form-item">
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
:label="title"
|
|
7
|
-
:name="field"
|
|
8
|
-
:label-width="itemLabelWidth"
|
|
9
|
-
:label-position="itemVertical">
|
|
10
|
-
<slot>
|
|
11
|
-
<ml-input v-if="matchComponent('MlInput')" :value="itemValue" border @change="modelEvent"></ml-input>
|
|
12
|
-
<ml-date-picker v-else-if="matchComponent('MlDatePicker')" :value="itemValue" border @change="modelEvent"></ml-date-picker>
|
|
13
|
-
<ml-select-picker v-else-if="matchComponent('MlSelectPicker')" :value="itemValue" :options="renderOpts.options" border @change="modelEvent"></ml-select-picker>
|
|
14
|
-
<ml-textarea v-else-if="matchComponent('MlTextarea')" :value="itemValue" :rows="renderOpts.rows || 3" border @change="modelEvent"></ml-textarea>
|
|
15
|
-
<ml-upload v-else-if="matchComponent('MlUpload')" :value="itemValue" :mediatype="renderOpts.mediatype || 'image'" @change="modelEvent"></ml-upload>
|
|
16
|
-
<view v-else>{{ itemValue }}</view>
|
|
2
|
+
<view class="ml-form-item" :class="[className, '', itemTitleAlign ? `title-align-${itemTitleAlign}` : '', itemAlign ? `align-${itemAlign}` : '', {'is-border': isFormBorder, 'is-vertical': itemVertical}]">
|
|
3
|
+
<view class="ml-form-item-title" :style="titleStyle">
|
|
4
|
+
<slot name="title">
|
|
5
|
+
<text>{{ title }}</text>
|
|
17
6
|
</slot>
|
|
18
|
-
</
|
|
7
|
+
</view>
|
|
8
|
+
<view class="ml-form-item-content">
|
|
9
|
+
<view class="ml-form-item-content-warpper">
|
|
10
|
+
<slot>
|
|
11
|
+
<ml-input v-if="matchComponent('MlInput')" :value="itemValue" border @change="modelEvent"></ml-input>
|
|
12
|
+
<ml-date-picker v-else-if="matchComponent('MlDatePicker')" :value="itemValue" border @change="modelEvent"></ml-date-picker>
|
|
13
|
+
<ml-select-picker v-else-if="matchComponent('MlSelectPicker')" :value="itemValue" :options="renderOpts.options" border @change="modelEvent"></ml-select-picker>
|
|
14
|
+
<ml-textarea v-else-if="matchComponent('MlTextarea')" :value="itemValue" :rows="renderOpts.rows || 3" border @change="modelEvent"></ml-textarea>
|
|
15
|
+
<ml-upload v-else-if="matchComponent('MlUpload')" :value="itemValue" :mediatype="renderOpts.mediatype || 'image'" @change="modelEvent"></ml-upload>
|
|
16
|
+
<ml-amount-input v-else-if="matchComponent('MlAmountInput')" :value="itemValue" @change="modelEvent"></ml-amount-input>
|
|
17
|
+
<ml-amount-text v-else-if="matchComponent('MlAmountText')" :value="itemValue" @change="modelEvent"></ml-amount-text>
|
|
18
|
+
<text v-else class="ml-form-item-default-content">{{ itemValue }}</text>
|
|
19
|
+
</slot>
|
|
20
|
+
</view>
|
|
21
|
+
</view>
|
|
19
22
|
</view>
|
|
20
23
|
</template>
|
|
21
24
|
|
|
@@ -28,10 +31,9 @@ export default {
|
|
|
28
31
|
props: {
|
|
29
32
|
title: String,
|
|
30
33
|
field: String,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
},
|
|
34
|
+
align: String,
|
|
35
|
+
titleAlign: String,
|
|
36
|
+
vertical: Boolean,
|
|
35
37
|
labelWidth: String,
|
|
36
38
|
itemRender: Object,
|
|
37
39
|
className: String
|
|
@@ -43,10 +45,16 @@ export default {
|
|
|
43
45
|
}
|
|
44
46
|
},
|
|
45
47
|
computed: {
|
|
48
|
+
titleStyle () {
|
|
49
|
+
return this.itemLabelWidth ? `width:${this.itemLabelWidth};` : ''
|
|
50
|
+
},
|
|
51
|
+
isFormBorder () {
|
|
52
|
+
return this.form ? this.form.border : false
|
|
53
|
+
},
|
|
46
54
|
isRequired () {
|
|
47
|
-
if (this.form && this.form.
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
55
|
+
if (this.form && this.form.rules) {
|
|
56
|
+
const currRules = this.form.rules[this.field]
|
|
57
|
+
if (currRules && currRules.some(item => item.required)) {
|
|
50
58
|
return true
|
|
51
59
|
}
|
|
52
60
|
}
|
|
@@ -61,12 +69,23 @@ export default {
|
|
|
61
69
|
renderOpts () {
|
|
62
70
|
return this.itemRender || {}
|
|
63
71
|
},
|
|
72
|
+
itemAlign () {
|
|
73
|
+
if (this.align) {
|
|
74
|
+
return this.align
|
|
75
|
+
}
|
|
76
|
+
return this.form ? this.form.align : ''
|
|
77
|
+
},
|
|
78
|
+
itemTitleAlign () {
|
|
79
|
+
if (this.titleAlign) {
|
|
80
|
+
return this.titleAlign
|
|
81
|
+
}
|
|
82
|
+
return this.form ? this.form.titleAlign : ''
|
|
83
|
+
},
|
|
64
84
|
itemVertical () {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
vertical = this.form ? this.form.vertical : ''
|
|
85
|
+
if (this.vertical) {
|
|
86
|
+
return true
|
|
68
87
|
}
|
|
69
|
-
return
|
|
88
|
+
return this.form ? this.form.vertical : false
|
|
70
89
|
},
|
|
71
90
|
itemLabelWidth () {
|
|
72
91
|
let labelWidth = this.labelWidth
|
|
@@ -82,18 +101,8 @@ export default {
|
|
|
82
101
|
created () {
|
|
83
102
|
this.init()
|
|
84
103
|
},
|
|
85
|
-
watch: {
|
|
86
|
-
itemVertical () {
|
|
87
|
-
this.init()
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
104
|
methods: {
|
|
91
105
|
init () {
|
|
92
|
-
this.$nextTick(() => {
|
|
93
|
-
if (this.$refs.uniFormItem) {
|
|
94
|
-
this.$refs.uniFormItem.localLabelPos = this.itemVertical
|
|
95
|
-
}
|
|
96
|
-
})
|
|
97
106
|
},
|
|
98
107
|
matchComponent (name) {
|
|
99
108
|
return this.renderOpts.name === name
|
|
@@ -104,3 +113,75 @@ export default {
|
|
|
104
113
|
}
|
|
105
114
|
}
|
|
106
115
|
</script>
|
|
116
|
+
|
|
117
|
+
<style lang="scss">
|
|
118
|
+
.ml-form-item {
|
|
119
|
+
position: relative;
|
|
120
|
+
display: flex;
|
|
121
|
+
flex-direction: row;
|
|
122
|
+
font-size: $uni-font-size-base;
|
|
123
|
+
padding: 10rpx 20rpx;
|
|
124
|
+
&.is-border {
|
|
125
|
+
border-bottom: 1px solid #e5e5e5;
|
|
126
|
+
&:last-child {
|
|
127
|
+
border: 0;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
.ml-form-item-title {
|
|
131
|
+
min-height: 70rpx;
|
|
132
|
+
color: rgba(0, 0, 0, 0.65);
|
|
133
|
+
}
|
|
134
|
+
&.is-vertical {
|
|
135
|
+
flex-direction: column;
|
|
136
|
+
}
|
|
137
|
+
&:not(.is-vertical) {
|
|
138
|
+
.ml-form-item-title {
|
|
139
|
+
flex-shrink: 0;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
&.title-align-left {
|
|
143
|
+
.ml-form-item-title {
|
|
144
|
+
text-align: left;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
&.title-align-center {
|
|
148
|
+
.ml-form-item-title {
|
|
149
|
+
text-align: center;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
&.title-align-right {
|
|
153
|
+
.ml-form-item-title {
|
|
154
|
+
text-align: right;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
&.align-left {
|
|
158
|
+
.ml-form-item-content {
|
|
159
|
+
text-align: left;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
&.align-center {
|
|
163
|
+
.ml-form-item-content {
|
|
164
|
+
text-align: center;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
&.align-right {
|
|
168
|
+
.ml-form-item-content {
|
|
169
|
+
text-align: right;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
.ml-form-item-title {
|
|
173
|
+
display: flex;
|
|
174
|
+
align-items: center;
|
|
175
|
+
padding-right: 20rpx;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
.ml-form-item-content {
|
|
179
|
+
display: flex;
|
|
180
|
+
align-items: center;
|
|
181
|
+
flex-grow: 1;
|
|
182
|
+
}
|
|
183
|
+
.ml-form-item-content-warpper {
|
|
184
|
+
flex-grow: 1;
|
|
185
|
+
width: 100%;
|
|
186
|
+
}
|
|
187
|
+
</style>
|