imatrix-ui 2.8.39-dw → 2.8.39-pvtmp

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.
Files changed (189) hide show
  1. package/lib/super-ui.css +1 -1
  2. package/lib/super-ui.umd.min.js +5 -35
  3. package/package.json +6 -4
  4. package/packages/breadcrumb/index.js +6 -0
  5. package/packages/breadcrumb/src/breadcrumb.vue +71 -0
  6. package/packages/department-tree/index.js +6 -0
  7. package/packages/department-tree/src/department-tree.vue +108 -0
  8. package/packages/department-tree-inline/index.js +6 -0
  9. package/packages/department-tree-inline/src/department-multi-tree-inline.vue +411 -0
  10. package/packages/department-tree-inline/src/department-single-tree-inline.vue +293 -0
  11. package/packages/department-tree-inline/src/department-tree-inline.vue +86 -0
  12. package/packages/department-tree-inline/src/department-tree-service.js +275 -0
  13. package/packages/department-tree-inline/src/search-result.vue +176 -0
  14. package/packages/department-user-tree/index.js +6 -0
  15. package/packages/department-user-tree/src/department-user-multiple-tree.vue +116 -0
  16. package/packages/department-user-tree/src/department-user-single-tree.vue +76 -0
  17. package/packages/department-user-tree/src/department-user-tree.vue +101 -0
  18. package/packages/department-user-tree-inline/index.js +6 -0
  19. package/packages/department-user-tree-inline/src/department-user-multiple-tree-inline.vue +639 -0
  20. package/packages/department-user-tree-inline/src/department-user-single-tree-inline.vue +274 -0
  21. package/packages/department-user-tree-inline/src/department-user-tree-inline.vue +79 -0
  22. package/packages/department-user-tree-inline/src/department-user-tree-multi-service.js +248 -0
  23. package/packages/department-user-tree-inline/src/department-user-tree-single-service.js +142 -0
  24. package/packages/department-user-tree-inline/src/search-result.vue +197 -0
  25. package/packages/directives/prevent-reclick.js +19 -0
  26. package/packages/dynamic-source-select/index.js +6 -0
  27. package/packages/dynamic-source-select/src/dynamic-source-select-service.js +75 -0
  28. package/packages/dynamic-source-select/src/dynamic-source-select.vue +586 -0
  29. package/packages/dynamic-source-select/src/events.js +55 -0
  30. package/packages/fs-preview/index.js +6 -0
  31. package/packages/fs-preview/src/fs-preview.vue +226 -0
  32. package/packages/fs-upload/index.js +6 -0
  33. package/packages/fs-upload/src/fs-upload-multi.vue +420 -0
  34. package/packages/fs-upload/src/fs-upload-single.vue +312 -0
  35. package/packages/fs-upload/src/fs-upload.vue +189 -0
  36. package/packages/fs-upload/src/see-big-picture.vue +55 -0
  37. package/packages/fs-upload-list/index.js +6 -0
  38. package/packages/fs-upload-list/src/fs-upload-list.vue +287 -0
  39. package/packages/hamburger/index.js +6 -0
  40. package/packages/hamburger/src/hamburger.vue +38 -0
  41. package/packages/index.js +121 -0
  42. package/packages/multipart-upload/index.js +6 -0
  43. package/packages/multipart-upload/src/index.vue +73 -0
  44. package/packages/multipart-upload/src/multipart-upload-form.vue +297 -0
  45. package/packages/multipart-upload/src/multipart-upload-list.vue +378 -0
  46. package/packages/organization-input/index.js +6 -0
  47. package/packages/organization-input/src/organization-input.vue +542 -0
  48. package/packages/plugins/export-data-new.js +468 -0
  49. package/packages/plugins/export-data.js +361 -0
  50. package/packages/plugins/index.js +15 -0
  51. package/packages/plugins/public-method.js +43 -0
  52. package/packages/remove-department/index.js +6 -0
  53. package/packages/remove-department/src/remove-department.vue +172 -0
  54. package/packages/remove-department/src/remove-dept-service.js +20 -0
  55. package/packages/remove-user/index.js +6 -0
  56. package/packages/remove-user/src/remove-user-service.js +20 -0
  57. package/packages/remove-user/src/remove-user.vue +195 -0
  58. package/packages/remove-workgroup/index.js +6 -0
  59. package/packages/remove-workgroup/src/remove-workgroup-service.js +20 -0
  60. package/packages/remove-workgroup/src/remove-workgroup.vue +159 -0
  61. package/packages/rich-editor/index.js +7 -0
  62. package/packages/rich-editor/index.vue +278 -0
  63. package/packages/rich-editor/langs/zh-Hans.js +1 -0
  64. package/packages/rich-editor/viewer.vue +103 -0
  65. package/packages/scan-code-input/index.js +6 -0
  66. package/packages/scan-code-input/src/events.js +33 -0
  67. package/packages/scan-code-input/src/scan-code-input-colse.vue +131 -0
  68. package/packages/scan-code-input/src/scan-code-input.vue +116 -0
  69. package/packages/secret-info/index.js +7 -0
  70. package/packages/secret-info/index.vue +90 -0
  71. package/packages/super-grid/index.js +7 -0
  72. package/packages/super-grid/src/apis.js +825 -0
  73. package/packages/super-grid/src/columns-config.vue +335 -0
  74. package/packages/super-grid/src/custom-formatter.js +280 -0
  75. package/packages/super-grid/src/dynamic-input.vue +1286 -0
  76. package/packages/super-grid/src/eventBus.js +2 -0
  77. package/packages/super-grid/src/events.js +55 -0
  78. package/packages/super-grid/src/formValidatorUtil.js +226 -0
  79. package/packages/super-grid/src/formatter.js +181 -0
  80. package/packages/super-grid/src/group-column.vue +100 -0
  81. package/packages/super-grid/src/header-context-menu.vue +87 -0
  82. package/packages/super-grid/src/index-column.vue +51 -0
  83. package/packages/super-grid/src/normal-column.vue +775 -0
  84. package/packages/super-grid/src/public-methods.js +31 -0
  85. package/packages/super-grid/src/row-operation.vue +161 -0
  86. package/packages/super-grid/src/search-button.vue +66 -0
  87. package/packages/super-grid/src/search-condition-input.vue +61 -0
  88. package/packages/super-grid/src/search-condition-list.vue +59 -0
  89. package/packages/super-grid/src/search-form-advancedQuery.vue +654 -0
  90. package/packages/super-grid/src/search-form-dialog.vue +79 -0
  91. package/packages/super-grid/src/search-form-item.vue +405 -0
  92. package/packages/super-grid/src/search-form-number.vue +38 -0
  93. package/packages/super-grid/src/search-form-open.vue +170 -0
  94. package/packages/super-grid/src/search-form-ordinarySearch.vue +196 -0
  95. package/packages/super-grid/src/search-form.vue +642 -0
  96. package/packages/super-grid/src/search-methods.js +448 -0
  97. package/packages/super-grid/src/selection-column.vue +43 -0
  98. package/packages/super-grid/src/store.js +3 -0
  99. package/packages/super-grid/src/super-grid-service.js +595 -0
  100. package/packages/super-grid/src/super-grid.vue +2936 -0
  101. package/packages/super-grid/src/utils.js +782 -0
  102. package/packages/super-grid/src/view-image-dialog.vue +130 -0
  103. package/packages/super-nine-grid/index.js +7 -0
  104. package/packages/super-nine-grid/src/apis.js +103 -0
  105. package/packages/super-nine-grid/src/custom-formatter.js +66 -0
  106. package/packages/super-nine-grid/src/formatter.js +131 -0
  107. package/packages/super-nine-grid/src/search-form-number.vue +38 -0
  108. package/packages/super-nine-grid/src/search-form.vue +430 -0
  109. package/packages/super-nine-grid/src/search-methods.js +134 -0
  110. package/packages/super-nine-grid/src/store.js +3 -0
  111. package/packages/super-nine-grid/src/super-grid-service.js +93 -0
  112. package/packages/super-nine-grid/src/super-nine-grid.vue +883 -0
  113. package/packages/super-nine-grid/src/utils.js +261 -0
  114. package/packages/svg-icon/index.js +6 -0
  115. package/packages/svg-icon/src/svg-icon.vue +43 -0
  116. package/packages/utils/memory-cache-utils.js +90 -0
  117. package/packages/utils/utils.js +152 -0
  118. package/packages/utils/value-set.js +86 -0
  119. package/packages/valid-code/index.js +7 -0
  120. package/packages/valid-code/src/valid-code.vue +95 -0
  121. package/packages/workflow-button/index.js +6 -0
  122. package/packages/workflow-button/src/workflow-button.vue +325 -0
  123. package/packages/workflow-history-list/index.js +6 -0
  124. package/packages/workflow-history-list/src/api.js +7 -0
  125. package/packages/workflow-history-list/src/workflow-history-list.vue +197 -0
  126. package/packages/workgroup-tree/index.js +6 -0
  127. package/packages/workgroup-tree/src/workgroup-tree.vue +77 -0
  128. package/packages/workgroup-tree-inline/index.js +6 -0
  129. package/packages/workgroup-tree-inline/src/search-result.vue +168 -0
  130. package/packages/workgroup-tree-inline/src/workgroup-tree-inline.vue +458 -0
  131. package/packages/workgroup-tree-inline/src/workgroup-tree-service.js +71 -0
  132. package/packages/workgroup-user-tree/index.js +6 -0
  133. package/packages/workgroup-user-tree/src/workgroup-user-tree.vue +100 -0
  134. package/packages/workgroup-user-tree-inline/index.js +6 -0
  135. package/packages/workgroup-user-tree-inline/src/search-result.vue +197 -0
  136. package/packages/workgroup-user-tree-inline/src/workgroup-tree-inline-service.js +192 -0
  137. package/packages/workgroup-user-tree-inline/src/workgroup-user-tree-inline.vue +584 -0
  138. package/packages/year-range-picker/index.js +6 -0
  139. package/packages/year-range-picker/src/year-range-picker.vue +51 -0
  140. package/src/api/sso-service.js +9 -1
  141. package/src/api/tab.js +3 -3
  142. package/src/i18n/i18n.js +1 -1
  143. package/src/i18n/langs/cn.js +15 -5
  144. package/src/i18n/langs/en.js +15 -5
  145. package/src/index.js +93 -0
  146. package/src/permission.js +51 -17
  147. package/src/plugins.js +3 -3
  148. package/src/store/getters.js +2 -1
  149. package/src/store/modules/app.js +10 -1
  150. package/src/store/modules/user.js +11 -18
  151. package/src/styles/display-layout.scss +34 -0
  152. package/src/styles/index.scss +32 -4
  153. package/src/styles/theme/dark-blue/button.scss +9 -0
  154. package/src/styles/theme/dark-blue/card.scss +64 -0
  155. package/src/styles/theme/dark-blue/checkbox.scss +10 -0
  156. package/src/styles/theme/dark-blue/dark-blue-var.scss +8 -0
  157. package/src/styles/theme/dark-blue/dialog.scss +21 -0
  158. package/src/styles/theme/dark-blue/element-variables.scss +7 -0
  159. package/src/styles/theme/dark-blue/font.scss +71 -0
  160. package/src/styles/theme/dark-blue/form.scss +51 -0
  161. package/src/styles/theme/dark-blue/index.scss +247 -0
  162. package/src/styles/theme/dark-blue/input.scss +15 -0
  163. package/src/styles/theme/dark-blue/pagination.scss +14 -0
  164. package/src/styles/theme/dark-blue/scrollbar-style.scss +32 -0
  165. package/src/styles/theme/dark-blue/sidebar.scss +296 -0
  166. package/src/styles/theme/dark-blue/tab.scss +83 -0
  167. package/src/styles/theme/dark-blue/table.scss +60 -0
  168. package/src/styles/theme/dark-blue/tree.scss +31 -0
  169. package/src/styles/theme/dark-blue/var.scss +1028 -0
  170. package/src/styles/theme/gray/input-style.scss +8 -0
  171. package/src/styles/theme/gray/sidebar.scss +14 -2
  172. package/src/utils/auth-api.js +171 -0
  173. package/src/utils/auth.js +75 -41
  174. package/src/utils/calculator/calculator-factory.js +2 -2
  175. package/src/utils/calculator/calculator-util.js +7 -7
  176. package/src/utils/common-util.js +134 -1
  177. package/src/utils/jump-page-utils.js +36 -10
  178. package/src/utils/menu.js +19 -0
  179. package/src/utils/permission.js +4 -0
  180. package/src/utils/permissionAuth.js +46 -25
  181. package/src/utils/request.js +65 -8
  182. package/src/utils/util.js +77 -29
  183. package/src/views/dsc-component/Sidebar/Item.vue +5 -5
  184. package/src/views/dsc-component/Sidebar/Link.vue +11 -2
  185. package/src/views/dsc-component/Sidebar/SidebarItem.vue +37 -21
  186. package/src/views/dsc-component/Sidebar/index.vue +24 -12
  187. package/src/views/dsc-component/tabs/tab-content.vue +18 -2
  188. package/src/views/layout/components/Breadcrumb/index.vue +1 -1
  189. package/src/views/login/index.vue +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imatrix-ui",
