imatrix-ui 0.2.0-up → 0.2.2-up

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/README.md +7 -7
  2. package/index.html +13 -13
  3. package/lib/super-ui.css +1 -1
  4. package/lib/super-ui.js +787 -366
  5. package/lib/super-ui.umd.cjs +18 -18
  6. package/package.json +34 -34
  7. package/packages/IntervalSelection/index.js +6 -6
  8. package/packages/IntervalSelection/src/quarterScope.vue +405 -405
  9. package/packages/IntervalSelection/src/sectionDate.vue +475 -475
  10. package/packages/breadcrumb/index.js +6 -6
  11. package/packages/breadcrumb/src/breadcrumb.vue +81 -81
  12. package/packages/department-tree/index.js +6 -6
  13. package/packages/department-tree/src/department-tree.vue +113 -113
  14. package/packages/department-tree-inline/index.js +6 -6
  15. package/packages/department-tree-inline/src/department-multi-tree-inline.vue +472 -472
  16. package/packages/department-tree-inline/src/department-single-tree-inline.vue +340 -340
  17. package/packages/department-tree-inline/src/department-tree-inline.vue +86 -86
  18. package/packages/department-tree-inline/src/department-tree-service.js +344 -344
  19. package/packages/department-tree-inline/src/search-result.vue +235 -235
  20. package/packages/department-user-tree/index.js +6 -6
  21. package/packages/department-user-tree/src/department-user-multiple-tree.vue +129 -129
  22. package/packages/department-user-tree/src/department-user-single-tree.vue +94 -94
  23. package/packages/department-user-tree/src/department-user-tree.vue +114 -114
  24. package/packages/department-user-tree-inline/index.js +9 -9
  25. package/packages/department-user-tree-inline/src/department-user-multiple-tree-inline.vue +731 -731
  26. package/packages/department-user-tree-inline/src/department-user-single-tree-inline.vue +334 -334
  27. package/packages/department-user-tree-inline/src/department-user-tree-inline.vue +87 -87
  28. package/packages/department-user-tree-inline/src/department-user-tree-multi-service.js +309 -309
  29. package/packages/department-user-tree-inline/src/department-user-tree-single-service.js +179 -179
  30. package/packages/department-user-tree-inline/src/search-result.vue +273 -273
  31. package/packages/directives/prevent-reclick.js +22 -22
  32. package/packages/dynamic-source-select/index.js +6 -6
  33. package/packages/dynamic-source-select/src/dynamic-source-select-service.js +106 -106
  34. package/packages/dynamic-source-select/src/dynamic-source-select.vue +675 -675
  35. package/packages/dynamic-source-select/src/events.js +78 -78
  36. package/packages/fs-preview/index.js +6 -6
  37. package/packages/fs-preview/src/fs-preview.vue +287 -287
  38. package/packages/fs-upload/index.js +6 -6
  39. package/packages/fs-upload/src/fs-upload-multi.vue +443 -443
  40. package/packages/fs-upload/src/fs-upload-single.vue +350 -350
  41. package/packages/fs-upload/src/fs-upload.vue +191 -191
  42. package/packages/fs-upload/src/see-big-picture.vue +67 -67
  43. package/packages/fs-upload-list/index.js +6 -6
  44. package/packages/fs-upload-list/src/fs-upload-list.vue +372 -372
  45. package/packages/hamburger/index.js +6 -6
  46. package/packages/hamburger/src/hamburger.vue +40 -40
  47. package/packages/index.js +125 -123
  48. package/packages/multipart-upload/index.js +6 -6
  49. package/packages/multipart-upload/src/index.vue +66 -66
  50. package/packages/multipart-upload/src/multipart-upload-form.vue +377 -377
  51. package/packages/multipart-upload/src/multipart-upload-list.vue +517 -517
  52. package/packages/organization-input/index.js +6 -6
  53. package/packages/organization-input/src/organization-input.vue +583 -587
  54. package/packages/plugins/export-data-new.js +623 -623
  55. package/packages/plugins/export-data.js +431 -431
  56. package/packages/plugins/index.js +15 -15
  57. package/packages/plugins/public-method.js +47 -47
  58. package/packages/remove-department/index.js +6 -6
  59. package/packages/remove-department/src/remove-department.vue +200 -200
  60. package/packages/remove-department/src/remove-dept-service.js +31 -31
  61. package/packages/remove-user/index.js +6 -6
  62. package/packages/remove-user/src/remove-user-service.js +31 -31
  63. package/packages/remove-user/src/remove-user.vue +226 -226
  64. package/packages/remove-workgroup/index.js +6 -6
  65. package/packages/remove-workgroup/src/remove-workgroup-service.js +31 -31
  66. package/packages/remove-workgroup/src/remove-workgroup.vue +183 -183
  67. package/packages/rich-editor/index.js +7 -7
  68. package/packages/rich-editor/index.vue +297 -297
  69. package/packages/rich-editor/langs/zh-Hans.js +438 -438
  70. package/packages/rich-editor/viewer.vue +105 -105
  71. package/packages/scan-code-input/index.js +6 -6
  72. package/packages/scan-code-input/src/events.js +34 -34
  73. package/packages/scan-code-input/src/scan-code-input-colse.vue +140 -140
  74. package/packages/scan-code-input/src/scan-code-input.vue +132 -132
  75. package/packages/secret-info/index.js +7 -7
  76. package/packages/secret-info/index.vue +100 -100
  77. package/packages/super-grid/index.js +7 -7
  78. package/packages/super-grid/src/apis.js +1092 -1092
  79. package/packages/super-grid/src/columns-config.vue +427 -427
  80. package/packages/super-grid/src/custom-formatter.js +388 -388
  81. package/packages/super-grid/src/eventBus.js +2 -2
  82. package/packages/super-grid/src/events.js +56 -56
  83. package/packages/super-grid/src/formValidatorUtil.js +300 -300
  84. package/packages/super-grid/src/formatter.js +196 -196
  85. package/packages/super-grid/src/group-column.vue +99 -99
  86. package/packages/super-grid/src/header-context-menu.vue +82 -82
  87. package/packages/super-grid/src/index-column.vue +69 -69
  88. package/packages/super-grid/src/normal-column.vue +1221 -1221
  89. package/packages/super-grid/src/public-methods.js +30 -30
  90. package/packages/super-grid/src/row-operation.vue +193 -193
  91. package/packages/super-grid/src/search-button.vue +74 -74
  92. package/packages/super-grid/src/search-condition-input.vue +73 -73
  93. package/packages/super-grid/src/search-condition-list.vue +68 -68
  94. package/packages/super-grid/src/search-form-advancedQuery.vue +819 -826
  95. package/packages/super-grid/src/search-form-dialog.vue +77 -77
  96. package/packages/super-grid/src/search-form-item.vue +495 -495
  97. package/packages/super-grid/src/search-form-number.vue +111 -111
  98. package/packages/super-grid/src/search-form-open.vue +167 -159
  99. package/packages/super-grid/src/search-form-ordinarySearch.vue +239 -233
  100. package/packages/super-grid/src/search-form.vue +762 -765
  101. package/packages/super-grid/src/search-methods.js +592 -592
  102. package/packages/super-grid/src/selection-column.vue +46 -46
  103. package/packages/super-grid/src/super-grid-service.js +728 -728
  104. package/packages/super-grid/src/super-grid.vue +3009 -3009
  105. package/packages/super-grid/src/utils.js +880 -880
  106. package/packages/super-grid/src/view-image-dialog.vue +176 -176
  107. package/packages/super-nine-grid/index.js +7 -7
  108. package/packages/super-nine-grid/src/apis.js +108 -108
  109. package/packages/super-nine-grid/src/custom-formatter.js +73 -73
  110. package/packages/super-nine-grid/src/formatter.js +134 -134
  111. package/packages/super-nine-grid/src/search-form-number.vue +35 -35
  112. package/packages/super-nine-grid/src/search-form.vue +700 -703
  113. package/packages/super-nine-grid/src/search-methods.js +151 -151
  114. package/packages/super-nine-grid/src/super-grid-service.js +107 -107
  115. package/packages/super-nine-grid/src/super-nine-grid.vue +1164 -1164
  116. package/packages/super-nine-grid/src/utils.js +264 -264
  117. package/packages/svg-icon/index.js +6 -6
  118. package/packages/svg-icon/src/svg-icon.vue +43 -43
  119. package/packages/utils/date-util.js +292 -292
  120. package/packages/utils/dom.js +227 -227
  121. package/packages/utils/gogocodeTransfer.js +59 -59
  122. package/packages/utils/memory-cache-utils.js +117 -117
  123. package/packages/utils/utils.js +180 -180
  124. package/packages/utils/value-set.js +97 -97
  125. package/packages/valid-code/index.js +7 -7
  126. package/packages/valid-code/src/valid-code.vue +104 -104
  127. package/packages/workflow-button/index.js +6 -6
  128. package/packages/workflow-button/src/workflow-button.vue +550 -550
  129. package/packages/workflow-history-list/index.js +6 -6
  130. package/packages/workflow-history-list/src/api.js +7 -7
  131. package/packages/workflow-history-list/src/workflow-history-list.vue +291 -291
  132. package/packages/workgroup-tree/index.js +6 -6
  133. package/packages/workgroup-tree/src/workgroup-tree.vue +86 -86
  134. package/packages/workgroup-tree-inline/index.js +6 -6
  135. package/packages/workgroup-tree-inline/src/search-result.vue +222 -222
  136. package/packages/workgroup-tree-inline/src/workgroup-tree-inline.vue +516 -516
  137. package/packages/workgroup-tree-inline/src/workgroup-tree-service.js +93 -93
  138. package/packages/workgroup-user-tree/index.js +6 -6
  139. package/packages/workgroup-user-tree/src/workgroup-user-tree.vue +103 -103
  140. package/packages/workgroup-user-tree-inline/index.js +9 -9
  141. package/packages/workgroup-user-tree-inline/src/search-result.vue +266 -266
  142. package/packages/workgroup-user-tree-inline/src/workgroup-tree-inline-service.js +239 -239
  143. package/packages/workgroup-user-tree-inline/src/workgroup-user-tree-inline.vue +657 -657
  144. package/packages/year-range-picker/index.js +6 -6
  145. package/packages/year-range-picker/src/year-range-picker.vue +53 -53
  146. package/src/api/sso-service.js +172 -172
  147. package/src/api/tab.js +36 -36
  148. package/src/api/user-service.js +11 -11
  149. package/src/directives/permission/index.js +13 -13
  150. package/src/directives/permission/permission.js +20 -20
  151. package/src/i18n/langs/cn.js +259 -259
  152. package/src/i18n/langs/en.js +269 -269
  153. package/src/index.js +93 -93
  154. package/src/permission.js +160 -158
  155. package/src/plugins.js +18 -18
  156. package/src/router/index.js +110 -116
  157. package/src/store/getters.js +15 -15
  158. package/src/store/index.js +19 -19
  159. package/src/store/modules/app.js +54 -54
  160. package/src/store/modules/permission.js +145 -145
  161. package/src/store/modules/tab-content.js +36 -36
  162. package/src/store/modules/user.js +285 -285
  163. package/src/utils/auth-api.js +159 -159
  164. package/src/utils/calculator/calculator-factory-wf.js +558 -558
  165. package/src/utils/calculator/calculator-factory.js +145 -145
  166. package/src/utils/calculator/calculator-util.js +166 -166
  167. package/src/utils/eventBus.js +2 -2
  168. package/src/utils/iconUtils.js +28 -28
  169. package/src/utils/index.js +102 -102
  170. package/src/utils/jump-page-utils.js +824 -824
  171. package/src/utils/local-storage.js +7 -7
  172. package/src/utils/permission.js +31 -31
  173. package/src/utils/permissionAuth.js +96 -96
  174. package/src/utils/range-selector.js +188 -188
  175. package/src/utils/request.js +269 -269
  176. package/src/utils/restful-interface-utils.js +57 -57
  177. package/src/utils/util.js +698 -698
  178. package/src/utils/validate.js +34 -34
  179. package/src/utils/watermark.js +108 -108
  180. package/src/utils/workflow-util.js +93 -93
  181. package/src/views/404.vue +248 -248
  182. package/src/views/dsc-component/Sidebar/Item.vue +84 -84
  183. package/src/views/dsc-component/Sidebar/Link.vue +38 -38
  184. package/src/views/dsc-component/Sidebar/SidebarItem.vue +198 -198
  185. package/src/views/dsc-component/Sidebar/index.vue +228 -228
  186. package/src/views/dsc-component/tabs/tab-content.vue +203 -203
  187. package/src/views/error-page/401.vue +106 -106
  188. package/src/views/error-page/404.vue +248 -248
  189. package/src/views/layout/EmptyLayout.vue +3 -3
  190. package/src/views/layout/Layout.vue +81 -81
  191. package/src/views/layout/NewLayout.vue +18 -18
  192. package/src/views/layout/components/AppMain.vue +39 -39
  193. package/src/views/layout/components/Breadcrumb/index.vue +156 -156
  194. package/src/views/layout/components/Menubar/Item.vue +79 -79
  195. package/src/views/layout/components/Menubar/Link.vue +38 -38
  196. package/src/views/layout/components/Menubar/SidebarItem.vue +164 -164
  197. package/src/views/layout/components/Menubar/index.vue +210 -210
  198. package/src/views/layout/components/Sidebar/Item.vue +53 -53
  199. package/src/views/layout/components/Sidebar/Link.vue +38 -38
  200. package/src/views/layout/components/Sidebar/SidebarItem.vue +135 -135
  201. package/src/views/layout/components/Sidebar/index.vue +141 -141
  202. package/src/views/layout/components/iframe-page.vue +38 -38
  203. package/src/views/layout/components/index.js +4 -4
  204. package/src/views/layout/components/tabs/tab-content.vue +207 -207
  205. package/src/views/layout/mixin/ResizeHandler.js +41 -41
  206. package/src/views/layout/tab-content-iframe-index.vue +38 -38
  207. package/src/views/layout/tab-content-index.vue +93 -93
  208. package/src/views/login/authredirect.vue +10 -10
  209. package/src/views/login/index.vue +296 -296
  210. package/src/views/login/update-password.vue +243 -243
  211. package/src/views/redirect/index.vue +14 -14
  212. package/src/views/wf-history/tache-subprocess-history.vue +45 -45
  213. package/.vscode/extensions.json +0 -3
