imatrix-ui 0.0.15 → 0.1.1-up

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. package/.vscode/extensions.json +3 -0
  2. package/README.md +7 -0
  3. package/components/dynamic-source-select/dynamic-source-select-service.js +106 -0
  4. package/components/dynamic-source-select/dynamic-source-select.vue +673 -0
  5. package/components/dynamic-source-select/events.js +77 -0
  6. package/components/fs-preview/fs-preview.vue +287 -0
  7. package/components/index.js +26 -0
  8. package/components/plugins/export-data-new.js +623 -0
  9. package/components/plugins/export-data.js +431 -0
  10. package/components/plugins/index.js +15 -0
  11. package/components/plugins/public-method.js +47 -0
  12. package/components/rich-editor/index-bak.vue +306 -0
  13. package/components/rich-editor/index.vue +236 -0
  14. package/components/rich-editor/langs/zh-Hans.js +438 -0
  15. package/components/rich-editor/viewer.vue +105 -0
  16. package/components/super-grid/apis.js +1065 -0
  17. package/components/super-grid/columns-config.vue +430 -0
  18. package/components/super-grid/custom-formatter.js +330 -0
  19. package/components/super-grid/dynamic-input.vue +1706 -0
  20. package/components/super-grid/eventBus.js +2 -0
  21. package/components/super-grid/events.js +56 -0
  22. package/components/super-grid/formValidatorUtil.js +300 -0
  23. package/components/super-grid/formatter.js +190 -0
  24. package/components/super-grid/group-column.vue +100 -0
  25. package/components/super-grid/header-context-menu.vue +82 -0
  26. package/components/super-grid/index-column.vue +69 -0
  27. package/components/super-grid/normal-column.vue +1148 -0
  28. package/components/super-grid/public-methods.js +30 -0
  29. package/components/super-grid/row-operation.vue +193 -0
  30. package/components/super-grid/search-button.vue +74 -0
  31. package/components/super-grid/search-condition-input.vue +73 -0
  32. package/components/super-grid/search-condition-list.vue +68 -0
  33. package/components/super-grid/search-form-advancedQuery.vue +820 -0
  34. package/components/super-grid/search-form-dialog.vue +77 -0
  35. package/components/super-grid/search-form-item.vue +470 -0
  36. package/components/super-grid/search-form-number.vue +111 -0
  37. package/components/super-grid/search-form-open.vue +178 -0
  38. package/components/super-grid/search-form-ordinarySearch.vue +218 -0
  39. package/components/super-grid/search-form.vue +756 -0
  40. package/components/super-grid/search-methods.js +484 -0
  41. package/components/super-grid/selection-column.vue +46 -0
  42. package/components/super-grid/store.js +3 -0
  43. package/components/super-grid/super-grid-service.js +682 -0
  44. package/components/super-grid/super-grid.vue +2893 -0
  45. package/components/super-grid/utils.js +851 -0
  46. package/components/super-grid/view-image-dialog.vue +173 -0
  47. package/components/utils/gogocodeTransfer.js +59 -0
  48. package/components/utils/utils.js +180 -0
  49. package/components/utils/value-set.js +98 -0
  50. package/components/z-test-utton/index.vue +82 -0
  51. package/package.json +29 -40
  52. package/public/index.html +13 -0
  53. package/public/vite.svg +1 -0
  54. package/src/api/sso-service.js +172 -19
  55. package/src/api/tab.js +36 -0
  56. package/src/api/user-service.js +11 -11
  57. package/src/assets/401/401.gif +0 -0
  58. package/src/assets/404/404-cloud.png +0 -0
  59. package/src/assets/404/404.png +0 -0
  60. package/src/assets/cloud.png +0 -0
  61. package/src/directives/permission/index.js +13 -13
  62. package/src/directives/permission/permission.js +20 -15
  63. package/src/i18n/i18n.js +16 -0
  64. package/src/i18n/langs/cn.js +254 -0
  65. package/src/i18n/langs/en.js +264 -0
  66. package/src/permission.js +157 -71
  67. package/src/plugins.js +18 -18
  68. package/src/router/index.js +96 -69
  69. package/src/store/getters.js +15 -10
  70. package/src/store/index.js +19 -19
  71. package/src/store/modules/app.js +54 -42
  72. package/src/store/modules/permission.js +137 -73
  73. package/src/store/modules/tab-content.js +36 -0
  74. package/src/store/modules/user.js +293 -80
  75. package/src/styles/display-layout.scss +34 -0
  76. package/src/styles/element-ui.scss +29 -29
  77. package/src/styles/index.scss +157 -78
  78. package/src/styles/mixin.scss +27 -27
  79. package/src/styles/theme/black/font-style.scss +70 -0
  80. package/src/styles/theme/black/index.scss +306 -0
  81. package/src/styles/theme/black/sidebar.scss +189 -0
  82. package/src/styles/theme/blue/font-style.scss +46 -0
  83. package/src/styles/theme/blue/index.scss +172 -0
  84. package/src/styles/{sidebar.scss → theme/blue/sidebar.scss} +171 -141
  85. package/src/styles/theme/blue2/font-style.scss +70 -0
  86. package/src/styles/theme/blue2/index.scss +188 -0
  87. package/src/styles/theme/blue2/sidebar.scss +201 -0
  88. package/src/styles/theme/dark-blue/button.scss +9 -0
  89. package/src/styles/theme/dark-blue/card.scss +62 -0
  90. package/src/styles/theme/dark-blue/checkbox.scss +10 -0
  91. package/src/styles/theme/dark-blue/dark-blue-var.scss +8 -0
  92. package/src/styles/theme/dark-blue/dialog.scss +21 -0
  93. package/src/styles/theme/dark-blue/element-variables.scss +7 -0
  94. package/src/styles/theme/dark-blue/font.scss +71 -0
  95. package/src/styles/theme/dark-blue/form.scss +51 -0
  96. package/src/styles/theme/dark-blue/index.scss +269 -0
  97. package/src/styles/theme/dark-blue/input.scss +15 -0
  98. package/src/styles/theme/dark-blue/message.scss +8 -0
  99. package/src/styles/theme/dark-blue/pagination.scss +14 -0
  100. package/src/styles/theme/dark-blue/scrollbar-style.scss +32 -0
  101. package/src/styles/theme/dark-blue/sidebar.scss +266 -0
  102. package/src/styles/theme/dark-blue/tab.scss +83 -0
  103. package/src/styles/theme/dark-blue/table.scss +60 -0
  104. package/src/styles/theme/dark-blue/tree.scss +31 -0
  105. package/src/styles/theme/dark-blue/var.scss +1028 -0
  106. package/src/styles/theme/gray/card-style.scss +54 -0
  107. package/src/styles/theme/gray/font-style.scss +70 -0
  108. package/src/styles/theme/gray/index.scss +172 -0
  109. package/src/styles/theme/gray/input-style.scss +19 -0
  110. package/src/styles/theme/gray/scrollbar-style.scss +32 -0
  111. package/src/styles/theme/gray/sidebar.scss +231 -0
  112. package/src/styles/theme/gray/tab-style.scss +81 -0
  113. package/src/styles/transition.scss +47 -46
  114. package/src/utils/auth-api.js +159 -0
  115. package/src/utils/auth.js +61 -15
  116. package/src/utils/calculator/calculator-factory-wf.js +558 -0
  117. package/src/utils/calculator/calculator-factory.js +145 -0
  118. package/src/utils/calculator/calculator-util.js +166 -0
  119. package/src/utils/common-util.js +305 -0
  120. package/src/utils/eventBus.js +2 -0
  121. package/src/utils/iconUtils.js +28 -0
  122. package/src/utils/index.js +102 -86
  123. package/src/utils/jump-page-utils.js +814 -0
  124. package/src/utils/local-storage.js +33 -31
  125. package/src/utils/menu.js +19 -0
  126. package/src/utils/permission.js +31 -26
  127. package/src/utils/permissionAuth.js +90 -0
  128. package/src/utils/range-selector.js +188 -0
  129. package/src/utils/request.js +270 -116
  130. package/src/utils/restful-interface-utils.js +57 -0
  131. package/src/utils/util.js +698 -0
  132. package/src/utils/validate.js +34 -33
  133. package/src/utils/watermark.js +108 -0
  134. package/src/utils/workflow-util.js +93 -0
  135. package/src/views/404.vue +248 -228
  136. package/src/views/dsc-component/Sidebar/Item.vue +84 -0
  137. package/src/views/dsc-component/Sidebar/Link.vue +38 -0
  138. package/src/views/dsc-component/Sidebar/SidebarItem.vue +196 -0
  139. package/src/views/dsc-component/Sidebar/index.vue +220 -0
  140. package/src/views/dsc-component/tabs/tab-content.vue +199 -0
  141. package/src/views/error-page/401.vue +106 -91
  142. package/src/views/error-page/404.vue +248 -228
  143. package/src/views/layout/EmptyLayout.vue +3 -0
  144. package/src/views/layout/Layout.vue +81 -68
  145. package/src/views/layout/NewLayout.vue +18 -0
  146. package/src/views/layout/components/AppMain.vue +39 -29
  147. package/src/views/layout/components/Breadcrumb/index.vue +156 -0
  148. package/src/views/layout/components/Menubar/Item.vue +57 -0
  149. package/src/views/layout/components/Menubar/Link.vue +38 -0
  150. package/src/views/layout/components/Menubar/SidebarItem.vue +164 -0
  151. package/src/views/layout/components/Menubar/index.vue +210 -0
  152. package/src/views/layout/components/Sidebar/Item.vue +53 -29
  153. package/src/views/layout/components/Sidebar/Link.vue +38 -39
  154. package/src/views/layout/components/Sidebar/SidebarItem.vue +135 -100
  155. package/src/views/layout/components/Sidebar/index.vue +141 -48
  156. package/src/views/layout/components/iframe-page.vue +38 -0
  157. package/src/views/layout/components/index.js +4 -3
  158. package/src/views/layout/components/tabs/tab-content.vue +207 -0
  159. package/src/views/layout/mixin/ResizeHandler.js +41 -41
  160. package/src/views/layout/tab-content-iframe-index.vue +38 -0
  161. package/src/views/layout/tab-content-index.vue +93 -0
  162. package/src/views/login/authredirect.vue +10 -10
  163. package/src/views/login/index.vue +296 -203
  164. package/src/views/login/update-password.vue +243 -0
  165. package/src/views/redirect/index.vue +14 -12
  166. package/src/views/wf-history/tache-subprocess-history.vue +45 -0
  167. package/vite.config.js +31 -0
  168. package/lib/super-ui.css +0 -1
  169. package/lib/super-ui.umd.min.js +0 -2
  170. package/src/styles/variables.scss +0 -4
  171. package/src/views/layout/components/Navbar.vue +0 -92
