doway-coms 1.9.4 → 1.9.6
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
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
:replaceFields="replaceFields"
|
|
35
35
|
:dropdownMatchSelectWidth="dropdownMatchSelectWidth"
|
|
36
36
|
:treeDefaultExpandAll="treeDefaultExpandAll"
|
|
37
|
+
@change="changeData"
|
|
37
38
|
:size="size"
|
|
38
39
|
:allowClear="allowClear"
|
|
39
40
|
@focus="searchData"
|
|
@@ -65,6 +66,7 @@
|
|
|
65
66
|
<script>
|
|
66
67
|
import { Tooltip, TreeSelect } from 'ant-design-vue'
|
|
67
68
|
import request from '../../utils/request'
|
|
69
|
+
import XEUtils from 'xe-utils'
|
|
68
70
|
import { ValidationProvider } from 'vee-validate'
|
|
69
71
|
export default {
|
|
70
72
|
name: 'BaseTreeSelect',
|
|
@@ -235,6 +237,12 @@ export default {
|
|
|
235
237
|
type: String,
|
|
236
238
|
required: true,
|
|
237
239
|
},
|
|
240
|
+
linkedTitle: {
|
|
241
|
+
type: [],
|
|
242
|
+
default: function () {
|
|
243
|
+
return []
|
|
244
|
+
},
|
|
245
|
+
},
|
|
238
246
|
method: {
|
|
239
247
|
type: String,
|
|
240
248
|
default: function () {
|
|
@@ -251,7 +259,21 @@ export default {
|
|
|
251
259
|
},
|
|
252
260
|
mounted() {
|
|
253
261
|
// this.searchData()
|
|
254
|
-
|
|
262
|
+
|
|
263
|
+
if (this.treeData.length) {
|
|
264
|
+
this.currentValue = this.row[this.linkedField]
|
|
265
|
+
} else {
|
|
266
|
+
this.currentValue = this.value
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
watch: {
|
|
270
|
+
treeData(val) {
|
|
271
|
+
if (this.treeData.length) {
|
|
272
|
+
this.currentValue = this.row[this.linkedField]
|
|
273
|
+
} else {
|
|
274
|
+
this.currentValue = this.value
|
|
275
|
+
}
|
|
276
|
+
},
|
|
255
277
|
},
|
|
256
278
|
computed: {},
|
|
257
279
|
methods: {
|
|
@@ -259,6 +281,7 @@ export default {
|
|
|
259
281
|
* 查询数据
|
|
260
282
|
*/
|
|
261
283
|
searchData() {
|
|
284
|
+
console.log(this.$refs.treeSelectView)
|
|
262
285
|
let tempExp = {
|
|
263
286
|
operator: 'or',
|
|
264
287
|
expressions: [],
|
|
@@ -292,6 +315,15 @@ export default {
|
|
|
292
315
|
})
|
|
293
316
|
.then((responseData) => {
|
|
294
317
|
vm.treeData = responseData.content
|
|
318
|
+
if (this.linkedTitle.length) {
|
|
319
|
+
XEUtils.eachTree(vm.treeData, (item) => {
|
|
320
|
+
let title = ''
|
|
321
|
+
XEUtils.arrayEach(this.linkedTitle, (newTitle) => {
|
|
322
|
+
title = title + item[newTitle] + '-'
|
|
323
|
+
})
|
|
324
|
+
item[this.replaceFields.title] = title.slice(0, -1)
|
|
325
|
+
})
|
|
326
|
+
}
|
|
295
327
|
})
|
|
296
328
|
.catch((error) => {
|
|
297
329
|
console.error(error)
|
|
@@ -327,6 +359,12 @@ export default {
|
|
|
327
359
|
this.$set(this.row, this.linkedField, value)
|
|
328
360
|
this.$set(this.row, this.field, node.title)
|
|
329
361
|
},
|
|
362
|
+
changeData(value) {
|
|
363
|
+
if (!value) {
|
|
364
|
+
this.$set(this.row, this.linkedField, '')
|
|
365
|
+
this.$set(this.row, this.field, '')
|
|
366
|
+
}
|
|
367
|
+
},
|
|
330
368
|
},
|
|
331
369
|
}
|
|
332
370
|
</script>
|