vue2-client 1.8.259 → 1.8.261

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 (210) 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/docs/lowcode.md +188 -188
  8. package/docs/lowcodeForDeveloper.md +200 -192
  9. package/index.js +31 -31
  10. package/jest-transform-stub.js +8 -8
  11. package/jest.config.js +21 -21
  12. package/jest.setup.js +7 -7
  13. package/package.json +95 -95
  14. package/public/index.html +27 -27
  15. package/src/App.vue +188 -188
  16. package/src/ReportView.js +19 -19
  17. package/src/assets/img/querySlotDemo.svg +15 -15
  18. package/src/assets/svg/badtwo.svg +1 -1
  19. package/src/assets/svg/goodtwo.svg +1 -1
  20. package/src/base-client/components/common/AMisRender/index.js +3 -3
  21. package/src/base-client/components/common/AMisRender/index.vue +263 -263
  22. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +413 -413
  23. package/src/base-client/components/common/AddressSearchCombobox/demo.vue +36 -36
  24. package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +120 -120
  25. package/src/base-client/components/common/CitySelect/CitySelect.vue +348 -348
  26. package/src/base-client/components/common/CitySelect/index.js +3 -3
  27. package/src/base-client/components/common/CitySelect/index.md +109 -109
  28. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +669 -669
  29. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +1014 -1014
  30. package/src/base-client/components/common/CreateQuery/index.js +3 -3
  31. package/src/base-client/components/common/CreateQuery/index.md +42 -42
  32. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +452 -452
  33. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +511 -511
  34. package/src/base-client/components/common/CreateSimpleFormQuery/index.js +3 -3
  35. package/src/base-client/components/common/CreateSimpleFormQuery/index.md +42 -42
  36. package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +149 -149
  37. package/src/base-client/components/common/FormGroupEdit/index.js +3 -3
  38. package/src/base-client/components/common/FormGroupEdit/index.md +43 -43
  39. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +166 -166
  40. package/src/base-client/components/common/FormGroupQuery/index.js +3 -3
  41. package/src/base-client/components/common/FormGroupQuery/index.md +43 -43
  42. package/src/base-client/components/common/JSONToTree/jsontotree.vue +271 -271
  43. package/src/base-client/components/common/LowCodeComponent/LowCodePageOrganization.vue +394 -355
  44. package/src/base-client/components/common/LowCodePageRender/LowCodePageRender.vue +29 -29
  45. package/src/base-client/components/common/LowCodePageRender/editorPageRender.vue +533 -467
  46. package/src/base-client/components/common/LowCodePageRender/index.js +3 -3
  47. package/src/base-client/components/common/PersonSetting/PersonSetting.vue +208 -208
  48. package/src/base-client/components/common/PersonSetting/index.js +3 -3
  49. package/src/base-client/components/common/Tree/Tree.vue +149 -149
  50. package/src/base-client/components/common/Tree/index.js +2 -2
  51. package/src/base-client/components/common/Upload/Upload.vue +197 -197
  52. package/src/base-client/components/common/Upload/index.js +3 -3
  53. package/src/base-client/components/common/XAddForm/XAddForm.vue +98 -98
  54. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +732 -732
  55. package/src/base-client/components/common/XAddNativeForm/index.md +146 -146
  56. package/src/base-client/components/common/XAddNativeForm/lowcodeEditorRegister.js +16 -12
  57. package/src/base-client/components/common/XAddNativeFormOA/XAddNativeFormOA.vue +303 -303
  58. package/src/base-client/components/common/XAddNativeFormOA/index.js +3 -3
  59. package/src/base-client/components/common/XAddNativeFormOA/index.md +146 -146
  60. package/src/base-client/components/common/XBadge/XBadge.vue +78 -78
  61. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  62. package/src/base-client/components/common/XDataDrawer/XDataDrawer.vue +180 -180
  63. package/src/base-client/components/common/XDataDrawer/index.js +3 -3
  64. package/src/base-client/components/common/XDataDrawer/index.md +41 -41
  65. package/src/base-client/components/common/XDescriptions/XDescriptions.vue +167 -167
  66. package/src/base-client/components/common/XDescriptions/XDescriptionsGroup.vue +299 -299
  67. package/src/base-client/components/common/XDescriptions/demo.vue +50 -50
  68. package/src/base-client/components/common/XDescriptions/index.js +3 -3
  69. package/src/base-client/components/common/XDescriptions/index.md +83 -83
  70. package/src/base-client/components/common/XDescriptions/lowcodeEditorRegister.js +15 -5
  71. package/src/base-client/components/common/XDetailsView/XDetailsView.vue +214 -214
  72. package/src/base-client/components/common/XDetailsView/index.js +3 -3
  73. package/src/base-client/components/common/XForm/XForm.vue +281 -281
  74. package/src/base-client/components/common/XForm/XFormItem.vue +807 -807
  75. package/src/base-client/components/common/XForm/XTreeSelect.vue +206 -206
  76. package/src/base-client/components/common/XForm/index.md +178 -178
  77. package/src/base-client/components/common/XFormCol/XFormCol.vue +36 -36
  78. package/src/base-client/components/common/XFormGroup/XFormGroup.vue +241 -241
  79. package/src/base-client/components/common/XFormGroup/demo.vue +40 -40
  80. package/src/base-client/components/common/XFormGroup/index.js +3 -3
  81. package/src/base-client/components/common/XFormGroup/index.md +38 -38
  82. package/src/base-client/components/common/XFormGroupDetails/XFormGroupDetails.vue +72 -72
  83. package/src/base-client/components/common/XFormGroupDetails/index.js +3 -3
  84. package/src/base-client/components/common/XFormTable/XFormTable.vue +519 -519
  85. package/src/base-client/components/common/XFormTable/index.md +98 -98
  86. package/src/base-client/components/common/XFormTable/lowcodeEditorRegister.js +16 -12
  87. package/src/base-client/components/common/XImportExcel/XImportExcel.vue +147 -147
  88. package/src/base-client/components/common/XReport/XReport.vue +843 -843
  89. package/src/base-client/components/common/XReport/XReportDemo.vue +2233 -2233
  90. package/src/base-client/components/common/XReport/XReportDesign.vue +470 -470
  91. package/src/base-client/components/common/XReport/XReportJsonRender.vue +267 -267
  92. package/src/base-client/components/common/XReport/XReportTrGroup.vue +745 -742
  93. package/src/base-client/components/common/XReport/index.js +3 -3
  94. package/src/base-client/components/common/XReport/index.md +44 -44
  95. package/src/base-client/components/common/XReportSlot/XReportSlot.vue +110 -110
  96. package/src/base-client/components/common/XReportSlot/index.js +3 -3
  97. package/src/base-client/components/common/XStepView/XStepView.vue +252 -252
  98. package/src/base-client/components/common/XStepView/index.js +3 -3
  99. package/src/base-client/components/common/XStepView/index.md +31 -31
  100. package/src/base-client/components/common/XTable/XTable.vue +636 -636
  101. package/src/base-client/components/common/XTable/index.md +255 -255
  102. package/src/base-client/components/common/XTree/XTree.vue +318 -318
  103. package/src/base-client/components/common/XTree/index.js +3 -3
  104. package/src/base-client/components/common/XTree/index.md +36 -36
  105. package/src/base-client/components/common/XTreeOne/XTreeOne.vue +114 -114
  106. package/src/base-client/components/common/XTreeOne/lowcodeEditorRegister.js +11 -9
  107. package/src/base-client/components/index.js +51 -51
  108. package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +232 -232
  109. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
  110. package/src/base-client/plugins/AppData.js +115 -115
  111. package/src/base-client/plugins/Config.js +19 -19
  112. package/src/base-client/plugins/GetLoginInfoService.js +183 -183
  113. package/src/base-client/plugins/tabs-page-plugin.js +39 -39
  114. package/src/bootstrap.js +39 -39
  115. package/src/components/CodeMirror/inedx.vue +118 -118
  116. package/src/components/CodeMirror/setting.js +40 -40
  117. package/src/components/FilePreview/FilePreview.vue +166 -166
  118. package/src/components/NumberInfo/NumberInfo.vue +54 -54
  119. package/src/components/STable/index.js +323 -323
  120. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  121. package/src/components/checkbox/ImgCheckbox.vue +163 -163
  122. package/src/components/menu/SideMenu.vue +75 -75
  123. package/src/components/menu/menu.js +273 -273
  124. package/src/components/tool/AStepItem.vue +60 -60
  125. package/src/config/CreateQueryConfig.js +322 -322
  126. package/src/config/default/antd.config.js +89 -89
  127. package/src/config/default/setting.config.js +55 -55
  128. package/src/font-style/font.css +4 -4
  129. package/src/layouts/CommonLayout.vue +56 -56
  130. package/src/layouts/PageLayout.vue +151 -151
  131. package/src/layouts/SinglePageView.vue +138 -138
  132. package/src/layouts/header/AdminHeader.vue +132 -132
  133. package/src/layouts/header/HeaderNotice.vue +177 -177
  134. package/src/layouts/tabs/TabsHead.vue +189 -189
  135. package/src/layouts/tabs/TabsView.vue +387 -387
  136. package/src/lib.js +1 -1
  137. package/src/main.js +26 -26
  138. package/src/mock/extend/index.js +84 -84
  139. package/src/mock/goods/index.js +108 -108
  140. package/src/pages/AMisDemo/AMisDemo.vue +325 -325
  141. package/src/pages/AMisDemo/AMisDemo2.vue +74 -74
  142. package/src/pages/DynamicStatistics/ChartSelector.vue +331 -331
  143. package/src/pages/DynamicStatistics/DataTabs.vue +83 -83
  144. package/src/pages/DynamicStatistics/DynamicTable.vue +128 -128
  145. package/src/pages/DynamicStatistics/EvaluationArea.vue +69 -69
  146. package/src/pages/DynamicStatistics/FavoriteList.vue +51 -51
  147. package/src/pages/DynamicStatistics/QuestionHistoryAndFavorites.vue +591 -591
  148. package/src/pages/DynamicStatistics/SearchBar.vue +192 -192
  149. package/src/pages/DynamicStatistics/index.vue +282 -282
  150. package/src/pages/Example/index.vue +32 -32
  151. package/src/pages/NewDynamicStatistics/ChartSelector.vue +331 -331
  152. package/src/pages/NewDynamicStatistics/DataTabs.vue +122 -122
  153. package/src/pages/NewDynamicStatistics/DynamicTable.vue +128 -128
  154. package/src/pages/NewDynamicStatistics/EvaluationArea.vue +69 -69
  155. package/src/pages/NewDynamicStatistics/FavoriteList.vue +51 -51
  156. package/src/pages/NewDynamicStatistics/QuestionHistoryAndFavorites.vue +289 -289
  157. package/src/pages/NewDynamicStatistics/SearchBar.vue +193 -193
  158. package/src/pages/NewDynamicStatistics/index.vue +258 -258
  159. package/src/pages/ServiceReview/index.vue +284 -284
  160. package/src/pages/XReportView/index.vue +62 -62
  161. package/src/pages/login/Login.vue +378 -378
  162. package/src/pages/login/LoginV3.vue +389 -389
  163. package/src/pages/lowCode/lowCodeEditor.vue +1501 -1285
  164. package/src/pages/lowCode/lowCodeRender.vue +39 -39
  165. package/src/pages/resourceManage/orgListManage.vue +98 -98
  166. package/src/pages/system/dictionary/index.vue +44 -44
  167. package/src/pages/system/monitor/loginInfor/index.vue +37 -37
  168. package/src/pages/system/monitor/operLog/index.vue +37 -37
  169. package/src/pages/system/settings/modifyPassword.vue +117 -117
  170. package/src/pages/system/ticket/index.vue +480 -480
  171. package/src/pages/system/ticket/submitTicketSuccess.vue +484 -484
  172. package/src/router/async/config.async.js +33 -33
  173. package/src/router/async/router.map.js +107 -107
  174. package/src/router/guards.js +220 -220
  175. package/src/router/index.js +27 -27
  176. package/src/router.js +19 -19
  177. package/src/services/api/TicketDetailsViewApi.js +46 -46
  178. package/src/services/api/cas.js +79 -79
  179. package/src/services/api/common.js +284 -284
  180. package/src/services/api/entity.js +18 -18
  181. package/src/services/api/index.js +17 -17
  182. package/src/services/api/restTools.js +46 -46
  183. package/src/services/apiService.js +14 -14
  184. package/src/services/user.js +71 -71
  185. package/src/store/modules/setting.js +119 -119
  186. package/src/theme/default/style.less +57 -57
  187. package/src/theme/global.less +130 -130
  188. package/src/utils/authority-utils.js +85 -85
  189. package/src/utils/errorCode.js +6 -6
  190. package/src/utils/htmlToPDF.js +108 -108
  191. package/src/utils/htmlToPDFApi.js +5 -5
  192. package/src/utils/indexedDB.js +201 -201
  193. package/src/utils/login.js +144 -144
  194. package/src/utils/lowcode/lowcodeComponentMixin.js +112 -78
  195. package/src/utils/lowcode/lowcodeLog.js +29 -29
  196. package/src/utils/lowcode/lowcodeUtils.js +276 -129
  197. package/src/utils/lowcode/registerComponentForEditor.js +11 -11
  198. package/src/utils/lowcode/registerComponentForRender.js +11 -11
  199. package/src/utils/map-utils.js +47 -47
  200. package/src/utils/reg.js +19 -19
  201. package/src/utils/request.js +343 -343
  202. package/src/utils/routerUtil.js +435 -435
  203. package/src/utils/runEvalFunction.js +6 -6
  204. package/src/utils/util.js +241 -241
  205. package/src/utils/waterMark.js +31 -31
  206. package/test/Amis.spec.js +163 -163
  207. package/test/Tree.spec.js +167 -167
  208. package/test/myDialog.spec.js +46 -46
  209. package/vue.config.js +177 -177
  210. package//350/277/201/347/247/273/346/227/245/345/277/227.md +15 -15