3
- "version": "2.8.39-dw",
3
+ "version": "2.8.39-pvtmp",
4
4
  "description": "前端组件库:表格、表单、组织结构树等",
5
5
  "main": "lib/super-ui.umd.min.js",
6
6
  "private": false,
@@ -13,9 +13,11 @@
13
13
  "test:unit": "vue-cli-service test:unit"
14
14
  },
15
15
  "dependencies": {
16
+ "@tinymce/tinymce-vue": "^3.2.4",
16
17
  "@zxing/library": "^0.19.1",
17
18
  "js-cookie": "^2.2.0",
18
- "sortablejs": "1.10.2"
19
+ "sortablejs": "1.10.2",
20
+ "tinymce": "^5.6.1"
19
21
  },
20
22
  "devDependencies": {
21
23
  "@vue/cli-plugin-babel": "3.8.0",
@@ -32,9 +34,9 @@
32
34
  "element-ui": "2.15.3",
33
35
  "eslint": "5.16.0",
34
36
  "eslint-plugin-vue": "5.2.2",
35
- "node-sass": "4.12.0",
36
37
  "nprogress": "^0.2.0",
37
- "sass-loader": "^7.1.0",
38
+ "sass": "^1.49.8",
39
+ "sass-loader": "^10.0.2",
38
40
  "sessionstorage": "^0.1.0",
39
41
  "vue": "^2.6.10",
40
42
  "vue-cli-plugin-element": "^1.0.1",
@@ -0,0 +1,6 @@
1
+ import Breadcrumb from './src/breadcrumb.vue'
2
+ Breadcrumb.install = function(Vue) {
3
+ Vue.component(Breadcrumb.name, Breadcrumb)
4
+ }
5
+
6
+ export default Breadcrumb
@@ -0,0 +1,71 @@
1
+ <template>
2
+ <el-breadcrumb class="app-breadcrumb" separator="/">
3
+ <transition-group name="breadcrumb">
4
+ <el-breadcrumb-item v-for="(item,index) in levelListWithTitle" :key="item.path">
5
+ <span v-if="item.redirect==='noredirect'||index==levelList.length-1" class="no-redirect">
6
+ {{ item.meta.title }}
7
+ </span>
8
+ <router-link v-else :to="item.redirect||item.path">
9
+ {{ item.meta.title }}
10
+ </router-link>
11
+ </el-breadcrumb-item>
12
+ </transition-group>
13
+ </el-breadcrumb>
14
+ </template>
15
+
16
+ <script>
17
+ import pathToRegexp from 'path-to-regexp'
18
+
19
+ export default {
20
+ name: 'Breadcrumb',
21
+ data() {
22
+ return {
23
+ levelList: null
24
+ }
25
+ },
26
+ computed: {
27
+ levelListWithTitle() {
28
+ return this.levelList.filter(item => item.meta.title !== undefined && item.meta.title !== null)
29
+ }
30
+ },
31
+ watch: {
32
+ $route() {
33
+ this.getBreadcrumb()
34
+ }
35
+ },
36
+ created() {
37
+ this.getBreadcrumb()
38
+ },
39
+ methods: {
40
+ getBreadcrumb() {
41
+ const { params } = this.$route
42
+ let matched = this.$route.matched.filter(item => {
43
+ if (item.name) {
44
+ // To solve this problem https://github.com/PanJiaChen/vue-element-admin/issues/561
45
+ var toPath = pathToRegexp.compile(item.path)
46
+ item.path = toPath(params)
47
+ return true
48
+ }
49
+ })
50
+ const first = matched[0]
51
+ if (first && first.name !== 'Dashboard') {
52
+ matched = [{ path: '/dashboard', meta: { title: 'Dashboard' }}].concat(matched)
53
+ }
54
+ this.levelList = matched
55
+ }
56
+ }
57
+ }
58
+ </script>
59
+
60
+ <style rel="stylesheet/scss" lang="scss" scoped>
61
+ .app-breadcrumb.el-breadcrumb {
62
+ display: inline-block;
63
+ font-size: 14px;
64
+ line-height: 50px;
65
+ margin-left: 10px;
66
+ .no-redirect {
67
+ color: #97a8be;
68
+ cursor: text;
69
+ }
70
+ }
71
+ </style>
@@ -0,0 +1,6 @@
1
+ import DepartmentTree from './src/department-tree.vue'
2
+ DepartmentTree.install = function(Vue) {
3
+ Vue.component(DepartmentTree.name, DepartmentTree)
4
+ }
5
+
6
+ export default DepartmentTree
@@ -0,0 +1,108 @@
1
+ <template>
2
+ <div>
3
+ <el-dialog
4
+ class="user-tree"
5
+ visible
6
+ :title="myTitle"
7
+ :close-on-click-modal="false"
8
+ append-to-body
9
+ :width="multiple?'50%':'30%'"
10
+ @open="$emit('open')"
11
+ @opend="$emit('opend')"
12
+ @close="$emit('close')"
13
+ @closed="$emit('closed')"
14
+ >
15
+ <inline-department-tree
16
+ ref="inlineDeparmentTree"
17
+ :check-strictly="checkStrictly"
18
+ :multiple="multiple"
19
+ :height="height"
20
+ :department-info="departmentInfo"
21
+ :select-department-info="selectDepartmentInfo"
22
+ :search-field="searchField"
23
+ :separator="separator"
24
+ @result="result"
25
+ />
26
+ <div slot="footer" class="dialog-footer">
27
+ <el-button size="small" @click="$emit('close')">
28
+ {{ $t('imatrixUIPublicModel.cancel') }}
29
+ </el-button>
30
+ <el-button size="small" type="primary" @click="selectDepartment">
31
+ {{ $t('imatrixUIPublicModel.sure') }}
32
+ </el-button>
33
+ </div>
34
+ </el-dialog>
35
+ </div>
36
+ </template>
37
+ <script>
38
+ import InlineDepartmentTree from '../../department-tree-inline/src/department-tree-inline.vue'
39
+ export default {
40
+ name: 'DepartmentTree',
41
+ components: {
42
+ InlineDepartmentTree
43
+ },
44
+ props: {
45
+ // 是否是多选树,默认是true
46
+ multiple: {
47
+ type: Boolean,
48
+ default: true
49
+ },
50
+ checkStrictly: {
51
+ type: Boolean,
52
+ default: false
53
+ },
54
+ // 显示指定部门节点及其子节点,不传该属性,表示显示整个组织结构树
55
+ departmentInfo: {
56
+ type: Array,
57
+ default: null
58
+ },
59
+ // 弹框的标题
60
+ title: {
61
+ type: String,
62
+ default: null
63
+ },
64
+ // 弹框的宽度
65
+ width: {
66
+ type: String,
67
+ default: '30%'
68
+ },
69
+ // 弹框的高度
70
+ height: {
71
+ type: String,
72
+ default: '300px'
73
+ },
74
+ // 多选部门树时,已选择部门id或部门名称或编码集合,多个之间以逗号隔开
75
+ selectDepartmentInfo: {
76
+ type: [String, Number],
77
+ default: null
78
+ },
79
+ // 移除部门时,部门属性名称:id、name、code,默认是id
80
+ searchField: {
81
+ type: String,
82
+ default: 'id'
83
+ },
84
+ // 多选树时结果之间的分隔符,默认是逗号分隔
85
+ separator: {
86
+ type: String,
87
+ default: ','
88
+ }
89
+ },
90
+ data() {
91
+ let myTitle = this.$t('imatrixUIMessage.pleaseSelectDepartment')
92
+ if (this.title) {
93
+ myTitle = this.title
94
+ }
95
+ return {
96
+ myTitle
97
+ }
98
+ },
99
+ methods: {
100
+ result(selectNodeInfo) {
101
+ this.$emit('close', selectNodeInfo)
102
+ },
103
+ selectDepartment() {
104
+ this.$refs.inlineDeparmentTree.selectDepartment()
105
+ }
106
+ }
107
+ }
108
+ </script>
@@ -0,0 +1,6 @@
1
+ import InlineDepartmentTree from './src/department-tree-inline.vue'
2
+ InlineDepartmentTree.install = function(Vue) {
3
+ Vue.component(InlineDepartmentTree.name, InlineDepartmentTree)
4
+ }
5
+
6
+ export default InlineDepartmentTree
@@ -0,0 +1,411 @@
1
+ <template>
2
+ <div>
3
+ <el-container style="height: 395px">
4
+ <el-aside width="350px">
5
+ <el-container style="height: 390px">
6
+ <el-header style="text-align: right; font-size: 12px;height: 35px">
7
+ <el-autocomplete
8
+ v-model="filterText"
9
+ size="small"
10
+ class="inline-input inline-input-custom"
11
+ :fetch-suggestions="querySearch"
12
+ :placeholder="$t('departmentTreeInline.pleaseEnterDepartmentName')"
13
+ @keyup.enter.native="clickSearch"
14
+ @select="handleSelect"
15
+ >
16
+ <el-button slot="append" icon="el-icon-search" @click="clickSearch" />
17
+ </el-autocomplete>
18
+ </el-header>
19
+ <el-main style="padding: 10px">
20
+ <div v-if="!searchValue" style="padding-top:5px;overflow:auto;width: auto;display: inline-block !important;">
21
+ <el-tree
22
+ ref="deparmentTree"
23
+ :props="defaultProps"
24
+ :load="loadNode"
25
+ lazy
26
+ :show-checkbox="true"
27
+ node-key="id"
28
+ check-strictly
29
+ :render-content="renderContent"
30
+ :filter-node-method="filterNode"
31
+ @check-change="handleCheckChange"
32
+ @node-expand="handleNodeExpand"
33
+ @check="handleCheckNode"
34
+ @node-click="handleNodeClick"
35
+ />
36
+ </div>
37
+
38
+ <div v-if="searchValue && searchValue.length > 0" style="height:100%;overflow: hidden;">
39
+ <user-result :grid-data="searchResult" :select-result="selectResult" :height="height" :multiple="true" :is-search-result="true" @addUser="selectUser" />
40
+ </div>
41
+ </el-main>
42
+ </el-container>
43
+ </el-aside>
44
+
45
+ <el-container>
46
+ <el-aside width="2px">
47
+ <table border="1px" cellpadding="0" cellspacing="0" style="height:100%;border-left-style:solid; border-bottom-style:none;border-right-style:none;border-top-style:none;border-left-color: #cccccc" />
48
+ </el-aside>
49
+ <el-main style="padding: 10px">
50
+ <div style="text-align:left;font-size:16px">
51
+ {{ $t('departmentTreeInline.selectedDept') }}:
52
+ </div>
53
+ <div :style="'padding-top: 5px;height:90%;overflow: hidden;'">
54
+ <user-result v-loading="isloading" :grid-data="selectResult" :height="height" :multiple="true" :is-search-result="false" @removeUser="removeUser" />
55
+ </div>
56
+ </el-main>
57
+ </el-container>
58
+ </el-container>
59
+ </div>
60
+ </template>
61
+ <style>
62
+ .searchResult {
63
+ color:red
64
+ }
65
+ .inline-input-custom {
66
+ width : 90%
67
+ }
68
+ .el-autocomplete-suggestion.el-popper {
69
+ min-width: 300px;
70
+ }
71
+ </style>
72
+
73
+ <script>
74
+ import localStorage from '../../../src/utils/local-storage'
75
+ import utils from '../../utils/utils'
76
+ import departmentTreeService from './department-tree-service'
77
+ import UserResult from './search-result.vue'
78
+ import memoryCacheUtils from '../../utils/memory-cache-utils'
79
+ export default {
80
+ name: 'InlineDepartmentMultiTree',
81
+ components: {
82
+ UserResult
83
+ },
84
+ props: {
85
+ checkStrictly: {
86
+ type: Boolean,
87
+ default: false
88
+ },
89
+ // 显示指定部门节点及其子节点,不传该属性,表示显示整个组织结构树
90
+ departmentInfo: {
91
+ type: Array,
92
+ default: null
93
+ },
94
+ // 弹框的高度
95
+ height: {
96
+ type: String,
97
+ default: '300px'
98
+ },
99
+ // 多选部门树时,已选择部门id或部门名称或编码集合,多个之间以逗号隔开
100
+ selectDepartmentInfo: {
101
+ type: [String, Number],
102
+ default: null
103
+ },
104
+ // 移除部门时,部门属性名称:id、name、code,默认是id
105
+ searchField: {
106
+ type: String,
107
+ default: 'id'
108
+ },
109
+ // 多选树时结果之间的分隔符,默认是逗号分隔
110
+ separator: {
111
+ type: String,
112
+ default: ','
113
+ }
114
+ },
115
+ data() {
116
+ return {
117
+ filterText: '',
118
+ defaultProps: {
119
+ id: 'id',
120
+ label: 'showName',
121
+ children: 'childDepartments',
122
+ isLeaf: 'leaf'
123
+ },
124
+ searchParam: {
125
+ searchValue: null,
126
+ treeType: 'DEPARTMENT_TREE',
127
+ departmentInfo: null
128
+ },
129
+ count: 0,
130
+ containBranch: false, // 当前租户内是否包含分支机构。获得当前选中部门名称时,如果有分支,则需要将分支名称返回给用户,例如:部门1(分支1)
131
+ tenantNodeId: -1, // 公司节点的id
132
+ allSearchNodeIds: [], // 用于保存所有查询出的节点id
133
+ allExpandNodeIds: [], // 用于保存allSearchNodeIds中所有已加载子节点的id集合
134
+ isClickNode: false,
135
+ restaurants: [], // 查询的备选值
136
+ searchValue: null, // 查询条件
137
+ searchStoreKey: 'searchDepartment',
138
+ selectNodeInfo: null, // 单选时,选择的部门信息
139
+ tenantInfo: {}, // 公司根节点信息
140
+ searchResult: [],
141
+ selectResult: [],
142
+ isloading: false, // 控制右侧选择区的loading状态
143
+ multiple: true,
144
+ memoryCacheKey: 'DEPARTMENT_MEMORY_KEY',
145
+ memoryCacheData: [] // 记忆选择数据, 搜索框获得焦点后,下拉显示最近选中的10个人,倒序排列,最后选中的在最上面显示。
146
+ }
147
+ },
148
+ computed: {
149
+ },
150
+ watch: {
151
+ filterText(val) {
152
+ if (!val) {
153
+ this.searchValue = val
154
+ // 清空查询内容时,重新加载整个树
155
+ if (this.departmentInfo && this.departmentInfo.length > 0) {
156
+ // 加载指定部门时,展开公司节点
157
+ this.loadPointDepartments()
158
+ } else {
159
+ // 加载整个组织结构树时,展开公司节点
160
+ this.loadDepartment(this.tenantNodeId)
161
+ }
162
+ }
163
+ }
164
+ },
165
+ created() {
166
+ this.initSelectDepts(this.searchField, this.selectDepartmentInfo, this.separator).then(selectUsers => {
167
+ if (selectUsers) {
168
+ this.selectResult = selectUsers
169
+ }
170
+ })
171
+ },
172
+ mounted() {
173
+ var searchDepartment = localStorage.getObject(this.searchStoreKey)
174
+ if (searchDepartment) {
175
+ this.restaurants = searchDepartment
176
+ } else {
177
+ this.restaurants = []
178
+ }
179
+ this.getMemoryCacheData('department')
180
+ },
181
+ methods: {
182
+ ...utils,
183
+ ...departmentTreeService,
184
+ ...memoryCacheUtils,
185
+ filterNode(value, data, node) {
186
+ if (!value) {
187
+ return true
188
+ } else {
189
+ return data.name.indexOf(value) !== -1
190
+ }
191
+ },
192
+ // 选中当前节点及其子节点
193
+ checkedNodeAndChildren(data) {
194
+ // 取消选中状态时,保持节点是展开的状态,不要折叠
195
+ // this.$refs.deparmentTree.store.nodesMap[data.id].expanded = true
196
+ let department = data
197
+ if (data.data) {
198
+ department = JSON.parse(data.data)
199
+ }
200
+ this.selectUser(null, department)
201
+ // 获得所有应该选中的节点
202
+ this.$refs.deparmentTree.setChecked(data.id, true)
203
+ const childDepartments = data.childDepartments
204
+ if (childDepartments && !this.checkStrictly) {
205
+ // 递归设置子子节点的选中状态
206
+ childDepartments.forEach(nodeData => {
207
+ this.checkedNodeAndChildren(nodeData)
208
+ })
209
+ }
210
+ },
211
+ // 取消当前节点的子节点的选中状态
212
+ cancelChildCheckedNodes(data) {
213
+ const department = JSON.parse(data.data)
214
+ this.selectResult = this.removeRow(this.selectResult, department)
215
+ if (data.id !== this.tenantNodeId) {
216
+ // 如果当前节点不是公司节点,需要将公司节点的选中状态去掉
217
+ this.$refs.deparmentTree.setChecked(this.tenantNodeId, false)
218
+ }
219
+ const childDepartments = data.childDepartments
220
+ if (childDepartments && !this.checkStrictly) {
221
+ childDepartments.forEach(nodeData => {
222
+ // 取消节点的选中状态
223
+ this.$refs.deparmentTree.setChecked(nodeData.id, false)
224
+ // 递归取消子子节点的选中状态
225
+ this.cancelChildCheckedNodes(nodeData)
226
+ })
227
+ }
228
+ },
229
+ handleCheckChange(data, checked, indeterminate) {
230
+
231
+ },
232
+ handleNodeExpand(data, node, nodeTree) {
233
+ },
234
+ handleNodeClick(data, node, nodeTree) {
235
+ // 多选部门树时,处理点击节点事件
236
+ this.clickNodeWhenMultiple(data)
237
+ },
238
+ // 多选树时,点击节点处理复选框的选中状态
239
+ clickNodeWhenMultiple(data) {
240
+ var checkedKeys = []
241
+ if (this.$refs.deparmentTree) {
242
+ checkedKeys = this.$refs.deparmentTree.getCheckedKeys()
243
+ }
244
+ if (checkedKeys && checkedKeys.indexOf(data.id) > -1) {
245
+ // 表示当前节点是选中状态,则需要取消其选中状态
246
+ // 取消当前节点的勾选状态
247
+ this.$refs.deparmentTree.setChecked(data.id, false)
248
+ // 取消当前节点的子节点的勾选状态
249
+ if (!this.checkStrictly) {
250
+ this.cancelChildCheckedNodes(data)
251
+ }
252
+ // 取消选中状态时,保持节点是展开的状态,不要折叠
253
+ this.$refs.deparmentTree.store.nodesMap[data.id].expanded = true
254
+ } else {
255
+ // 表示当前节点不是选中的状态,需要勾选该节点
256
+ if (data.nodeType && data.nodeType === 'DEPARTMENT' && data.data) {
257
+ // 表示当前选中的节点是部门
258
+ const department = JSON.parse(data.data)
259
+ this.selectUser(null, department)
260
+ }
261
+ this.$refs.deparmentTree.setChecked(data.id, true)
262
+ // 点击树节点时添加并展开节点会走loadNode方法,因为设置了树组件的expand-on-click-node属性为true
263
+ const children = data.childDepartments
264
+ if (children && children.length > 0) {
265
+ // 表示加载过该节点,直接选中即可
266
+ if (!this.checkStrictly) {
267
+ this.checkedNodeAndChildren(data)
268
+ }
269
+ } else {
270
+ // 表示没有加载过该节点,是首次加载,需要走后台
271
+ // 会走loadNode方法,因为设置了树组件的expand-on-click-node属性为true
272
+ this.isClickNode = true
273
+ }
274
+ }
275
+ },
276
+ isDepartmentNode(data) {
277
+ // 当前节点不是公司节点,也不是分支机构节点,表示是部门节点
278
+ return data.id !== this.tenantNodeId && data.nodeType && data.nodeType === 'DEPARTMENT' && !data.branch
279
+ },
280
+ selectDepartment() {
281
+ // 是否需要显示提示框,默认不显示
282
+ var showTip = false
283
+ var leafSelectNodeInfo = {
284
+ ids: [],
285
+ names: [],
286
+ codes: [],
287
+ zhNames: [],
288
+ enNames: [],
289
+ departments: []
290
+ }
291
+ if (this.selectResult.length === 0) {
292
+ // 没有选择任何节点
293
+ showTip = true
294
+ } else {
295
+ for (var i = 0; i < this.selectResult.length; i++) {
296
+ var userData = this.selectResult[i]
297
+ // 不存在该用户则放到结果集合中,去掉重复使用
298
+ leafSelectNodeInfo.ids.push(userData.id)
299
+ leafSelectNodeInfo.codes.push(userData.code)
300
+ if (userData.enName) {
301
+ leafSelectNodeInfo.enNames.push(userData.enName)
302
+ } else {
303
+ leafSelectNodeInfo.enNames.push('')
304
+ }
305
+ if (userData.department) {
306
+ leafSelectNodeInfo.departments.push(userData.department)
307
+ } else {
308
+ leafSelectNodeInfo.departments.push(userData)
309
+ }
310
+ const name = userData.showName
311
+ leafSelectNodeInfo.names.push(name)
312
+ leafSelectNodeInfo.zhNames.push(userData.name)
313
+ }
314
+ }
315
+ if (leafSelectNodeInfo.ids.length > 0) {
316
+ leafSelectNodeInfo.containBranch = this.containBranch
317
+ this.$emit('result', leafSelectNodeInfo)
318
+ } else {
319
+ showTip = true
320
+ }
321
+ if (showTip) {
322
+ this.$alert(this.$t('imatrixUIMessage.pleaseSelectDepartment'), this.$t('imatrixUIMessage.tips'), {
323
+ confirmButtonText: this.$t('imatrixUIPublicModel.sure')
324
+ })
325
+ }
326
+ },
327
+ // 是否选中了公司节点
328
+ isSelectTenantNode(dataId) {
329
+ return dataId === this.tenantNodeId && (!this.departmentInfo || this.departmentInfo.length === 0)
330
+ },
331
+ // 给节点添加自定义图标
332
+ renderContent(h, { node, data, store }) {
333
+ var className
334
+ if (node.data.id === -1 || node.data.branch) {
335
+ // node.id ===-1表示公司节点,node.branch表示是分支机构节点
336
+ className = 'el-icon-menu'
337
+ } else if (node.data.id === -2 || node.data.id === -3) {
338
+ // node.id ===-2表示集团公司无部门用户节点,node.id ===-3表示是分支机构无部门用户节点
339
+ className = 'el-icon-tickets'
340
+ } else {
341
+ // 表示是部门节点
342
+ className = 'el-icon-date'
343
+ }
344
+ return (
345
+ <span>
346
+ <i class={className}></i>
347
+ <span title={node.label}>{node.label}</span>
348
+ </span>
349
+ )
350
+ },
351
+ // 将查询结果中指定用户添加到已选择用户集合中
352
+ selectUser(index, dept) {
353
+ // if (!this.isContainAllUser()) {
354
+ const containUsers = this.selectResult.filter(this.filterDept(dept))
355
+ if (containUsers && containUsers.length === 0) {
356
+ // 如果已选结果中不包含当前用户,则添加
357
+ // 将查询结果中的用户复制到已选择用户集合中
358
+ dept.tenantCode = this.tenantInfo.code
359
+ dept.tenantName = this.tenantInfo.tenantName
360
+ this.selectResult.push(dept)
361
+ // 搜索选中记忆
362
+ this.setMemoryCacheData(dept, 'department')
363
+ }
364
+ // } else {
365
+ // this.alertByAllUser()
366
+ // }
367
+ },
368
+ // 判断用户是否存在的过滤器
369
+ filterDept(queryDept) {
370
+ return (dept) => {
371
+ return (dept.id === queryDept.id)
372
+ }
373
+ },
374
+ filterDeptNode(queryDept) {
375
+ return (deptNodeId) => {
376
+ return (deptNodeId + '' === queryDept.id + '')
377
+ }
378
+ },
379
+ // 从已选择用户集合中移除指定用户,并添加到查询结果集合中
380
+ removeUser(index, dept) {
381
+ // 表示是在组织结构树页面,需要将树的人员节点的选中状态去掉
382
+ if (dept.nodeId) {
383
+ const nodeId = dept.nodeId
384
+ if (this.$refs.deparmentTree && nodeId) {
385
+ this.$refs.deparmentTree.setChecked(nodeId, false)
386
+ }
387
+ } else {
388
+ if (this.$refs.deparmentTree) {
389
+ // 通过查询结果添加的用户,在返回到组织结构树时,也选中了该用户,在移除该用户时,需要去掉复选框的选中状态
390
+ const checkedKeys = this.$refs.deparmentTree.getCheckedKeys()
391
+ const currentCheckedUserNodeIds = checkedKeys.filter(this.filterDeptNode(dept))
392
+ if (currentCheckedUserNodeIds.length > 0) {
393
+ // 表示当前用户是选中的状态,需要去掉
394
+ currentCheckedUserNodeIds.forEach(userNodeId => {
395
+ this.$refs.deparmentTree.setChecked(userNodeId, false)
396
+ })
397
+ }
398
+ }
399
+ }
400
+ this.selectResult = this.removeRow(this.selectResult, dept)
401
+ if (!this.selectResult || this.selectResult.length === 0) {
402
+ // 已选结果面板没有内容,则左侧树节点也不要有选中节点了
403
+ if (this.$refs.deparmentTree) {
404
+ this.$refs.deparmentTree.setCheckedKeys([])
405
+ }
406
+ }
407
+ }
408
+
409
+ }
410
+ }
411
+ </script>