askbot-dragon 1.0.18 → 1.0.20

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": "askbot-dragon",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
@@ -4,11 +4,19 @@
4
4
  <span class="cacel" @click="cancelBtn">取消</span>
5
5
  <span class="primary" @click="saveData">确认</span>
6
6
  </div>
7
+ <div class="tree-input" v-if="setCascadeOption && setCascadeOption.length > 0">
8
+ <el-input
9
+ placeholder="请搜索"
10
+ v-model="filterText"
11
+ >
12
+ </el-input>
13
+ </div>
7
14
  <div class="tree-container">
8
15
  <el-tree :data="setCascadeOption"
9
16
  :props="defaultProps"
10
17
  ref="dataTree"
11
18
  node-key="value"
19
+ :filter-node-method="filterNode"
12
20
  >
13
21
  <span class="custom-tree-node" slot-scope="{ node,data}">
14
22
  <span class="tree-label">{{ node.label }}</span>
@@ -39,7 +47,8 @@ export default {
39
47
  checked:'',
40
48
  // dataTree:[],
41
49
  checkList:[],
42
- checkDatas:[]
50
+ checkDatas:[],
51
+ filterText:""
43
52
  }
44
53
  },
45
54
  props:["dataOptions","fieldValue"],
@@ -89,6 +98,16 @@ export default {
89
98
  }
90
99
  return list
91
100
  },
101
+ filterNode(value, data, node) {
102
+ if (!value) return true;
103
+ let upperCase = value.toUpperCase()
104
+ let lowerCase = value.toLowerCase()
105
+ let serchFlag = false
106
+ if (node.parent && Object.prototype.toString.call(node.parent.data) == '[object Object]') {
107
+ serchFlag = node.parent.data.label.indexOf(value) !== -1 || node.parent.data.label.indexOf(upperCase) !== -1 || node.parent.data.label.indexOf(lowerCase) !== -1
108
+ }
109
+ return data.label.indexOf(value) !== -1 || data.label.indexOf(upperCase) !== -1 || data.label.indexOf(lowerCase) !== -1 || serchFlag;
110
+ },
92
111
  },
93
112
  computed: {
94
113
  dataTree() {
@@ -167,6 +186,11 @@ export default {
167
186
  return arr
168
187
  },
169
188
  },
189
+ watch:{
190
+ filterText(val) {
191
+ this.$refs.dataTree.filter(val);
192
+ }
193
+ }
170
194
  // mounted() {
171
195
  // if (this.dataOptions.extInfo.cascadeDown.options){
172
196
  // debugger
@@ -199,7 +223,7 @@ export default {
199
223
  margin: 0 20px;
200
224
  width: calc(100% - 40px);
201
225
  /*font-size: 14px;*/
202
- padding-bottom: 30px;
226
+ padding-bottom: 20px;
203
227
  .primary{
204
228
  color: #366aff;
205
229
  cursor: pointer;
@@ -209,6 +233,10 @@ export default {
209
233
  cursor: pointer;
210
234
  }
211
235
  }
236
+ .tree-input{
237
+ width: calc(100% - 20px);
238
+ margin: 0 10px 10px 10px;
239
+ }
212
240
  .tree-container{
213
241
  height:260px;
214
242
  overflow-y: scroll;