@@ -1,742 +1,745 @@
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="determineCellStyle(cell)"
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
- <!-- 占位 -->
22
- <template v-else-if="cell.type === 'placeHolderColumn'">
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-if="getDeepObject(configData.images, cell.dataIndex) === undefined || getDeepObject(configData.images, cell.dataIndex).length === 0">
64
- <span>无</span>
65
- </template>
66
- <template v-else v-for="(img,imgIndex) in getDeepObject(configData.images, cell.dataIndex)">
67
- <span :key="imgIndex" style="margin-right: 5%">{{ img.name }}</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="determineCellStyle(cell)"
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="determineCellStyle(cell)"
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
- <template v-if="configData.images[cell.dataIndex]?.length > 0">
243
- <upload
244
- :model="uploadParams"
245
- service-name="af-system"
246
- :images="checkImg(cell.dataIndex, 'configData')"
247
- :outer-container-index="cell.dataIndex"
248
- @setFiles="(...args) => {setImages(args, 'configData')}"
249
- :upload-style="'simple'"
250
- />
251
- </template>
252
- <template v-else>
253
- <upload
254
- :model="uploadParams"
255
- service-name="af-system"
256
- :images="checkImg(cell.dataIndex, 'config')"
257
- :outer-container-index="cell.dataIndex"
258
- @setFiles="(...args) => {setImages(args, 'config', cell.dataIndex)}"
259
- :upload-style="'simple'"
260
- />
261
- </template>
262
- </div>
263
- </template>
264
- </td>
265
- </template>
266
- <!-- 动态行插入按钮 -->
267
- <template v-else-if="inputColumnsButton">
268
- <td :colspan="maxColSpan" :class="calcTDBorder()">
269
- <a-button-group>
270
- <a-button @click="addData(columns[0].dataIndex, columns)">
271
- <a-icon type="plus"/>
272
- </a-button>
273
- <a-button @click="removeData(columns[0].dataIndex)">
274
- <a-icon type="minus"/>
275
- </a-button>
276
- </a-button-group>
277
- </td>
278
- </template>
279
- <!-- 其他行 -->
280
- <template v-else>
281
- <td
282
- v-for="(cell, cellIndex) in columns"
283
- :key="cellIndex"
284
- :class=" calcTDBorder(cell.noBoarder) "
285
- :colspan="cell.colSpan ? cell.colSpan : undefined"
286
- :style="determineCellStyle(cell)"
287
- :rowspan="cell.rowSpan ? cell.rowSpan : undefined">
288
- <template v-if="cell.type === 'column'">
289
- {{ cell.text }}
290
- </template>
291
- <template v-else-if="cell.type === 'value'">
292
- {{ cell.value }}
293
- </template>
294
- <template v-else-if="cell.type === 'curDateInput'">
295
- <a-button type="dashed" v-if="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]">
296
- {{ configData.arr[inputColumnsDefinitionIndex][cell.dataIndex] }}
297
- </a-button>
298
- <a-button
299
- v-if="!configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
300
- type="primary"
301
- @click="getNowDate(inputColumnsDefinitionIndex,cell.dataIndex)"
302
- >{{ cell.text || '确认' }}
303
- </a-button>
304
- </template>
305
- <template v-else-if="cell.type === 'increment'">
306
- {{ configData.arr[inputColumnsDefinitionIndex][cell.dataIndex] }}
307
- </template>
308
- <template v-else-if="cell.type === 'input'">
309
- <template v-if="cell.inputReadOnly === true">
310
- <a-input
311
- v-model="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
312
- :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"
313
- :disabled="true"/>
314
- </template>
315
- <template v-else>
316
- <a-input
317
- v-model="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
318
- :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
319
- </template>
320
- </template>
321
- <template v-else-if="cell.type === 'inputs'">
322
- <template v-if="cell.inputReadOnly === true">
323
- <a-input
324
- v-model="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
325
- :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"
326
- :disabled="true"/>
327
- </template>
328
- <template v-else>
329
- <a-input
330
- v-model="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
331
- :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
332
- </template>
333
- </template>
334
- </td>
335
- </template>
336
- </tr>
337
- </template>
338
-
339
- <script>
340
- import Upload from '@vue2-client/base-client/components/common/Upload'
341
- import { formatDate } from '@vue2-client/utils/util'
342
-
343
- export default {
344
- name: 'XReportTrGroup',
345
- components: {
346
- Upload
347
- },
348
- props: {
349
- // 每一行的配置
350
- columns: {
351
- type: Array,
352
- required: true
353
- },
354
- config: {
355
- type: Object,
356
- default: function () {
357
- return {}
358
- }
359
- },
360
- // 原始配置
361
- configData: {
362
- type: Object,
363
- required: true
364
- },
365
- // 是否为动态行
366
- inputColumns: {
367
- type: Boolean,
368
- default: false
369
- },
370
- // 是否为动态行按钮
371
- inputColumnsButton: {
372
- type: Boolean,
373
- default: false
374
- },
375
- // 动态行的Index
376
- inputColumnsDefinitionIndex: {
377
- type: Number,
378
- default: undefined
379
- },
380
- // 是否为展示行
381
- display: {
382
- type: Boolean,
383
- default: false
384
- },
385
- // list类型的下标,用于遍历列表时,获取对应的数据
386
- listIndex: {
387
- type: Number,
388
- default: undefined
389
- },
390
- // 表格没有上边框
391
- noTopBorder: {
392
- type: Boolean,
393
- default: false
394
- },
395
- // 图片是否使用OSS来保存
396
- useOssForImg: {
397
- type: Boolean,
398
- default: true
399
- }
400
- },
401
- data () {
402
- return {
403
- maxColSpan: 12,
404
- uploadParams: {
405
- type: 'image',
406
- accept: ['*'],
407
- resUploadStock: 1,
408
- pathKey: 'cs'
409
- }
410
- // tableConfig: {}
411
- }
412
- },
413
- methods: {
414
- updateImg (data) {
415
- this.$emit('updateImg', data)
416
- },
417
- checkImg (index, type) {
418
- let target
419
- if (type === 'configData') {
420
- target = this.configData.images[index]
421
- } else {
422
- target = this.config.tempData[index]
423
- }
424
- target.forEach(obj => {
425
- if (obj.uid === undefined) {
426
- obj.uid = obj.id.toString()
427
- }
428
- if (obj.url === undefined) {
429
- if (obj.path) {
430
- obj.url = obj.path
431
- }
432
- }
433
- if (obj.name === undefined) {
434
- const withOutEndFix = obj.url.split('.')[0]
435
- const temp = withOutEndFix.split('/')
436
- obj.name = temp[temp.length - 1]
437
- }
438
- })
439
- return target
440
- },
441
- // 判断单元格样式
442
- determineCellStyle (cell, color = '#000', borderWidth = '1px') {
443
- // 如果声明了borderColor
444
- if (this.config.style.borderColor) {
445
- color = this.config.style.borderColor
446
- }
447
- // 如果声明了borderWidth
448
- if (this.config.style.borderWidth) {
449
- borderWidth = this.config.style.borderWidth
450
- }
451
- // 普通带边框单元格
452
- const withBorder = {
453
- border: borderWidth + ' solid ' + color,
454
- padding: '8px'
455
- }
456
- // 只有左右边框的单元格
457
- const noBorder = {
458
- borderLeft: borderWidth + ' solid ' + color,
459
- borderRight: borderWidth + ' solid ' + color,
460
- padding: '8px'
461
- }
462
- // 只没有上边框的单元格
463
- const NoTopBorder = {
464
- borderTopStyle: 'none',
465
- borderLeft: borderWidth + ' solid ' + color,
466
- borderRight: borderWidth + ' solid ' + color,
467
- borderBottom: borderWidth + ' solid ' + color,
468
- padding: '8px'
469
- }
470
- let result = {}
471
- // 如果表格也声明了样式,用表格样式将样式覆盖
472
- if (cell.style) {
473
- if (cell.noBorder) {
474
- result = { ...noBorder, ...cell.style }
475
- } else {
476
- if (this.noTopBorder) {
477
- result = { ...NoTopBorder, ...cell.style }
478
- } else {
479
- result = { ...withBorder, ...cell.style }
480
- }
481
- }
482
- return result
483
- }
484
- // 如果表头声明了样式,则用其将基础样式覆盖
485
- if (cell.type === 'column') {
486
- if (this.config.labelStyle !== undefined) {
487
- if (cell.noBorder) {
488
- result = { ...noBorder, ...this.config.labelStyle }
489
- } else {
490
- if (this.noTopBorder) {
491
- result = { ...NoTopBorder, ...this.config.labelStyle }
492
- } else {
493
- result = { ...withBorder, ...this.config.labelStyle }
494
- }
495
- }
496
- return result
497
- }
498
- }
499
- if (cell.noBorder) {
500
- result = { ...noBorder }
501
- } else {
502
- if (this.noTopBorder) {
503
- result = { ...NoTopBorder }
504
- } else {
505
- result = { ...withBorder }
506
- }
507
- }
508
- return result
509
- },
510
- // 表格中数据key含有@@@,需要手动触发更新
511
- handleInputDeepChange () {
512
- this.$forceUpdate()
513
- },
514
- // 路径中含有@@@的key,将其解析,并返回其数据
515
- getDeepObject (obj, strPath) {
516
- const arr = strPath.split('@@@')
517
- let result = obj[arr[0]]
518
- arr.shift()
519
- try {
520
- while (arr.length > 0) {
521
- result = result[arr[0]]
522
- arr.shift()
523
- }
524
- } catch (e) {
525
- result = undefined
526
- }
527
- return result
528
- },
529
- // 获取当前日期
530
- getNowDate (index1, index2) {
531
- if (index2) {
532
- // @click="getNowDate(configData.arr[inputColumnsDefinitionIndex][cell.dataIndex])"
533
- this.configData.arr[index1][index2] = formatDate('now')
534
- } else {
535
- this.configData[index1] = formatDate('now')
536
- }
537
- this.configData = Object.assign({}, this.configData)
538
- },
539
- // 反序列化函数并执行
540
- deserializeFunctionAndRun (functionStr, value) {
541
- // eslint-disable-next-line no-eval
542
- const fun = eval('(' + functionStr + ')')
543
- return fun(value, this.config)
544
- },
545
- // 基础上传组件,图片改动后触发
546
- setImages (args, type, index = undefined) {
547
- // 如果基础上传组件在初始化完成后,就调用emit了setImage,此时图片并没有变化,直接返回
548
- if (args[2] === 'created') {
549
- return
550
- }
551
- if (type === 'configData') {
552
- this.configData.images[args[1]] = args[0]
553
- } else {
554
- this.config.tempData[args[1]] = args[0]
555
- if (index) {
556
- this.$emit('updateImg', this.config.tempData[index])
557
- }
558
- }
559
- },
560
- // 动态行删除
561
- removeData (index) {
562
- if (this.configData[index].length === 0) {
563
- this.$message.warn('已经没有更多了')
564
- return
565
- }
566
- this.configData[index].pop()
567
- },
568
- // 添加一行
569
- addData (index, row) {
570
- // 获取定义
571
- const defs = row[0].definition
572
-
573
- // 获取外层对象名
574
- const dataName = row[0].dataIndex
575
- const temp = {}
576
-
577
- defs.forEach(def => {
578
- // 找到数组中最后一个数据的值
579
- let lastDataNo = 0
580
- if (this.configData[dataName][this.configData[dataName].length - 1]) {
581
- lastDataNo = this.configData[dataName][this.configData[dataName].length - 1][def.dataIndex]
582
- }
583
-
584
- // 如果没有值,检查是否声明了初始值
585
- if (lastDataNo === 0 && def.initialValue) {
586
- lastDataNo = def.initialValue
587
- }
588
-
589
- // 检查是否有步长
590
- let step = 1
591
- if (def.step) {
592
- step = def.step
593
- }
594
-
595
- // 如果单元格类型为increment,则进行自增
596
- if (def.type === 'increment') {
597
- temp[def.dataIndex] = lastDataNo + step
598
- }
599
- })
600
- this.configData[index].push(temp)
601
- },
602
- // 根据format计算需要多少个输入框
603
- calcFormatInputNum (formatStr) {
604
- let count = 0
605
- for (let i = 0; i < formatStr.length; i++) {
606
- if (formatStr[i] === '{') {
607
- count++
608
- }
609
- }
610
- return count
611
- },
612
- // 根据format计算输入框之后的文字显示
613
- displayFormatText (formatStr, num) {
614
- let start = 0
615
- let count = 0
616
- num++
617
- for (let i = 0; i < formatStr.length; i++) {
618
- if (formatStr[i] === '}') {
619
- start = i
620
- count++
621
- }
622
- if (count === num) {
623
- for (let j = start + 1; j < formatStr.length; j++) {
624
- if (formatStr[j] === '{') {
625
- return formatStr.slice(start + 1, j)
626
- }
627
- if (j === formatStr.length - 1 && formatStr[j] !== '}') {
628
- return formatStr[j]
629
- }
630
- }
631
- }
632
- }
633
- },
634
- calcTDBorder (cellNoBorder = false) {
635
- if (cellNoBorder) {
636
- return 'tdNoBorder'
637
- } else {
638
- if (this.noTopBorder) {
639
- return 'tdWithNoTopBorder'
640
- } else {
641
- return 'tdWithBorder'
642
- }
643
- }
644
- },
645
- // 根据format计算输入框之前的文字显示
646
- displayFormatStartText (formatStr) {
647
- let count = 0
648
- for (let i = 0; i < formatStr.length; i++) {
649
- if (formatStr[i] === '{') {
650
- break
651
- } else {
652
- count++
653
- }
654
- }
655
- return formatStr.slice(0, count)
656
- },
657
- // 拼接被自动拆分的单元格内容
658
- showSubRowValue (cell) {
659
- const dataName = cell.dataIndex
660
- const formatArr = []
661
- const dataArr = []
662
-
663
- // 从config中取出所有数据,根据dataIndex的开头内容进行拼接
664
- this.config.columns.forEach(row => row.forEach(cell => {
665
- if (cell.dataIndex && cell.dataIndex.startsWith(dataName)) {
666
- formatArr.push(cell.format)
667
- dataArr.push(this.configData[cell.dataIndex])
668
- }
669
- }))
670
-
671
- const text = []
672
- const data = []
673
-
674
- formatArr.forEach(word => {
675
- const temp = word.split('{}')
676
- temp.forEach(char => {
677
- if (char !== '') {
678
- text.push(char)
679
- }
680
- })
681
- })
682
-
683
- dataArr.forEach(item => {
684
- item.forEach(num => {
685
- data.push(num)
686
- })
687
- })
688
-
689
- let result = ''
690
- for (let i = 0; i < data.length; i++) {
691
- result += data[i]
692
- result += text[i]
693
- }
694
-
695
- return result
696
- },
697
- },
698
- beforeMount () {
699
- if (this.useOssForImg) {
700
- this.uploadParams.resUploadMode = 'oss'
701
- }
702
- }
703
- }
704
-
705
- </script>
706
-
707
- <style scoped lang="less">
708
- .inputsDiv {
709
- display: flex;
710
- justify-content: space-between;
711
-
712
- .inputsDivItem {
713
- display: flex;
714
- align-items: center;
715
- padding: 0 4px;
716
- white-space: nowrap;
717
-
718
- .inputsDivItemLabel {
719
- padding: 0 4px;
720
- }
721
- }
722
- }
723
-
724
- .tdNoBorder {
725
- border-left: 1px solid #000;
726
- border-right: 1px solid #000;
727
- padding: 8px;
728
- }
729
-
730
- .tdWithBorder {
731
- border: 1px solid #000;
732
- padding: 8px;
733
- }
734
-
735
- .tdWithNoTopBorder {
736
- border-top-style: none;
737
- border-left: 1px solid #000;
738
- border-right: 1px solid #000;
739
- border-bottom: 1px solid #000;
740
- padding: 8px;
741
- }
742
- </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="determineCellStyle(cell)"
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
+ <!-- 占位 -->
22
+ <template v-else-if="cell.type === 'placeHolderColumn'">
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-if="getDeepObject(configData.images, cell.dataIndex) === undefined || getDeepObject(configData.images, cell.dataIndex).length === 0">
64
+ <span>无</span>
65
+ </template>
66
+ <template v-else v-for="(img,imgIndex) in getDeepObject(configData.images, cell.dataIndex)">
67
+ <span :key="imgIndex" style="margin-right: 5%">{{ img.name }}</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="determineCellStyle(cell)"
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="determineCellStyle(cell)"
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
+ <template v-if="configData.images[cell.dataIndex]?.length > 0">
243
+ <upload
244
+ :model="uploadParams"
245
+ service-name="af-system"
246
+ :images="checkImg(cell.dataIndex, 'configData')"
247
+ :outer-container-index="cell.dataIndex"
248
+ @setFiles="(...args) => {setImages(args, 'configData')}"
249
+ :upload-style="'simple'"
250
+ />
251
+ </template>
252
+ <template v-else>
253
+ <upload
254
+ :model="uploadParams"
255
+ service-name="af-system"
256
+ :images="checkImg(cell.dataIndex, 'config')"
257
+ :outer-container-index="cell.dataIndex"
258
+ @setFiles="(...args) => {setImages(args, 'config', cell.dataIndex)}"
259
+ :upload-style="'simple'"
260
+ />
261
+ </template>
262
+ </div>
263
+ </template>
264
+ </td>
265
+ </template>
266
+ <!-- 动态行插入按钮 -->
267
+ <template v-else-if="inputColumnsButton">
268
+ <td :colspan="maxColSpan" :class="calcTDBorder()">
269
+ <a-button-group>
270
+ <a-button @click="addData(columns[0].dataIndex, columns)">
271
+ <a-icon type="plus"/>
272
+ </a-button>
273
+ <a-button @click="removeData(columns[0].dataIndex)">
274
+ <a-icon type="minus"/>
275
+ </a-button>
276
+ </a-button-group>
277
+ </td>
278
+ </template>
279
+ <!-- 其他行 -->
280
+ <template v-else>
281
+ <td
282
+ v-for="(cell, cellIndex) in columns"
283
+ :key="cellIndex"
284
+ :class=" calcTDBorder(cell.noBoarder) "
285
+ :colspan="cell.colSpan ? cell.colSpan : undefined"
286
+ :style="determineCellStyle(cell)"
287
+ :rowspan="cell.rowSpan ? cell.rowSpan : undefined">
288
+ <template v-if="cell.type === 'column'">
289
+ {{ cell.text }}
290
+ </template>
291
+ <template v-else-if="cell.type === 'value'">
292
+ {{ cell.value }}
293
+ </template>
294
+ <template v-else-if="cell.type === 'curDateInput'">
295
+ <a-button type="dashed" v-if="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]">
296
+ {{ configData.arr[inputColumnsDefinitionIndex][cell.dataIndex] }}
297
+ </a-button>
298
+ <a-button
299
+ v-if="!configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
300
+ type="primary"
301
+ @click="getNowDate(inputColumnsDefinitionIndex,cell.dataIndex)"
302
+ >{{ cell.text || '确认' }}
303
+ </a-button>
304
+ </template>
305
+ <template v-else-if="cell.type === 'increment'">
306
+ {{ configData.arr[inputColumnsDefinitionIndex][cell.dataIndex] }}
307
+ </template>
308
+ <template v-else-if="cell.type === 'input'">
309
+ <template v-if="cell.inputReadOnly === true">
310
+ <a-input
311
+ v-model="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
312
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"
313
+ :disabled="true"/>
314
+ </template>
315
+ <template v-else>
316
+ <a-input
317
+ v-model="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
318
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
319
+ </template>
320
+ </template>
321
+ <template v-else-if="cell.type === 'inputs'">
322
+ <template v-if="cell.inputReadOnly === true">
323
+ <a-input
324
+ v-model="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
325
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"
326
+ :disabled="true"/>
327
+ </template>
328
+ <template v-else>
329
+ <a-input
330
+ v-model="configData.arr[inputColumnsDefinitionIndex][cell.dataIndex]"
331
+ :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
332
+ </template>
333
+ </template>
334
+ </td>
335
+ </template>
336
+ </tr>
337
+ </template>
338
+
339
+ <script>
340
+ import Upload from '@vue2-client/base-client/components/common/Upload'
341
+ import { formatDate } from '@vue2-client/utils/util'
342
+
343
+ export default {
344
+ name: 'XReportTrGroup',
345
+ components: {
346
+ Upload
347
+ },
348
+ props: {
349
+ // 每一行的配置
350
+ columns: {
351
+ type: Array,
352
+ required: true
353
+ },
354
+ config: {
355
+ type: Object,
356
+ default: function () {
357
+ return {}
358
+ }
359
+ },
360
+ // 原始配置
361
+ configData: {
362
+ type: Object,
363
+ required: true
364
+ },
365
+ // 是否为动态行
366
+ inputColumns: {
367
+ type: Boolean,
368
+ default: false
369
+ },
370
+ // 是否为动态行按钮
371
+ inputColumnsButton: {
372
+ type: Boolean,
373
+ default: false
374
+ },
375
+ // 动态行的Index
376
+ inputColumnsDefinitionIndex: {
377
+ type: Number,
378
+ default: undefined
379
+ },
380
+ // 是否为展示行
381
+ display: {
382
+ type: Boolean,
383
+ default: false
384
+ },
385
+ // list类型的下标,用于遍历列表时,获取对应的数据
386
+ listIndex: {
387
+ type: Number,
388
+ default: undefined
389
+ },
390
+ // 表格没有上边框
391
+ noTopBorder: {
392
+ type: Boolean,
393
+ default: false
394
+ },
395
+ // 图片是否使用OSS来保存
396
+ useOssForImg: {
397
+ type: Boolean,
398
+ default: true
399
+ }
400
+ },
401
+ data () {
402
+ return {
403
+ maxColSpan: 12,
404
+ uploadParams: {
405
+ type: 'image',
406
+ accept: ['*'],
407
+ resUploadStock: 1,
408
+ pathKey: 'cs'
409
+ }
410
+ // tableConfig: {}
411
+ }
412
+ },
413
+ methods: {
414
+ updateImg (data) {
415
+ this.$emit('updateImg', data)
416
+ },
417
+ checkImg (index, type) {
418
+ let target
419
+ if (type === 'configData') {
420
+ target = this.configData.images[index]
421
+ } else {
422
+ target = this.config.tempData[index]
423
+ }
424
+ target.forEach(obj => {
425
+ if (obj.uid === undefined) {
426
+ obj.uid = obj.id.toString()
427
+ }
428
+ if (obj.url === undefined) {
429
+ if (obj.path) {
430
+ obj.url = obj.path
431
+ }
432
+ }
433
+ if (obj.name === undefined) {
434
+ const withOutEndFix = obj.url.split('.')[0]
435
+ const temp = withOutEndFix.split('/')
436
+ obj.name = temp[temp.length - 1]
437
+ }
438
+ if (obj.status === undefined) {
439
+ obj.status = 'done'
440
+ }
441
+ })
442
+ return target
443
+ },
444
+ // 判断单元格样式
445
+ determineCellStyle (cell, color = '#000', borderWidth = '1px') {
446
+ // 如果声明了borderColor
447
+ if (this.config.style.borderColor) {
448
+ color = this.config.style.borderColor
449
+ }
450
+ // 如果声明了borderWidth
451
+ if (this.config.style.borderWidth) {
452
+ borderWidth = this.config.style.borderWidth
453
+ }
454
+ // 普通带边框单元格
455
+ const withBorder = {
456
+ border: borderWidth + ' solid ' + color,
457
+ padding: '8px'
458
+ }
459
+ // 只有左右边框的单元格
460
+ const noBorder = {
461
+ borderLeft: borderWidth + ' solid ' + color,
462
+ borderRight: borderWidth + ' solid ' + color,
463
+ padding: '8px'
464
+ }
465
+ // 只没有上边框的单元格
466
+ const NoTopBorder = {
467
+ borderTopStyle: 'none',
468
+ borderLeft: borderWidth + ' solid ' + color,
469
+ borderRight: borderWidth + ' solid ' + color,
470
+ borderBottom: borderWidth + ' solid ' + color,
471
+ padding: '8px'
472
+ }
473
+ let result = {}
474
+ // 如果表格也声明了样式,用表格样式将样式覆盖
475
+ if (cell.style) {
476
+ if (cell.noBorder) {
477
+ result = { ...noBorder, ...cell.style }
478
+ } else {
479
+ if (this.noTopBorder) {
480
+ result = { ...NoTopBorder, ...cell.style }
481
+ } else {
482
+ result = { ...withBorder, ...cell.style }
483
+ }
484
+ }
485
+ return result
486
+ }
487
+ // 如果表头声明了样式,则用其将基础样式覆盖
488
+ if (cell.type === 'column') {
489
+ if (this.config.labelStyle !== undefined) {
490
+ if (cell.noBorder) {
491
+ result = { ...noBorder, ...this.config.labelStyle }
492
+ } else {
493
+ if (this.noTopBorder) {
494
+ result = { ...NoTopBorder, ...this.config.labelStyle }
495
+ } else {
496
+ result = { ...withBorder, ...this.config.labelStyle }
497
+ }
498
+ }
499
+ return result
500
+ }
501
+ }
502
+ if (cell.noBorder) {
503
+ result = { ...noBorder }
504
+ } else {
505
+ if (this.noTopBorder) {
506
+ result = { ...NoTopBorder }
507
+ } else {
508
+ result = { ...withBorder }
509
+ }
510
+ }
511
+ return result
512
+ },
513
+ // 表格中数据key含有@@@,需要手动触发更新
514
+ handleInputDeepChange () {
515
+ this.$forceUpdate()
516
+ },
517
+ // 路径中含有@@@的key,将其解析,并返回其数据
518
+ getDeepObject (obj, strPath) {
519
+ const arr = strPath.split('@@@')
520
+ let result = obj[arr[0]]
521
+ arr.shift()
522
+ try {
523
+ while (arr.length > 0) {
524
+ result = result[arr[0]]
525
+ arr.shift()
526
+ }
527
+ } catch (e) {
528
+ result = undefined
529
+ }
530
+ return result
531
+ },
532
+ // 获取当前日期
533
+ getNowDate (index1, index2) {
534
+ if (index2) {
535
+ // @click="getNowDate(configData.arr[inputColumnsDefinitionIndex][cell.dataIndex])"
536
+ this.configData.arr[index1][index2] = formatDate('now')
537
+ } else {
538
+ this.configData[index1] = formatDate('now')
539
+ }
540
+ this.configData = Object.assign({}, this.configData)
541
+ },
542
+ // 反序列化函数并执行
543
+ deserializeFunctionAndRun (functionStr, value) {
544
+ // eslint-disable-next-line no-eval
545
+ const fun = eval('(' + functionStr + ')')
546
+ return fun(value, this.config)
547
+ },
548
+ // 基础上传组件,图片改动后触发
549
+ setImages (args, type, index = undefined) {
550
+ // 如果基础上传组件在初始化完成后,就调用emit了setImage,此时图片并没有变化,直接返回
551
+ if (args[2] === 'created') {
552
+ return
553
+ }
554
+ if (type === 'configData') {
555
+ this.configData.images[args[1]] = args[0]
556
+ } else {
557
+ this.config.tempData[args[1]] = args[0]
558
+ if (index) {
559
+ this.$emit('updateImg', this.config.tempData[index])
560
+ }
561
+ }
562
+ },
563
+ // 动态行删除
564
+ removeData (index) {
565
+ if (this.configData[index].length === 0) {
566
+ this.$message.warn('已经没有更多了')
567
+ return
568
+ }
569
+ this.configData[index].pop()
570
+ },
571
+ // 添加一行
572
+ addData (index, row) {
573
+ // 获取定义
574
+ const defs = row[0].definition
575
+
576
+ // 获取外层对象名
577
+ const dataName = row[0].dataIndex
578
+ const temp = {}
579
+
580
+ defs.forEach(def => {
581
+ // 找到数组中最后一个数据的值
582
+ let lastDataNo = 0
583
+ if (this.configData[dataName][this.configData[dataName].length - 1]) {
584
+ lastDataNo = this.configData[dataName][this.configData[dataName].length - 1][def.dataIndex]
585
+ }
586
+
587
+ // 如果没有值,检查是否声明了初始值
588
+ if (lastDataNo === 0 && def.initialValue) {
589
+ lastDataNo = def.initialValue
590
+ }
591
+
592
+ // 检查是否有步长
593
+ let step = 1
594
+ if (def.step) {
595
+ step = def.step
596
+ }
597
+
598
+ // 如果单元格类型为increment,则进行自增
599
+ if (def.type === 'increment') {
600
+ temp[def.dataIndex] = lastDataNo + step
601
+ }
602
+ })
603
+ this.configData[index].push(temp)
604
+ },
605
+ // 根据format计算需要多少个输入框
606
+ calcFormatInputNum (formatStr) {
607
+ let count = 0
608
+ for (let i = 0; i < formatStr.length; i++) {
609
+ if (formatStr[i] === '{') {
610
+ count++
611
+ }
612
+ }
613
+ return count
614
+ },
615
+ // 根据format计算输入框之后的文字显示
616
+ displayFormatText (formatStr, num) {
617
+ let start = 0
618
+ let count = 0
619
+ num++
620
+ for (let i = 0; i < formatStr.length; i++) {
621
+ if (formatStr[i] === '}') {
622
+ start = i
623
+ count++
624
+ }
625
+ if (count === num) {
626
+ for (let j = start + 1; j < formatStr.length; j++) {
627
+ if (formatStr[j] === '{') {
628
+ return formatStr.slice(start + 1, j)
629
+ }
630
+ if (j === formatStr.length - 1 && formatStr[j] !== '}') {
631
+ return formatStr[j]
632
+ }
633
+ }
634
+ }
635
+ }
636
+ },
637
+ calcTDBorder (cellNoBorder = false) {
638
+ if (cellNoBorder) {
639
+ return 'tdNoBorder'
640
+ } else {
641
+ if (this.noTopBorder) {
642
+ return 'tdWithNoTopBorder'
643
+ } else {
644
+ return 'tdWithBorder'
645
+ }
646
+ }
647
+ },
648
+ // 根据format计算输入框之前的文字显示
649
+ displayFormatStartText (formatStr) {
650
+ let count = 0
651
+ for (let i = 0; i < formatStr.length; i++) {
652
+ if (formatStr[i] === '{') {
653
+ break
654
+ } else {
655
+ count++
656
+ }
657
+ }
658
+ return formatStr.slice(0, count)
659
+ },
660
+ // 拼接被自动拆分的单元格内容
661
+ showSubRowValue (cell) {
662
+ const dataName = cell.dataIndex
663
+ const formatArr = []
664
+ const dataArr = []
665
+
666
+ // 从config中取出所有数据,根据dataIndex的开头内容进行拼接
667
+ this.config.columns.forEach(row => row.forEach(cell => {
668
+ if (cell.dataIndex && cell.dataIndex.startsWith(dataName)) {
669
+ formatArr.push(cell.format)
670
+ dataArr.push(this.configData[cell.dataIndex])
671
+ }
672
+ }))
673
+
674
+ const text = []
675
+ const data = []
676
+
677
+ formatArr.forEach(word => {
678
+ const temp = word.split('{}')
679
+ temp.forEach(char => {
680
+ if (char !== '') {
681
+ text.push(char)
682
+ }
683
+ })
684
+ })
685
+
686
+ dataArr.forEach(item => {
687
+ item.forEach(num => {
688
+ data.push(num)
689
+ })
690
+ })
691
+
692
+ let result = ''
693
+ for (let i = 0; i < data.length; i++) {
694
+ result += data[i]
695
+ result += text[i]
696
+ }
697
+
698
+ return result
699
+ },
700
+ },
701
+ beforeMount () {
702
+ if (this.useOssForImg) {
703
+ this.uploadParams.resUploadMode = 'oss'
704
+ }
705
+ }
706
+ }
707
+
708
+ </script>
709
+
710
+ <style scoped lang="less">
711
+ .inputsDiv {
712
+ display: flex;
713
+ justify-content: space-between;
714
+
715
+ .inputsDivItem {
716
+ display: flex;
717
+ align-items: center;
718
+ padding: 0 4px;
719
+ white-space: nowrap;
720
+
721
+ .inputsDivItemLabel {
722
+ padding: 0 4px;
723
+ }
724
+ }
725
+ }
726
+
727
+ .tdNoBorder {
728
+ border-left: 1px solid #000;
729
+ border-right: 1px solid #000;
730
+ padding: 8px;
731
+ }
732
+
733
+ .tdWithBorder {
734
+ border: 1px solid #000;
735
+ padding: 8px;
736
+ }
737
+
738
+ .tdWithNoTopBorder {
739
+ border-top-style: none;
740
+ border-left: 1px solid #000;
741
+ border-right: 1px solid #000;
742
+ border-bottom: 1px solid #000;
743
+ padding: 8px;
744
+ }
745
+ </style>