vsyswin-ui 0.2.84 → 0.2.85

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": "vsyswin-ui",
3
- "version": "0.2.84",
3
+ "version": "0.2.85",
4
4
  "main": "lib/vsyswin-ui.umd.min.js",
5
5
  "private": false,
6
6
  "description": "Vue2.x的应用组件库.",
@@ -123,6 +123,12 @@
123
123
  <el-option v-for="opt in item.options" :key="opt.id" :label="opt.label" :value="opt.value"></el-option>
124
124
  </el-select>
125
125
  </template>
126
+ <template v-else-if="item.type === 'cascade'">
127
+ <span class="syswin-filter-item__name" v-if="item.name && !item.hideName">{{ item.name }}</span>
128
+ <el-cascader size="small" v-model="item.value" :placeholder="`请选择${item.name}`" :style="{
129
+ width: item.width ? item.width : '200px'
130
+ }" :options="item.options" :props="{ multiple: !!item.multiple, checkStrictly: !!item.checkStrictly }" collapse-tags clearable @change="handleChangeDateragne(idx, index)"></el-cascader>
131
+ </template>
126
132
  <template v-else-if="item.type === 'slot'">
127
133
  <slot :name="item.slot" :item="item">内容为空</slot>
128
134
  </template>
@@ -230,6 +236,12 @@
230
236
  <el-option v-for="opt in item.options" :key="opt.id" :label="opt.label" :value="opt.value"></el-option>
231
237
  </el-select>
232
238
  </template>
239
+ <template v-else-if="item.type === 'cascade'">
240
+ <span class="syswin-filter-item__name" v-if="item.name && !item.hideName">{{ item.name }}</span>
241
+ <el-cascader size="small" v-model="item.value" :placeholder="`请选择${item.name}`" :style="{
242
+ width: item.width ? item.width : '200px'
243
+ }" :options="item.options" :props="{ multiple: !!item.multiple, checkStrictly: !!item.checkStrictly }" collapse-tags clearable @change="handleChangeDateragne(idx, index)"></el-cascader>
244
+ </template>
233
245
  <template v-else-if="item.type === 'slot'">
234
246
  <slot :name="item.slot" :item="item">内容为空</slot>
235
247
  </template>
@@ -324,6 +336,12 @@
324
336
  <el-option v-for="opt in item.options" :key="opt.id" :label="opt.label" :value="opt.value"></el-option>
325
337
  </el-select>
326
338
  </template>
339
+ <template v-else-if="item.type === 'cascade'">
340
+ <span class="syswin-filter-item__name" v-if="item.name && !item.hideName">{{ item.name }}</span>
341
+ <el-cascader size="small" v-model="item.value" :placeholder="`请选择${item.name}`" :style="{
342
+ width: item.width ? item.width : '200px'
343
+ }" :options="item.options" :props="{ multiple: !!item.multiple, checkStrictly: !!item.checkStrictly }" collapse-tags clearable @change="handleChangeDateragne(idx, index + maxConditionLength)"></el-cascader>
344
+ </template>
327
345
  <template v-else-if="item.type === 'slot'">
328
346
  <slot :name="item.slot" :item="item">内容为空</slot>
329
347
  </template>
@@ -371,6 +389,7 @@
371
389
  import _ from 'lodash'
372
390
  import moment from 'moment'
373
391
  import saveLocal from './save-local'
392
+ import XEUtils from 'xe-utils'
374
393
 
375
394
  function deepCopyFunction(arr1, arr2) {
376
395
  for (let i = 0; i < arr1.length; i++) {
@@ -601,6 +620,25 @@ export default {
601
620
  } else {
602
621
  obj.name = item.options.find((x) => x.value === item.value).label
603
622
  }
623
+ } else if (item.type === 'cascade') {
624
+ if (!item.value) return
625
+ if (item.multiple) {
626
+ if (!item.value.length) {
627
+ return
628
+ }
629
+ // const valueOptions = item.value.map((x) => item.options.find((f) => f.value === x))
630
+ const valueOptions = item.value.map((x) => {
631
+ // console.log('xxxxxxxxxxxxx', x) // 这里的x是个数组
632
+ const lastValue = x[x.length - 1]
633
+ const find = XEUtils.findTree(item.options, tItem => tItem.value === lastValue)
634
+ return find
635
+ })
636
+ obj.name = valueOptions.map((x) => x.nodes.map(y => y.label).join('/')).join(',')
637
+ } else {
638
+ const lastValue = item.value[item.value.length - 1]
639
+ const find = XEUtils.findTree(item.options, tItem => tItem.value === lastValue)
640
+ obj.name = find.nodes.map(y => y.label).join('/')
641
+ }
604
642
  } else if (item.type === 'slot') {
605
643
  if (!item.getValue) return
606
644
  const info = item.getValue() // 这里不能直接调,因为是深拷贝过来的
@@ -687,6 +725,9 @@ export default {
687
725
  if (item.type === 'select') {
688
726
  item.value = item.multiple ? [] : null
689
727
  }
728
+ if (item.type === 'cascade') {
729
+ item.value = item.multiple ? [] : null
730
+ }
690
731
  if (item.type === 'slot') {
691
732
  item.setValue({ name: '', value: '' })
692
733
  }
@@ -719,6 +760,9 @@ export default {
719
760
  if (item.type === 'select') {
720
761
  item.value = item.multiple ? [] : null
721
762
  }
763
+ if (item.type === 'cascade') {
764
+ item.value = item.multiple ? [] : null
765
+ }
722
766
  if (item.type === 'slot') {
723
767
  item.setValue({ name: '', value: '' })
724
768
  }
@@ -758,6 +802,13 @@ export default {
758
802
  item.value = null
759
803
  }
760
804
  }
805
+ if (item.type === 'cascade') {
806
+ if (item.multiple) {
807
+ item.value = []
808
+ } else {
809
+ item.value = null
810
+ }
811
+ }
761
812
  item.type === 'slot' && item.setValue({ value: '', name: '' })
762
813
  })
763
814
  })
@@ -840,6 +891,9 @@ export default {
840
891
  if (item.type === 'select') {
841
892
  item.value = item.multiple ? [] : null
842
893
  }
894
+ if (item.type === 'cascade') {
895
+ item.value = item.multiple ? [] : null
896
+ }
843
897
  }
844
898
  })
845
899
  this.$set(this.currentSearchList, parentIndex, parentItem)
@@ -920,6 +974,9 @@ export default {
920
974
  v.value = ele.value
921
975
  }
922
976
  if (ele.value) v.isActive = true
977
+ } else if (v.type === 'cascade') {
978
+ v.value = ele.value
979
+ if (ele.value) v.isActive = true
923
980
  } else if (v.type === 'month' || v.type === 'year') {
924
981
  v.value = ele.value
925
982
  if (ele.value) v.isActive = true