@@ -0,0 +1,1706 @@
1
+ <template>
2
+ <div
3
+ v-if="type && type.indexOf('custom:') >= 0 && componentName != ''"
4
+ :style="
5
+ row.validateErrorField && row.validateErrorField === column.prop
6
+ ? 'border:1px solid red'
7
+ : ''
8
+ "
9
+ >
10
+ <component
11
+ :is="componentName"
12
+ ref="customItem"
13
+ :disabled="disabled"
14
+ :entity="row"
15
+ :grid-data="gridData"
16
+ :page-grid-data="pageGridData"
17
+ :parent="parentFormData"
18
+ :prop="column.prop"
19
+ :row="row"
20
+ :row-index="position ? position.row : null"
21
+ :select-options="options"
22
+ :value="innerValue"
23
+ @change="cellEvent('change', $event)"
24
+ @input="cellEvent('input', $event)"
25
+ />
26
+ </div>
27
+ <div
28
+ v-else
29
+ :style="
30
+ row.validateErrorField && row.validateErrorField === column.prop
31
+ ? 'border:1px solid red'
32
+ : ''
33
+ "
34
+ >
35
+ <!--必须有@input ,否则无法输入值-->
36
+ <el-date-picker
37
+ v-if="type === 'year' || type === 'month'"
38
+ ref="item"
39
+ v-model="innerValue"
40
+ :disabled="disabled"
41
+ :editable="false"
42
+ :format="isFormat()"
43
+ :placeholder="$t('imatrixUIMessage.selectTime')"
44
+ :type="type"
45
+ :value-format="isValueFormat()"
46
+ style="width: 100%"
47
+ @blur="cellEvent('blur', $event)"
48
+ @change="cellEvent('change', $event)"
49
+ @focus="cellEvent('focus', $event)"
50
+ @input="cellEvent('input', $event)"
51
+ />
52
+ <el-date-picker
53
+ v-if="type === 'yearRange'"
54
+ ref="item"
55
+ v-model="innerValue"
56
+ :disabled="disabled"
57
+ :editable="false"
58
+ :placeholder="$t('imatrixUIMessage.selectYear')"
59
+ style="width: 100%"
60
+ type="year"
61
+ value-format="yyyy"
62
+ @blur="cellEvent('blur', $event)"
63
+ @change="cellEvent('change', $event)"
64
+ @focus="cellEvent('focus', $event)"
65
+ @input="cellEvent('input', $event)"
66
+ />
67
+ <!--必须有@input ,否则无法输入值-->
68
+ <el-date-picker
69
+ v-else-if="type === 'dateTimePicker'"
70
+ ref="item"
71
+ :disabled="disabled"
72
+ :editable="false"
73
+ :format="isFormat()"
74
+ :placeholder="$t('imatrixUIMessage.selectTime')"
75
+ :value="innerValue"
76
+ :value-format="isValueFormat()"
77
+ style="width: 100%"
78
+ type="datetime"
79
+ @blur="cellEvent('blur', $event)"
80
+ @change="cellEvent('change', $event)"
81
+ @focus="cellEvent('focus', $event)"
82
+ @input="cellEvent('input', $event)"
83
+ />
84
+ <el-date-picker
85
+ v-else-if="type === 'date' || column.dataType === 'DATE'"
86
+ ref="item"
87
+ :disabled="disabled"
88
+ :editable="false"
89
+ :format="isFormat()"
90
+ :picker-options="pickerOptions"
91
+ :placeholder="$t('imatrixUIMessage.selectionDate')"
92
+ :value="innerValue"
93
+ :value-format="isValueFormat()"
94
+ style="width: 100%"
95
+ type="date"
96
+ @blur="cellEvent('blur', $event)"
97
+ @change="cellEvent('change', $event)"
98
+ @focus="cellEvent('focus', $event)"
99
+ @input="cellEvent('input', $event)"
100
+ />
101
+ <!--必须有@input ,否则无法输入值-->
102
+ <el-date-picker
103
+ v-else-if="type === 'time' || column.dataType === 'TIME'"
104
+ ref="item"
105
+ :disabled="disabled"
106
+ :editable="false"
107
+ :format="isFormat()"
108
+ :placeholder="$t('imatrixUIMessage.selectTime')"
109
+ :value="innerValue"
110
+ :value-format="isValueFormat()"
111
+ style="width: 100%"
112
+ type="datetime"
113
+ @blur="cellEvent('blur', $event)"
114
+ @change="cellEvent('change', $event)"
115
+ @focus="cellEvent('focus', $event)"
116
+ @input="cellEvent('input', $event)"
117
+ />
118
+ <el-time-picker
119
+ v-else-if="type === 'timePicker'"
120
+ ref="item"
121
+ v-model="innerValue"
122
+ :disabled="disabled"
123
+ :format="isFormat()"
124
+ :placeholder="$t('imatrixUIMessage.pleaseEnterATimePoint')"
125
+ :value-format="isValueFormat()"
126
+ style="width: 100%"
127
+ @blur="cellEvent('blur', $event)"
128
+ @change="cellEvent('change', $event)"
129
+ @focus="cellEvent('focus', $event)"
130
+ @input="cellEvent('input', $event)"
131
+ />
132
+
133
+ <!--必须有@input ,否则无法输入值,如果是数字类型需要加上.number修饰符-->
134
+ <el-input
135
+ v-else-if="
136
+ type === 'input' &&
137
+ (column.dataType === 'INTEGER' || column.dataType === 'LONG')
138
+ "
139
+ ref="item"
140
+ v-model.number="innerValue"
141
+ :disabled="disabled"
142
+ :placeholder="$t('imatrixUIMessage.pleaseEnterContent')"
143
+ :title="innerValue"
144
+ clearable
145
+ @blur="cellEvent('blur', $event)"
146
+ @change="cellEvent('change', $event)"
147
+ @clear="cellEvent('clear', $event)"
148
+ @focus="cellEvent('focus', $event)"
149
+ @input="cellEvent('input', $event, true)"
150
+ />
151
+ <!--必须有@input ,否则无法输入值-->
152
+ <el-input
153
+ v-else-if="type === 'input'"
154
+ ref="item"
155
+ v-model="innerValue"
156
+ :disabled="disabled"
157
+ :maxlength="controlConfig.maxlength ? controlConfig.maxlength : ''"
158
+ :minlength="controlConfig.minlength ? controlConfig.minlength : ''"
159
+ :placeholder="$t('imatrixUIMessage.pleaseEnterContent')"
160
+ :title="innerValue"
161
+ clearable
162
+ @blur="cellEvent('blur', $event)"
163
+ @change="cellEvent('change', $event)"
164
+ @clear="cellEvent('clear', $event)"
165
+ @focus="cellEvent('focus', $event)"
166
+ @input="cellEvent('input', $event)"
167
+ />
168
+
169
+ <el-input
170
+ v-else-if="type === 'textarea'"
171
+ ref="item"
172
+ v-model="innerValue"
173
+ :disabled="disabled"
174
+ :maxlength="controlConfig.maxlength ? controlConfig.maxlength : ''"
175
+ :minlength="controlConfig.minlength ? controlConfig.minlength : ''"
176
+ :placeholder="$t('imatrixUIMessage.pleaseEnterContent')"
177
+ :rows="1"
178
+ :title="innerValue"
179
+ clearable
180
+ type="textarea"
181
+ @blur="cellEvent('blur', $event)"
182
+ @change="cellEvent('change', $event)"
183
+ @clear="cellEvent('clear', $event)"
184
+ @focus="cellEvent('focus', $event)"
185
+ @input="cellEvent('input', $event)"
186
+ />
187
+ <fs-upload-list
188
+ v-else-if="type === 'annex'"
189
+ :custom-view-url="true"
190
+ :disabled="disabled"
191
+ :file-info="fileInfo"
192
+ :file-list="fileList"
193
+ :file-set-obj="fileSetObj"
194
+ :is-sql="isSql"
195
+ :row="row"
196
+ :value="innerValue"
197
+ @delete="deleteFile"
198
+ @delete-success="deleteSuccess"
199
+ @upload-success="uploadOnSuccess"
200
+ />
201
+ <multipart-upload
202
+ v-else-if="type === 'multipartUpload'"
203
+ :disabled="disabled"
204
+ :entity="row"
205
+ :file-info="fileInfo"
206
+ :file-list="fileList"
207
+ :file-set-obj="fileSetObj"
208
+ :value="innerValue"
209
+ type="list"
210
+ @delete="deleteFile"
211
+ @delete-success="deleteSuccess"
212
+ @upload-success="uploadOnSuccess"
213
+ />
214
+ <!-- <el-input
215
+ v-else-if="type==='annex' && !fileMultiple"
216
+ ref="item"
217
+ :value="innerValue"
218
+ :readonly="true"
219
+ :disabled="disabled"
220
+ :placeholder="$t('imatrixUIMessage.pleaseEnterContent')"
221
+ >
222
+ <el-button slot="append" size="mini" :disabled="disabled" icon="el-icon-upload2" @click="openAnnexUpload" />
223
+ <el-button v-if="innerValue" slot="append" :disabled="disabled" size="mini" icon="el-icon-zoom-in" @click="previewImg" />
224
+ </el-input>
225
+
226
+ <el-input
227
+ v-else-if="type==='annex' && fileMultiple"
228
+ ref="item"
229
+ :value="lastFileName"
230
+ :readonly="true"
231
+ :disabled="disabled"
232
+ :placeholder="$t('imatrixUIMessage.pleaseEnterContent')"
233
+ >
234
+ <el-button slot="append" size="mini" :disabled="disabled" icon="el-icon-upload2" @click="openAnnexUpload" />
235
+ <el-button v-if="innerValue" slot="append" :disabled="disabled" size="mini" icon="el-icon-zoom-in" @click="previewImg" />
236
+ </el-input> -->
237
+
238
+ <!-- <custom-fma v-if="type==null ||type === ''" /> -->
239
+ <!-- v-model="newValue" -->
240
+ <!--必须有@input ,否则无法输入值-->
241
+ <el-select
242
+ v-else-if="type === 'select' && !isDynamicDataSourceSource()"
243
+ ref="item"
244
+ v-model="innerValue"
245
+ :allow-create="controlConfig.allowCreate ? true : false"
246
+ :clearable="controlConfig.clearable ? true : false"
247
+ :default-first-option="controlConfig.allowCreate ? true : false"
248
+ :disabled="disabled"
249
+ :filterable="controlConfig.filterable ? true : false"
250
+ :placeholder="$t('imatrixUIMessage.pleaseSelect')"
251
+ :title="getClassOptionTitle(innerValue)"
252
+ @blur="cellEvent('blur', $event)"
253
+ @change="cellEvent('change', $event)"
254
+ @clear="cellEvent('clear', $event)"
255
+ @focus="cellEvent('focus', $event)"
256
+ @input="cellEvent('input', $event)"
257
+ @visible-change="cellEvent('visible-change', $event)"
258
+ >
259
+ <el-option
260
+ v-for="item in options"
261
+ :key="item.value"
262
+ :label="item.label"
263
+ :value="item.value"
264
+ />
265
+ </el-select>
266
+ <!--必须有@input ,否则无法输入值-->
267
+ <el-select
268
+ v-else-if="type === 'multiselect' && !isDynamicDataSourceSource()"
269
+ ref="item"
270
+ v-model="innerValue"
271
+ :disabled="disabled"
272
+ :placeholder="$t('imatrixUIMessage.pleaseSelect')"
273
+ :title="getClassOptionTitle(innerValue)"
274
+ clearable
275
+ collapse-tags
276
+ multiple
277
+ @blur="cellEvent('blur', $event)"
278
+ @change="multiselectChange"
279
+ @clear="cellEvent('clear', $event)"
280
+ @focus="cellEvent('focus', $event)"
281
+ @input="cellEvent('input', $event)"
282
+ @visible-change="cellEvent('visible-change', $event)"
283
+ @remove-tag="cellEvent('remove-tag', $event)"
284
+ >
285
+ <el-option :label="$t('superGrid.selectAll')" value="saveAll" />
286
+ <el-option
287
+ v-for="item in options"
288
+ :key="item.value"
289
+ :label="item.label"
290
+ :value="item.value"
291
+ />
292
+ </el-select>
293
+ <dynamic-source-select
294
+ v-else-if="
295
+ (type === 'multiselect' || type === 'select') &&
296
+ isDynamicDataSourceSource()
297
+ "
298
+ v-model="innerValue"
299
+ :base-props="{
300
+ multiple: type === 'multiselect' ? true : false,
301
+ disabled: disabled,
302
+ }"
303
+ :column="column"
304
+ :entity="row"
305
+ :is-join-table="isJoinTable"
306
+ :list-code="listCode"
307
+ :list-toolbar-form-data="listToolbarFormData"
308
+ :options="{
309
+ dynamicDataSourceCode: dynamicDataSourceCode,
310
+ valueSetOptions: valueSetOptions,
311
+ isSql: isSql,
312
+ }"
313
+ :parent="parentFormData"
314
+ :table-name="tableName"
315
+ @blur="cellEvent('blur', $event)"
316
+ @change="multiselectChange"
317
+ @clear="cellEvent('clear', $event)"
318
+ @focus="cellEvent('focus', $event)"
319
+ @input="cellEvent('input', $event)"
320
+ @visible-change="cellEvent('visible-change', $event)"
321
+ @remove-tag="cellEvent('remove-tag', $event)"
322
+ @set-value="setDynamicSourceSelectValue"
323
+ />
324
+
325
+ <el-input-number
326
+ v-else-if="type === 'inputNumber'"
327
+ ref="item"
328
+ v-model="innerValue"
329
+ :controls-position="inputNumberSet.position"
330
+ :disabled="disabled"
331
+ :max="
332
+ inputNumberSet.max == 0
333
+ ? 0
334
+ : !inputNumberSet.max
335
+ ? Infinity
336
+ : inputNumberSet.max
337
+ "
338
+ :min="
339
+ inputNumberSet.min == 0
340
+ ? 0
341
+ : !inputNumberSet.min
342
+ ? -Infinity
343
+ : inputNumberSet.min
344
+ "
345
+ :precision="inputNumberSet.precision"
346
+ :step="!inputNumberSet.step ? 1 : inputNumberSet.step"
347
+ @blur="cellEvent('blur', $event)"
348
+ @change="cellEvent('change', $event)"
349
+ @focus="cellEvent('focus', $event)"
350
+ @input="cellEvent('input', $event)"
351
+ />
352
+ <!--mysql数据库--->
353
+ <el-switch
354
+ v-else-if="
355
+ (type === 'switch' || column.dataType === 'BOOLEAN') &&
356
+ dataSourceType === 'mysql'
357
+ "
358
+ ref="item"
359
+ :disabled="disabled"
360
+ :value="innerValue"
361
+ active-color="#13ce66"
362
+ inactive-color="#ff4949"
363
+ @change="cellEvent('change', $event)"
364
+ @input="cellEvent('input', $event, true)"
365
+ />
366
+ <!--oracle或sqlserver数据库--->
367
+ <el-switch
368
+ v-else-if="type === 'switch' || column.dataType === 'BOOLEAN'"
369
+ ref="item"
370
+ :active-value="1"
371
+ :disabled="disabled"
372
+ :inactive-value="0"
373
+ :value="innerValue"
374
+ active-color="#13ce66"
375
+ inactive-color="#ff4949"
376
+ @change="cellEvent('change', $event)"
377
+ @input="cellEvent('input', $event, true)"
378
+ />
379
+ <el-slider
380
+ v-else-if="type === 'slider'"
381
+ ref="item"
382
+ :disabled="disabled"
383
+ :value="innerValue"
384
+ @change="cellEvent('change', $event)"
385
+ @input="cellEvent('input', $event, true)"
386
+ />
387
+
388
+ <el-rate
389
+ v-else-if="type === 'rate'"
390
+ ref="item"
391
+ :disabled="disabled"
392
+ :value="innerValue"
393
+ @change="cellEvent('change', $event)"
394
+ @input="cellEvent('input', $event, true)"
395
+ />
396
+
397
+ <organization-input
398
+ v-else-if="deptManTree || deptTree || wgManTree || wgTree"
399
+ v-model="innerValue"
400
+ :check-strictly="isCheckStrictly"
401
+ :department-info="departmentInfo"
402
+ :disabled="disabled"
403
+ :fields="fields"
404
+ :is-join-table="isJoinTable"
405
+ :models="row"
406
+ :multiple="isMultiTree"
407
+ :table-name="tableName"
408
+ :tree-type="
409
+ deptManTree
410
+ ? 'DeptUserTree'
411
+ : deptTree
412
+ ? 'DeptTree'
413
+ : wgManTree
414
+ ? 'WgTree'
415
+ : wgTree
416
+ ? 'WgUserTree'
417
+ : null
418
+ "
419
+ @append="appendOrganizationInputEvent"
420
+ @clear="clearOrganizationInputEvent"
421
+ @focus="showOrganizationTree"
422
+ @replace="replaceOrganizationInputEvent"
423
+ @setValue="organizationInputEvent"
424
+ />
425
+
426
+ <el-dialog
427
+ :append-to-body="true"
428
+ :show-close="true"
429
+ :title="$t('imatrixUIMessage.tips')"
430
+ :visible.sync="annexUploadFlag"
431
+ width="30%"
432
+ >
433
+ <el-upload
434
+ v-if="type === 'annex' && annexUploadFlag"
435
+ :accept="fileSetObj && fileSetObj.accept ? fileSetObj.accept : null"
436
+ :action="defaultAction"
437
+ :before-upload="handleBeforeUpload"
438
+ :headers="headers"
439
+ :on-success="uploadOnSuccess"
440
+ :with-credentials="true"
441
+ name="file"
442
+ >
443
+ <el-button>{{ $t('imatrixUIMessage.upload') }}</el-button>
444
+ </el-upload>
445
+ </el-dialog>
446
+ <view-image-dialog
447
+ v-if="showSingleImgFlag"
448
+ :deleteable="!disabled"
449
+ :downloadable="!disabled"
450
+ :file-list="fileList"
451
+ @close="showSingleImgFlag = false"
452
+ @delete="deleteFile"
453
+ />
454
+ </div>
455
+ </template>
456
+ <script>
457
+ import store from './store'
458
+ import * as Vue from 'vue'
459
+ import {
460
+ analysisFileSetObj,
461
+ getFileList,
462
+ isDisableEdit,
463
+ isDynamicDataSourceSource,
464
+ isEditOptionFunction,
465
+ otherFilesToStandard,
466
+ } from './utils'
467
+ import dynamicSourceSelect from '../dynamic-source-select/dynamic-source-select.vue'
468
+ import {
469
+ getEntityFieldValue,
470
+ setEntityFieldValue,
471
+ } from '../../src/utils/util'
472
+ import { getToken } from '../../src/utils/auth'
473
+ import apis from './apis'
474
+ import ViewImageDialog from './view-image-dialog.vue'
475
+
476
+ export default {
477
+ name: 'DynamicInput',
478
+ components: {
479
+ dynamicSourceSelect,
480
+ ViewImageDialog,
481
+ },
482
+ props: {
483
+ value: {
484
+ type: [String, Boolean, Number, Date, Array],
485
+ default: null,
486
+ },
487
+ type: {
488
+ type: String,
489
+ default: 'input',
490
+ },
491
+ position: {
492
+ type: Object,
493
+ default: null,
494
+ },
495
+ lineEdit: {
496
+ type: Object,
497
+ default: null,
498
+ },
499
+ options: {
500
+ type: Array,
501
+ default: null,
502
+ },
503
+ // 字段配置
504
+ column: {
505
+ type: Object,
506
+ default: null,
507
+ },
508
+ // 行数据
509
+ row: {
510
+ type: Object,
511
+ default: null,
512
+ },
513
+ listCode: {
514
+ type: String,
515
+ default: null,
516
+ },
517
+ isSql: {
518
+ type: Boolean,
519
+ default: false,
520
+ },
521
+ listToolbarFormData: {
522
+ type: Object,
523
+ default: null,
524
+ },
525
+ rowIndex: {
526
+ type: Number,
527
+ default: -1,
528
+ },
529
+ },
530
+ data() {
531
+ let innerValue = this.value
532
+ if (this.type && this.type === 'select') {
533
+ // 单选下拉框时值处理
534
+ if (this.column.dataType !== 'TEXT') {
535
+ innerValue =
536
+ this.value && this.value !== null && typeof this.value !== 'string'
537
+ ? this.value + ''
538
+ : this.value
539
+ this.$emit('input', innerValue)
540
+ }
541
+ }
542
+ const defaultValue = this.getDefaultValue(innerValue)
543
+ if (defaultValue !== undefined && defaultValue !== null) {
544
+ innerValue = defaultValue
545
+ }
546
+ const disabled = isDisableEdit(this.column.prop, this.listCode, this.row)
547
+ const defaultAction =
548
+ window.$vueApp.config.globalProperties.baseAPI + '/component/super-form/uploads'
549
+ if (!this.listCode) {
550
+ this.listCode = store.get('_list_code')
551
+ }
552
+ const gridParams = store.get(this.listCode)
553
+ let tableName
554
+ if (gridParams && gridParams.basicInfo && gridParams.basicInfo.tableName) {
555
+ tableName = gridParams.basicInfo.tableName
556
+ }
557
+ let isHasJoinTable
558
+ if (
559
+ gridParams &&
560
+ gridParams.basicInfo &&
561
+ gridParams.basicInfo.hasJoinTable
562
+ ) {
563
+ isHasJoinTable = gridParams.basicInfo.hasJoinTable
564
+ }
565
+ let parentFormData
566
+ if (
567
+ gridParams.options.extraParam &&
568
+ gridParams.options.extraParam.entityMap
569
+ ) {
570
+ parentFormData = gridParams.options.extraParam.entityMap
571
+ }
572
+ const headers = { Authorization: getToken() }
573
+ // 数据库类型,值为mysql、oracle、sqlserver,默认是mysql,el-switch组件值保存需要使用
574
+ let dataSourceType = 'mysql'
575
+ if (Vue.prototype.dataSourceType) {
576
+ dataSourceType = window.$vueApp.config.globalProperties.dataSourceType.toLowerCase()
577
+ }
578
+ const gridData = gridParams.gridData
579
+ const subTableData = gridParams.subTableData
580
+ const isSubTableShowPage = gridParams.isSubTableShowPage
581
+ let controlConfig = {}
582
+ if (this.column.controlConfig) {
583
+ controlConfig = JSON.parse(this.column.controlConfig)
584
+ }
585
+ return {
586
+ deptManTree: false, // 是否是部门人员树
587
+ isMultiTree: false, // 是否是多选树
588
+ isCheckStrictly: false, // 父子不互相关联也就是不选中子部门节点
589
+ deptTree: false, // 是否是部门树
590
+ wgManTree: false, // 是否是工作组人员树
591
+ wgTree: false, // 是否是工作组树
592
+ newValue: null,
593
+ disabled, // 当前用户是否禁止编辑该字段/ 是否新增行
594
+ componentName: '',
595
+ validateErrorField: '', // 保存行记录时,验证失败的字段名
596
+ annexUploadFlag: false,
597
+ defaultAction,
598
+ fileMultiple: false, // 文件是否多选
599
+ lastFileName: '',
600
+ fileList: [],
601
+ lastServerName: '',
602
+ fileSetObj: null,
603
+ showSingleImgFlag: false,
604
+ singleImgSrc: '',
605
+ fields: null,
606
+ innerValue, // 输入的内容
607
+ dynamicSourceSelectOptions: {},
608
+ valueSetOptions: null,
609
+ dynamicDataSourceCode: null,
610
+ tableName,
611
+ isJoinTable: isHasJoinTable, // 是否是关联表
612
+ departmentInfo: null, // 指定部门或分支
613
+ parentFormData,
614
+ headers,
615
+ dataSourceType,
616
+ inputNumberSet: {},
617
+ fileInfo: { showName: null, serverPath: null },
618
+ gridData: isSubTableShowPage ? subTableData : gridData,
619
+ pageGridData: isSubTableShowPage ? gridData : null,
620
+ controlConfig,
621
+ // 设置日期选择器选择范围
622
+ pickerOptions: {
623
+ disabledDate: (time) => {
624
+ if (this.stateForbiddenTime && this.endForbiddenTime) {
625
+ return (
626
+ time.getTime() < this.stateForbiddenTime ||
627
+ time.getTime() > this.endForbiddenTime
628
+ )
629
+ } else if (this.stateForbiddenTime && !this.endForbiddenTime) {
630
+ return time.getTime() < this.stateForbiddenTime
631
+ } else if (!this.stateForbiddenTime && this.endForbiddenTime) {
632
+ return time.getTime() > this.endForbiddenTime
633
+ } else {
634
+ return false
635
+ }
636
+ },
637
+ },
638
+ stateForbiddenTime: null,
639
+ endForbiddenTime: null,
640
+ }
641
+ },
642
+ computed: {},
643
+ watch: {
644
+ value: {
645
+ handler(newValue, oldValue) {
646
+ // this.value = newValue
647
+ // this.innerValue = this.value
648
+ if (this.type && this.type === 'multiselect') {
649
+ // 修改时多选下拉值回显 ,将字符串转换为数组
650
+ const tempMultData =
651
+ this.value && this.value !== null && typeof this.value === 'string'
652
+ ? this.value.split(',')
653
+ : this.value
654
+ this.$set(this, 'innerValue', tempMultData)
655
+ } else {
656
+ if (this.type === 'yearRange') {
657
+ this.$set(this, 'innerValue', '' + newValue)
658
+ } else if (this.type === 'input' && newValue !== null) {
659
+ // 不允许输入框首尾有空格及全空格处理
660
+ if (newValue && typeof newValue === 'string') {
661
+ newValue = newValue.trim()
662
+ }
663
+ if (newValue === '') {
664
+ newValue = null
665
+ }
666
+ this.$set(this, 'innerValue', newValue)
667
+ } else {
668
+ this.$set(this, 'innerValue', newValue)
669
+ }
670
+ }
671
+ const gridParams = store.get(this.listCode)
672
+ if (gridParams.editProp === this.column.prop) {
673
+ // 如果是当前编辑的字段,且是自定义控件才需要手动获得一下焦点
674
+ this.$nextTick(() => {
675
+ if (this.$refs.customItem) {
676
+ this.$refs.customItem.focus()
677
+ }
678
+ })
679
+ }
680
+ },
681
+ deep: true,
682
+ immediate: true,
683
+ },
684
+ },
685
+ created() {
686
+ // console.log(this.type)
687
+ // console.log(this.column)
688
+ const gridParams = store.get(this.listCode)
689
+ this.gridParams = gridParams
690
+ this.isCreateRow = gridParams.isCreateRow
691
+ this.setTreeType()
692
+ if (this.type && this.type.indexOf('custom:') >= 0) {
693
+ this.componentName = this.type.substring(this.type.indexOf(':') + 1)
694
+ }
695
+
696
+ if (
697
+ this.column.fileSet &&
698
+ this.column.fileSet !== '' &&
699
+ (this.column.componentType === 'annex' ||
700
+ this.column.componentType === 'multipartUpload')
701
+ ) {
702
+ const fileSetObj = JSON.parse(this.column.fileSet)
703
+ this.fileInfo.showName = this.row[fileSetObj.showNameData.dbName]
704
+ this.fileInfo.serverPath = this.row[fileSetObj.serverNameData.dbName]
705
+ this.fileSetObj = fileSetObj
706
+ if (fileSetObj && fileSetObj.multiple) {
707
+ this.fileMultiple = true
708
+ }
709
+ this.fileList = getFileList(this.row, this.column, this.isSql)
710
+ this.packageFileNameWithFileList()
711
+ }
712
+
713
+ if (this.column.componentType === 'inputNumber') {
714
+ this.setInputNumberConfig()
715
+ }
716
+ // 如果是多选文件类型,需要解析(需要设置临时字段,判断文件还是图片,图片需要预览)
717
+ if (
718
+ this.column.valueSetOptions &&
719
+ this.column.componentType !== 'inputNumber'
720
+ ) {
721
+ const valueSetOptionsObj = JSON.parse(this.column.valueSetOptions)
722
+ if (valueSetOptionsObj && valueSetOptionsObj.valueSetOptions) {
723
+ this.$set(this, 'valueSetOptions', valueSetOptionsObj.valueSetOptions)
724
+ }
725
+ if (
726
+ valueSetOptionsObj.dynamicDataSourceCode &&
727
+ valueSetOptionsObj.dynamicDataSourceCode !== ''
728
+ ) {
729
+ this.$set(
730
+ this,
731
+ 'dynamicDataSourceCode',
732
+ valueSetOptionsObj.dynamicDataSourceCode
733
+ )
734
+ }
735
+ }
736
+ if (this.column.orgTreeSet) {
737
+ const orgTreeSet = JSON.parse(this.column.orgTreeSet)
738
+ if (this.type.indexOf('DeptTree') > 0 && orgTreeSet.checkStrictly) {
739
+ this.isCheckStrictly = orgTreeSet.checkStrictly
740
+ }
741
+ if (orgTreeSet.length) {
742
+ this.fields = orgTreeSet
743
+ } else {
744
+ if (orgTreeSet.orgTreeSetArr) {
745
+ this.fields = orgTreeSet.orgTreeSetArr
746
+ }
747
+ }
748
+ }
749
+ this.getDateAllowTime()
750
+ },
751
+ mounted() {
752
+ // 去掉该监听,否则导致焦点总是跳到第一个编辑框
753
+ // this.$watch('lineEdit.editingCell', function(newVal, oldVal) {
754
+ // this.focus()
755
+ // }, {
756
+ // immediate: true,
757
+ // deep: true
758
+ // })
759
+ },
760
+ methods: {
761
+ /**
762
+ * @author: 梁旭
763
+ * @description: 获取提示标题
764
+ * @Date: 2023-08-04 10:53:24
765
+ * @param {*}
766
+ * @return {*}
767
+ */
768
+ getClassOptionTitle(val) {
769
+ if (val !== null && val !== undefined && val !== '' && val.length > 0) {
770
+ let selectTittle = ''
771
+ if (typeof val === 'string') {
772
+ // 单选
773
+ this.options.forEach((item) => {
774
+ if (item.value === val) {
775
+ selectTittle = item.label
776
+ }
777
+ })
778
+ } else {
779
+ // 多选
780
+ this.options.forEach((item) => {
781
+ val.forEach((Vtem) => {
782
+ if (item.value === Vtem) {
783
+ selectTittle = selectTittle + item.label + ','
784
+ }
785
+ })
786
+ })
787
+ selectTittle = selectTittle.slice(0, selectTittle.length - 1)
788
+ }
789
+ return selectTittle
790
+ }
791
+ },
792
+ /**
793
+ * @description: 获取日期选择器可选时间范围
794
+ * @Date: 2023-07-20 13:18:14
795
+ * @param {*}
796
+ * @return {*}
797
+ */
798
+ getDateAllowTime() {
799
+ if (this.column.valueSetOptions) {
800
+ const optionsObj = JSON.parse(this.column.valueSetOptions)
801
+ const nowTime = Date.now()
802
+ if (optionsObj.stateForbiddenTime) {
803
+ const stateDayNumber = optionsObj.stateForbiddenTime
804
+ this.stateForbiddenTime =
805
+ nowTime - stateDayNumber * 24 * 60 * 60 * 1000
806
+ } else {
807
+ this.stateForbiddenTime = null
808
+ }
809
+ if (optionsObj.endForbiddenTime) {
810
+ const endDayNumber = optionsObj.endForbiddenTime
811
+ this.endForbiddenTime =
812
+ nowTime + endDayNumber * 24 * 60 * 60 * 1000 - 24 * 60 * 60 * 1000
813
+ } else {
814
+ this.endForbiddenTime = null
815
+ }
816
+ }
817
+ },
818
+ focus() {
819
+ if (this.type !== 'slider' && this.type !== 'rate') {
820
+ // slider滑块组件 和 rate评分组件 没有focus方法
821
+ if (
822
+ this.lineEdit.editingCell &&
823
+ this.position &&
824
+ this.position.row === this.lineEdit.editingCell.row &&
825
+ this.position.prop === this.lineEdit.editingCell.prop
826
+ ) {
827
+ if (this.$refs.item) {
828
+ this.$refs.item.focus()
829
+ }
830
+ }
831
+ }
832
+ },
833
+ handleBeforeUpload(file) {
834
+ let limitFileSize = this.fileSetObj.limitFileSize
835
+ if (limitFileSize === undefined) {
836
+ // 默认是30M
837
+ limitFileSize = 30
838
+ }
839
+ if (file.size > limitFileSize * 1024 * 1024) {
840
+ // 超过最大限制
841
+ this.$message({
842
+ type: 'warning',
843
+ message: this.$t('imatrixUIMessage.exceedFileSize', {
844
+ fileSize: limitFileSize,
845
+ }),
846
+ showClose: true,
847
+ })
848
+ // 返回false停止上传
849
+ return false
850
+ }
851
+ },
852
+ setTreeType() {
853
+ if (this.type) {
854
+ if (this.type.indexOf('single') >= 0 && this.type.indexOf('Tree') > 0) {
855
+ this.isMultiTree = false
856
+ } else {
857
+ this.isMultiTree = true
858
+ }
859
+ if (this.type.indexOf('DeptManTree') > 0) {
860
+ // 说明是部门人员树
861
+ this.deptManTree = true
862
+ }
863
+ if (this.type.indexOf('DeptTree') > 0) {
864
+ // 说明是部门树
865
+ this.deptTree = true
866
+ }
867
+ if (this.type.indexOf('WgManTree') > 0) {
868
+ // 说明是工作组人员树
869
+ this.wgManTree = true
870
+ }
871
+ if (this.type.indexOf('WgTree') > 0) {
872
+ // 说明是工作组树
873
+ this.wgTree = true
874
+ }
875
+ }
876
+ },
877
+ // 显示组织树时需要计算指定部门
878
+ showOrganizationTree() {
879
+ if (this.column.orgTreeSet) {
880
+ const orgTreeSet = JSON.parse(this.column.orgTreeSet)
881
+ if (orgTreeSet.length) {
882
+ this.fields = orgTreeSet
883
+ } else {
884
+ if (orgTreeSet.orgTreeSetArr) {
885
+ this.fields = orgTreeSet.orgTreeSetArr
886
+ }
887
+ if (orgTreeSet.specifyType) {
888
+ if (orgTreeSet.specifyType === 'dataTable') {
889
+ // 根据字段获取值
890
+ if (orgTreeSet.dataTableField) {
891
+ const dataTableFieldValue = getEntityFieldValue(
892
+ this.row,
893
+ orgTreeSet.dataTableField
894
+ )
895
+ if (dataTableFieldValue && dataTableFieldValue !== '') {
896
+ this.$set(
897
+ this,
898
+ 'departmentInfo',
899
+ dataTableFieldValue.split(',')
900
+ )
901
+ }
902
+ }
903
+ } else if (
904
+ orgTreeSet.specifyType === 'dept' ||
905
+ orgTreeSet.specifyType === 'workGroup'
906
+ ) {
907
+ if (orgTreeSet.specifyDept && orgTreeSet.specifyDept !== '') {
908
+ if (typeof orgTreeSet.specifyDept === 'object') {
909
+ // 固定值
910
+ this.$set(this, 'departmentInfo', orgTreeSet.specifyDept)
911
+ } else {
912
+ this.$set(
913
+ this,
914
+ 'departmentInfo',
915
+ orgTreeSet.specifyDept.split(',')
916
+ )
917
+ }
918
+ }
919
+ }
920
+ }
921
+ }
922
+ }
923
+ },
924
+ // isInputEventUpdateValue input事件时是否更新value值
925
+ cellEvent(eventName, event, isInputEventUpdateValue) {
926
+ // console.log('cellEvent1---eventName=', eventName, 'this.innerValue=', this.innerValue)
927
+ let isInputVal = false
928
+ if (eventName === 'focus') {
929
+ this.$emit('focus', event)
930
+ }
931
+ if (eventName === 'input' && this.isDateControll()) {
932
+ // 如果是日期控件,如果使用blur事件来修改数据内容,清空文本框内容不会改变model的值,所以还是需要input事件时处理
933
+ let val = event
934
+ if (val === '') {
935
+ val = null
936
+ }
937
+ this.$emit('input', val)
938
+ isInputVal = true
939
+ // 在callCustomEvent方法中使用了innerValue属性
940
+ this.innerValue = val
941
+ } else if (eventName === 'input' && this.isSelectControll()) {
942
+ // 如果是下拉框选择器控件,如果使用blur事件来修改数据内容,有时会更新不到最新数据
943
+ // console.log('cellEvent2---this.innerValue=', this.innerValue)
944
+ if (
945
+ this.type === 'multiselect' &&
946
+ this.innerValue &&
947
+ Object.prototype.toString.apply(this.innerValue) === '[object Array]'
948
+ ) {
949
+ // 如果是多选下拉框,且值是数组
950
+ const saveAll = 'saveAll'
951
+ if (this.innerValue.indexOf(saveAll) < 0) {
952
+ // 不包含“全选”时才走input,全选是在multiselectchange中特殊处理的
953
+ this.$emit('input', this.innerValue.join(','))
954
+ }
955
+ } else {
956
+ this.$emit('input', this.innerValue)
957
+ }
958
+ isInputVal = true
959
+ } else if (
960
+ eventName === 'input' &&
961
+ isInputEventUpdateValue !== undefined &&
962
+ isInputEventUpdateValue === true
963
+ ) {
964
+ // 表示input事件时更新值,switch、rate、slider组件时会走该分支
965
+ // 在callCustomEvent方法中使用了innerValue属性
966
+ this.innerValue = event
967
+ this.$emit('input', event)
968
+ isInputVal = true
969
+ } else if (eventName === 'blur' && !this.isSelectControll()) {
970
+ // 为了使输入时流畅,所以在blur时调用input,更改组件的数据
971
+ this.blurEvent()
972
+ isInputVal = true
973
+ }
974
+ if (!isInputVal && eventName === 'change') {
975
+ // 走完chang事件,触发一次失焦事件
976
+ // this.$refs.item.blur()
977
+ this.blurEvent()
978
+ // 验证是否是合法的小数
979
+ // 保存时后台给出数字类型转换错误的验证,前台不提供了,因为会同时出现两个类型错误提示信息的问题
980
+ // this.checkDecimal()
981
+ }
982
+ if (eventName === 'clear') {
983
+ if (
984
+ (this.type === 'multiselect' || this.type === 'select') &&
985
+ isDynamicDataSourceSource(this.column)
986
+ ) {
987
+ for (let index = 0; index < this.valueSetOptions.length; index++) {
988
+ if (
989
+ this.column.prop !==
990
+ this.valueSetOptions[0].valueColumn.dbColumnName
991
+ ) {
992
+ this.setCellValue(
993
+ this.valueSetOptions[0].valueColumn.dbColumnName,
994
+ null,
995
+ 'input'
996
+ )
997
+ }
998
+ }
999
+ }
1000
+ // 清空时,必须这样调用input事件 ,否则组件无法输入值
1001
+ this.$emit('input', null)
1002
+ }
1003
+ const gridParams = store.get(this.listCode)
1004
+ gridParams.editProp = this.column.prop
1005
+
1006
+ // console.log('cellEvent4---this.innerValue=', this.innerValue)
1007
+ if (this.column.events && this.column.events[eventName]) {
1008
+ // 事件回调
1009
+ this.callCustomEvent(eventName)
1010
+ } else if (isEditOptionFunction(eventName, this.listCode)) {
1011
+ // 为了兼容历史版本保留了该判断
1012
+
1013
+ gridParams.options.lineEditOptions[eventName].call(
1014
+ this,
1015
+ event,
1016
+ this.row,
1017
+ this.column
1018
+ )
1019
+ }
1020
+ this.$emit('findIndex')
1021
+ // console.log('cellEvent5---this.innerValue=', this.innerValue)
1022
+ },
1023
+ blurEvent() {
1024
+ if (this.innerValue === null || this.innerValue === undefined) {
1025
+ this.innerValue = null
1026
+ this.val = null
1027
+ }
1028
+ // 必须这样调用input事件 ,否则组件无法输入值
1029
+ this.$emit('input', this.innerValue)
1030
+ },
1031
+ // 是否是日期时间选择器
1032
+ isDateControll() {
1033
+ return (
1034
+ this.type === 'date' ||
1035
+ this.column.dataType === 'DATE' ||
1036
+ this.type === 'time' ||
1037
+ this.column.dataType === 'TIME'
1038
+ )
1039
+ },
1040
+ // 是否是下拉框选择器
1041
+ isSelectControll() {
1042
+ return this.type === 'select' || this.type === 'multiselect'
1043
+ },
1044
+ // 值设置是否是动态数据源类型的数据源
1045
+ isDynamicDataSourceSource() {
1046
+ return isDynamicDataSourceSource(this.column)
1047
+ },
1048
+ // 是否是小数类型字段
1049
+ isDecimalDateType() {
1050
+ return (
1051
+ (this.column.dataType && this.column.dataType === 'DOUBLE') ||
1052
+ this.column.dataType === 'FLOAT'
1053
+ )
1054
+ },
1055
+ // 调用自定义事件回调
1056
+ callCustomEvent(eventName) {
1057
+ this.callCustomEventWithParam(eventName, {
1058
+ value: this.innerValue,
1059
+ row: this.row,
1060
+ column: this.column,
1061
+ extendParams: this.extendParams,
1062
+ })
1063
+ },
1064
+ // 调用自定义事件回调
1065
+ callCustomEventWithParam(eventName, param) {
1066
+ // this.column.events 是个对象,key是事件名,value是options.eventCallBack中对应的方法名
1067
+ if (this.column && this.column.events && this.column.events[eventName]) {
1068
+ const funName = this.column.events[eventName]
1069
+ if (!this.listCode) {
1070
+ this.listCode = store.get('_list_code')
1071
+ }
1072
+ const gridParams = store.get(this.listCode)
1073
+ if (
1074
+ gridParams.options &&
1075
+ gridParams.options['eventCallBack'] &&
1076
+ gridParams.options['eventCallBack'][funName] &&
1077
+ typeof gridParams.options['eventCallBack'][funName] === 'function'
1078
+ ) {
1079
+ if (!param) {
1080
+ param = {}
1081
+ }
1082
+ param.formData =
1083
+ gridParams.options && gridParams.options.formData
1084
+ ? gridParams.options.formData
1085
+ : null
1086
+ param.parent = this.parentFormData
1087
+ param.rowIndex = this.rowIndex
1088
+ gridParams.options['eventCallBack'][funName].call(this, param)
1089
+ }
1090
+ }
1091
+ },
1092
+ // 验证是否是合法的小数
1093
+ checkDecimal() {
1094
+ if (
1095
+ this.isDecimalDateType() &&
1096
+ this.innerValue &&
1097
+ this.innerValue !== null
1098
+ ) {
1099
+ // 小数类型的字段,失去焦点时,判断输入的内容是否合法
1100
+ const numberReg = /^(-?\d+)(\.\d+)?$/
1101
+ if (!numberReg.test(this.innerValue + '')) {
1102
+ // 表示该字段还未验证,或验证成功,需要再次验证
1103
+ // 表示输入的不合法
1104
+ this.$message({
1105
+ type: 'warning',
1106
+ message: this.$t('imatrixUIMessage.invalideDoubleValue', {
1107
+ num: this.innerValue,
1108
+ }),
1109
+ showClose: true,
1110
+ })
1111
+ this.focus()
1112
+ }
1113
+ }
1114
+ },
1115
+ // 自定义编辑组件修改属性值
1116
+ customFocus() {
1117
+ apis.focus(this.position ? this.position.row : null)
1118
+ },
1119
+ openAnnexUpload() {
1120
+ this.annexUploadFlag = true
1121
+ },
1122
+ previewImg() {
1123
+ this.fileList = getFileList(this.row, this.column, this.isSql)
1124
+ this.showSingleImgFlag = true
1125
+ },
1126
+ // 上传成功
1127
+ uploadOnSuccess(response) {
1128
+ if (response) {
1129
+ const responseFile = {
1130
+ name: response.showName,
1131
+ serverPath: response.serverPath,
1132
+ }
1133
+ if (this.column.fileSet && this.column.fileSet !== '') {
1134
+ const fileSetObj = JSON.parse(this.column.fileSet)
1135
+ if (fileSetObj) {
1136
+ // 判断单选还是多选
1137
+ if (this.fileMultiple) {
1138
+ this.multiStorage(fileSetObj, responseFile)
1139
+ } else {
1140
+ this.radioStorageFile(fileSetObj, responseFile)
1141
+ }
1142
+ this.fileList = getFileList(this.row, this.column, this.isSql)
1143
+ }
1144
+ }
1145
+ }
1146
+ this.annexUploadFlag = false
1147
+ },
1148
+ // eventNames 事件名称值为input或clear,input表示值改变时触发的事件,clear表示值清空时触发的事件
1149
+ setCellValue(prop, value, eventNames) {
1150
+ this.$set(this.row, prop, value)
1151
+ if (eventNames) {
1152
+ eventNames.split(',').forEach((eventName) => {
1153
+ this.callCustomEventWithParam(eventName, {
1154
+ value,
1155
+ row: this.row,
1156
+ column: this.column,
1157
+ prop,
1158
+ })
1159
+ })
1160
+ }
1161
+ },
1162
+ // 单选上传完成后存储
1163
+ radioStorageFile(fileSetObj, responseFile) {
1164
+ if (fileSetObj.showNameData) {
1165
+ if (this.isSql) {
1166
+ if (fileSetObj.showNameData.dbName) {
1167
+ this.setCellValue(
1168
+ fileSetObj.showNameData.dbName,
1169
+ responseFile.name,
1170
+ 'input'
1171
+ )
1172
+ }
1173
+ } else {
1174
+ if (fileSetObj.showNameData.name) {
1175
+ this.setCellValue(
1176
+ fileSetObj.showNameData.name,
1177
+ responseFile.name,
1178
+ 'input'
1179
+ )
1180
+ }
1181
+ }
1182
+ }
1183
+ if (fileSetObj.serverNameData) {
1184
+ if (this.isSql) {
1185
+ if (fileSetObj.serverNameData.dbName) {
1186
+ this.setCellValue(
1187
+ fileSetObj.serverNameData.dbName,
1188
+ responseFile.serverPath
1189
+ )
1190
+ }
1191
+ } else {
1192
+ if (fileSetObj.serverNameData.name) {
1193
+ this.setCellValue(
1194
+ fileSetObj.serverNameData.name,
1195
+ responseFile.serverPath
1196
+ )
1197
+ }
1198
+ }
1199
+ }
1200
+ this.packageFileNameWithFileList([
1201
+ { showName: responseFile.name, serverPath: responseFile.serverPath },
1202
+ ])
1203
+ },
1204
+ // 多选上传完成后存储
1205
+ multiStorage(fileSetObj, responseFile) {
1206
+ const keyValueParam = analysisFileSetObj(fileSetObj, this.isSql)
1207
+ // 存储
1208
+ // 判断主表拼接还是子表保存
1209
+ if (fileSetObj.childAnnexDataTableCode) {
1210
+ // 存储子表
1211
+ // const lowerStr = fileSetObj.childAnnexDataTableCode.toLowerCase()
1212
+ let fileArr = this.row[this.column.prop]
1213
+ if (!fileArr) {
1214
+ fileArr = []
1215
+ }
1216
+ const fileObj = this.responseFileToFileObj(fileSetObj, responseFile)
1217
+ fileArr.push(fileObj)
1218
+ this.fileList = otherFilesToStandard(
1219
+ fileSetObj,
1220
+ keyValueParam,
1221
+ fileArr,
1222
+ null
1223
+ )
1224
+ this.setCellValue(this.column.prop, fileArr, 'input')
1225
+ } else {
1226
+ let showNameStr = ''
1227
+ let pathNameStr = ''
1228
+ // 存储主表
1229
+ if (fileSetObj.showNameData) {
1230
+ if (this.isSql) {
1231
+ if (fileSetObj.showNameData.dbName) {
1232
+ if (this.row) {
1233
+ if (this.row[fileSetObj.showNameData.dbName]) {
1234
+ let str = this.row[fileSetObj.showNameData.dbName]
1235
+ str += ',' + responseFile.name
1236
+ this.setCellValue(
1237
+ fileSetObj.showNameData.dbName,
1238
+ str,
1239
+ 'input'
1240
+ )
1241
+ } else {
1242
+ this.setCellValue(
1243
+ fileSetObj.showNameData.dbName,
1244
+ responseFile.name,
1245
+ 'input'
1246
+ )
1247
+ }
1248
+ showNameStr = this.row[fileSetObj.showNameData.dbName]
1249
+ }
1250
+ }
1251
+ } else {
1252
+ if (fileSetObj.showNameData.name) {
1253
+ if (this.row) {
1254
+ if (this.row[fileSetObj.showNameData.name]) {
1255
+ let str = this.row[fileSetObj.showNameData.name]
1256
+ str += ',' + responseFile.name
1257
+ this.setCellValue(fileSetObj.showNameData.name, str, 'input')
1258
+ } else {
1259
+ this.setCellValue(
1260
+ fileSetObj.showNameData.name,
1261
+ responseFile.name,
1262
+ 'input'
1263
+ )
1264
+ }
1265
+ showNameStr = this.row[fileSetObj.showNameData.name]
1266
+ }
1267
+ }
1268
+ }
1269
+ }
1270
+ if (fileSetObj.serverNameData) {
1271
+ if (this.isSql) {
1272
+ if (fileSetObj.serverNameData.dbName) {
1273
+ if (this.row) {
1274
+ if (this.row[fileSetObj.serverNameData.dbName]) {
1275
+ let str = this.row[fileSetObj.serverNameData.dbName]
1276
+ str += ',' + responseFile.serverPath
1277
+ this.setCellValue(fileSetObj.serverNameData.dbName, str)
1278
+ } else {
1279
+ this.setCellValue(
1280
+ fileSetObj.serverNameData.dbName,
1281
+ responseFile.serverPath
1282
+ )
1283
+ }
1284
+ pathNameStr = this.row[fileSetObj.serverNameData.dbName]
1285
+ }
1286
+ }
1287
+ } else {
1288
+ if (fileSetObj.serverNameData.name) {
1289
+ if (this.row) {
1290
+ if (this.row[fileSetObj.serverNameData.name]) {
1291
+ let str = this.row[fileSetObj.serverNameData.name]
1292
+ str += ',' + responseFile.serverPath
1293
+ this.setCellValue(fileSetObj.serverNameData.name, str)
1294
+ } else {
1295
+ this.setCellValue(
1296
+ fileSetObj.serverNameData.name,
1297
+ responseFile.serverPath
1298
+ )
1299
+ }
1300
+ pathNameStr = this.row[fileSetObj.serverNameData.name]
1301
+ }
1302
+ }
1303
+ }
1304
+ }
1305
+ this.fileList = otherFilesToStandard(fileSetObj, keyValueParam, null, {
1306
+ showName: showNameStr,
1307
+ serverPath: pathNameStr,
1308
+ })
1309
+ }
1310
+ this.packageFileNameWithFileList()
1311
+ },
1312
+ responseFileToFileObj(fileSetObj, responseFile) {
1313
+ const fileObj = {}
1314
+ if (fileSetObj.showNameData) {
1315
+ if (this.isSql) {
1316
+ if (fileSetObj.showNameData.dbName) {
1317
+ this.$set(
1318
+ fileObj,
1319
+ fileSetObj.showNameData.dbName,
1320
+ responseFile.name
1321
+ )
1322
+ }
1323
+ } else {
1324
+ if (fileSetObj.showNameData.name) {
1325
+ this.$set(fileObj, fileSetObj.showNameData.name, responseFile.name)
1326
+ }
1327
+ }
1328
+ }
1329
+ if (fileSetObj.serverNameData) {
1330
+ if (this.isSql) {
1331
+ if (fileSetObj.serverNameData.dbName) {
1332
+ this.$set(
1333
+ fileObj,
1334
+ fileSetObj.serverNameData.dbName,
1335
+ responseFile.serverPath
1336
+ )
1337
+ }
1338
+ } else {
1339
+ if (fileSetObj.serverNameData.name) {
1340
+ this.$set(
1341
+ fileObj,
1342
+ fileSetObj.serverNameData.name,
1343
+ responseFile.serverPath
1344
+ )
1345
+ }
1346
+ }
1347
+ }
1348
+ return fileObj
1349
+ },
1350
+ // 单选删除文件
1351
+ deleteAnnexFile(fileSetObj) {
1352
+ if (fileSetObj) {
1353
+ if (fileSetObj.showNameData) {
1354
+ if (this.isSql) {
1355
+ if (fileSetObj.showNameData.dbName) {
1356
+ this.setCellValue(
1357
+ fileSetObj.showNameData.dbName,
1358
+ null,
1359
+ 'input,clear'
1360
+ )
1361
+ }
1362
+ } else {
1363
+ if (fileSetObj.showNameData.name) {
1364
+ this.setCellValue(
1365
+ fileSetObj.showNameData.name,
1366
+ null,
1367
+ 'input,clear'
1368
+ )
1369
+ }
1370
+ }
1371
+ }
1372
+ if (fileSetObj.serverNameData) {
1373
+ if (this.isSql) {
1374
+ if (fileSetObj.serverNameData.dbName) {
1375
+ this.setCellValue(fileSetObj.serverNameData.dbName, null)
1376
+ }
1377
+ } else {
1378
+ if (fileSetObj.serverNameData.name) {
1379
+ this.setCellValue(fileSetObj.serverNameData.name, null)
1380
+ }
1381
+ }
1382
+ }
1383
+ }
1384
+ },
1385
+ deleteFile(fileList, index) {
1386
+ this.fileList = fileList
1387
+ if (index !== undefined && index !== -1) {
1388
+ this.fileList.splice(index, 1)
1389
+ }
1390
+ this.packageFileNameWithFileList()
1391
+ if (this.column.fileSet && this.column.fileSet !== '') {
1392
+ const fileSetObj = JSON.parse(this.column.fileSet)
1393
+ if (fileSetObj) {
1394
+ if (this.fileMultiple) {
1395
+ // 多选附件
1396
+ const keyValueParam = analysisFileSetObj(fileSetObj, this.isSql)
1397
+ this.standardToOtherFiles(fileSetObj, keyValueParam)
1398
+ } else {
1399
+ // 单选附件
1400
+ this.deleteAnnexFile(fileSetObj)
1401
+ }
1402
+ }
1403
+ }
1404
+ },
1405
+ packageFileNameWithFileList(fileList) {
1406
+ if (!fileList) {
1407
+ fileList = this.fileList
1408
+ }
1409
+ if (fileList && fileList.length > 0) {
1410
+ let fileNames = ''
1411
+ let fileServerName = ''
1412
+ fileList.forEach((item) => {
1413
+ fileNames += item.showName + ','
1414
+ fileServerName += item.serverPath + ','
1415
+ })
1416
+ if (fileNames && fileNames.indexOf(',') > 0) {
1417
+ this.lastFileName = fileNames.substring(0, fileNames.lastIndexOf(','))
1418
+ this.lastServerName = fileServerName.substring(
1419
+ 0,
1420
+ fileServerName.lastIndexOf(',')
1421
+ )
1422
+ }
1423
+ } else {
1424
+ this.lastFileName = null
1425
+ this.lastServerName = null
1426
+ }
1427
+ },
1428
+ // fileList 赋值Row
1429
+ standardToOtherFiles(fileSetObj, keyValueParam) {
1430
+ if (fileSetObj.childAnnexDataTableCode) {
1431
+ // 子表
1432
+ let fileArr = null
1433
+ if (this.fileList && this.fileList.length > 0) {
1434
+ fileArr = []
1435
+ for (var i = 0; i < this.fileList.length; i++) {
1436
+ const file = this.fileList[i]
1437
+ const otherFile = {}
1438
+ this.$set(otherFile, keyValueParam.showName, file.showName)
1439
+ this.$set(otherFile, keyValueParam.serverPath, file.serverPath)
1440
+ fileArr.push(otherFile)
1441
+ }
1442
+ }
1443
+ this.setCellValue(this.column.prop, fileArr, 'input')
1444
+ } else {
1445
+ // 主表
1446
+ let showNameStr = null
1447
+ let serverNameStr = null
1448
+ if (this.fileList && this.fileList.length > 0) {
1449
+ showNameStr = ''
1450
+ serverNameStr = ''
1451
+ for (var k = 0; k < this.fileList.length; k++) {
1452
+ const file = this.fileList[k]
1453
+ if (showNameStr !== '') {
1454
+ showNameStr += ','
1455
+ }
1456
+ if (serverNameStr !== '') {
1457
+ serverNameStr += ','
1458
+ }
1459
+ showNameStr += file.showName
1460
+ serverNameStr += file.serverPath
1461
+ }
1462
+ }
1463
+ this.setCellValue(keyValueParam.showName, showNameStr, 'input')
1464
+ this.setCellValue(keyValueParam.serverPath, serverNameStr)
1465
+ }
1466
+ },
1467
+ // 组织结构树文本框值改变事件
1468
+ organizationInputEvent(prop, value) {
1469
+ // console.log('organizationInputEvent1---prop=', prop, 'this.column.prop=', this.column.prop, 'value=', value)
1470
+ if (this.isSql && prop && prop.indexOf('.') < 0) {
1471
+ if (prop !== this.column.prop && this.tableName) {
1472
+ const replaceDot = '__'
1473
+ prop = this.tableName + replaceDot + prop
1474
+ }
1475
+ }
1476
+ setEntityFieldValue(this.row, prop, value)
1477
+ if (prop && prop === this.column.prop) {
1478
+ // 必须手动调用一下input事件,否则不会更新组件的值
1479
+ // console.log('organizationInputEvent2---prop=', prop, 'value=', value)
1480
+ this.callCustomEventWithParam('input', {
1481
+ value,
1482
+ row: this.row,
1483
+ column: this.column,
1484
+ prop,
1485
+ })
1486
+ }
1487
+ },
1488
+ // 组织结构树文本框值清空事件
1489
+ clearOrganizationInputEvent(prop) {
1490
+ if (this.isSql) {
1491
+ // sql处理时在后台会把空串当做null处理
1492
+ // this.$set(this.row, prop, '')
1493
+ setEntityFieldValue(this.row, prop, '')
1494
+ } else {
1495
+ // 非sql处理时需要设为null,否则保存时后台可能会报字段类型不正确,无法保存
1496
+ // this.$set(this.row, prop, null)
1497
+ setEntityFieldValue(this.row, prop, null)
1498
+ }
1499
+ if (prop && prop === this.column.prop) {
1500
+ // 必须手动调用一下input事件,否则不会更新组件的值
1501
+ this.callCustomEventWithParam('clear', {
1502
+ row: this.row,
1503
+ column: this.column,
1504
+ prop,
1505
+ })
1506
+ }
1507
+ },
1508
+ // 组织结构树文本框值追加事件
1509
+ appendOrganizationInputEvent(
1510
+ prop,
1511
+ originalValue,
1512
+ appendValue,
1513
+ separator,
1514
+ finallyValue
1515
+ ) {
1516
+ // this.$set(this.row, prop, finallyValue)
1517
+ setEntityFieldValue(this.row, prop, finallyValue)
1518
+ if (prop && prop === this.column.prop) {
1519
+ this.callCustomEventWithParam('append', {
1520
+ originalValue,
1521
+ appendValue,
1522
+ separator,
1523
+ finallyValue,
1524
+ row: this.row,
1525
+ column: this.column,
1526
+ prop,
1527
+ })
1528
+ }
1529
+ },
1530
+ // 组织结构树文本框值替换事件
1531
+ replaceOrganizationInputEvent(prop, originalValue, newValue) {
1532
+ // this.$set(this.row, prop, newValue)
1533
+ setEntityFieldValue(this.row, prop, newValue)
1534
+ if (prop && prop === this.column.prop) {
1535
+ this.callCustomEventWithParam('replace', {
1536
+ originalValue,
1537
+ newValue,
1538
+ row: this.row,
1539
+ column: this.column,
1540
+ prop,
1541
+ })
1542
+ }
1543
+ },
1544
+ setDynamicSourceSelectValue({
1545
+ value,
1546
+ sourceColumnName,
1547
+ targetColumnName,
1548
+ options,
1549
+ selectedItem,
1550
+ }) {
1551
+ if (targetColumnName) {
1552
+ this.setCellValue(targetColumnName, value, 'input')
1553
+ this.callCustomEventWithParam('input', {
1554
+ value,
1555
+ extendParams: selectedItem,
1556
+ row: this.row,
1557
+ column: this.column,
1558
+ targetColumnName,
1559
+ })
1560
+ }
1561
+ },
1562
+ multiselectChange(arr, selectedItem) {
1563
+ // console.log('multiselectChange1---arr=', arr)
1564
+ this.extendParams = selectedItem
1565
+ let isSaveAll = false
1566
+ if (arr && arr.length > 0) {
1567
+ const saveAll = 'saveAll'
1568
+ if (arr.indexOf(saveAll) !== -1) {
1569
+ const length = arr.length
1570
+ if (length - 1 >= this.options.length) {
1571
+ this.innerValue = null
1572
+ // 取消全选
1573
+ } else {
1574
+ // 全选
1575
+ if (!this.innerValue || this.innerValue.indexOf(saveAll) >= 0) {
1576
+ this.innerValue = []
1577
+ }
1578
+ this.options.forEach((item) => {
1579
+ if (this.innerValue.indexOf(item.value) === -1) {
1580
+ this.innerValue.push(item.value)
1581
+ }
1582
+ })
1583
+ }
1584
+ isSaveAll = true
1585
+ }
1586
+ }
1587
+ // console.log('multiselectChange2---this.innerValue=', this.innerValue)
1588
+ if (
1589
+ this.innerValue &&
1590
+ typeof this.innerValue !== 'number' &&
1591
+ this.innerValue.indexOf('saveAll') !== -1
1592
+ ) {
1593
+ this.innerValue.splice(this.innerValue.indexOf('saveAll'), 1)
1594
+ }
1595
+ // console.log('multiselectChange3---this.innerValue=', this.innerValue)
1596
+ if (isSaveAll) {
1597
+ this.cellEvent('input', this.innerValue)
1598
+ }
1599
+ this.cellEvent('change', arr)
1600
+ },
1601
+ getDefaultValue(val) {
1602
+ if (val === undefined || val === null || val === '') {
1603
+ // 没有值的时候才设置默认值
1604
+ if (
1605
+ this.column.defaultValue !== undefined &&
1606
+ this.column.defaultValue !== null
1607
+ ) {
1608
+ // 表示当前字段的是空的,但是有默认值时,给当前字段设置值
1609
+ setEntityFieldValue(
1610
+ this.row,
1611
+ this.column.prop,
1612
+ this.column.defaultValue
1613
+ )
1614
+ return this.column.defaultValue
1615
+ } else {
1616
+ if (
1617
+ this.column.componentType === 'select' &&
1618
+ !isDynamicDataSourceSource(this.column) &&
1619
+ this.column.valueSet
1620
+ ) {
1621
+ // TODO 不知道为什么这个方法调用了三遍, 需要看下
1622
+ // 如果没有给字段设置默认值时,如果是选项组则选项组如果有默认选中,则将默认选中值赋值给当前字段
1623
+ // console.log(this.column.valueSet.find(element => element.selected === true), 'xxxxxxxxxxx')
1624
+ const defaultSelected = this.column.valueSet.find(
1625
+ (element) => element.selected === true
1626
+ )
1627
+ if (defaultSelected) {
1628
+ setEntityFieldValue(
1629
+ this.row,
1630
+ this.column.prop,
1631
+ defaultSelected.value
1632
+ )
1633
+ return defaultSelected.value
1634
+ }
1635
+ }
1636
+ }
1637
+ }
1638
+ },
1639
+ refresData(data) {
1640
+ this.$emit('refresData', data)
1641
+ },
1642
+ refresPortData(port, value) {
1643
+ this.$emit('refresPortData', port, value)
1644
+ },
1645
+ refresPortsData(map) {
1646
+ this.$emit('refresPortsData', map)
1647
+ },
1648
+ refresMainTableFields(map) {
1649
+ this.$emit('refresMainTableFields', map)
1650
+ },
1651
+ deleteSuccess(deleteFile) {
1652
+ console.log('deleteSuccess', deleteFile, this.fileInfo)
1653
+ },
1654
+ // 时间格式判断是否是字符串类型,如果是字符串类型使用格式化的数据,如果是时间格式的显示时间搓
1655
+ isValueFormat() {
1656
+ if (this.column.dataType === 'TEXT' || this.column.dataType === 'text') {
1657
+ return this.isFormat()
1658
+ }
1659
+ return 'timestamp'
1660
+ },
1661
+ // 时间格式判断是否是字符串类型,显示格式
1662
+ isFormat() {
1663
+ if (this.type === 'time' && this.column.dataType === 'TIME') {
1664
+ return 'yyyy-MM-dd HH:mm:ss'
1665
+ } else if (this.type === 'dateTimePicker') {
1666
+ return 'yyyy-MM-dd HH:mm:ss'
1667
+ } else if (this.type === 'date' && this.column.dataType === 'DATE') {
1668
+ return 'yyyy-MM-dd'
1669
+ } else if (this.type === 'timePicker') {
1670
+ if (this.column.originalFormat) {
1671
+ return this.column.originalFormat
1672
+ }
1673
+ return 'hh:mm:ss'
1674
+ } else if (this.type === 'year') {
1675
+ return 'yyyy'
1676
+ } else if (this.type === 'month') {
1677
+ return 'MM'
1678
+ }
1679
+ return 'yyyy-MM-dd'
1680
+ },
1681
+ fnProhibitToEdit(entity) {
1682
+ this.$emit('prohibitToEdit', entity)
1683
+ },
1684
+ setInputNumberConfig() {
1685
+ if (this.column.componentType === 'inputNumber') {
1686
+ if (
1687
+ this.column.valueSetOptions &&
1688
+ this.column.valueSetOptions !== '' &&
1689
+ this.column.componentType === 'inputNumber'
1690
+ ) {
1691
+ const inputNumberSetting = JSON.parse(this.column.valueSetOptions)
1692
+ this.inputNumberSet = inputNumberSetting
1693
+ } else {
1694
+ this.inputNumberSet = {
1695
+ min: null,
1696
+ max: null,
1697
+ step: 1,
1698
+ precision: 0,
1699
+ position: '',
1700
+ }
1701
+ }
1702
+ }
1703
+ },
1704
+ },
1705
+ }
1706
+ </script>