audit-picker-users-by-group.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template>
  2. <div>
  3. <a-card :class="$style.tree" bordered size="small">
  4. <a-input-search slot="title" v-model="searchValue" placeholder="搜索" @search="onSearch" />
  5. <a-checkbox slot="extra" v-model="isContainSub">含下级</a-checkbox>
  6. <AuditGroupTree
  7. :root-node="rootNode"
  8. :hierarchical="hierarchical"
  9. @update:selectedKeys="handleTreeSelect"
  10. />
  11. </a-card>
  12. <sd-picker-source-lazy-list
  13. v-if="key"
  14. :key="listKey + isContainSub"
  15. v-bind="$attrs"
  16. :load-list-data="() => loadListData()"
  17. :show-search="false"
  18. v-on="$listeners"
  19. />
  20. </div>
  21. </template>
  22. <script>
  23. import AddressBook from '@/addressbook/group-user-service'
  24. import AuditGroupTree from './audit-group-tree.vue'
  25. import components from './_import-components/audit-picker-users-by-group-import'
  26. export default {
  27. name: 'AuditPickerUsersByGroup',
  28. metaInfo: {},
  29. components: {
  30. ...components,
  31. AuditGroupTree,
  32. },
  33. inheritAttrs: false,
  34. props: {
  35. title: {
  36. type: String,
  37. default: '',
  38. },
  39. icon: {
  40. type: String,
  41. default: '',
  42. },
  43. rootNode: {
  44. type: [Object, Array],
  45. default: undefined,
  46. },
  47. hierarchical: {
  48. type: Boolean,
  49. default: undefined,
  50. },
  51. secretLevel: {
  52. type: String,
  53. default: '',
  54. },
  55. },
  56. data() {
  57. return {
  58. key: '',
  59. isContainSub: false,
  60. searchValue: '',
  61. listKey: '',
  62. }
  63. },
  64. methods: {
  65. handleTreeSelect(key) {
  66. this.key = key[0]
  67. this.listKey = this.key
  68. this.searchValue = ''
  69. },
  70. loadListData() {
  71. if (this.searchValue) {
  72. return AddressBook.usersQuery(this.searchValue, [], {
  73. secretLevel: this.secretLevel,
  74. hierarchical: this.hierarchical,
  75. })
  76. }
  77. if (this.key) {
  78. return AddressBook.getChildNodes(this.key, {
  79. type: 'U',
  80. isContainSub: this.isContainSub,
  81. secretLevel: this.secretLevel,
  82. hierarchical: this.hierarchical,
  83. })
  84. }
  85. },
  86. onSearch() {
  87. this.listKey = this.searchValue
  88. },
  89. },
  90. }
  91. </script>
  92. <style module lang="scss">
  93. @use '@/common/design' as *;
  94. .tree {
  95. position: absolute;
  96. top: -41px;
  97. left: -285px;
  98. width: 275px;
  99. height: calc(100% + 42px);
  100. :global(.ant-card-body) {
  101. height: calc(100% - 42px);
  102. padding: 0;
  103. > div {
  104. height: 100%;
  105. overflow: auto;
  106. }
  107. }
  108. :global(.ant-card-head > .ant-card-head-wrapper > .ant-card-head-title) {
  109. padding: 0;
  110. margin-right: 4px;
  111. }
  112. }
  113. </style>