ic-measure-picker.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <template>
  2. <!-- :load-tree-data="loadTreeData"
  3. :module-id="treeparams.moduleId" -->
  4. <icTreePicker
  5. :is-abandonment="isAbandonment"
  6. v-bind="pickerMixinProps"
  7. :load-tree-data="loadTreeData"
  8. :selectclick="selectclick"
  9. :default-expanded-keys="defaultExpandedKeys"
  10. :selecttype="selecttype"
  11. :types="types"
  12. :org-id="orgId"
  13. :version-id="versionId"
  14. option-value="code"
  15. option-label="text"
  16. :search-tree-data="searchTreeData"
  17. :render="(item, direction) => renderItem(item, direction)"
  18. v-on="$listeners"
  19. ><a-icon v-if="!readOnly" slot="suffixIcon" type="apartment" />
  20. </icTreePicker>
  21. </template>
  22. <script>
  23. // import AddressBook from '@/addressbook/group-user-service'
  24. // import auditPermissionTreeService from '../audit-permission-tree-service'
  25. import icTreeService from './ic-tree-service'
  26. import icTreePicker from './ic-tree-picker.vue'
  27. import pickerMixin from './picker-mixin'
  28. import components from './_import-components/ic-measure-picker-import'
  29. /**
  30. * 组织选择器
  31. * @displayName icMeasurPicker 组织选择器
  32. */
  33. export default {
  34. name: 'IcMeasurPicker',
  35. components: {
  36. ...components,
  37. icTreePicker,
  38. },
  39. mixins: [pickerMixin],
  40. props: {
  41. selectall: {
  42. type: Boolean,
  43. default: false,
  44. },
  45. selectclick: {
  46. type: Function,
  47. default: null,
  48. },
  49. /**
  50. * 根节点{code:'200000',name:'西安分公司'}
  51. */
  52. rootNode: {
  53. type: [Object, Array],
  54. default: undefined,
  55. },
  56. /**
  57. * 默认展开的节点['200000']
  58. */
  59. defaultExpandedKeys: {
  60. type: Array,
  61. default: undefined,
  62. },
  63. /**
  64. * 当开启分级授权时,是否过滤掉启用分级授权的子公司,true时过滤,false时不过滤
  65. *
  66. */
  67. hierarchical: {
  68. type: Boolean,
  69. default: undefined,
  70. },
  71. // 地址树接口数据源
  72. treeparams: {
  73. type: Object,
  74. default: () => {
  75. return {}
  76. },
  77. },
  78. // 根节点名称
  79. topNodeText: {
  80. type: String,
  81. default: '审计机构',
  82. },
  83. // 根节点ID
  84. topNodeId: {
  85. type: String,
  86. default: '0',
  87. },
  88. // 事项选择器
  89. versionId: {
  90. type: String,
  91. default: '',
  92. },
  93. orgId: {
  94. type: String,
  95. default: '',
  96. },
  97. orgName: {
  98. type: String,
  99. default: '',
  100. },
  101. selecttype: {
  102. type: String,
  103. default: 'control',
  104. },
  105. types: {
  106. type: String,
  107. default: 'NK',
  108. },
  109. isAbandonment: {
  110. type: String,
  111. default: 'NO',
  112. },
  113. },
  114. data() {
  115. return {
  116. defaultTopNodeId: -1,
  117. // defaultTopNodeText: '风控库',
  118. }
  119. },
  120. methods: {
  121. loadTreeData(depId) {
  122. const params = {
  123. auditOrgId: parseInt(this.orgId),
  124. versionId: parseInt(this.versionId),
  125. }
  126. this.defaultTopNodeText = this.orgName
  127. const getdata = new Promise((resolve) => {
  128. icTreeService.getCategoryTree(this.defaultTopNodeId, params, this.types).then((res1) => {
  129. this.spinning = false
  130. res1.data.forEach((item) => {
  131. item.code = item.id.toString()
  132. item.cat = true
  133. item.isLeaf = false
  134. })
  135. const treeNode = [
  136. {
  137. id: this.defaultTopNodeId,
  138. text: this.defaultTopNodeText,
  139. code: this.defaultTopNodeId.toString(),
  140. isLeaf: false,
  141. props: {
  142. isroot: true,
  143. },
  144. children: res1.data,
  145. key: this.defaultTopNodeId.toString(),
  146. cat: true,
  147. },
  148. ]
  149. resolve(treeNode)
  150. })
  151. })
  152. return getdata
  153. },
  154. searchTreeData(searchValue) {
  155. if (searchValue) {
  156. }
  157. },
  158. renderItem(item, direction) {
  159. let name = item.name
  160. if (name === undefined) {
  161. name = item.text
  162. }
  163. if (name.indexOf('/') > -1) {
  164. return <span title={name}>{name.split('/').pop()}</span>
  165. } else {
  166. return <span title={name}>{name}</span>
  167. }
  168. },
  169. },
  170. }
  171. </script>
  172. <style module lang="scss">
  173. @use '@/common/design' as *;
  174. </style>