imatrix-ui 2.8.39-dw → 2.8.39-pvtmp

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