wl-design-mobile 0.6.2 → 0.6.4

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.
@@ -46,7 +46,7 @@ import LamboVectorIcon from '../../icon/lambo-vector-icon.vue'
46
46
  import LamboRequiredRedStar from '../../icon/lambo-required-red-star.vue'
47
47
 
48
48
  export default {
49
- name: 'LamboEditEmployeeSingleSelect',
49
+ name: 'LamboEditSearchSingleSelect',
50
50
  components: {LamboRequiredRedStar, LamboVectorIcon},
51
51
  props: {
52
52
  title: {
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.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "finch",
@@ -0,0 +1,152 @@
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 LamboVectorIcon from '../icon/lambo-vector-icon.vue'
36
+ import LamboRequiredRedStar from '../icon/lambo-required-red-star.vue'
37
+
38
+ export default {
39
+ name: 'LamboSearchSingleSelect',
40
+ components: {LamboRequiredRedStar, LamboVectorIcon},
41
+ props: {
42
+ title: {
43
+ type: String,
44
+ default: '',
45
+ },
46
+ placeholder: {
47
+ type: String,
48
+ default: '请选择',
49
+ },
50
+ required: {
51
+ type: Boolean,
52
+ default: false,
53
+ },
54
+ icon: {
55
+ type: String,
56
+ default: 'arrow-right-big.png',
57
+ },
58
+ data: {
59
+ type: Array,
60
+ default: () => ([]),
61
+ },
62
+ defaultItem: {
63
+ type: Object,
64
+ },
65
+ },
66
+ data() {
67
+ return {
68
+ showBottom: false,
69
+ val: '',
70
+ valName: '',
71
+ selectItem: {
72
+ K: '',
73
+ V: '',
74
+ },
75
+ firstLoad: true,
76
+ searchField:'',
77
+ searchData:this.data
78
+ }
79
+ },
80
+ watch: {
81
+ defaultItem: {
82
+ handler: function (val, oldVal) {
83
+ console.log('lambo-select -- defaultItem -- val,oldVal,firstLoad:', {
84
+ val,
85
+ oldVal,
86
+ 'firstLoad': this.firstLoad,
87
+ })
88
+ if (this.defaultItem && ((this.defaultItem.K && this.firstLoad === true) || !this.firstLoad) ) {
89
+ this.val = this.defaultItem.K || ''
90
+ this.valName = this.defaultItem.V || ''
91
+ this.$set(this.selectItem, 'K', this.defaultItem.K)
92
+ this.$set(this.selectItem, 'V', this.defaultItem.V)
93
+ this.firstLoad = false
94
+ this.$emit('on-ok', this.defaultItem)
95
+ }
96
+ },
97
+ deep: true,
98
+ immediate: true,
99
+ },
100
+ data:{
101
+ handler: function (val) {
102
+ this.searchData = val
103
+ }
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
+ console.error('lambo-select -- 条件选择失败,this.selectItem:', this.selectItem)
121
+ this.val = ''
122
+ this.valName = ''
123
+ this.$emit('on-ok', {K: '', V: ''})
124
+ }
125
+ this.showBottom = false
126
+ },
127
+ radioClick(data) {
128
+ if (data && data.K) {
129
+ this.selectItem.K = data.K
130
+ this.selectItem.V = data.V
131
+ }
132
+ },
133
+ search(){
134
+ let arr = []
135
+ let searchData = this.data
136
+ for (let i = 0; i < searchData.length; i++) {
137
+ if(searchData[i].V.indexOf(this.searchField)>=0){
138
+ arr.push(searchData[i]);
139
+ }
140
+ }
141
+ this.searchData = arr
142
+ }
143
+ },
144
+ created() {
145
+
146
+ },
147
+ }
148
+ </script>
149
+ <style scoped>
150
+ @import "../styles/index.less";
151
+ @import "./styles/css/index.css";
152
+ </style>