vue2-client 1.8.166 → 1.8.167

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 (167) hide show
  1. package/.env +19 -19
  2. package/.eslintrc.js +90 -90
  3. package/CHANGELOG.md +824 -824
  4. package/Components.md +60 -60
  5. package/babel.config.js +21 -21
  6. package/docs/index.md +30 -30
  7. package/index.js +31 -31
  8. package/jest-transform-stub.js +8 -8
  9. package/jest.config.js +21 -21
  10. package/jest.setup.js +7 -7
  11. package/package.json +97 -97
  12. package/public/index.html +27 -27
  13. package/src/App.vue +164 -164
  14. package/src/ReportView.js +19 -19
  15. package/src/assets/img/querySlotDemo.svg +15 -15
  16. package/src/assets/svg/badtwo.svg +1 -1
  17. package/src/assets/svg/goodtwo.svg +1 -1
  18. package/src/base-client/components/common/AMisRender/index.js +3 -3
  19. package/src/base-client/components/common/AMisRender/index.vue +263 -263
  20. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +316 -316
  21. package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +120 -120
  22. package/src/base-client/components/common/CitySelect/index.js +3 -3
  23. package/src/base-client/components/common/CitySelect/index.md +109 -109
  24. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +669 -669
  25. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +1014 -1014
  26. package/src/base-client/components/common/CreateQuery/index.js +3 -3
  27. package/src/base-client/components/common/CreateQuery/index.md +42 -42
  28. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +452 -452
  29. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +511 -511
  30. package/src/base-client/components/common/CreateSimpleFormQuery/index.js +3 -3
  31. package/src/base-client/components/common/CreateSimpleFormQuery/index.md +42 -42
  32. package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +149 -149
  33. package/src/base-client/components/common/FormGroupEdit/index.js +3 -3
  34. package/src/base-client/components/common/FormGroupEdit/index.md +43 -43
  35. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +166 -166
  36. package/src/base-client/components/common/FormGroupQuery/index.js +3 -3
  37. package/src/base-client/components/common/FormGroupQuery/index.md +43 -43
  38. package/src/base-client/components/common/JSONToTree/jsontotree.vue +271 -271
  39. package/src/base-client/components/common/PersonSetting/PersonSetting.vue +208 -208
  40. package/src/base-client/components/common/PersonSetting/index.js +3 -3
  41. package/src/base-client/components/common/Tree/Tree.vue +149 -149
  42. package/src/base-client/components/common/Tree/index.js +2 -2
  43. package/src/base-client/components/common/Upload/Upload.vue +197 -197
  44. package/src/base-client/components/common/Upload/index.js +3 -3
  45. package/src/base-client/components/common/XAddForm/XAddForm.vue +92 -92
  46. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +502 -502
  47. package/src/base-client/components/common/XAddNativeForm/index.md +146 -146
  48. package/src/base-client/components/common/XAddNativeFormOA/XAddNativeFormOA.vue +303 -303
  49. package/src/base-client/components/common/XAddNativeFormOA/index.js +3 -3
  50. package/src/base-client/components/common/XAddNativeFormOA/index.md +146 -146
  51. package/src/base-client/components/common/XBadge/XBadge.vue +78 -78
  52. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  53. package/src/base-client/components/common/XDataDrawer/XDataDrawer.vue +180 -180
  54. package/src/base-client/components/common/XDataDrawer/index.js +3 -3
  55. package/src/base-client/components/common/XDataDrawer/index.md +41 -41
  56. package/src/base-client/components/common/XDescriptions/XDescriptions.vue +117 -117
  57. package/src/base-client/components/common/XDescriptions/index.js +3 -3
  58. package/src/base-client/components/common/XDescriptions/index.md +83 -83
  59. package/src/base-client/components/common/XForm/XForm.vue +253 -253
  60. package/src/base-client/components/common/XForm/XFormItem.vue +545 -545
  61. package/src/base-client/components/common/XForm/XTreeSelect.vue +191 -191
  62. package/src/base-client/components/common/XForm/index.md +178 -178
  63. package/src/base-client/components/common/XFormCol/XFormCol.vue +38 -38
  64. package/src/base-client/components/common/XFormTable/XFormTable.vue +418 -418
  65. package/src/base-client/components/common/XFormTable/index.md +98 -98
  66. package/src/base-client/components/common/XImportExcel/XImportExcel.vue +131 -131
  67. package/src/base-client/components/common/XReport/XReport.vue +694 -694
  68. package/src/base-client/components/common/XReport/XReportDesign.vue +423 -414
  69. package/src/base-client/components/common/XReport/XReportTrGroup.vue +602 -596
  70. package/src/base-client/components/common/XReport/index.js +3 -3
  71. package/src/base-client/components/common/XReport/index.md +44 -44
  72. package/src/base-client/components/common/XReportSlot/XReportSlot.vue +110 -110
  73. package/src/base-client/components/common/XReportSlot/index.js +3 -3
  74. package/src/base-client/components/common/XStepView/XStepView.vue +252 -252
  75. package/src/base-client/components/common/XStepView/index.js +3 -3
  76. package/src/base-client/components/common/XStepView/index.md +31 -31
  77. package/src/base-client/components/common/XTable/XTable.vue +549 -549
  78. package/src/base-client/components/common/XTable/index.md +255 -255
  79. package/src/base-client/components/common/XTree/XTree.vue +76 -76
  80. package/src/base-client/components/common/XTree/index.js +3 -3
  81. package/src/base-client/components/common/XTree/index.md +36 -36
  82. package/src/base-client/components/index.js +47 -47
  83. package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +232 -232
  84. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
  85. package/src/base-client/plugins/AppData.js +115 -115
  86. package/src/base-client/plugins/Config.js +19 -19
  87. package/src/base-client/plugins/GetLoginInfoService.js +182 -182
  88. package/src/base-client/plugins/tabs-page-plugin.js +39 -39
  89. package/src/bootstrap.js +39 -39
  90. package/src/components/CodeMirror/inedx.vue +118 -118
  91. package/src/components/CodeMirror/setting.js +40 -40
  92. package/src/components/FilePreview/FilePreview.vue +166 -166
  93. package/src/components/NumberInfo/NumberInfo.vue +54 -54
  94. package/src/components/STable/index.js +323 -323
  95. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  96. package/src/components/checkbox/ImgCheckbox.vue +163 -163
  97. package/src/components/menu/SideMenu.vue +75 -75
  98. package/src/components/menu/menu.js +273 -273
  99. package/src/components/tool/AStepItem.vue +60 -60
  100. package/src/config/CreateQueryConfig.js +322 -322
  101. package/src/config/default/antd.config.js +89 -89
  102. package/src/config/default/setting.config.js +53 -53
  103. package/src/font-style/font.css +4 -4
  104. package/src/layouts/CommonLayout.vue +56 -56
  105. package/src/layouts/PageLayout.vue +151 -151
  106. package/src/layouts/SinglePageView.vue +138 -138
  107. package/src/layouts/header/AdminHeader.vue +132 -132
  108. package/src/layouts/header/HeaderNotice.vue +177 -177
  109. package/src/layouts/tabs/TabsHead.vue +189 -189
  110. package/src/layouts/tabs/TabsView.vue +387 -387
  111. package/src/lib.js +1 -1
  112. package/src/main.js +26 -26
  113. package/src/mock/extend/index.js +84 -84
  114. package/src/mock/goods/index.js +108 -108
  115. package/src/pages/AMisDemo/AMisDemo.vue +325 -325
  116. package/src/pages/AMisDemo/AMisDemo2.vue +74 -74
  117. package/src/pages/DynamicStatistics/ChartSelector.vue +331 -331
  118. package/src/pages/DynamicStatistics/DataTabs.vue +83 -83
  119. package/src/pages/DynamicStatistics/DynamicTable.vue +128 -128
  120. package/src/pages/DynamicStatistics/EvaluationArea.vue +69 -69
  121. package/src/pages/DynamicStatistics/FavoriteList.vue +51 -51
  122. package/src/pages/DynamicStatistics/QuestionHistoryAndFavorites.vue +591 -591
  123. package/src/pages/DynamicStatistics/SearchBar.vue +192 -192
  124. package/src/pages/DynamicStatistics/index.vue +282 -282
  125. package/src/pages/Example/index.vue +1432 -1305
  126. package/src/pages/ServiceReview/index.vue +284 -284
  127. package/src/pages/XReportView/index.vue +62 -62
  128. package/src/pages/login/Login.vue +378 -378
  129. package/src/pages/login/LoginV3.vue +389 -389
  130. package/src/pages/resourceManage/orgListManage.vue +98 -98
  131. package/src/pages/system/dictionary/index.vue +44 -44
  132. package/src/pages/system/monitor/loginInfor/index.vue +37 -37
  133. package/src/pages/system/monitor/operLog/index.vue +37 -37
  134. package/src/pages/system/settings/modifyPassword.vue +117 -117
  135. package/src/pages/system/ticket/index.vue +480 -480
  136. package/src/pages/system/ticket/submitTicketSuccess.vue +484 -484
  137. package/src/router/async/config.async.js +32 -32
  138. package/src/router/async/router.map.js +98 -98
  139. package/src/router/guards.js +214 -214
  140. package/src/router/index.js +27 -27
  141. package/src/router.js +18 -18
  142. package/src/services/api/TicketDetailsViewApi.js +46 -46
  143. package/src/services/api/cas.js +79 -79
  144. package/src/services/api/common.js +274 -274
  145. package/src/services/api/entity.js +18 -18
  146. package/src/services/api/index.js +17 -17
  147. package/src/services/api/restTools.js +46 -46
  148. package/src/services/apiService.js +14 -14
  149. package/src/services/user.js +71 -71
  150. package/src/store/modules/setting.js +119 -119
  151. package/src/theme/default/style.less +57 -57
  152. package/src/utils/authority-utils.js +85 -85
  153. package/src/utils/errorCode.js +6 -6
  154. package/src/utils/htmlToPDF.js +108 -108
  155. package/src/utils/htmlToPDFApi.js +5 -5
  156. package/src/utils/indexedDB.js +201 -201
  157. package/src/utils/login.js +141 -141
  158. package/src/utils/map-utils.js +47 -47
  159. package/src/utils/request.js +343 -343
  160. package/src/utils/routerUtil.js +428 -428
  161. package/src/utils/util.js +231 -231
  162. package/src/utils/waterMark.js +31 -31
  163. package/test/Amis.spec.js +163 -163
  164. package/test/Tree.spec.js +167 -167
  165. package/test/myDialog.spec.js +46 -46
  166. package/vue.config.js +166 -166
  167. package//350/277/201/347/247/273/346/227/245/345/277/227.md +15 -15
