imatrix-ui 2.9.0-dw → 2.9.0-dw-tmp2

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 (145) hide show
  1. package/.babelrc +17 -0
  2. package/build/components.json +4 -0
  3. package/build/gen-style.js +32 -0
  4. package/build/webpack.base.js +140 -0
  5. package/build/webpack.component.js +40 -0
  6. package/build/webpack.prod.js +35 -0
  7. package/lib/DepartmentTree.js +8 -0
  8. package/lib/SuperGrid.js +28 -0
  9. package/lib/super-ui.min.js +72 -0
  10. package/package.json +49 -24
  11. package/lib/super-ui.css +0 -1
  12. package/lib/super-ui.umd.min.js +0 -67
  13. package/packages/breadcrumb/index.js +0 -6
  14. package/packages/breadcrumb/src/breadcrumb.vue +0 -71
  15. package/packages/department-tree/index.js +0 -6
  16. package/packages/department-tree/src/department-tree.vue +0 -108
  17. package/packages/department-tree-inline/index.js +0 -6
  18. package/packages/department-tree-inline/src/department-multi-tree-inline.vue +0 -402
  19. package/packages/department-tree-inline/src/department-single-tree-inline.vue +0 -284
  20. package/packages/department-tree-inline/src/department-tree-inline.vue +0 -86
  21. package/packages/department-tree-inline/src/department-tree-service.js +0 -245
  22. package/packages/department-tree-inline/src/search-result.vue +0 -176
  23. package/packages/department-user-tree/index.js +0 -6
  24. package/packages/department-user-tree/src/department-user-multiple-tree.vue +0 -116
  25. package/packages/department-user-tree/src/department-user-single-tree.vue +0 -76
  26. package/packages/department-user-tree/src/department-user-tree.vue +0 -101
  27. package/packages/department-user-tree-inline/index.js +0 -6
  28. package/packages/department-user-tree-inline/src/department-user-multiple-tree-inline.vue +0 -626
  29. package/packages/department-user-tree-inline/src/department-user-single-tree-inline.vue +0 -269
  30. package/packages/department-user-tree-inline/src/department-user-tree-inline.vue +0 -79
  31. package/packages/department-user-tree-inline/src/department-user-tree-multi-service.js +0 -230
  32. package/packages/department-user-tree-inline/src/department-user-tree-single-service.js +0 -122
  33. package/packages/department-user-tree-inline/src/search-result.vue +0 -197
  34. package/packages/directives/prevent-reclick.js +0 -19
  35. package/packages/dynamic-source-select/index.js +0 -6
  36. package/packages/dynamic-source-select/src/dynamic-source-select-service.js +0 -70
  37. package/packages/dynamic-source-select/src/dynamic-source-select.vue +0 -440
  38. package/packages/dynamic-source-select/src/events.js +0 -55
  39. package/packages/fs-preview/index.js +0 -6
  40. package/packages/fs-preview/src/fs-preview.vue +0 -226
  41. package/packages/fs-upload/index.js +0 -6
  42. package/packages/fs-upload/src/fs-upload-multi.vue +0 -420
  43. package/packages/fs-upload/src/fs-upload-single.vue +0 -312
  44. package/packages/fs-upload/src/fs-upload.vue +0 -189
  45. package/packages/fs-upload/src/see-big-picture.vue +0 -55
  46. package/packages/fs-upload-list/index.js +0 -6
  47. package/packages/fs-upload-list/src/fs-upload-list.vue +0 -287
  48. package/packages/hamburger/index.js +0 -6
  49. package/packages/hamburger/src/hamburger.vue +0 -38
  50. package/packages/index.js +0 -121
  51. package/packages/multipart-upload/index.js +0 -6
  52. package/packages/multipart-upload/src/index.vue +0 -73
  53. package/packages/multipart-upload/src/multipart-upload-form.vue +0 -297
  54. package/packages/multipart-upload/src/multipart-upload-list.vue +0 -378
  55. package/packages/organization-input/index.js +0 -6
  56. package/packages/organization-input/src/organization-input.vue +0 -542
  57. package/packages/plugins/export-data-new.js +0 -453
  58. package/packages/plugins/export-data.js +0 -361
  59. package/packages/plugins/index.js +0 -15
  60. package/packages/plugins/public-method.js +0 -43
  61. package/packages/remove-department/index.js +0 -6
  62. package/packages/remove-department/src/remove-department.vue +0 -172
  63. package/packages/remove-department/src/remove-dept-service.js +0 -20
  64. package/packages/remove-user/index.js +0 -6
  65. package/packages/remove-user/src/remove-user-service.js +0 -20
  66. package/packages/remove-user/src/remove-user.vue +0 -195
  67. package/packages/remove-workgroup/index.js +0 -6
  68. package/packages/remove-workgroup/src/remove-workgroup-service.js +0 -20
  69. package/packages/remove-workgroup/src/remove-workgroup.vue +0 -159
  70. package/packages/rich-editor/index.js +0 -7
  71. package/packages/rich-editor/index.vue +0 -278
  72. package/packages/rich-editor/langs/zh-Hans.js +0 -1
  73. package/packages/rich-editor/viewer.vue +0 -103
  74. package/packages/scan-code-input/index.js +0 -6
  75. package/packages/scan-code-input/src/events.js +0 -33
  76. package/packages/scan-code-input/src/scan-code-input-colse.vue +0 -131
  77. package/packages/scan-code-input/src/scan-code-input.vue +0 -116
  78. package/packages/secret-info/index.js +0 -7
  79. package/packages/secret-info/index.vue +0 -90
  80. package/packages/super-grid/index.js +0 -7
  81. package/packages/super-grid/src/apis.js +0 -763
  82. package/packages/super-grid/src/columns-config.vue +0 -335
  83. package/packages/super-grid/src/custom-formatter.js +0 -250
  84. package/packages/super-grid/src/dynamic-input.vue +0 -1279
  85. package/packages/super-grid/src/eventBus.js +0 -2
  86. package/packages/super-grid/src/events.js +0 -55
  87. package/packages/super-grid/src/formValidatorUtil.js +0 -226
  88. package/packages/super-grid/src/formatter.js +0 -181
  89. package/packages/super-grid/src/group-column.vue +0 -100
  90. package/packages/super-grid/src/header-context-menu.vue +0 -87
  91. package/packages/super-grid/src/index-column.vue +0 -51
  92. package/packages/super-grid/src/normal-column.vue +0 -769
  93. package/packages/super-grid/src/public-methods.js +0 -31
  94. package/packages/super-grid/src/row-operation.vue +0 -161
  95. package/packages/super-grid/src/search-button.vue +0 -66
  96. package/packages/super-grid/src/search-condition-input.vue +0 -61
  97. package/packages/super-grid/src/search-condition-list.vue +0 -59
  98. package/packages/super-grid/src/search-form-advancedQuery.vue +0 -653
  99. package/packages/super-grid/src/search-form-dialog.vue +0 -79
  100. package/packages/super-grid/src/search-form-item.vue +0 -386
  101. package/packages/super-grid/src/search-form-number.vue +0 -38
  102. package/packages/super-grid/src/search-form-open.vue +0 -162
  103. package/packages/super-grid/src/search-form-ordinarySearch.vue +0 -188
  104. package/packages/super-grid/src/search-form.vue +0 -634
  105. package/packages/super-grid/src/search-methods.js +0 -387
  106. package/packages/super-grid/src/selection-column.vue +0 -43
  107. package/packages/super-grid/src/store.js +0 -3
  108. package/packages/super-grid/src/super-grid-service.js +0 -561
  109. package/packages/super-grid/src/super-grid.vue +0 -2793
  110. package/packages/super-grid/src/utils.js +0 -763
  111. package/packages/super-grid/src/view-image-dialog.vue +0 -130
  112. package/packages/super-nine-grid/index.js +0 -7
  113. package/packages/super-nine-grid/src/apis.js +0 -103
  114. package/packages/super-nine-grid/src/custom-formatter.js +0 -66
  115. package/packages/super-nine-grid/src/formatter.js +0 -132
  116. package/packages/super-nine-grid/src/search-form-number.vue +0 -38
  117. package/packages/super-nine-grid/src/search-form.vue +0 -430
  118. package/packages/super-nine-grid/src/search-methods.js +0 -134
  119. package/packages/super-nine-grid/src/store.js +0 -3
  120. package/packages/super-nine-grid/src/super-grid-service.js +0 -91
  121. package/packages/super-nine-grid/src/super-nine-grid.vue +0 -872
  122. package/packages/super-nine-grid/src/utils.js +0 -261
  123. package/packages/svg-icon/index.js +0 -6
  124. package/packages/svg-icon/src/svg-icon.vue +0 -43
  125. package/packages/utils/utils.js +0 -152
  126. package/packages/utils/value-set.js +0 -86
  127. package/packages/valid-code/index.js +0 -7
  128. package/packages/valid-code/src/valid-code.vue +0 -95
  129. package/packages/workflow-button/index.js +0 -6
  130. package/packages/workflow-button/src/workflow-button.vue +0 -325
  131. package/packages/workflow-history-list/index.js +0 -6
  132. package/packages/workflow-history-list/src/api.js +0 -7
  133. package/packages/workflow-history-list/src/workflow-history-list.vue +0 -185
  134. package/packages/workgroup-tree/index.js +0 -6
  135. package/packages/workgroup-tree/src/workgroup-tree.vue +0 -76
  136. package/packages/workgroup-tree-inline/index.js +0 -6
  137. package/packages/workgroup-tree-inline/src/workgroup-tree-inline.vue +0 -317
  138. package/packages/workgroup-tree-inline/src/workgroup-tree-service.js +0 -43
  139. package/packages/workgroup-user-tree/index.js +0 -6
  140. package/packages/workgroup-user-tree/src/workgroup-user-tree.vue +0 -100
  141. package/packages/workgroup-user-tree-inline/index.js +0 -6
  142. package/packages/workgroup-user-tree-inline/src/workgroup-tree-inline-service.js +0 -163
  143. package/packages/workgroup-user-tree-inline/src/workgroup-user-tree-inline.vue +0 -436
  144. package/packages/year-range-picker/index.js +0 -6
  145. package/packages/year-range-picker/src/year-range-picker.vue +0 -51
