imatrix-ui 2.8.21-dw → 2.8.21
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.
- package/lib/super-ui.css +1 -1
- package/lib/super-ui.umd.min.js +5 -35
- package/package.json +4 -2
- package/packages/breadcrumb/index.js +6 -0
- package/packages/breadcrumb/src/breadcrumb.vue +71 -0
- package/packages/department-tree/index.js +6 -0
- package/packages/department-tree/src/department-tree.vue +108 -0
- package/packages/department-tree-inline/index.js +6 -0
- package/packages/department-tree-inline/src/department-multi-tree-inline.vue +402 -0
- package/packages/department-tree-inline/src/department-single-tree-inline.vue +284 -0
- package/packages/department-tree-inline/src/department-tree-inline.vue +86 -0
- package/packages/department-tree-inline/src/department-tree-service.js +245 -0
- package/packages/department-tree-inline/src/search-result.vue +176 -0
- package/packages/department-user-tree/index.js +6 -0
- package/packages/department-user-tree/src/department-user-multiple-tree.vue +116 -0
- package/packages/department-user-tree/src/department-user-single-tree.vue +76 -0
- package/packages/department-user-tree/src/department-user-tree.vue +101 -0
- package/packages/department-user-tree-inline/index.js +6 -0
- package/packages/department-user-tree-inline/src/department-user-multiple-tree-inline.vue +626 -0
- package/packages/department-user-tree-inline/src/department-user-single-tree-inline.vue +269 -0
- package/packages/department-user-tree-inline/src/department-user-tree-inline.vue +79 -0
- package/packages/department-user-tree-inline/src/department-user-tree-multi-service.js +230 -0
- package/packages/department-user-tree-inline/src/department-user-tree-single-service.js +122 -0
- package/packages/department-user-tree-inline/src/search-result.vue +197 -0
- package/packages/directives/prevent-reclick.js +19 -0
- package/packages/dynamic-source-select/index.js +6 -0
- package/packages/dynamic-source-select/src/dynamic-source-select-service.js +70 -0
- package/packages/dynamic-source-select/src/dynamic-source-select.vue +440 -0
- package/packages/dynamic-source-select/src/events.js +55 -0
- package/packages/fs-preview/index.js +6 -0
- package/packages/fs-preview/src/fs-preview.vue +226 -0
- package/packages/fs-upload/index.js +6 -0
- package/packages/fs-upload/src/fs-upload-multi.vue +420 -0
- package/packages/fs-upload/src/fs-upload-single.vue +312 -0
- package/packages/fs-upload/src/fs-upload.vue +189 -0
- package/packages/fs-upload/src/see-big-picture.vue +55 -0
- package/packages/fs-upload-list/index.js +6 -0
- package/packages/fs-upload-list/src/fs-upload-list.vue +287 -0
- package/packages/hamburger/index.js +6 -0
- package/packages/hamburger/src/hamburger.vue +38 -0
- package/packages/index.js +121 -0
- package/packages/multipart-upload/index.js +6 -0
- package/packages/multipart-upload/src/index.vue +73 -0
- package/packages/multipart-upload/src/multipart-upload-form.vue +297 -0
- package/packages/multipart-upload/src/multipart-upload-list.vue +378 -0
- package/packages/organization-input/index.js +6 -0
- package/packages/organization-input/src/organization-input.vue +542 -0
- package/packages/plugins/export-data-new.js +453 -0
- package/packages/plugins/export-data.js +361 -0
- package/packages/plugins/index.js +15 -0
- package/packages/plugins/public-method.js +43 -0
- package/packages/remove-department/index.js +6 -0
- package/packages/remove-department/src/remove-department.vue +172 -0
- package/packages/remove-department/src/remove-dept-service.js +20 -0
- package/packages/remove-user/index.js +6 -0
- package/packages/remove-user/src/remove-user-service.js +20 -0
- package/packages/remove-user/src/remove-user.vue +195 -0
- package/packages/remove-workgroup/index.js +6 -0
- package/packages/remove-workgroup/src/remove-workgroup-service.js +20 -0
- package/packages/remove-workgroup/src/remove-workgroup.vue +159 -0
- package/packages/rich-editor/index.js +7 -0
- package/packages/rich-editor/index.vue +278 -0
- package/packages/rich-editor/langs/zh-Hans.js +1 -0
- package/packages/rich-editor/viewer.vue +103 -0
- package/packages/scan-code-input/index.js +6 -0
- package/packages/scan-code-input/src/events.js +33 -0
- package/packages/scan-code-input/src/scan-code-input-colse.vue +131 -0
- package/packages/scan-code-input/src/scan-code-input.vue +116 -0
- package/packages/secret-info/index.js +7 -0
- package/packages/secret-info/index.vue +90 -0
- package/packages/super-grid/index.js +7 -0
- package/packages/super-grid/src/apis.js +763 -0
- package/packages/super-grid/src/columns-config.vue +335 -0
- package/packages/super-grid/src/custom-formatter.js +250 -0
- package/packages/super-grid/src/dynamic-input.vue +1279 -0
- package/packages/super-grid/src/eventBus.js +2 -0
- package/packages/super-grid/src/events.js +55 -0
- package/packages/super-grid/src/formValidatorUtil.js +226 -0
- package/packages/super-grid/src/formatter.js +181 -0
- package/packages/super-grid/src/group-column.vue +100 -0
- package/packages/super-grid/src/header-context-menu.vue +87 -0
- package/packages/super-grid/src/index-column.vue +51 -0
- package/packages/super-grid/src/normal-column.vue +769 -0
- package/packages/super-grid/src/public-methods.js +31 -0
- package/packages/super-grid/src/row-operation.vue +161 -0
- package/packages/super-grid/src/search-button.vue +66 -0
- package/packages/super-grid/src/search-condition-input.vue +61 -0
- package/packages/super-grid/src/search-condition-list.vue +59 -0
- package/packages/super-grid/src/search-form-advancedQuery.vue +653 -0
- package/packages/super-grid/src/search-form-dialog.vue +79 -0
- package/packages/super-grid/src/search-form-item.vue +386 -0
- package/packages/super-grid/src/search-form-number.vue +38 -0
- package/packages/super-grid/src/search-form-open.vue +162 -0
- package/packages/super-grid/src/search-form-ordinarySearch.vue +188 -0
- package/packages/super-grid/src/search-form.vue +634 -0
- package/packages/super-grid/src/search-methods.js +387 -0
- package/packages/super-grid/src/selection-column.vue +43 -0
- package/packages/super-grid/src/store.js +3 -0
- package/packages/super-grid/src/super-grid-service.js +561 -0
- package/packages/super-grid/src/super-grid.vue +2793 -0
- package/packages/super-grid/src/utils.js +763 -0
- package/packages/super-grid/src/view-image-dialog.vue +130 -0
- package/packages/super-nine-grid/index.js +7 -0
- package/packages/super-nine-grid/src/apis.js +103 -0
- package/packages/super-nine-grid/src/custom-formatter.js +66 -0
- package/packages/super-nine-grid/src/formatter.js +132 -0
- package/packages/super-nine-grid/src/search-form-number.vue +38 -0
- package/packages/super-nine-grid/src/search-form.vue +430 -0
- package/packages/super-nine-grid/src/search-methods.js +134 -0
- package/packages/super-nine-grid/src/store.js +3 -0
- package/packages/super-nine-grid/src/super-grid-service.js +91 -0
- package/packages/super-nine-grid/src/super-nine-grid.vue +872 -0
- package/packages/super-nine-grid/src/utils.js +261 -0
- package/packages/svg-icon/index.js +6 -0
- package/packages/svg-icon/src/svg-icon.vue +43 -0
- package/packages/utils/utils.js +152 -0
- package/packages/utils/value-set.js +86 -0
- package/packages/valid-code/index.js +7 -0
- package/packages/valid-code/src/valid-code.vue +95 -0
- package/packages/workflow-button/index.js +6 -0
- package/packages/workflow-button/src/workflow-button.vue +325 -0
- package/packages/workflow-history-list/index.js +6 -0
- package/packages/workflow-history-list/src/api.js +7 -0
- package/packages/workflow-history-list/src/workflow-history-list.vue +185 -0
- package/packages/workgroup-tree/index.js +6 -0
- package/packages/workgroup-tree/src/workgroup-tree.vue +76 -0
- package/packages/workgroup-tree-inline/index.js +6 -0
- package/packages/workgroup-tree-inline/src/workgroup-tree-inline.vue +317 -0
- package/packages/workgroup-tree-inline/src/workgroup-tree-service.js +43 -0
- package/packages/workgroup-user-tree/index.js +6 -0
- package/packages/workgroup-user-tree/src/workgroup-user-tree.vue +100 -0
- package/packages/workgroup-user-tree-inline/index.js +6 -0
- package/packages/workgroup-user-tree-inline/src/workgroup-tree-inline-service.js +163 -0
- package/packages/workgroup-user-tree-inline/src/workgroup-user-tree-inline.vue +436 -0
- package/packages/year-range-picker/index.js +6 -0
- package/packages/year-range-picker/src/year-range-picker.vue +51 -0
- package/src/i18n/i18n.js +1 -1
- package/src/i18n/langs/cn.js +4 -2
- package/src/i18n/langs/en.js +4 -2
- package/src/index.js +93 -0
- package/src/permission.js +7 -3
- package/src/plugins.js +3 -3
- package/src/router/index.js +24 -0
- package/src/store/getters.js +2 -1
- package/src/store/modules/app.js +10 -1
- package/src/styles/display-layout.scss +34 -0
- package/src/styles/index.scss +32 -4
- package/src/styles/theme/dark-blue/button.scss +9 -0
- package/src/styles/theme/dark-blue/card.scss +64 -0
- package/src/styles/theme/dark-blue/checkbox.scss +10 -0
- package/src/styles/theme/dark-blue/dark-blue-var.scss +8 -0
- package/src/styles/theme/dark-blue/dialog.scss +21 -0
- package/src/styles/theme/dark-blue/element-variables.scss +7 -0
- package/src/styles/theme/dark-blue/font.scss +71 -0
- package/src/styles/theme/dark-blue/form.scss +51 -0
- package/src/styles/theme/dark-blue/index.scss +247 -0
- package/src/styles/theme/dark-blue/input.scss +15 -0
- package/src/styles/theme/dark-blue/pagination.scss +14 -0
- package/src/styles/theme/dark-blue/scrollbar-style.scss +32 -0
- package/src/styles/theme/dark-blue/sidebar.scss +296 -0
- package/src/styles/theme/dark-blue/tab.scss +83 -0
- package/src/styles/theme/dark-blue/table.scss +60 -0
- package/src/styles/theme/dark-blue/tree.scss +31 -0
- package/src/styles/theme/dark-blue/var.scss +1028 -0
- package/src/styles/theme/gray/form-style.scss +2 -2
- package/src/styles/theme/gray/input-style.scss +8 -0
- package/src/utils/auth-api.js +115 -0
- package/src/utils/auth.js +34 -42
- package/src/utils/calculator/calculator-factory.js +2 -2
- package/src/utils/common-util.js +34 -0
- package/src/utils/jump-page-utils.js +29 -5
- package/src/utils/menu.js +19 -0
- package/src/utils/permission.js +4 -0
- package/src/utils/request.js +18 -2
- package/src/utils/util.js +7 -3
- package/src/views/dsc-component/Sidebar/Item.vue +4 -4
- package/src/views/dsc-component/Sidebar/Link.vue +11 -2
- package/src/views/dsc-component/Sidebar/SidebarItem.vue +36 -20
- package/src/views/dsc-component/Sidebar/index.vue +24 -12
- package/src/views/dsc-component/tabs/tab-content.vue +16 -1
- package/src/views/login/index.vue +1 -1
|
@@ -0,0 +1,440 @@
|
|
|
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
|
+
filterable
|
|
9
|
+
:remote="remote"
|
|
10
|
+
:remote-method="remoteMethod"
|
|
11
|
+
:value-key="valueAttribute"
|
|
12
|
+
:loading="loading"
|
|
13
|
+
:reserve-keyword="true"
|
|
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="blur"
|
|
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
|
+
} from '../../../src/utils/util'
|
|
45
|
+
export default {
|
|
46
|
+
name: 'DynamicSourceSelect',
|
|
47
|
+
components: {},
|
|
48
|
+
model: {
|
|
49
|
+
prop: 'value',
|
|
50
|
+
event: 'input'
|
|
51
|
+
},
|
|
52
|
+
props: {
|
|
53
|
+
// 字段配置
|
|
54
|
+
column: {
|
|
55
|
+
type: Object,
|
|
56
|
+
default: null
|
|
57
|
+
},
|
|
58
|
+
value: {
|
|
59
|
+
type: [String, Boolean, Number, Array],
|
|
60
|
+
default: null
|
|
61
|
+
},
|
|
62
|
+
baseProps: {
|
|
63
|
+
type: Object,
|
|
64
|
+
default: null
|
|
65
|
+
},
|
|
66
|
+
entity: {
|
|
67
|
+
type: Object,
|
|
68
|
+
default: null
|
|
69
|
+
},
|
|
70
|
+
// dynamicDataSourceCode、valueSetOptions、isSql(默认是false,在配置系统中使用时需要是true)、additionalParameter( json字符串)
|
|
71
|
+
options: {
|
|
72
|
+
type: Object,
|
|
73
|
+
default: null
|
|
74
|
+
},
|
|
75
|
+
// 列表组件行编辑使用,sql查询时数据表名称,用于自定义系统中列表组件中字段多表查询带有别名时,将点"."改成两个下划线"__"时使用
|
|
76
|
+
tableName: {
|
|
77
|
+
type: String,
|
|
78
|
+
default: null
|
|
79
|
+
},
|
|
80
|
+
// 列表组件行编辑使用,是否是关联表,用于确定属性名是否需要拼接tableName
|
|
81
|
+
isJoinTable: {
|
|
82
|
+
type: Boolean,
|
|
83
|
+
default: false
|
|
84
|
+
},
|
|
85
|
+
// 子表行编辑时,父表单数据
|
|
86
|
+
parent: {
|
|
87
|
+
type: Object,
|
|
88
|
+
default: null
|
|
89
|
+
},
|
|
90
|
+
// 所在的列表编码
|
|
91
|
+
listCode: {
|
|
92
|
+
type: String,
|
|
93
|
+
default: null
|
|
94
|
+
},
|
|
95
|
+
// 所在的表单编码
|
|
96
|
+
formCode: {
|
|
97
|
+
type: String,
|
|
98
|
+
default: null
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
data() {
|
|
102
|
+
const myProps = Object.assign({}, this.baseProps)
|
|
103
|
+
let markValue
|
|
104
|
+
if (this.entity) {
|
|
105
|
+
markValue = JSON.stringify(this.entity)
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
/**
|
|
109
|
+
* 用于回显动态数据源选择的默认值,因为初始进入编辑状态时,没有获取映射关系,
|
|
110
|
+
* 如果当前字段是保存的label值则无法确定当前选项组的值对应哪一个,导致row中的对应字段变成了空值,所以备份一份
|
|
111
|
+
* 然后在获取动态数据源选项组后,给上默认值
|
|
112
|
+
*/
|
|
113
|
+
markValue,
|
|
114
|
+
optionItems: [],
|
|
115
|
+
myProps,
|
|
116
|
+
valueSetOptions: [], // 字段映射集合配置
|
|
117
|
+
dynamicDataSourceCode: '', // 动态数据源编码
|
|
118
|
+
loading: false, // 是否在加载
|
|
119
|
+
valueAttribute: null, // 选项值字段,即控制下拉框组件的value-key属性的
|
|
120
|
+
remote: false, // 是否是远程搜索
|
|
121
|
+
additionalParameterStr: this.options.additionalParameter, // 附加参数json字符串
|
|
122
|
+
isLoaded: false,
|
|
123
|
+
watchAttr: null, // 监控的entity属性名,多个属性名逗号分隔。即当该属性修改时,需要走后台重新获得当前下拉选的选项集合
|
|
124
|
+
backendUrl: null // 后台访问路径
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
watch: {
|
|
128
|
+
baseProps: {
|
|
129
|
+
deep: true,
|
|
130
|
+
handler(newModels) {
|
|
131
|
+
this.myProps = Object.assign({}, newModels)
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
created() {
|
|
136
|
+
if (this.options && this.options.dynamicDataSourceCode) {
|
|
137
|
+
this.dynamicDataSourceCode = this.options.dynamicDataSourceCode.trim()
|
|
138
|
+
const param = {
|
|
139
|
+
_listCode: this.listCode,
|
|
140
|
+
_formCode: this.formCode,
|
|
141
|
+
_tableName: this.tableName
|
|
142
|
+
}
|
|
143
|
+
if (this.parent) {
|
|
144
|
+
param.parent = this.parent
|
|
145
|
+
}
|
|
146
|
+
this.packageDynamicDataSourceInfo(this.dynamicDataSourceCode, param)
|
|
147
|
+
.then(dynamicDataSourceDto => {
|
|
148
|
+
if (dynamicDataSourceDto.backendUrl) {
|
|
149
|
+
this.backendUrl = dynamicDataSourceDto.backendUrl
|
|
150
|
+
}
|
|
151
|
+
if (
|
|
152
|
+
dynamicDataSourceDto.fuzzyQuery !== undefined &&
|
|
153
|
+
dynamicDataSourceDto.fuzzyQuery === true
|
|
154
|
+
) {
|
|
155
|
+
// 是否启用远程搜索
|
|
156
|
+
this.remote = true
|
|
157
|
+
}
|
|
158
|
+
if (this.options && this.options.valueSetOptions) {
|
|
159
|
+
this.valueSetOptions = this.options.valueSetOptions
|
|
160
|
+
}
|
|
161
|
+
if (
|
|
162
|
+
this.options &&
|
|
163
|
+
this.options.isSql !== undefined &&
|
|
164
|
+
this.options.isSql !== null
|
|
165
|
+
) {
|
|
166
|
+
this.isSql = this.options.isSql
|
|
167
|
+
}
|
|
168
|
+
if (this.watchAttr) {
|
|
169
|
+
let initWatchValue
|
|
170
|
+
const watchAttrs = this.watchAttr.split(',')
|
|
171
|
+
watchAttrs.forEach((attr) => {
|
|
172
|
+
// 初始化下拉选内容
|
|
173
|
+
if (this.entity) {
|
|
174
|
+
initWatchValue = this.entity[attr]
|
|
175
|
+
}
|
|
176
|
+
this.$watch('entity.' + attr, function(newValue, oldValue) {
|
|
177
|
+
this.watchAttrValueChange(newValue)
|
|
178
|
+
// this.inputValue('')
|
|
179
|
+
const items = this.optionItems.filter(
|
|
180
|
+
item => item[this.valueAttribute] === newValue
|
|
181
|
+
)
|
|
182
|
+
if (!items) {
|
|
183
|
+
this.inputValue('')
|
|
184
|
+
}
|
|
185
|
+
})
|
|
186
|
+
})
|
|
187
|
+
this.watchAttrValueChange(initWatchValue)
|
|
188
|
+
}
|
|
189
|
+
this.isLoaded = true
|
|
190
|
+
})
|
|
191
|
+
.catch(error => {
|
|
192
|
+
console.log(error)
|
|
193
|
+
this.isLoaded = true
|
|
194
|
+
})
|
|
195
|
+
} else {
|
|
196
|
+
this.isLoaded = true
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
methods: {
|
|
200
|
+
...dynamicSourceSelectService,
|
|
201
|
+
...events,
|
|
202
|
+
// 必须有该方法,否则无法给字段赋值
|
|
203
|
+
inputValue(newValue) {
|
|
204
|
+
this.$emit('input', newValue)
|
|
205
|
+
if (newValue === null || newValue === undefined || newValue === '') {
|
|
206
|
+
this.remoteQueryMethod(newValue)
|
|
207
|
+
}
|
|
208
|
+
this.setValues(newValue)
|
|
209
|
+
},
|
|
210
|
+
packageDynamicDataSourceInfo(dynamicDataSourceCode, param) {
|
|
211
|
+
return new Promise((resolve, reject) => {
|
|
212
|
+
this.findDynamicDataSourceByCode(
|
|
213
|
+
dynamicDataSourceCode,
|
|
214
|
+
this.entity,
|
|
215
|
+
param,
|
|
216
|
+
this.additionalParameterStr,
|
|
217
|
+
this.backendUrl
|
|
218
|
+
)
|
|
219
|
+
.then(dynamicDataSourceDto => {
|
|
220
|
+
if (dynamicDataSourceDto) {
|
|
221
|
+
if (dynamicDataSourceDto.options) {
|
|
222
|
+
this.optionItems = dynamicDataSourceDto.options
|
|
223
|
+
if (this.watchAttr) {
|
|
224
|
+
// 解决当监控值变化时,数据源重新加载后select输入框中显示的值和下拉中的值不一致问题
|
|
225
|
+
if (this.baseProps.multiple !== undefined && this.baseProps.multiple === true) {
|
|
226
|
+
this.$nextTick(() => {
|
|
227
|
+
this.$refs['dynamicDataSourceRef'].setSelected()
|
|
228
|
+
})
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
//
|
|
232
|
+
if (this.column) { // 只有行编辑时处理
|
|
233
|
+
// 设置选项组数据、 选项组值字段、 映射关系
|
|
234
|
+
if (this.column.prop !== dynamicDataSourceDto.valueAttribute) {
|
|
235
|
+
this.$set(this.column, '_dynamic-source-data-' + this.column.prop,
|
|
236
|
+
{
|
|
237
|
+
valueSetOptions: this.options.valueSetOptions,
|
|
238
|
+
optionItems: this.optionItems,
|
|
239
|
+
valueAttribute: dynamicDataSourceDto.valueAttribute
|
|
240
|
+
})
|
|
241
|
+
}
|
|
242
|
+
for (let i = 0; i < this.options.valueSetOptions.length; i++) {
|
|
243
|
+
const valueSetOption = this.options.valueSetOptions[i]
|
|
244
|
+
if (dynamicDataSourceDto.valueAttribute === valueSetOption.columnName) {
|
|
245
|
+
if (this.markValue) {
|
|
246
|
+
const muMarkValue = JSON.parse(this.markValue)
|
|
247
|
+
if (muMarkValue && muMarkValue[valueSetOption.valueColumn.dbColumnName]) {
|
|
248
|
+
let targeValue = muMarkValue[valueSetOption.valueColumn.dbColumnName].split(',')
|
|
249
|
+
if (this.column.componentType === 'select') {
|
|
250
|
+
// 如果是单选
|
|
251
|
+
targeValue = targeValue[0]
|
|
252
|
+
}
|
|
253
|
+
this.$emit('set-value', {
|
|
254
|
+
value: targeValue,
|
|
255
|
+
targetColumnName: this.column.prop
|
|
256
|
+
})
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
break
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
} else {
|
|
264
|
+
this.optionItems = []
|
|
265
|
+
}
|
|
266
|
+
if (dynamicDataSourceDto.valueAttribute) {
|
|
267
|
+
this.valueAttribute = dynamicDataSourceDto.valueAttribute
|
|
268
|
+
}
|
|
269
|
+
this.valueAttribute = this.getValueAttribute()
|
|
270
|
+
this.watchAttr = dynamicDataSourceDto.watchAttr
|
|
271
|
+
resolve(dynamicDataSourceDto)
|
|
272
|
+
} else {
|
|
273
|
+
resolve()
|
|
274
|
+
}
|
|
275
|
+
})
|
|
276
|
+
.catch(error => {
|
|
277
|
+
reject(error)
|
|
278
|
+
})
|
|
279
|
+
})
|
|
280
|
+
},
|
|
281
|
+
// 远程搜索方法
|
|
282
|
+
remoteQuery(searchText, watchAttrValue) {
|
|
283
|
+
if (
|
|
284
|
+
(searchText !== null && searchText !== undefined) ||
|
|
285
|
+
(watchAttrValue !== null && watchAttrValue !== undefined)
|
|
286
|
+
) {
|
|
287
|
+
const param = {
|
|
288
|
+
_listCode: this.listCode,
|
|
289
|
+
_formCode: this.formCode,
|
|
290
|
+
_tableName: this.tableName }
|
|
291
|
+
if (searchText !== null && searchText !== undefined) {
|
|
292
|
+
param.searchText = searchText
|
|
293
|
+
}
|
|
294
|
+
if (watchAttrValue !== null && watchAttrValue !== undefined) {
|
|
295
|
+
// 监控的属性值改变了远程搜索方法
|
|
296
|
+
if (Object.prototype.toString.apply(watchAttrValue) === '[object Array]') {
|
|
297
|
+
param.watchAttrValue = watchAttrValue.join(',')
|
|
298
|
+
} else {
|
|
299
|
+
param.watchAttrValue = watchAttrValue + ''
|
|
300
|
+
}
|
|
301
|
+
} else if (this.entity) {
|
|
302
|
+
// 搜索时下拉选项的集合
|
|
303
|
+
const watchValue = this.entity[this.watchAttr]
|
|
304
|
+
if (watchValue !== null && watchValue !== undefined) {
|
|
305
|
+
if (Object.prototype.toString.apply(watchValue) === '[object Array]') {
|
|
306
|
+
param.watchAttrValue = watchValue.join(',')
|
|
307
|
+
} else {
|
|
308
|
+
param.watchAttrValue = watchValue + ''
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
if (this.parent) {
|
|
313
|
+
param.parent = this.parent
|
|
314
|
+
}
|
|
315
|
+
this.loading = true
|
|
316
|
+
this.packageDynamicDataSourceInfo(this.dynamicDataSourceCode, param)
|
|
317
|
+
.then(dynamicDataSourceDto => {
|
|
318
|
+
this.loading = false
|
|
319
|
+
})
|
|
320
|
+
.catch(error => {
|
|
321
|
+
console.log(error)
|
|
322
|
+
this.loading = false
|
|
323
|
+
})
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
// 远程搜索方法
|
|
327
|
+
remoteQueryMethod(searchText) {
|
|
328
|
+
if (Array.isArray(this.value)) {
|
|
329
|
+
if (this.value.length === 0) {
|
|
330
|
+
this.remoteQuery(searchText, null)
|
|
331
|
+
}
|
|
332
|
+
} else {
|
|
333
|
+
this.remoteQuery(searchText, null)
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
/**
|
|
337
|
+
* 输入框输入查询值时搜索方法,
|
|
338
|
+
* 不使用remoteQueryMethod, 解决输入框第一次输入时可查询,第二次输入时没有触发查询方法问题
|
|
339
|
+
* @param {*} searchText
|
|
340
|
+
*/
|
|
341
|
+
remoteMethod(searchText) {
|
|
342
|
+
this.remoteQuery(searchText, null)
|
|
343
|
+
},
|
|
344
|
+
// 监控的属性值改变了远程搜索方法
|
|
345
|
+
watchAttrValueChange(watchAttrValues) {
|
|
346
|
+
this.remoteQuery(null, watchAttrValues)
|
|
347
|
+
},
|
|
348
|
+
getValueAttribute() {
|
|
349
|
+
return !this.valueAttribute || this.valueAttribute === '[label]'
|
|
350
|
+
? '_label_'
|
|
351
|
+
: this.valueAttribute
|
|
352
|
+
},
|
|
353
|
+
setValues(newValue) {
|
|
354
|
+
if (this.valueSetOptions && this.valueSetOptions.length > 0) {
|
|
355
|
+
this.valueSetOptions.forEach(columnInfo => {
|
|
356
|
+
const sourceColumnName = columnInfo.columnName
|
|
357
|
+
let value
|
|
358
|
+
if (this.optionItems && sourceColumnName) {
|
|
359
|
+
value = this.getTargetColumnValue(newValue, sourceColumnName)
|
|
360
|
+
}
|
|
361
|
+
let targetColumnName = null
|
|
362
|
+
const targetColumnInfo = columnInfo.valueColumn
|
|
363
|
+
if (targetColumnInfo) {
|
|
364
|
+
targetColumnName = targetColumnInfo.name
|
|
365
|
+
if (this.isSql === true) {
|
|
366
|
+
targetColumnName = targetColumnInfo.dbColumnName
|
|
367
|
+
targetColumnName = getPropNameWhenJoinTable(
|
|
368
|
+
targetColumnName,
|
|
369
|
+
this.isJoinTable,
|
|
370
|
+
this.tableName
|
|
371
|
+
)
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
if (
|
|
375
|
+
this.entity &&
|
|
376
|
+
targetColumnName &&
|
|
377
|
+
targetColumnName !== null &&
|
|
378
|
+
targetColumnName !== ''
|
|
379
|
+
) {
|
|
380
|
+
setEntityFieldValue(this.entity, targetColumnName, value)
|
|
381
|
+
}
|
|
382
|
+
this.$emit('set-value', {
|
|
383
|
+
value: value,
|
|
384
|
+
sourceColumnName: sourceColumnName,
|
|
385
|
+
targetColumnName: targetColumnName,
|
|
386
|
+
options: this.optionItems
|
|
387
|
+
})
|
|
388
|
+
})
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
// 获得目的字段的值
|
|
392
|
+
getTargetColumnValue(newValue, sourceColumnName) {
|
|
393
|
+
if (newValue) {
|
|
394
|
+
let value = ''
|
|
395
|
+
if (
|
|
396
|
+
this.baseProps.multiple !== undefined &&
|
|
397
|
+
this.baseProps.multiple === true &&
|
|
398
|
+
Array.isArray(newValue)
|
|
399
|
+
) {
|
|
400
|
+
// 多选值处理,数组信息,使用逗号分开的格式设置其它字段的值
|
|
401
|
+
let i = 0
|
|
402
|
+
newValue.forEach(itemValue => {
|
|
403
|
+
const items = this.optionItems.filter(
|
|
404
|
+
item => item[this.valueAttribute] === itemValue
|
|
405
|
+
)
|
|
406
|
+
if (items && items.length > 0) {
|
|
407
|
+
value += items[0][sourceColumnName]
|
|
408
|
+
if (i < newValue.length - 1) {
|
|
409
|
+
// 最后一个元素不加逗号
|
|
410
|
+
value += ','
|
|
411
|
+
}
|
|
412
|
+
i++
|
|
413
|
+
}
|
|
414
|
+
})
|
|
415
|
+
} else {
|
|
416
|
+
// 单选
|
|
417
|
+
const items = this.optionItems.filter(
|
|
418
|
+
item => item[this.valueAttribute] === newValue
|
|
419
|
+
)
|
|
420
|
+
if (items && items.length > 0) {
|
|
421
|
+
value = items[0][sourceColumnName]
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
return value
|
|
425
|
+
}
|
|
426
|
+
},
|
|
427
|
+
// 移除所有tag和clear时候清除markValue的值解决清除选项时关联字段清空了但是当前动态数据源控件仍然有值问题
|
|
428
|
+
clearMarkValue() {
|
|
429
|
+
if (this.markValue && this.entity) {
|
|
430
|
+
const muMarkValue = JSON.parse(this.markValue)
|
|
431
|
+
for (let i = 0; i < this.options.valueSetOptions.length; i++) {
|
|
432
|
+
const valueSetOption = this.options.valueSetOptions[i]
|
|
433
|
+
muMarkValue[valueSetOption.valueColumn.dbColumnName] = null
|
|
434
|
+
}
|
|
435
|
+
this.markValue = JSON.stringify(muMarkValue)
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
</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
|