askbot-dragon 0.7.93 → 0.7.96

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.
@@ -95,10 +95,45 @@ export default {
95
95
  watch: {
96
96
  defaultValue: {
97
97
  handler(value) {
98
- if (!value) {
99
- // 定位当前位置
100
- /* this.options.forEach(item => {})*/
98
+ console.log(value,'=====');
99
+ this.checkOptions = []
100
+ if(Array.isArray(this.defaultValue)) {
101
+ if (this.multiple){
102
+ let val = []
103
+ this.defaultValue.forEach(item=>{
104
+ item.forEach(items=>{
105
+ val.push(items)
106
+ })
107
+ })
108
+ this.checkIdList = [...val]
109
+ }
110
+ else {
111
+ this.checkIdList = [...this.defaultValue]
112
+ }
113
+
114
+ this.checkIdList.forEach(item =>{
115
+ if (Array.isArray(item)){
116
+ item.forEach(items=>{
117
+
118
+ this.options.forEach(res =>{
119
+ console.debug('items',items,res[this.props.value])
120
+ if(items == res[this.props.value]) {
121
+ this.checkOptions.push(res)
122
+ }
123
+ })
124
+ })
125
+ }
126
+ else {
127
+ this.options.forEach(res =>{
128
+ if(item == res[this.props.value]) {
129
+ this.checkOptions.push(res)
130
+ }
131
+ })
132
+ }
133
+
134
+ })
101
135
  }
136
+ console.debug('checkOptions',this.checkOptions)
102
137
  },
103
138
  deep: true,
104
139
  immediate: true
@@ -126,21 +161,28 @@ export default {
126
161
  this.checkOptions = []
127
162
  this.checkIdList = []
128
163
  }
129
- }
164
+ },
130
165
  },
131
-
166
+ mounted() {
167
+ console.debug('options',this.options)
168
+
169
+ }
132
170
  }
133
171
  </script>
134
172
 
135
173
  <style lang="less" scoped>
136
174
  .popup-content {
137
175
  /*padding-top: 8px;*/
176
+ height: 240px;
177
+ overflow-y: scroll;
178
+ overflow-x: hidden;
138
179
  .filter-item {
139
180
  width: 100%;
140
181
  display: flex;
141
182
  align-items: center;
142
183
  justify-content: center;
143
184
  height: 48px;
185
+ cursor: pointer;
144
186
  .setColor {
145
187
  color: #366aff;
146
188
  }
@@ -164,9 +206,11 @@ export default {
164
206
  padding: 0 20px;
165
207
  .cancel {
166
208
  color: #606266;
209
+ cursor:pointer;
167
210
  }
168
211
  .sure {
169
212
  color: #366aff;
213
+ cursor: pointer;
170
214
  }
171
215
  }
172
216
  .popup-footer {
@@ -31,7 +31,10 @@ export default {
31
31
  name: "tree",
32
32
  data(){
33
33
  return{
34
- defaultProps:{},
34
+ defaultProps:{
35
+ label:"label",
36
+ value:"value"
37
+ },
35
38
  checked:'',
36
39
  dataTree:[],
37
40
  checkList:[],
@@ -51,19 +54,23 @@ export default {
51
54
  },
52
55
  ergodicData(list){
53
56
  list.forEach(item=>{
54
- if (item.checked){
55
- let data = this.$refs.dataTree.getNode(item)
56
- let checkList = []
57
- let arr = this.serchParent(data,checkList)
58
- this.checkList.push(arr)
59
- this.checkDatas.push(item)
57
+ if (this.dataOptions.extInfo.selectType === '多选'){
58
+ if (item.checked){
59
+ let data = this.$refs.dataTree.getNode(item)
60
+ let checkList = []
61
+ let arr = this.serchParent(data,checkList)
62
+ this.checkList.push(arr)
63
+ this.checkDatas.push(item)
64
+ }
60
65
  }
61
- if (item.value === this.checked){
62
- let data = this.$refs.dataTree.getNode(item)
63
- let checkList = []
64
- let arr = this.serchParent(data,checkList)
65
- this.checkList = arr
66
- this.checkDatas = [item]
66
+ else {
67
+ if (item.value === this.checked){
68
+ let data = this.$refs.dataTree.getNode(item)
69
+ let checkList = []
70
+ let arr = this.serchParent(data,checkList)
71
+ this.checkList = arr
72
+ this.checkDatas = [item]
73
+ }
67
74
  }
68
75
  if (item.children){
69
76
  this.ergodicData(item.children)
@@ -92,6 +99,7 @@ export default {
92
99
  else if (this.dataOptions.extInfo.cascadeDown && this.dataOptions.extInfo.cascadeDown[0]){
93
100
  this.dataTree = this.dataOptions.extInfo.cascadeDown[0].options
94
101
  }
102
+ console.debug('dataTree',this.dataTree)
95
103
  }
96
104
  };
97
105
  </script>
@@ -115,9 +123,11 @@ export default {
115
123
  padding-bottom: 30px;
116
124
  .primary{
117
125
  color: #366aff;
126
+ cursor: pointer;
118
127
  }
119
128
  .cacel{
120
129
  color: #969799;
130
+ cursor: pointer;
121
131
  }
122
132
  }
123
133
  .tree-container{