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,872 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<search-form
|
|
4
|
+
v-if="hasLoadedColumns"
|
|
5
|
+
v-show="showSearch"
|
|
6
|
+
ref="sf"
|
|
7
|
+
:columns="columns"
|
|
8
|
+
:code="code"
|
|
9
|
+
:url="url"
|
|
10
|
+
:pagination="pagination"
|
|
11
|
+
:query="query"
|
|
12
|
+
:search-param="searchFormContent"
|
|
13
|
+
:init-search-props="initSearchProps"
|
|
14
|
+
:grid-id="gridId"
|
|
15
|
+
@search="search"
|
|
16
|
+
@reset="resetSearch"
|
|
17
|
+
/>
|
|
18
|
+
<div class="nine-grid-area">
|
|
19
|
+
<div :id="gridId" :style="'height:'+ height+'px;overflow-y: auto;overflow-x: hidden;'">
|
|
20
|
+
<el-row :gutter="20">
|
|
21
|
+
<el-col v-if="isHasCreate" id="_addCardId_" v-permission="createPermission" :span="6" :offset="1.5">
|
|
22
|
+
<el-card :body-style="{ padding: '0px' }">
|
|
23
|
+
<div class="add-screen" @click="add">
|
|
24
|
+
<span style="color:#6882da"> <em class="el-icon-plus" /> {{ $t('superNineGrid.add') }}</span>
|
|
25
|
+
</div>
|
|
26
|
+
</el-card>
|
|
27
|
+
</el-col>
|
|
28
|
+
<el-col v-for="(params,index) in gridData" :key="params.id" :span="6" :offset="1.5" class="col-content">
|
|
29
|
+
<el-card :body-style="{ padding: '0px' }" shadow="hover">
|
|
30
|
+
<div @mouseenter="enter(index)" @mouseleave="leave()" @click="clickContent(params)">
|
|
31
|
+
<transition name="fade">
|
|
32
|
+
<div v-if="seen && index === current" class="popContainer">
|
|
33
|
+
<div class="else-button">
|
|
34
|
+
<template v-for="button in operations">
|
|
35
|
+
<template v-if="isShowButton(params, button)">
|
|
36
|
+
<el-tooltip v-if="button.icon" :key="button.name" v-permission="button.permission?button.permission:'true'" class="item" effect="dark" :content="button.name" placement="top">
|
|
37
|
+
<em :class="button.icon +' icons'" @click.stop="buttonClick(button.event, params)" />
|
|
38
|
+
</el-tooltip>
|
|
39
|
+
<em v-else :key="button.name" v-permission="button.permission?button.permission:'true'" :class="button.name +' icons'" @click.stop="buttonClick(button.event, params)">{{ button.name }} </em>
|
|
40
|
+
</template>
|
|
41
|
+
</template>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</transition>
|
|
45
|
+
<img v-if="props && props.imageUrl && objectPropValue(params, propCloumns.imageUrl, props.imageUrl)" :src="defaultShowImageAction+objectPropValue(params, propCloumns.imageUrl, props.imageUrl)" alt="加载失败" class="image">
|
|
46
|
+
<!-- <img v-if="true || (props && props.imageUrl)" :src="defaultShowImageAction+'fa7ae05e-0f0e-4cc0-b24a-69aea4408233'" alt="加载失败" class="image"> -->
|
|
47
|
+
<div v-else class="image" style="display: table; text-align: center;">
|
|
48
|
+
<div v-if="props && props.content" style="display: table-cell; vertical-align: middle">
|
|
49
|
+
{{ getPropValue('content', params) }}
|
|
50
|
+
</div>
|
|
51
|
+
<div v-else-if="props && props.title" style="display: table-cell; vertical-align: middle">
|
|
52
|
+
{{ getPropValue('title', params) }}
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
<el-divider />
|
|
57
|
+
<div style="padding: 10px 10px 10px 10px;">
|
|
58
|
+
<div class="bottom clearfix">
|
|
59
|
+
<time class="name">
|
|
60
|
+
<span v-if="props && props.title">
|
|
61
|
+
<el-checkbox v-if="multiple" style="width: 100%" :value="selectionModels['select'+params.id]" :true-label="params.id" :false-label="'false-'+params.id" :title="getPropValue('title', params)" @change="changeChecked($event, index)">
|
|
62
|
+
<!-- {{ getPropValue('title', params) }} -->
|
|
63
|
+
<span :style="getTitleStyle(params)"> {{ getPropValue('title', params) }}</span>
|
|
64
|
+
</el-checkbox>
|
|
65
|
+
<el-radio v-else-if="isShowRadio" v-model="currentId" style="width: 100%" :label="params.id" :title="getPropValue('title', params)" @change="changeSelectWhenRadio($event, index)">
|
|
66
|
+
<!-- {{ getPropValue('title', params) }} -->
|
|
67
|
+
<span :style="getTitleStyle(params)"> {{ getPropValue('title', params) }}</span>
|
|
68
|
+
</el-radio>
|
|
69
|
+
<span v-else :style="getTitleStyle(params)" :title="getPropValue('title', params)"> {{ getPropValue('title', params) }}</span>
|
|
70
|
+
</span>
|
|
71
|
+
<span v-else-if="props && props.content">
|
|
72
|
+
<el-checkbox v-if="multiple" style="width: 100%" :value="selectionModels['select'+params.id]" :true-label="params.id" :false-label="'false-'+params.id" :title="getPropValue('content', params)" @change="changeChecked($event, index)">{{ getPropValue('content', params) }}</el-checkbox>
|
|
73
|
+
<el-radio v-else-if="isShowRadio" v-model="currentId" style="width: 100%" :label="params.id" :title="getPropValue('content', params)" @change="changeSelectWhenRadio($event, index)">{{ getPropValue('content', params) }}</el-radio>
|
|
74
|
+
<span v-else style="width: 100%" :title="getPropValue('content', params)"> {{ getPropValue('content', params) }}</span>
|
|
75
|
+
</span>
|
|
76
|
+
<span v-else>
|
|
77
|
+
<el-checkbox v-if="multiple" :value="selectionModels['select'+params.id]" :true-label="params.id" :false-label="'false-'+params.id" @change="changeChecked($event, index)">{{ index + 1 }}</el-checkbox>
|
|
78
|
+
<el-radio v-else-if="isShowRadio" v-model="currentId" :label="params.id" @change="changeSelectWhenRadio($event, index)">{{ index + 1 }}</el-radio>
|
|
79
|
+
<span v-else> {{ index + 1 }}</span>
|
|
80
|
+
</span>
|
|
81
|
+
</time>
|
|
82
|
+
<time v-if="props && props.subTitle" class="state">
|
|
83
|
+
<span :title="getPropValue('subTitle', params)" style="width: 100%">{{ getPropValue('subTitle', params) }}</span>
|
|
84
|
+
</time>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
</el-card>
|
|
88
|
+
</el-col>
|
|
89
|
+
</el-row>
|
|
90
|
+
</div>
|
|
91
|
+
<el-pagination
|
|
92
|
+
v-if="pagination"
|
|
93
|
+
:current-page.sync="currentPage"
|
|
94
|
+
:page-sizes="pagination.pageSizes"
|
|
95
|
+
:page-size="pagination.pageSize"
|
|
96
|
+
:layout="pagination.layout"
|
|
97
|
+
:total="pagination.total"
|
|
98
|
+
@size-change="handleSizeChange"
|
|
99
|
+
@current-change="handleCurrentChange"
|
|
100
|
+
/>
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
</template>
|
|
104
|
+
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
105
|
+
.nine-grid-area {
|
|
106
|
+
padding:10px;
|
|
107
|
+
.el-row {
|
|
108
|
+
margin-bottom: 20px;
|
|
109
|
+
&:last-child {
|
|
110
|
+
margin-bottom: 0;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
.el-col {
|
|
114
|
+
border-radius: 4px;
|
|
115
|
+
margin-bottom: 10px;
|
|
116
|
+
}
|
|
117
|
+
.name {
|
|
118
|
+
font-size: 12px;
|
|
119
|
+
color: #555;
|
|
120
|
+
float: left;
|
|
121
|
+
width: 80%;
|
|
122
|
+
text-align: left;
|
|
123
|
+
}
|
|
124
|
+
.bottom {
|
|
125
|
+
// margin-top: 13px;
|
|
126
|
+
line-height: 13px;
|
|
127
|
+
// background: aquamarine;
|
|
128
|
+
}
|
|
129
|
+
.state {
|
|
130
|
+
font-size: 12px;
|
|
131
|
+
margin-top: 1.5px;
|
|
132
|
+
float: right;
|
|
133
|
+
line-height: 1;
|
|
134
|
+
display: flex;
|
|
135
|
+
align-items: right;
|
|
136
|
+
color: #999;;
|
|
137
|
+
width: 20%;
|
|
138
|
+
text-align: right;
|
|
139
|
+
}
|
|
140
|
+
.image {
|
|
141
|
+
width: 100%;
|
|
142
|
+
display: block;
|
|
143
|
+
height: 200px;
|
|
144
|
+
}
|
|
145
|
+
.clearfix:before,
|
|
146
|
+
.clearfix:after {
|
|
147
|
+
display: table;
|
|
148
|
+
content: "";
|
|
149
|
+
}
|
|
150
|
+
.clearfix:after {
|
|
151
|
+
clear: both
|
|
152
|
+
}
|
|
153
|
+
.input-with-select {
|
|
154
|
+
// background-color: #fff;
|
|
155
|
+
width: 200px;
|
|
156
|
+
float: right;
|
|
157
|
+
}
|
|
158
|
+
.popContainer{
|
|
159
|
+
position: absolute;
|
|
160
|
+
width: 23.15%;
|
|
161
|
+
display: block;
|
|
162
|
+
height: 200px;
|
|
163
|
+
background: rgba(0,0,0,0.5);
|
|
164
|
+
text-align: right;
|
|
165
|
+
}
|
|
166
|
+
.fade-enter-active, .fade-leave-active {
|
|
167
|
+
transition: opacity 0.5s
|
|
168
|
+
}
|
|
169
|
+
.fade-enter, .fade-leave-to {
|
|
170
|
+
opacity: 0
|
|
171
|
+
}
|
|
172
|
+
.icons{
|
|
173
|
+
color:#fff;
|
|
174
|
+
margin: 10px 10px 0px 0px;
|
|
175
|
+
cursor: pointer;
|
|
176
|
+
}
|
|
177
|
+
.release-status{
|
|
178
|
+
display: block;
|
|
179
|
+
width: 8px;
|
|
180
|
+
height: 8px;
|
|
181
|
+
margin-right: 8px;
|
|
182
|
+
border-radius: 100%;
|
|
183
|
+
}
|
|
184
|
+
.add-screen{
|
|
185
|
+
display: flex;
|
|
186
|
+
flex-direction: column;
|
|
187
|
+
justify-content: center;
|
|
188
|
+
align-items: center;
|
|
189
|
+
cursor: pointer;
|
|
190
|
+
height: 230px;
|
|
191
|
+
// background-color: #fff;
|
|
192
|
+
// border: 1px solid #7693f5;
|
|
193
|
+
// box-shadow: 0 2px 8px 0 rgba(104,130,218,.4);
|
|
194
|
+
font-size: 12px;
|
|
195
|
+
}
|
|
196
|
+
.el-divider--horizontal{
|
|
197
|
+
margin: 5px 0;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
</style>
|
|
202
|
+
|
|
203
|
+
<script>
|
|
204
|
+
import customFormatter from './custom-formatter'
|
|
205
|
+
import SearchForm from './search-form'
|
|
206
|
+
import { getGridParams, getTableHeight, isHasOptionFunction } from './utils'
|
|
207
|
+
import store from './store'
|
|
208
|
+
import superGridService from './super-grid-service'
|
|
209
|
+
import apis from './apis'
|
|
210
|
+
import Sortable from 'sortablejs'
|
|
211
|
+
import { addDynamicProp } from './utils'
|
|
212
|
+
import Vue from 'vue'
|
|
213
|
+
export default {
|
|
214
|
+
name: 'SuperNineGrid',
|
|
215
|
+
components: {
|
|
216
|
+
SearchForm
|
|
217
|
+
},
|
|
218
|
+
props: {
|
|
219
|
+
code: {
|
|
220
|
+
type: String,
|
|
221
|
+
default: ''
|
|
222
|
+
},
|
|
223
|
+
url: {
|
|
224
|
+
type: String,
|
|
225
|
+
default: ''
|
|
226
|
+
},
|
|
227
|
+
options: {
|
|
228
|
+
type: Object,
|
|
229
|
+
default: function() {
|
|
230
|
+
return {}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
data() {
|
|
235
|
+
let mergeFields = []
|
|
236
|
+
if (this.options && this.options.mergeFields && this.options.mergeFields !== '') {
|
|
237
|
+
mergeFields = this.options.mergeFields.split(',')
|
|
238
|
+
}
|
|
239
|
+
const defaultShowImageAction = Vue.prototype.baseAPI + '/component/super-form/show-image?serverPath='
|
|
240
|
+
const gridId = this.options && this.options.id ? this.options.id : '_nineGrid'
|
|
241
|
+
const storeId = this.code + '~' + gridId
|
|
242
|
+
const isShowRadio = this.options && this.options.showRadio !== undefined ? this.options.showRadio : false
|
|
243
|
+
return {
|
|
244
|
+
isLoading: false,
|
|
245
|
+
currentPage: 1,
|
|
246
|
+
showColumnConfig: false,
|
|
247
|
+
basicInfo: {
|
|
248
|
+
summary: 'no'
|
|
249
|
+
},
|
|
250
|
+
columns: [],
|
|
251
|
+
pagination: null,
|
|
252
|
+
query: null,
|
|
253
|
+
lineEdit: null,
|
|
254
|
+
gridData: [],
|
|
255
|
+
sortInfo: null,
|
|
256
|
+
pageSize: null,
|
|
257
|
+
showSearch: false,
|
|
258
|
+
height: null,
|
|
259
|
+
isSql: false, // 是否是sql查询
|
|
260
|
+
hasLoadData: false,
|
|
261
|
+
mergeFields,
|
|
262
|
+
hasLoadedColumns: false, // 是否已经加载了列配置
|
|
263
|
+
seen: false,
|
|
264
|
+
current: null,
|
|
265
|
+
isHasCreate: true, // 是否需要新建按钮
|
|
266
|
+
screenBaseUrl: null,
|
|
267
|
+
props: null, // 属性配置
|
|
268
|
+
operations: [], // 指向格子时出现的操作按钮集合
|
|
269
|
+
propCloumns: null, // 属性字段配置详细信息
|
|
270
|
+
multiple: false, // 是否需要多选
|
|
271
|
+
createPermission: 'true', // 新建权限编码,默认是有权限的
|
|
272
|
+
urlToSaveOrder: null, // 拖动格子后台保存接口路径
|
|
273
|
+
selections: [], // 选中的记录集合
|
|
274
|
+
selectionIds: [], // 选中的记录id集合
|
|
275
|
+
selectionModels: {}, // 选中的记录对象
|
|
276
|
+
searchFormContent: null,
|
|
277
|
+
initSearchProps: [], // 初始查询的字段属性名集合
|
|
278
|
+
defaultShowImageAction, // 显示图片的路径
|
|
279
|
+
gridId,
|
|
280
|
+
storeId,
|
|
281
|
+
currentId: null, // 当前点击的记录id
|
|
282
|
+
isShowRadio, // 单选时是否显示单选按钮
|
|
283
|
+
titleStyle: null // 标题的样式对象,格式为:{ color: 'green', fontWeight: 'bold'}
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
computed: {
|
|
287
|
+
},
|
|
288
|
+
provide() {
|
|
289
|
+
return {
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
created() {
|
|
293
|
+
store.set(this.code + '~' + this.gridId, getGridParams())
|
|
294
|
+
store.set('_nine_list_code', this.code + '~' + this.gridId)
|
|
295
|
+
this.initSetting()
|
|
296
|
+
this.initialize()
|
|
297
|
+
// this.showDemo()
|
|
298
|
+
},
|
|
299
|
+
mounted() {
|
|
300
|
+
this.$watch('showSearch', function(newVal, oldVal) {
|
|
301
|
+
this.$nextTick(() => {
|
|
302
|
+
let tableHeight = getTableHeight(newVal, this.$refs.sf)
|
|
303
|
+
const newHeight = this.resizeHeight()
|
|
304
|
+
if (newHeight) {
|
|
305
|
+
tableHeight = newHeight
|
|
306
|
+
}
|
|
307
|
+
this.height = tableHeight
|
|
308
|
+
})
|
|
309
|
+
}, {
|
|
310
|
+
immediate: true,
|
|
311
|
+
deep: true
|
|
312
|
+
})
|
|
313
|
+
|
|
314
|
+
this.$watch('hasLoadData', function(newVal, oldVal) {
|
|
315
|
+
if (newVal === true) {
|
|
316
|
+
this.$nextTick(() => {
|
|
317
|
+
this.rowDrop()
|
|
318
|
+
const gridParams = store.get(this.storeId)
|
|
319
|
+
if (isHasOptionFunction('gridComplete', this.storeId)) {
|
|
320
|
+
gridParams.options.gridComplete.call(this, { gridData: this.gridData, columns: gridParams.columns, superGrid: this.$refs.superGrid })
|
|
321
|
+
}
|
|
322
|
+
const newHeight = this.resizeHeight()
|
|
323
|
+
if (newHeight) {
|
|
324
|
+
this.height = newHeight
|
|
325
|
+
}
|
|
326
|
+
})
|
|
327
|
+
}
|
|
328
|
+
}, {
|
|
329
|
+
immediate: true,
|
|
330
|
+
deep: true
|
|
331
|
+
})
|
|
332
|
+
},
|
|
333
|
+
methods: {
|
|
334
|
+
...superGridService,
|
|
335
|
+
...apis,
|
|
336
|
+
...customFormatter,
|
|
337
|
+
getTitleStyle(entity) {
|
|
338
|
+
// 九宫格的标题自定义样式
|
|
339
|
+
if (this.options && this.options.titleStyle) {
|
|
340
|
+
return this.options.titleStyle.call(this, entity)
|
|
341
|
+
}
|
|
342
|
+
return { width: '100%' }
|
|
343
|
+
},
|
|
344
|
+
// 获得属性值
|
|
345
|
+
getPropValue(type, entity) {
|
|
346
|
+
let value = ''
|
|
347
|
+
const gridParams = store.get(this.storeId)
|
|
348
|
+
if (type === 'content') {
|
|
349
|
+
let content = ''
|
|
350
|
+
if (isHasOptionFunction('setContent', this.storeId)) {
|
|
351
|
+
content = gridParams.options.getContent.call(this, entity)
|
|
352
|
+
}
|
|
353
|
+
if (content === undefined || content === '') {
|
|
354
|
+
if (this.props && this.props.content) {
|
|
355
|
+
content = this.objectPropValue(entity, this.propCloumns.content, this.props.content)
|
|
356
|
+
} else if (this.props && this.props.title) {
|
|
357
|
+
content = this.objectPropValue(entity, this.propCloumns.title, this.props.title)
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
value = content
|
|
361
|
+
} else if (type === 'title') {
|
|
362
|
+
let content = ''
|
|
363
|
+
if (isHasOptionFunction('setTitle', this.storeId)) {
|
|
364
|
+
content = gridParams.options.setTitle.call(this, entity)
|
|
365
|
+
}
|
|
366
|
+
if (content === undefined || content === '') {
|
|
367
|
+
if (this.props && this.props.title) {
|
|
368
|
+
content = this.objectPropValue(entity, this.propCloumns.title, this.props.title)
|
|
369
|
+
} else if (this.props && this.props.content) {
|
|
370
|
+
content = this.objectPropValue(entity, this.propCloumns.content, this.props.content)
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
value = content
|
|
374
|
+
} else if (type === 'subTitle') {
|
|
375
|
+
let content = ''
|
|
376
|
+
if (isHasOptionFunction('setSubTitle', this.storeId)) {
|
|
377
|
+
content = gridParams.options.getSubTitle.call(this, entity)
|
|
378
|
+
}
|
|
379
|
+
if (content === undefined || content === '') {
|
|
380
|
+
if (this.props && this.props.subTitle) {
|
|
381
|
+
content = this.objectPropValue(entity, this.propCloumns.subTitle, this.props.subTitle)
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
value = content
|
|
385
|
+
}
|
|
386
|
+
if (value === undefined) {
|
|
387
|
+
value = ''
|
|
388
|
+
}
|
|
389
|
+
return value
|
|
390
|
+
},
|
|
391
|
+
resizeHeight() {
|
|
392
|
+
const gridParams = store.get(this.storeId)
|
|
393
|
+
if (isHasOptionFunction('resizeHeight', this.storeId)) {
|
|
394
|
+
let searchHeight = 0
|
|
395
|
+
if (this.showSearch === true) {
|
|
396
|
+
if (this.$refs.sf) {
|
|
397
|
+
// 获得查询区高度
|
|
398
|
+
searchHeight = this.$refs.sf.$el.offsetHeight
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
return gridParams.options.resizeHeight.call(this, { code: this.code, height: this.height, searchHeight: searchHeight })
|
|
402
|
+
}
|
|
403
|
+
},
|
|
404
|
+
enter(index) {
|
|
405
|
+
this.seen = true
|
|
406
|
+
this.current = index
|
|
407
|
+
},
|
|
408
|
+
leave() {
|
|
409
|
+
this.seen = false
|
|
410
|
+
this.current = null
|
|
411
|
+
},
|
|
412
|
+
initSetting() {
|
|
413
|
+
const gridParams = store.get(this.storeId)
|
|
414
|
+
if (typeof (this.options) !== 'undefined') {
|
|
415
|
+
Object.assign(gridParams.options, this.options)
|
|
416
|
+
} else {
|
|
417
|
+
gridParams.options = {}
|
|
418
|
+
}
|
|
419
|
+
if (this.options && typeof (this.options.isHasCreate) !== 'undefined') {
|
|
420
|
+
this.isHasCreate = this.options.isHasCreate
|
|
421
|
+
}
|
|
422
|
+
if (this.options && typeof (this.options.props) !== 'undefined') {
|
|
423
|
+
this.props = this.options.props
|
|
424
|
+
}
|
|
425
|
+
if (this.options && typeof (this.options.operations) !== 'undefined') {
|
|
426
|
+
this.operations = this.options.operations
|
|
427
|
+
}
|
|
428
|
+
if (this.options && typeof (this.options.createPermission) !== 'undefined') {
|
|
429
|
+
this.createPermission = this.options.createPermission
|
|
430
|
+
}
|
|
431
|
+
if (this.options && typeof (this.options.multiple) !== 'undefined') {
|
|
432
|
+
this.multiple = this.options.multiple
|
|
433
|
+
}
|
|
434
|
+
},
|
|
435
|
+
// 获得各属性对应的字段配置
|
|
436
|
+
getPropColumns() {
|
|
437
|
+
if (this.columns && this.columns.length > 0) {
|
|
438
|
+
// imageUrl:{column}, content: {column}, title: {}, subTitle:{}
|
|
439
|
+
this.propCloumns = {}
|
|
440
|
+
this.columns.forEach(column => {
|
|
441
|
+
if (this.props.imageUrl && this.props.imageUrl === column.prop) {
|
|
442
|
+
this.propCloumns.imageUrl = column
|
|
443
|
+
}
|
|
444
|
+
if (this.props.content && this.props.content === column.prop) {
|
|
445
|
+
this.propCloumns.content = column
|
|
446
|
+
}
|
|
447
|
+
if (this.props.title && this.props.title === column.prop) {
|
|
448
|
+
this.propCloumns.title = column
|
|
449
|
+
}
|
|
450
|
+
if (this.props.subTitle && this.props.subTitle === column.prop) {
|
|
451
|
+
this.propCloumns.subTitle = column
|
|
452
|
+
}
|
|
453
|
+
})
|
|
454
|
+
}
|
|
455
|
+
},
|
|
456
|
+
fetchData(searchParam, isSearch) {
|
|
457
|
+
return new Promise((resolve, reject) => {
|
|
458
|
+
// 获得各属性对应的字段配置
|
|
459
|
+
this.getPropColumns()
|
|
460
|
+
this.isLoading = true
|
|
461
|
+
this.hasLoadData = false
|
|
462
|
+
if (isSearch === undefined || isSearch === false) {
|
|
463
|
+
// 如果不是查询时才需要从缓存中获得结果
|
|
464
|
+
// 如果是刷新当前列表,则需要获得缓存中的sessionStorage
|
|
465
|
+
const isRefreshList = sessionStorage.getItem('refreshList-' + this.storeId)
|
|
466
|
+
// console.log('fetchData--isRefreshList--', isRefreshList)
|
|
467
|
+
if (isRefreshList !== undefined && isRefreshList === 'true') {
|
|
468
|
+
const searchParamJson = sessionStorage.getItem('searchParam-' + this.storeId)
|
|
469
|
+
// console.log('fetchData--searchParamJson--', searchParamJson)
|
|
470
|
+
// console.log('fetchData--pagination--', this.pagination)
|
|
471
|
+
if (searchParamJson !== undefined && searchParamJson !== null && searchParamJson !== '') {
|
|
472
|
+
searchParam = JSON.parse(searchParamJson)
|
|
473
|
+
const pagination = searchParam.pagination
|
|
474
|
+
if (pagination) {
|
|
475
|
+
this.currentPage = pagination.currentPage
|
|
476
|
+
this.pagination.pageSize = pagination.pageSize
|
|
477
|
+
this.pagination.showTotal = pagination.showTotal
|
|
478
|
+
}
|
|
479
|
+
this.getInitSearchForm(searchParam.searchForm)
|
|
480
|
+
// this.searchFormContent = searchParam.searchForm
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
sessionStorage.removeItem('refreshList-' + this.storeId)
|
|
485
|
+
if (searchParam === undefined) {
|
|
486
|
+
searchParam = this.getSearchParam()
|
|
487
|
+
}
|
|
488
|
+
const gridParams = store.get(this.storeId)
|
|
489
|
+
let param = searchParam
|
|
490
|
+
if (gridParams.options.extraParam) {
|
|
491
|
+
param = {
|
|
492
|
+
searchParam: searchParam
|
|
493
|
+
}
|
|
494
|
+
if (gridParams.options.extraParam) {
|
|
495
|
+
for (const paramName in gridParams.options.extraParam) {
|
|
496
|
+
param[paramName] = gridParams.options.extraParam[paramName]
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
// 导出需要这两个参数
|
|
501
|
+
gridParams.searchParam = searchParam
|
|
502
|
+
gridParams.url = this.url
|
|
503
|
+
const requestUrl = this.url
|
|
504
|
+
// 缓存查询条件及当前页数
|
|
505
|
+
sessionStorage.setItem('searchParam-' + this.storeId, JSON.stringify(param))
|
|
506
|
+
this.$http.post(requestUrl, param).then(data => {
|
|
507
|
+
// 对数据做序列化,比如:处理xss攻击
|
|
508
|
+
if (isHasOptionFunction('gridDataLoaded', this.storeId)) {
|
|
509
|
+
const gridData = gridParams.options.gridDataLoaded.call(this, { gridData: data.data, columns: gridParams.columns })
|
|
510
|
+
if (gridData) {
|
|
511
|
+
this.gridData = gridData
|
|
512
|
+
} else {
|
|
513
|
+
this.gridData = data.data
|
|
514
|
+
}
|
|
515
|
+
} else {
|
|
516
|
+
this.gridData = data.data
|
|
517
|
+
}
|
|
518
|
+
if (!this.gridData) {
|
|
519
|
+
this.gridData = []
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
if (this.pagination !== null) {
|
|
523
|
+
this.pagination.total = data.total
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
gridParams.gridData = this.gridData
|
|
527
|
+
// 完成深拷贝,复制一份对象,行编辑时使用
|
|
528
|
+
gridParams.orgGridData = [].concat(JSON.parse(JSON.stringify(this.gridData)))
|
|
529
|
+
|
|
530
|
+
gridParams.pagination = this.pagination
|
|
531
|
+
gridParams.loaded = true
|
|
532
|
+
this.hasLoadData = true
|
|
533
|
+
resolve()
|
|
534
|
+
}).catch(error => {
|
|
535
|
+
if (isHasOptionFunction('loadError', this.storeId)) {
|
|
536
|
+
gridParams.options.loadError.call(this, this.code, error)
|
|
537
|
+
}
|
|
538
|
+
reject(error)
|
|
539
|
+
})
|
|
540
|
+
})
|
|
541
|
+
},
|
|
542
|
+
// 获得初始查询条件对象
|
|
543
|
+
getInitSearchForm(searchFormArr) {
|
|
544
|
+
const gridParams = store.get(this.storeId)
|
|
545
|
+
if (searchFormArr && searchFormArr.length > 0) {
|
|
546
|
+
this.searchFormContent = {}
|
|
547
|
+
searchFormArr.forEach(item => {
|
|
548
|
+
// 获得的是"isDeleted"
|
|
549
|
+
let prop = item.propName
|
|
550
|
+
// 获得的是“deleted”
|
|
551
|
+
const columnProp = item.columnProp
|
|
552
|
+
const dataType = item.dataType
|
|
553
|
+
if (dataType && dataType === 'BOOLEAN') {
|
|
554
|
+
prop = columnProp
|
|
555
|
+
}
|
|
556
|
+
this.initSearchProps.push(prop)
|
|
557
|
+
const propValue = item.propValue
|
|
558
|
+
if (prop.indexOf('.') > 0) {
|
|
559
|
+
// 动态给searchForm添加属性,包括多级嵌套属性,属性的初始值都为 null
|
|
560
|
+
addDynamicProp(this.searchFormContent, prop, propValue)
|
|
561
|
+
} else {
|
|
562
|
+
this.searchFormContent[prop] = propValue
|
|
563
|
+
}
|
|
564
|
+
})
|
|
565
|
+
gridParams.searchForm = searchFormArr
|
|
566
|
+
// 调用查询api方法,该方法中调用了@showSearch方法,用于控制“查询”按钮改名为“取消查询”
|
|
567
|
+
this.showSearchForm()
|
|
568
|
+
} else {
|
|
569
|
+
gridParams.searchForm = null
|
|
570
|
+
}
|
|
571
|
+
},
|
|
572
|
+
showDemo() {
|
|
573
|
+
this.isLoading = true
|
|
574
|
+
this.$http.get(this.url).then(data => {
|
|
575
|
+
Object.assign(this, data)
|
|
576
|
+
const gridParams = store.get(this.storeId)
|
|
577
|
+
|
|
578
|
+
gridParams.listCode = this.code
|
|
579
|
+
|
|
580
|
+
gridParams.columns = this.columns
|
|
581
|
+
if (gridParams.columns && this.options.dynamicColumns) {
|
|
582
|
+
for (var i = 0; i < this.options.dynamicColumns.length; i++) {
|
|
583
|
+
this.options.dynamicColumns[i].dynamic = true
|
|
584
|
+
gridParams.columns.push(this.options.dynamicColumns[i])
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
gridParams.lineEdit = this.lineEdit
|
|
588
|
+
gridParams.basicInfo = this.basicInfo
|
|
589
|
+
gridParams.pagination = this.pagination
|
|
590
|
+
gridParams.query = this.query
|
|
591
|
+
|
|
592
|
+
this.gridData = data.gridData
|
|
593
|
+
// 对数据做序列化,比如:处理xss攻击
|
|
594
|
+
if (isHasOptionFunction('gridDataLoaded', this.storeId)) {
|
|
595
|
+
const gridData = gridParams.options.gridDataLoaded.call(this, data.gridData)
|
|
596
|
+
if (gridData) {
|
|
597
|
+
this.gridData = gridData
|
|
598
|
+
} else {
|
|
599
|
+
this.gridData = data.gridData
|
|
600
|
+
}
|
|
601
|
+
} else {
|
|
602
|
+
this.gridData = data.gridData
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
if (this.pagination != null) {
|
|
606
|
+
this.pagination.total = data.total
|
|
607
|
+
}
|
|
608
|
+
if (!this.gridData) {
|
|
609
|
+
this.gridData = []
|
|
610
|
+
}
|
|
611
|
+
gridParams.gridData = this.gridData
|
|
612
|
+
// 完成深拷贝,复制一份对象,行编辑时使用
|
|
613
|
+
gridParams.orgGridData = [].concat(JSON.parse(JSON.stringify(this.gridData)))
|
|
614
|
+
gridParams.pagination = this.pagination
|
|
615
|
+
|
|
616
|
+
if (isHasOptionFunction('gridComplete', this.storeId)) {
|
|
617
|
+
gridParams.options.gridComplete.call(this, this.gridData, gridParams.columns)
|
|
618
|
+
}
|
|
619
|
+
}).catch(error => {
|
|
620
|
+
if (isHasOptionFunction('loadError', this.storeId)) {
|
|
621
|
+
const gridParams = store.get(this.storeId)
|
|
622
|
+
gridParams.options.loadError.call(this, this.code, error)
|
|
623
|
+
}
|
|
624
|
+
})
|
|
625
|
+
},
|
|
626
|
+
search(searchForm) {
|
|
627
|
+
const vm = this
|
|
628
|
+
return new Promise((resolve, reject) => {
|
|
629
|
+
const gridParams = store.get(vm.storeId)
|
|
630
|
+
if (typeof (searchForm) !== 'undefined' && searchForm !== null) {
|
|
631
|
+
gridParams.searchForm = searchForm
|
|
632
|
+
} else {
|
|
633
|
+
gridParams.searchForm = null
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
vm.fetchData(vm.getSearchParam(), true).then(data => {
|
|
637
|
+
if (gridParams.options !== undefined && gridParams.options.isHiddenSearchForm !== undefined && gridParams.options.isHiddenSearchForm === true) {
|
|
638
|
+
// 查询时,是否隐藏查询区域,默认是不隐藏查询区域
|
|
639
|
+
vm.showSearch = false
|
|
640
|
+
vm.$emit('cancel-search')
|
|
641
|
+
}
|
|
642
|
+
if (vm.$refs.sf) {
|
|
643
|
+
vm.$refs.sf.loading = false
|
|
644
|
+
}
|
|
645
|
+
resolve(data)
|
|
646
|
+
}).catch((error) => {
|
|
647
|
+
if (vm.$refs.sf) {
|
|
648
|
+
vm.$refs.sf.loading = false
|
|
649
|
+
}
|
|
650
|
+
reject(error)
|
|
651
|
+
})
|
|
652
|
+
})
|
|
653
|
+
},
|
|
654
|
+
getSearchParam() {
|
|
655
|
+
const searchParam = {
|
|
656
|
+
'code': this.code
|
|
657
|
+
}
|
|
658
|
+
const gridParams = store.get(this.storeId)
|
|
659
|
+
if (this.pagination !== null) {
|
|
660
|
+
const pagination = {
|
|
661
|
+
'currentPage': this.currentPage,
|
|
662
|
+
'pageSize': this.pagination.pageSize,
|
|
663
|
+
'showTotal': this.pagination.showTotal
|
|
664
|
+
}
|
|
665
|
+
if (this.pageSize !== null) {
|
|
666
|
+
// 表示更改了每页显示的数据条数
|
|
667
|
+
pagination.pageSize = this.pageSize
|
|
668
|
+
}
|
|
669
|
+
searchParam.pagination = pagination
|
|
670
|
+
}
|
|
671
|
+
// 排序信息
|
|
672
|
+
if (this.sortInfo !== null) {
|
|
673
|
+
// 表示更改了排序信息
|
|
674
|
+
searchParam.sorts = this.sortInfo
|
|
675
|
+
}
|
|
676
|
+
if (this.mergeFields && this.mergeFields.length > 0) {
|
|
677
|
+
if (!searchParam.sorts) {
|
|
678
|
+
searchParam.sorts = []
|
|
679
|
+
}
|
|
680
|
+
const mergeFieldsArr = []
|
|
681
|
+
for (const mergeField of this.mergeFields) {
|
|
682
|
+
let flag = true
|
|
683
|
+
for (const so of searchParam.sorts) {
|
|
684
|
+
if (so.prop === mergeField) {
|
|
685
|
+
flag = false
|
|
686
|
+
break
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
if (flag) {
|
|
690
|
+
mergeFieldsArr.push({
|
|
691
|
+
'prop': mergeField,
|
|
692
|
+
'order': 'ascending'
|
|
693
|
+
})
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
mergeFieldsArr.push(...searchParam.sorts)
|
|
697
|
+
searchParam.sorts = mergeFieldsArr
|
|
698
|
+
}
|
|
699
|
+
// 是否有初始过滤条件
|
|
700
|
+
if (gridParams.options && typeof (gridParams.options.initSearchForm) !== 'undefined') {
|
|
701
|
+
searchParam.initSearchForm = gridParams.options.initSearchForm
|
|
702
|
+
}
|
|
703
|
+
if (typeof (gridParams.searchForm) !== 'undefined') {
|
|
704
|
+
searchParam.searchForm = gridParams.searchForm
|
|
705
|
+
} else {
|
|
706
|
+
searchParam.searchForm = []
|
|
707
|
+
}
|
|
708
|
+
return searchParam
|
|
709
|
+
},
|
|
710
|
+
handleSizeChange(val) {
|
|
711
|
+
this.pageSize = val
|
|
712
|
+
this.fetchData(this.getSearchParam())
|
|
713
|
+
},
|
|
714
|
+
handleCurrentChange(val) {
|
|
715
|
+
this.fetchData(this.getSearchParam())
|
|
716
|
+
},
|
|
717
|
+
handleSortChange({ column, prop, order }) {
|
|
718
|
+
if (prop !== null) {
|
|
719
|
+
// 当点击第3次时,prop会是空,表示清空排序字段,还原原顺序
|
|
720
|
+
this.sortInfo = [{
|
|
721
|
+
'prop': prop,
|
|
722
|
+
'order': order
|
|
723
|
+
}]
|
|
724
|
+
} else {
|
|
725
|
+
this.sortInfo = null
|
|
726
|
+
}
|
|
727
|
+
this.fetchData(this.getSearchParam())
|
|
728
|
+
this.$emit('sort-change', { column, prop, order })
|
|
729
|
+
},
|
|
730
|
+
resetSearch() {
|
|
731
|
+
this.search(null, false)
|
|
732
|
+
},
|
|
733
|
+
// 新建事件
|
|
734
|
+
add() {
|
|
735
|
+
this.$emit('add')
|
|
736
|
+
},
|
|
737
|
+
// 操作按钮的点击事件
|
|
738
|
+
buttonClick(event, data) {
|
|
739
|
+
if (event) {
|
|
740
|
+
if (typeof (event) === 'function') {
|
|
741
|
+
event.call(this, data)
|
|
742
|
+
} else {
|
|
743
|
+
this.$emit(event, data)
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
},
|
|
747
|
+
// 点击内容区域的事件
|
|
748
|
+
clickContent(data) {
|
|
749
|
+
this.changeSelect(data)
|
|
750
|
+
this.$emit('click', data)
|
|
751
|
+
},
|
|
752
|
+
// 格子拖拽
|
|
753
|
+
rowDrop() {
|
|
754
|
+
if (this.urlToSaveOrder) {
|
|
755
|
+
let urlToSaveOrder = this.urlToSaveOrder
|
|
756
|
+
if (urlToSaveOrder.indexOf('http:') < 0 || urlToSaveOrder.indexOf('https:') < 0) {
|
|
757
|
+
// 表示是相对路径,需要拼接全路径
|
|
758
|
+
let baseURL = Vue.prototype.baseURL
|
|
759
|
+
if (baseURL.lastIndexOf('/') === baseURL.length - 1) {
|
|
760
|
+
// 表示以斜线结尾
|
|
761
|
+
// 去掉斜线
|
|
762
|
+
baseURL = baseURL.substring(0, baseURL.length - 1)
|
|
763
|
+
}
|
|
764
|
+
if (urlToSaveOrder.indexOf('/') > 0) {
|
|
765
|
+
// 表示不是以斜线开头,需要开头加“/”
|
|
766
|
+
urlToSaveOrder = '/' + urlToSaveOrder
|
|
767
|
+
}
|
|
768
|
+
urlToSaveOrder = baseURL + urlToSaveOrder
|
|
769
|
+
}
|
|
770
|
+
const tbody = document.querySelector('#' + this.gridId + ' .el-row')
|
|
771
|
+
if (tbody != null) {
|
|
772
|
+
const vm = this
|
|
773
|
+
Sortable.create(tbody, {
|
|
774
|
+
draggable: '.col-content',
|
|
775
|
+
onEnd({ newIndex, oldIndex }) {
|
|
776
|
+
const addCardId = document.querySelector('#' + vm.gridId + ' #_addCardId_')
|
|
777
|
+
if (addCardId != null) {
|
|
778
|
+
// 表示存在新建区域,则序号需要减1
|
|
779
|
+
if (oldIndex > 0) {
|
|
780
|
+
oldIndex = oldIndex - 1
|
|
781
|
+
}
|
|
782
|
+
if (newIndex > 0) {
|
|
783
|
+
newIndex = newIndex - 1
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
const params = {
|
|
787
|
+
'oldIndex': oldIndex,
|
|
788
|
+
'newIndex': newIndex,
|
|
789
|
+
'gridData': vm.gridData
|
|
790
|
+
}
|
|
791
|
+
vm.$http.post(urlToSaveOrder, params).then(data => {
|
|
792
|
+
const currRow = vm.gridData.splice(oldIndex, 1)[0]
|
|
793
|
+
vm.gridData.splice(newIndex, 0, currRow)
|
|
794
|
+
vm.refresh().then(() => {
|
|
795
|
+
vm.$emit('afterDrag', params)
|
|
796
|
+
})
|
|
797
|
+
})
|
|
798
|
+
}
|
|
799
|
+
})
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
},
|
|
803
|
+
// 多选按钮的change事件
|
|
804
|
+
changeChecked(label, index) {
|
|
805
|
+
const entity = this.gridData[index]
|
|
806
|
+
if ((label + '').indexOf('false-') >= 0) {
|
|
807
|
+
// 表示取消勾选记录
|
|
808
|
+
this.unselect(entity)
|
|
809
|
+
} else {
|
|
810
|
+
// 表示勾选记录
|
|
811
|
+
this.select(entity)
|
|
812
|
+
}
|
|
813
|
+
},
|
|
814
|
+
unselect(entity) {
|
|
815
|
+
const id = entity.id
|
|
816
|
+
const index = this.selectionIds.indexOf(id)
|
|
817
|
+
if (index > -1) {
|
|
818
|
+
this.selections.splice(index, 1)
|
|
819
|
+
this.selectionIds.splice(index, 1)
|
|
820
|
+
}
|
|
821
|
+
this.$emit('unselect', entity, this.selections)
|
|
822
|
+
this.$set(this.selectionModels, 'select' + id, 'false-' + id)
|
|
823
|
+
// console.log('unselect---this.selections=', this.selections)
|
|
824
|
+
},
|
|
825
|
+
select(entity) {
|
|
826
|
+
const id = entity.id
|
|
827
|
+
if (this.selectionIds.indexOf(id) < 0) {
|
|
828
|
+
this.$set(this.selectionIds, this.selectionIds.length, id)
|
|
829
|
+
this.$set(this.selections, this.selections.length, entity)
|
|
830
|
+
}
|
|
831
|
+
this.$emit('select', entity, this.selections)
|
|
832
|
+
this.$set(this.selectionModels, 'select' + id, id)
|
|
833
|
+
// console.log('select---this.selections=', this.selections)
|
|
834
|
+
},
|
|
835
|
+
// 单选按钮的change事件
|
|
836
|
+
changeSelectWhenRadio(label, index) {
|
|
837
|
+
const entity = this.gridData[index]
|
|
838
|
+
this.selectionIds = []
|
|
839
|
+
this.selections = []
|
|
840
|
+
this.selectionModels = {}
|
|
841
|
+
this.select(entity)
|
|
842
|
+
},
|
|
843
|
+
changeSelect(data) {
|
|
844
|
+
const id = data.id
|
|
845
|
+
if (this.multiple === true) {
|
|
846
|
+
// 多选时
|
|
847
|
+
if (this.selectionIds && this.selectionIds.indexOf(id) >= 0) {
|
|
848
|
+
// 表示需要取消选中
|
|
849
|
+
this.unselect(data)
|
|
850
|
+
} else {
|
|
851
|
+
// 表示需要选中
|
|
852
|
+
this.select(data)
|
|
853
|
+
}
|
|
854
|
+
} else {
|
|
855
|
+
// 单选时
|
|
856
|
+
this.currentId = id
|
|
857
|
+
this.selectionIds = []
|
|
858
|
+
this.selections = []
|
|
859
|
+
this.selectionModels = {}
|
|
860
|
+
this.select(data)
|
|
861
|
+
}
|
|
862
|
+
},
|
|
863
|
+
isShowButton(entity, button) {
|
|
864
|
+
const val = this.isShowButtonFun(entity, button)
|
|
865
|
+
if (val === undefined) {
|
|
866
|
+
return true
|
|
867
|
+
}
|
|
868
|
+
return val
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
</script>
|