imatrix-ui 0.0.15 → 0.1.1-up

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 (171) hide show
  1. package/.vscode/extensions.json +3 -0
  2. package/README.md +7 -0
  3. package/components/dynamic-source-select/dynamic-source-select-service.js +106 -0
  4. package/components/dynamic-source-select/dynamic-source-select.vue +673 -0
  5. package/components/dynamic-source-select/events.js +77 -0
  6. package/components/fs-preview/fs-preview.vue +287 -0
  7. package/components/index.js +26 -0
  8. package/components/plugins/export-data-new.js +623 -0
  9. package/components/plugins/export-data.js +431 -0
  10. package/components/plugins/index.js +15 -0
  11. package/components/plugins/public-method.js +47 -0
  12. package/components/rich-editor/index-bak.vue +306 -0
  13. package/components/rich-editor/index.vue +236 -0
  14. package/components/rich-editor/langs/zh-Hans.js +438 -0
  15. package/components/rich-editor/viewer.vue +105 -0
  16. package/components/super-grid/apis.js +1065 -0
  17. package/components/super-grid/columns-config.vue +430 -0
  18. package/components/super-grid/custom-formatter.js +330 -0
  19. package/components/super-grid/dynamic-input.vue +1706 -0
  20. package/components/super-grid/eventBus.js +2 -0
  21. package/components/super-grid/events.js +56 -0
  22. package/components/super-grid/formValidatorUtil.js +300 -0
  23. package/components/super-grid/formatter.js +190 -0
  24. package/components/super-grid/group-column.vue +100 -0
  25. package/components/super-grid/header-context-menu.vue +82 -0
  26. package/components/super-grid/index-column.vue +69 -0
  27. package/components/super-grid/normal-column.vue +1148 -0
  28. package/components/super-grid/public-methods.js +30 -0
  29. package/components/super-grid/row-operation.vue +193 -0
  30. package/components/super-grid/search-button.vue +74 -0
  31. package/components/super-grid/search-condition-input.vue +73 -0
  32. package/components/super-grid/search-condition-list.vue +68 -0
  33. package/components/super-grid/search-form-advancedQuery.vue +820 -0
  34. package/components/super-grid/search-form-dialog.vue +77 -0
  35. package/components/super-grid/search-form-item.vue +470 -0
  36. package/components/super-grid/search-form-number.vue +111 -0
  37. package/components/super-grid/search-form-open.vue +178 -0
  38. package/components/super-grid/search-form-ordinarySearch.vue +218 -0
  39. package/components/super-grid/search-form.vue +756 -0
  40. package/components/super-grid/search-methods.js +484 -0
  41. package/components/super-grid/selection-column.vue +46 -0
  42. package/components/super-grid/store.js +3 -0
  43. package/components/super-grid/super-grid-service.js +682 -0
  44. package/components/super-grid/super-grid.vue +2893 -0
  45. package/components/super-grid/utils.js +851 -0
  46. package/components/super-grid/view-image-dialog.vue +173 -0
  47. package/components/utils/gogocodeTransfer.js +59 -0
  48. package/components/utils/utils.js +180 -0
  49. package/components/utils/value-set.js +98 -0
  50. package/components/z-test-utton/index.vue +82 -0
  51. package/package.json +29 -40
  52. package/public/index.html +13 -0
  53. package/public/vite.svg +1 -0
  54. package/src/api/sso-service.js +172 -19
  55. package/src/api/tab.js +36 -0
  56. package/src/api/user-service.js +11 -11
  57. package/src/assets/401/401.gif +0 -0
  58. package/src/assets/404/404-cloud.png +0 -0
  59. package/src/assets/404/404.png +0 -0
  60. package/src/assets/cloud.png +0 -0
  61. package/src/directives/permission/index.js +13 -13
  62. package/src/directives/permission/permission.js +20 -15
  63. package/src/i18n/i18n.js +16 -0
  64. package/src/i18n/langs/cn.js +254 -0
  65. package/src/i18n/langs/en.js +264 -0
  66. package/src/permission.js +157 -71
  67. package/src/plugins.js +18 -18
  68. package/src/router/index.js +96 -69
  69. package/src/store/getters.js +15 -10
  70. package/src/store/index.js +19 -19
  71. package/src/store/modules/app.js +54 -42
  72. package/src/store/modules/permission.js +137 -73
  73. package/src/store/modules/tab-content.js +36 -0
  74. package/src/store/modules/user.js +293 -80
  75. package/src/styles/display-layout.scss +34 -0
  76. package/src/styles/element-ui.scss +29 -29
  77. package/src/styles/index.scss +157 -78
  78. package/src/styles/mixin.scss +27 -27
  79. package/src/styles/theme/black/font-style.scss +70 -0
  80. package/src/styles/theme/black/index.scss +306 -0
  81. package/src/styles/theme/black/sidebar.scss +189 -0
  82. package/src/styles/theme/blue/font-style.scss +46 -0
  83. package/src/styles/theme/blue/index.scss +172 -0
  84. package/src/styles/{sidebar.scss → theme/blue/sidebar.scss} +171 -141
  85. package/src/styles/theme/blue2/font-style.scss +70 -0
  86. package/src/styles/theme/blue2/index.scss +188 -0
  87. package/src/styles/theme/blue2/sidebar.scss +201 -0
  88. package/src/styles/theme/dark-blue/button.scss +9 -0
  89. package/src/styles/theme/dark-blue/card.scss +62 -0
  90. package/src/styles/theme/dark-blue/checkbox.scss +10 -0
  91. package/src/styles/theme/dark-blue/dark-blue-var.scss +8 -0
  92. package/src/styles/theme/dark-blue/dialog.scss +21 -0
  93. package/src/styles/theme/dark-blue/element-variables.scss +7 -0
  94. package/src/styles/theme/dark-blue/font.scss +71 -0
  95. package/src/styles/theme/dark-blue/form.scss +51 -0
  96. package/src/styles/theme/dark-blue/index.scss +269 -0
  97. package/src/styles/theme/dark-blue/input.scss +15 -0
  98. package/src/styles/theme/dark-blue/message.scss +8 -0
  99. package/src/styles/theme/dark-blue/pagination.scss +14 -0
  100. package/src/styles/theme/dark-blue/scrollbar-style.scss +32 -0
  101. package/src/styles/theme/dark-blue/sidebar.scss +266 -0
  102. package/src/styles/theme/dark-blue/tab.scss +83 -0
  103. package/src/styles/theme/dark-blue/table.scss +60 -0
  104. package/src/styles/theme/dark-blue/tree.scss +31 -0
  105. package/src/styles/theme/dark-blue/var.scss +1028 -0
  106. package/src/styles/theme/gray/card-style.scss +54 -0
  107. package/src/styles/theme/gray/font-style.scss +70 -0
  108. package/src/styles/theme/gray/index.scss +172 -0
  109. package/src/styles/theme/gray/input-style.scss +19 -0
  110. package/src/styles/theme/gray/scrollbar-style.scss +32 -0
  111. package/src/styles/theme/gray/sidebar.scss +231 -0
  112. package/src/styles/theme/gray/tab-style.scss +81 -0
  113. package/src/styles/transition.scss +47 -46
  114. package/src/utils/auth-api.js +159 -0
  115. package/src/utils/auth.js +61 -15
  116. package/src/utils/calculator/calculator-factory-wf.js +558 -0
  117. package/src/utils/calculator/calculator-factory.js +145 -0
  118. package/src/utils/calculator/calculator-util.js +166 -0
  119. package/src/utils/common-util.js +305 -0
  120. package/src/utils/eventBus.js +2 -0
  121. package/src/utils/iconUtils.js +28 -0
  122. package/src/utils/index.js +102 -86
  123. package/src/utils/jump-page-utils.js +814 -0
  124. package/src/utils/local-storage.js +33 -31
  125. package/src/utils/menu.js +19 -0
  126. package/src/utils/permission.js +31 -26
  127. package/src/utils/permissionAuth.js +90 -0
  128. package/src/utils/range-selector.js +188 -0
  129. package/src/utils/request.js +270 -116
  130. package/src/utils/restful-interface-utils.js +57 -0
  131. package/src/utils/util.js +698 -0
  132. package/src/utils/validate.js +34 -33
  133. package/src/utils/watermark.js +108 -0
  134. package/src/utils/workflow-util.js +93 -0
  135. package/src/views/404.vue +248 -228
  136. package/src/views/dsc-component/Sidebar/Item.vue +84 -0
  137. package/src/views/dsc-component/Sidebar/Link.vue +38 -0
  138. package/src/views/dsc-component/Sidebar/SidebarItem.vue +196 -0
  139. package/src/views/dsc-component/Sidebar/index.vue +220 -0
  140. package/src/views/dsc-component/tabs/tab-content.vue +199 -0
  141. package/src/views/error-page/401.vue +106 -91
  142. package/src/views/error-page/404.vue +248 -228
  143. package/src/views/layout/EmptyLayout.vue +3 -0
  144. package/src/views/layout/Layout.vue +81 -68
  145. package/src/views/layout/NewLayout.vue +18 -0
  146. package/src/views/layout/components/AppMain.vue +39 -29
  147. package/src/views/layout/components/Breadcrumb/index.vue +156 -0
  148. package/src/views/layout/components/Menubar/Item.vue +57 -0
  149. package/src/views/layout/components/Menubar/Link.vue +38 -0
  150. package/src/views/layout/components/Menubar/SidebarItem.vue +164 -0
  151. package/src/views/layout/components/Menubar/index.vue +210 -0
  152. package/src/views/layout/components/Sidebar/Item.vue +53 -29
  153. package/src/views/layout/components/Sidebar/Link.vue +38 -39
  154. package/src/views/layout/components/Sidebar/SidebarItem.vue +135 -100
  155. package/src/views/layout/components/Sidebar/index.vue +141 -48
  156. package/src/views/layout/components/iframe-page.vue +38 -0
  157. package/src/views/layout/components/index.js +4 -3
  158. package/src/views/layout/components/tabs/tab-content.vue +207 -0
  159. package/src/views/layout/mixin/ResizeHandler.js +41 -41
  160. package/src/views/layout/tab-content-iframe-index.vue +38 -0
  161. package/src/views/layout/tab-content-index.vue +93 -0
  162. package/src/views/login/authredirect.vue +10 -10
  163. package/src/views/login/index.vue +296 -203
  164. package/src/views/login/update-password.vue +243 -0
  165. package/src/views/redirect/index.vue +14 -12
  166. package/src/views/wf-history/tache-subprocess-history.vue +45 -0
  167. package/vite.config.js +31 -0
  168. package/lib/super-ui.css +0 -1
  169. package/lib/super-ui.umd.min.js +0 -2
  170. package/src/styles/variables.scss +0 -4
  171. package/src/views/layout/components/Navbar.vue +0 -92
