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
@@ -0,0 +1,586 @@
1
+ <template>
2
+ <span class="select-top-span">
3
+ <el-select
4
+ v-if="isLoaded"
5
+ ref="dynamicDataSourceRef"
6
+ :value="value"
7
+ v-bind="myProps"
8
+ :remote="remote"
9
+ :remote-method="remoteMethod"
10
+ :value-key="valueAttribute"
11
+ :loading="loading"
12
+ :reserve-keyword="true"
13
+ filterable
14
+ clearable
15
+ style="width:100%;height:100%"
16
+ @input="inputValue"
17
+ @change="change"
18
+ @visible-change="visibleChange"
19
+ @remove-tag="removeTag(remote,$event)"
20
+ @clear="clear"
21
+ @blur="blurEvent($event)"
22
+ @focus="focus"
23
+ >
24
+ <el-option
25
+ v-for="item in optionItems"
26
+ :key="item.value"
27
+ :label="item._label_"
28
+ :value="item[valueAttribute]"
29
+ />
30
+ </el-select>
31
+ </span>
32
+ </template>
33
+ <style>
34
+ .select-top-span {
35
+ width: 100%;
36
+ }
37
+ </style>
38
+ <script>
39
+ import dynamicSourceSelectService from './dynamic-source-select-service'
40
+ import events from './events'
41
+ import {
42
+ setEntityFieldValue,
43
+ getPropNameWhenJoinTable,
44
+ getEntityFieldValue
45
+ } from '../../../src/utils/util'
46
+ export default {
47
+ name: 'DynamicSourceSelect',
48
+ components: {},
49
+ model: {
50
+ prop: 'value',
51
+ event: 'input'
52
+ },
53
+ props: {
54
+ // 字段配置
55
+ column: {
56
+ type: Object,
57
+ default: null
58
+ },
59
+ value: {
60
+ type: [String, Boolean, Number, Array],
61
+ default: null
62
+ },
63
+ baseProps: {
64
+ type: Object,
65
+ default: null
66
+ },
67
+ entity: {
68
+ type: Object,
69
+ default: null
70
+ },
71
+ // dynamicDataSourceCode、valueSetOptions、isSql(默认是false,在配置系统中使用时需要是true)、additionalParameter( json字符串)
72
+ options: {
73
+ type: Object,
74
+ default: null
75
+ },
76
+ // 列表组件行编辑使用,sql查询时数据表名称,用于自定义系统中列表组件中字段多表查询带有别名时,将点"."改成两个下划线"__"时使用
77
+ tableName: {
78
+ type: String,
79
+ default: null
80
+ },
81
+ // 列表组件行编辑使用,是否是关联表,用于确定属性名是否需要拼接tableName
82
+ isJoinTable: {
83
+ type: Boolean,
84
+ default: false
85
+ },
86
+ // 子表行编辑时,父表单数据
87
+ parent: {
88
+ type: Object,
89
+ default: null
90
+ },
91
+ // 所在的列表编码
92
+ listCode: {
93
+ type: String,
94
+ default: null
95
+ },
96
+ // 所在的表单编码
97
+ formCode: {
98
+ type: String,
99
+ default: null
100
+ }
101
+ },
102
+ data() {
103
+ const myProps = Object.assign({}, this.baseProps)
104
+ let markValue
105
+ if (this.entity) {
106
+ markValue = JSON.stringify(this.entity)
107
+ }
108
+ let lastValues = []
109
+ if (this.baseProps.multiple !== undefined && this.baseProps.multiple === true) {
110
+ if (this.value !== undefined && this.value !== null && this.value && Array.isArray(this.value)) {
111
+ lastValues = JSON.parse(JSON.stringify(this.value))
112
+ }
113
+ }
114
+ return {
115
+ /**
116
+ * 用于回显动态数据源选择的默认值,因为初始进入编辑状态时,没有获取映射关系,
117
+ * 如果当前字段是保存的label值则无法确定当前选项组的值对应哪一个,导致row中的对应字段变成了空值,所以备份一份
118
+ * 然后在获取动态数据源选项组后,给上默认值
119
+ */
120
+ markValue,
121
+ optionItems: [],
122
+ myProps,
123
+ valueSetOptions: [], // 字段映射集合配置
124
+ dynamicDataSourceCode: '', // 动态数据源编码
125
+ loading: false, // 是否在加载
126
+ valueAttribute: null, // 选项值字段,即控制下拉框组件的value-key属性的
127
+ remote: false, // 是否是远程搜索
128
+ additionalParameterStr: this.options.additionalParameter, // 附加参数json字符串
129
+ isLoaded: false,
130
+ watchAttr: null, // 监控的entity属性名,多个属性名逗号分隔。即当该属性修改时,需要走后台重新获得当前下拉选的选项集合
131
+ backendUrl: null, // 后台访问路径
132
+ lastValues // 最后一次的value值,用于判断是否是增加元素
133
+ }
134
+ },
135
+ watch: {
136
+ baseProps: {
137
+ deep: true,
138
+ handler(newModels) {
139
+ this.myProps = Object.assign({}, newModels)
140
+ }
141
+ }
142
+ },
143
+ created() {
144
+ if (this.options && this.options.dynamicDataSourceCode) {
145
+ this.dynamicDataSourceCode = this.options.dynamicDataSourceCode.trim()
146
+ const param = {
147
+ _listCode: this.listCode,
148
+ _formCode: this.formCode,
149
+ _tableName: this.tableName
150
+ }
151
+ if (this.parent) {
152
+ param.parent = this.parent
153
+ }
154
+ this.packageDynamicDataSourceInfo(this.dynamicDataSourceCode, param)
155
+ .then(dynamicDataSourceDto => {
156
+ if (dynamicDataSourceDto.backendUrl) {
157
+ this.backendUrl = dynamicDataSourceDto.backendUrl
158
+ }
159
+ if (
160
+ dynamicDataSourceDto.fuzzyQuery !== undefined &&
161
+ dynamicDataSourceDto.fuzzyQuery === true
162
+ ) {
163
+ // 是否启用远程搜索
164
+ this.remote = true
165
+ }
166
+ if (this.options && this.options.valueSetOptions) {
167
+ this.valueSetOptions = this.options.valueSetOptions
168
+ }
169
+ if (
170
+ this.options &&
171
+ this.options.isSql !== undefined &&
172
+ this.options.isSql !== null
173
+ ) {
174
+ this.isSql = this.options.isSql
175
+ }
176
+ if (this.watchAttr) {
177
+ let initWatchValue
178
+ const watchAttrs = this.watchAttr.split(',')
179
+ watchAttrs.forEach((attr) => {
180
+ // 初始化下拉选内容
181
+ if (this.entity) {
182
+ initWatchValue = this.entity[attr]
183
+ }
184
+ this.$watch('entity.' + attr, function(newValue, oldValue) {
185
+ this.watchAttrValueChange(newValue)
186
+ // this.inputValue('')
187
+ const items = this.optionItems.filter(
188
+ item => item[this.valueAttribute] === newValue
189
+ )
190
+ if (!items) {
191
+ this.inputValue('')
192
+ }
193
+ })
194
+ })
195
+ this.watchAttrValueChange(initWatchValue)
196
+ }
197
+ this.isLoaded = true
198
+ // 解决当监控值变化时,数据源重新加载后select输入框中显示的值和下拉中的值不一致问题
199
+ if (this.baseProps.multiple !== undefined && this.baseProps.multiple === true) {
200
+ this.$nextTick(() => {
201
+ this.$refs['dynamicDataSourceRef'].setSelected()
202
+ })
203
+ }
204
+ })
205
+ .catch(error => {
206
+ console.log(error)
207
+ this.isLoaded = true
208
+ })
209
+ } else {
210
+ this.isLoaded = true
211
+ }
212
+ },
213
+ methods: {
214
+ ...dynamicSourceSelectService,
215
+ ...events,
216
+ blurEvent(event) {
217
+ // 解决当监控值变化时,数据源重新加载后select输入框中显示的值和下拉中的值不一致问题
218
+ if (this.baseProps.multiple !== undefined && this.baseProps.multiple === false) {
219
+ this.$nextTick(() => {
220
+ this.$refs['dynamicDataSourceRef'].setSelected()
221
+ })
222
+ }
223
+ this.$emit('blur', event)
224
+ },
225
+ // 必须有该方法,否则无法给字段赋值
226
+ inputValue(newValue) {
227
+ this.$emit('input', newValue)
228
+ if (newValue === null || newValue === undefined || newValue === '') {
229
+ this.remoteQueryMethod(newValue)
230
+ }
231
+ this.setValues(newValue)
232
+ },
233
+ packageDynamicDataSourceInfo(dynamicDataSourceCode, param) {
234
+ return new Promise((resolve, reject) => {
235
+ this.findDynamicDataSourceByCode(
236
+ dynamicDataSourceCode,
237
+ this.entity,
238
+ param,
239
+ this.additionalParameterStr,
240
+ this.backendUrl
241
+ )
242
+ .then(dynamicDataSourceDto => {
243
+ if (dynamicDataSourceDto) {
244
+ if (dynamicDataSourceDto.options) {
245
+ this.optionItems = dynamicDataSourceDto.options
246
+ //
247
+ if (this.column) { // 只有行编辑时处理
248
+ // 设置选项组数据、 选项组值字段、 映射关系
249
+ if (this.column.prop !== dynamicDataSourceDto.valueAttribute) {
250
+ this.$set(this.column, '_dynamic-source-data-' + this.column.prop,
251
+ {
252
+ valueSetOptions: this.options.valueSetOptions,
253
+ optionItems: this.optionItems,
254
+ valueAttribute: dynamicDataSourceDto.valueAttribute
255
+ })
256
+ }
257
+ for (let i = 0; i < this.options.valueSetOptions.length; i++) {
258
+ const valueSetOption = this.options.valueSetOptions[i]
259
+ if (dynamicDataSourceDto.valueAttribute === valueSetOption.columnName) {
260
+ if (this.markValue) {
261
+ const muMarkValue = JSON.parse(this.markValue)
262
+ if (muMarkValue && muMarkValue[valueSetOption.valueColumn.dbColumnName]) {
263
+ let targeValue = muMarkValue[valueSetOption.valueColumn.dbColumnName].split(',')
264
+ if (this.column.componentType === 'select') {
265
+ // 如果是单选
266
+ targeValue = targeValue[0]
267
+ }
268
+ this.$emit('set-value', {
269
+ value: targeValue,
270
+ targetColumnName: this.column.prop,
271
+ options: this.optionItems,
272
+ valueAttribute: this.valueAttribute
273
+ })
274
+ }
275
+ }
276
+ break
277
+ }
278
+ }
279
+ }
280
+ } else {
281
+ this.optionItems = []
282
+ }
283
+ if (dynamicDataSourceDto.valueAttribute) {
284
+ this.valueAttribute = dynamicDataSourceDto.valueAttribute
285
+ }
286
+ this.valueAttribute = this.getValueAttribute()
287
+ this.watchAttr = dynamicDataSourceDto.watchAttr
288
+ resolve(dynamicDataSourceDto)
289
+ } else {
290
+ resolve()
291
+ }
292
+ })
293
+ .catch(error => {
294
+ reject(error)
295
+ })
296
+ })
297
+ },
298
+ // 远程搜索方法
299
+ remoteQuery(searchText, watchAttrValue) {
300
+ if (
301
+ (searchText !== null && searchText !== undefined) ||
302
+ (watchAttrValue !== null && watchAttrValue !== undefined)
303
+ ) {
304
+ const param = {
305
+ _listCode: this.listCode,
306
+ _formCode: this.formCode,
307
+ _tableName: this.tableName }
308
+ if (searchText !== null && searchText !== undefined) {
309
+ param.searchText = searchText
310
+ }
311
+ if (watchAttrValue !== null && watchAttrValue !== undefined) {
312
+ // 监控的属性值改变了远程搜索方法
313
+ if (Object.prototype.toString.apply(watchAttrValue) === '[object Array]') {
314
+ param.watchAttrValue = watchAttrValue.join(',')
315
+ } else {
316
+ param.watchAttrValue = watchAttrValue + ''
317
+ }
318
+ } else if (this.entity) {
319
+ // 搜索时下拉选项的集合
320
+ const watchValue = this.entity[this.watchAttr]
321
+ if (watchValue !== null && watchValue !== undefined) {
322
+ if (Object.prototype.toString.apply(watchValue) === '[object Array]') {
323
+ param.watchAttrValue = watchValue.join(',')
324
+ } else {
325
+ param.watchAttrValue = watchValue + ''
326
+ }
327
+ }
328
+ }
329
+ if (this.parent) {
330
+ param.parent = this.parent
331
+ }
332
+ this.loading = true
333
+ this.packageDynamicDataSourceInfo(this.dynamicDataSourceCode, param)
334
+ .then(dynamicDataSourceDto => {
335
+ // 解决当监控值变化时,数据源重新加载后select输入框中显示的值和下拉中的值不一致问题
336
+ if (this.baseProps.multiple !== undefined && this.baseProps.multiple === true) {
337
+ this.$nextTick(() => {
338
+ this.$refs['dynamicDataSourceRef'].setSelected()
339
+ })
340
+ }
341
+ this.loading = false
342
+ })
343
+ .catch(error => {
344
+ console.log(error)
345
+ this.loading = false
346
+ })
347
+ }
348
+ },
349
+ // 远程搜索方法
350
+ remoteQueryMethod(searchText) {
351
+ if (Array.isArray(this.value)) {
352
+ if (this.value.length === 0) {
353
+ this.remoteQuery(searchText, null)
354
+ }
355
+ } else {
356
+ this.remoteQuery(searchText, null)
357
+ }
358
+ },
359
+ /**
360
+ * 输入框输入查询值时搜索方法,
361
+ * 不使用remoteQueryMethod, 解决输入框第一次输入时可查询,第二次输入时没有触发查询方法问题
362
+ * @param {*} searchText
363
+ */
364
+ remoteMethod(searchText) {
365
+ this.remoteQuery(searchText, null)
366
+ },
367
+ // 监控的属性值改变了远程搜索方法
368
+ watchAttrValueChange(watchAttrValues) {
369
+ this.remoteQuery(null, watchAttrValues)
370
+ },
371
+ getValueAttribute() {
372
+ return !this.valueAttribute || this.valueAttribute === '[label]'
373
+ ? '_label_'
374
+ : this.valueAttribute
375
+ },
376
+ setValues(newValue) {
377
+ if (this.valueSetOptions && this.valueSetOptions.length > 0) {
378
+ if (this.baseProps.multiple !== undefined && this.baseProps.multiple === true) {
379
+ // 多选时
380
+ this.setColumnValueWhenMulti(newValue)
381
+ } else {
382
+ // 单选时
383
+ this.valueSetOptions.forEach(columnInfo => {
384
+ const sourceColumnName = columnInfo.columnName
385
+ let value
386
+ if (this.optionItems && sourceColumnName) {
387
+ value = this.getTargetColumnValue(newValue, sourceColumnName)
388
+ }
389
+ this.setColumnValue(sourceColumnName, value, columnInfo)
390
+ })
391
+ }
392
+ }
393
+ },
394
+ // 设置字段的值
395
+ setColumnValue(sourceColumnName, value, columnInfo) {
396
+ let targetColumnName = null
397
+ const targetColumnInfo = columnInfo.valueColumn
398
+ if (targetColumnInfo) {
399
+ targetColumnName = targetColumnInfo.name
400
+ if (this.isSql === true) {
401
+ targetColumnName = targetColumnInfo.dbColumnName
402
+ targetColumnName = getPropNameWhenJoinTable(
403
+ targetColumnName,
404
+ this.isJoinTable,
405
+ this.tableName
406
+ )
407
+ }
408
+ }
409
+ if (
410
+ this.entity &&
411
+ targetColumnName &&
412
+ targetColumnName !== null &&
413
+ targetColumnName !== ''
414
+ ) {
415
+ setEntityFieldValue(this.entity, targetColumnName, value)
416
+ }
417
+ this.$emit('set-value', {
418
+ value: value,
419
+ sourceColumnName: sourceColumnName,
420
+ targetColumnName: targetColumnName,
421
+ options: this.optionItems,
422
+ valueAttribute: this.valueAttribute
423
+ })
424
+ },
425
+ // 多选下拉框时处理增加tag、减少tag时,映射字段赋值问题
426
+ setColumnValueWhenMulti(newValue) {
427
+ // 是否添加tag
428
+ let isAddTag = false
429
+ let removeTag
430
+ this.valueSetOptions.forEach(columnInfo => {
431
+ const sourceColumnName = columnInfo.columnName
432
+ if (sourceColumnName === this.valueAttribute) {
433
+ // 是当前下拉选组件对应的字段时,才需要走该方法
434
+ // 字段的值
435
+ let value
436
+ if (this.optionItems && sourceColumnName) {
437
+ value = this.getTargetColumnValue(newValue, sourceColumnName)
438
+ }
439
+ this.setColumnValue(sourceColumnName, value, columnInfo)
440
+ if (this.lastValues.length < newValue.length) {
441
+ // 表示是增加tag
442
+ isAddTag = true
443
+ } else if (this.lastValues.length > newValue.length) {
444
+ // 表示减少tag
445
+ isAddTag = false
446
+ const totalArr = [...this.lastValues, ...newValue]
447
+ const totalSet = new Set(totalArr)
448
+ const arr = Array.from(totalSet)
449
+ const removeTagArr = [...arr.filter(item => !this.lastValues.includes(item)), ...arr.filter(item => !newValue.includes(item))]
450
+ if (removeTagArr && removeTagArr.length > 0) {
451
+ removeTag = removeTagArr[0]
452
+ }
453
+ }
454
+ this.lastValues = JSON.parse(JSON.stringify(newValue))
455
+ // 跳出forEach循环
456
+ return
457
+ }
458
+ })
459
+ if (isAddTag) {
460
+ // 表示是增加tag
461
+ const isRemove = false
462
+ const lastSelectTag = newValue[newValue.length - 1]
463
+ const items = this.optionItems.filter(
464
+ item => item[this.valueAttribute] === lastSelectTag
465
+ )
466
+ if (items && items.length > 0) {
467
+ this.setTagValue(null, isRemove, items[0])
468
+ }
469
+ } else {
470
+ // 表示是减少tag
471
+ const isRemove = true
472
+ this.setTagValue(removeTag, isRemove)
473
+ }
474
+ },
475
+ // 根据tag参数设置映射字段的值
476
+ setTagValue(tag, isRemove, selectItem) {
477
+ if (this.valueSetOptions && this.valueSetOptions.length > 0) {
478
+ this.valueSetOptions.forEach(columnInfo => {
479
+ const sourceColumnName = columnInfo.columnName
480
+ if (sourceColumnName !== this.valueAttribute) {
481
+ let targetColumnName = null
482
+ const targetColumnInfo = columnInfo.valueColumn
483
+ if (targetColumnInfo) {
484
+ targetColumnName = targetColumnInfo.name
485
+ if (this.isSql === true) {
486
+ targetColumnName = targetColumnInfo.dbColumnName
487
+ targetColumnName = getPropNameWhenJoinTable(
488
+ targetColumnName,
489
+ this.isJoinTable,
490
+ this.tableName
491
+ )
492
+ }
493
+ }
494
+ let value
495
+ if (targetColumnName) {
496
+ const originalValue = getEntityFieldValue(this.entity, targetColumnName)
497
+ if (isRemove) {
498
+ // 移除tag
499
+ const index = this.value.indexOf(tag)
500
+ if (originalValue !== undefined && originalValue !== null && originalValue !== '') {
501
+ const originalVals = originalValue.split(',')
502
+ originalVals.splice(index, 1)
503
+ value = originalVals.join(',')
504
+ }
505
+ } else {
506
+ // 添加tag
507
+ let addValue
508
+ if (selectItem) {
509
+ addValue = selectItem[sourceColumnName]
510
+ }
511
+ if (originalValue !== undefined && originalValue !== null && originalValue !== '') {
512
+ value = originalValue + ',' + addValue
513
+ } else {
514
+ value = addValue
515
+ }
516
+ }
517
+ }
518
+ if (
519
+ this.entity &&
520
+ targetColumnName &&
521
+ targetColumnName !== null &&
522
+ targetColumnName !== ''
523
+ ) {
524
+ setEntityFieldValue(this.entity, targetColumnName, value)
525
+ }
526
+ this.$emit('set-value', {
527
+ value: value,
528
+ sourceColumnName: sourceColumnName,
529
+ targetColumnName: targetColumnName,
530
+ options: this.optionItems,
531
+ valueAttribute: this.valueAttribute
532
+ })
533
+ }
534
+ })
535
+ }
536
+ },
537
+ // 获得目的字段的值
538
+ getTargetColumnValue(newValue, sourceColumnName) {
539
+ if (newValue) {
540
+ let value = ''
541
+ if (
542
+ this.baseProps.multiple !== undefined &&
543
+ this.baseProps.multiple === true &&
544
+ Array.isArray(newValue)
545
+ ) {
546
+ // 多选值处理,数组信息,使用逗号分开的格式设置其它字段的值
547
+ let i = 0
548
+ newValue.forEach(itemValue => {
549
+ const items = this.optionItems.filter(
550
+ item => item[this.valueAttribute] === itemValue
551
+ )
552
+ if (items && items.length > 0) {
553
+ value += items[0][sourceColumnName]
554
+ if (i < newValue.length - 1) {
555
+ // 最后一个元素不加逗号
556
+ value += ','
557
+ }
558
+ i++
559
+ }
560
+ })
561
+ } else {
562
+ // 单选
563
+ const items = this.optionItems.filter(
564
+ item => item[this.valueAttribute] === newValue
565
+ )
566
+ if (items && items.length > 0) {
567
+ value = items[0][sourceColumnName]
568
+ }
569
+ }
570
+ return value
571
+ }
572
+ },
573
+ // 移除所有tag和clear时候清除markValue的值解决清除选项时关联字段清空了但是当前动态数据源控件仍然有值问题
574
+ clearMarkValue() {
575
+ if (this.markValue && this.entity) {
576
+ const muMarkValue = JSON.parse(this.markValue)
577
+ for (let i = 0; i < this.options.valueSetOptions.length; i++) {
578
+ const valueSetOption = this.options.valueSetOptions[i]
579
+ muMarkValue[valueSetOption.valueColumn.dbColumnName] = null
580
+ }
581
+ this.markValue = JSON.stringify(muMarkValue)
582
+ }
583
+ }
584
+ }
585
+ }
586
+ </script>
@@ -0,0 +1,55 @@
1
+ const events = {
2
+ /**
3
+ * 选中值发生变化时触发
4
+ * @param {*} newValue
5
+ */
6
+ change: function(newValue) {
7
+ this.$emit('change', newValue)
8
+ },
9
+ /**
10
+ * 下拉框出现/隐藏时触发
11
+ * @param {*} visible 出现则为 true,隐藏则为 false
12
+ */
13
+ visibleChange: function(visible) {
14
+ this.$emit('visible-change', visible)
15
+ },
16
+ /**
17
+ * 多选模式下移除tag时触发
18
+ * @param {*} remote 是否启用了远程搜索
19
+ * @param {*} tag 移除的tag值
20
+ */
21
+ removeTag: function(remote, tag) {
22
+ this.$emit('remove-tag', tag)
23
+ if (Array.isArray(this.value)) {
24
+ if (this.value.length === 1 && remote) {
25
+ this.clearMarkValue()
26
+ this.remoteQuery('', null)
27
+ }
28
+ }
29
+ },
30
+ /**
31
+ * 可清空的单选模式下用户点击清空按钮时触发
32
+ */
33
+ clear: function() {
34
+ this.clearMarkValue()
35
+ this.$emit('clear')
36
+ },
37
+ /**
38
+ * 当 input 失去焦点时触发
39
+ * @param {*} event
40
+ */
41
+ blur: function(event) {
42
+ this.$emit('blur', event)
43
+ },
44
+ /**
45
+ * 当 input 获得焦点时触发
46
+ * @param {*} event
47
+ */
48
+ focus: function(event) {
49
+ this.$emit('focus', event)
50
+ },
51
+ input(newValue) {
52
+ this.$emit('input', newValue)
53
+ }
54
+ }
55
+ export default events
@@ -0,0 +1,6 @@
1
+ import FsPreview from './src/fs-preview.vue'
2
+ FsPreview.install = function(Vue) {
3
+ Vue.component(FsPreview.name, FsPreview)
4
+ }
5
+
6
+ export default FsPreview