wl-design-mobile 0.6.2 → 0.6.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wl-design-mobile",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "finch",
@@ -0,0 +1,154 @@
1
+ <template>
2
+ <div>
3
+ <div class="search-row" @click="onOpen">
4
+ <lambo-required-red-star :required="required"></lambo-required-red-star>
5
+ <div class="search-input-title">{{ title }}</div>
6
+ <div class="search-lambo-input">{{ valName }}</div>
7
+ <lambo-vector-icon v-if="icon" :icon="icon" ></lambo-vector-icon>
8
+ </div>
9
+ <div>
10
+ <van-popup v-model="showBottom" :style="{ height: '33%' }" position="bottom">
11
+ <van-radio-group v-model="selectItem.K">
12
+ <div class="bottom-div">
13
+ <div class="search-top-div">
14
+ <van-button class="search-cancel-btn" size="normal" @click="cancel">取消</van-button>
15
+ <span class="search-select-title">请选择</span>
16
+ <van-button class="search-confirm-btn" size="normal" @click="onConfirm">确认</van-button>
17
+ </div>
18
+ <div class="cell-group-div">
19
+ <van-cell-group>
20
+ <van-search v-model="searchField" placeholder="请输入筛选名称" clearable @input="search"/>
21
+ <van-cell v-for="(c, index) in searchData" :key="index" :title="`${c.V}`" clickable @click="radioClick(c)">
22
+ <template #right-icon>
23
+ <van-radio :name="c.K" checked-color="#0070D2"/>
24
+ </template>
25
+ </van-cell>
26
+ </van-cell-group>
27
+ </div>
28
+ </div>
29
+ </van-radio-group>
30
+ </van-popup>
31
+ </div>
32
+ </div>
33
+ </template>
34
+ <script>
35
+ import requiredIcon from '../../assets/icon/required.png'
36
+ import LamboVectorIcon from '../../icon/lambo-vector-icon.vue'
37
+ import LamboRequiredRedStar from '../../icon/lambo-required-red-star.vue'
38
+
39
+ export default {
40
+ name: 'LamboEditEmployeeSingleSelect',
41
+ components: {LamboRequiredRedStar, LamboVectorIcon},
42
+ props: {
43
+ title: {
44
+ type: String,
45
+ default: '',
46
+ },
47
+ placeholder: {
48
+ type: String,
49
+ default: '请选择',
50
+ },
51
+ required: {
52
+ type: Boolean,
53
+ default: false,
54
+ },
55
+ icon: {
56
+ type: String,
57
+ default: 'arrow-right-big.png',
58
+ },
59
+ data: {
60
+ type: Array,
61
+ default: () => ([]),
62
+ },
63
+ defaultItem: {
64
+ type: Object,
65
+ },
66
+ },
67
+ data() {
68
+ return {
69
+ iconSrc: requiredIcon,
70
+ showBottom: false,
71
+ val: '',
72
+ valName: '',
73
+ selectItem: {
74
+ K: '',
75
+ V: '',
76
+ },
77
+ firstLoad: true,
78
+ searchField:'',
79
+ searchData:this.data
80
+ }
81
+ },
82
+ watch: {
83
+ defaultItem: {
84
+ handler: function (val, oldVal) {
85
+ console.log('lambo-select -- defaultItem -- val,oldVal,firstLoad:', {
86
+ val,
87
+ oldVal,
88
+ 'firstLoad': this.firstLoad,
89
+ })
90
+ if (this.defaultItem && ((this.defaultItem.K && this.firstLoad === true) || !this.firstLoad) ) {
91
+ this.val = this.defaultItem.K || ''
92
+ this.valName = this.defaultItem.V || ''
93
+ this.$set(this.selectItem, 'K', this.defaultItem.K)
94
+ this.$set(this.selectItem, 'V', this.defaultItem.V)
95
+ this.firstLoad = false
96
+ this.$emit('on-ok', this.defaultItem)
97
+ }
98
+ },
99
+ deep: true,
100
+ immediate: true,
101
+ },
102
+ data:{
103
+ handler: function (val) {
104
+ this.searchData = val
105
+ }
106
+ }
107
+ },
108
+ methods: {
109
+ onOpen() {
110
+ console.log('this.data:', this.data)
111
+ this.showBottom = true
112
+ },
113
+ cancel() {
114
+ this.showBottom = false
115
+ },
116
+ onConfirm() {
117
+ if (this.selectItem && this.selectItem.K) {
118
+ this.val = this.selectItem.K
119
+ this.valName = this.selectItem.V
120
+ this.$emit('on-ok', this.selectItem)
121
+ } else {
122
+ console.error('lambo-select -- 条件选择失败,this.selectItem:', this.selectItem)
123
+ this.val = ''
124
+ this.valName = ''
125
+ this.$emit('on-ok', {K: '', V: ''})
126
+ }
127
+ this.showBottom = false
128
+ },
129
+ radioClick(data) {
130
+ if (data && data.K) {
131
+ this.selectItem.K = data.K
132
+ this.selectItem.V = data.V
133
+ }
134
+ },
135
+ search(){
136
+ let arr = []
137
+ let searchData = this.data
138
+ for (let i = 0; i < searchData.length; i++) {
139
+ if(searchData[i].V.indexOf(this.searchField)>=0){
140
+ arr.push(searchData[i]);
141
+ }
142
+ }
143
+ this.searchData = arr
144
+ }
145
+ },
146
+ created() {
147
+
148
+ },
149
+ }
150
+ </script>
151
+ <style scoped>
152
+ @import "../styles/index.less";
153
+ @import "./styles/css/index.css";
154
+ </style>