vue2-client 1.8.263 → 1.8.264

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