@@ -1,1164 +1,1164 @@
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
20
- :id="gridId"
21
- :style="'height:' + height + 'px;overflow-y: auto;overflow-x: hidden;'"
22
- >
23
- <el-row :gutter="24">
24
- <el-col
25
- v-if="isHasCreate"
26
- id="_addCardId_"
27
- v-permission="createPermission"
28
- :span="colSpan"
29
- >
30
- <el-card
31
- :body-style="{ padding: '0px' }"
32
- style="
33
- border-radius: 4px;
34
- background: #ffffff;
35
- border: 1px solid #e5e8ef;
36
- "
37
- >
38
- <div class="add-screen" @click="add">
39
- <em class="el-icon-plus" />
40
- <span style="margin-top: 7px">
41
- {{ $t('superNineGrid.add') }}</span
42
- >
43
- </div>
44
- </el-card>
45
- </el-col>
46
- <el-col
47
- v-for="(params, index) in gridData"
48
- :key="params.id"
49
- :span="colSpan"
50
- >
51
- <el-card
52
- :body-style="{ padding: '0px' }"
53
- :style="{
54
- border:
55
- selectionIds.indexOf(params.id) > -1
56
- ? '1px solid #005EBA'
57
- : '',
58
- }"
59
- shadow="hover"
60
- >
61
- <div
62
- style="height: 160px"
63
- @mouseenter="enter(index)"
64
- @mouseleave="leave()"
65
- @click="clickContent(params)"
66
- >
67
- <!-- <transition name="fade">
68
- <div v-if="seen && index === current" class="popContainer">
69
- <div class="else-button">
70
- <template v-for="button in operations">
71
- <template v-if="isShowButton(params, button)">
72
- <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">
73
- <em :class="button.icon +' icons'" @click.stop="buttonClick(button.event, params)" />
74
- </el-tooltip>
75
- <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>
76
- </template>
77
- </template>
78
- </div>
79
- </div>
80
- </transition> -->
81
- <!-- <img v-if="props && props.imageUrl && objectPropValue(params, propCloumns.imageUrl, props.imageUrl)" :src="defaultShowImageAction+objectPropValue(params, propCloumns.imageUrl, props.imageUrl)" alt="加载失败" class="image"> -->
82
- <!-- <img v-if="true || (props && props.imageUrl)" :src="defaultShowImageAction+'fa7ae05e-0f0e-4cc0-b24a-69aea4408233'" alt="加载失败" class="image"> -->
83
- <!-- <div v-else class="image" style="padding: 20px; text-align: center;"> -->
84
- <div
85
- class="image"
86
- style="padding: 15px; box-sizing: border-box"
87
- >
88
- <div>
89
- <el-tooltip
90
- effect="dark"
91
- :content="'系统编码:' + params.code"
92
- placement="top-start"
93
- >
94
- <div
95
- v-if="props && props.content"
96
- style="display: inline-block"
97
- >
98
- {{
99
- getPropValue('content', params) +
100
- getLength(params.code)
101
- }}
102
- </div>
103
- <div
104
- v-else-if="props && props.title"
105
- style="display: inline-block"
106
- >
107
- {{
108
- getPropValue('title', params) + getLength(params.code)
109
- }}
110
- </div>
111
- </el-tooltip>
112
- <div
113
- v-if="showEnableButton(params)"
114
- style="
115
- margin-left: 2px;
116
- color: #00b42a;
117
- background-color: #e8ffea;
118
- width: 68px;
119
- text-align: center;
120
- display: inline-block;
121
- "
122
- >
123
- <em class="el-icon-success" />
124
- <span
125
- :title="getPropValue('subTitle', params)"
126
- style="margin-left: 4px"
127
- >{{ getPropValue('subTitle', params) }}</span
128
- >
129
- </div>
130
- </div>
131
- <div class="button-style">
132
- 操作
133
- <template v-for="button in operations">
134
- <template v-if="isShowButton(params, button)">
135
- <el-tooltip
136
- v-if="button.icon"
137
- v-permission="
138
- button.permission ? button.permission : 'true'
139
- "
140
- :content="button.name"
141
- class="item"
142
- effect="dark"
143
- placement="top"
144
- >
145
- <em
146
- :class="button.icon + ' icons'"
147
- @click.stop="buttonClick(button.event, params)"
148
- />
149
- </el-tooltip>
150
- <em
151
- v-else
152
- v-permission="
153
- button.permission ? button.permission : 'true'
154
- "
155
- :class="button.name + ' icons'"
156
- @click.stop="buttonClick(button.event, params)"
157
- >{{ button.name }}
158
- </em>
159
- </template>
160
- </template>
161
- </div>
162
- <div
163
- v-if="isShowEnableState"
164
- style="float: right; margin-top: 28px"
165
- >
166
- <el-button
167
- v-if="showEnableButton(params)"
168
- size="mini"
169
- @click.stop="changeState(params)"
170
- >
171
- 禁用
172
- </el-button>
173
- <el-button
174
- v-else
175
- size="mini"
176
- type="primary"
177
- @click.stop="changeState(params)"
178
- >
179
- 启用
180
- </el-button>
181
- </div>
182
- </div>
183
- </div>
184
- <!-- <el-divider />
185
- <div style="padding: 10px 10px 10px 10px;">
186
- <div class="bottom clearfix">
187
- <time class="name">
188
- <span v-if="props && props.title">
189
- <el-checkbox v-if="multiple" :value="selectionModels['select'+params.id]" :true-label="params.id" :false-label="'false-'+params.id" :title="getPropValue('title', params)" style="width: 100%" @change="changeChecked($event, index)">
190
- {{ getPropValue('title', params) }}
191
- <span :style="getTitleStyle(params)"> {{ getPropValue('title', params) }}</span>
192
- </el-checkbox>
193
- <el-radio v-else-if="isShowRadio" v-model="currentId" :label="params.id" :title="getPropValue('title', params)" style="width: 100%" @change="changeSelectWhenRadio($event, index)">
194
- {{ getPropValue('title', params) }}
195
- <span :style="getTitleStyle(params)"> {{ getPropValue('title', params) }}</span>
196
- </el-radio>
197
- <span v-else :style="getTitleStyle(params)" :title="getPropValue('title', params)"> {{ getPropValue('title', params) }}</span>
198
- </span>
199
- <span v-else-if="props && props.content">
200
- <el-checkbox v-if="multiple" :value="selectionModels['select'+params.id]" :true-label="params.id" :false-label="'false-'+params.id" :title="getPropValue('content', params)" style="width: 100%" @change="changeChecked($event, index)">{{ getPropValue('content', params) }}</el-checkbox>
201
- <el-radio v-else-if="isShowRadio" v-model="currentId" :label="params.id" :title="getPropValue('content', params)" style="width: 100%" @change="changeSelectWhenRadio($event, index)">{{ getPropValue('content', params) }}</el-radio>
202
- <span v-else :title="getPropValue('content', params)" style="width: 100%"> {{ getPropValue('content', params) }}</span>
203
- </span>
204
- <span v-else>
205
- <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>
206
- <el-radio v-else-if="isShowRadio" v-model="currentId" :label="params.id" @change="changeSelectWhenRadio($event, index)">{{ index + 1 }}</el-radio>
207
- <span v-else> {{ index + 1 }}</span>
208
- </span>
209
- </time>
210
- <time v-if="props && props.subTitle" class="state">
211
- <span :title="getPropValue('subTitle', params)" style="width: 100%">{{ getPropValue('subTitle', params) }}</span>
212
- </time>
213
- </div>
214
- </div> -->
215
- </el-card>
216
- </el-col>
217
- </el-row>
218
- </div>
219
- <el-pagination
220
- v-if="pagination"
221
- v-model:current-page="currentPage"
222
- :page-sizes="pagination.pageSizes"
223
- :page-size="pagination.pageSize"
224
- :layout="pagination.layout"
225
- :total="pagination.total"
226
- @size-change="handleSizeChange"
227
- @current-change="handleCurrentChange"
228
- />
229
- </div>
230
- </div>
231
- </template>
232
-
233
- <script>
234
- import { $on, $off, $once, $emit } from '../../utils/gogocodeTransfer'
235
- import customFormatter from './custom-formatter'
236
- import SearchForm from './search-form.vue'
237
- import { getGridParams, getTableHeight, isHasOptionFunction } from './utils'
238
- import store from './store'
239
- import superGridService from './super-grid-service'
240
- import apis from './apis'
241
- import Sortable from 'sortablejs'
242
- import { addDynamicProp } from './utils'
243
- import * as Vue from 'vue'
244
- export default {
245
- name: 'SuperNineGrid',
246
- components: {
247
- SearchForm,
248
- },
249
- props: {
250
- code: {
251
- type: String,
252
- default: '',
253
- },
254
- url: {
255
- type: String,
256
- default: '',
257
- },
258
- options: {
259
- type: Object,
260
- default: function () {
261
- return {}
262
- },
263
- },
264
- },
265
- data() {
266
- let mergeFields = []
267
- if (
268
- this.options &&
269
- this.options.mergeFields &&
270
- this.options.mergeFields !== ''
271
- ) {
272
- mergeFields = this.options.mergeFields.split(',')
273
- }
274
- const defaultShowImageAction =
275
- window.$vueApp.config.globalProperties.baseAPI +
276
- '/component/super-form/show-image?serverPath='
277
- const gridId =
278
- this.options && this.options.id ? this.options.id : '_nineGrid'
279
- const storeId = this.code + '~' + gridId
280
- const isShowRadio =
281
- this.options && this.options.showRadio !== undefined
282
- ? this.options.showRadio
283
- : false
284
- return {
285
- isLoading: false,
286
- currentPage: 1,
287
- showColumnConfig: false,
288
- basicInfo: {
289
- summary: 'no',
290
- },
291
- columns: [],
292
- pagination: null,
293
- query: null,
294
- lineEdit: null,
295
- gridData: [],
296
- sortInfo: null,
297
- pageSize: null,
298
- showSearch: false,
299
- height: null,
300
- isSql: false, // 是否是sql查询
301
- hasLoadData: false,
302
- mergeFields,
303
- hasLoadedColumns: false, // 是否已经加载了列配置
304
- seen: false,
305
- current: null,
306
- isHasCreate: true, // 是否需要新建按钮
307
- screenBaseUrl: null,
308
- props: null, // 属性配置
309
- operations: [], // 指向格子时出现的操作按钮集合
310
- propCloumns: null, // 属性字段配置详细信息
311
- multiple: false, // 是否需要多选
312
- createPermission: 'true', // 新建权限编码,默认是有权限的
313
- urlToSaveOrder: null, // 拖动格子后台保存接口路径
314
- selections: [], // 选中的记录集合
315
- selectionIds: [], // 选中的记录id集合
316
- selectionModels: {}, // 选中的记录对象
317
- searchFormContent: null,
318
- initSearchProps: [], // 初始查询的字段属性名集合
319
- defaultShowImageAction, // 显示图片的路径
320
- gridId,
321
- storeId,
322
- currentId: null, // 当前点击的记录id
323
- isShowRadio, // 单选时是否显示单选按钮
324
- titleStyle: null, // 标题的样式对象,格式为:{ color: 'green', fontWeight: 'bold'}
325
- isShowEnableState: false,
326
- colSpan: 6,
327
- }
328
- },
329
- computed: {},
330
- provide() {
331
- return {}
332
- },
333
- created() {
334
- store.set(this.code + '~' + this.gridId, getGridParams())
335
- store.set('_nine_list_code', this.code + '~' + this.gridId)
336
- this.initSetting()
337
- this.initialize()
338
- // this.showDemo()
339
- },
340
- mounted() {
341
- this.$watch(
342
- 'showSearch',
343
- function (newVal, oldVal) {
344
- this.$nextTick(() => {
345
- let tableHeight = getTableHeight(newVal, this.$refs.sf)
346
- const newHeight = this.resizeHeight()
347
- if (newHeight) {
348
- tableHeight = newHeight
349
- }
350
- this.height = tableHeight
351
- })
352
- },
353
- {
354
- immediate: true,
355
- deep: true,
356
- }
357
- )
358
-
359
- this.$watch(
360
- 'hasLoadData',
361
- function (newVal, oldVal) {
362
- if (newVal === true) {
363
- this.$nextTick(() => {
364
- this.rowDrop()
365
- const gridParams = store.get(this.storeId)
366
- if (isHasOptionFunction('gridComplete', this.storeId)) {
367
- gridParams.options.gridComplete.call(this, {
368
- gridData: this.gridData,
369
- columns: gridParams.columns,
370
- superGrid: this.$refs.superGrid,
371
- })
372
- }
373
- const newHeight = this.resizeHeight()
374
- if (newHeight) {
375
- this.height = newHeight
376
- }
377
- })
378
- }
379
- },
380
- {
381
- immediate: true,
382
- deep: true,
383
- }
384
- )
385
- },
386
- methods: {
387
- ...superGridService,
388
- ...apis,
389
- ...customFormatter,
390
- getTitleStyle(entity) {
391
- // 九宫格的标题自定义样式
392
- if (this.options && this.options.titleStyle) {
393
- return this.options.titleStyle.call(this, entity)
394
- }
395
- return { width: '100%' }
396
- },
397
- // 获得属性值
398
- getPropValue(type, entity) {
399
- let value = ''
400
- const gridParams = store.get(this.storeId)
401
- if (type === 'content') {
402
- let content = ''
403
- if (isHasOptionFunction('setContent', this.storeId)) {
404
- content = gridParams.options.getContent.call(this, entity)
405
- }
406
- if (content === undefined || content === '') {
407
- if (this.props && this.props.content) {
408
- content = this.objectPropValue(
409
- entity,
410
- this.propCloumns.content,
411
- this.props.content
412
- )
413
- } else if (this.props && this.props.title) {
414
- content = this.objectPropValue(
415
- entity,
416
- this.propCloumns.title,
417
- this.props.title
418
- )
419
- }
420
- }
421
- value = content
422
- } else if (type === 'title') {
423
- let content = ''
424
- if (isHasOptionFunction('setTitle', this.storeId)) {
425
- content = gridParams.options.setTitle.call(this, entity)
426
- }
427
- if (content === undefined || content === '') {
428
- if (this.props && this.props.title) {
429
- content = this.objectPropValue(
430
- entity,
431
- this.propCloumns.title,
432
- this.props.title
433
- )
434
- } else if (this.props && this.props.content) {
435
- content = this.objectPropValue(
436
- entity,
437
- this.propCloumns.content,
438
- this.props.content
439
- )
440
- }
441
- }
442
- value = content
443
- } else if (type === 'subTitle') {
444
- let content = ''
445
- if (isHasOptionFunction('setSubTitle', this.storeId)) {
446
- content = gridParams.options.setSubTitle.call(this, entity)
447
- }
448
- if (content === undefined || content === '') {
449
- if (this.props && this.props.subTitle) {
450
- content = this.objectPropValue(
451
- entity,
452
- this.propCloumns.subTitle,
453
- this.props.subTitle
454
- )
455
- }
456
- }
457
- value = content
458
- }
459
- if (value === undefined) {
460
- value = ''
461
- }
462
- return value
463
- },
464
- resizeHeight() {
465
- const gridParams = store.get(this.storeId)
466
- if (isHasOptionFunction('resizeHeight', this.storeId)) {
467
- let searchHeight = 0
468
- if (this.showSearch === true) {
469
- if (this.$refs.sf) {
470
- // 获得查询区高度
471
- searchHeight = this.$refs.sf.$el.offsetHeight
472
- }
473
- }
474
- return gridParams.options.resizeHeight.call(this, {
475
- code: this.code,
476
- height: this.height,
477
- searchHeight: searchHeight,
478
- })
479
- }
480
- },
481
- enter(index) {
482
- this.seen = true
483
- this.current = index
484
- },
485
- leave() {
486
- this.seen = false
487
- this.current = null
488
- },
489
- initSetting() {
490
- const gridParams = store.get(this.storeId)
491
- if (typeof this.options !== 'undefined') {
492
- Object.assign(gridParams.options, this.options)
493
- } else {
494
- gridParams.options = {}
495
- }
496
- if (this.options && typeof this.options.isHasCreate !== 'undefined') {
497
- this.isHasCreate = this.options.isHasCreate
498
- }
499
- if (this.options && typeof this.options.props !== 'undefined') {
500
- this.props = this.options.props
501
- }
502
- if (this.options && typeof this.options.operations !== 'undefined') {
503
- this.operations = this.options.operations
504
- }
505
- if (
506
- this.options &&
507
- typeof this.options.createPermission !== 'undefined'
508
- ) {
509
- this.createPermission = this.options.createPermission
510
- }
511
- if (this.options && typeof this.options.multiple !== 'undefined') {
512
- this.multiple = this.options.multiple
513
- }
514
- if (
515
- this.options &&
516
- typeof this.options.isShowEnableState !== 'undefined'
517
- ) {
518
- this.isShowEnableState = this.options.isShowEnableState
519
- }
520
- if (this.options && typeof this.options.colSpan !== 'undefined') {
521
- this.colSpan = this.options.colSpan
522
- }
523
- },
524
- // 获得各属性对应的字段配置
525
- getPropColumns() {
526
- if (this.columns && this.columns.length > 0) {
527
- // imageUrl:{column}, content: {column}, title: {}, subTitle:{}
528
- this.propCloumns = {}
529
- this.columns.forEach((column) => {
530
- if (this.props.imageUrl && this.props.imageUrl === column.prop) {
531
- this.propCloumns.imageUrl = column
532
- }
533
- if (this.props.content && this.props.content === column.prop) {
534
- this.propCloumns.content = column
535
- }
536
- if (this.props.title && this.props.title === column.prop) {
537
- this.propCloumns.title = column
538
- }
539
- if (this.props.subTitle && this.props.subTitle === column.prop) {
540
- this.propCloumns.subTitle = column
541
- }
542
- })
543
- }
544
- },
545
- fetchData(searchParam, isSearch) {
546
- return new Promise((resolve, reject) => {
547
- // 获得各属性对应的字段配置
548
- this.getPropColumns()
549
- this.isLoading = true
550
- this.hasLoadData = false
551
- if (isSearch === undefined || isSearch === false) {
552
- // 如果不是查询时才需要从缓存中获得结果
553
- // 如果是刷新当前列表,则需要获得缓存中的window.sessionStorage
554
- const isRefreshList = window.sessionStorage.getItem(
555
- 'refreshList-' + this.storeId
556
- )
557
- // console.log('fetchData--isRefreshList--', isRefreshList)
558
- if (isRefreshList !== undefined && isRefreshList === 'true') {
559
- const searchParamJson = window.sessionStorage.getItem(
560
- 'searchParam-' + this.storeId
561
- )
562
- // console.log('fetchData--searchParamJson--', searchParamJson)
563
- // console.log('fetchData--pagination--', this.pagination)
564
- if (
565
- searchParamJson !== undefined &&
566
- searchParamJson !== null &&
567
- searchParamJson !== ''
568
- ) {
569
- searchParam = JSON.parse(searchParamJson)
570
- const pagination = searchParam.pagination
571
- if (pagination) {
572
- this.currentPage = pagination.currentPage
573
- this.pagination.pageSize = pagination.pageSize
574
- this.pagination.showTotal = pagination.showTotal
575
- }
576
- this.getInitSearchForm(searchParam.searchForm)
577
- // this.searchFormContent = searchParam.searchForm
578
- }
579
- }
580
- }
581
- window.sessionStorage.removeItem('refreshList-' + this.storeId)
582
- if (searchParam === undefined) {
583
- searchParam = this.getSearchParam()
584
- }
585
- const gridParams = store.get(this.storeId)
586
- let param = searchParam
587
- if (gridParams.options.extraParam) {
588
- param = {
589
- searchParam: searchParam,
590
- }
591
- if (gridParams.options.extraParam) {
592
- for (const paramName in gridParams.options.extraParam) {
593
- param[paramName] = gridParams.options.extraParam[paramName]
594
- }
595
- }
596
- }
597
- // 导出需要这两个参数
598
- gridParams.searchParam = searchParam
599
- gridParams.url = this.url
600
- const requestUrl = this.url
601
- // 缓存查询条件及当前页数
602
- window.sessionStorage.setItem(
603
- 'searchParam-' + this.storeId,
604
- JSON.stringify(param)
605
- )
606
- this.$http
607
- .post(requestUrl, param)
608
- .then((data) => {
609
- // 对数据做序列化,比如:处理xss攻击
610
- if (isHasOptionFunction('gridDataLoaded', this.storeId)) {
611
- const gridData = gridParams.options.gridDataLoaded.call(this, {
612
- gridData: data.data,
613
- columns: gridParams.columns,
614
- })
615
- if (gridData) {
616
- this.gridData = gridData
617
- } else {
618
- this.gridData = data.data
619
- }
620
- } else {
621
- this.gridData = data.data
622
- }
623
- if (!this.gridData) {
624
- this.gridData = []
625
- }
626
-
627
- if (this.pagination !== null) {
628
- this.pagination.total = data.total
629
- }
630
-
631
- gridParams.gridData = this.gridData
632
- // 完成深拷贝,复制一份对象,行编辑时使用
633
- gridParams.orgGridData = [].concat(
634
- JSON.parse(JSON.stringify(this.gridData))
635
- )
636
-
637
- gridParams.pagination = this.pagination
638
- gridParams.loaded = true
639
- this.hasLoadData = true
640
- resolve()
641
- })
642
- .catch((error) => {
643
- if (isHasOptionFunction('loadError', this.storeId)) {
644
- gridParams.options.loadError.call(this, this.code, error)
645
- }
646
- reject(error)
647
- })
648
- })
649
- },
650
- getLength(paramsData) {
651
- if (paramsData && paramsData.length > 5) {
652
- return '(' + paramsData.substring(0, 5) + '...' + ')'
653
- } else if (paramsData) {
654
- return '(' + paramsData + ')'
655
- } else {
656
- return ''
657
- }
658
- },
659
- // 获得初始查询条件对象
660
- getInitSearchForm(searchFormArr) {
661
- const gridParams = store.get(this.storeId)
662
- if (searchFormArr && searchFormArr.length > 0) {
663
- this.searchFormContent = {}
664
- searchFormArr.forEach((item) => {
665
- // 获得的是"isDeleted"
666
- let prop = item.propName
667
- // 获得的是“deleted”
668
- const columnProp = item.columnProp
669
- const dataType = item.dataType
670
- if (dataType && dataType === 'BOOLEAN') {
671
- prop = columnProp
672
- }
673
- this.initSearchProps.push(prop)
674
- const propValue = item.propValue
675
- if (prop.indexOf('.') > 0) {
676
- // 动态给searchForm添加属性,包括多级嵌套属性,属性的初始值都为 null
677
- addDynamicProp(this.searchFormContent, prop, propValue)
678
- } else {
679
- this.searchFormContent[prop] = propValue
680
- }
681
- })
682
- gridParams.searchForm = searchFormArr
683
- // 调用查询api方法,该方法中调用了@showSearch方法,用于控制“查询”按钮改名为“取消查询”
684
- this.showSearchForm()
685
- } else {
686
- gridParams.searchForm = null
687
- }
688
- },
689
- showDemo() {
690
- this.isLoading = true
691
- this.$http
692
- .get(this.url)
693
- .then((data) => {
694
- Object.assign(this, data)
695
- const gridParams = store.get(this.storeId)
696
-
697
- gridParams.listCode = this.code
698
-
699
- gridParams.columns = this.columns
700
- if (gridParams.columns && this.options.dynamicColumns) {
701
- for (var i = 0; i < this.options.dynamicColumns.length; i++) {
702
- this.options.dynamicColumns[i].dynamic = true
703
- gridParams.columns.push(this.options.dynamicColumns[i])
704
- }
705
- }
706
- gridParams.lineEdit = this.lineEdit
707
- gridParams.basicInfo = this.basicInfo
708
- gridParams.pagination = this.pagination
709
- gridParams.query = this.query
710
-
711
- this.gridData = data.gridData
712
- // 对数据做序列化,比如:处理xss攻击
713
- if (isHasOptionFunction('gridDataLoaded', this.storeId)) {
714
- const gridData = gridParams.options.gridDataLoaded.call(
715
- this,
716
- data.gridData
717
- )
718
- if (gridData) {
719
- this.gridData = gridData
720
- } else {
721
- this.gridData = data.gridData
722
- }
723
- } else {
724
- this.gridData = data.gridData
725
- }
726
-
727
- if (this.pagination != null) {
728
- this.pagination.total = data.total
729
- }
730
- if (!this.gridData) {
731
- this.gridData = []
732
- }
733
- gridParams.gridData = this.gridData
734
- // 完成深拷贝,复制一份对象,行编辑时使用
735
- gridParams.orgGridData = [].concat(
736
- JSON.parse(JSON.stringify(this.gridData))
737
- )
738
- gridParams.pagination = this.pagination
739
-
740
- if (isHasOptionFunction('gridComplete', this.storeId)) {
741
- gridParams.options.gridComplete.call(
742
- this,
743
- this.gridData,
744
- gridParams.columns
745
- )
746
- }
747
- })
748
- .catch((error) => {
749
- if (isHasOptionFunction('loadError', this.storeId)) {
750
- const gridParams = store.get(this.storeId)
751
- gridParams.options.loadError.call(this, this.code, error)
752
- }
753
- })
754
- },
755
- search(searchForm) {
756
- const vm = this
757
- return new Promise((resolve, reject) => {
758
- const gridParams = store.get(vm.storeId)
759
- if (typeof searchForm !== 'undefined' && searchForm !== null) {
760
- gridParams.searchForm = searchForm
761
- } else {
762
- gridParams.searchForm = null
763
- }
764
-
765
- vm.fetchData(vm.getSearchParam(), true)
766
- .then((data) => {
767
- if (
768
- gridParams.options !== undefined &&
769
- gridParams.options.isHiddenSearchForm !== undefined &&
770
- gridParams.options.isHiddenSearchForm === true
771
- ) {
772
- // 查询时,是否隐藏查询区域,默认是不隐藏查询区域
773
- vm.showSearch = false
774
- $emit(vm, 'cancel-search')
775
- }
776
- if (vm.$refs.sf) {
777
- vm.$refs.sf.loading = false
778
- }
779
- resolve(data)
780
- })
781
- .catch((error) => {
782
- if (vm.$refs.sf) {
783
- vm.$refs.sf.loading = false
784
- }
785
- reject(error)
786
- })
787
- })
788
- },
789
- getSearchParam() {
790
- const searchParam = {
791
- code: this.code,
792
- }
793
- const gridParams = store.get(this.storeId)
794
- if (this.pagination !== null) {
795
- const pagination = {
796
- currentPage: this.currentPage,
797
- pageSize: this.pagination.pageSize,
798
- showTotal: this.pagination.showTotal,
799
- }
800
- if (this.pageSize !== null) {
801
- // 表示更改了每页显示的数据条数
802
- pagination.pageSize = this.pageSize
803
- }
804
- searchParam.pagination = pagination
805
- }
806
- // 排序信息
807
- if (this.sortInfo !== null) {
808
- // 表示更改了排序信息
809
- searchParam.sorts = this.sortInfo
810
- }
811
- if (this.mergeFields && this.mergeFields.length > 0) {
812
- if (!searchParam.sorts) {
813
- searchParam.sorts = []
814
- }
815
- const mergeFieldsArr = []
816
- for (const mergeField of this.mergeFields) {
817
- let flag = true
818
- for (const so of searchParam.sorts) {
819
- if (so.prop === mergeField) {
820
- flag = false
821
- break
822
- }
823
- }
824
- if (flag) {
825
- mergeFieldsArr.push({
826
- prop: mergeField,
827
- order: 'ascending',
828
- })
829
- }
830
- }
831
- mergeFieldsArr.push(...searchParam.sorts)
832
- searchParam.sorts = mergeFieldsArr
833
- }
834
- // 是否有初始过滤条件
835
- if (
836
- gridParams.options &&
837
- typeof gridParams.options.initSearchForm !== 'undefined'
838
- ) {
839
- searchParam.initSearchForm = gridParams.options.initSearchForm
840
- }
841
- if (typeof gridParams.searchForm !== 'undefined') {
842
- searchParam.searchForm = gridParams.searchForm
843
- } else {
844
- searchParam.searchForm = []
845
- }
846
- return searchParam
847
- },
848
- handleSizeChange(val) {
849
- this.pageSize = val
850
- this.fetchData(this.getSearchParam())
851
- },
852
- handleCurrentChange(val) {
853
- this.fetchData(this.getSearchParam())
854
- },
855
- handleSortChange({ column, prop, order }) {
856
- if (prop !== null) {
857
- // 当点击第3次时,prop会是空,表示清空排序字段,还原原顺序
858
- this.sortInfo = [
859
- {
860
- prop: prop,
861
- order: order,
862
- },
863
- ]
864
- } else {
865
- this.sortInfo = null
866
- }
867
- this.fetchData(this.getSearchParam())
868
- $emit(this, 'sort-change', { column, prop, order })
869
- },
870
- resetSearch() {
871
- this.search(null, false)
872
- },
873
- // 新建事件
874
- add() {
875
- $emit(this, 'add')
876
- },
877
- // 操作按钮的点击事件
878
- buttonClick(event, data) {
879
- if (event) {
880
- if (typeof event === 'function') {
881
- event.call(this, data)
882
- } else {
883
- $emit(this, event, data)
884
- }
885
- }
886
- },
887
- // 点击内容区域的事件
888
- clickContent(data) {
889
- this.changeSelect(data)
890
- $emit(this, 'click', data)
891
- },
892
- // 格子拖拽
893
- rowDrop() {
894
- if (this.urlToSaveOrder) {
895
- let urlToSaveOrder = this.urlToSaveOrder
896
- if (
897
- urlToSaveOrder.indexOf('http:') < 0 ||
898
- urlToSaveOrder.indexOf('https:') < 0
899
- ) {
900
- // 表示是相对路径,需要拼接全路径
901
- let baseURL = window.$vueApp.config.globalProperties.baseURL
902
- if (baseURL.lastIndexOf('/') === baseURL.length - 1) {
903
- // 表示以斜线结尾
904
- // 去掉斜线
905
- baseURL = baseURL.substring(0, baseURL.length - 1)
906
- }
907
- if (urlToSaveOrder.indexOf('/') > 0) {
908
- // 表示不是以斜线开头,需要开头加“/”
909
- urlToSaveOrder = '/' + urlToSaveOrder
910
- }
911
- urlToSaveOrder = baseURL + urlToSaveOrder
912
- }
913
- const tbody = document.querySelector('#' + this.gridId + ' .el-row')
914
- if (tbody != null) {
915
- const vm = this
916
- Sortable.create(tbody, {
917
- draggable: '.col-content',
918
- onEnd({ newIndex, oldIndex }) {
919
- const addCardId = document.querySelector(
920
- '#' + vm.gridId + ' #_addCardId_'
921
- )
922
- if (addCardId != null) {
923
- // 表示存在新建区域,则序号需要减1
924
- if (oldIndex > 0) {
925
- oldIndex = oldIndex - 1
926
- }
927
- if (newIndex > 0) {
928
- newIndex = newIndex - 1
929
- }
930
- }
931
- const params = {
932
- oldIndex: oldIndex,
933
- newIndex: newIndex,
934
- gridData: vm.gridData,
935
- }
936
- vm.$http.post(urlToSaveOrder, params).then((data) => {
937
- const currRow = vm.gridData.splice(oldIndex, 1)[0]
938
- vm.gridData.splice(newIndex, 0, currRow)
939
- vm.refresh().then(() => {
940
- $emit(vm, 'afterDrag', params)
941
- })
942
- })
943
- },
944
- })
945
- }
946
- }
947
- },
948
- // 多选按钮的change事件
949
- changeChecked(label, index) {
950
- const entity = this.gridData[index]
951
- if ((label + '').indexOf('false-') >= 0) {
952
- // 表示取消勾选记录
953
- this.unselect(entity)
954
- } else {
955
- // 表示勾选记录
956
- this.select(entity)
957
- }
958
- },
959
- unselect(entity) {
960
- const id = entity.id
961
- const index = this.selectionIds.indexOf(id)
962
- if (index > -1) {
963
- this.selections.splice(index, 1)
964
- this.selectionIds.splice(index, 1)
965
- }
966
- $emit(this, 'unselect', entity, this.selections)
967
- this.selectionModels['select' + id] = 'false-' + id
968
- // console.log('unselect---this.selections=', this.selections)
969
- },
970
- select(entity) {
971
- const id = entity.id
972
- if (this.selectionIds.indexOf(id) < 0) {
973
- this.selectionIds[this.selectionIds.length] = id
974
- this.selections[this.selections.length] = entity
975
- }
976
- $emit(this, 'select', entity, this.selections)
977
- this.selectionModels['select' + id] = id
978
- // console.log('select---this.selections=', this.selections)
979
- },
980
- // 单选按钮的change事件
981
- changeSelectWhenRadio(label, index) {
982
- const entity = this.gridData[index]
983
- this.selectionIds = []
984
- this.selections = []
985
- this.selectionModels = {}
986
- this.select(entity)
987
- },
988
- changeSelect(data) {
989
- const id = data.id
990
- if (this.multiple === true) {
991
- // 多选时
992
- if (this.selectionIds && this.selectionIds.indexOf(id) >= 0) {
993
- // 表示需要取消选中
994
- this.unselect(data)
995
- } else {
996
- // 表示需要选中
997
- this.select(data)
998
- }
999
- } else {
1000
- // 单选时
1001
- this.currentId = id
1002
- this.selectionIds = []
1003
- this.selections = []
1004
- this.selectionModels = {}
1005
- this.select(data)
1006
- }
1007
- },
1008
- isShowButton(entity, button) {
1009
- const val = this.isShowButtonFun(entity, button)
1010
- if (val === undefined) {
1011
- return true
1012
- }
1013
- return val
1014
- },
1015
- // 是否显示启用禁用按钮
1016
- showEnableButton(entity) {
1017
- const gridParams = store.get(this.storeId)
1018
- if (isHasOptionFunction('showEnableButton', this.storeId)) {
1019
- return gridParams.options.showEnableButton.call(this, entity)
1020
- }
1021
- return false
1022
- },
1023
- // 启用禁用按钮显示状态
1024
- changeState(entity) {
1025
- const gridParams = store.get(this.storeId)
1026
- if (isHasOptionFunction('changeState', this.storeId)) {
1027
- return gridParams.options.changeState.call(this, entity)
1028
- }
1029
- return false
1030
- },
1031
- },
1032
- emits: [
1033
- 'sort-change',
1034
- ,
1035
- 'click',
1036
- 'afterDrag',
1037
- 'unselect',
1038
- 'select',
1039
- 'cancel-search',
1040
- 'add',
1041
- ,
1042
- ],
1043
- }
1044
- </script>
1045
-
1046
- <style lang="scss" rel="stylesheet/scss" scoped>
1047
- .nine-grid-area {
1048
- padding: 10px;
1049
- .el-row {
1050
- margin-bottom: 20px;
1051
- &:last-child {
1052
- margin-bottom: 0;
1053
- }
1054
- }
1055
- .el-col-5 {
1056
- width: 20%;
1057
- }
1058
- .el-col {
1059
- border-radius: 4px;
1060
- margin-bottom: 10px;
1061
- }
1062
- .name {
1063
- font-size: 12px;
1064
- color: #555;
1065
- float: left;
1066
- width: 80%;
1067
- text-align: left;
1068
- }
1069
- .bottom {
1070
- // margin-top: 13px;
1071
- line-height: 13px;
1072
- // background: aquamarine;
1073
- }
1074
- .state {
1075
- font-size: 12px;
1076
- margin-top: 1.5px;
1077
- float: right;
1078
- line-height: 1;
1079
- display: flex;
1080
- align-items: right;
1081
- color: #999;
1082
- width: 20%;
1083
- text-align: right;
1084
- }
1085
- .image {
1086
- width: 100%;
1087
- display: block;
1088
- height: 200px;
1089
- }
1090
- .clearfix:before,
1091
- .clearfix:after {
1092
- display: table;
1093
- content: '';
1094
- }
1095
- .clearfix:after {
1096
- clear: both;
1097
- }
1098
- .input-with-select {
1099
- // background-color: #fff;
1100
- width: 200px;
1101
- float: right;
1102
- }
1103
- .popContainer {
1104
- position: absolute;
1105
- width: 23.15%;
1106
- display: block;
1107
- height: 200px;
1108
- background: rgba(0, 0, 0, 0.5);
1109
- text-align: right;
1110
- }
1111
- .fade-enter-active,
1112
- .fade-leave-active {
1113
- transition: opacity 0.5s;
1114
- }
1115
- .fade-enter,
1116
- .fade-leave-to {
1117
- opacity: 0;
1118
- }
1119
- .icons {
1120
- color: #adb5bd;
1121
- margin: 10px 10px 0px 0px;
1122
- cursor: pointer;
1123
- }
1124
- .release-status {
1125
- display: block;
1126
- width: 8px;
1127
- height: 8px;
1128
- margin-right: 8px;
1129
- border-radius: 100%;
1130
- }
1131
- .add-screen {
1132
- display: flex;
1133
- flex-direction: column;
1134
- justify-content: center;
1135
- align-items: center;
1136
- cursor: pointer;
1137
- height: 160px;
1138
- // background-color: #fff;
1139
- // border: 1px solid #7693f5;
1140
- // box-shadow: 0 2px 8px 0 rgba(104,130,218,.4);
1141
- font-size: 12px;
1142
- color: #666666;
1143
- font-family: Source Han Sans CN;
1144
- font-weight: regular;
1145
- font-size: 14px;
1146
- line-height: 14px;
1147
- letter-spacing: 0px;
1148
- text-align: left;
1149
- }
1150
- .el-divider--horizontal {
1151
- margin: 5px 0;
1152
- }
1153
- .button-style {
1154
- margin-top: 28px;
1155
- color: #606266;
1156
- font-family: Source Han Sans CN;
1157
- font-weight: regular;
1158
- font-size: 14px;
1159
- line-height: 14px;
1160
- letter-spacing: 0px;
1161
- text-align: left;
1162
- }
1163
- }
1164
- </style>
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
20
+ :id="gridId"
21
+ :style="'height:' + height + 'px;overflow-y: auto;overflow-x: hidden;'"
22
+ >
23
+ <el-row :gutter="24">
24
+ <el-col
25
+ v-if="isHasCreate"
26
+ id="_addCardId_"
27
+ v-permission="createPermission"
28
+ :span="colSpan"
29
+ >
30
+ <el-card
31
+ :body-style="{ padding: '0px' }"
32
+ style="
33
+ border-radius: 4px;
34
+ background: #ffffff;
35
+ border: 1px solid #e5e8ef;
36
+ "
37
+ >
38
+ <div class="add-screen" @click="add">
39
+ <em class="el-icon-plus" />
40
+ <span style="margin-top: 7px">
41
+ {{ $t('superNineGrid.add') }}</span
42
+ >
43
+ </div>
44
+ </el-card>
45
+ </el-col>
46
+ <el-col
47
+ v-for="(params, index) in gridData"
48
+ :key="params.id"
49
+ :span="colSpan"
50
+ >
51
+ <el-card
52
+ :body-style="{ padding: '0px' }"
53
+ :style="{
54
+ border:
55
+ selectionIds.indexOf(params.id) > -1
56
+ ? '1px solid #005EBA'
57
+ : '',
58
+ }"
59
+ shadow="hover"
60
+ >
61
+ <div
62
+ style="height: 160px"
63
+ @mouseenter="enter(index)"
64
+ @mouseleave="leave()"
65
+ @click="clickContent(params)"
66
+ >
67
+ <!-- <transition name="fade">
68
+ <div v-if="seen && index === current" class="popContainer">
69
+ <div class="else-button">
70
+ <template v-for="button in operations">
71
+ <template v-if="isShowButton(params, button)">
72
+ <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">
73
+ <em :class="button.icon +' icons'" @click.stop="buttonClick(button.event, params)" />
74
+ </el-tooltip>
75
+ <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>
76
+ </template>
77
+ </template>
78
+ </div>
79
+ </div>
80
+ </transition> -->
81
+ <!-- <img v-if="props && props.imageUrl && objectPropValue(params, propCloumns.imageUrl, props.imageUrl)" :src="defaultShowImageAction+objectPropValue(params, propCloumns.imageUrl, props.imageUrl)" alt="加载失败" class="image"> -->
82
+ <!-- <img v-if="true || (props && props.imageUrl)" :src="defaultShowImageAction+'fa7ae05e-0f0e-4cc0-b24a-69aea4408233'" alt="加载失败" class="image"> -->
83
+ <!-- <div v-else class="image" style="padding: 20px; text-align: center;"> -->
84
+ <div
85
+ class="image"
86
+ style="padding: 15px; box-sizing: border-box"
87
+ >
88
+ <div>
89
+ <el-tooltip
90
+ effect="dark"
91
+ :content="'系统编码:' + params.code"
92
+ placement="top-start"
93
+ >
94
+ <div
95
+ v-if="props && props.content"
96
+ style="display: inline-block"
97
+ >
98
+ {{
99
+ getPropValue('content', params) +
100
+ getLength(params.code)
101
+ }}
102
+ </div>
103
+ <div
104
+ v-else-if="props && props.title"
105
+ style="display: inline-block"
106
+ >
107
+ {{
108
+ getPropValue('title', params) + getLength(params.code)
109
+ }}
110
+ </div>
111
+ </el-tooltip>
112
+ <div
113
+ v-if="showEnableButton(params)"
114
+ style="
115
+ margin-left: 2px;
116
+ color: #00b42a;
117
+ background-color: #e8ffea;
118
+ width: 68px;
119
+ text-align: center;
120
+ display: inline-block;
121
+ "
122
+ >
123
+ <em class="el-icon-success" />
124
+ <span
125
+ :title="getPropValue('subTitle', params)"
126
+ style="margin-left: 4px"
127
+ >{{ getPropValue('subTitle', params) }}</span
128
+ >
129
+ </div>
130
+ </div>
131
+ <div class="button-style">
132
+ 操作
133
+ <template v-for="button in operations">
134
+ <template v-if="isShowButton(params, button)">
135
+ <el-tooltip
136
+ v-if="button.icon"
137
+ v-permission="
138
+ button.permission ? button.permission : 'true'
139
+ "
140
+ :content="button.name"
141
+ class="item"
142
+ effect="dark"
143
+ placement="top"
144
+ >
145
+ <em
146
+ :class="button.icon + ' icons'"
147
+ @click.stop="buttonClick(button.event, params)"
148
+ />
149
+ </el-tooltip>
150
+ <em
151
+ v-else
152
+ v-permission="
153
+ button.permission ? button.permission : 'true'
154
+ "
155
+ :class="button.name + ' icons'"
156
+ @click.stop="buttonClick(button.event, params)"
157
+ >{{ button.name }}
158
+ </em>
159
+ </template>
160
+ </template>
161
+ </div>
162
+ <div
163
+ v-if="isShowEnableState"
164
+ style="float: right; margin-top: 28px"
165
+ >
166
+ <el-button
167
+ v-if="showEnableButton(params)"
168
+ size="mini"
169
+ @click.stop="changeState(params)"
170
+ >
171
+ 禁用
172
+ </el-button>
173
+ <el-button
174
+ v-else
175
+ size="mini"
176
+ type="primary"
177
+ @click.stop="changeState(params)"
178
+ >
179
+ 启用
180
+ </el-button>
181
+ </div>
182
+ </div>
183
+ </div>
184
+ <!-- <el-divider />
185
+ <div style="padding: 10px 10px 10px 10px;">
186
+ <div class="bottom clearfix">
187
+ <time class="name">
188
+ <span v-if="props && props.title">
189
+ <el-checkbox v-if="multiple" :value="selectionModels['select'+params.id]" :true-label="params.id" :false-label="'false-'+params.id" :title="getPropValue('title', params)" style="width: 100%" @change="changeChecked($event, index)">
190
+ {{ getPropValue('title', params) }}
191
+ <span :style="getTitleStyle(params)"> {{ getPropValue('title', params) }}</span>
192
+ </el-checkbox>
193
+ <el-radio v-else-if="isShowRadio" v-model="currentId" :label="params.id" :title="getPropValue('title', params)" style="width: 100%" @change="changeSelectWhenRadio($event, index)">
194
+ {{ getPropValue('title', params) }}
195
+ <span :style="getTitleStyle(params)"> {{ getPropValue('title', params) }}</span>
196
+ </el-radio>
197
+ <span v-else :style="getTitleStyle(params)" :title="getPropValue('title', params)"> {{ getPropValue('title', params) }}</span>
198
+ </span>
199
+ <span v-else-if="props && props.content">
200
+ <el-checkbox v-if="multiple" :value="selectionModels['select'+params.id]" :true-label="params.id" :false-label="'false-'+params.id" :title="getPropValue('content', params)" style="width: 100%" @change="changeChecked($event, index)">{{ getPropValue('content', params) }}</el-checkbox>
201
+ <el-radio v-else-if="isShowRadio" v-model="currentId" :label="params.id" :title="getPropValue('content', params)" style="width: 100%" @change="changeSelectWhenRadio($event, index)">{{ getPropValue('content', params) }}</el-radio>
202
+ <span v-else :title="getPropValue('content', params)" style="width: 100%"> {{ getPropValue('content', params) }}</span>
203
+ </span>
204
+ <span v-else>
205
+ <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>
206
+ <el-radio v-else-if="isShowRadio" v-model="currentId" :label="params.id" @change="changeSelectWhenRadio($event, index)">{{ index + 1 }}</el-radio>
207
+ <span v-else> {{ index + 1 }}</span>
208
+ </span>
209
+ </time>
210
+ <time v-if="props && props.subTitle" class="state">
211
+ <span :title="getPropValue('subTitle', params)" style="width: 100%">{{ getPropValue('subTitle', params) }}</span>
212
+ </time>
213
+ </div>
214
+ </div> -->
215
+ </el-card>
216
+ </el-col>
217
+ </el-row>
218
+ </div>
219
+ <el-pagination
220
+ v-if="pagination"
221
+ v-model:current-page="currentPage"
222
+ :page-sizes="pagination.pageSizes"
223
+ :page-size="pagination.pageSize"
224
+ :layout="pagination.layout"
225
+ :total="pagination.total"
226
+ @size-change="handleSizeChange"
227
+ @current-change="handleCurrentChange"
228
+ />
229
+ </div>
230
+ </div>
231
+ </template>
232
+
233
+ <script>
234
+ import { $on, $off, $once, $emit } from '../../utils/gogocodeTransfer'
235
+ import customFormatter from './custom-formatter'
236
+ import SearchForm from './search-form.vue'
237
+ import { getGridParams, getTableHeight, isHasOptionFunction } from './utils'
238
+ import store from './store'
239
+ import superGridService from './super-grid-service'
240
+ import apis from './apis'
241
+ import Sortable from 'sortablejs'
242
+ import { addDynamicProp } from './utils'
243
+ import * as Vue from 'vue'
244
+ export default {
245
+ name: 'SuperNineGrid',
246
+ components: {
247
+ SearchForm,
248
+ },
249
+ props: {
250
+ code: {
251
+ type: String,
252
+ default: '',
253
+ },
254
+ url: {
255
+ type: String,
256
+ default: '',
257
+ },
258
+ options: {
259
+ type: Object,
260
+ default: function () {
261
+ return {}
262
+ },
263
+ },
264
+ },
265
+ data() {
266
+ let mergeFields = []
267
+ if (
268
+ this.options &&
269
+ this.options.mergeFields &&
270
+ this.options.mergeFields !== ''
271
+ ) {
272
+ mergeFields = this.options.mergeFields.split(',')
273
+ }
274
+ const defaultShowImageAction =
275
+ window.$vueApp.config.globalProperties.baseAPI +
276
+ '/component/super-form/show-image?serverPath='
277
+ const gridId =
278
+ this.options && this.options.id ? this.options.id : '_nineGrid'
279
+ const storeId = this.code + '~' + gridId
280
+ const isShowRadio =
281
+ this.options && this.options.showRadio !== undefined
282
+ ? this.options.showRadio
283
+ : false
284
+ return {
285
+ isLoading: false,
286
+ currentPage: 1,
287
+ showColumnConfig: false,
288
+ basicInfo: {
289
+ summary: 'no',
290
+ },
291
+ columns: [],
292
+ pagination: null,
293
+ query: null,
294
+ lineEdit: null,
295
+ gridData: [],
296
+ sortInfo: null,
297
+ pageSize: null,
298
+ showSearch: false,
299
+ height: null,
300
+ isSql: false, // 是否是sql查询
301
+ hasLoadData: false,
302
+ mergeFields,
303
+ hasLoadedColumns: false, // 是否已经加载了列配置
304
+ seen: false,
305
+ current: null,
306
+ isHasCreate: true, // 是否需要新建按钮
307
+ screenBaseUrl: null,
308
+ props: null, // 属性配置
309
+ operations: [], // 指向格子时出现的操作按钮集合
310
+ propCloumns: null, // 属性字段配置详细信息
311
+ multiple: false, // 是否需要多选
312
+ createPermission: 'true', // 新建权限编码,默认是有权限的
313
+ urlToSaveOrder: null, // 拖动格子后台保存接口路径
314
+ selections: [], // 选中的记录集合
315
+ selectionIds: [], // 选中的记录id集合
316
+ selectionModels: {}, // 选中的记录对象
317
+ searchFormContent: null,
318
+ initSearchProps: [], // 初始查询的字段属性名集合
319
+ defaultShowImageAction, // 显示图片的路径
320
+ gridId,
321
+ storeId,
322
+ currentId: null, // 当前点击的记录id
323
+ isShowRadio, // 单选时是否显示单选按钮
324
+ titleStyle: null, // 标题的样式对象,格式为:{ color: 'green', fontWeight: 'bold'}
325
+ isShowEnableState: false,
326
+ colSpan: 6,
327
+ }
328
+ },
329
+ computed: {},
330
+ provide() {
331
+ return {}
332
+ },
333
+ created() {
334
+ store.set(this.code + '~' + this.gridId, getGridParams())
335
+ store.set('_nine_list_code', this.code + '~' + this.gridId)
336
+ this.initSetting()
337
+ this.initialize()
338
+ // this.showDemo()
339
+ },
340
+ mounted() {
341
+ this.$watch(
342
+ 'showSearch',
343
+ function (newVal, oldVal) {
344
+ this.$nextTick(() => {
345
+ let tableHeight = getTableHeight(newVal, this.$refs.sf)
346
+ const newHeight = this.resizeHeight()
347
+ if (newHeight) {
348
+ tableHeight = newHeight
349
+ }
350
+ this.height = tableHeight
351
+ })
352
+ },
353
+ {
354
+ immediate: true,
355
+ deep: true,
356
+ }
357
+ )
358
+
359
+ this.$watch(
360
+ 'hasLoadData',
361
+ function (newVal, oldVal) {
362
+ if (newVal === true) {
363
+ this.$nextTick(() => {
364
+ this.rowDrop()
365
+ const gridParams = store.get(this.storeId)
366
+ if (isHasOptionFunction('gridComplete', this.storeId)) {
367
+ gridParams.options.gridComplete.call(this, {
368
+ gridData: this.gridData,
369
+ columns: gridParams.columns,
370
+ superGrid: this.$refs.superGrid,
371
+ })
372
+ }
373
+ const newHeight = this.resizeHeight()
374
+ if (newHeight) {
375
+ this.height = newHeight
376
+ }
377
+ })
378
+ }
379
+ },
380
+ {
381
+ immediate: true,
382
+ deep: true,
383
+ }
384
+ )
385
+ },
386
+ methods: {
387
+ ...superGridService,
388
+ ...apis,
389
+ ...customFormatter,
390
+ getTitleStyle(entity) {
391
+ // 九宫格的标题自定义样式
392
+ if (this.options && this.options.titleStyle) {
393
+ return this.options.titleStyle.call(this, entity)
394
+ }
395
+ return { width: '100%' }
396
+ },
397
+ // 获得属性值
398
+ getPropValue(type, entity) {
399
+ let value = ''
400
+ const gridParams = store.get(this.storeId)
401
+ if (type === 'content') {
402
+ let content = ''
403
+ if (isHasOptionFunction('setContent', this.storeId)) {
404
+ content = gridParams.options.getContent.call(this, entity)
405
+ }
406
+ if (content === undefined || content === '') {
407
+ if (this.props && this.props.content) {
408
+ content = this.objectPropValue(
409
+ entity,
410
+ this.propCloumns.content,
411
+ this.props.content
412
+ )
413
+ } else if (this.props && this.props.title) {
414
+ content = this.objectPropValue(
415
+ entity,
416
+ this.propCloumns.title,
417
+ this.props.title
418
+ )
419
+ }
420
+ }
421
+ value = content
422
+ } else if (type === 'title') {
423
+ let content = ''
424
+ if (isHasOptionFunction('setTitle', this.storeId)) {
425
+ content = gridParams.options.setTitle.call(this, entity)
426
+ }
427
+ if (content === undefined || content === '') {
428
+ if (this.props && this.props.title) {
429
+ content = this.objectPropValue(
430
+ entity,
431
+ this.propCloumns.title,
432
+ this.props.title
433
+ )
434
+ } else if (this.props && this.props.content) {
435
+ content = this.objectPropValue(
436
+ entity,
437
+ this.propCloumns.content,
438
+ this.props.content
439
+ )
440
+ }
441
+ }
442
+ value = content
443
+ } else if (type === 'subTitle') {
444
+ let content = ''
445
+ if (isHasOptionFunction('setSubTitle', this.storeId)) {
446
+ content = gridParams.options.setSubTitle.call(this, entity)
447
+ }
448
+ if (content === undefined || content === '') {
449
+ if (this.props && this.props.subTitle) {
450
+ content = this.objectPropValue(
451
+ entity,
452
+ this.propCloumns.subTitle,
453
+ this.props.subTitle
454
+ )
455
+ }
456
+ }
457
+ value = content
458
+ }
459
+ if (value === undefined) {
460
+ value = ''
461
+ }
462
+ return value
463
+ },
464
+ resizeHeight() {
465
+ const gridParams = store.get(this.storeId)
466
+ if (isHasOptionFunction('resizeHeight', this.storeId)) {
467
+ let searchHeight = 0
468
+ if (this.showSearch === true) {
469
+ if (this.$refs.sf) {
470
+ // 获得查询区高度
471
+ searchHeight = this.$refs.sf.$el.offsetHeight
472
+ }
473
+ }
474
+ return gridParams.options.resizeHeight.call(this, {
475
+ code: this.code,
476
+ height: this.height,
477
+ searchHeight: searchHeight,
478
+ })
479
+ }
480
+ },
481
+ enter(index) {
482
+ this.seen = true
483
+ this.current = index
484
+ },
485
+ leave() {
486
+ this.seen = false
487
+ this.current = null
488
+ },
489
+ initSetting() {
490
+ const gridParams = store.get(this.storeId)
491
+ if (typeof this.options !== 'undefined') {
492
+ Object.assign(gridParams.options, this.options)
493
+ } else {
494
+ gridParams.options = {}
495
+ }
496
+ if (this.options && typeof this.options.isHasCreate !== 'undefined') {
497
+ this.isHasCreate = this.options.isHasCreate
498
+ }
499
+ if (this.options && typeof this.options.props !== 'undefined') {
500
+ this.props = this.options.props
501
+ }
502
+ if (this.options && typeof this.options.operations !== 'undefined') {
503
+ this.operations = this.options.operations
504
+ }
505
+ if (
506
+ this.options &&
507
+ typeof this.options.createPermission !== 'undefined'
508
+ ) {
509
+ this.createPermission = this.options.createPermission
510
+ }
511
+ if (this.options && typeof this.options.multiple !== 'undefined') {
512
+ this.multiple = this.options.multiple
513
+ }
514
+ if (
515
+ this.options &&
516
+ typeof this.options.isShowEnableState !== 'undefined'
517
+ ) {
518
+ this.isShowEnableState = this.options.isShowEnableState
519
+ }
520
+ if (this.options && typeof this.options.colSpan !== 'undefined') {
521
+ this.colSpan = this.options.colSpan
522
+ }
523
+ },
524
+ // 获得各属性对应的字段配置
525
+ getPropColumns() {
526
+ if (this.columns && this.columns.length > 0) {
527
+ // imageUrl:{column}, content: {column}, title: {}, subTitle:{}
528
+ this.propCloumns = {}
529
+ this.columns.forEach((column) => {
530
+ if (this.props.imageUrl && this.props.imageUrl === column.prop) {
531
+ this.propCloumns.imageUrl = column
532
+ }
533
+ if (this.props.content && this.props.content === column.prop) {
534
+ this.propCloumns.content = column
535
+ }
536
+ if (this.props.title && this.props.title === column.prop) {
537
+ this.propCloumns.title = column
538
+ }
539
+ if (this.props.subTitle && this.props.subTitle === column.prop) {
540
+ this.propCloumns.subTitle = column
541
+ }
542
+ })
543
+ }
544
+ },
545
+ fetchData(searchParam, isSearch) {
546
+ return new Promise((resolve, reject) => {
547
+ // 获得各属性对应的字段配置
548
+ this.getPropColumns()
549
+ this.isLoading = true
550
+ this.hasLoadData = false
551
+ if (isSearch === undefined || isSearch === false) {
552
+ // 如果不是查询时才需要从缓存中获得结果
553
+ // 如果是刷新当前列表,则需要获得缓存中的window.sessionStorage
554
+ const isRefreshList = window.sessionStorage.getItem(
555
+ 'refreshList-' + this.storeId
556
+ )
557
+ // console.log('fetchData--isRefreshList--', isRefreshList)
558
+ if (isRefreshList !== undefined && isRefreshList === 'true') {
559
+ const searchParamJson = window.sessionStorage.getItem(
560
+ 'searchParam-' + this.storeId
561
+ )
562
+ // console.log('fetchData--searchParamJson--', searchParamJson)
563
+ // console.log('fetchData--pagination--', this.pagination)
564
+ if (
565
+ searchParamJson !== undefined &&
566
+ searchParamJson !== null &&
567
+ searchParamJson !== ''
568
+ ) {
569
+ searchParam = JSON.parse(searchParamJson)
570
+ const pagination = searchParam.pagination
571
+ if (pagination) {
572
+ this.currentPage = pagination.currentPage
573
+ this.pagination.pageSize = pagination.pageSize
574
+ this.pagination.showTotal = pagination.showTotal
575
+ }
576
+ this.getInitSearchForm(searchParam.searchForm)
577
+ // this.searchFormContent = searchParam.searchForm
578
+ }
579
+ }
580
+ }
581
+ window.sessionStorage.removeItem('refreshList-' + this.storeId)
582
+ if (searchParam === undefined) {
583
+ searchParam = this.getSearchParam()
584
+ }
585
+ const gridParams = store.get(this.storeId)
586
+ let param = searchParam
587
+ if (gridParams.options.extraParam) {
588
+ param = {
589
+ searchParam: searchParam,
590
+ }
591
+ if (gridParams.options.extraParam) {
592
+ for (const paramName in gridParams.options.extraParam) {
593
+ param[paramName] = gridParams.options.extraParam[paramName]
594
+ }
595
+ }
596
+ }
597
+ // 导出需要这两个参数
598
+ gridParams.searchParam = searchParam
599
+ gridParams.url = this.url
600
+ const requestUrl = this.url
601
+ // 缓存查询条件及当前页数
602
+ window.sessionStorage.setItem(
603
+ 'searchParam-' + this.storeId,
604
+ JSON.stringify(param)
605
+ )
606
+ this.$http
607
+ .post(requestUrl, param)
608
+ .then((data) => {
609
+ // 对数据做序列化,比如:处理xss攻击
610
+ if (isHasOptionFunction('gridDataLoaded', this.storeId)) {
611
+ const gridData = gridParams.options.gridDataLoaded.call(this, {
612
+ gridData: data.data,
613
+ columns: gridParams.columns,
614
+ })
615
+ if (gridData) {
616
+ this.gridData = gridData
617
+ } else {
618
+ this.gridData = data.data
619
+ }
620
+ } else {
621
+ this.gridData = data.data
622
+ }
623
+ if (!this.gridData) {
624
+ this.gridData = []
625
+ }
626
+
627
+ if (this.pagination !== null) {
628
+ this.pagination.total = data.total
629
+ }
630
+
631
+ gridParams.gridData = this.gridData
632
+ // 完成深拷贝,复制一份对象,行编辑时使用
633
+ gridParams.orgGridData = [].concat(
634
+ JSON.parse(JSON.stringify(this.gridData))
635
+ )
636
+
637
+ gridParams.pagination = this.pagination
638
+ gridParams.loaded = true
639
+ this.hasLoadData = true
640
+ resolve()
641
+ })
642
+ .catch((error) => {
643
+ if (isHasOptionFunction('loadError', this.storeId)) {
644
+ gridParams.options.loadError.call(this, this.code, error)
645
+ }
646
+ reject(error)
647
+ })
648
+ })
649
+ },
650
+ getLength(paramsData) {
651
+ if (paramsData && paramsData.length > 5) {
652
+ return '(' + paramsData.substring(0, 5) + '...' + ')'
653
+ } else if (paramsData) {
654
+ return '(' + paramsData + ')'
655
+ } else {
656
+ return ''
657
+ }
658
+ },
659
+ // 获得初始查询条件对象
660
+ getInitSearchForm(searchFormArr) {
661
+ const gridParams = store.get(this.storeId)
662
+ if (searchFormArr && searchFormArr.length > 0) {
663
+ this.searchFormContent = {}
664
+ searchFormArr.forEach((item) => {
665
+ // 获得的是"isDeleted"
666
+ let prop = item.propName
667
+ // 获得的是“deleted”
668
+ const columnProp = item.columnProp
669
+ const dataType = item.dataType
670
+ if (dataType && dataType === 'BOOLEAN') {
671
+ prop = columnProp
672
+ }
673
+ this.initSearchProps.push(prop)
674
+ const propValue = item.propValue
675
+ if (prop.indexOf('.') > 0) {
676
+ // 动态给searchForm添加属性,包括多级嵌套属性,属性的初始值都为 null
677
+ addDynamicProp(this.searchFormContent, prop, propValue)
678
+ } else {
679
+ this.searchFormContent[prop] = propValue
680
+ }
681
+ })
682
+ gridParams.searchForm = searchFormArr
683
+ // 调用查询api方法,该方法中调用了@showSearch方法,用于控制“查询”按钮改名为“取消查询”
684
+ this.showSearchForm()
685
+ } else {
686
+ gridParams.searchForm = null
687
+ }
688
+ },
689
+ showDemo() {
690
+ this.isLoading = true
691
+ this.$http
692
+ .get(this.url)
693
+ .then((data) => {
694
+ Object.assign(this, data)
695
+ const gridParams = store.get(this.storeId)
696
+
697
+ gridParams.listCode = this.code
698
+
699
+ gridParams.columns = this.columns
700
+ if (gridParams.columns && this.options.dynamicColumns) {
701
+ for (var i = 0; i < this.options.dynamicColumns.length; i++) {
702
+ this.options.dynamicColumns[i].dynamic = true
703
+ gridParams.columns.push(this.options.dynamicColumns[i])
704
+ }
705
+ }
706
+ gridParams.lineEdit = this.lineEdit
707
+ gridParams.basicInfo = this.basicInfo
708
+ gridParams.pagination = this.pagination
709
+ gridParams.query = this.query
710
+
711
+ this.gridData = data.gridData
712
+ // 对数据做序列化,比如:处理xss攻击
713
+ if (isHasOptionFunction('gridDataLoaded', this.storeId)) {
714
+ const gridData = gridParams.options.gridDataLoaded.call(
715
+ this,
716
+ data.gridData
717
+ )
718
+ if (gridData) {
719
+ this.gridData = gridData
720
+ } else {
721
+ this.gridData = data.gridData
722
+ }
723
+ } else {
724
+ this.gridData = data.gridData
725
+ }
726
+
727
+ if (this.pagination != null) {
728
+ this.pagination.total = data.total
729
+ }
730
+ if (!this.gridData) {
731
+ this.gridData = []
732
+ }
733
+ gridParams.gridData = this.gridData
734
+ // 完成深拷贝,复制一份对象,行编辑时使用
735
+ gridParams.orgGridData = [].concat(
736
+ JSON.parse(JSON.stringify(this.gridData))
737
+ )
738
+ gridParams.pagination = this.pagination
739
+
740
+ if (isHasOptionFunction('gridComplete', this.storeId)) {
741
+ gridParams.options.gridComplete.call(
742
+ this,
743
+ this.gridData,
744
+ gridParams.columns
745
+ )
746
+ }
747
+ })
748
+ .catch((error) => {
749
+ if (isHasOptionFunction('loadError', this.storeId)) {
750
+ const gridParams = store.get(this.storeId)
751
+ gridParams.options.loadError.call(this, this.code, error)
752
+ }
753
+ })
754
+ },
755
+ search(searchForm) {
756
+ const vm = this
757
+ return new Promise((resolve, reject) => {
758
+ const gridParams = store.get(vm.storeId)
759
+ if (typeof searchForm !== 'undefined' && searchForm !== null) {
760
+ gridParams.searchForm = searchForm
761
+ } else {
762
+ gridParams.searchForm = null
763
+ }
764
+
765
+ vm.fetchData(vm.getSearchParam(), true)
766
+ .then((data) => {
767
+ if (
768
+ gridParams.options !== undefined &&
769
+ gridParams.options.isHiddenSearchForm !== undefined &&
770
+ gridParams.options.isHiddenSearchForm === true
771
+ ) {
772
+ // 查询时,是否隐藏查询区域,默认是不隐藏查询区域
773
+ vm.showSearch = false
774
+ $emit(vm, 'cancel-search')
775
+ }
776
+ if (vm.$refs.sf) {
777
+ vm.$refs.sf.loading = false
778
+ }
779
+ resolve(data)
780
+ })
781
+ .catch((error) => {
782
+ if (vm.$refs.sf) {
783
+ vm.$refs.sf.loading = false
784
+ }
785
+ reject(error)
786
+ })
787
+ })
788
+ },
789
+ getSearchParam() {
790
+ const searchParam = {
791
+ code: this.code,
792
+ }
793
+ const gridParams = store.get(this.storeId)
794
+ if (this.pagination !== null) {
795
+ const pagination = {
796
+ currentPage: this.currentPage,
797
+ pageSize: this.pagination.pageSize,
798
+ showTotal: this.pagination.showTotal,
799
+ }
800
+ if (this.pageSize !== null) {
801
+ // 表示更改了每页显示的数据条数
802
+ pagination.pageSize = this.pageSize
803
+ }
804
+ searchParam.pagination = pagination
805
+ }
806
+ // 排序信息
807
+ if (this.sortInfo !== null) {
808
+ // 表示更改了排序信息
809
+ searchParam.sorts = this.sortInfo
810
+ }
811
+ if (this.mergeFields && this.mergeFields.length > 0) {
812
+ if (!searchParam.sorts) {
813
+ searchParam.sorts = []
814
+ }
815
+ const mergeFieldsArr = []
816
+ for (const mergeField of this.mergeFields) {
817
+ let flag = true
818
+ for (const so of searchParam.sorts) {
819
+ if (so.prop === mergeField) {
820
+ flag = false
821
+ break
822
+ }
823
+ }
824
+ if (flag) {
825
+ mergeFieldsArr.push({
826
+ prop: mergeField,
827
+ order: 'ascending',
828
+ })
829
+ }
830
+ }
831
+ mergeFieldsArr.push(...searchParam.sorts)
832
+ searchParam.sorts = mergeFieldsArr
833
+ }
834
+ // 是否有初始过滤条件
835
+ if (
836
+ gridParams.options &&
837
+ typeof gridParams.options.initSearchForm !== 'undefined'
838
+ ) {
839
+ searchParam.initSearchForm = gridParams.options.initSearchForm
840
+ }
841
+ if (typeof gridParams.searchForm !== 'undefined') {
842
+ searchParam.searchForm = gridParams.searchForm
843
+ } else {
844
+ searchParam.searchForm = []
845
+ }
846
+ return searchParam
847
+ },
848
+ handleSizeChange(val) {
849
+ this.pageSize = val
850
+ this.fetchData(this.getSearchParam())
851
+ },
852
+ handleCurrentChange(val) {
853
+ this.fetchData(this.getSearchParam())
854
+ },
855
+ handleSortChange({ column, prop, order }) {
856
+ if (prop !== null) {
857
+ // 当点击第3次时,prop会是空,表示清空排序字段,还原原顺序
858
+ this.sortInfo = [
859
+ {
860
+ prop: prop,
861
+ order: order,
862
+ },
863
+ ]
864
+ } else {
865
+ this.sortInfo = null
866
+ }
867
+ this.fetchData(this.getSearchParam())
868
+ $emit(this, 'sort-change', { column, prop, order })
869
+ },
870
+ resetSearch() {
871
+ this.search(null, false)
872
+ },
873
+ // 新建事件
874
+ add() {
875
+ $emit(this, 'add')
876
+ },
877
+ // 操作按钮的点击事件
878
+ buttonClick(event, data) {
879
+ if (event) {
880
+ if (typeof event === 'function') {
881
+ event.call(this, data)
882
+ } else {
883
+ $emit(this, event, data)
884
+ }
885
+ }
886
+ },
887
+ // 点击内容区域的事件
888
+ clickContent(data) {
889
+ this.changeSelect(data)
890
+ $emit(this, 'click', data)
891
+ },
892
+ // 格子拖拽
893
+ rowDrop() {
894
+ if (this.urlToSaveOrder) {
895
+ let urlToSaveOrder = this.urlToSaveOrder
896
+ if (
897
+ urlToSaveOrder.indexOf('http:') < 0 ||
898
+ urlToSaveOrder.indexOf('https:') < 0
899
+ ) {
900
+ // 表示是相对路径,需要拼接全路径
901
+ let baseURL = window.$vueApp.config.globalProperties.baseURL
902
+ if (baseURL.lastIndexOf('/') === baseURL.length - 1) {
903
+ // 表示以斜线结尾
904
+ // 去掉斜线
905
+ baseURL = baseURL.substring(0, baseURL.length - 1)
906
+ }
907
+ if (urlToSaveOrder.indexOf('/') > 0) {
908
+ // 表示不是以斜线开头,需要开头加“/”
909
+ urlToSaveOrder = '/' + urlToSaveOrder
910
+ }
911
+ urlToSaveOrder = baseURL + urlToSaveOrder
912
+ }
913
+ const tbody = document.querySelector('#' + this.gridId + ' .el-row')
914
+ if (tbody != null) {
915
+ const vm = this
916
+ Sortable.create(tbody, {
917
+ draggable: '.col-content',
918
+ onEnd({ newIndex, oldIndex }) {
919
+ const addCardId = document.querySelector(
920
+ '#' + vm.gridId + ' #_addCardId_'
921
+ )
922
+ if (addCardId != null) {
923
+ // 表示存在新建区域,则序号需要减1
924
+ if (oldIndex > 0) {
925
+ oldIndex = oldIndex - 1
926
+ }
927
+ if (newIndex > 0) {
928
+ newIndex = newIndex - 1
929
+ }
930
+ }
931
+ const params = {
932
+ oldIndex: oldIndex,
933
+ newIndex: newIndex,
934
+ gridData: vm.gridData,
935
+ }
936
+ vm.$http.post(urlToSaveOrder, params).then((data) => {
937
+ const currRow = vm.gridData.splice(oldIndex, 1)[0]
938
+ vm.gridData.splice(newIndex, 0, currRow)
939
+ vm.refresh().then(() => {
940
+ $emit(vm, 'afterDrag', params)
941
+ })
942
+ })
943
+ },
944
+ })
945
+ }
946
+ }
947
+ },
948
+ // 多选按钮的change事件
949
+ changeChecked(label, index) {
950
+ const entity = this.gridData[index]
951
+ if ((label + '').indexOf('false-') >= 0) {
952
+ // 表示取消勾选记录
953
+ this.unselect(entity)
954
+ } else {
955
+ // 表示勾选记录
956
+ this.select(entity)
957
+ }
958
+ },
959
+ unselect(entity) {
960
+ const id = entity.id
961
+ const index = this.selectionIds.indexOf(id)
962
+ if (index > -1) {
963
+ this.selections.splice(index, 1)
964
+ this.selectionIds.splice(index, 1)
965
+ }
966
+ $emit(this, 'unselect', entity, this.selections)
967
+ this.selectionModels['select' + id] = 'false-' + id
968
+ // console.log('unselect---this.selections=', this.selections)
969
+ },
970
+ select(entity) {
971
+ const id = entity.id
972
+ if (this.selectionIds.indexOf(id) < 0) {
973
+ this.selectionIds[this.selectionIds.length] = id
974
+ this.selections[this.selections.length] = entity
975
+ }
976
+ $emit(this, 'select', entity, this.selections)
977
+ this.selectionModels['select' + id] = id
978
+ // console.log('select---this.selections=', this.selections)
979
+ },
980
+ // 单选按钮的change事件
981
+ changeSelectWhenRadio(label, index) {
982
+ const entity = this.gridData[index]
983
+ this.selectionIds = []
984
+ this.selections = []
985
+ this.selectionModels = {}
986
+ this.select(entity)
987
+ },
988
+ changeSelect(data) {
989
+ const id = data.id
990
+ if (this.multiple === true) {
991
+ // 多选时
992
+ if (this.selectionIds && this.selectionIds.indexOf(id) >= 0) {
993
+ // 表示需要取消选中
994
+ this.unselect(data)
995
+ } else {
996
+ // 表示需要选中
997
+ this.select(data)
998
+ }
999
+ } else {
1000
+ // 单选时
1001
+ this.currentId = id
1002
+ this.selectionIds = []
1003
+ this.selections = []
1004
+ this.selectionModels = {}
1005
+ this.select(data)
1006
+ }
1007
+ },
1008
+ isShowButton(entity, button) {
1009
+ const val = this.isShowButtonFun(entity, button)
1010
+ if (val === undefined) {
1011
+ return true
1012
+ }
1013
+ return val
1014
+ },
1015
+ // 是否显示启用禁用按钮
1016
+ showEnableButton(entity) {
1017
+ const gridParams = store.get(this.storeId)
1018
+ if (isHasOptionFunction('showEnableButton', this.storeId)) {
1019
+ return gridParams.options.showEnableButton.call(this, entity)
1020
+ }
1021
+ return false
1022
+ },
1023
+ // 启用禁用按钮显示状态
1024
+ changeState(entity) {
1025
+ const gridParams = store.get(this.storeId)
1026
+ if (isHasOptionFunction('changeState', this.storeId)) {
1027
+ return gridParams.options.changeState.call(this, entity)
1028
+ }
1029
+ return false
1030
+ },
1031
+ },
1032
+ emits: [
1033
+ 'sort-change',
1034
+ ,
1035
+ 'click',
1036
+ 'afterDrag',
1037
+ 'unselect',
1038
+ 'select',
1039
+ 'cancel-search',
1040
+ 'add',
1041
+ ,
1042
+ ],
1043
+ }
1044
+ </script>
1045
+
1046
+ <style lang="scss" rel="stylesheet/scss" scoped>
1047
+ .nine-grid-area {
1048
+ padding: 10px;
1049
+ .el-row {
1050
+ margin-bottom: 20px;
1051
+ &:last-child {
1052
+ margin-bottom: 0;
1053
+ }
1054
+ }
1055
+ .el-col-5 {
1056
+ width: 20%;
1057
+ }
1058
+ .el-col {
1059
+ border-radius: 4px;
1060
+ margin-bottom: 10px;
1061
+ }
1062
+ .name {
1063
+ font-size: 12px;
1064
+ color: #555;
1065
+ float: left;
1066
+ width: 80%;
1067
+ text-align: left;
1068
+ }
1069
+ .bottom {
1070
+ // margin-top: 13px;
1071
+ line-height: 13px;
1072
+ // background: aquamarine;
1073
+ }
1074
+ .state {
1075
+ font-size: 12px;
1076
+ margin-top: 1.5px;
1077
+ float: right;
1078
+ line-height: 1;
1079
+ display: flex;
1080
+ align-items: right;
1081
+ color: #999;
1082
+ width: 20%;
1083
+ text-align: right;
1084
+ }
1085
+ .image {
1086
+ width: 100%;
1087
+ display: block;
1088
+ height: 200px;
1089
+ }
1090
+ .clearfix:before,
1091
+ .clearfix:after {
1092
+ display: table;
1093
+ content: '';
1094
+ }
1095
+ .clearfix:after {
1096
+ clear: both;
1097
+ }
1098
+ .input-with-select {
1099
+ // background-color: #fff;
1100
+ width: 200px;
1101
+ float: right;
1102
+ }
1103
+ .popContainer {
1104
+ position: absolute;
1105
+ width: 23.15%;
1106
+ display: block;
1107
+ height: 200px;
1108
+ background: rgba(0, 0, 0, 0.5);
1109
+ text-align: right;
1110
+ }
1111
+ .fade-enter-active,
1112
+ .fade-leave-active {
1113
+ transition: opacity 0.5s;
1114
+ }
1115
+ .fade-enter,
1116
+ .fade-leave-to {
1117
+ opacity: 0;
1118
+ }
1119
+ .icons {
1120
+ color: #adb5bd;
1121
+ margin: 10px 10px 0px 0px;
1122
+ cursor: pointer;
1123
+ }
1124
+ .release-status {
1125
+ display: block;
1126
+ width: 8px;
1127
+ height: 8px;
1128
+ margin-right: 8px;
1129
+ border-radius: 100%;
1130
+ }
1131
+ .add-screen {
1132
+ display: flex;
1133
+ flex-direction: column;
1134
+ justify-content: center;
1135
+ align-items: center;
1136
+ cursor: pointer;
1137
+ height: 160px;
1138
+ // background-color: #fff;
1139
+ // border: 1px solid #7693f5;
1140
+ // box-shadow: 0 2px 8px 0 rgba(104,130,218,.4);
1141
+ font-size: 12px;
1142
+ color: #666666;
1143
+ font-family: Source Han Sans CN;
1144
+ font-weight: regular;
1145
+ font-size: 14px;
1146
+ line-height: 14px;
1147
+ letter-spacing: 0px;
1148
+ text-align: left;
1149
+ }
1150
+ .el-divider--horizontal {
1151
+ margin: 5px 0;
1152
+ }
1153
+ .button-style {
1154
+ margin-top: 28px;
1155
+ color: #606266;
1156
+ font-family: Source Han Sans CN;
1157
+ font-weight: regular;
1158
+ font-size: 14px;
1159
+ line-height: 14px;
1160
+ letter-spacing: 0px;
1161
+ text-align: left;
1162
+ }
1163
+ }
1164
+ </style>