wl-design-mobile 0.0.1 → 0.0.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/api/doc.js +25 -0
- package/api/x1.js +56 -0
- package/btn/lambo-big-button.vue +125 -121
- package/btn/lambo-button-group.vue +47 -47
- package/btn/lambo-medium-button.vue +123 -121
- package/btn/lambo-small-button-group.vue +31 -31
- package/btn/lambo-small-button-select.vue +53 -53
- package/btn/lambo-small-button.vue +123 -121
- package/card-item/card-row-icon.vue +0 -1
- package/card-item/filtrate-row.vue +1 -0
- package/collapse/lambo-collapse.vue +80 -80
- package/config/config.js +14 -0
- package/detail/lambo-detail-grid.vue +87 -57
- package/detail/lambo-detail-row.vue +59 -59
- package/doc/file/lambo-file-upload.vue +176 -179
- package/doc/file/styles/css/index.css +118 -118
- package/doc/img/lambo-img-upload.vue +109 -109
- package/edit/list/Lambo-edit-list.vue +90 -90
- package/edit/list/lambo-edit-card-group.vue +103 -103
- package/edit/select/lambo-edit-date-range.vue +135 -135
- package/edit/select/lambo-edit-date-time.vue +105 -0
- package/edit/select/lambo-edit-date.vue +108 -108
- package/edit/select/lambo-edit-input-textarea.vue +92 -92
- package/edit/select/lambo-edit-input.vue +92 -92
- package/edit/select/lambo-edit-multi-select.vue +160 -160
- package/edit/select/lambo-edit-single-select.vue +153 -153
- package/flow/lambo-flow-detail.vue +30 -30
- package/flow/lambo-flow-edit.vue +30 -30
- package/icon/lambo-required-red-star.vue +47 -47
- package/list/lambo-list.vue +1 -1
- package/nav/lambo-top-nav.vue +89 -89
- package/package.json +4 -2
- package/search/lambo-date-range-page.vue +191 -191
- package/search/lambo-date-range.vue +107 -107
- package/search/lambo-input.vue +74 -74
- package/search/lambo-multi-select.vue +125 -125
- package/search/lambo-org-select-page.vue +109 -109
- package/search/lambo-search-box.vue +55 -55
- package/search/lambo-single-select.vue +119 -119
- package/styles/base.less +75 -75
- package/styles/components/btn.less +7 -7
- package/styles/components/search.less +33 -33
- package/styles/components/tag.less +181 -181
- package/styles/index.less +4 -4
- package/tag/lambo-tag.vue +25 -0
- package/title/lambo-title1.vue +129 -129
- package/title/lambo-title2.vue +37 -37
- package/util/assist.js +43 -0
- package/util/axios/cacheconf.js +19 -0
- package/util/axios/index.js +11 -0
- package/util/axios/interceptors.js +101 -0
- package/util/bus.js +4 -0
- package/util/token.js +36 -0
|
@@ -1,160 +1,160 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<div class="edit-box" @click="changeColor">
|
|
4
|
-
<div class="edit-left-box">
|
|
5
|
-
<div class="edit-left-top">
|
|
6
|
-
<div class="edit-red-icon" v-if="required">
|
|
7
|
-
<lambo-required-red-star :required="required"></lambo-required-red-star>
|
|
8
|
-
</div>
|
|
9
|
-
<div class="edit-title">{{ title }}222</div>
|
|
10
|
-
</div>
|
|
11
|
-
<van-field v-model="valName" :placeholder="placeholder" class="edit-lambo-input"
|
|
12
|
-
clear-trigger="focus"></van-field>
|
|
13
|
-
</div>
|
|
14
|
-
<div class="edit-right-icon" v-if="icon">
|
|
15
|
-
<lambo-vector-icon :icon="icon" @click="onOpen"></lambo-vector-icon>
|
|
16
|
-
</div>
|
|
17
|
-
</div>
|
|
18
|
-
<div>
|
|
19
|
-
<van-popup v-model:show="showBottom" :style="{ height: '33%' }" position="bottom">
|
|
20
|
-
<van-checkbox-group v-model="selectItem.K">
|
|
21
|
-
<div class="edit-top-div">
|
|
22
|
-
<van-button class="edit-cancel-btn" size="normal" @click="cancel">取消</van-button>
|
|
23
|
-
<span class="edit-select-title">请选择</span>
|
|
24
|
-
<van-button class="edit-confirm-btn" size="normal" @click="onConfirm">确认</van-button>
|
|
25
|
-
</div>
|
|
26
|
-
<van-cell-group>
|
|
27
|
-
<van-cell v-for="(c, index) in data" :key="index" :title="`${c.V}`" clickable @click="checkboxClick(c)">
|
|
28
|
-
<template #right-icon>
|
|
29
|
-
<van-checkbox ref="checkboxes" :name="c.K" checked-color="#0070D2" shape="square"/>
|
|
30
|
-
</template>
|
|
31
|
-
</van-cell>
|
|
32
|
-
</van-cell-group>
|
|
33
|
-
</van-checkbox-group>
|
|
34
|
-
</van-popup>
|
|
35
|
-
</div>
|
|
36
|
-
</div>
|
|
37
|
-
</template>
|
|
38
|
-
<script>
|
|
39
|
-
import LamboRequiredRedStar from '
|
|
40
|
-
import LamboVectorIcon from '
|
|
41
|
-
import {Toast} from 'vant'
|
|
42
|
-
|
|
43
|
-
export default {
|
|
44
|
-
name: 'LamboEditMultiSelect',
|
|
45
|
-
components: {LamboVectorIcon, LamboRequiredRedStar},
|
|
46
|
-
props: {
|
|
47
|
-
title: {
|
|
48
|
-
type: String,
|
|
49
|
-
default: '',
|
|
50
|
-
},
|
|
51
|
-
placeholder: {
|
|
52
|
-
type: String,
|
|
53
|
-
default: '请选择',
|
|
54
|
-
},
|
|
55
|
-
required: {
|
|
56
|
-
type: Boolean,
|
|
57
|
-
default: false,
|
|
58
|
-
},
|
|
59
|
-
icon: {
|
|
60
|
-
type: String,
|
|
61
|
-
default: 'arrow-right-big.png',
|
|
62
|
-
},
|
|
63
|
-
data: {
|
|
64
|
-
type: Array,
|
|
65
|
-
default: () => ([]),
|
|
66
|
-
},
|
|
67
|
-
defaultItem: {
|
|
68
|
-
type: Object,
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
data() {
|
|
72
|
-
return {
|
|
73
|
-
showBottom: false,
|
|
74
|
-
val: '',
|
|
75
|
-
valName: '',
|
|
76
|
-
selectItem: {
|
|
77
|
-
K: [],
|
|
78
|
-
V: [],
|
|
79
|
-
},
|
|
80
|
-
firstLoad: true,
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
watch: {
|
|
84
|
-
defaultItem: {
|
|
85
|
-
handler: function (val, oldVal) {
|
|
86
|
-
console.log('multi-select -- defaultItem -- val,oldVal,firstLoad:', {
|
|
87
|
-
val,
|
|
88
|
-
oldVal,
|
|
89
|
-
'firstLoad': this.firstLoad,
|
|
90
|
-
})
|
|
91
|
-
if (this.defaultItem && this.defaultItem.K && this.firstLoad === true) {
|
|
92
|
-
this.val = this.defaultItem.K
|
|
93
|
-
this.valName = this.defaultItem.V.join()
|
|
94
|
-
this.selectItem.K = this.defaultItem.K
|
|
95
|
-
this.selectItem.V = this.defaultItem.V
|
|
96
|
-
this.firstLoad = false
|
|
97
|
-
this.$emit('on-ok', this.defaultItem)
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
deep: true,
|
|
101
|
-
immediate: true,
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
methods: {
|
|
105
|
-
onOpen() {
|
|
106
|
-
this.showBottom = true
|
|
107
|
-
},
|
|
108
|
-
cancel() {
|
|
109
|
-
this.showBottom = false
|
|
110
|
-
},
|
|
111
|
-
onConfirm() {
|
|
112
|
-
if (this.selectItem && typeof this.selectItem === 'object' && this.selectItem.K && this.selectItem.V) {
|
|
113
|
-
this.val = this.selectItem.K
|
|
114
|
-
this.valName = this.selectItem.V.join()
|
|
115
|
-
this.$emit('on-ok', this.selectItem)
|
|
116
|
-
} else {
|
|
117
|
-
Toast.fail('查询条件选择失败,请联系管理员')
|
|
118
|
-
console.error('multi-select -- 查询条件选择失败,this.selectItem:', this.selectItem)
|
|
119
|
-
this.val = []
|
|
120
|
-
this.valName = ''
|
|
121
|
-
this.$emit('on-ok', {K: [], V: []})
|
|
122
|
-
}
|
|
123
|
-
this.showBottom = false
|
|
124
|
-
},
|
|
125
|
-
checkboxClick(data) {
|
|
126
|
-
console.log('multi-select -- checkboxClick:', data)
|
|
127
|
-
if (data && data.K) {
|
|
128
|
-
if (this.selectItem.K.includes(data.K)) {
|
|
129
|
-
this.selectItem.K.splice(this.selectItem.K.indexOf(data.K), 1)
|
|
130
|
-
this.selectItem.V.splice(this.selectItem.V.indexOf(data.V), 1)
|
|
131
|
-
} else {
|
|
132
|
-
this.selectItem.K.push(data.K)
|
|
133
|
-
this.selectItem.V.push(data.V)
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
changeColor() {
|
|
138
|
-
let searchRows = document.querySelectorAll('.edit-box')
|
|
139
|
-
Array.from(searchRows).forEach(function (row, index) {
|
|
140
|
-
row.addEventListener('click', function () {
|
|
141
|
-
Array.from(searchRows).forEach(function (row) {
|
|
142
|
-
row.style.borderBottom = '1px solid var(--scl-white-2)'
|
|
143
|
-
})
|
|
144
|
-
row.style.borderBottom = '1px solid var(--scl-blue)'
|
|
145
|
-
})
|
|
146
|
-
})
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
created() {
|
|
150
|
-
}
|
|
151
|
-
,
|
|
152
|
-
mounted() {
|
|
153
|
-
}
|
|
154
|
-
,
|
|
155
|
-
}
|
|
156
|
-
</script>
|
|
157
|
-
<style scoped>
|
|
158
|
-
@import "../../styles/index.less";
|
|
159
|
-
@import "styles/css/index.css";
|
|
160
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div class="edit-box" @click="changeColor">
|
|
4
|
+
<div class="edit-left-box">
|
|
5
|
+
<div class="edit-left-top">
|
|
6
|
+
<div class="edit-red-icon" v-if="required">
|
|
7
|
+
<lambo-required-red-star :required="required"></lambo-required-red-star>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="edit-title">{{ title }}222</div>
|
|
10
|
+
</div>
|
|
11
|
+
<van-field v-model="valName" :placeholder="placeholder" class="edit-lambo-input"
|
|
12
|
+
clear-trigger="focus"></van-field>
|
|
13
|
+
</div>
|
|
14
|
+
<div class="edit-right-icon" v-if="icon">
|
|
15
|
+
<lambo-vector-icon :icon="icon" @click="onOpen"></lambo-vector-icon>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
<div>
|
|
19
|
+
<van-popup v-model:show="showBottom" :style="{ height: '33%' }" position="bottom">
|
|
20
|
+
<van-checkbox-group v-model="selectItem.K">
|
|
21
|
+
<div class="edit-top-div">
|
|
22
|
+
<van-button class="edit-cancel-btn" size="normal" @click="cancel">取消</van-button>
|
|
23
|
+
<span class="edit-select-title">请选择</span>
|
|
24
|
+
<van-button class="edit-confirm-btn" size="normal" @click="onConfirm">确认</van-button>
|
|
25
|
+
</div>
|
|
26
|
+
<van-cell-group>
|
|
27
|
+
<van-cell v-for="(c, index) in data" :key="index" :title="`${c.V}`" clickable @click="checkboxClick(c)">
|
|
28
|
+
<template #right-icon>
|
|
29
|
+
<van-checkbox ref="checkboxes" :name="c.K" checked-color="#0070D2" shape="square"/>
|
|
30
|
+
</template>
|
|
31
|
+
</van-cell>
|
|
32
|
+
</van-cell-group>
|
|
33
|
+
</van-checkbox-group>
|
|
34
|
+
</van-popup>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</template>
|
|
38
|
+
<script>
|
|
39
|
+
import LamboRequiredRedStar from '../../icon/lambo-required-red-star.vue'
|
|
40
|
+
import LamboVectorIcon from '../../icon/lambo-vector-icon.vue'
|
|
41
|
+
import {Toast} from 'vant'
|
|
42
|
+
|
|
43
|
+
export default {
|
|
44
|
+
name: 'LamboEditMultiSelect',
|
|
45
|
+
components: {LamboVectorIcon, LamboRequiredRedStar},
|
|
46
|
+
props: {
|
|
47
|
+
title: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: '',
|
|
50
|
+
},
|
|
51
|
+
placeholder: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: '请选择',
|
|
54
|
+
},
|
|
55
|
+
required: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: false,
|
|
58
|
+
},
|
|
59
|
+
icon: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: 'arrow-right-big.png',
|
|
62
|
+
},
|
|
63
|
+
data: {
|
|
64
|
+
type: Array,
|
|
65
|
+
default: () => ([]),
|
|
66
|
+
},
|
|
67
|
+
defaultItem: {
|
|
68
|
+
type: Object,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
data() {
|
|
72
|
+
return {
|
|
73
|
+
showBottom: false,
|
|
74
|
+
val: '',
|
|
75
|
+
valName: '',
|
|
76
|
+
selectItem: {
|
|
77
|
+
K: [],
|
|
78
|
+
V: [],
|
|
79
|
+
},
|
|
80
|
+
firstLoad: true,
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
watch: {
|
|
84
|
+
defaultItem: {
|
|
85
|
+
handler: function (val, oldVal) {
|
|
86
|
+
console.log('multi-select -- defaultItem -- val,oldVal,firstLoad:', {
|
|
87
|
+
val,
|
|
88
|
+
oldVal,
|
|
89
|
+
'firstLoad': this.firstLoad,
|
|
90
|
+
})
|
|
91
|
+
if (this.defaultItem && this.defaultItem.K && this.firstLoad === true) {
|
|
92
|
+
this.val = this.defaultItem.K
|
|
93
|
+
this.valName = this.defaultItem.V.join()
|
|
94
|
+
this.selectItem.K = this.defaultItem.K
|
|
95
|
+
this.selectItem.V = this.defaultItem.V
|
|
96
|
+
this.firstLoad = false
|
|
97
|
+
this.$emit('on-ok', this.defaultItem)
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
deep: true,
|
|
101
|
+
immediate: true,
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
methods: {
|
|
105
|
+
onOpen() {
|
|
106
|
+
this.showBottom = true
|
|
107
|
+
},
|
|
108
|
+
cancel() {
|
|
109
|
+
this.showBottom = false
|
|
110
|
+
},
|
|
111
|
+
onConfirm() {
|
|
112
|
+
if (this.selectItem && typeof this.selectItem === 'object' && this.selectItem.K && this.selectItem.V) {
|
|
113
|
+
this.val = this.selectItem.K
|
|
114
|
+
this.valName = this.selectItem.V.join()
|
|
115
|
+
this.$emit('on-ok', this.selectItem)
|
|
116
|
+
} else {
|
|
117
|
+
Toast.fail('查询条件选择失败,请联系管理员')
|
|
118
|
+
console.error('multi-select -- 查询条件选择失败,this.selectItem:', this.selectItem)
|
|
119
|
+
this.val = []
|
|
120
|
+
this.valName = ''
|
|
121
|
+
this.$emit('on-ok', {K: [], V: []})
|
|
122
|
+
}
|
|
123
|
+
this.showBottom = false
|
|
124
|
+
},
|
|
125
|
+
checkboxClick(data) {
|
|
126
|
+
console.log('multi-select -- checkboxClick:', data)
|
|
127
|
+
if (data && data.K) {
|
|
128
|
+
if (this.selectItem.K.includes(data.K)) {
|
|
129
|
+
this.selectItem.K.splice(this.selectItem.K.indexOf(data.K), 1)
|
|
130
|
+
this.selectItem.V.splice(this.selectItem.V.indexOf(data.V), 1)
|
|
131
|
+
} else {
|
|
132
|
+
this.selectItem.K.push(data.K)
|
|
133
|
+
this.selectItem.V.push(data.V)
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
changeColor() {
|
|
138
|
+
let searchRows = document.querySelectorAll('.edit-box')
|
|
139
|
+
Array.from(searchRows).forEach(function (row, index) {
|
|
140
|
+
row.addEventListener('click', function () {
|
|
141
|
+
Array.from(searchRows).forEach(function (row) {
|
|
142
|
+
row.style.borderBottom = '1px solid var(--scl-white-2)'
|
|
143
|
+
})
|
|
144
|
+
row.style.borderBottom = '1px solid var(--scl-blue)'
|
|
145
|
+
})
|
|
146
|
+
})
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
created() {
|
|
150
|
+
}
|
|
151
|
+
,
|
|
152
|
+
mounted() {
|
|
153
|
+
}
|
|
154
|
+
,
|
|
155
|
+
}
|
|
156
|
+
</script>
|
|
157
|
+
<style scoped>
|
|
158
|
+
@import "../../styles/index.less";
|
|
159
|
+
@import "styles/css/index.css";
|
|
160
|
+
</style>
|
|
@@ -1,153 +1,153 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<div class="edit-box" @click="changeColor">
|
|
4
|
-
<div class="edit-left-box">
|
|
5
|
-
<div class="edit-left-top">
|
|
6
|
-
<div v-if="required" class="edit-red-icon">
|
|
7
|
-
<lambo-required-red-star :required="required"></lambo-required-red-star>
|
|
8
|
-
</div>
|
|
9
|
-
<div class="edit-title">{{ title }}</div>
|
|
10
|
-
</div>
|
|
11
|
-
<van-field v-model="valName" :placeholder="placeholder" :readonly="true"
|
|
12
|
-
class="edit-lambo-input" clear-trigger="focus"></van-field>
|
|
13
|
-
</div>
|
|
14
|
-
<div v-if="icon" class="edit-right-icon">
|
|
15
|
-
<lambo-vector-icon :icon="icon" @click="onOpen"></lambo-vector-icon>
|
|
16
|
-
</div>
|
|
17
|
-
</div>
|
|
18
|
-
<div>
|
|
19
|
-
<van-popup v-model:show="showBottom" :style="{ height: '33%' }" position="bottom">
|
|
20
|
-
<van-radio-group v-model="selectItem.K">
|
|
21
|
-
<div class="edit-top-div">
|
|
22
|
-
<van-button class="edit-cancel-btn" size="normal" @click="cancel">取消</van-button>
|
|
23
|
-
<span class="edit-select-title">请选择</span>
|
|
24
|
-
<van-button class="edit-confirm-btn" size="normal" @click="onConfirm">确认</van-button>
|
|
25
|
-
</div>
|
|
26
|
-
<van-cell-group>
|
|
27
|
-
<van-cell v-for="(c, index) in data" :key="index" :title="`${c.V}`" clickable @click="radioClick(c)">
|
|
28
|
-
<template #right-icon>
|
|
29
|
-
<van-radio :name="c.K" checked-color="#0070D2"/>
|
|
30
|
-
</template>
|
|
31
|
-
</van-cell>
|
|
32
|
-
</van-cell-group>
|
|
33
|
-
</van-radio-group>
|
|
34
|
-
</van-popup>
|
|
35
|
-
</div>
|
|
36
|
-
</div>
|
|
37
|
-
</template>
|
|
38
|
-
<script>
|
|
39
|
-
import requiredIcon from '
|
|
40
|
-
import LamboVectorIcon from '
|
|
41
|
-
import {Toast} from 'vant'
|
|
42
|
-
import LamboRequiredRedStar from '
|
|
43
|
-
|
|
44
|
-
export default {
|
|
45
|
-
name: 'LamboEditSingleSelect',
|
|
46
|
-
components: {LamboRequiredRedStar, LamboVectorIcon},
|
|
47
|
-
props: {
|
|
48
|
-
title: {
|
|
49
|
-
type: String,
|
|
50
|
-
default: '',
|
|
51
|
-
},
|
|
52
|
-
placeholder: {
|
|
53
|
-
type: String,
|
|
54
|
-
default: '请选择',
|
|
55
|
-
},
|
|
56
|
-
required: {
|
|
57
|
-
type: Boolean,
|
|
58
|
-
default: false,
|
|
59
|
-
},
|
|
60
|
-
icon: {
|
|
61
|
-
type: String,
|
|
62
|
-
default: 'arrow-right-big.png',
|
|
63
|
-
},
|
|
64
|
-
data: {
|
|
65
|
-
type: Array,
|
|
66
|
-
default: () => ([]),
|
|
67
|
-
},
|
|
68
|
-
defaultItem: {
|
|
69
|
-
type: Object,
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
data() {
|
|
73
|
-
return {
|
|
74
|
-
iconSrc: requiredIcon,
|
|
75
|
-
showBottom: false,
|
|
76
|
-
val: '',
|
|
77
|
-
valName: '',
|
|
78
|
-
selectItem: {
|
|
79
|
-
K: '',
|
|
80
|
-
V: '',
|
|
81
|
-
},
|
|
82
|
-
firstLoad: true,
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
watch: {
|
|
86
|
-
defaultItem: {
|
|
87
|
-
handler: function (val, oldVal) {
|
|
88
|
-
console.log('lambo-select -- defaultItem -- val,oldVal,firstLoad:', {
|
|
89
|
-
val,
|
|
90
|
-
oldVal,
|
|
91
|
-
'firstLoad': this.firstLoad,
|
|
92
|
-
})
|
|
93
|
-
if (this.defaultItem && ((this.defaultItem.K && this.firstLoad === true) || !this.firstLoad) ) {
|
|
94
|
-
this.val = this.defaultItem.K || ''
|
|
95
|
-
this.valName = this.defaultItem.V || ''
|
|
96
|
-
this.$set(this.selectItem, 'K', this.defaultItem.K)
|
|
97
|
-
this.$set(this.selectItem, 'V', this.defaultItem.V)
|
|
98
|
-
this.firstLoad = false
|
|
99
|
-
this.$emit('on-ok', this.defaultItem)
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
deep: true,
|
|
103
|
-
immediate: true,
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
methods: {
|
|
107
|
-
onOpen() {
|
|
108
|
-
console.log('this.data:', this.data)
|
|
109
|
-
this.showBottom = true
|
|
110
|
-
},
|
|
111
|
-
cancel() {
|
|
112
|
-
this.showBottom = false
|
|
113
|
-
},
|
|
114
|
-
onConfirm() {
|
|
115
|
-
if (this.selectItem && this.selectItem.K) {
|
|
116
|
-
this.val = this.selectItem.K
|
|
117
|
-
this.valName = this.selectItem.V
|
|
118
|
-
this.$emit('on-ok', this.selectItem)
|
|
119
|
-
} else {
|
|
120
|
-
Toast.fail('条件选择失败,请联系管理员')
|
|
121
|
-
console.error('lambo-select -- 条件选择失败,this.selectItem:', this.selectItem)
|
|
122
|
-
this.val = ''
|
|
123
|
-
this.valName = ''
|
|
124
|
-
this.$emit('on-ok', {K: '', V: ''})
|
|
125
|
-
}
|
|
126
|
-
this.showBottom = false
|
|
127
|
-
},
|
|
128
|
-
radioClick(data) {
|
|
129
|
-
if (data && data.K) {
|
|
130
|
-
this.selectItem.K = data.K
|
|
131
|
-
this.selectItem.V = data.V
|
|
132
|
-
}
|
|
133
|
-
},
|
|
134
|
-
changeColor() {
|
|
135
|
-
let searchRows = document.querySelectorAll('.edit-box')
|
|
136
|
-
Array.from(searchRows).forEach(function (row, index) {
|
|
137
|
-
row.addEventListener('click', function () {
|
|
138
|
-
Array.from(searchRows).forEach(function (row) {
|
|
139
|
-
row.style.borderBottom = '1px solid var(--scl-white-2)'
|
|
140
|
-
})
|
|
141
|
-
row.style.borderBottom = '1px solid var(--scl-blue)'
|
|
142
|
-
})
|
|
143
|
-
})
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
created() {
|
|
147
|
-
},
|
|
148
|
-
}
|
|
149
|
-
</script>
|
|
150
|
-
<style scoped>
|
|
151
|
-
@import "../../styles/index.less";
|
|
152
|
-
@import "styles/css/index.css";
|
|
153
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div class="edit-box" @click="changeColor">
|
|
4
|
+
<div class="edit-left-box">
|
|
5
|
+
<div class="edit-left-top">
|
|
6
|
+
<div v-if="required" class="edit-red-icon">
|
|
7
|
+
<lambo-required-red-star :required="required"></lambo-required-red-star>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="edit-title">{{ title }}</div>
|
|
10
|
+
</div>
|
|
11
|
+
<van-field v-model="valName" :placeholder="placeholder" :readonly="true"
|
|
12
|
+
class="edit-lambo-input" clear-trigger="focus"></van-field>
|
|
13
|
+
</div>
|
|
14
|
+
<div v-if="icon" class="edit-right-icon">
|
|
15
|
+
<lambo-vector-icon :icon="icon" @click="onOpen"></lambo-vector-icon>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
<div>
|
|
19
|
+
<van-popup v-model:show="showBottom" :style="{ height: '33%' }" position="bottom">
|
|
20
|
+
<van-radio-group v-model="selectItem.K">
|
|
21
|
+
<div class="edit-top-div">
|
|
22
|
+
<van-button class="edit-cancel-btn" size="normal" @click="cancel">取消</van-button>
|
|
23
|
+
<span class="edit-select-title">请选择</span>
|
|
24
|
+
<van-button class="edit-confirm-btn" size="normal" @click="onConfirm">确认</van-button>
|
|
25
|
+
</div>
|
|
26
|
+
<van-cell-group>
|
|
27
|
+
<van-cell v-for="(c, index) in data" :key="index" :title="`${c.V}`" clickable @click="radioClick(c)">
|
|
28
|
+
<template #right-icon>
|
|
29
|
+
<van-radio :name="c.K" checked-color="#0070D2"/>
|
|
30
|
+
</template>
|
|
31
|
+
</van-cell>
|
|
32
|
+
</van-cell-group>
|
|
33
|
+
</van-radio-group>
|
|
34
|
+
</van-popup>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</template>
|
|
38
|
+
<script>
|
|
39
|
+
import requiredIcon from '../../assets/icon/required.png'
|
|
40
|
+
import LamboVectorIcon from '../../icon/lambo-vector-icon.vue'
|
|
41
|
+
import {Toast} from 'vant'
|
|
42
|
+
import LamboRequiredRedStar from '../../icon/lambo-required-red-star.vue'
|
|
43
|
+
|
|
44
|
+
export default {
|
|
45
|
+
name: 'LamboEditSingleSelect',
|
|
46
|
+
components: {LamboRequiredRedStar, LamboVectorIcon},
|
|
47
|
+
props: {
|
|
48
|
+
title: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: '',
|
|
51
|
+
},
|
|
52
|
+
placeholder: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: '请选择',
|
|
55
|
+
},
|
|
56
|
+
required: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
default: false,
|
|
59
|
+
},
|
|
60
|
+
icon: {
|
|
61
|
+
type: String,
|
|
62
|
+
default: 'arrow-right-big.png',
|
|
63
|
+
},
|
|
64
|
+
data: {
|
|
65
|
+
type: Array,
|
|
66
|
+
default: () => ([]),
|
|
67
|
+
},
|
|
68
|
+
defaultItem: {
|
|
69
|
+
type: Object,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
data() {
|
|
73
|
+
return {
|
|
74
|
+
iconSrc: requiredIcon,
|
|
75
|
+
showBottom: false,
|
|
76
|
+
val: '',
|
|
77
|
+
valName: '',
|
|
78
|
+
selectItem: {
|
|
79
|
+
K: '',
|
|
80
|
+
V: '',
|
|
81
|
+
},
|
|
82
|
+
firstLoad: true,
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
watch: {
|
|
86
|
+
defaultItem: {
|
|
87
|
+
handler: function (val, oldVal) {
|
|
88
|
+
console.log('lambo-select -- defaultItem -- val,oldVal,firstLoad:', {
|
|
89
|
+
val,
|
|
90
|
+
oldVal,
|
|
91
|
+
'firstLoad': this.firstLoad,
|
|
92
|
+
})
|
|
93
|
+
if (this.defaultItem && ((this.defaultItem.K && this.firstLoad === true) || !this.firstLoad) ) {
|
|
94
|
+
this.val = this.defaultItem.K || ''
|
|
95
|
+
this.valName = this.defaultItem.V || ''
|
|
96
|
+
this.$set(this.selectItem, 'K', this.defaultItem.K)
|
|
97
|
+
this.$set(this.selectItem, 'V', this.defaultItem.V)
|
|
98
|
+
this.firstLoad = false
|
|
99
|
+
this.$emit('on-ok', this.defaultItem)
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
deep: true,
|
|
103
|
+
immediate: true,
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
methods: {
|
|
107
|
+
onOpen() {
|
|
108
|
+
console.log('this.data:', this.data)
|
|
109
|
+
this.showBottom = true
|
|
110
|
+
},
|
|
111
|
+
cancel() {
|
|
112
|
+
this.showBottom = false
|
|
113
|
+
},
|
|
114
|
+
onConfirm() {
|
|
115
|
+
if (this.selectItem && this.selectItem.K) {
|
|
116
|
+
this.val = this.selectItem.K
|
|
117
|
+
this.valName = this.selectItem.V
|
|
118
|
+
this.$emit('on-ok', this.selectItem)
|
|
119
|
+
} else {
|
|
120
|
+
Toast.fail('条件选择失败,请联系管理员')
|
|
121
|
+
console.error('lambo-select -- 条件选择失败,this.selectItem:', this.selectItem)
|
|
122
|
+
this.val = ''
|
|
123
|
+
this.valName = ''
|
|
124
|
+
this.$emit('on-ok', {K: '', V: ''})
|
|
125
|
+
}
|
|
126
|
+
this.showBottom = false
|
|
127
|
+
},
|
|
128
|
+
radioClick(data) {
|
|
129
|
+
if (data && data.K) {
|
|
130
|
+
this.selectItem.K = data.K
|
|
131
|
+
this.selectItem.V = data.V
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
changeColor() {
|
|
135
|
+
let searchRows = document.querySelectorAll('.edit-box')
|
|
136
|
+
Array.from(searchRows).forEach(function (row, index) {
|
|
137
|
+
row.addEventListener('click', function () {
|
|
138
|
+
Array.from(searchRows).forEach(function (row) {
|
|
139
|
+
row.style.borderBottom = '1px solid var(--scl-white-2)'
|
|
140
|
+
})
|
|
141
|
+
row.style.borderBottom = '1px solid var(--scl-blue)'
|
|
142
|
+
})
|
|
143
|
+
})
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
created() {
|
|
147
|
+
},
|
|
148
|
+
}
|
|
149
|
+
</script>
|
|
150
|
+
<style scoped>
|
|
151
|
+
@import "../../styles/index.less";
|
|
152
|
+
@import "styles/css/index.css";
|
|
153
|
+
</style>
|