imatrix-ui 2.8.39-dw → 2.8.39-pvtmp

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