@@ -0,0 +1,673 @@
1
+ <template>
2
+ <span class="select-top-span">
3
+ <el-select
4
+ ref="dynamicDataSourceRef"
5
+ :model-value="value"
6
+ v-bind="myProps"
7
+ :remote="remote"
8
+ :title="getClassOptionTitle(value)"
9
+ :remote-method="remoteMethod"
10
+ :value-key="valueAttribute"
11
+ :loading="loading"
12
+ :size="size"
13
+ :allow-create="allowCreate"
14
+ :placeholder="placeholder"
15
+ default-first-option
16
+ :reserve-keyword="true"
17
+ :filterable="remote"
18
+ :clearable="clearable"
19
+ :style="fullWidth ? { width: '100%', height: '100%' } : {}"
20
+ @input="inputValue"
21
+ @change="change"
22
+ @visible-change="visibleChange"
23
+ @remove-tag="removeTag(remote, $event)"
24
+ @clear="clear"
25
+ @blur="blur"
26
+ @focus="focus"
27
+ >
28
+ <template v-if="descriptionAttribute">
29
+ <div v-if="optionWidth > 0" :style="{ width: optionWidth + 'px' }">
30
+ <el-option
31
+ v-for="item in optionItems"
32
+ :key="item.value"
33
+ :label="item._label_"
34
+ :value="item[valueAttribute]"
35
+ :title="item._label_ + item._description_"
36
+ >
37
+ <div style="display: flex">
38
+ <span>{{ item._label_ }}</span>
39
+ <span
40
+ style="color: #8492a6; font-size: 13px; margin-left: 30px"
41
+ >{{ item._description_ }}</span
42
+ >
43
+ </div>
44
+ </el-option>
45
+ </div>
46
+ <el-option
47
+ v-for="item in optionItems"
48
+ v-else
49
+ :key="item.value"
50
+ :label="item._label_"
51
+ :value="item[valueAttribute]"
52
+ :title="item._label_ + item._description_"
53
+ >
54
+ <span style="float: left">{{ item._label_ }}</span>
55
+ <span
56
+ style="
57
+ float: right;
58
+ color: #8492a6;
59
+ font-size: 13px;
60
+ margin-left: 30px;
61
+ "
62
+ >{{ item._description_ }}</span
63
+ >
64
+ </el-option>
65
+ </template>
66
+ <template v-else>
67
+ <div
68
+ v-if="optionWidth > 0"
69
+ :style="{ width: optionWidth + 'px', position: 'relative' }"
70
+ >
71
+ <el-option
72
+ v-for="item in optionItems"
73
+ :key="item.value"
74
+ :label="item._label_"
75
+ :value="item[valueAttribute]"
76
+ />
77
+ </div>
78
+ <el-option
79
+ v-for="item in optionItems"
80
+ v-else
81
+ :key="item.value"
82
+ :label="item._label_"
83
+ :value="item[valueAttribute]"
84
+ />
85
+ </template>
86
+ </el-select>
87
+ </span>
88
+ </template>
89
+
90
+ <script>
91
+ import dynamicSourceSelectService from './dynamic-source-select-service'
92
+ import events from './events'
93
+ import eventBus from '../../src/utils/eventBus'
94
+ import {
95
+ setEntityFieldValue,
96
+ getPropNameWhenJoinTable,
97
+ } from '../../src/utils/util'
98
+ export default {
99
+ name: 'DynamicSourceSelect',
100
+ components: {},
101
+ model: {
102
+ prop: 'value',
103
+ event: 'input',
104
+ },
105
+ props: {
106
+ // 字段配置 只有列表行编辑时候才用
107
+ column: {
108
+ type: Object,
109
+ default: null,
110
+ },
111
+ value: {
112
+ type: [String, Boolean, Number, Array],
113
+ default: null,
114
+ },
115
+ baseProps: {
116
+ type: Object,
117
+ default: null,
118
+ },
119
+ entity: {
120
+ type: Object,
121
+ default: null,
122
+ },
123
+ // dynamicDataSourceCode、valueSetOptions、isSql(默认是false,在配置系统中使用时需要是true)、additionalParameter( json字符串)
124
+ options: {
125
+ type: Object,
126
+ default: null,
127
+ },
128
+ // 列表组件行编辑使用,sql查询时数据表名称,用于自定义系统中列表组件中字段多表查询带有别名时,将点"."改成两个下划线"__"时使用
129
+ tableName: {
130
+ type: String,
131
+ default: null,
132
+ },
133
+ // 列表组件行编辑使用,是否是关联表,用于确定属性名是否需要拼接tableName
134
+ isJoinTable: {
135
+ type: Boolean,
136
+ default: false,
137
+ },
138
+ // 子表行编辑时,父表单数据
139
+ parent: {
140
+ type: Object,
141
+ default: null,
142
+ },
143
+ // 所在的列表编码
144
+ listCode: {
145
+ type: String,
146
+ default: null,
147
+ },
148
+ // 所在的表单编码
149
+ formCode: {
150
+ type: String,
151
+ default: null,
152
+ },
153
+ listToolbarFormData: {
154
+ type: Object,
155
+ default: () => {
156
+ return {}
157
+ },
158
+ },
159
+ fullWidth: {
160
+ type: Boolean,
161
+ default: true,
162
+ },
163
+ clearable: {
164
+ type: Boolean,
165
+ default: true,
166
+ },
167
+ size: {
168
+ type: String,
169
+ default: 'medium',
170
+ },
171
+ allowCreate: {
172
+ type: Boolean,
173
+ default: false,
174
+ },
175
+ analysisArea: {
176
+ type: Number,
177
+ default: null,
178
+ // 1 为工具栏解析
179
+ },
180
+ placeholder: {
181
+ type: String,
182
+ default: null,
183
+ },
184
+ // 下拉框配置宽度
185
+ optionWidth: {
186
+ default: 0,
187
+ },
188
+ },
189
+ // 是否是页面预览, 从页面管理传递
190
+ inject: {
191
+ isPageInfo: { value: 'isPageInfo', default: false },
192
+ },
193
+ data() {
194
+ const myProps = Object.assign({}, this.baseProps)
195
+ let markValue
196
+ if (this.entity) {
197
+ markValue = JSON.stringify(this.entity)
198
+ }
199
+ return {
200
+ /**
201
+ * 用于回显动态数据源选择的默认值,因为初始进入编辑状态时,没有获取映射关系,
202
+ * 如果当前字段是保存的label值则无法确定当前选项组的值对应哪一个,导致row中的对应字段变成了空值,所以备份一份
203
+ * 然后在获取动态数据源选项组后,给上默认值
204
+ */
205
+ markValue,
206
+ optionItems: [],
207
+ myProps,
208
+ valueSetOptions: [], // 字段映射集合配置
209
+ dynamicDataSourceCode: '', // 动态数据源编码
210
+ loading: false, // 是否在加载
211
+ valueAttribute: null, // 选项值字段,即控制下拉框组件的value-key属性的
212
+ remote: false, // 是否是远程搜索
213
+ additionalParameterStr: this.options.additionalParameter, // 附加参数json字符串
214
+ isLoaded: false, // 动态数据源是否直接显示静态页面
215
+ watchAttr: null, // 监控的entity属性名,多个属性名逗号分隔。即当该属性修改时,需要走后台重新获得当前下拉选的选项集合
216
+ backendUrl: null, // 后台访问路径
217
+ descriptionAttribute: null,
218
+ queryParam: {}, // 请求参数
219
+ }
220
+ },
221
+ watch: {
222
+ baseProps: {
223
+ deep: true,
224
+ handler(newModels) {
225
+ this.myProps = Object.assign({}, newModels)
226
+ },
227
+ },
228
+ },
229
+ created() {
230
+ if (this.options && this.options.dynamicDataSourceCode) {
231
+ this.dynamicDataSourceCode = this.options.dynamicDataSourceCode.trim()
232
+ const param = {
233
+ _listCode: this.listCode,
234
+ _formCode: this.formCode,
235
+ _tableName: this.tableName,
236
+ }
237
+ if (this.parent) {
238
+ param.parent = this.parent
239
+ }
240
+ if (!this.isPageInfo) {
241
+ this.packageDynamicDataSourceInfo(this.dynamicDataSourceCode, param)
242
+ .then((dynamicDataSourceDto) => {
243
+ // console.log('UI获取的数据', dynamicDataSourceDto)
244
+ if (dynamicDataSourceDto.backendUrl) {
245
+ this.backendUrl = dynamicDataSourceDto.backendUrl
246
+ }
247
+ if (
248
+ dynamicDataSourceDto.fuzzyQuery !== undefined &&
249
+ dynamicDataSourceDto.fuzzyQuery === true
250
+ ) {
251
+ // 是否启用远程搜索
252
+ this.remote = true
253
+ }
254
+ if (this.options && this.options.valueSetOptions) {
255
+ this.valueSetOptions = this.options.valueSetOptions
256
+ }
257
+ if (
258
+ this.options &&
259
+ this.options.isSql !== undefined &&
260
+ this.options.isSql !== null
261
+ ) {
262
+ this.isSql = this.options.isSql
263
+ }
264
+ if (this.watchAttr) {
265
+ let initWatchValue
266
+ const watchAttrs = this.watchAttr.split(',')
267
+ watchAttrs.forEach((attr) => {
268
+ // 初始化下拉选内容
269
+ if (this.entity) {
270
+ initWatchValue = this.entity[attr]
271
+ }
272
+ this.$watch('entity.' + attr, function (newValue, oldValue) {
273
+ this.watchAttrValueChange(newValue)
274
+ // this.inputValue('')
275
+ const items = this.optionItems.filter(
276
+ (item) => item[this.valueAttribute] === newValue
277
+ )
278
+ if (!items) {
279
+ this.inputValue('')
280
+ }
281
+ })
282
+ })
283
+ this.watchAttrValueChange(initWatchValue)
284
+ }
285
+ this.isLoaded = true
286
+ // 默认选中处理
287
+ if (dynamicDataSourceDto.defaultSelect) {
288
+ // 多选处理
289
+ if (this.baseProps.multiple) {
290
+ this.$emit('set-default-value', [
291
+ this.optionItems[0][this.valueAttribute],
292
+ ])
293
+ } else {
294
+ // 单选处理
295
+ if (this.optionItems.length > 0) {
296
+ this.$emit(
297
+ 'set-default-value',
298
+ this.optionItems[0][this.valueAttribute]
299
+ )
300
+ }
301
+ }
302
+ }
303
+ // console.log('判断参数',this.analysisArea);
304
+ // console.log('判断参数',this.remote);
305
+ if (this.analysisArea !== 1 && this.remote) {
306
+ // 传递初始化查询供重置用
307
+ const that = this
308
+ eventBus.$on('remoteMethod', () => {
309
+ that.remoteMethod('')
310
+ })
311
+ // console.log('传递了参数');
312
+ }
313
+ this.$emit('load-completed', dynamicDataSourceDto)
314
+ })
315
+ .catch((error) => {
316
+ console.log(error)
317
+ this.$emit('load-completed', {
318
+ code: this.dynamicDataSourceCode,
319
+ error: error,
320
+ })
321
+ this.isLoaded = true
322
+ })
323
+ }
324
+ } else {
325
+ this.isLoaded = true
326
+ }
327
+ console.log(
328
+ '%c描述-095027',
329
+ 'color:#2E3435;background:#F8BB07;padding:3px;border-radius:2px',
330
+ this.optionWidth
331
+ )
332
+ },
333
+ methods: {
334
+ ...dynamicSourceSelectService,
335
+ ...events,
336
+ /**
337
+ * @description: 获取提示标题
338
+ * @Date: 2023-08-04 10:04:42
339
+ * @param {*}
340
+ * @return {*}
341
+ */
342
+ getClassOptionTitle(val) {
343
+ if (val !== null && val !== undefined && val !== '' && val.length > 0) {
344
+ let selectTittle = ''
345
+ if (typeof val === 'string') {
346
+ // 单选
347
+ if (this.descriptionAttribute) {
348
+ this.optionItems.forEach((item) => {
349
+ if (item[this.valueAttribute] === val) {
350
+ selectTittle = item._label_ + item._description_
351
+ }
352
+ })
353
+ } else {
354
+ this.optionItems.forEach((Ttem) => {
355
+ if (Ttem[this.valueAttribute] === val) {
356
+ selectTittle = Ttem._label_
357
+ }
358
+ })
359
+ }
360
+ } else {
361
+ // 多选
362
+ if (this.descriptionAttribute) {
363
+ this.optionItems.forEach((item) => {
364
+ val.forEach((Vtem) => {
365
+ if (item[this.valueAttribute] === Vtem) {
366
+ selectTittle = selectTittle + item._label_ + ','
367
+ }
368
+ })
369
+ })
370
+ selectTittle = selectTittle.slice(0, selectTittle.length - 1)
371
+ } else {
372
+ this.optionItems.forEach((Ttem) => {
373
+ val.forEach((Vtem) => {
374
+ if (Ttem[this.valueAttribute] === Vtem) {
375
+ selectTittle = selectTittle + Ttem._label_ + ','
376
+ }
377
+ })
378
+ })
379
+ selectTittle = selectTittle.slice(0, selectTittle.length - 1)
380
+ }
381
+ }
382
+ return selectTittle
383
+ }
384
+ },
385
+ // 必须有该方法,否则无法给字段赋值
386
+ inputValue(newValue) {
387
+ this.$emit('input', newValue)
388
+ if (newValue === null || newValue === undefined || newValue === '') {
389
+ this.remoteQueryMethod(newValue)
390
+ }
391
+ this.setValues(newValue)
392
+ },
393
+ packageDynamicDataSourceInfo(dynamicDataSourceCode, param) {
394
+ return new Promise((resolve, reject) => {
395
+ this.findDynamicDataSourceByCode(
396
+ dynamicDataSourceCode,
397
+ this.entity,
398
+ param,
399
+ this.additionalParameterStr,
400
+ this.backendUrl
401
+ )
402
+ .then((dynamicDataSourceDto) => {
403
+ if (dynamicDataSourceDto) {
404
+ if (dynamicDataSourceDto.options) {
405
+ this.optionItems = dynamicDataSourceDto.options
406
+ if (this.watchAttr) {
407
+ // 解决当监控值变化时,数据源重新加载后select输入框中显示的值和下拉中的值不一致问题
408
+ if (
409
+ this.baseProps.multiple !== undefined &&
410
+ this.baseProps.multiple === true
411
+ ) {
412
+ this.$nextTick(() => {
413
+ this.$refs['dynamicDataSourceRef'].setSelected()
414
+ })
415
+ }
416
+ }
417
+ //
418
+ if (this.column) {
419
+ // 只有行编辑时处理
420
+ // 设置选项组数据、 选项组值字段、 映射关系
421
+ if (
422
+ this.column.prop !== dynamicDataSourceDto.valueAttribute
423
+ ) {
424
+ this.$set(
425
+ this.column,
426
+ '_dynamic-source-data-' + this.column.prop,
427
+ {
428
+ valueSetOptions: this.options.valueSetOptions,
429
+ optionItems: this.optionItems,
430
+ valueAttribute: dynamicDataSourceDto.valueAttribute,
431
+ }
432
+ )
433
+ }
434
+ for (
435
+ let i = 0;
436
+ i < this.options.valueSetOptions.length;
437
+ i++
438
+ ) {
439
+ const valueSetOption = this.options.valueSetOptions[i]
440
+ if (
441
+ dynamicDataSourceDto.valueAttribute ===
442
+ valueSetOption.columnName
443
+ ) {
444
+ if (this.markValue) {
445
+ const muMarkValue = JSON.parse(this.markValue)
446
+ if (
447
+ muMarkValue &&
448
+ muMarkValue[valueSetOption.valueColumn.dbColumnName]
449
+ ) {
450
+ let targeValue = (
451
+ muMarkValue[
452
+ valueSetOption.valueColumn.dbColumnName
453
+ ] + ''
454
+ ).split(',')
455
+ if (this.column.componentType === 'select') {
456
+ // 如果是单选
457
+ targeValue = targeValue[0]
458
+ }
459
+ // 不需要再赋值了 如果当前字段不上动态数据源的值字段,那就表示不需要回显
460
+ // if (valueSetOption.valueColumn.dbColumnName === this.column.prop) {
461
+ // this.$emit('set-value', {
462
+ // value: targeValue,
463
+ // targetColumnName: this.column.prop
464
+ // })
465
+ // }
466
+ }
467
+ }
468
+ break
469
+ }
470
+ }
471
+ }
472
+ } else {
473
+ this.optionItems = []
474
+ }
475
+ if (dynamicDataSourceDto.valueAttribute) {
476
+ this.valueAttribute = dynamicDataSourceDto.valueAttribute
477
+ }
478
+ if (dynamicDataSourceDto.descriptionAttribute) {
479
+ this.descriptionAttribute =
480
+ dynamicDataSourceDto.descriptionAttribute
481
+ }
482
+ this.valueAttribute = this.getValueAttribute()
483
+ this.watchAttr = dynamicDataSourceDto.watchAttr
484
+ this.$emit('load-completed', dynamicDataSourceDto)
485
+ resolve(dynamicDataSourceDto)
486
+ } else {
487
+ resolve()
488
+ }
489
+ })
490
+ .catch((error) => {
491
+ reject(error)
492
+ })
493
+ })
494
+ },
495
+ // 远程搜索方法
496
+ remoteQuery(searchText, watchAttrValue) {
497
+ if (
498
+ (searchText !== null && searchText !== undefined) ||
499
+ (watchAttrValue !== null && watchAttrValue !== undefined)
500
+ ) {
501
+ const param = {
502
+ _listCode: this.listCode,
503
+ _formCode: this.formCode,
504
+ _tableName: this.tableName,
505
+ }
506
+ if (searchText !== null && searchText !== undefined) {
507
+ param.searchText = searchText
508
+ }
509
+ if (watchAttrValue !== null && watchAttrValue !== undefined) {
510
+ // 监控的属性值改变了远程搜索方法
511
+ if (
512
+ Object.prototype.toString.apply(watchAttrValue) === '[object Array]'
513
+ ) {
514
+ param.watchAttrValue = watchAttrValue.join(',')
515
+ } else {
516
+ param.watchAttrValue = watchAttrValue + ''
517
+ }
518
+ } else if (this.entity) {
519
+ // 搜索时下拉选项的集合
520
+ const watchValue = this.entity[this.watchAttr]
521
+ if (watchValue !== null && watchValue !== undefined) {
522
+ if (
523
+ Object.prototype.toString.apply(watchValue) === '[object Array]'
524
+ ) {
525
+ param.watchAttrValue = watchValue.join(',')
526
+ } else {
527
+ param.watchAttrValue = watchValue + ''
528
+ }
529
+ }
530
+ }
531
+ if (this.parent) {
532
+ param.parent = this.parent
533
+ }
534
+ this.loading = true
535
+ this.packageDynamicDataSourceInfo(this.dynamicDataSourceCode, param)
536
+ .then((dynamicDataSourceDto) => {
537
+ this.loading = false
538
+ })
539
+ .catch((error) => {
540
+ console.log(error)
541
+ this.loading = false
542
+ })
543
+ }
544
+ },
545
+ // 远程搜索方法
546
+ remoteQueryMethod(searchText) {
547
+ if (Array.isArray(this.value)) {
548
+ if (this.value.length === 0) {
549
+ this.remoteQuery(searchText, null)
550
+ }
551
+ } else {
552
+ this.remoteQuery(searchText, null)
553
+ }
554
+ },
555
+ /**
556
+ * 输入框输入查询值时搜索方法,
557
+ * 不使用remoteQueryMethod, 解决输入框第一次输入时可查询,第二次输入时没有触发查询方法问题
558
+ * @param {*} searchText
559
+ */
560
+ remoteMethod(searchText) {
561
+ this.remoteQuery(searchText, null)
562
+ },
563
+ // 监控的属性值改变了远程搜索方法
564
+ watchAttrValueChange(watchAttrValues) {
565
+ this.remoteQuery(null, watchAttrValues)
566
+ },
567
+ getValueAttribute() {
568
+ return !this.valueAttribute || this.valueAttribute === '[label]'
569
+ ? '_label_'
570
+ : this.valueAttribute
571
+ },
572
+ setValues(newValue) {
573
+ if (this.valueSetOptions && this.valueSetOptions.length > 0) {
574
+ this.valueSetOptions.forEach((columnInfo) => {
575
+ const sourceColumnName = columnInfo.columnName
576
+ let value
577
+ if (this.optionItems && sourceColumnName) {
578
+ value = this.getTargetColumnValue(newValue, sourceColumnName)
579
+ }
580
+ let targetColumnName = null
581
+ const targetColumnInfo = columnInfo.valueColumn
582
+ if (targetColumnInfo) {
583
+ targetColumnName = targetColumnInfo.name
584
+ if (this.isSql === true) {
585
+ targetColumnName = targetColumnInfo.dbColumnName
586
+ targetColumnName = getPropNameWhenJoinTable(
587
+ targetColumnName,
588
+ this.isJoinTable,
589
+ this.tableName
590
+ )
591
+ }
592
+ }
593
+ if (
594
+ this.entity &&
595
+ targetColumnName &&
596
+ targetColumnName !== null &&
597
+ targetColumnName !== ''
598
+ ) {
599
+ setEntityFieldValue(this.entity, targetColumnName, value)
600
+ }
601
+ const item = this.getSelectedOptionItem(newValue)
602
+ this.$emit('set-value', {
603
+ value: value,
604
+ sourceColumnName: sourceColumnName,
605
+ targetColumnName: targetColumnName,
606
+ options: this.optionItems,
607
+ selectedItem: item,
608
+ })
609
+ })
610
+ }
611
+ },
612
+ // 获得目的字段的值
613
+ getTargetColumnValue(newValue, sourceColumnName) {
614
+ if (newValue) {
615
+ let value = ''
616
+ if (
617
+ this.baseProps.multiple !== undefined &&
618
+ this.baseProps.multiple === true &&
619
+ Array.isArray(newValue)
620
+ ) {
621
+ // 多选值处理,数组信息,使用逗号分开的格式设置其它字段的值
622
+ let i = 0
623
+ newValue.forEach((itemValue) => {
624
+ const items = this.optionItems.filter(
625
+ (item) => item[this.valueAttribute] === itemValue
626
+ )
627
+ if (items && items.length > 0) {
628
+ value += items[0][sourceColumnName]
629
+ if (i < newValue.length - 1) {
630
+ // 最后一个元素不加逗号
631
+ value += ','
632
+ }
633
+ i++
634
+ }
635
+ })
636
+ } else {
637
+ // 单选
638
+ const items = this.optionItems.filter(
639
+ (item) => item[this.valueAttribute] === newValue
640
+ )
641
+ if (items && items.length > 0) {
642
+ value = items[0][sourceColumnName]
643
+ }
644
+ }
645
+ return value
646
+ }
647
+ },
648
+ // 移除所有tag和clear时候清除markValue的值解决清除选项时关联字段清空了但是当前动态数据源控件仍然有值问题
649
+ clearMarkValue() {
650
+ if (this.markValue && this.entity) {
651
+ const muMarkValue = JSON.parse(this.markValue)
652
+ for (let i = 0; i < this.options.valueSetOptions.length; i++) {
653
+ const valueSetOption = this.options.valueSetOptions[i]
654
+ muMarkValue[valueSetOption.valueColumn.dbColumnName] = null
655
+ }
656
+ this.markValue = JSON.stringify(muMarkValue)
657
+ }
658
+ },
659
+ },
660
+ }
661
+ </script>
662
+
663
+ <style>
664
+ .select-top-span {
665
+ width: 100%;
666
+ }
667
+ </style>
668
+
669
+ <style lang="scss" scoped>
670
+ ::v-deep .el-select-dropdown__item {
671
+ display: inline-block;
672
+ }
673
+ </style>