@@ -1,1279 +0,0 @@
1
- <template>
2
- <div v-if="type && type.indexOf('custom:')>=0 && componentName != ''" :style="(row.validateErrorField && row.validateErrorField === column.prop) ?'border:1px solid red':''">
3
- <component
4
- :is="componentName"
5
- ref="customItem"
6
- :value="innerValue"
7
- :row="row"
8
- :entity="row"
9
- :disabled="disabled"
10
- :prop="column.prop"
11
- :parent="parentFormData"
12
- :row-index="position?position.row:null"
13
- :select-options="options"
14
- :grid-data="gridData"
15
- :page-grid-data="pageGridData"
16
- @input="cellEvent('input',$event)"
17
- />
18
- </div>
19
- <div v-else :style="(row.validateErrorField && row.validateErrorField === column.prop) ?'border:1px solid red':''">
20
- <!--必须有@input ,否则无法输入值-->
21
- <el-date-picker
22
- v-if="type==='year' || type==='month'"
23
- ref="item"
24
- v-model="innerValue"
25
- :disabled="disabled"
26
- :type="type"
27
- :editable="false"
28
- :value-format="isValueFormat()"
29
- :format="isFormat()"
30
- :placeholder="$t('imatrixUIMessage.selectTime')"
31
- style="width: 100%;"
32
- @input="cellEvent('input',$event)"
33
- @focus="cellEvent('focus',$event)"
34
- @blur="cellEvent('blur',$event)"
35
- @change="cellEvent('change',$event)"
36
- />
37
- <el-date-picker
38
- v-if="type==='yearRange'"
39
- ref="item"
40
- v-model="innerValue"
41
- :disabled="disabled"
42
- :editable="false"
43
- :placeholder="$t('imatrixUIMessage.selectYear')"
44
- type="year"
45
- value-format="yyyy"
46
- style="width: 100%;"
47
- @input="cellEvent('input',$event)"
48
- @focus="cellEvent('focus',$event)"
49
- @blur="cellEvent('blur',$event)"
50
- @change="cellEvent('change',$event)"
51
- />
52
- <!--必须有@input ,否则无法输入值-->
53
- <el-date-picker
54
- v-else-if="type==='dateTimePicker'"
55
- ref="item"
56
- :value="innerValue"
57
- :disabled="disabled"
58
- :editable="false"
59
- :placeholder="$t('imatrixUIMessage.selectTime')"
60
- type="datetime"
61
- style="width: 100%;"
62
- :value-format="isValueFormat()"
63
- :format="isFormat()"
64
- @input="cellEvent('input',$event)"
65
- @focus="cellEvent('focus',$event)"
66
- @blur="cellEvent('blur',$event)"
67
- @change="cellEvent('change',$event)"
68
- />
69
- <el-date-picker
70
- v-else-if="type==='date' || column.dataType === 'DATE'"
71
- ref="item"
72
- :value="innerValue"
73
- type="date"
74
- :disabled="disabled"
75
- :editable="false"
76
- :placeholder="$t('imatrixUIMessage.selectionDate')"
77
- :value-format="isValueFormat()"
78
- :format="isFormat()"
79
- style="width: 100%;"
80
- @input="cellEvent('input',$event)"
81
- @focus="cellEvent('focus',$event)"
82
- @blur="cellEvent('blur',$event)"
83
- @change="cellEvent('change',$event)"
84
- />
85
- <!--必须有@input ,否则无法输入值-->
86
- <el-date-picker
87
- v-else-if="type==='time' || column.dataType === 'TIME'"
88
- ref="item"
89
- :value="innerValue"
90
- :disabled="disabled"
91
- type="datetime"
92
- :editable="false"
93
- :placeholder="$t('imatrixUIMessage.selectTime')"
94
- :value-format="isValueFormat()"
95
- :format="isFormat()"
96
- style="width: 100%;"
97
- @input="cellEvent('input',$event)"
98
- @focus="cellEvent('focus',$event)"
99
- @blur="cellEvent('blur',$event)"
100
- @change="cellEvent('change',$event)"
101
- />
102
- <el-time-picker
103
- v-else-if="type==='timePicker'"
104
- ref="item"
105
- v-model="innerValue"
106
- :disabled="disabled"
107
- :value-format="isValueFormat()"
108
- :format="isFormat()"
109
- style="width: 100%;"
110
- :placeholder="$t('imatrixUIMessage.pleaseEnterATimePoint')"
111
- @input="cellEvent('input',$event)"
112
- @focus="cellEvent('focus',$event)"
113
- @blur="cellEvent('blur',$event)"
114
- @change="cellEvent('change',$event)"
115
- />
116
-
117
- <!--必须有@input ,否则无法输入值,如果是数字类型需要加上.number修饰符-->
118
- <el-input
119
- v-else-if="type==='input' && (column.dataType === 'INTEGER' || column.dataType === 'LONG' )"
120
- ref="item"
121
- v-model.number="innerValue"
122
- :disabled="disabled"
123
- clearable
124
- :placeholder="$t('imatrixUIMessage.pleaseEnterContent')"
125
- @input="cellEvent('input',$event)"
126
- @focus="cellEvent('focus',$event)"
127
- @blur="cellEvent('blur',$event)"
128
- @change="cellEvent('change', $event)"
129
- @clear="cellEvent('clear', $event)"
130
- />
131
- <!--必须有@input ,否则无法输入值-->
132
- <el-input
133
- v-else-if="type==='input'"
134
- ref="item"
135
- v-model="innerValue"
136
- :disabled="disabled"
137
- clearable
138
- :placeholder="$t('imatrixUIMessage.pleaseEnterContent')"
139
- @input="cellEvent('input',$event)"
140
- @focus="cellEvent('focus',$event)"
141
- @blur="cellEvent('blur',$event)"
142
- @change="cellEvent('change', $event)"
143
- @clear="cellEvent('clear', $event)"
144
- />
145
-
146
- <el-input
147
- v-else-if="type==='textarea'"
148
- ref="item"
149
- v-model="innerValue"
150
- :disabled="disabled"
151
- type="textarea"
152
- :rows="1"
153
- clearable
154
- :placeholder="$t('imatrixUIMessage.pleaseEnterContent')"
155
- @input="cellEvent('input',$event)"
156
- @focus="cellEvent('focus',$event)"
157
- @blur="cellEvent('blur',$event)"
158
- @change="cellEvent('change', $event)"
159
- @clear="cellEvent('clear', $event)"
160
- />
161
- <fs-upload-list
162
- v-else-if="type==='annex'"
163
- :disabled="disabled"
164
- :file-info="fileInfo"
165
- :file-list="fileList"
166
- :file-set-obj="fileSetObj"
167
- :value="innerValue"
168
- :row="row"
169
- :is-sql="isSql"
170
- :custom-view-url="true"
171
- @delete="deleteFile"
172
- @delete-success="deleteSuccess"
173
- @upload-success="uploadOnSuccess"
174
- />
175
- <multipart-upload
176
- v-else-if="type==='multipartUpload'"
177
- :disabled="disabled"
178
- :entity="row"
179
- :file-info="fileInfo"
180
- :file-list="fileList"
181
- :file-set-obj="fileSetObj"
182
- :value="innerValue"
183
- type="list"
184
- @delete="deleteFile"
185
- @delete-success="deleteSuccess"
186
- @upload-success="uploadOnSuccess"
187
- />
188
- <!-- <el-input
189
- v-else-if="type==='annex' && !fileMultiple"
190
- ref="item"
191
- :value="innerValue"
192
- :readonly="true"
193
- :disabled="disabled"
194
- :placeholder="$t('imatrixUIMessage.pleaseEnterContent')"
195
- >
196
- <el-button slot="append" size="mini" :disabled="disabled" icon="el-icon-upload2" @click="openAnnexUpload" />
197
- <el-button v-if="innerValue" slot="append" :disabled="disabled" size="mini" icon="el-icon-zoom-in" @click="previewImg" />
198
- </el-input>
199
-
200
- <el-input
201
- v-else-if="type==='annex' && fileMultiple"
202
- ref="item"
203
- :value="lastFileName"
204
- :readonly="true"
205
- :disabled="disabled"
206
- :placeholder="$t('imatrixUIMessage.pleaseEnterContent')"
207
- >
208
- <el-button slot="append" size="mini" :disabled="disabled" icon="el-icon-upload2" @click="openAnnexUpload" />
209
- <el-button v-if="innerValue" slot="append" :disabled="disabled" size="mini" icon="el-icon-zoom-in" @click="previewImg" />
210
- </el-input> -->
211
-
212
- <!-- <custom-fma v-if="type==null ||type === ''" /> -->
213
- <!-- v-model="newValue" -->
214
- <!--必须有@input ,否则无法输入值-->
215
- <el-select
216
- v-else-if="type==='select' && !isDynamicDataSourceSource()"
217
- ref="item"
218
- v-model="innerValue"
219
- clearable
220
- :disabled="disabled"
221
- :placeholder="$t('imatrixUIMessage.pleaseSelect')"
222
- @input="cellEvent('input',$event)"
223
- @change="cellEvent('change',$event)"
224
- @focus="cellEvent('focus',$event)"
225
- @visible-change="cellEvent('visible-change',$event)"
226
- @blur="cellEvent('blur',$event)"
227
- @clear="cellEvent('clear',$event)"
228
- >
229
- <el-option
230
- v-for="item in options"
231
- :key="item.value"
232
- :label="item.label"
233
- :value="item.value"
234
- />
235
- </el-select>
236
- <!--必须有@input ,否则无法输入值-->
237
- <el-select
238
- v-else-if="type==='multiselect' && !isDynamicDataSourceSource()"
239
- ref="item"
240
- v-model="innerValue"
241
- clearable
242
- :disabled="disabled"
243
- multiple
244
- collapse-tags
245
- :placeholder="$t('imatrixUIMessage.pleaseSelect')"
246
- @input="cellEvent('input',$event)"
247
- @change="multiselectChange"
248
- @visible-change="cellEvent('visible-change',$event)"
249
- @focus="cellEvent('focus',$event)"
250
- @remove-tag="cellEvent('remove-tag',$event)"
251
- @blur="cellEvent('blur',$event)"
252
- @clear="cellEvent('clear',$event)"
253
- >
254
- <el-option :label="$t('superGrid.selectAll')" value="saveAll" />
255
- <el-option
256
- v-for="item in options"
257
- :key="item.value"
258
- :label="item.label"
259
- :value="item.value"
260
- />
261
- </el-select>
262
- <dynamic-source-select
263
- v-else-if="(type==='multiselect' || type==='select') && isDynamicDataSourceSource()"
264
- v-model="innerValue"
265
- :base-props="{
266
- multiple: type==='multiselect'?true:false,
267
- disabled:disabled
268
- }"
269
- :column="column"
270
- :entity="row"
271
- :options="{
272
- dynamicDataSourceCode:dynamicDataSourceCode,
273
- valueSetOptions:valueSetOptions,
274
- isSql:isSql
275
- }"
276
- :table-name="tableName"
277
- :list-code="listCode"
278
- :is-join-table="isJoinTable"
279
- :parent="parentFormData"
280
- @input="cellEvent('input',$event)"
281
- @change="multiselectChange"
282
- @visible-change="cellEvent('visible-change',$event)"
283
- @focus="cellEvent('focus',$event)"
284
- @remove-tag="cellEvent('remove-tag',$event)"
285
- @blur="cellEvent('blur',$event)"
286
- @clear="cellEvent('clear',$event)"
287
- @set-value="setDynamicSourceSelectValue"
288
- />
289
-
290
- <el-input-number
291
- v-else-if="type==='inputNumber'"
292
- ref="item"
293
- v-model="innerValue"
294
- :disabled="disabled"
295
- :min="!inputNumberSet.min?-Infinity:inputNumberSet.min"
296
- :max="!inputNumberSet.max?Infinity:inputNumberSet.min"
297
- :step="!inputNumberSet.step?1:inputNumberSet.step"
298
- :precision="inputNumberSet.precision"
299
- :controls-position="inputNumberSet.position"
300
- @input="cellEvent('input',$event)"
301
- @change="cellEvent('change',$event)"
302
- @focus="cellEvent('focus',$event)"
303
- @blur="cellEvent('blur',$event)"
304
- />
305
- <!--mysql数据库--->
306
- <el-switch
307
- v-else-if="(type==='switch' || column.dataType === 'BOOLEAN') && dataSourceType === 'mysql'"
308
- ref="item"
309
- :value="innerValue"
310
- :disabled="disabled"
311
- active-color="#13ce66"
312
- inactive-color="#ff4949"
313
- @input="cellEvent('input',$event,true)"
314
- @change="cellEvent('change',$event)"
315
- />
316
- <!--oracle或sqlserver数据库--->
317
- <el-switch
318
- v-else-if="type==='switch' || column.dataType === 'BOOLEAN'"
319
- ref="item"
320
- :value="innerValue"
321
- :disabled="disabled"
322
- :active-value="1"
323
- :inactive-value="0"
324
- active-color="#13ce66"
325
- inactive-color="#ff4949"
326
- @input="cellEvent('input',$event,true)"
327
- @change="cellEvent('change',$event)"
328
- />
329
- <el-slider
330
- v-else-if="type==='slider'"
331
- ref="item"
332
- :value="innerValue"
333
- :disabled="disabled"
334
- @input="cellEvent('input',$event,true)"
335
- @change="cellEvent('change',$event)"
336
- />
337
-
338
- <el-rate
339
- v-else-if="type==='rate'"
340
- ref="item"
341
- :value="innerValue"
342
- :disabled="disabled"
343
- @input="cellEvent('input',$event,true)"
344
- @change="cellEvent('change',$event)"
345
- />
346
-
347
- <organization-input
348
- v-else-if="deptManTree || deptTree || wgManTree || wgTree"
349
- v-model="innerValue"
350
- :fields="fields"
351
- :models="row"
352
- :check-strictly="isCheckStrictly"
353
- :multiple="isMultiTree"
354
- :tree-type="deptManTree?'DeptUserTree':deptTree?'DeptTree':wgManTree?'WgTree':wgTree?'WgUserTree':null"
355
- :disabled="disabled"
356
- :table-name="tableName"
357
- :department-info="departmentInfo"
358
- :is-join-table="isJoinTable"
359
- @focus="showOrganizationTree"
360
- @setValue="organizationInputEvent"
361
- @clear="clearOrganizationInputEvent"
362
- @append="appendOrganizationInputEvent"
363
- @replace="replaceOrganizationInputEvent"
364
- />
365
-
366
- <el-dialog
367
- :title="$t('imatrixUIMessage.tips')"
368
- :visible.sync="annexUploadFlag"
369
- :append-to-body="true"
370
- :show-close="true"
371
- width="30%"
372
- >
373
- <el-upload
374
- v-if="type==='annex' && annexUploadFlag"
375
- :action="defaultAction"
376
- :accept="fileSetObj&&fileSetObj.accept?fileSetObj.accept:null"
377
- :on-success="uploadOnSuccess"
378
- :headers="headers"
379
- :before-upload="handleBeforeUpload"
380
- name="file"
381
- :with-credentials="true"
382
- >
383
- <el-button>{{ $t('imatrixUIMessage.upload') }}</el-button>
384
- </el-upload>
385
- </el-dialog>
386
- <view-image-dialog
387
- v-if="showSingleImgFlag"
388
- :downloadable="!disabled"
389
- :deleteable="!disabled"
390
- :file-list="fileList"
391
- @close="showSingleImgFlag = false"
392
- @delete="deleteFile"
393
- />
394
- </div>
395
- </template>
396
- <script>
397
- import store from './store'
398
- import Vue from 'vue'
399
- import { isDisableEdit, isEditOptionFunction, analysisFileSetObj, otherFilesToStandard, getFileList, isDynamicDataSourceSource } from './utils'
400
- import dynamicSourceSelect from '../../dynamic-source-select/src/dynamic-source-select'
401
- import { getEntityFieldValue, setEntityFieldValue } from '../../../src/utils/util'
402
- import { getToken } from '../../../src/utils/auth'
403
- import apis from './apis'
404
- import ViewImageDialog from './view-image-dialog.vue'
405
- export default {
406
- name: 'DynamicInput',
407
- components: {
408
- dynamicSourceSelect,
409
- ViewImageDialog
410
- },
411
- props: {
412
- value: {
413
- type: [String, Boolean, Number, Date, Array],
414
- default: null
415
- },
416
- type: {
417
- type: String,
418
- default: 'input'
419
- },
420
- position: {
421
- type: Object,
422
- default: null
423
- },
424
- lineEdit: {
425
- type: Object,
426
- default: null
427
- },
428
- options: {
429
- type: Array,
430
- default: null
431
- },
432
- // 字段配置
433
- column: {
434
- type: Object,
435
- default: null
436
- },
437
- // 行数据
438
- row: {
439
- type: Object,
440
- default: null
441
- },
442
- listCode: {
443
- type: String,
444
- default: null
445
- },
446
- isSql: {
447
- type: Boolean,
448
- default: false
449
- }
450
- },
451
- data() {
452
- let innerValue = this.value
453
- if (this.type && this.type === 'select') {
454
- // 单选下拉框时值处理
455
- if (this.column.dataType !== 'TEXT') {
456
- innerValue = this.value && this.value !== null && typeof (this.value) !== 'string' ? this.value + '' : this.value
457
- this.$emit('input', innerValue)
458
- }
459
- }
460
- const defaultValue = this.getDefaultValue(innerValue)
461
- if (defaultValue !== undefined && defaultValue !== null) {
462
- innerValue = defaultValue
463
- }
464
- const disabled = isDisableEdit(this.column.prop, this.listCode, this.row)
465
- const defaultAction = Vue.prototype.baseAPI + '/component/super-form/uploads'
466
- if (!this.listCode) {
467
- this.listCode = store.get('_list_code')
468
- }
469
- const gridParams = store.get(this.listCode)
470
- let tableName
471
- if (gridParams && gridParams.basicInfo && gridParams.basicInfo.tableName) {
472
- tableName = gridParams.basicInfo.tableName
473
- }
474
- let isHasJoinTable
475
- if (gridParams && gridParams.basicInfo && gridParams.basicInfo.hasJoinTable) {
476
- isHasJoinTable = gridParams.basicInfo.hasJoinTable
477
- }
478
- let parentFormData
479
- if (gridParams.options.extraParam && gridParams.options.extraParam.entityMap) {
480
- parentFormData = gridParams.options.extraParam.entityMap
481
- }
482
- const headers = { Authorization: getToken() }
483
- // 数据库类型,值为mysql、oracle、sqlserver,默认是mysql,el-switch组件值保存需要使用
484
- let dataSourceType = 'mysql'
485
- if (Vue.prototype.dataSourceType) {
486
- dataSourceType = Vue.prototype.dataSourceType.toLowerCase()
487
- }
488
- const gridData = gridParams.gridData
489
- const subTableData = gridParams.subTableData
490
- const isSubTableShowPage = gridParams.isSubTableShowPage
491
- return {
492
- deptManTree: false, // 是否是部门人员树
493
- isMultiTree: false, // 是否是多选树
494
- isCheckStrictly: false, // 父子不互相关联也就是不选中子部门节点
495
- deptTree: false, // 是否是部门树
496
- wgManTree: false, // 是否是工作组人员树
497
- wgTree: false, // 是否是工作组树
498
- newValue: null,
499
- disabled, // 当前用户是否禁止编辑该字段/ 是否新增行
500
- componentName: '',
501
- validateErrorField: '', // 保存行记录时,验证失败的字段名
502
- annexUploadFlag: false,
503
- defaultAction,
504
- fileMultiple: false, // 文件是否多选
505
- lastFileName: '',
506
- fileList: [],
507
- lastServerName: '',
508
- fileSetObj: null,
509
- showSingleImgFlag: false,
510
- singleImgSrc: '',
511
- fields: null,
512
- innerValue, // 输入的内容
513
- dynamicSourceSelectOptions: {},
514
- valueSetOptions: null,
515
- dynamicDataSourceCode: null,
516
- tableName,
517
- isJoinTable: isHasJoinTable, // 是否是关联表
518
- departmentInfo: null, // 指定部门或分支
519
- parentFormData,
520
- headers,
521
- dataSourceType,
522
- inputNumberSet: {},
523
- fileInfo: { showName: null, serverPath: null },
524
- gridData: isSubTableShowPage ? subTableData : gridData,
525
- pageGridData: isSubTableShowPage ? gridData : null
526
-
527
- }
528
- },
529
- computed: {
530
- },
531
- watch: {
532
- value: {
533
- handler(newValue, oldValue) {
534
- // this.value = newValue
535
- // this.innerValue = this.value
536
- if (this.type && this.type === 'multiselect') {
537
- // 修改时多选下拉值回显 ,将字符串转换为数组
538
- const tempMultData = this.value && this.value !== null && typeof (this.value) === 'string' ? this.value.split(',') : this.value
539
- this.$set(this, 'innerValue', tempMultData)
540
- } else {
541
- if (this.type === 'yearRange') {
542
- this.$set(this, 'innerValue', '' + newValue)
543
- } else {
544
- this.$set(this, 'innerValue', newValue)
545
- }
546
- }
547
- const gridParams = store.get(this.listCode)
548
- if (gridParams.editProp === this.column.prop) {
549
- // 如果是当前编辑的字段,且是自定义控件才需要手动获得一下焦点
550
- this.$nextTick(() => {
551
- if (this.$refs.customItem) {
552
- this.$refs.customItem.focus()
553
- }
554
- })
555
- }
556
- },
557
- deep: true,
558
- immediate: true
559
- }
560
- },
561
- created() {
562
- const gridParams = store.get(this.listCode)
563
- this.gridParams = gridParams
564
- this.isCreateRow = gridParams.isCreateRow
565
- this.setTreeType()
566
- if (this.type && this.type.indexOf('custom:') >= 0) {
567
- this.componentName = this.type.substring(this.type.indexOf(':') + 1)
568
- }
569
-
570
- if (this.column.fileSet && this.column.fileSet !== '' &&
571
- (this.column.componentType === 'annex' || this.column.componentType === 'multipartUpload')) {
572
- const fileSetObj = JSON.parse(this.column.fileSet)
573
- this.fileInfo.showName = this.row[fileSetObj.showNameData.dbName]
574
- this.fileInfo.serverPath = this.row[fileSetObj.serverNameData.dbName]
575
- this.fileSetObj = fileSetObj
576
- if (fileSetObj && fileSetObj.multiple) {
577
- this.fileMultiple = true
578
- }
579
- this.fileList = getFileList(this.row, this.column, this.isSql)
580
- this.packageFileNameWithFileList()
581
- }
582
-
583
- if (this.column.componentType === 'inputNumber') {
584
- if (this.column.valueSetOptions && this.column.valueSetOptions !== '' && this.column.componentType === 'inputNumber') {
585
- const inputNumberSetting = JSON.parse(this.column.valueSetOptions)
586
- this.inputNumberSet = inputNumberSetting
587
- } else {
588
- this.inputNumberSet = {
589
- min: null,
590
- max: null,
591
- step: 1,
592
- precision: 0,
593
- position: ''
594
- }
595
- }
596
- }
597
- // 如果是多选文件类型,需要解析(需要设置临时字段,判断文件还是图片,图片需要预览)
598
- if (this.column.valueSetOptions && this.column.componentType !== 'inputNumber') {
599
- const valueSetOptionsObj = JSON.parse(this.column.valueSetOptions)
600
- if (valueSetOptionsObj && valueSetOptionsObj.valueSetOptions) {
601
- this.$set(this, 'valueSetOptions', valueSetOptionsObj.valueSetOptions)
602
- }
603
- if (valueSetOptionsObj.dynamicDataSourceCode && valueSetOptionsObj.dynamicDataSourceCode !== '') {
604
- this.$set(this, 'dynamicDataSourceCode', valueSetOptionsObj.dynamicDataSourceCode)
605
- }
606
- }
607
- if (this.column.orgTreeSet) {
608
- const orgTreeSet = JSON.parse(this.column.orgTreeSet)
609
- if (this.type.indexOf('DeptTree') > 0 && orgTreeSet.checkStrictly) {
610
- this.isCheckStrictly = orgTreeSet.checkStrictly
611
- }
612
- if (orgTreeSet.length) {
613
- this.fields = orgTreeSet
614
- } else {
615
- if (orgTreeSet.orgTreeSetArr) {
616
- this.fields = orgTreeSet.orgTreeSetArr
617
- }
618
- }
619
- }
620
- },
621
- mounted() {
622
- // 去掉该监听,否则导致焦点总是跳到第一个编辑框
623
- // this.$watch('lineEdit.editingCell', function(newVal, oldVal) {
624
- // this.focus()
625
- // }, {
626
- // immediate: true,
627
- // deep: true
628
- // })
629
- },
630
- methods: {
631
- focus() {
632
- if (this.type !== 'slider' && this.type !== 'rate') {
633
- // slider滑块组件 和 rate评分组件 没有focus方法
634
- if (this.lineEdit.editingCell && this.position && this.position.row === this.lineEdit.editingCell.row && this.position.prop === this.lineEdit.editingCell.prop) {
635
- if (this.$refs.item) {
636
- this.$refs.item.focus()
637
- }
638
- }
639
- }
640
- },
641
- handleBeforeUpload(file) {
642
- let limitFileSize = this.fileSetObj.limitFileSize
643
- if (limitFileSize === undefined) {
644
- // 默认是30M
645
- limitFileSize = 30
646
- }
647
- if (file.size > limitFileSize * 1024 * 1024) {
648
- // 超过最大限制
649
- this.$message({
650
- type: 'warning',
651
- message: this.$t('imatrixUIMessage.exceedFileSize', { fileSize: limitFileSize }),
652
- showClose: true
653
- })
654
- // 返回false停止上传
655
- return false
656
- }
657
- },
658
- setTreeType() {
659
- if (this.type) {
660
- if (this.type.indexOf('single') >= 0 && this.type.indexOf('Tree') > 0) {
661
- this.isMultiTree = false
662
- } else {
663
- this.isMultiTree = true
664
- }
665
- if (this.type.indexOf('DeptManTree') > 0) {
666
- // 说明是部门人员树
667
- this.deptManTree = true
668
- }
669
- if (this.type.indexOf('DeptTree') > 0) {
670
- // 说明是部门树
671
- this.deptTree = true
672
- }
673
- if (this.type.indexOf('WgManTree') > 0) {
674
- // 说明是工作组人员树
675
- this.wgManTree = true
676
- }
677
- if (this.type.indexOf('WgTree') > 0) {
678
- // 说明是工作组树
679
- this.wgTree = true
680
- }
681
- }
682
- },
683
- // 显示组织树时需要计算指定部门
684
- showOrganizationTree() {
685
- if (this.column.orgTreeSet) {
686
- const orgTreeSet = JSON.parse(this.column.orgTreeSet)
687
- if (orgTreeSet.length) {
688
- this.fields = orgTreeSet
689
- } else {
690
- if (orgTreeSet.orgTreeSetArr) {
691
- this.fields = orgTreeSet.orgTreeSetArr
692
- }
693
- if (orgTreeSet.specifyType) {
694
- if (orgTreeSet.specifyType === 'dataTable') {
695
- // 根据字段获取值
696
- if (orgTreeSet.dataTableField) {
697
- const dataTableFieldValue = getEntityFieldValue(this.row, orgTreeSet.dataTableField)
698
- if (dataTableFieldValue && dataTableFieldValue !== '') {
699
- this.$set(this, 'departmentInfo', dataTableFieldValue.split(','))
700
- }
701
- }
702
- } else if (orgTreeSet.specifyType === 'dept' || orgTreeSet.specifyType === 'workGroup') {
703
- if (orgTreeSet.specifyDept && orgTreeSet.specifyDept !== '') {
704
- if (typeof (orgTreeSet.specifyDept) === 'object') {
705
- // 固定值
706
- this.$set(this, 'departmentInfo', orgTreeSet.specifyDept)
707
- } else {
708
- this.$set(this, 'departmentInfo', orgTreeSet.specifyDept.split(','))
709
- }
710
- }
711
- }
712
- }
713
- }
714
- }
715
- },
716
- // isInputEventUpdateValue input事件时是否更新value值
717
- cellEvent(eventName, event, isInputEventUpdateValue) {
718
- // console.log('cellEvent1---eventName=', eventName, 'this.innerValue=', this.innerValue)
719
- let isInputVal = false
720
- if (eventName === 'focus') {
721
- this.$emit('focus', event)
722
- }
723
- if (eventName === 'input' && this.isDateControll()) {
724
- // 如果是日期控件,如果使用blur事件来修改数据内容,清空文本框内容不会改变model的值,所以还是需要input事件时处理
725
- let val = event
726
- if (val === '') {
727
- val = null
728
- }
729
- this.$emit('input', val)
730
- isInputVal = true
731
- // 在callCustomEvent方法中使用了innerValue属性
732
- this.innerValue = val
733
- } else if (eventName === 'input' && this.isSelectControll()) {
734
- // 如果是下拉框选择器控件,如果使用blur事件来修改数据内容,有时会更新不到最新数据
735
- // console.log('cellEvent2---this.innerValue=', this.innerValue)
736
- if (this.type === 'multiselect' && this.innerValue && Object.prototype.toString.apply(this.innerValue) === '[object Array]') {
737
- // 如果是多选下拉框,且值是数组
738
- const saveAll = 'saveAll'
739
- if (this.innerValue.indexOf(saveAll) < 0) {
740
- // 不包含“全选”时才走input,全选是在multiselectchange中特殊处理的
741
- this.$emit('input', this.innerValue.join(','))
742
- }
743
- } else {
744
- this.$emit('input', this.innerValue)
745
- }
746
- isInputVal = true
747
- } else if (eventName === 'input' && isInputEventUpdateValue !== undefined && isInputEventUpdateValue === true) {
748
- // 表示input事件时更新值,switch、rate、slider组件时会走该分支
749
- // 在callCustomEvent方法中使用了innerValue属性
750
- this.innerValue = event
751
- this.$emit('input', event)
752
- isInputVal = true
753
- } else if (eventName === 'blur' && !this.isSelectControll()) {
754
- // 为了使输入时流畅,所以在blur时调用input,更改组件的数据
755
- this.blurEvent()
756
- isInputVal = true
757
- }
758
- if (!isInputVal && eventName === 'change') {
759
- // 走完chang事件,触发一次失焦事件
760
- // this.$refs.item.blur()
761
- this.blurEvent()
762
- // 验证是否是合法的小数
763
- // 保存时后台给出数字类型转换错误的验证,前台不提供了,因为会同时出现两个类型错误提示信息的问题
764
- // this.checkDecimal()
765
- }
766
- if (eventName === 'clear') {
767
- if ((this.type === 'multiselect' || this.type === 'select') && isDynamicDataSourceSource(this.column)) {
768
- for (let index = 0; index < this.valueSetOptions.length; index++) {
769
- if (this.column.prop !== this.valueSetOptions[0].valueColumn.dbColumnName) {
770
- this.setCellValue(this.valueSetOptions[0].valueColumn.dbColumnName, null, 'input')
771
- }
772
- }
773
- }
774
- // 清空时,必须这样调用input事件 ,否则组件无法输入值
775
- this.$emit('input', null)
776
- }
777
- const gridParams = store.get(this.listCode)
778
- gridParams.editProp = this.column.prop
779
-
780
- // console.log('cellEvent4---this.innerValue=', this.innerValue)
781
- if (this.column.events && this.column.events[eventName]) {
782
- // 事件回调
783
- this.callCustomEvent(eventName)
784
- } else if (isEditOptionFunction(eventName, this.listCode)) {
785
- // 为了兼容历史版本保留了该判断
786
-
787
- gridParams.options.lineEditOptions[eventName].call(this, event, this.row, this.column)
788
- }
789
- this.$emit('findIndex')
790
- // console.log('cellEvent5---this.innerValue=', this.innerValue)
791
- },
792
- blurEvent() {
793
- if (this.innerValue === null || this.innerValue === undefined) {
794
- this.innerValue = null
795
- this.val = null
796
- }
797
- // 必须这样调用input事件 ,否则组件无法输入值
798
- this.$emit('input', this.innerValue)
799
- },
800
- // 是否是日期时间选择器
801
- isDateControll() {
802
- return (this.type === 'date' || this.column.dataType === 'DATE') || (this.type === 'time' || this.column.dataType === 'TIME')
803
- },
804
- // 是否是下拉框选择器
805
- isSelectControll() {
806
- return this.type === 'select' || this.type === 'multiselect'
807
- },
808
- // 值设置是否是动态数据源类型的数据源
809
- isDynamicDataSourceSource() {
810
- return isDynamicDataSourceSource(this.column)
811
- },
812
- // 是否是小数类型字段
813
- isDecimalDateType() {
814
- return this.column.dataType && this.column.dataType === 'DOUBLE' || this.column.dataType === 'FLOAT'
815
- },
816
- // 调用自定义事件回调
817
- callCustomEvent(eventName) {
818
- this.callCustomEventWithParam(eventName, { value: this.innerValue, row: this.row, column: this.column })
819
- },
820
- // 调用自定义事件回调
821
- callCustomEventWithParam(eventName, param) {
822
- // this.column.events 是个对象,key是事件名,value是options.eventCallBack中对应的方法名
823
- if (this.column && this.column.events && this.column.events[eventName]) {
824
- const funName = this.column.events[eventName]
825
- if (!this.listCode) {
826
- this.listCode = store.get('_list_code')
827
- }
828
- const gridParams = store.get(this.listCode)
829
- if (gridParams.options && gridParams.options['eventCallBack'] &&
830
- gridParams.options['eventCallBack'][funName] && typeof (gridParams.options['eventCallBack'][funName]) === 'function') {
831
- if (!param) {
832
- param = {}
833
- }
834
- param.formData = gridParams.options && gridParams.options.formData ? gridParams.options.formData : null
835
- param.parent = this.parentFormData
836
- gridParams.options['eventCallBack'][funName].call(this, param)
837
- }
838
- }
839
- },
840
- // 验证是否是合法的小数
841
- checkDecimal() {
842
- if (this.isDecimalDateType() && this.innerValue && this.innerValue !== null) {
843
- // 小数类型的字段,失去焦点时,判断输入的内容是否合法
844
- const numberReg = /^(-?\d+)(\.\d+)?$/
845
- if (!numberReg.test(this.innerValue + '')) {
846
- // 表示该字段还未验证,或验证成功,需要再次验证
847
- // 表示输入的不合法
848
- this.$message({
849
- type: 'warning',
850
- message: this.$t('imatrixUIMessage.invalideDoubleValue', { num: this.innerValue }),
851
- showClose: true
852
- })
853
- this.focus()
854
- return
855
- }
856
- }
857
- },
858
- // 自定义编辑组件修改属性值
859
- customFocus() {
860
- apis.focus(this.position ? this.position.row : null)
861
- },
862
- openAnnexUpload() {
863
- this.annexUploadFlag = true
864
- },
865
- previewImg() {
866
- this.fileList = getFileList(this.row, this.column, this.isSql)
867
- this.showSingleImgFlag = true
868
- },
869
- // 上传成功
870
- uploadOnSuccess(response) {
871
- if (response) {
872
- const responseFile = { name: response.showName, serverPath: response.serverPath }
873
- if (this.column.fileSet && this.column.fileSet !== '') {
874
- const fileSetObj = JSON.parse(this.column.fileSet)
875
- if (fileSetObj) {
876
- // 判断单选还是多选
877
- if (this.fileMultiple) {
878
- this.multiStorage(fileSetObj, responseFile)
879
- } else {
880
- this.radioStorageFile(fileSetObj, responseFile)
881
- }
882
- this.fileList = getFileList(this.row, this.column, this.isSql)
883
- }
884
- }
885
- }
886
- this.annexUploadFlag = false
887
- },
888
- // eventNames 事件名称值为input或clear,input表示值改变时触发的事件,clear表示值清空时触发的事件
889
- setCellValue(prop, value, eventNames) {
890
- this.$set(this.row, prop, value)
891
- if (eventNames) {
892
- eventNames.split(',').forEach(eventName => {
893
- this.callCustomEventWithParam(eventName, { value, row: this.row, column: this.column, prop })
894
- })
895
- }
896
- },
897
- // 单选上传完成后存储
898
- radioStorageFile(fileSetObj, responseFile) {
899
- if (fileSetObj.showNameData) {
900
- if (this.isSql) {
901
- if (fileSetObj.showNameData.dbName) {
902
- this.setCellValue(fileSetObj.showNameData.dbName, responseFile.name, 'input')
903
- }
904
- } else {
905
- if (fileSetObj.showNameData.name) {
906
- this.setCellValue(fileSetObj.showNameData.name, responseFile.name, 'input')
907
- }
908
- }
909
- }
910
- if (fileSetObj.serverNameData) {
911
- if (this.isSql) {
912
- if (fileSetObj.serverNameData.dbName) {
913
- this.setCellValue(fileSetObj.serverNameData.dbName, responseFile.serverPath)
914
- }
915
- } else {
916
- if (fileSetObj.serverNameData.name) {
917
- this.setCellValue(fileSetObj.serverNameData.name, responseFile.serverPath)
918
- }
919
- }
920
- }
921
- this.packageFileNameWithFileList([{ showName: responseFile.name, serverPath: responseFile.serverPath }])
922
- },
923
- // 多选上传完成后存储
924
- multiStorage(fileSetObj, responseFile) {
925
- const keyValueParam = analysisFileSetObj(fileSetObj, this.isSql)
926
- // 存储
927
- // 判断主表拼接还是子表保存
928
- if (fileSetObj.childAnnexDataTableCode) {
929
- // 存储子表
930
- // const lowerStr = fileSetObj.childAnnexDataTableCode.toLowerCase()
931
- let fileArr = this.row[this.column.prop]
932
- if (!fileArr) {
933
- fileArr = []
934
- }
935
- const fileObj = this.responseFileToFileObj(fileSetObj, responseFile)
936
- fileArr.push(fileObj)
937
- this.fileList = otherFilesToStandard(fileSetObj, keyValueParam, fileArr, null)
938
- this.setCellValue(this.column.prop, fileArr, 'input')
939
- } else {
940
- let showNameStr = ''
941
- let pathNameStr = ''
942
- // 存储主表
943
- if (fileSetObj.showNameData) {
944
- if (this.isSql) {
945
- if (fileSetObj.showNameData.dbName) {
946
- if (this.row) {
947
- if (this.row[fileSetObj.showNameData.dbName]) {
948
- let str = this.row[fileSetObj.showNameData.dbName]
949
- str += ',' + responseFile.name
950
- this.setCellValue(fileSetObj.showNameData.dbName, str, 'input')
951
- } else {
952
- this.setCellValue(fileSetObj.showNameData.dbName, responseFile.name, 'input')
953
- }
954
- showNameStr = this.row[fileSetObj.showNameData.dbName]
955
- }
956
- }
957
- } else {
958
- if (fileSetObj.showNameData.name) {
959
- if (this.row) {
960
- if (this.row[fileSetObj.showNameData.name]) {
961
- let str = this.row[fileSetObj.showNameData.name]
962
- str += ',' + responseFile.name
963
- this.setCellValue(fileSetObj.showNameData.name, str, 'input')
964
- } else {
965
- this.setCellValue(fileSetObj.showNameData.name, responseFile.name, 'input')
966
- }
967
- showNameStr = this.row[fileSetObj.showNameData.name]
968
- }
969
- }
970
- }
971
- }
972
- if (fileSetObj.serverNameData) {
973
- if (this.isSql) {
974
- if (fileSetObj.serverNameData.dbName) {
975
- if (this.row) {
976
- if (this.row[fileSetObj.serverNameData.dbName]) {
977
- let str = this.row[fileSetObj.serverNameData.dbName]
978
- str += ',' + responseFile.serverPath
979
- this.setCellValue(fileSetObj.serverNameData.dbName, str)
980
- } else {
981
- this.setCellValue(fileSetObj.serverNameData.dbName, responseFile.serverPath)
982
- }
983
- pathNameStr = this.row[fileSetObj.serverNameData.dbName]
984
- }
985
- }
986
- } else {
987
- if (fileSetObj.serverNameData.name) {
988
- if (this.row) {
989
- if (this.row[fileSetObj.serverNameData.name]) {
990
- let str = this.row[fileSetObj.serverNameData.name]
991
- str += ',' + responseFile.serverPath
992
- this.setCellValue(fileSetObj.serverNameData.name, str)
993
- } else {
994
- this.setCellValue(fileSetObj.serverNameData.name, responseFile.serverPath)
995
- }
996
- pathNameStr = this.row[fileSetObj.serverNameData.name]
997
- }
998
- }
999
- }
1000
- }
1001
- this.fileList = otherFilesToStandard(fileSetObj, keyValueParam, null, { 'showName': showNameStr, 'serverPath': pathNameStr })
1002
- }
1003
- this.packageFileNameWithFileList()
1004
- },
1005
- responseFileToFileObj(fileSetObj, responseFile) {
1006
- const fileObj = {}
1007
- if (fileSetObj.showNameData) {
1008
- if (this.isSql) {
1009
- if (fileSetObj.showNameData.dbName) {
1010
- this.$set(fileObj, fileSetObj.showNameData.dbName, responseFile.name)
1011
- }
1012
- } else {
1013
- if (fileSetObj.showNameData.name) {
1014
- this.$set(fileObj, fileSetObj.showNameData.name, responseFile.name)
1015
- }
1016
- }
1017
- }
1018
- if (fileSetObj.serverNameData) {
1019
- if (this.isSql) {
1020
- if (fileSetObj.serverNameData.dbName) {
1021
- this.$set(fileObj, fileSetObj.serverNameData.dbName, responseFile.serverPath)
1022
- }
1023
- } else {
1024
- if (fileSetObj.serverNameData.name) {
1025
- this.$set(fileObj, fileSetObj.serverNameData.name, responseFile.serverPath)
1026
- }
1027
- }
1028
- }
1029
- return fileObj
1030
- },
1031
- // 单选删除文件
1032
- deleteAnnexFile(fileSetObj) {
1033
- if (fileSetObj) {
1034
- if (fileSetObj.showNameData) {
1035
- if (this.isSql) {
1036
- if (fileSetObj.showNameData.dbName) {
1037
- this.setCellValue(fileSetObj.showNameData.dbName, null, 'input,clear')
1038
- }
1039
- } else {
1040
- if (fileSetObj.showNameData.name) {
1041
- this.setCellValue(fileSetObj.showNameData.name, null, 'input,clear')
1042
- }
1043
- }
1044
- }
1045
- if (fileSetObj.serverNameData) {
1046
- if (this.isSql) {
1047
- if (fileSetObj.serverNameData.dbName) {
1048
- this.setCellValue(fileSetObj.serverNameData.dbName, null)
1049
- }
1050
- } else {
1051
- if (fileSetObj.serverNameData.name) {
1052
- this.setCellValue(fileSetObj.serverNameData.name, null)
1053
- }
1054
- }
1055
- }
1056
- }
1057
- },
1058
- deleteFile(fileList, index) {
1059
- this.fileList = fileList
1060
- if (index !== undefined && index !== -1) {
1061
- this.fileList.splice(index, 1)
1062
- }
1063
- this.packageFileNameWithFileList()
1064
- if (this.column.fileSet && this.column.fileSet !== '') {
1065
- const fileSetObj = JSON.parse(this.column.fileSet)
1066
- if (fileSetObj) {
1067
- if (this.fileMultiple) {
1068
- // 多选附件
1069
- const keyValueParam = analysisFileSetObj(fileSetObj, this.isSql)
1070
- this.standardToOtherFiles(fileSetObj, keyValueParam)
1071
- } else {
1072
- // 单选附件
1073
- this.deleteAnnexFile(fileSetObj)
1074
- }
1075
- }
1076
- }
1077
- },
1078
- packageFileNameWithFileList(fileList) {
1079
- if (!fileList) {
1080
- fileList = this.fileList
1081
- }
1082
- if (fileList && fileList.length > 0) {
1083
- let fileNames = ''
1084
- let fileServerName = ''
1085
- fileList.forEach(item => {
1086
- fileNames += item.showName + ','
1087
- fileServerName += item.serverPath + ','
1088
- })
1089
- if (fileNames && fileNames.indexOf(',') > 0) {
1090
- this.lastFileName = fileNames.substring(0, fileNames.lastIndexOf(','))
1091
- this.lastServerName = fileServerName.substring(0, fileServerName.lastIndexOf(','))
1092
- }
1093
- } else {
1094
- this.lastFileName = null
1095
- this.lastServerName = null
1096
- }
1097
- },
1098
- // fileList 赋值Row
1099
- standardToOtherFiles(fileSetObj, keyValueParam) {
1100
- if (fileSetObj.childAnnexDataTableCode) {
1101
- // 子表
1102
- let fileArr = null
1103
- if (this.fileList && this.fileList.length > 0) {
1104
- fileArr = []
1105
- for (var i = 0; i < this.fileList.length; i++) {
1106
- const file = this.fileList[i]
1107
- const otherFile = {}
1108
- this.$set(otherFile, keyValueParam.showName, file.showName)
1109
- this.$set(otherFile, keyValueParam.serverPath, file.serverPath)
1110
- fileArr.push(otherFile)
1111
- }
1112
- }
1113
- this.setCellValue(this.column.prop, fileArr, 'input')
1114
- } else {
1115
- // 主表
1116
- let showNameStr = null
1117
- let serverNameStr = null
1118
- if (this.fileList && this.fileList.length > 0) {
1119
- showNameStr = ''
1120
- serverNameStr = ''
1121
- for (var k = 0; k < this.fileList.length; k++) {
1122
- const file = this.fileList[k]
1123
- if (showNameStr !== '') {
1124
- showNameStr += ','
1125
- }
1126
- if (serverNameStr !== '') {
1127
- serverNameStr += ','
1128
- }
1129
- showNameStr += file.showName
1130
- serverNameStr += file.serverPath
1131
- }
1132
- }
1133
- this.setCellValue(keyValueParam.showName, showNameStr, 'input')
1134
- this.setCellValue(keyValueParam.serverPath, serverNameStr)
1135
- }
1136
- },
1137
- // 组织结构树文本框值改变事件
1138
- organizationInputEvent(prop, value) {
1139
- // console.log('organizationInputEvent1---prop=', prop, 'this.column.prop=', this.column.prop, 'value=', value)
1140
- if (this.isSql && prop && prop.indexOf('.') < 0) {
1141
- if (prop !== this.column.prop && this.tableName) {
1142
- const replaceDot = '__'
1143
- prop = this.tableName + replaceDot + prop
1144
- }
1145
- }
1146
- setEntityFieldValue(this.row, prop, value)
1147
- if (prop && prop === this.column.prop) {
1148
- // 必须手动调用一下input事件,否则不会更新组件的值
1149
- // console.log('organizationInputEvent2---prop=', prop, 'value=', value)
1150
- this.callCustomEventWithParam('input', { value, row: this.row, column: this.column, prop })
1151
- }
1152
- },
1153
- // 组织结构树文本框值清空事件
1154
- clearOrganizationInputEvent(prop) {
1155
- if (this.isSql) {
1156
- // sql处理时在后台会把空串当做null处理
1157
- // this.$set(this.row, prop, '')
1158
- setEntityFieldValue(this.row, prop, '')
1159
- } else {
1160
- // 非sql处理时需要设为null,否则保存时后台可能会报字段类型不正确,无法保存
1161
- // this.$set(this.row, prop, null)
1162
- setEntityFieldValue(this.row, prop, null)
1163
- }
1164
- if (prop && prop === this.column.prop) {
1165
- // 必须手动调用一下input事件,否则不会更新组件的值
1166
- this.callCustomEventWithParam('clear', { row: this.row, column: this.column, prop })
1167
- }
1168
- },
1169
- // 组织结构树文本框值追加事件
1170
- appendOrganizationInputEvent(prop, originalValue, appendValue, separator, finallyValue) {
1171
- // this.$set(this.row, prop, finallyValue)
1172
- setEntityFieldValue(this.row, prop, finallyValue)
1173
- if (prop && prop === this.column.prop) {
1174
- this.callCustomEventWithParam('append', { originalValue, appendValue, separator, finallyValue, row: this.row, column: this.column, prop })
1175
- }
1176
- },
1177
- // 组织结构树文本框值替换事件
1178
- replaceOrganizationInputEvent(prop, originalValue, newValue) {
1179
- // this.$set(this.row, prop, newValue)
1180
- setEntityFieldValue(this.row, prop, newValue)
1181
- if (prop && prop === this.column.prop) {
1182
- this.callCustomEventWithParam('replace', { originalValue, newValue, row: this.row, column: this.column, prop })
1183
- }
1184
- },
1185
- setDynamicSourceSelectValue({ value, sourceColumnName, targetColumnName, options }) {
1186
- if (targetColumnName) {
1187
- this.setCellValue(targetColumnName, value, 'input')
1188
- }
1189
- },
1190
- multiselectChange(arr) {
1191
- // console.log('multiselectChange1---arr=', arr)
1192
- let isSaveAll = false
1193
- if (arr && arr.length > 0) {
1194
- const saveAll = 'saveAll'
1195
- if (arr.indexOf(saveAll) !== -1) {
1196
- const length = arr.length
1197
- if (length - 1 >= this.options.length) {
1198
- this.innerValue = null
1199
- // 取消全选
1200
- } else {
1201
- // 全选
1202
- if (!this.innerValue || this.innerValue.indexOf(saveAll) >= 0) {
1203
- this.innerValue = []
1204
- }
1205
- this.options.forEach(item => {
1206
- if (this.innerValue.indexOf(item.value) === -1) {
1207
- this.innerValue.push(item.value)
1208
- }
1209
- })
1210
- }
1211
- isSaveAll = true
1212
- }
1213
- }
1214
- // console.log('multiselectChange2---this.innerValue=', this.innerValue)
1215
- if (this.innerValue && this.innerValue.indexOf('saveAll') !== -1) {
1216
- this.innerValue.splice(this.innerValue.indexOf('saveAll'), 1)
1217
- }
1218
- // console.log('multiselectChange3---this.innerValue=', this.innerValue)
1219
- if (isSaveAll) {
1220
- this.cellEvent('input', this.innerValue)
1221
- }
1222
- this.cellEvent('change', arr)
1223
- },
1224
- getDefaultValue(val) {
1225
- if (this.column.defaultValue !== undefined && this.column.defaultValue !== null && (val === undefined || val === null || val === '')) {
1226
- // 表示当前字段的是空的,但是有默认值时,给当前字段设置值
1227
- setEntityFieldValue(this.row, this.column.prop, this.column.defaultValue)
1228
- return this.column.defaultValue
1229
- }
1230
- },
1231
- refresData(data) {
1232
- this.$emit('refresData', data)
1233
- },
1234
- refresPortData(port, value) {
1235
- this.$emit('refresPortData', port, value)
1236
- },
1237
- refresPortsData(map) {
1238
- this.$emit('refresPortsData', map)
1239
- },
1240
- refresMainTableFields(map) {
1241
- this.$emit('refresMainTableFields', map)
1242
- },
1243
- deleteSuccess(deleteFile) {
1244
- console.log('deleteSuccess', deleteFile, this.fileInfo)
1245
- },
1246
- // 时间格式判断是否是字符串类型,如果是字符串类型使用格式化的数据,如果是时间格式的显示时间搓
1247
- isValueFormat() {
1248
- if (this.column.dataType === 'TEXT' || this.column.dataType === 'text') {
1249
- return this.isFormat()
1250
- }
1251
- return 'timestamp'
1252
- },
1253
- // 时间格式判断是否是字符串类型,显示格式
1254
- isFormat() {
1255
- if (this.type === 'time' && this.column.dataType === 'TIME') {
1256
- return 'yyyy-MM-dd HH:mm:ss'
1257
- } else if (this.type === 'dateTimePicker') {
1258
- return 'yyyy-MM-dd HH:mm:ss'
1259
- } else if (this.type === 'date' && this.column.dataType === 'DATE') {
1260
- return 'yyyy-MM-dd'
1261
- } else if (this.type === 'timePicker') {
1262
- if (this.column.originalFormat) {
1263
- return this.column.originalFormat
1264
- }
1265
- return 'hh:mm:ss'
1266
- } else if (this.type === 'year') {
1267
- return 'yyyy'
1268
- } else if (this.type === 'month') {
1269
- return 'MM'
1270
- }
1271
- return 'yyyy-MM-dd'
1272
- },
1273
- fnProhibitToEdit(entity) {
1274
- this.$emit('prohibitToEdit', entity)
1275
- }
1276
-
1277
- }
1278
- }
1279
- </script>