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.
- package/.vscode/extensions.json +3 -0
- package/README.md +7 -0
- package/components/dynamic-source-select/dynamic-source-select-service.js +106 -0
- package/components/dynamic-source-select/dynamic-source-select.vue +673 -0
- package/components/dynamic-source-select/events.js +77 -0
- package/components/fs-preview/fs-preview.vue +287 -0
- package/components/index.js +26 -0
- package/components/plugins/export-data-new.js +623 -0
- package/components/plugins/export-data.js +431 -0
- package/components/plugins/index.js +15 -0
- package/components/plugins/public-method.js +47 -0
- package/components/rich-editor/index-bak.vue +306 -0
- package/components/rich-editor/index.vue +236 -0
- package/components/rich-editor/langs/zh-Hans.js +438 -0
- package/components/rich-editor/viewer.vue +105 -0
- package/components/super-grid/apis.js +1065 -0
- package/components/super-grid/columns-config.vue +430 -0
- package/components/super-grid/custom-formatter.js +330 -0
- package/components/super-grid/dynamic-input.vue +1706 -0
- package/components/super-grid/eventBus.js +2 -0
- package/components/super-grid/events.js +56 -0
- package/components/super-grid/formValidatorUtil.js +300 -0
- package/components/super-grid/formatter.js +190 -0
- package/components/super-grid/group-column.vue +100 -0
- package/components/super-grid/header-context-menu.vue +82 -0
- package/components/super-grid/index-column.vue +69 -0
- package/components/super-grid/normal-column.vue +1148 -0
- package/components/super-grid/public-methods.js +30 -0
- package/components/super-grid/row-operation.vue +193 -0
- package/components/super-grid/search-button.vue +74 -0
- package/components/super-grid/search-condition-input.vue +73 -0
- package/components/super-grid/search-condition-list.vue +68 -0
- package/components/super-grid/search-form-advancedQuery.vue +820 -0
- package/components/super-grid/search-form-dialog.vue +77 -0
- package/components/super-grid/search-form-item.vue +470 -0
- package/components/super-grid/search-form-number.vue +111 -0
- package/components/super-grid/search-form-open.vue +178 -0
- package/components/super-grid/search-form-ordinarySearch.vue +218 -0
- package/components/super-grid/search-form.vue +756 -0
- package/components/super-grid/search-methods.js +484 -0
- package/components/super-grid/selection-column.vue +46 -0
- package/components/super-grid/store.js +3 -0
- package/components/super-grid/super-grid-service.js +682 -0
- package/components/super-grid/super-grid.vue +2893 -0
- package/components/super-grid/utils.js +851 -0
- package/components/super-grid/view-image-dialog.vue +173 -0
- package/components/utils/gogocodeTransfer.js +59 -0
- package/components/utils/utils.js +180 -0
- package/components/utils/value-set.js +98 -0
- package/components/z-test-utton/index.vue +82 -0
- package/package.json +29 -40
- package/public/index.html +13 -0
- package/public/vite.svg +1 -0
- package/src/api/sso-service.js +172 -19
- package/src/api/tab.js +36 -0
- package/src/api/user-service.js +11 -11
- package/src/assets/401/401.gif +0 -0
- package/src/assets/404/404-cloud.png +0 -0
- package/src/assets/404/404.png +0 -0
- package/src/assets/cloud.png +0 -0
- package/src/directives/permission/index.js +13 -13
- package/src/directives/permission/permission.js +20 -15
- package/src/i18n/i18n.js +16 -0
- package/src/i18n/langs/cn.js +254 -0
- package/src/i18n/langs/en.js +264 -0
- package/src/permission.js +157 -71
- package/src/plugins.js +18 -18
- package/src/router/index.js +96 -69
- package/src/store/getters.js +15 -10
- package/src/store/index.js +19 -19
- package/src/store/modules/app.js +54 -42
- package/src/store/modules/permission.js +137 -73
- package/src/store/modules/tab-content.js +36 -0
- package/src/store/modules/user.js +293 -80
- package/src/styles/display-layout.scss +34 -0
- package/src/styles/element-ui.scss +29 -29
- package/src/styles/index.scss +157 -78
- package/src/styles/mixin.scss +27 -27
- package/src/styles/theme/black/font-style.scss +70 -0
- package/src/styles/theme/black/index.scss +306 -0
- package/src/styles/theme/black/sidebar.scss +189 -0
- package/src/styles/theme/blue/font-style.scss +46 -0
- package/src/styles/theme/blue/index.scss +172 -0
- package/src/styles/{sidebar.scss → theme/blue/sidebar.scss} +171 -141
- package/src/styles/theme/blue2/font-style.scss +70 -0
- package/src/styles/theme/blue2/index.scss +188 -0
- package/src/styles/theme/blue2/sidebar.scss +201 -0
- package/src/styles/theme/dark-blue/button.scss +9 -0
- package/src/styles/theme/dark-blue/card.scss +62 -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 +269 -0
- package/src/styles/theme/dark-blue/input.scss +15 -0
- package/src/styles/theme/dark-blue/message.scss +8 -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 +266 -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/card-style.scss +54 -0
- package/src/styles/theme/gray/font-style.scss +70 -0
- package/src/styles/theme/gray/index.scss +172 -0
- package/src/styles/theme/gray/input-style.scss +19 -0
- package/src/styles/theme/gray/scrollbar-style.scss +32 -0
- package/src/styles/theme/gray/sidebar.scss +231 -0
- package/src/styles/theme/gray/tab-style.scss +81 -0
- package/src/styles/transition.scss +47 -46
- package/src/utils/auth-api.js +159 -0
- package/src/utils/auth.js +61 -15
- package/src/utils/calculator/calculator-factory-wf.js +558 -0
- package/src/utils/calculator/calculator-factory.js +145 -0
- package/src/utils/calculator/calculator-util.js +166 -0
- package/src/utils/common-util.js +305 -0
- package/src/utils/eventBus.js +2 -0
- package/src/utils/iconUtils.js +28 -0
- package/src/utils/index.js +102 -86
- package/src/utils/jump-page-utils.js +814 -0
- package/src/utils/local-storage.js +33 -31
- package/src/utils/menu.js +19 -0
- package/src/utils/permission.js +31 -26
- package/src/utils/permissionAuth.js +90 -0
- package/src/utils/range-selector.js +188 -0
- package/src/utils/request.js +270 -116
- package/src/utils/restful-interface-utils.js +57 -0
- package/src/utils/util.js +698 -0
- package/src/utils/validate.js +34 -33
- package/src/utils/watermark.js +108 -0
- package/src/utils/workflow-util.js +93 -0
- package/src/views/404.vue +248 -228
- package/src/views/dsc-component/Sidebar/Item.vue +84 -0
- package/src/views/dsc-component/Sidebar/Link.vue +38 -0
- package/src/views/dsc-component/Sidebar/SidebarItem.vue +196 -0
- package/src/views/dsc-component/Sidebar/index.vue +220 -0
- package/src/views/dsc-component/tabs/tab-content.vue +199 -0
- package/src/views/error-page/401.vue +106 -91
- package/src/views/error-page/404.vue +248 -228
- package/src/views/layout/EmptyLayout.vue +3 -0
- package/src/views/layout/Layout.vue +81 -68
- package/src/views/layout/NewLayout.vue +18 -0
- package/src/views/layout/components/AppMain.vue +39 -29
- package/src/views/layout/components/Breadcrumb/index.vue +156 -0
- package/src/views/layout/components/Menubar/Item.vue +57 -0
- package/src/views/layout/components/Menubar/Link.vue +38 -0
- package/src/views/layout/components/Menubar/SidebarItem.vue +164 -0
- package/src/views/layout/components/Menubar/index.vue +210 -0
- package/src/views/layout/components/Sidebar/Item.vue +53 -29
- package/src/views/layout/components/Sidebar/Link.vue +38 -39
- package/src/views/layout/components/Sidebar/SidebarItem.vue +135 -100
- package/src/views/layout/components/Sidebar/index.vue +141 -48
- package/src/views/layout/components/iframe-page.vue +38 -0
- package/src/views/layout/components/index.js +4 -3
- package/src/views/layout/components/tabs/tab-content.vue +207 -0
- package/src/views/layout/mixin/ResizeHandler.js +41 -41
- package/src/views/layout/tab-content-iframe-index.vue +38 -0
- package/src/views/layout/tab-content-index.vue +93 -0
- package/src/views/login/authredirect.vue +10 -10
- package/src/views/login/index.vue +296 -203
- package/src/views/login/update-password.vue +243 -0
- package/src/views/redirect/index.vue +14 -12
- package/src/views/wf-history/tache-subprocess-history.vue +45 -0
- package/vite.config.js +31 -0
- package/lib/super-ui.css +0 -1
- package/lib/super-ui.umd.min.js +0 -2
- package/src/styles/variables.scss +0 -4
- package/src/views/layout/components/Navbar.vue +0 -92
|
@@ -0,0 +1,756 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<search-condition-list
|
|
4
|
+
v-if="searchConditions.length > 0"
|
|
5
|
+
ref="searchConditionList"
|
|
6
|
+
:search-type="searchType"
|
|
7
|
+
:search-conditions="searchConditions"
|
|
8
|
+
@remove-condition="removeCondition"
|
|
9
|
+
@select-condition="selectCondition"
|
|
10
|
+
/>
|
|
11
|
+
<search-form-ordinarySearch
|
|
12
|
+
v-if="searchType === 'normal'"
|
|
13
|
+
ref="searchFormOrdinarySearch"
|
|
14
|
+
:searchable-columns="searchableColumns"
|
|
15
|
+
:search-form="searchForm"
|
|
16
|
+
:field-num="fieldNum"
|
|
17
|
+
:label-width="labelWidth"
|
|
18
|
+
:query="query"
|
|
19
|
+
:code="code"
|
|
20
|
+
:row-num="rowNum"
|
|
21
|
+
:span-num="spanNum"
|
|
22
|
+
:rules="rules"
|
|
23
|
+
:is-sql="isSql"
|
|
24
|
+
@submit-form="submitForm('searchForm')"
|
|
25
|
+
@reset-form="resetForm('searchForm')"
|
|
26
|
+
@save-condition="saveCondition()"
|
|
27
|
+
@open-fold="openFold"
|
|
28
|
+
/>
|
|
29
|
+
<search-form-advancedQuery
|
|
30
|
+
v-if="searchType === 'advanced'"
|
|
31
|
+
ref="searchFormAdvancedQuery"
|
|
32
|
+
style="padding-bottom: 10px"
|
|
33
|
+
:code="code"
|
|
34
|
+
:searchable-columns="advancedQueryColumns"
|
|
35
|
+
:search-form-list="searchFormList"
|
|
36
|
+
:prop-map="propMap"
|
|
37
|
+
:is-sql="isSql"
|
|
38
|
+
@resetForm="resetSearchFormList"
|
|
39
|
+
/>
|
|
40
|
+
<div
|
|
41
|
+
v-if="searchType === 'advanced'"
|
|
42
|
+
style="padding-top: 10px; padding-bottom: 10px; text-align: center"
|
|
43
|
+
>
|
|
44
|
+
<el-button
|
|
45
|
+
:loading="loading"
|
|
46
|
+
type="primary"
|
|
47
|
+
size="mini"
|
|
48
|
+
@click="submitForm('searchForm')"
|
|
49
|
+
>
|
|
50
|
+
{{ $t('imatrixUIPublicModel.sure') }}
|
|
51
|
+
</el-button>
|
|
52
|
+
<el-button
|
|
53
|
+
:loading="loading"
|
|
54
|
+
size="mini"
|
|
55
|
+
@click="resetForm('searchForm')"
|
|
56
|
+
>
|
|
57
|
+
{{ $t('imatrixUIPublicModel.reset') }}
|
|
58
|
+
</el-button>
|
|
59
|
+
<el-button size="mini" @click="saveCondition">
|
|
60
|
+
{{ $t('superGrid.saveCondition') }}
|
|
61
|
+
</el-button>
|
|
62
|
+
<span
|
|
63
|
+
v-if="
|
|
64
|
+
advancedQuery !== null &&
|
|
65
|
+
advancedQuery !== undefined &&
|
|
66
|
+
advancedQuery === true &&
|
|
67
|
+
normalQuery !== null &&
|
|
68
|
+
normalQuery !== undefined &&
|
|
69
|
+
normalQuery === true
|
|
70
|
+
"
|
|
71
|
+
style="margin-left: 10px"
|
|
72
|
+
>
|
|
73
|
+
<el-button
|
|
74
|
+
v-if="searchType === 'advanced'"
|
|
75
|
+
size="mini"
|
|
76
|
+
@click="searchType = 'normal'"
|
|
77
|
+
>
|
|
78
|
+
{{ $t('imatrixUIPublicModel.switchToNormalQuery') }}
|
|
79
|
+
</el-button>
|
|
80
|
+
<el-button
|
|
81
|
+
v-if="searchType === 'normal'"
|
|
82
|
+
size="mini"
|
|
83
|
+
@click="searchType = 'advanced'"
|
|
84
|
+
>
|
|
85
|
+
{{ $t('imatrixUIPublicModel.switchToAdvancedQuery') }}
|
|
86
|
+
</el-button>
|
|
87
|
+
</span>
|
|
88
|
+
</div>
|
|
89
|
+
<search-condition-input
|
|
90
|
+
v-if="isShowSearchCondition"
|
|
91
|
+
@close="saveConditionValue"
|
|
92
|
+
/>
|
|
93
|
+
</div>
|
|
94
|
+
</template>
|
|
95
|
+
|
|
96
|
+
<script>
|
|
97
|
+
import { $on, $off, $once, $emit } from '../utils/gogocodeTransfer'
|
|
98
|
+
import searchMethods from './search-methods'
|
|
99
|
+
// import searchFormNumber from './search-form-number'
|
|
100
|
+
import searchFormOrdinarySearch from './search-form-ordinarySearch.vue'
|
|
101
|
+
// import searchFormAdvancedQuery from './search-form-advancedQuery'
|
|
102
|
+
import store from './store'
|
|
103
|
+
// import { isOptionFunction, getSearchObject } from './utils'
|
|
104
|
+
import { addDynamicProp, addDynamicPropDateSection } from './utils'
|
|
105
|
+
import * as Vue from 'vue'
|
|
106
|
+
import SearchConditionInput from './search-condition-input.vue'
|
|
107
|
+
import SearchConditionList from './search-condition-list.vue'
|
|
108
|
+
export default {
|
|
109
|
+
name: 'SearchForm',
|
|
110
|
+
components: {
|
|
111
|
+
// searchFormNumber,
|
|
112
|
+
SearchConditionInput,
|
|
113
|
+
SearchConditionList,
|
|
114
|
+
searchFormOrdinarySearch,
|
|
115
|
+
// searchFormAdvancedQuery
|
|
116
|
+
},
|
|
117
|
+
provide() {
|
|
118
|
+
return {
|
|
119
|
+
getListToolbarFormData: () => ({
|
|
120
|
+
listToolbarFormData: this.listToolbarFormData,
|
|
121
|
+
}),
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
props: {
|
|
125
|
+
columns: {
|
|
126
|
+
type: Array,
|
|
127
|
+
default: null,
|
|
128
|
+
},
|
|
129
|
+
code: {
|
|
130
|
+
type: String,
|
|
131
|
+
default: null,
|
|
132
|
+
},
|
|
133
|
+
url: {
|
|
134
|
+
type: String,
|
|
135
|
+
default: null,
|
|
136
|
+
},
|
|
137
|
+
pagination: {
|
|
138
|
+
type: Object,
|
|
139
|
+
default: null,
|
|
140
|
+
},
|
|
141
|
+
query: {
|
|
142
|
+
type: Object,
|
|
143
|
+
default: null,
|
|
144
|
+
},
|
|
145
|
+
searchParam: {
|
|
146
|
+
type: Object,
|
|
147
|
+
default: null,
|
|
148
|
+
},
|
|
149
|
+
initSearchProps: {
|
|
150
|
+
type: Array,
|
|
151
|
+
default: null,
|
|
152
|
+
},
|
|
153
|
+
isSql: {
|
|
154
|
+
type: Boolean,
|
|
155
|
+
default: false,
|
|
156
|
+
},
|
|
157
|
+
searchFormInfo: {
|
|
158
|
+
type: Object,
|
|
159
|
+
default: () => {
|
|
160
|
+
return {}
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
listToolbarFormData: {
|
|
164
|
+
type: Object,
|
|
165
|
+
default: null,
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
data() {
|
|
169
|
+
const customComponentNames = new Set()
|
|
170
|
+
const gridParams = store.get(this.code)
|
|
171
|
+
const propMap = {}
|
|
172
|
+
let searchForm = {}
|
|
173
|
+
if (this.searchParam !== null) {
|
|
174
|
+
searchForm = JSON.parse(JSON.stringify(this.searchParam))
|
|
175
|
+
}
|
|
176
|
+
const searchColumns = this.getSearchableColumns(null, null, propMap)
|
|
177
|
+
if (this.initSearchProps === undefined || this.initSearchProps === null) {
|
|
178
|
+
this.initSearchProps = []
|
|
179
|
+
}
|
|
180
|
+
console.log('searchForm=', searchColumns)
|
|
181
|
+
searchColumns.forEach((column) => {
|
|
182
|
+
// propMap[column.prop] = column
|
|
183
|
+
if (this.initSearchProps.indexOf(column.prop) < 0) {
|
|
184
|
+
// 表示没有默认初始查询字段
|
|
185
|
+
if (column.prop && column.prop.indexOf('.') > 0) {
|
|
186
|
+
if (column.componentType === 'dateSection') {
|
|
187
|
+
addDynamicPropDateSection(searchForm, column.prop)
|
|
188
|
+
} else {
|
|
189
|
+
// 动态给searchForm添加属性,包括多级嵌套属性,属性的初始值都为 null
|
|
190
|
+
addDynamicProp(searchForm, column.prop)
|
|
191
|
+
}
|
|
192
|
+
} else {
|
|
193
|
+
if (column.componentType === 'dateSection') {
|
|
194
|
+
searchForm[column.prop] = [new Date(), new Date()]
|
|
195
|
+
} else if (column.componentType === 'yearRange') {
|
|
196
|
+
searchForm[column.prop] = ['', '']
|
|
197
|
+
} else {
|
|
198
|
+
searchForm[column.prop] = null
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
})
|
|
203
|
+
const spanNum = this.getSpanNum()
|
|
204
|
+
const fieldNum = this.getFieldNumPerRow()
|
|
205
|
+
const rowNum = Math.ceil(searchColumns.length / fieldNum)
|
|
206
|
+
console.log('rowNumrowNumrowNumrowNum', rowNum)
|
|
207
|
+
console.log(searchColumns)
|
|
208
|
+
console.log(fieldNum)
|
|
209
|
+
const advancedQuery = this.query.advancedQuery
|
|
210
|
+
const normalQuery = this.query.normalQuery
|
|
211
|
+
// console.log('searchColumns.length=' + searchColumns.length + ',fieldNum=' + fieldNum + ',rowNum=' + rowNum)
|
|
212
|
+
// // -2是把
|
|
213
|
+
// const dateSpanNum = (spanNum - 2) / 2
|
|
214
|
+
|
|
215
|
+
return {
|
|
216
|
+
searchForm,
|
|
217
|
+
rules: {},
|
|
218
|
+
searchParams: [],
|
|
219
|
+
labelWidth:
|
|
220
|
+
gridParams.options.search && gridParams.options.search.labelWidth
|
|
221
|
+
? gridParams.options.search.labelWidth
|
|
222
|
+
: '80px',
|
|
223
|
+
customComponentNames: customComponentNames,
|
|
224
|
+
componentName: '',
|
|
225
|
+
spanNum: spanNum,
|
|
226
|
+
fieldNum: fieldNum, // 每行放的字段个数
|
|
227
|
+
rowNum: rowNum, // 一共有几行
|
|
228
|
+
loading: false, // 是否正在查询,默认时否
|
|
229
|
+
isShowSearchCondition: false,
|
|
230
|
+
searchConditions: [],
|
|
231
|
+
propMap,
|
|
232
|
+
advancedQuery,
|
|
233
|
+
normalQuery,
|
|
234
|
+
searchFormList: [],
|
|
235
|
+
searchType: null,
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
computed: {
|
|
239
|
+
searchableColumns() {
|
|
240
|
+
return this.getSearchableColumns()
|
|
241
|
+
},
|
|
242
|
+
advancedQueryColumns() {
|
|
243
|
+
return this.getAdvancedQueryColumns()
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
watch: {
|
|
247
|
+
searchForm: {
|
|
248
|
+
deep: true,
|
|
249
|
+
handler(val) {
|
|
250
|
+
this.searchFormInfo['data'] = val
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
created() {
|
|
255
|
+
this.listSearchConditions()
|
|
256
|
+
if (this.normalQuery) {
|
|
257
|
+
this.searchType = 'normal'
|
|
258
|
+
} else if (this.advancedQuery) {
|
|
259
|
+
this.searchType = 'advanced'
|
|
260
|
+
}
|
|
261
|
+
console.log(
|
|
262
|
+
'%c描述-095906',
|
|
263
|
+
'color:#2E3435;background:#F8BB07;padding:3px;border-radius:2px',
|
|
264
|
+
this.searchType
|
|
265
|
+
)
|
|
266
|
+
},
|
|
267
|
+
methods: {
|
|
268
|
+
...searchMethods,
|
|
269
|
+
// 每行放的字段个数
|
|
270
|
+
getFieldNumPerRow() {
|
|
271
|
+
const gridParams = store.get(this.code)
|
|
272
|
+
return gridParams.options.search && gridParams.options.search.fieldNum
|
|
273
|
+
? gridParams.options.search.fieldNum
|
|
274
|
+
: 3
|
|
275
|
+
},
|
|
276
|
+
// 根据每行显示的字段个数,确定栅栏个数,默认是4个字段。最多就只能放6个字段
|
|
277
|
+
getSpanNum() {
|
|
278
|
+
const fieldNum = this.getFieldNumPerRow()
|
|
279
|
+
if (fieldNum === 1) {
|
|
280
|
+
return 22
|
|
281
|
+
} else if (fieldNum === 2) {
|
|
282
|
+
return 10
|
|
283
|
+
} else if (fieldNum === 3) {
|
|
284
|
+
return 8
|
|
285
|
+
} else if (fieldNum === 4) {
|
|
286
|
+
return 6
|
|
287
|
+
} else {
|
|
288
|
+
// 6个字段
|
|
289
|
+
return 4
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
setValueToModelProp(prop, value, componentName, index) {
|
|
293
|
+
if (prop && prop.indexOf('.') > 0) {
|
|
294
|
+
const parentOjbect = this.getParentObject(prop)
|
|
295
|
+
// 嵌套属性中的最后一个属性是属于这个中间父对象的,所有要通过中间父对象来赋值
|
|
296
|
+
if (index != null && index !== undefined) {
|
|
297
|
+
// parentOjbect[prop.substring(prop.lastIndexOf('.') + 1)][index] = value
|
|
298
|
+
parentOjbect[prop.substring(prop.lastIndexOf('.') + 1)][index] = value
|
|
299
|
+
} else {
|
|
300
|
+
parentOjbect[prop.substring(prop.lastIndexOf('.') + 1)] = value
|
|
301
|
+
}
|
|
302
|
+
} else {
|
|
303
|
+
if (index != null && index !== undefined) {
|
|
304
|
+
this.searchForm[prop][index] = value
|
|
305
|
+
} else {
|
|
306
|
+
this.searchForm[prop] = value
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
getAdvancedQueryColumns(columns, searchColumns, propMap) {
|
|
311
|
+
if (!this.customComponentNames) {
|
|
312
|
+
this.customComponentNames = new Set()
|
|
313
|
+
}
|
|
314
|
+
if (!searchColumns) {
|
|
315
|
+
searchColumns = []
|
|
316
|
+
}
|
|
317
|
+
if (!columns) {
|
|
318
|
+
columns = this.columns
|
|
319
|
+
}
|
|
320
|
+
for (let i = 0; i < columns.length; i++) {
|
|
321
|
+
const column = columns[i]
|
|
322
|
+
if (propMap) {
|
|
323
|
+
propMap[column.prop] = column
|
|
324
|
+
}
|
|
325
|
+
if (
|
|
326
|
+
column.prop === '$index' ||
|
|
327
|
+
column.prop === '$selection' ||
|
|
328
|
+
column.dynamic
|
|
329
|
+
) {
|
|
330
|
+
// 序号和复选框列、动态列 不属于该组件的查询字段
|
|
331
|
+
continue
|
|
332
|
+
}
|
|
333
|
+
if (column.groupHeader) {
|
|
334
|
+
// 组合表头中子表头的字段查询
|
|
335
|
+
this.getSearchableColumns(column.children, searchColumns, propMap)
|
|
336
|
+
} else {
|
|
337
|
+
if (
|
|
338
|
+
column.queryType === 'advanced' &&
|
|
339
|
+
!column.custom &&
|
|
340
|
+
column.prop !== ''
|
|
341
|
+
) {
|
|
342
|
+
// 表示是普通查询,且不是占位符列,是查询字段
|
|
343
|
+
if (
|
|
344
|
+
typeof column.componentType === 'undefined' ||
|
|
345
|
+
column.componentType === ''
|
|
346
|
+
) {
|
|
347
|
+
column.componentType = 'input'
|
|
348
|
+
}
|
|
349
|
+
if (column.querySetting && column.querySetting !== '') {
|
|
350
|
+
const querySetting = JSON.parse(column.querySetting)
|
|
351
|
+
if (querySetting.width) {
|
|
352
|
+
column.searchControlWidth = 'width:' + querySetting.width + 'px'
|
|
353
|
+
}
|
|
354
|
+
if (querySetting.labelWidth) {
|
|
355
|
+
column.searchLabelWidth = querySetting.labelWidth + 'px'
|
|
356
|
+
}
|
|
357
|
+
if (querySetting.label) {
|
|
358
|
+
column.searchLabel = querySetting.label
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
// 行编辑时自定义编辑组件
|
|
362
|
+
if (
|
|
363
|
+
column.componentType &&
|
|
364
|
+
column.componentType.indexOf('custom:') >= 0
|
|
365
|
+
) {
|
|
366
|
+
column.componentName = column.componentType.substring(
|
|
367
|
+
column.componentType.indexOf(':') + 1
|
|
368
|
+
)
|
|
369
|
+
this.customComponentNames.add(column.componentName)
|
|
370
|
+
} else {
|
|
371
|
+
column.componentName = ''
|
|
372
|
+
}
|
|
373
|
+
// this.$set(this.propMap, column.prop, column)
|
|
374
|
+
// this.propMap[column.prop] = column
|
|
375
|
+
searchColumns.push(column)
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
return searchColumns
|
|
380
|
+
},
|
|
381
|
+
getSearchableColumns(columns, searchColumns, propMap) {
|
|
382
|
+
if (!this.customComponentNames) {
|
|
383
|
+
this.customComponentNames = new Set()
|
|
384
|
+
}
|
|
385
|
+
if (!searchColumns) {
|
|
386
|
+
searchColumns = []
|
|
387
|
+
}
|
|
388
|
+
if (!columns) {
|
|
389
|
+
columns = this.columns
|
|
390
|
+
}
|
|
391
|
+
for (let i = 0; i < columns.length; i++) {
|
|
392
|
+
const column = columns[i]
|
|
393
|
+
if (propMap) {
|
|
394
|
+
propMap[column.prop] = column
|
|
395
|
+
}
|
|
396
|
+
if (
|
|
397
|
+
column.prop === '$index' ||
|
|
398
|
+
column.prop === '$selection' ||
|
|
399
|
+
column.dynamic
|
|
400
|
+
) {
|
|
401
|
+
// 序号和复选框列、动态列 不属于该组件的查询字段
|
|
402
|
+
continue
|
|
403
|
+
}
|
|
404
|
+
if (column.groupHeader) {
|
|
405
|
+
// 组合表头中子表头的字段查询
|
|
406
|
+
this.getSearchableColumns(column.children, searchColumns, propMap)
|
|
407
|
+
} else {
|
|
408
|
+
if (
|
|
409
|
+
column.queryType === 'normal' &&
|
|
410
|
+
!column.custom &&
|
|
411
|
+
column.prop !== ''
|
|
412
|
+
) {
|
|
413
|
+
// 表示是普通查询,且不是占位符列,是查询字段
|
|
414
|
+
if (
|
|
415
|
+
typeof column.componentType === 'undefined' ||
|
|
416
|
+
column.componentType === ''
|
|
417
|
+
) {
|
|
418
|
+
column.componentType = 'input'
|
|
419
|
+
}
|
|
420
|
+
if (column.querySetting && column.querySetting !== '') {
|
|
421
|
+
const querySetting = JSON.parse(column.querySetting)
|
|
422
|
+
if (querySetting.width) {
|
|
423
|
+
column.searchControlWidth = 'width:' + querySetting.width + 'px'
|
|
424
|
+
}
|
|
425
|
+
if (querySetting.labelWidth) {
|
|
426
|
+
column.searchLabelWidth = querySetting.labelWidth + 'px'
|
|
427
|
+
}
|
|
428
|
+
if (querySetting.label) {
|
|
429
|
+
column.searchLabel = querySetting.label
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
// 行编辑时自定义编辑组件
|
|
433
|
+
if (
|
|
434
|
+
column.componentType &&
|
|
435
|
+
column.componentType.indexOf('custom:') >= 0
|
|
436
|
+
) {
|
|
437
|
+
column.componentName = column.componentType.substring(
|
|
438
|
+
column.componentType.indexOf(':') + 1
|
|
439
|
+
)
|
|
440
|
+
this.customComponentNames.add(column.componentName)
|
|
441
|
+
} else {
|
|
442
|
+
column.componentName = ''
|
|
443
|
+
}
|
|
444
|
+
// this.$set(this.propMap, column.prop, column)
|
|
445
|
+
// this.propMap[column.prop] = column
|
|
446
|
+
searchColumns.push(column)
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
return searchColumns
|
|
451
|
+
},
|
|
452
|
+
customComponent(column) {
|
|
453
|
+
const gridParams = store.get(this.code)
|
|
454
|
+
if (column.componentName && column.componentName !== '') {
|
|
455
|
+
this.customComponentNames.add(column.componentName)
|
|
456
|
+
return true
|
|
457
|
+
}
|
|
458
|
+
if (
|
|
459
|
+
(!column.componentName || column.componentName === '') &&
|
|
460
|
+
gridParams.options &&
|
|
461
|
+
gridParams.options.search &&
|
|
462
|
+
gridParams.options.search.customSearchElements
|
|
463
|
+
) {
|
|
464
|
+
// 定义了自定义查询组件
|
|
465
|
+
const propSearchEle =
|
|
466
|
+
gridParams.options.search.customSearchElements[column.prop]
|
|
467
|
+
// console.log('customComponent-customSearchElements-propSearchEle-', column.prop)
|
|
468
|
+
if (propSearchEle) {
|
|
469
|
+
column.componentName = 'custom-' + column.prop
|
|
470
|
+
const component = propSearchEle.call(this, column)
|
|
471
|
+
// console.log('customComponent-customSearchElements-')
|
|
472
|
+
if (component) {
|
|
473
|
+
this.customComponentNames.add(column.componentName)
|
|
474
|
+
window.$vueApp.component(column.componentName, component)
|
|
475
|
+
return true
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
return false
|
|
480
|
+
},
|
|
481
|
+
submitForm() {
|
|
482
|
+
if (this.searchType === 'normal') {
|
|
483
|
+
this.$refs.searchFormOrdinarySearch.validateForm().then((valid) => {
|
|
484
|
+
if (valid) {
|
|
485
|
+
// this.loading = true
|
|
486
|
+
this.searchParams = this.packageSearchParam()
|
|
487
|
+
$emit(this, 'search', this.searchParams)
|
|
488
|
+
} else {
|
|
489
|
+
return false
|
|
490
|
+
}
|
|
491
|
+
})
|
|
492
|
+
} else if (this.searchType === 'advanced') {
|
|
493
|
+
this.$refs.searchFormAdvancedQuery.validateForm().then((valid) => {
|
|
494
|
+
if (valid) {
|
|
495
|
+
this.loading = true
|
|
496
|
+
this.searchParams = this.packageSearchParam()
|
|
497
|
+
$emit(this, 'search', this.searchParams)
|
|
498
|
+
} else {
|
|
499
|
+
return false
|
|
500
|
+
}
|
|
501
|
+
})
|
|
502
|
+
}
|
|
503
|
+
},
|
|
504
|
+
resetForm() {
|
|
505
|
+
if (this.$refs.searchConditionList) {
|
|
506
|
+
this.$refs.searchConditionList.editConditionId = null
|
|
507
|
+
}
|
|
508
|
+
if (this.searchType === 'normal') {
|
|
509
|
+
this.$refs.searchFormOrdinarySearch.resetForm()
|
|
510
|
+
} else if (this.searchType === 'advanced') {
|
|
511
|
+
this.$refs.searchFormAdvancedQuery.resetForm()
|
|
512
|
+
}
|
|
513
|
+
$emit(this, 'reset')
|
|
514
|
+
},
|
|
515
|
+
setNumberValue(value, r, n) {
|
|
516
|
+
let itemValue = this.getFormItemValue(
|
|
517
|
+
this.searchableColumns[this.fieldNum * (r - 1) + (n - 1)].prop
|
|
518
|
+
)
|
|
519
|
+
itemValue = value
|
|
520
|
+
this.setValueToModelProp(
|
|
521
|
+
this.searchableColumns[this.fieldNum * (r - 1) + (n - 1)].prop,
|
|
522
|
+
itemValue
|
|
523
|
+
)
|
|
524
|
+
},
|
|
525
|
+
listSearchConditions() {
|
|
526
|
+
return new Promise((resolve, reject) => {
|
|
527
|
+
this.listSearchCondition(this.code)
|
|
528
|
+
.then((conditions) => {
|
|
529
|
+
this.searchConditions = conditions
|
|
530
|
+
resolve(conditions)
|
|
531
|
+
})
|
|
532
|
+
.catch((error) => {
|
|
533
|
+
reject(error)
|
|
534
|
+
})
|
|
535
|
+
})
|
|
536
|
+
},
|
|
537
|
+
saveCondition() {
|
|
538
|
+
const searchParams = this.packageSearchParam()
|
|
539
|
+
if (!searchParams || searchParams.length === 0) {
|
|
540
|
+
this.$message({
|
|
541
|
+
type: 'warning',
|
|
542
|
+
message: this.$t('imatrixUIMessage.pleaseInputSearchCondition'),
|
|
543
|
+
showClose: true,
|
|
544
|
+
})
|
|
545
|
+
return
|
|
546
|
+
}
|
|
547
|
+
this.isShowSearchCondition = true
|
|
548
|
+
},
|
|
549
|
+
saveConditionValue(conditionName) {
|
|
550
|
+
if (conditionName) {
|
|
551
|
+
let searchParams
|
|
552
|
+
if (
|
|
553
|
+
this.searchType === 'normal' ||
|
|
554
|
+
this.searchType === '' ||
|
|
555
|
+
this.searchType === null ||
|
|
556
|
+
this.searchType === undefined
|
|
557
|
+
) {
|
|
558
|
+
searchParams = this.packageSearchParam()
|
|
559
|
+
} else {
|
|
560
|
+
searchParams = this.searchFormList
|
|
561
|
+
}
|
|
562
|
+
const condition = {
|
|
563
|
+
listCode: this.code,
|
|
564
|
+
queryType:
|
|
565
|
+
this.searchType === 'normal' ||
|
|
566
|
+
this.searchType === '' ||
|
|
567
|
+
this.searchType === null ||
|
|
568
|
+
this.searchType === undefined
|
|
569
|
+
? 'FIXED'
|
|
570
|
+
: 'CUSTOM',
|
|
571
|
+
name: conditionName,
|
|
572
|
+
queryCondition: JSON.stringify(searchParams),
|
|
573
|
+
}
|
|
574
|
+
this.saveSearchCondition(condition).then((condition) => {
|
|
575
|
+
this.$message({
|
|
576
|
+
type: 'success',
|
|
577
|
+
message: this.$t('imatrixUIMessage.saveSuccessfully'),
|
|
578
|
+
showClose: true,
|
|
579
|
+
})
|
|
580
|
+
this.isShowSearchCondition = false
|
|
581
|
+
this.listSearchConditions().then(() => {
|
|
582
|
+
if (this.$refs.searchConditionList) {
|
|
583
|
+
// 选中刚刚保存的条件
|
|
584
|
+
this.$refs.searchConditionList.editConditionId = condition.id + ''
|
|
585
|
+
}
|
|
586
|
+
// 查询条件对应的数据
|
|
587
|
+
this.selectCondition(condition.id)
|
|
588
|
+
})
|
|
589
|
+
})
|
|
590
|
+
}
|
|
591
|
+
this.isShowSearchCondition = false
|
|
592
|
+
},
|
|
593
|
+
removeCondition(conditionId) {
|
|
594
|
+
if (conditionId) {
|
|
595
|
+
this.$confirm(
|
|
596
|
+
this.$t('imatrixUIMessage.whetherToConfirmDeletion'),
|
|
597
|
+
this.$t('imatrixUIMessage.tips'),
|
|
598
|
+
{
|
|
599
|
+
confirmButtonText: this.$t('imatrixUIPublicModel.sure'),
|
|
600
|
+
cancelButtonText: this.$t('imatrixUIPublicModel.cancel'),
|
|
601
|
+
type: 'warning',
|
|
602
|
+
}
|
|
603
|
+
).then(() => {
|
|
604
|
+
this.removeSearchCondition(conditionId).then(() => {
|
|
605
|
+
this.$message({
|
|
606
|
+
type: 'success',
|
|
607
|
+
message: this.$t('superGrid.deleteSuccessful'),
|
|
608
|
+
showClose: true,
|
|
609
|
+
})
|
|
610
|
+
this.listSearchConditions()
|
|
611
|
+
})
|
|
612
|
+
})
|
|
613
|
+
}
|
|
614
|
+
},
|
|
615
|
+
selectCondition(conditionId) {
|
|
616
|
+
if (conditionId) {
|
|
617
|
+
this.getSearchCondition(conditionId).then((searchCondition) => {
|
|
618
|
+
if (searchCondition) {
|
|
619
|
+
const queryCondition = searchCondition.queryCondition
|
|
620
|
+
if (queryCondition) {
|
|
621
|
+
if (
|
|
622
|
+
this.searchType === 'normal' ||
|
|
623
|
+
this.searchType === '' ||
|
|
624
|
+
this.searchType === null ||
|
|
625
|
+
this.searchType === undefined
|
|
626
|
+
) {
|
|
627
|
+
const searchParams = JSON.parse(queryCondition)
|
|
628
|
+
const searchForm = this.packageSearchForm(searchParams)
|
|
629
|
+
if (searchForm) {
|
|
630
|
+
this.searchForm = searchForm
|
|
631
|
+
}
|
|
632
|
+
// 查询数据
|
|
633
|
+
this.loading = true
|
|
634
|
+
$emit(this, 'search', searchParams)
|
|
635
|
+
} else {
|
|
636
|
+
this.searchFormList = JSON.parse(queryCondition)
|
|
637
|
+
// 查询数据
|
|
638
|
+
this.loading = true
|
|
639
|
+
$emit(this, 'search', this.packageSearchParam())
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
})
|
|
644
|
+
}
|
|
645
|
+
},
|
|
646
|
+
// 封装searchForm
|
|
647
|
+
packageSearchForm(searchFormArr) {
|
|
648
|
+
if (searchFormArr && searchFormArr.length > 0) {
|
|
649
|
+
const searchForm = {}
|
|
650
|
+
const initSearchProps = []
|
|
651
|
+
searchFormArr.forEach((item) => {
|
|
652
|
+
// 获得的是"isDeleted"
|
|
653
|
+
let prop = item.propName
|
|
654
|
+
// 获得的是“deleted”
|
|
655
|
+
const columnProp = item.columnProp
|
|
656
|
+
const dataType = item.dataType
|
|
657
|
+
if (dataType && dataType === 'BOOLEAN' && columnProp) {
|
|
658
|
+
prop = columnProp
|
|
659
|
+
}
|
|
660
|
+
if (initSearchProps.indexOf(prop) === -1) {
|
|
661
|
+
initSearchProps.push(prop)
|
|
662
|
+
}
|
|
663
|
+
const propValue = item.propValue
|
|
664
|
+
if (prop && prop.indexOf('.') > 0) {
|
|
665
|
+
// 动态给searchForm添加属性,包括多级嵌套属性,属性的初始值都为 null
|
|
666
|
+
addDynamicProp(searchForm, prop, propValue)
|
|
667
|
+
} else {
|
|
668
|
+
let isRangeQueryValue = false
|
|
669
|
+
if (dataType && (dataType === 'DATE' || dataType === 'TIME')) {
|
|
670
|
+
if (item.startValue && item.endValue) {
|
|
671
|
+
isRangeQueryValue = true
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
if (isRangeQueryValue) {
|
|
675
|
+
searchForm[prop] = [item.startValue, item.endValue]
|
|
676
|
+
} else {
|
|
677
|
+
if (searchForm[prop]) {
|
|
678
|
+
if (searchForm[prop] instanceof Array) {
|
|
679
|
+
searchForm[prop].push(propValue)
|
|
680
|
+
} else {
|
|
681
|
+
searchForm[prop] = [searchForm[prop], propValue]
|
|
682
|
+
}
|
|
683
|
+
} else {
|
|
684
|
+
searchForm[prop] = propValue
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
})
|
|
689
|
+
|
|
690
|
+
this.searchableColumns.forEach((column) => {
|
|
691
|
+
if (initSearchProps) {
|
|
692
|
+
if (initSearchProps.indexOf(column.prop) < 0) {
|
|
693
|
+
// 表示没有默认初始查询字段
|
|
694
|
+
if (column.prop && column.prop.indexOf('.') > 0) {
|
|
695
|
+
if (column.componentType === 'dateSection') {
|
|
696
|
+
addDynamicPropDateSection(searchForm, column.prop)
|
|
697
|
+
} else {
|
|
698
|
+
// 动态给searchForm添加属性,包括多级嵌套属性,属性的初始值都为 null
|
|
699
|
+
addDynamicProp(searchForm, column.prop)
|
|
700
|
+
}
|
|
701
|
+
} else {
|
|
702
|
+
if (column.componentType === 'dateSection') {
|
|
703
|
+
searchForm[column.prop] = [new Date(), new Date()]
|
|
704
|
+
} else {
|
|
705
|
+
searchForm[column.prop] = null
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
} else {
|
|
709
|
+
if (
|
|
710
|
+
column.componentType === 'multiselect' &&
|
|
711
|
+
searchForm[column.prop]
|
|
712
|
+
) {
|
|
713
|
+
if (!(searchForm[column.prop] instanceof Array)) {
|
|
714
|
+
searchForm[column.prop] = [searchForm[column.prop]]
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
})
|
|
720
|
+
|
|
721
|
+
return searchForm
|
|
722
|
+
}
|
|
723
|
+
},
|
|
724
|
+
resetSearchFormList() {
|
|
725
|
+
this.searchFormList = null
|
|
726
|
+
},
|
|
727
|
+
openFold(isOpen) {
|
|
728
|
+
$emit(this, 'open-fold', isOpen)
|
|
729
|
+
},
|
|
730
|
+
// 查询完毕
|
|
731
|
+
searchComplete() {
|
|
732
|
+
if (this.$refs.searchFormOrdinarySearch) {
|
|
733
|
+
this.$refs.searchFormOrdinarySearch.searchComplete()
|
|
734
|
+
}
|
|
735
|
+
},
|
|
736
|
+
},
|
|
737
|
+
emits: ['search', 'open-fold', 'reset'],
|
|
738
|
+
}
|
|
739
|
+
</script>
|
|
740
|
+
|
|
741
|
+
<style scoped>
|
|
742
|
+
.grid-search-form {
|
|
743
|
+
overflow: auto;
|
|
744
|
+
}
|
|
745
|
+
.grid-search-form >>> .el-form-item {
|
|
746
|
+
margin-bottom: 0px;
|
|
747
|
+
}
|
|
748
|
+
.grid-search-form >>> .search-btn {
|
|
749
|
+
margin-bottom: 5px;
|
|
750
|
+
text-align: center;
|
|
751
|
+
}
|
|
752
|
+
.grid-search-form >>> .el-select,
|
|
753
|
+
.grid-search-form >>> .customComponent {
|
|
754
|
+
width: 100%;
|
|
755
|
+
}
|
|
756
|
+
</style>
|