uni-data-pickerview.uvue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <view class="uni-data-pickerview">
  3. <view v-if="error!=null" class="error">
  4. <text class="error-text">{{error!.errMsg}}</text>
  5. </view>
  6. <scroll-view v-if="!isCloudDataList" :scroll-x="true">
  7. <view class="selected-node-list">
  8. <template v-for="(item, index) in selectedNodes">
  9. <text class="selected-node-item" :class="{'selected-node-item-active':index==selectedIndex}"
  10. @click="onTabSelect(index)">
  11. {{item[mappingTextName]}}
  12. </text>
  13. </template>
  14. </view>
  15. </scroll-view>
  16. <list-view class="list-view" :scroll-y="true">
  17. <list-item class="list-item" v-for="(item, _) in currentDataList" @click="onNodeClick(item)">
  18. <text class="item-text" :class="{'item-text-disabled': item['disable']}">{{item[mappingTextName]}}</text>
  19. <text class="check" v-if="item[mappingValueName] == selectedNodes[selectedIndex][mappingValueName]"></text>
  20. </list-item>
  21. </list-view>
  22. <view class="loading-cover" v-if="loading">
  23. <slot name="pickerview-loading" :loading="loading"></slot>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. import { dataPicker } from "./uni-data-picker.uts"
  29. /**
  30. * DataPickerview
  31. * @description uni-data-pickerview
  32. * @tutorial https://ext.dcloud.net.cn/plugin?id=3796
  33. * @property {Array} localdata 本地数据,参考
  34. * @property {Boolean} step-searh = [true|false] 是否分布查询
  35. * @value true 启用分布查询,仅查询当前选中节点
  36. * @value false 关闭分布查询,一次查询出所有数据
  37. * @property {String|DBFieldString} self-field 分布查询当前字段名称
  38. * @property {String|DBFieldString} parent-field 分布查询父字段名称
  39. * @property {String|DBCollectionString} collection 表名
  40. * @property {String|DBFieldString} field 查询字段,多个字段用 `,` 分割
  41. * @property {String} orderby 排序字段及正序倒叙设置
  42. * @property {String|JQLString} where 查询条件
  43. */
  44. export default {
  45. name: 'UniDataPickerView',
  46. emits: ['nodeclick', 'change', 'update:modelValue'],
  47. mixins: [dataPicker],
  48. props: {
  49. ellipsis: {
  50. type: Boolean,
  51. default: true
  52. }
  53. },
  54. created() {
  55. this.loadData()
  56. },
  57. methods: {
  58. onFinish() {
  59. this.$emit('change', this.getChangeNodes())
  60. }
  61. }
  62. }
  63. </script>
  64. <style>
  65. @import url("uni-data-pickerview.css");
  66. </style>