doway-coms 1.9.4 → 1.9.5

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": "doway-coms",
3
- "version": "1.9.4",
3
+ "version": "1.9.5",
4
4
  "description": "doway组件库",
5
5
  "author": "dowaysoft",
6
6
  "main": "packages/index.js",
@@ -297,6 +297,7 @@
297
297
  :showSearch="col.showSearch"
298
298
  :allowClear="col.allowClear"
299
299
  :placeholder="col.placeholder"
300
+ :linkedTitle="col.linkedTitle"
300
301
  :method="col.method"
301
302
  v-model="row[col.field]"
302
303
  @change="
@@ -65,6 +65,7 @@
65
65
  <script>
66
66
  import { Tooltip, TreeSelect } from 'ant-design-vue'
67
67
  import request from '../../utils/request'
68
+ import XEUtils from 'xe-utils'
68
69
  import { ValidationProvider } from 'vee-validate'
69
70
  export default {
70
71
  name: 'BaseTreeSelect',
@@ -235,6 +236,12 @@ export default {
235
236
  type: String,
236
237
  required: true,
237
238
  },
239
+ linkedTitle: {
240
+ type: [],
241
+ default: function () {
242
+ return []
243
+ },
244
+ },
238
245
  method: {
239
246
  type: String,
240
247
  default: function () {
@@ -251,7 +258,21 @@ export default {
251
258
  },
252
259
  mounted() {
253
260
  // this.searchData()
254
- this.currentValue = this.row[this.linkedField]
261
+
262
+ if (this.treeData.length) {
263
+ this.currentValue = this.row[this.linkedField]
264
+ } else {
265
+ this.currentValue = this.value
266
+ }
267
+ },
268
+ watch: {
269
+ treeData(val) {
270
+ if (this.treeData.length) {
271
+ this.currentValue = this.row[this.linkedField]
272
+ } else {
273
+ this.currentValue = this.value
274
+ }
275
+ },
255
276
  },
256
277
  computed: {},
257
278
  methods: {
@@ -292,6 +313,15 @@ export default {
292
313
  })
293
314
  .then((responseData) => {
294
315
  vm.treeData = responseData.content
316
+ if (this.linkedTitle.length) {
317
+ XEUtils.eachTree(vm.treeData, (item) => {
318
+ let title = ''
319
+ XEUtils.arrayEach(this.linkedTitle, (newTitle) => {
320
+ title = title + item[newTitle] + '-'
321
+ })
322
+ item[this.replaceFields.title] = title.slice(0, -1)
323
+ })
324
+ }
295
325
  })
296
326
  .catch((error) => {
297
327
  console.error(error)