imatrix-ui 2.9.15-dw-tmp2 → 2.9.16-boe1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/lib/super-ui.css +1 -1
  2. package/lib/super-ui.umd.min.js +5 -35
  3. package/package.json +2 -2
  4. package/src/api/sso-service.js +19 -1
  5. package/src/assets/nonemessage.png +0 -0
  6. package/src/i18n/i18n.js +1 -1
  7. package/src/i18n/langs/cn.js +18 -6
  8. package/src/i18n/langs/en.js +20 -7
  9. package/src/permission.js +2 -2
  10. package/src/plugins.js +3 -3
  11. package/src/router/index.js +10 -0
  12. package/src/store/modules/tab-content.js +6 -0
  13. package/src/store/modules/user.js +32 -2
  14. package/src/styles/display-layout.scss +1 -1
  15. package/src/styles/index.scss +74 -4
  16. package/src/styles/theme/black/font-style.scss +70 -0
  17. package/src/styles/theme/black/index.scss +6 -30
  18. package/src/styles/theme/blue/font-style.scss +37 -0
  19. package/src/styles/theme/blue/index.scss +2 -18
  20. package/src/styles/theme/blue2/font-style.scss +70 -0
  21. package/src/styles/theme/blue2/index.scss +3 -13
  22. package/src/styles/theme/dark-blue/card.scss +4 -6
  23. package/src/styles/theme/dark-blue/form.scss +7 -4
  24. package/src/styles/theme/dark-blue/index.scss +30 -5
  25. package/src/styles/theme/dark-blue/message.scss +8 -0
  26. package/src/styles/theme/dark-blue/radio.scss +13 -0
  27. package/src/styles/theme/dark-blue/sidebar.scss +7 -37
  28. package/src/styles/theme/dark-blue/tab.scss +4 -1
  29. package/src/styles/theme/dark-blue/table.scss +1 -1
  30. package/src/styles/theme/dark-blue/tree.scss +35 -10
  31. package/src/styles/theme/gray/card-style.scss +13 -1
  32. package/src/styles/theme/gray/font-style.scss +38 -0
  33. package/src/styles/theme/gray/index.scss +13 -25
  34. package/src/styles/theme/gray/scrollbar-style.scss +32 -0
  35. package/src/styles/theme/gray/sidebar.scss +7 -14
  36. package/src/utils/auth-api.js +47 -1
  37. package/src/utils/common-util.js +22 -81
  38. package/src/utils/jump-page-utils.js +3 -6
  39. package/src/utils/range-selector.js +185 -0
  40. package/src/utils/request.js +6 -3
  41. package/src/utils/util.js +13 -11
  42. package/src/utils/workflow-util.js +3 -0
  43. package/src/views/dsc-component/Sidebar/Item.vue +7 -5
  44. package/src/views/dsc-component/Sidebar/SidebarItem.vue +2 -3
  45. package/src/views/dsc-component/Sidebar/index.vue +12 -20
  46. package/src/views/dsc-component/tabs/tab-content.vue +8 -9
  47. package/src/views/layout/EmptyLayout.vue +4 -1
  48. package/src/views/layout/NewLayout.vue +6 -65
  49. package/src/views/layout/components/AppMain.vue +2 -1
  50. package/src/views/layout/components/Menubar/Item.vue +23 -7
  51. package/src/views/layout/components/Menubar/Link.vue +11 -2
  52. package/src/views/layout/components/Menubar/SidebarItem.vue +50 -7
  53. package/src/views/layout/components/Menubar/index.vue +51 -16
  54. package/src/views/layout/components/tabs/tab-content.vue +162 -0
  55. package/src/views/layout/tab-content-iframe-index.vue +31 -0
  56. package/src/views/layout/tab-content-index.vue +85 -0
  57. package/src/views/login/index.vue +1 -1
  58. package/packages/breadcrumb/index.js +0 -6
  59. package/packages/breadcrumb/src/breadcrumb.vue +0 -71
  60. package/packages/department-tree/index.js +0 -6
  61. package/packages/department-tree/src/department-tree.vue +0 -108
  62. package/packages/department-tree-inline/index.js +0 -6
  63. package/packages/department-tree-inline/src/department-multi-tree-inline.vue +0 -408
  64. package/packages/department-tree-inline/src/department-single-tree-inline.vue +0 -290
  65. package/packages/department-tree-inline/src/department-tree-inline.vue +0 -86
  66. package/packages/department-tree-inline/src/department-tree-service.js +0 -273
  67. package/packages/department-tree-inline/src/search-result.vue +0 -176
  68. package/packages/department-user-tree/index.js +0 -6
  69. package/packages/department-user-tree/src/department-user-multiple-tree.vue +0 -116
  70. package/packages/department-user-tree/src/department-user-single-tree.vue +0 -76
  71. package/packages/department-user-tree/src/department-user-tree.vue +0 -101
  72. package/packages/department-user-tree-inline/index.js +0 -6
  73. package/packages/department-user-tree-inline/src/department-user-multiple-tree-inline.vue +0 -636
  74. package/packages/department-user-tree-inline/src/department-user-single-tree-inline.vue +0 -271
  75. package/packages/department-user-tree-inline/src/department-user-tree-inline.vue +0 -79
  76. package/packages/department-user-tree-inline/src/department-user-tree-multi-service.js +0 -248
  77. package/packages/department-user-tree-inline/src/department-user-tree-single-service.js +0 -142
  78. package/packages/department-user-tree-inline/src/search-result.vue +0 -197
  79. package/packages/directives/prevent-reclick.js +0 -19
  80. package/packages/dynamic-source-select/index.js +0 -6
  81. package/packages/dynamic-source-select/src/dynamic-source-select-service.js +0 -70
  82. package/packages/dynamic-source-select/src/dynamic-source-select.vue +0 -440
  83. package/packages/dynamic-source-select/src/events.js +0 -55
  84. package/packages/fs-preview/index.js +0 -6
  85. package/packages/fs-preview/src/fs-preview.vue +0 -226
  86. package/packages/fs-upload/index.js +0 -6
  87. package/packages/fs-upload/src/fs-upload-multi.vue +0 -420
  88. package/packages/fs-upload/src/fs-upload-single.vue +0 -312
  89. package/packages/fs-upload/src/fs-upload.vue +0 -189
  90. package/packages/fs-upload/src/see-big-picture.vue +0 -55
  91. package/packages/fs-upload-list/index.js +0 -6
  92. package/packages/fs-upload-list/src/fs-upload-list.vue +0 -287
  93. package/packages/hamburger/index.js +0 -6
  94. package/packages/hamburger/src/hamburger.vue +0 -38
  95. package/packages/index.js +0 -121
  96. package/packages/multipart-upload/index.js +0 -6
  97. package/packages/multipart-upload/src/index.vue +0 -73
  98. package/packages/multipart-upload/src/multipart-upload-form.vue +0 -297
  99. package/packages/multipart-upload/src/multipart-upload-list.vue +0 -378
  100. package/packages/organization-input/index.js +0 -6
  101. package/packages/organization-input/src/organization-input.vue +0 -542
  102. package/packages/plugins/export-data-new.js +0 -466
  103. package/packages/plugins/export-data.js +0 -361
  104. package/packages/plugins/index.js +0 -15
  105. package/packages/plugins/public-method.js +0 -43
  106. package/packages/remove-department/index.js +0 -6
  107. package/packages/remove-department/src/remove-department.vue +0 -172
  108. package/packages/remove-department/src/remove-dept-service.js +0 -20
  109. package/packages/remove-user/index.js +0 -6
  110. package/packages/remove-user/src/remove-user-service.js +0 -20
  111. package/packages/remove-user/src/remove-user.vue +0 -195
  112. package/packages/remove-workgroup/index.js +0 -6
  113. package/packages/remove-workgroup/src/remove-workgroup-service.js +0 -20
  114. package/packages/remove-workgroup/src/remove-workgroup.vue +0 -159
  115. package/packages/rich-editor/index.js +0 -7
  116. package/packages/rich-editor/index.vue +0 -278
  117. package/packages/rich-editor/langs/zh-Hans.js +0 -1
  118. package/packages/rich-editor/viewer.vue +0 -103
  119. package/packages/scan-code-input/index.js +0 -6
  120. package/packages/scan-code-input/src/events.js +0 -33
  121. package/packages/scan-code-input/src/scan-code-input-colse.vue +0 -131
  122. package/packages/scan-code-input/src/scan-code-input.vue +0 -116
  123. package/packages/secret-info/index.js +0 -7
  124. package/packages/secret-info/index.vue +0 -90
  125. package/packages/super-grid/index.js +0 -7
  126. package/packages/super-grid/src/apis.js +0 -820
  127. package/packages/super-grid/src/columns-config.vue +0 -335
  128. package/packages/super-grid/src/custom-formatter.js +0 -278
  129. package/packages/super-grid/src/dynamic-input.vue +0 -1279
  130. package/packages/super-grid/src/eventBus.js +0 -2
  131. package/packages/super-grid/src/events.js +0 -55
  132. package/packages/super-grid/src/formValidatorUtil.js +0 -226
  133. package/packages/super-grid/src/formatter.js +0 -181
  134. package/packages/super-grid/src/group-column.vue +0 -100
  135. package/packages/super-grid/src/header-context-menu.vue +0 -87
  136. package/packages/super-grid/src/index-column.vue +0 -51
  137. package/packages/super-grid/src/normal-column.vue +0 -771
  138. package/packages/super-grid/src/public-methods.js +0 -31
  139. package/packages/super-grid/src/row-operation.vue +0 -161
  140. package/packages/super-grid/src/search-button.vue +0 -66
  141. package/packages/super-grid/src/search-condition-input.vue +0 -61
  142. package/packages/super-grid/src/search-condition-list.vue +0 -59
  143. package/packages/super-grid/src/search-form-advancedQuery.vue +0 -653
  144. package/packages/super-grid/src/search-form-dialog.vue +0 -79
  145. package/packages/super-grid/src/search-form-item.vue +0 -404
  146. package/packages/super-grid/src/search-form-number.vue +0 -38
  147. package/packages/super-grid/src/search-form-open.vue +0 -170
  148. package/packages/super-grid/src/search-form-ordinarySearch.vue +0 -196
  149. package/packages/super-grid/src/search-form.vue +0 -642
  150. package/packages/super-grid/src/search-methods.js +0 -448
  151. package/packages/super-grid/src/selection-column.vue +0 -43
  152. package/packages/super-grid/src/store.js +0 -3
  153. package/packages/super-grid/src/super-grid-service.js +0 -593
  154. package/packages/super-grid/src/super-grid.vue +0 -2882
  155. package/packages/super-grid/src/utils.js +0 -762
  156. package/packages/super-grid/src/view-image-dialog.vue +0 -130
  157. package/packages/super-nine-grid/index.js +0 -7
  158. package/packages/super-nine-grid/src/apis.js +0 -103
  159. package/packages/super-nine-grid/src/custom-formatter.js +0 -66
  160. package/packages/super-nine-grid/src/formatter.js +0 -132
  161. package/packages/super-nine-grid/src/search-form-number.vue +0 -38
  162. package/packages/super-nine-grid/src/search-form.vue +0 -430
  163. package/packages/super-nine-grid/src/search-methods.js +0 -134
  164. package/packages/super-nine-grid/src/store.js +0 -3
  165. package/packages/super-nine-grid/src/super-grid-service.js +0 -91
  166. package/packages/super-nine-grid/src/super-nine-grid.vue +0 -872
  167. package/packages/super-nine-grid/src/utils.js +0 -261
  168. package/packages/svg-icon/index.js +0 -6
  169. package/packages/svg-icon/src/svg-icon.vue +0 -43
  170. package/packages/utils/memory-cache-utils.js +0 -90
  171. package/packages/utils/utils.js +0 -152
  172. package/packages/utils/value-set.js +0 -86
  173. package/packages/valid-code/index.js +0 -7
  174. package/packages/valid-code/src/valid-code.vue +0 -95
  175. package/packages/workflow-button/index.js +0 -6
  176. package/packages/workflow-button/src/workflow-button.vue +0 -325
  177. package/packages/workflow-history-list/index.js +0 -6
  178. package/packages/workflow-history-list/src/api.js +0 -7
  179. package/packages/workflow-history-list/src/workflow-history-list.vue +0 -185
  180. package/packages/workgroup-tree/index.js +0 -6
  181. package/packages/workgroup-tree/src/workgroup-tree.vue +0 -76
  182. package/packages/workgroup-tree-inline/index.js +0 -6
  183. package/packages/workgroup-tree-inline/src/workgroup-tree-inline.vue +0 -317
  184. package/packages/workgroup-tree-inline/src/workgroup-tree-service.js +0 -43
  185. package/packages/workgroup-user-tree/index.js +0 -6
  186. package/packages/workgroup-user-tree/src/workgroup-user-tree.vue +0 -100
  187. package/packages/workgroup-user-tree-inline/index.js +0 -6
  188. package/packages/workgroup-user-tree-inline/src/workgroup-tree-inline-service.js +0 -163
  189. package/packages/workgroup-user-tree-inline/src/workgroup-user-tree-inline.vue +0 -436
  190. package/packages/year-range-picker/index.js +0 -6
  191. package/packages/year-range-picker/src/year-range-picker.vue +0 -51
  192. package/src/index.js +0 -93
  193. package/src/styles/theme/gray/form-style.scss +0 -41
@@ -1,872 +0,0 @@
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>