@@ -1,596 +1,602 @@
1
- <template>
2
- <tr>
3
- <!-- 预览页展示 -->
4
- <template v-if="display">
5
- <template v-if="!inputColumns">
6
- <td
7
- v-for="(cell, cellIndex) in columns"
8
- v-if="!cell.dontShowRow"
9
- :key="cellIndex"
10
- :class=" calcTDBorder(cell.noBoarder) "
11
- :style="cell.style ? cell.style : undefined"
12
- :colspan="cell.colSpan ? cell.colSpan : undefined">
13
- <template v-if="cell.type === 'column'">
14
- <template v-if="cell.customFunction">
15
- {{ deserializeFunctionAndRun(cell.customFunction, configData[cell.dataIndex], config) }}
16
- </template>
17
- <template v-else>
18
- {{ cell.text }}
19
- </template>
20
- </template>
21
- <template v-else-if="cell.type === 'placeHolderColumn'">
22
- <!-- 占位 -->
23
- </template>
24
- <template v-else-if="cell.type === 'value'">
25
- <template v-if="cell.customFunction === undefined">
26
- {{ cell.value }}
27
- </template>
28
- <template v-else>
29
- {{ deserializeFunctionAndRun(cell.customFunction, cell.value, config) }}
30
- </template>
31
- </template>
32
- <template v-else-if="cell.type === 'input'">
33
- <template v-if="cell.customFunction === undefined">
34
- {{ getDeepObject(configData, cell.dataIndex) }}
35
- </template>
36
- <template v-else>
37
- {{ deserializeFunctionAndRun(cell.customFunction, configData[cell.dataIndex], config) }}
38
- </template>
39
- </template>
40
- <template v-else-if="cell.type === 'inputs'">
41
- <template v-if="cell.customFunction === undefined">
42
- {{ showSubRowValue(cell) }}
43
- </template>
44
- <template v-else>
45
- {{ deserializeFunctionAndRun(cell.customFunction, showSubRowValue(cell), config) }}
46
- </template>
47
- </template>
48
- <template v-else-if="cell.type === 'list'">
49
- <template v-if="cell.listType === 'input'">
50
- {{ getDeepObject(configData, cell.dataIndex)[listIndex] }}
51
- </template>
52
- <template v-else-if="cell.listType === 'value'">
53
- {{ cell.content[listIndex] }}
54
- </template>
55
- </template>
56
- <template v-else-if="cell.type === 'images'">
57
- <template v-for="(img,imgIndex) in getDeepObject(configData.images, cell.dataIndex)">
58
- <span :key="imgIndex" style="margin-right: 5%">{{ img.name }}</span>
59
- </template>
60
- <template v-if="getDeepObject(configData.images, cell.dataIndex).length === 0">
61
- <span>无</span>
62
- </template>
63
- </template>
64
- </td>
65
- </template>
66
- <template v-else>
67
- <td
68
- v-for="(cell, cellIndex) in columns"
69
- :key="cellIndex"
70
- :class=" calcTDBorder(cell.noBoarder) "
71
- :colspan="cell.colSpan ? cell.colSpan : undefined"
72
- :style="cell.style ? cell.style : undefined"
73
- :rowspan="cell.rowSpan ? cell.rowSpan : undefined">
74
- <template v-if="cell.type === 'column'">
75
- {{ cell.text }}
76
- </template>
77
- <template v-else-if="cell.type === 'value'">
78
- <template v-if="cell.customFunction === undefined">
79
- {{ cell.value }}
80
- </template>
81
- <template v-else>
82
- {{ deserializeFunctionAndRun(cell.customFunction, cell.value, config) }}
83
- </template>
84
- </template>
85
- <template v-else-if="cell.type === 'increment'">
86
- <template v-if="cell.customFunction === undefined">
87
- {{ getDeepObject(configData.arr[inputColumnsDefinitionIndex], cell.dataIndex) }}
88
- </template>
89
- <template v-else>
90
- {{
91
- deserializeFunctionAndRun(cell.customFunction, configData.arr[inputColumnsDefinitionIndex][cell.dataIndex], config)
92
- }}
93
- </template>
94
- </template>
95
- <template v-else-if="cell.type === 'input'">
96
- <template v-if="cell.customFunction === undefined">
97
- {{ getDeepObject(configData.arr[inputColumnsDefinitionIndex], cell.dataIndex) }}
98
- </template>
99
- <template v-else>
100
- {{
101
- deserializeFunctionAndRun(cell.customFunction, configData.arr[inputColumnsDefinitionIndex][cell.dataIndex], config)
102
- }}
103
- </template>
104
- </template>
105
- <template v-else-if="cell.type === 'inputs'">
106
- <template v-if="cell.customFunction === undefined">
107
- {{ getDeepObject(configData.arr[inputColumnsDefinitionIndex], cell.dataIndex) }}
108
- </template>
109
- <template v-else>
110
- {{
111
- deserializeFunctionAndRun(cell.customFunction, configData.arr[inputColumnsDefinitionIndex][cell.dataIndex], config)
112
- }}
113
- </template>
114
- </template>
115
- </td>
116
- </template>
117
- </template>
118
- <!-- 不是动态行 -->
119
- <template v-else-if="!inputColumns">
120
- <td
121
- v-for="(cell, cellIndex) in columns"
122
- :key="cellIndex"
123
- :class=" calcTDBorder(cell.noBoarder) "
124
- :colspan="cell.colSpan ? cell.colSpan : undefined"
125
- :style="cell.style ? cell.style : undefined"
126
- :rowspan="cell.rowSpan ? cell.rowSpan : undefined">
127
- <template v-if="cell.type === 'column'">
128
- <template v-if="cell.customFunction">
129
- {{ deserializeFunctionAndRun(cell.customFunction, configData[cell.dataIndex], config) }}
130
- </template>
131
- <template v-else>
132
- {{ cell.text }}
133
- </template>
134
- </template>
135
- <template v-else-if="cell.type === 'placeHolderColumn'">
136
- <!-- 占位 -->
137
- </template>
138
- <template v-else-if="cell.type === 'value'">
139
- {{ cell.value }}
140
- </template>
141
- <template v-else-if="cell.type === 'curDateInput'">
142
- <a-button type="dashed" v-if="configData[cell.dataIndex]">
143
- {{ configData[cell.dataIndex] }}
144
- </a-button>
145
- <a-button
146
- v-if="!configData[cell.dataIndex]"
147
- type="primary"
148
- @click="getNowDate(cell.dataIndex)"
149
- >{{ cell.text || '确认' }}
150
- </a-button>
151
- </template>
152
- <template v-else-if="cell.type === 'input'">
153
- <template v-if="cell.inputReadOnly === true">
154
- <template v-if="cell.dataIndex.indexOf('@@@') !== -1">
155
- <a-input
156
- @change="handleInputDeepChange($event, cell.dataIndex)"
157
- v-model="config.tempData[cell.dataIndex]"
158
- :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"
159
- :disabled="true"/>
160
- </template>
161
- <template v-else>
162
- <a-input
163
- v-model="configData[cell.dataIndex]"
164
- :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"
165
- :disabled="true"/>
166
- </template>
167
- </template>
168
- <template v-else>
169
- <template v-if="cell.dataIndex.indexOf('@@@') !== -1">
170
- <a-input
171
- @change="handleInputDeepChange($event, cell.dataIndex)"
172
- v-model="config.tempData[cell.dataIndex]"
173
- :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
174
- </template>
175
- <template v-else>
176
- <a-input
177
- v-model="configData[cell.dataIndex]"
178
- :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
179
- </template>
180
- </template>
181
- </template>
182
- <template v-else-if="cell.type === 'inputs'">
183
- <template v-if="cell.inputReadOnly === true">
184
- <div class="inputsDiv">
185
- <div class="inputsDivItem" v-for="(num, index) of calcFormatInputNum(cell.format)" :key="index">
186
- <span class="inputsDivItemLabel">{{ displayFormatStartText(cell.format) }}</span>
187
- <template v-if="cell.dataIndex.indexOf('@@@') !== -1">
188
- <a-input
189
- @change="handleInputDeepChange($event, cell.dataIndex)"
190
- v-model="config.tempData[cell.dataIndex][index]"
191
- :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"
192
- :disabled="true"/>
193
- </template>
194
- <template v-else>
195
- <a-input
196
- v-model="configData[cell.dataIndex][index]"
197
- :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"
198
- :disabled="true"/>
199
- </template>
200
- <span class="inputsDivItemLabel">{{ displayFormatText(cell.format, index) }}</span>
201
- </div>
202
- </div>
203
- </template>
204
- <template v-else>
205
- <div class="inputsDiv">
206
- <div class="inputsDivItem" v-for="(num, index) of calcFormatInputNum(cell.format)" :key="index">
207
- <span class="inputsDivItemLabel">{{ displayFormatStartText(cell.format) }}</span>
208
- <template v-if="cell.dataIndex.indexOf('@@@') !== -1">
209
- <a-input
210
- @change="handleInputDeepChange($event, cell.dataIndex)"
211
- v-model="config.tempData[cell.dataIndex][index]"
212
- :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
213
- </template>
214
- <template v-else>
215
- <a-input
216
- v-model="configData[cell.dataIndex][index]"
217
- :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
218
- </template>
219
- <span class="inputsDivItemLabel">{{ displayFormatText(cell.format, index) }}</span>
220
- </div>
221
- </div>
222
- </template>
223
- </template>
224
- <template v-else-if="cell.type === 'list'">
225
- <template v-if="cell.listType === 'input'">
226
- <a-input
227
- v-model="configData[cell.dataIndex][listIndex]"
228
- :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
229
- </template>
230
- <template v-else-if="cell.listType === 'value'">
231
- {{ cell.content[listIndex] }}
232
- </template>
233
- </template>
234
- <template v-else-if="cell.type === 'images'">
235
- <div>
236
- <upload
237
- :model="{type: 'image', accept: ['*'], resUploadStock: 1, pathKey: 'cs', resUploadMode: 'oss'}"
238
- service-name="af-system"
239
- :images="configData.images[cell.dataIndex]"
240
- :outer-container-index="cell.dataIndex"
241
- @setFiles="setImages"
242
- :upload-style="'simple'"
243
- />
244
- </div>
245
- </template>
246
- </td>
247
- </template>
248
- <!-- 动态行插入按钮 -->
249
- <template v-else-if="inputColumnsButton">
250
- <td :colspan="maxColSpan" :class="calcTDBorder()">
251
- <a-button-group>
252
- <a-button @click="addData(columns[0].dataIndex, columns)">
253
- <a-icon type="plus"/>
254
- </a-button>
255
- <a-button @click="removeData(columns[0].dataIndex)">
256
- <a-icon type="minus"/>
257
- </a-button>
258
- </a-button-group>
259
- </td>
260
- </template>
261
- <!-- 其他行 -->
262
- <template v-else>
263
- <td
264
- v-for="(cell, cellIndex) in columns"
265
- :key="cellIndex"
266
- :class=" calcTDBorder(cell.noBoarder) "
267
- :colspan="cell.colSpan ? cell.colSpan : undefined"
268
- :style="cell.style ? cell.style : undefined"
269
- :rowspan="cell.rowSpan ? cell.rowSpan : undefined">
270
- <template v-if="cell.type === 'column'">
271
- {{ cell.text }}
272
- </template>
273
- <template v-else-if="cell.type === 'value'">
274
- {{ cell.value }}
275
- </template>
276
- <template v-else-if="cell.type === 'curDateInput'">
277
- <a-button type="dashed" v-if="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]">
278
- {{ configData.arr[inputColumnsDefinitionIndex][cell.dataIndex] }}
279
- </a-button>
280
- <a-button
281
- v-if="!configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
282
- type="primary"
283
- @click="getNowDate(inputColumnsDefinitionIndex,cell.dataIndex)"
284
- >{{ cell.text || '确认' }}
285
- </a-button>
286
- </template>
287
- <template v-else-if="cell.type === 'increment'">
288
- {{ configData.arr[inputColumnsDefinitionIndex][cell.dataIndex] }}
289
- </template>
290
- <template v-else-if="cell.type === 'input'">
291
- <template v-if="cell.inputReadOnly === true">
292
- <a-input
293
- v-model="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
294
- :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"
295
- :disabled="true"/>
296
- </template>
297
- <template v-else>
298
- <a-input
299
- v-model="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
300
- :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
301
- </template>
302
- </template>
303
- <template v-else-if="cell.type === 'inputs'">
304
- <template v-if="cell.inputReadOnly === true">
305
- <a-input
306
- v-model="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
307
- :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"
308
- :disabled="true"/>
309
- </template>
310
- <template v-else>
311
- <a-input
312
- v-model="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
313
- :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
314
- </template>
315
- </template>
316
- </td>
317
- </template>
318
- </tr>
319
- </template>
320
-
321
- <script>
322
- import Upload from '@vue2-client/base-client/components/common/Upload'
323
- import { formatDate } from '@vue2-client/utils/util'
324
-
325
- export default {
326
- name: 'XReportTrGroup',
327
- components: {
328
- Upload
329
- },
330
- props: {
331
- // 每一行的配置
332
- columns: {
333
- type: Array,
334
- required: true
335
- },
336
- config: {
337
- type: Object,
338
- default: function () {
339
- return {}
340
- }
341
- },
342
- // 原始配置
343
- configData: {
344
- type: Object,
345
- required: true
346
- },
347
- // 是否为动态行
348
- inputColumns: {
349
- type: Boolean,
350
- default: false
351
- },
352
- // 是否为动态行按钮
353
- inputColumnsButton: {
354
- type: Boolean,
355
- default: false
356
- },
357
- // 动态行的Index
358
- inputColumnsDefinitionIndex: {
359
- type: Number,
360
- default: undefined
361
- },
362
- // 是否为展示行
363
- display: {
364
- type: Boolean,
365
- default: false
366
- },
367
- // listIndex
368
- listIndex: {
369
- type: Number,
370
- default: undefined
371
- },
372
- noTopBorder: {
373
- type: Boolean,
374
- default: false
375
- }
376
- },
377
- data () {
378
- return {
379
- maxColSpan: 12
380
- // tableConfig: {}
381
- }
382
- },
383
- methods: {
384
- handleInputDeepChange () {
385
- this.$forceUpdate()
386
- },
387
- getDeepObject (obj, strPath) {
388
- const arr = strPath.split('@@@')
389
- let result = obj[arr[0]]
390
- arr.shift()
391
- try {
392
- while (arr.length > 0) {
393
- result = result[arr[0]]
394
- arr.shift()
395
- }
396
- } catch (e) {
397
- result = undefined
398
- }
399
- return result
400
- },
401
- getNowDate (index1, index2) {
402
- if (index2) {
403
- // @click="getNowDate(configData.arr[inputColumnsDefinitionIndex][cell.dataIndex])"
404
- this.configData.arr[index1][index2] = formatDate('now')
405
- } else {
406
- this.configData[index1] = formatDate('now')
407
- }
408
- this.configData = Object.assign({}, this.configData)
409
- },
410
- deserializeFunctionAndRun (functionStr, value) {
411
- // eslint-disable-next-line no-eval
412
- const fun = eval('(' + functionStr + ')')
413
- return fun(value, this.config)
414
- },
415
- setImages (imageIds, dataIndex) {
416
- this.configData.images[dataIndex] = imageIds
417
- },
418
- removeData (index) {
419
- if (this.configData[index].length === 0) {
420
- this.$message.warn('已经没有更多了')
421
- return
422
- }
423
- this.configData[index].pop()
424
- },
425
- // 添加一行
426
- addData (index, row) {
427
- // 获取定义
428
- const defs = row[0].definition
429
-
430
- // 获取外层对象名
431
- const dataName = row[0].dataIndex
432
- const temp = {}
433
-
434
- defs.forEach(def => {
435
- // 找到数组中最后一个数据的值
436
- let lastDataNo = 0
437
- if (this.configData[dataName][this.configData[dataName].length - 1]) {
438
- lastDataNo = this.configData[dataName][this.configData[dataName].length - 1][def.dataIndex]
439
- }
440
-
441
- // 如果没有值,检查是否声明了初始值
442
- if (lastDataNo === 0 && def.initialValue) {
443
- lastDataNo = def.initialValue
444
- }
445
-
446
- // 检查是否有步长
447
- let step = 1
448
- if (def.step) {
449
- step = def.step
450
- }
451
-
452
- // 如果单元格类型为increment,则进行自增
453
- if (def.type === 'increment') {
454
- temp[def.dataIndex] = lastDataNo + step
455
- }
456
- })
457
- this.configData[index].push(temp)
458
- },
459
- // 根据format计算需要多少个输入框
460
- calcFormatInputNum (formatStr) {
461
- let count = 0
462
- for (let i = 0; i < formatStr.length; i++) {
463
- if (formatStr[i] === '{') {
464
- count++
465
- }
466
- }
467
- return count
468
- },
469
- // 根据format计算输入框之后的文字显示
470
- displayFormatText (formatStr, num) {
471
- let start = 0
472
- let count = 0
473
- num++
474
- for (let i = 0; i < formatStr.length; i++) {
475
- if (formatStr[i] === '}') {
476
- start = i
477
- count++
478
- }
479
- if (count === num) {
480
- for (let j = start + 1; j < formatStr.length; j++) {
481
- if (formatStr[j] === '{') {
482
- return formatStr.slice(start + 1, j)
483
- }
484
- if (j === formatStr.length - 1 && formatStr[j] !== '}') {
485
- return formatStr[j]
486
- }
487
- }
488
- }
489
- }
490
- },
491
- calcTDBorder (cellNoBorder = false) {
492
- if (cellNoBorder) {
493
- return 'tdNoBorder'
494
- } else {
495
- if (this.noTopBorder) {
496
- return 'tdWithNoTopBorder'
497
- } else {
498
- return 'tdWithBorder'
499
- }
500
- }
501
- },
502
- // 根据format计算输入框之前的文字显示
503
- displayFormatStartText (formatStr) {
504
- let count = 0
505
- for (let i = 0; i < formatStr.length; i++) {
506
- if (formatStr[i] === '{') {
507
- break
508
- } else {
509
- count++
510
- }
511
- }
512
- return formatStr.slice(0, count)
513
- },
514
- // 拼接被自动拆分的单元格内容
515
- showSubRowValue (cell) {
516
- const dataName = cell.dataIndex
517
- const formatArr = []
518
- const dataArr = []
519
-
520
- // 从config中取出所有数据,根据dataIndex的开头内容进行拼接
521
- this.config.columns.forEach(row => row.forEach(cell => {
522
- if (cell.dataIndex && cell.dataIndex.startsWith(dataName)) {
523
- formatArr.push(cell.format)
524
- dataArr.push(this.configData[cell.dataIndex])
525
- }
526
- }))
527
-
528
- const text = []
529
- const data = []
530
-
531
- formatArr.forEach(word => {
532
- const temp = word.split('{}')
533
- temp.forEach(char => {
534
- if (char !== '') {
535
- text.push(char)
536
- }
537
- })
538
- })
539
-
540
- dataArr.forEach(item => {
541
- item.forEach(num => {
542
- data.push(num)
543
- })
544
- })
545
-
546
- let result = ''
547
- for (let i = 0; i < data.length; i++) {
548
- result += data[i]
549
- result += text[i]
550
- }
551
-
552
- return result
553
- },
554
- },
555
- beforeMount () {
556
- }
557
- }
558
-
559
- </script>
560
-
561
- <style scoped lang="less">
562
- .inputsDiv {
563
- display: flex;
564
- justify-content: space-between;
565
-
566
- .inputsDivItem {
567
- display: flex;
568
- align-items: center;
569
- padding: 0 4px;
570
- white-space: nowrap;
571
-
572
- .inputsDivItemLabel {
573
- padding: 0 4px;
574
- }
575
- }
576
- }
577
-
578
- .tdNoBorder {
579
- border-left: 1px solid #000;
580
- border-right: 1px solid #000;
581
- padding: 8px;
582
- }
583
-
584
- .tdWithBorder {
585
- border: 1px solid #000;
586
- padding: 8px;
587
- }
588
-
589
- .tdWithNoTopBorder {
590
- border-top-style: none;
591
- border-left: 1px solid #000;
592
- border-right: 1px solid #000;
593
- border-bottom: 1px solid #000;
594
- padding: 8px;
595
- }
596
- </style>
1
+ <template>
2
+ <tr>
3
+ <!-- 预览页展示 -->
4
+ <template v-if="display">
5
+ <template v-if="!inputColumns">
6
+ <td
7
+ v-for="(cell, cellIndex) in columns"
8
+ v-if="!cell.dontShowRow"
9
+ :key="cellIndex"
10
+ :class=" calcTDBorder(cell.noBoarder) "
11
+ :style="cell.style ? cell.style : undefined"
12
+ :colspan="cell.colSpan ? cell.colSpan : undefined">
13
+ <template v-if="cell.type === 'column'">
14
+ <template v-if="cell.customFunction">
15
+ {{ deserializeFunctionAndRun(cell.customFunction, configData[cell.dataIndex], config) }}
16
+ </template>
17
+ <template v-else>
18
+ {{ cell.text }}
19
+ </template>
20
+ </template>
21
+ <template v-else-if="cell.type === 'placeHolderColumn'">
22
+ <!-- 占位 -->
23
+ </template>
24
+ <template v-else-if="cell.type === 'value'">
25
+ <template v-if="cell.customFunction === undefined">
26
+ {{ cell.value }}
27
+ </template>
28
+ <template v-else>
29
+ {{ deserializeFunctionAndRun(cell.customFunction, cell.value, config) }}
30
+ </template>
31
+ </template>
32
+ <template v-else-if="cell.type === 'input'">
33
+ <template v-if="cell.customFunction === undefined">
34
+ {{ getDeepObject(configData, cell.dataIndex) }}
35
+ </template>
36
+ <template v-else>
37
+ {{ deserializeFunctionAndRun(cell.customFunction, configData[cell.dataIndex], config) }}
38
+ </template>
39
+ </template>
40
+ <template v-else-if="cell.type === 'inputs'">
41
+ <template v-if="cell.customFunction === undefined">
42
+ {{ showSubRowValue(cell) }}
43
+ </template>
44
+ <template v-else>
45
+ {{ deserializeFunctionAndRun(cell.customFunction, showSubRowValue(cell), config) }}
46
+ </template>
47
+ </template>
48
+ <template v-else-if="cell.type === 'list'">
49
+ <template v-if="listIndex === 0">
50
+ <span style="font-weight: bold">{{ cell.listHead }}</span>
51
+ </template>
52
+ <template v-else-if="cell.listType === 'input'">
53
+ {{ getDeepObject(configData, cell.dataIndex)[listIndex] }}
54
+ </template>
55
+ <template v-else-if="cell.listType === 'value'">
56
+ {{ cell.content[listIndex] }}
57
+ </template>
58
+ <template v-else-if="cell.listType === 'variable'">
59
+ {{ configData[cell.dataIndex][listIndex - 1][cell.listDataIndex] }}
60
+ </template>
61
+ </template>
62
+ <template v-else-if="cell.type === 'images'">
63
+ <template v-for="(img,imgIndex) in getDeepObject(configData.images, cell.dataIndex)">
64
+ <span :key="imgIndex" style="margin-right: 5%">{{ img.name }}</span>
65
+ </template>
66
+ <template v-if="getDeepObject(configData.images, cell.dataIndex).length === 0">
67
+ <span>无</span>
68
+ </template>
69
+ </template>
70
+ </td>
71
+ </template>
72
+ <template v-else>
73
+ <td
74
+ v-for="(cell, cellIndex) in columns"
75
+ :key="cellIndex"
76
+ :class=" calcTDBorder(cell.noBoarder) "
77
+ :colspan="cell.colSpan ? cell.colSpan : undefined"
78
+ :style="cell.style ? cell.style : undefined"
79
+ :rowspan="cell.rowSpan ? cell.rowSpan : undefined">
80
+ <template v-if="cell.type === 'column'">
81
+ {{ cell.text }}
82
+ </template>
83
+ <template v-else-if="cell.type === 'value'">
84
+ <template v-if="cell.customFunction === undefined">
85
+ {{ cell.value }}
86
+ </template>
87
+ <template v-else>
88
+ {{ deserializeFunctionAndRun(cell.customFunction, cell.value, config) }}
89
+ </template>
90
+ </template>
91
+ <template v-else-if="cell.type === 'increment'">
92
+ <template v-if="cell.customFunction === undefined">
93
+ {{ getDeepObject(configData.arr[inputColumnsDefinitionIndex], cell.dataIndex) }}
94
+ </template>
95
+ <template v-else>
96
+ {{
97
+ deserializeFunctionAndRun(cell.customFunction, configData.arr[inputColumnsDefinitionIndex][cell.dataIndex], config)
98
+ }}
99
+ </template>
100
+ </template>
101
+ <template v-else-if="cell.type === 'input'">
102
+ <template v-if="cell.customFunction === undefined">
103
+ {{ getDeepObject(configData.arr[inputColumnsDefinitionIndex], cell.dataIndex) }}
104
+ </template>
105
+ <template v-else>
106
+ {{
107
+ deserializeFunctionAndRun(cell.customFunction, configData.arr[inputColumnsDefinitionIndex][cell.dataIndex], config)
108
+ }}
109
+ </template>
110
+ </template>
111
+ <template v-else-if="cell.type === 'inputs'">
112
+ <template v-if="cell.customFunction === undefined">
113
+ {{ getDeepObject(configData.arr[inputColumnsDefinitionIndex], cell.dataIndex) }}
114
+ </template>
115
+ <template v-else>
116
+ {{
117
+ deserializeFunctionAndRun(cell.customFunction, configData.arr[inputColumnsDefinitionIndex][cell.dataIndex], config)
118
+ }}
119
+ </template>
120
+ </template>
121
+ </td>
122
+ </template>
123
+ </template>
124
+ <!-- 不是动态行 -->
125
+ <template v-else-if="!inputColumns">
126
+ <td
127
+ v-for="(cell, cellIndex) in columns"
128
+ :key="cellIndex"
129
+ :class=" calcTDBorder(cell.noBoarder) "
130
+ :colspan="cell.colSpan ? cell.colSpan : undefined"
131
+ :style="cell.style ? cell.style : undefined"
132
+ :rowspan="cell.rowSpan ? cell.rowSpan : undefined">
133
+ <template v-if="cell.type === 'column'">
134
+ <template v-if="cell.customFunction">
135
+ {{ deserializeFunctionAndRun(cell.customFunction, configData[cell.dataIndex], config) }}
136
+ </template>
137
+ <template v-else>
138
+ {{ cell.text }}
139
+ </template>
140
+ </template>
141
+ <template v-else-if="cell.type === 'placeHolderColumn'">
142
+ <!-- 占位 -->
143
+ </template>
144
+ <template v-else-if="cell.type === 'value'">
145
+ {{ cell.value }}
146
+ </template>
147
+ <template v-else-if="cell.type === 'curDateInput'">
148
+ <a-button type="dashed" v-if="configData[cell.dataIndex]">
149
+ {{ configData[cell.dataIndex] }}
150
+ </a-button>
151
+ <a-button
152
+ v-if="!configData[cell.dataIndex]"
153
+ type="primary"
154
+ @click="getNowDate(cell.dataIndex)"
155
+ >{{ cell.text || '确认' }}
156
+ </a-button>
157
+ </template>
158
+ <template v-else-if="cell.type === 'input'">
159
+ <template v-if="cell.inputReadOnly === true">
160
+ <template v-if="cell.dataIndex.indexOf('@@@') !== -1">
161
+ <a-input
162
+ @change="handleInputDeepChange($event, cell.dataIndex)"
163
+ v-model="config.tempData[cell.dataIndex]"
164
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"
165
+ :disabled="true"/>
166
+ </template>
167
+ <template v-else>
168
+ <a-input
169
+ v-model="configData[cell.dataIndex]"
170
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"
171
+ :disabled="true"/>
172
+ </template>
173
+ </template>
174
+ <template v-else>
175
+ <template v-if="cell.dataIndex.indexOf('@@@') !== -1">
176
+ <a-input
177
+ @change="handleInputDeepChange($event, cell.dataIndex)"
178
+ v-model="config.tempData[cell.dataIndex]"
179
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
180
+ </template>
181
+ <template v-else>
182
+ <a-input
183
+ v-model="configData[cell.dataIndex]"
184
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
185
+ </template>
186
+ </template>
187
+ </template>
188
+ <template v-else-if="cell.type === 'inputs'">
189
+ <template v-if="cell.inputReadOnly === true">
190
+ <div class="inputsDiv">
191
+ <div class="inputsDivItem" v-for="(num, index) of calcFormatInputNum(cell.format)" :key="index">
192
+ <span class="inputsDivItemLabel">{{ displayFormatStartText(cell.format) }}</span>
193
+ <template v-if="cell.dataIndex.indexOf('@@@') !== -1">
194
+ <a-input
195
+ @change="handleInputDeepChange($event, cell.dataIndex)"
196
+ v-model="config.tempData[cell.dataIndex][index]"
197
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"
198
+ :disabled="true"/>
199
+ </template>
200
+ <template v-else>
201
+ <a-input
202
+ v-model="configData[cell.dataIndex][index]"
203
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"
204
+ :disabled="true"/>
205
+ </template>
206
+ <span class="inputsDivItemLabel">{{ displayFormatText(cell.format, index) }}</span>
207
+ </div>
208
+ </div>
209
+ </template>
210
+ <template v-else>
211
+ <div class="inputsDiv">
212
+ <div class="inputsDivItem" v-for="(num, index) of calcFormatInputNum(cell.format)" :key="index">
213
+ <span class="inputsDivItemLabel">{{ displayFormatStartText(cell.format) }}</span>
214
+ <template v-if="cell.dataIndex.indexOf('@@@') !== -1">
215
+ <a-input
216
+ @change="handleInputDeepChange($event, cell.dataIndex)"
217
+ v-model="config.tempData[cell.dataIndex][index]"
218
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
219
+ </template>
220
+ <template v-else>
221
+ <a-input
222
+ v-model="configData[cell.dataIndex][index]"
223
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
224
+ </template>
225
+ <span class="inputsDivItemLabel">{{ displayFormatText(cell.format, index) }}</span>
226
+ </div>
227
+ </div>
228
+ </template>
229
+ </template>
230
+ <template v-else-if="cell.type === 'list'">
231
+ <template v-if="cell.listType === 'input'">
232
+ <a-input
233
+ v-model="configData[cell.dataIndex][listIndex]"
234
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
235
+ </template>
236
+ <template v-else-if="cell.listType === 'value'">
237
+ {{ cell.content[listIndex] }}
238
+ </template>
239
+ </template>
240
+ <template v-else-if="cell.type === 'images'">
241
+ <div>
242
+ <upload
243
+ :model="{type: 'image', accept: ['*'], resUploadStock: 1, pathKey: 'cs', resUploadMode: 'oss'}"
244
+ service-name="af-system"
245
+ :images="configData.images[cell.dataIndex]"
246
+ :outer-container-index="cell.dataIndex"
247
+ @setFiles="setImages"
248
+ :upload-style="'simple'"
249
+ />
250
+ </div>
251
+ </template>
252
+ </td>
253
+ </template>
254
+ <!-- 动态行插入按钮 -->
255
+ <template v-else-if="inputColumnsButton">
256
+ <td :colspan="maxColSpan" :class="calcTDBorder()">
257
+ <a-button-group>
258
+ <a-button @click="addData(columns[0].dataIndex, columns)">
259
+ <a-icon type="plus"/>
260
+ </a-button>
261
+ <a-button @click="removeData(columns[0].dataIndex)">
262
+ <a-icon type="minus"/>
263
+ </a-button>
264
+ </a-button-group>
265
+ </td>
266
+ </template>
267
+ <!-- 其他行 -->
268
+ <template v-else>
269
+ <td
270
+ v-for="(cell, cellIndex) in columns"
271
+ :key="cellIndex"
272
+ :class=" calcTDBorder(cell.noBoarder) "
273
+ :colspan="cell.colSpan ? cell.colSpan : undefined"
274
+ :style="cell.style ? cell.style : undefined"
275
+ :rowspan="cell.rowSpan ? cell.rowSpan : undefined">
276
+ <template v-if="cell.type === 'column'">
277
+ {{ cell.text }}
278
+ </template>
279
+ <template v-else-if="cell.type === 'value'">
280
+ {{ cell.value }}
281
+ </template>
282
+ <template v-else-if="cell.type === 'curDateInput'">
283
+ <a-button type="dashed" v-if="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]">
284
+ {{ configData.arr[inputColumnsDefinitionIndex][cell.dataIndex] }}
285
+ </a-button>
286
+ <a-button
287
+ v-if="!configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
288
+ type="primary"
289
+ @click="getNowDate(inputColumnsDefinitionIndex,cell.dataIndex)"
290
+ >{{ cell.text || '确认' }}
291
+ </a-button>
292
+ </template>
293
+ <template v-else-if="cell.type === 'increment'">
294
+ {{ configData.arr[inputColumnsDefinitionIndex][cell.dataIndex] }}
295
+ </template>
296
+ <template v-else-if="cell.type === 'input'">
297
+ <template v-if="cell.inputReadOnly === true">
298
+ <a-input
299
+ v-model="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
300
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"
301
+ :disabled="true"/>
302
+ </template>
303
+ <template v-else>
304
+ <a-input
305
+ v-model="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
306
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
307
+ </template>
308
+ </template>
309
+ <template v-else-if="cell.type === 'inputs'">
310
+ <template v-if="cell.inputReadOnly === true">
311
+ <a-input
312
+ v-model="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
313
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"
314
+ :disabled="true"/>
315
+ </template>
316
+ <template v-else>
317
+ <a-input
318
+ v-model="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
319
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
320
+ </template>
321
+ </template>
322
+ </td>
323
+ </template>
324
+ </tr>
325
+ </template>
326
+
327
+ <script>
328
+ import Upload from '@vue2-client/base-client/components/common/Upload'
329
+ import { formatDate } from '@vue2-client/utils/util'
330
+
331
+ export default {
332
+ name: 'XReportTrGroup',
333
+ components: {
334
+ Upload
335
+ },
336
+ props: {
337
+ // 每一行的配置
338
+ columns: {
339
+ type: Array,
340
+ required: true
341
+ },
342
+ config: {
343
+ type: Object,
344
+ default: function () {
345
+ return {}
346
+ }
347
+ },
348
+ // 原始配置
349
+ configData: {
350
+ type: Object,
351
+ required: true
352
+ },
353
+ // 是否为动态行
354
+ inputColumns: {
355
+ type: Boolean,
356
+ default: false
357
+ },
358
+ // 是否为动态行按钮
359
+ inputColumnsButton: {
360
+ type: Boolean,
361
+ default: false
362
+ },
363
+ // 动态行的Index
364
+ inputColumnsDefinitionIndex: {
365
+ type: Number,
366
+ default: undefined
367
+ },
368
+ // 是否为展示行
369
+ display: {
370
+ type: Boolean,
371
+ default: false
372
+ },
373
+ // listIndex
374
+ listIndex: {
375
+ type: Number,
376
+ default: undefined
377
+ },
378
+ noTopBorder: {
379
+ type: Boolean,
380
+ default: false
381
+ }
382
+ },
383
+ data () {
384
+ return {
385
+ maxColSpan: 12
386
+ // tableConfig: {}
387
+ }
388
+ },
389
+ methods: {
390
+ handleInputDeepChange () {
391
+ this.$forceUpdate()
392
+ },
393
+ getDeepObject (obj, strPath) {
394
+ const arr = strPath.split('@@@')
395
+ let result = obj[arr[0]]
396
+ arr.shift()
397
+ try {
398
+ while (arr.length > 0) {
399
+ result = result[arr[0]]
400
+ arr.shift()
401
+ }
402
+ } catch (e) {
403
+ result = undefined
404
+ }
405
+ return result
406
+ },
407
+ getNowDate (index1, index2) {
408
+ if (index2) {
409
+ // @click="getNowDate(configData.arr[inputColumnsDefinitionIndex][cell.dataIndex])"
410
+ this.configData.arr[index1][index2] = formatDate('now')
411
+ } else {
412
+ this.configData[index1] = formatDate('now')
413
+ }
414
+ this.configData = Object.assign({}, this.configData)
415
+ },
416
+ deserializeFunctionAndRun (functionStr, value) {
417
+ // eslint-disable-next-line no-eval
418
+ const fun = eval('(' + functionStr + ')')
419
+ return fun(value, this.config)
420
+ },
421
+ setImages (imageIds, dataIndex) {
422
+ this.configData.images[dataIndex] = imageIds
423
+ },
424
+ removeData (index) {
425
+ if (this.configData[index].length === 0) {
426
+ this.$message.warn('已经没有更多了')
427
+ return
428
+ }
429
+ this.configData[index].pop()
430
+ },
431
+ // 添加一行
432
+ addData (index, row) {
433
+ // 获取定义
434
+ const defs = row[0].definition
435
+
436
+ // 获取外层对象名
437
+ const dataName = row[0].dataIndex
438
+ const temp = {}
439
+
440
+ defs.forEach(def => {
441
+ // 找到数组中最后一个数据的值
442
+ let lastDataNo = 0
443
+ if (this.configData[dataName][this.configData[dataName].length - 1]) {
444
+ lastDataNo = this.configData[dataName][this.configData[dataName].length - 1][def.dataIndex]
445
+ }
446
+
447
+ // 如果没有值,检查是否声明了初始值
448
+ if (lastDataNo === 0 && def.initialValue) {
449
+ lastDataNo = def.initialValue
450
+ }
451
+
452
+ // 检查是否有步长
453
+ let step = 1
454
+ if (def.step) {
455
+ step = def.step
456
+ }
457
+
458
+ // 如果单元格类型为increment,则进行自增
459
+ if (def.type === 'increment') {
460
+ temp[def.dataIndex] = lastDataNo + step
461
+ }
462
+ })
463
+ this.configData[index].push(temp)
464
+ },
465
+ // 根据format计算需要多少个输入框
466
+ calcFormatInputNum (formatStr) {
467
+ let count = 0
468
+ for (let i = 0; i < formatStr.length; i++) {
469
+ if (formatStr[i] === '{') {
470
+ count++
471
+ }
472
+ }
473
+ return count
474
+ },
475
+ // 根据format计算输入框之后的文字显示
476
+ displayFormatText (formatStr, num) {
477
+ let start = 0
478
+ let count = 0
479
+ num++
480
+ for (let i = 0; i < formatStr.length; i++) {
481
+ if (formatStr[i] === '}') {
482
+ start = i
483
+ count++
484
+ }
485
+ if (count === num) {
486
+ for (let j = start + 1; j < formatStr.length; j++) {
487
+ if (formatStr[j] === '{') {
488
+ return formatStr.slice(start + 1, j)
489
+ }
490
+ if (j === formatStr.length - 1 && formatStr[j] !== '}') {
491
+ return formatStr[j]
492
+ }
493
+ }
494
+ }
495
+ }
496
+ },
497
+ calcTDBorder (cellNoBorder = false) {
498
+ if (cellNoBorder) {
499
+ return 'tdNoBorder'
500
+ } else {
501
+ if (this.noTopBorder) {
502
+ return 'tdWithNoTopBorder'
503
+ } else {
504
+ return 'tdWithBorder'
505
+ }
506
+ }
507
+ },
508
+ // 根据format计算输入框之前的文字显示
509
+ displayFormatStartText (formatStr) {
510
+ let count = 0
511
+ for (let i = 0; i < formatStr.length; i++) {
512
+ if (formatStr[i] === '{') {
513
+ break
514
+ } else {
515
+ count++
516
+ }
517
+ }
518
+ return formatStr.slice(0, count)
519
+ },
520
+ // 拼接被自动拆分的单元格内容
521
+ showSubRowValue (cell) {
522
+ const dataName = cell.dataIndex
523
+ const formatArr = []
524
+ const dataArr = []
525
+
526
+ // 从config中取出所有数据,根据dataIndex的开头内容进行拼接
527
+ this.config.columns.forEach(row => row.forEach(cell => {
528
+ if (cell.dataIndex && cell.dataIndex.startsWith(dataName)) {
529
+ formatArr.push(cell.format)
530
+ dataArr.push(this.configData[cell.dataIndex])
531
+ }
532
+ }))
533
+
534
+ const text = []
535
+ const data = []
536
+
537
+ formatArr.forEach(word => {
538
+ const temp = word.split('{}')
539
+ temp.forEach(char => {
540
+ if (char !== '') {
541
+ text.push(char)
542
+ }
543
+ })
544
+ })
545
+
546
+ dataArr.forEach(item => {
547
+ item.forEach(num => {
548
+ data.push(num)
549
+ })
550
+ })
551
+
552
+ let result = ''
553
+ for (let i = 0; i < data.length; i++) {
554
+ result += data[i]
555
+ result += text[i]
556
+ }
557
+
558
+ return result
559
+ },
560
+ },
561
+ beforeMount () {
562
+ }
563
+ }
564
+
565
+ </script>
566
+
567
+ <style scoped lang="less">
568
+ .inputsDiv {
569
+ display: flex;
570
+ justify-content: space-between;
571
+
572
+ .inputsDivItem {
573
+ display: flex;
574
+ align-items: center;
575
+ padding: 0 4px;
576
+ white-space: nowrap;
577
+
578
+ .inputsDivItemLabel {
579
+ padding: 0 4px;
580
+ }
581
+ }
582
+ }
583
+
584
+ .tdNoBorder {
585
+ border-left: 1px solid #000;
586
+ border-right: 1px solid #000;
587
+ padding: 8px;
588
+ }
589
+
590
+ .tdWithBorder {
591
+ border: 1px solid #000;
592
+ padding: 8px;
593
+ }
594
+
595
+ .tdWithNoTopBorder {
596
+ border-top-style: none;
597
+ border-left: 1px solid #000;
598
+ border-right: 1px solid #000;
599
+ border-bottom: 1px solid #000;
600
+ padding: 8px;
601
+ }
602
+ </style>