vue2-client 1.13.10 → 1.13.12

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 (388) hide show
  1. package/.cursorrules +19 -19
  2. package/.env.gaslink +19 -19
  3. package/.env.his +19 -19
  4. package/.env.iot +19 -19
  5. package/.env.liuli +19 -19
  6. package/.env.revenue +19 -19
  7. package/.env.scada +19 -19
  8. package/.eslintrc.js +90 -90
  9. package/CHANGELOG.md +824 -824
  10. package/Components.md +60 -60
  11. package/docs/Logic/345/207/275/346/225/260/344/275/277/347/224/250/347/233/270/345/205/263.md +45 -45
  12. package/docs/LowCode/lowcode.md +155 -155
  13. package/docs/LowCode/lowcodeForDeveloper.md +230 -230
  14. package/docs/index.md +30 -30
  15. package/index.js +31 -31
  16. package/jest-transform-stub.js +8 -8
  17. package/jest.setup.js +7 -7
  18. package/jsconfig.json +19 -19
  19. package/package.json +1 -1
  20. package/public/his/editor/editor.html +51 -51
  21. package/public/his/editor/mock/bind_data.html +779 -779
  22. package/public/his/editor/mock/data_table.html +40 -40
  23. package/public/his/editor/mock/sign.html +75 -75
  24. package/public/his/editor/vender/JsBarcode.all.js +3669 -3669
  25. package/public/his/editor/vender/date97/My97DatePicker.htm +65 -65
  26. package/public/his/editor/vender/date97/WdatePicker.js +677 -677
  27. package/public/his/editor/vender/date97/calendar.js +4 -4
  28. package/public/his/editor/vender/date97/lang/en.js +13 -13
  29. package/public/his/editor/vender/date97/lang/zh-cn.js +13 -13
  30. package/public/his/editor/vender/date97/lang/zh-tw.js +13 -13
  31. package/public/his/editor/vender/date97/skin/WdatePicker.css +10 -10
  32. package/public/his/editor/vender/date97/skin/default/datepicker.css +328 -328
  33. package/public/his/editor/vender/date97/skin/ext/datepicker.css +308 -308
  34. package/public/his/editor/vender/date97/skin/whyGreen/datepicker.css +255 -255
  35. package/public/his/editor/vender/diff.js +1627 -1627
  36. package/public/his/editor/vender/editor.js +1 -1
  37. package/public/his/editor/vender/fabric.js +31187 -31187
  38. package/public/his/editor/vender/jquery/jquery.base64.js +190 -190
  39. package/public/his/editor/vender/jquery/jquery.js +10872 -10872
  40. package/public/his/editor/vender/jquery/jquery.print.js +255 -255
  41. package/public/his/editor/vender/jquery/zTreeStyle/zTreeStyle.css +96 -96
  42. package/public/his/editor/vender/mui/mui.min.css +4 -4
  43. package/public/his/editor/vender/mui/mui.min.js +5 -5
  44. package/public/his/editor/vender/mui/mui.picker.min.css +6 -6
  45. package/public/his/editor/vender/mui/mui.picker.min.js +6 -6
  46. package/public/his/editor/vender/qrcode.js +7 -7
  47. package/public/his/editor/vender/requirejs/require.js +2145 -2145
  48. package/public/his/editor/vender/signature/jSignature.CompressorSVG.js +518 -518
  49. package/public/his/editor/vender/signature/jSignature.UndoButton.js +164 -164
  50. package/public/his/editor/vender/signature/jSignature.js +1486 -1486
  51. package/public/his/editor/vender/validator.js +5094 -5094
  52. package/public/his/editor/vender/weui/weui.css +5659 -5659
  53. package/public/his/editor/vender/weui/weui.min.css +4 -4
  54. package/public/his/editor/vender/weui/weui.min.js +11 -11
  55. package/public/index.html +27 -27
  56. package/src/ReportView.js +19 -19
  57. package/src/assets/img/querySlotDemo.svg +15 -15
  58. package/src/assets/svg/badtwo.svg +1 -1
  59. package/src/assets/svg/goodtwo.svg +1 -1
  60. package/src/base-client/components/AI/AskAiBtn.vue +136 -136
  61. package/src/base-client/components/AI/demo.vue +31 -31
  62. package/src/base-client/components/common/AMisRender/index.js +3 -3
  63. package/src/base-client/components/common/AMisRender/index.vue +263 -263
  64. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +470 -470
  65. package/src/base-client/components/common/AddressSearchCombobox/IcMapIcon.vue +16 -16
  66. package/src/base-client/components/common/AddressSearchCombobox/demo.vue +36 -36
  67. package/src/base-client/components/common/AddressSearchCombobox/ic_map.svg +6 -6
  68. package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +120 -120
  69. package/src/base-client/components/common/CitySelect/index.js +3 -3
  70. package/src/base-client/components/common/CitySelect/index.md +109 -109
  71. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +669 -669
  72. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +1014 -1014
  73. package/src/base-client/components/common/CreateQuery/index.js +3 -3
  74. package/src/base-client/components/common/CreateQuery/index.md +42 -42
  75. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +452 -452
  76. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +511 -511
  77. package/src/base-client/components/common/CreateSimpleFormQuery/index.js +3 -3
  78. package/src/base-client/components/common/CreateSimpleFormQuery/index.md +42 -42
  79. package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +149 -149
  80. package/src/base-client/components/common/FormGroupEdit/index.js +3 -3
  81. package/src/base-client/components/common/FormGroupEdit/index.md +43 -43
  82. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +166 -166
  83. package/src/base-client/components/common/FormGroupQuery/index.js +3 -3
  84. package/src/base-client/components/common/FormGroupQuery/index.md +43 -43
  85. package/src/base-client/components/common/JSONToTree/jsontotree.vue +271 -271
  86. package/src/base-client/components/common/LowCodeComponent/LowCodeEditorModal.vue +108 -108
  87. package/src/base-client/components/common/LowCodeComponent/LowCodeEditorPanel.vue +413 -413
  88. package/src/base-client/components/common/LowCodeComponent/LowCodePageOrganization.vue +502 -502
  89. package/src/base-client/components/common/LowCodeComponent/LowCodeRender.vue +728 -728
  90. package/src/base-client/components/common/LowCodeComponent/LowCodeRenderEnter.vue +29 -29
  91. package/src/base-client/components/common/LowCodeComponent/LowCodeUIStore.vue +219 -219
  92. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeAddPageModal.vue +117 -117
  93. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeCustomJSModal.vue +80 -80
  94. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeEventEditorModal.vue +398 -398
  95. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeLifeCycleModal.vue +65 -65
  96. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeLogicCallbackModal.vue +64 -64
  97. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeLogicParamModal.vue +73 -73
  98. package/src/base-client/components/common/LowCodeComponent/modal/lowCodeRunFunctionParamModal.vue +76 -76
  99. package/src/base-client/components/common/PersonSetting/PersonSetting.vue +208 -208
  100. package/src/base-client/components/common/PersonSetting/index.js +3 -3
  101. package/src/base-client/components/common/Recording/Recording.vue +243 -243
  102. package/src/base-client/components/common/Recording/index.js +3 -3
  103. package/src/base-client/components/common/Tree/Tree.vue +149 -149
  104. package/src/base-client/components/common/Tree/index.js +2 -2
  105. package/src/base-client/components/common/Upload/index.js +3 -3
  106. package/src/base-client/components/common/XAddForm/XAddForm.vue +113 -113
  107. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +1156 -1156
  108. package/src/base-client/components/common/XAddNativeForm/index.md +146 -146
  109. package/src/base-client/components/common/XAddNativeFormOA/XAddNativeFormOA.vue +303 -303
  110. package/src/base-client/components/common/XAddNativeFormOA/index.js +3 -3
  111. package/src/base-client/components/common/XAddNativeFormOA/index.md +146 -146
  112. package/src/base-client/components/common/XAddReport/index.js +3 -3
  113. package/src/base-client/components/common/XAddReport/index.md +56 -56
  114. package/src/base-client/components/common/XBadge/XBadge.vue +94 -94
  115. package/src/base-client/components/common/XButtons/XButtonDemo.vue +28 -28
  116. package/src/base-client/components/common/XButtons/XButtons.vue +71 -71
  117. package/src/base-client/components/common/XButtons/index.js +3 -3
  118. package/src/base-client/components/common/XButtons/index.md +61 -61
  119. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  120. package/src/base-client/components/common/XCheckList/XCheckList.vue +106 -106
  121. package/src/base-client/components/common/XCheckList/XCheckListDemo.vue +41 -41
  122. package/src/base-client/components/common/XCollapse/XCollapseDemo.vue +15 -0
  123. package/src/base-client/components/common/XDataCard/index.js +3 -3
  124. package/src/base-client/components/common/XDataCard/index.md +1 -1
  125. package/src/base-client/components/common/XDataDrawer/XDataDrawer.vue +180 -180
  126. package/src/base-client/components/common/XDataDrawer/index.js +3 -3
  127. package/src/base-client/components/common/XDataDrawer/index.md +41 -41
  128. package/src/base-client/components/common/XDatePicker/demo.vue +153 -153
  129. package/src/base-client/components/common/XDescriptions/index.js +3 -3
  130. package/src/base-client/components/common/XDescriptions/index.md +83 -83
  131. package/src/base-client/components/common/XDetailsView/XDetailsView.vue +238 -238
  132. package/src/base-client/components/common/XDetailsView/index.js +3 -3
  133. package/src/base-client/components/common/XForm/XForm.vue +404 -404
  134. package/src/base-client/components/common/XForm/XFormItem.vue +1310 -1310
  135. package/src/base-client/components/common/XForm/XStatusButton.vue +54 -54
  136. package/src/base-client/components/common/XForm/XTreeSelect.vue +270 -270
  137. package/src/base-client/components/common/XForm/index.md +178 -178
  138. package/src/base-client/components/common/XForm/itemComponent/XClickChangeBtn/index.vue +49 -49
  139. package/src/base-client/components/common/XFormGroup/index.js +3 -3
  140. package/src/base-client/components/common/XFormGroup/index.md +38 -38
  141. package/src/base-client/components/common/XFormGroupDetails/XFormGroupDetails.vue +72 -72
  142. package/src/base-client/components/common/XFormGroupDetails/index.js +3 -3
  143. package/src/base-client/components/common/XFormTable/demo.vue +76 -76
  144. package/src/base-client/components/common/XFormTable/index.md +92 -92
  145. package/src/base-client/components/common/XImportExcel/XImportExcel.vue +167 -167
  146. package/src/base-client/components/common/XLabelSelect/XLabelSelect.vue +110 -110
  147. package/src/base-client/components/common/XLabelSelect/XLabelSelectDemo.vue +35 -35
  148. package/src/base-client/components/common/XLicensePlate/XLicensePlate.vue +193 -193
  149. package/src/base-client/components/common/XLicensePlate/XLicensePlateDemo.vue +48 -48
  150. package/src/base-client/components/common/XPrint/OpenInvoice.vue +21 -21
  151. package/src/base-client/components/common/XPrint/PrintBill.vue +302 -302
  152. package/src/base-client/components/common/XPrint/PrintHtml.js +98 -98
  153. package/src/base-client/components/common/XPrint/css/hiPrintCss.js +359 -359
  154. package/src/base-client/components/common/XPrint/css/lodopCss.js +26 -26
  155. package/src/base-client/components/common/XPrint/css/print-lock.css +351 -351
  156. package/src/base-client/components/common/XPrint/index.vue +97 -97
  157. package/src/base-client/components/common/XReport/XReport.vue +892 -892
  158. package/src/base-client/components/common/XReport/XReportDesign.vue +463 -463
  159. package/src/base-client/components/common/XReport/XReportJsonRender.vue +381 -381
  160. package/src/base-client/components/common/XReport/index.js +3 -3
  161. package/src/base-client/components/common/XReport/index.md +44 -44
  162. package/src/base-client/components/common/XReport/print.js +186 -186
  163. package/src/base-client/components/common/XReportDrawer/index.js +3 -3
  164. package/src/base-client/components/common/XReportGrid/XReportDemo.vue +44 -44
  165. package/src/base-client/components/common/XReportGrid/XReportTrGroup.vue +712 -712
  166. package/src/base-client/components/common/XReportGrid/index.js +3 -3
  167. package/src/base-client/components/common/XReportGrid/index.md +44 -44
  168. package/src/base-client/components/common/XReportSlot/XReportSlot.vue +110 -110
  169. package/src/base-client/components/common/XReportSlot/index.js +3 -3
  170. package/src/base-client/components/common/XReportSlot/index.md +48 -48
  171. package/src/base-client/components/common/XSimpleDescriptions/XSimpleDescriptions.vue +166 -166
  172. package/src/base-client/components/common/XSimpleDescriptions/index.js +3 -3
  173. package/src/base-client/components/common/XSimpleDescriptions/index.md +7 -7
  174. package/src/base-client/components/common/XStepView/XStepView.vue +252 -252
  175. package/src/base-client/components/common/XStepView/index.js +3 -3
  176. package/src/base-client/components/common/XStepView/index.md +31 -31
  177. package/src/base-client/components/common/XTab/XTabDemo.vue +22 -22
  178. package/src/base-client/components/common/XTab/index.js +3 -3
  179. package/src/base-client/components/common/XTable/CustomFuncCel.vue +51 -51
  180. package/src/base-client/components/common/XTable/TableCellRenderer.vue +161 -161
  181. package/src/base-client/components/common/XTable/XTable.vue +1361 -1361
  182. package/src/base-client/components/common/XTable/XTableWrapper.vue +257 -257
  183. package/src/base-client/components/common/XTable/index.md +255 -255
  184. package/src/base-client/components/common/XTagGroup/index.vue +52 -52
  185. package/src/base-client/components/common/XTree/XTree.vue +424 -424
  186. package/src/base-client/components/common/XTree/index.js +3 -3
  187. package/src/base-client/components/common/XTree/index.md +36 -36
  188. package/src/base-client/components/common/XTreeOne/XTreeOne.vue +113 -113
  189. package/src/base-client/components/common/XTreeOne/XTreeOnePro.vue +128 -128
  190. package/src/base-client/components/common/richTextModal/index.vue +56 -56
  191. package/src/base-client/components/common/richTextModal/richDemo.vue +48 -48
  192. package/src/base-client/components/his/XHDescriptions/XHDescriptions.vue +38 -5
  193. package/src/base-client/components/his/XHisEditor/XHisEditor.vue +3 -0
  194. package/src/base-client/components/his/XHisEditor/index.js +3 -3
  195. package/src/base-client/components/his/XSelect/XSelect.vue +72 -72
  196. package/src/base-client/components/his/XTitle/XTitle.vue +39 -39
  197. package/src/base-client/components/index.js +51 -51
  198. package/src/base-client/components/layout/XPageView/XErrorView.vue +11 -11
  199. package/src/base-client/components/layout/XPageView/XPageView.vue +155 -155
  200. package/src/base-client/components/layout/XPageView/index.js +3 -3
  201. package/src/base-client/components/layout/XPageView/index.md +38 -38
  202. package/src/base-client/components/layout/XTreeView/XTreeView.vue +130 -130
  203. package/src/base-client/components/layout/XTreeView/index.js +3 -3
  204. package/src/base-client/components/layout/XTreeView/index.md +46 -46
  205. package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +232 -232
  206. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
  207. package/src/base-client/plugins/AppData.js +126 -126
  208. package/src/base-client/plugins/Config.js +19 -19
  209. package/src/base-client/plugins/GetLoginInfoService.js +183 -183
  210. package/src/base-client/plugins/Recording.js +258 -258
  211. package/src/base-client/plugins/index.js +23 -23
  212. package/src/base-client/plugins/tabs-page-plugin.js +39 -39
  213. package/src/components/Charts/Bar.vue +62 -62
  214. package/src/components/Charts/ChartCard.vue +134 -134
  215. package/src/components/Charts/Liquid.vue +67 -67
  216. package/src/components/Charts/MiniArea.vue +39 -39
  217. package/src/components/Charts/MiniBar.vue +39 -39
  218. package/src/components/Charts/MiniProgress.vue +75 -75
  219. package/src/components/Charts/MiniSmoothArea.vue +40 -40
  220. package/src/components/Charts/Radar.vue +68 -68
  221. package/src/components/Charts/RankList.vue +77 -77
  222. package/src/components/Charts/TagCloud.vue +113 -113
  223. package/src/components/Charts/TransferBar.vue +64 -64
  224. package/src/components/Charts/Trend.vue +82 -82
  225. package/src/components/Charts/chart.less +12 -12
  226. package/src/components/Charts/smooth.area.less +13 -13
  227. package/src/components/CodeMirror/inedx.vue +118 -118
  228. package/src/components/CodeMirror/setting.js +40 -40
  229. package/src/components/FilePreview/FilePreviewDemo.vue +30 -30
  230. package/src/components/HeightScanner/index.vue +571 -571
  231. package/src/components/NumberInfo/NumberInfo.vue +54 -54
  232. package/src/components/NumberInfo/index.js +3 -3
  233. package/src/components/NumberInfo/index.less +54 -54
  234. package/src/components/NumberInfo/index.md +43 -43
  235. package/src/components/STable/index.js +437 -437
  236. package/src/components/card/ChartCard.vue +79 -79
  237. package/src/components/chart/Bar.vue +60 -60
  238. package/src/components/chart/MiniArea.vue +67 -67
  239. package/src/components/chart/MiniBar.vue +59 -59
  240. package/src/components/chart/MiniProgress.vue +57 -57
  241. package/src/components/chart/Radar.vue +80 -80
  242. package/src/components/chart/RankingList.vue +60 -60
  243. package/src/components/chart/Trend.vue +79 -79
  244. package/src/components/chart/index.less +9 -9
  245. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  246. package/src/components/checkbox/ImgCheckbox.vue +117 -117
  247. package/src/components/checkbox/ImgCheckboxGroup.vue +76 -76
  248. package/src/components/checkbox/index.js +9 -9
  249. package/src/components/exception/ExceptionPage.vue +70 -70
  250. package/src/components/g2Charts/constants.js +202 -202
  251. package/src/components/g2Charts/demo.vue +808 -808
  252. package/src/components/g2Charts/designer.vue +228 -228
  253. package/src/components/g2Charts/designerBaseConfig.vue +61 -61
  254. package/src/components/g2Charts/designerDataConfig.vue +259 -259
  255. package/src/components/g2Charts/designerStyleConfig.vue +16 -16
  256. package/src/components/g2Charts/index.vue +397 -397
  257. package/src/components/index.js +36 -36
  258. package/src/components/input/IInput.vue +66 -66
  259. package/src/components/menu/SideMenu.vue +75 -75
  260. package/src/components/menu/menu.js +273 -273
  261. package/src/components/setting/Setting.vue +234 -234
  262. package/src/components/tool/AStepItem.vue +60 -60
  263. package/src/config/CreateQueryConfig.js +325 -325
  264. package/src/config/default/antd.config.js +89 -89
  265. package/src/config/default/setting.config.js +55 -55
  266. package/src/font-style/font.css +4 -4
  267. package/src/layouts/CommonLayout.vue +56 -56
  268. package/src/layouts/PageLayout.vue +151 -151
  269. package/src/layouts/SinglePageView.vue +136 -136
  270. package/src/layouts/header/AdminHeader.vue +132 -132
  271. package/src/layouts/header/HeaderNotice.vue +177 -177
  272. package/src/layouts/header/InstitutionDetail.vue +181 -181
  273. package/src/layouts/tabs/TabsHead.vue +189 -189
  274. package/src/layouts/tabs/TabsView.vue +389 -389
  275. package/src/lib.js +1 -1
  276. package/src/main.js +34 -34
  277. package/src/mixins/formValidationMixin.js +46 -46
  278. package/src/mock/extend/index.js +84 -84
  279. package/src/mock/goods/index.js +108 -108
  280. package/src/pages/AMisDemo/AMisDemo.vue +325 -325
  281. package/src/pages/AMisDemo/AMisDemo2.vue +74 -74
  282. package/src/pages/DefaultExample/index.vue +77 -77
  283. package/src/pages/DynamicStatistics/ChartSelector.vue +331 -331
  284. package/src/pages/DynamicStatistics/DataTabs.vue +83 -83
  285. package/src/pages/DynamicStatistics/DynamicTable.vue +128 -128
  286. package/src/pages/DynamicStatistics/EvaluationArea.vue +69 -69
  287. package/src/pages/DynamicStatistics/FavoriteList.vue +50 -50
  288. package/src/pages/DynamicStatistics/QuestionHistoryAndFavorites.vue +591 -591
  289. package/src/pages/DynamicStatistics/SearchBar.vue +192 -192
  290. package/src/pages/DynamicStatistics/index.vue +282 -282
  291. package/src/pages/Example/childIndex.vue +15 -15
  292. package/src/pages/Example/index.vue +30 -30
  293. package/src/pages/NewDynamicStatistics/ChartSelector.vue +331 -331
  294. package/src/pages/NewDynamicStatistics/DataTabs.vue +122 -122
  295. package/src/pages/NewDynamicStatistics/DynamicTable.vue +128 -128
  296. package/src/pages/NewDynamicStatistics/EvaluationArea.vue +69 -69
  297. package/src/pages/NewDynamicStatistics/FavoriteList.vue +50 -50
  298. package/src/pages/NewDynamicStatistics/QuestionHistoryAndFavorites.vue +289 -289
  299. package/src/pages/NewDynamicStatistics/SearchBar.vue +193 -193
  300. package/src/pages/NewDynamicStatistics/index.vue +258 -258
  301. package/src/pages/Recording/index.vue +77 -77
  302. package/src/pages/ReportGrid/index.vue +76 -76
  303. package/src/pages/ServiceReview/index.vue +284 -284
  304. package/src/pages/SubExample/index.vue +26 -26
  305. package/src/pages/WorkflowDetail/WorkflowDetail.vue +235 -235
  306. package/src/pages/WorkflowDetail/WorkflowPageDetail/LeaveMessage.vue +131 -131
  307. package/src/pages/WorkflowDetail/WorkflowPageDetail/TrimTextTail.vue +23 -23
  308. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowBaseInformation.vue +302 -302
  309. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowBaseInformationDetails.vue +276 -276
  310. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowHandleReso.vue +997 -997
  311. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowTimeline.vue +222 -222
  312. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkOrderParentDetails.vue +233 -233
  313. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkflowDetailResso.vue +261 -261
  314. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkflowListResolution.vue +248 -248
  315. package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkflowLog.vue +73 -73
  316. package/src/pages/XPageViewExample/index.vue +38 -38
  317. package/src/pages/XReportView/index.vue +64 -64
  318. package/src/pages/XTreeOneProExample/index.vue +67 -67
  319. package/src/pages/dashboard/workplace/WorkPlace.vue +141 -141
  320. package/src/pages/login/Login.vue +378 -378
  321. package/src/pages/login/LoginV3.vue +389 -389
  322. package/src/pages/lowCode/lowCodeEditor.vue +1219 -1219
  323. package/src/pages/lowCode/lowCodeRenderPage.vue +43 -43
  324. package/src/pages/report/ReportTable.js +124 -124
  325. package/src/pages/resourceManage/orgListManage.vue +98 -98
  326. package/src/pages/system/dictionary/index.vue +44 -44
  327. package/src/pages/system/monitor/loginInfor/index.vue +37 -37
  328. package/src/pages/system/monitor/operLog/index.vue +37 -37
  329. package/src/pages/system/settings/modifyPassword.vue +117 -117
  330. package/src/pages/system/ticket/index.vue +480 -480
  331. package/src/pages/system/ticket/submitTicketSuccess.vue +484 -484
  332. package/src/pages/userInfoDetailManage/ChangeMeterRecordQuery/index.vue +64 -64
  333. package/src/pages/userInfoDetailManage/FillCardRecordQuery/index.vue +76 -76
  334. package/src/pages/userInfoDetailManage/FillGasRecordQuery/index.vue +74 -74
  335. package/src/pages/userInfoDetailManage/InfoChangeRecordQuery/index.vue +64 -64
  336. package/src/pages/userInfoDetailManage/InstructRecordQuery/index.vue +64 -64
  337. package/src/pages/userInfoDetailManage/MachineRecordQuery/index.vue +74 -74
  338. package/src/pages/userInfoDetailManage/MeterParamRecordQuery/index.vue +64 -64
  339. package/src/pages/userInfoDetailManage/OtherChargeRecordQuery/index.vue +74 -74
  340. package/src/pages/userInfoDetailManage/TransferRecordQuery/index.vue +66 -66
  341. package/src/pages/userInfoDetailManage/UserHandRecordQuery/index.vue +86 -86
  342. package/src/pages/userInfoDetailManage/UserRecordQuery/index.vue +73 -73
  343. package/src/pages/userInfoDetailManage/WatchCollectionRecordQuery/index.vue +64 -64
  344. package/src/plugins/EventLogPlugin.js +33 -33
  345. package/src/plugins/FindParentsData.js +17 -17
  346. package/src/router/async/config.async.js +35 -35
  347. package/src/router/async/router.map.js +126 -119
  348. package/src/router/index.js +27 -27
  349. package/src/router.js +19 -19
  350. package/src/services/DataModel.js +30 -30
  351. package/src/services/LodopFuncs.js +137 -137
  352. package/src/services/api/TicketDetailsViewApi.js +46 -46
  353. package/src/services/api/cas.js +79 -79
  354. package/src/services/api/common.js +346 -346
  355. package/src/services/api/entity.js +18 -18
  356. package/src/services/api/index.js +17 -17
  357. package/src/services/api/restTools.js +145 -145
  358. package/src/services/api/workFlow.js +63 -63
  359. package/src/services/apiService.js +16 -16
  360. package/src/store/modules/account.js +115 -115
  361. package/src/store/modules/index.js +5 -5
  362. package/src/store/modules/lowCode.js +33 -33
  363. package/src/store/modules/setting.js +119 -119
  364. package/src/theme/default/style.less +58 -58
  365. package/src/theme/global.less +159 -159
  366. package/src/utils/authority-utils.js +85 -85
  367. package/src/utils/errorCode.js +6 -6
  368. package/src/utils/formatter.js +74 -74
  369. package/src/utils/htmlToPDF.js +108 -108
  370. package/src/utils/htmlToPDFApi.js +5 -5
  371. package/src/utils/login.js +188 -188
  372. package/src/utils/lowcode/lowcodeComponentMixin.js +120 -120
  373. package/src/utils/lowcode/lowcodeLog.js +29 -29
  374. package/src/utils/lowcode/lowcodeUtils.js +373 -373
  375. package/src/utils/lowcode/registerComponentForEditor.js +1 -1
  376. package/src/utils/lowcode/registerComponentForRender.js +11 -11
  377. package/src/utils/map-utils.js +47 -47
  378. package/src/utils/reg.js +95 -95
  379. package/src/utils/runEvalFunction.js +14 -14
  380. package/src/utils/theme-color-replacer-extend.js +92 -92
  381. package/src/utils/util.js +329 -329
  382. package/src/utils/waterMark.js +31 -31
  383. package/test/Amis.spec.js +164 -164
  384. package/test/Tree.spec.js +168 -168
  385. package/test/myDialog.spec.js +47 -47
  386. package/test/util.test.js +53 -53
  387. package/test/v3Api.test.js +1984 -1984
  388. package//350/277/201/347/247/273/346/227/245/345/277/227.md +15 -15
@@ -1,1310 +1,1310 @@
1
- <template>
2
- <!-- 输入框 -->
3
- <x-form-col
4
- v-if="attr.type === 'input' && show"
5
- :occupyCol="attr.occupyCol"
6
- :labelCol="labelCol"
7
- :flex="attr.flex">
8
- <a-form-model-item
9
- :rules="rules"
10
- :ref="attr.model"
11
- :label="showLabel?attr.name:undefined"
12
- :prop="attr.prop ? attr.prop : attr.model">
13
- <!-- 如果配置了后置按钮插槽 -->
14
- <a-input-group
15
- v-if="((attr.inputOnAfterName && attr.inputOnAfterFunc) || (attr.inputOnAfterIcon && attr.inputOnAfterIconFunc)) && mode !== '查询'"
16
- style="display: flex; width: 100%; padding: 4px 0"
17
- compact>
18
- <a-input
19
- v-model="form[attr.model]"
20
- :read-only="readOnly"
21
- :disabled="disabled && !readOnly"
22
- :whitespace="true"
23
- @input="attr.dataChangeFunc && debouncedDataChangeFunc()"
24
- :suffix="attr.inputSuffix && mode !== '新增' ? attr.inputSuffix : ''"
25
- @blur="mode !== '查询' && attr.inputOnBlurFunc && emitFunc(attr.inputOnBlurFunc,attr)"
26
- @keyup.enter="mode !== '查询' && attr.inputOnEnterFunc && emitFunc(attr.inputOnEnterFunc, attr)"
27
- :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')"
28
- :ref="`${attr.model}input`"/>
29
- <a-button
30
- v-if="attr.inputOnAfterName && attr.inputOnAfterFunc && !attr.inputOnAfterName.includes('|')"
31
- style="width: auto; min-width: 4rem;max-width: 6rem"
32
- type="primary"
33
- @click="emitFunc(attr.inputOnAfterFunc,attr)">
34
- {{ attr.inputOnAfterName }}
35
- </a-button>
36
- <!-- 仅可以配置 一个按钮 以及 一个图标插槽 -->
37
- <a-button
38
- style="width: 2rem; flex-shrink: 0;"
39
- v-else-if="attr.inputOnAfterIcon"
40
- :type="attr.inputOnAfterIcon && attr.inputOnAfterName ? 'primary' :''"
41
- :icon="attr.inputOnAfterIcon || 'question'"
42
- @click="emitFunc(attr.inputOnAfterIconFunc,attr)">
43
- </a-button>
44
- <!-- 状态按钮 -->
45
- <x-status-button
46
- v-else
47
- :states="parseStates(attr.inputOnAfterName, attr.inputOnAfterFunc)"
48
- v-on="generateDynamicEvents(attr.inputOnAfterFunc, attr)"
49
- style="width: auto; min-width: 4rem; max-width: 6rem"
50
- />
51
- </a-input-group>
52
- <a-input-number
53
- v-else-if="attr.numberInput && !readOnly"
54
- v-model="form[attr.model]"
55
- :whitespace="true"
56
- @change="attr.dataChangeFunc && debouncedDataChangeFunc()"
57
- :disabled="disabled && !readOnly"
58
- style="width:100%"
59
- @blur="mode !== '查询' && attr.inputOnBlurFunc && emitFunc(attr.inputOnBlurFunc,attr)"
60
- @keyup.enter="mode !== '查询' && attr.inputOnEnterFunc && emitFunc(attr.inputOnEnterFunc, attr)"
61
- :suffix="attr.inputSuffix && mode !== '新增' ? attr.inputSuffix : ''"
62
- :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')"
63
- :ref="`${attr.model}input`"/>
64
- <a-input
65
- v-else
66
- v-model="form[attr.model]"
67
- :whitespace="true"
68
- :read-only="readOnly"
69
- :disabled="disabled && !readOnly"
70
- @input="attr.dataChangeFunc && debouncedDataChangeFunc()"
71
- :suffix="attr.inputSuffix && mode !== '新增' ? attr.inputSuffix : ''"
72
- style="width:100%"
73
- @blur="mode !== '查询' && attr.inputOnBlurFunc && emitFunc(attr.inputOnBlurFunc,attr)"
74
- @keyup.enter="mode !== '查询' && attr.inputOnEnterFunc && emitFunc(attr.inputOnEnterFunc, attr)"
75
- :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')"
76
- :ref="`${attr.model}input`"/>
77
- </a-form-model-item>
78
- </x-form-col>
79
- <!-- 下拉框 -->
80
- <x-form-col
81
- v-else-if="attr.type === 'select' && show"
82
- :labelCol="labelCol"
83
- :flex="attr.flex">
84
- <a-form-model-item
85
- :rules="rules"
86
- v-if="!attr.showMode || mode === '查询' || attr.showMode === 'select' "
87
- :ref="attr.model"
88
- :label="showLabel?attr.name:undefined"
89
- :prop="attr.prop ? attr.prop : attr.model">
90
- <!-- <span slot="label" class="label-box">{{ showLabel?attr.name:undefined }}</span>-->
91
- <a-select
92
- v-if="!attr.lazyLoad || attr.lazyLoad === 'false'"
93
- v-model="form[attr.model]"
94
- :disabled="disabled"
95
- @change="attr.dataChangeFunc && debouncedDataChangeFunc()"
96
- :filter-option="filterOption"
97
- :getPopupContainer="getPopupContainer"
98
- dropdownClassName="custom-dropdown"
99
- :dropdownMatchSelectWidth="false"
100
- :dropdownStyle="{ position: 'absolute'}"
101
- :placeholder="attr.placeholder ? attr.placeholder : '请选择'"
102
- show-search
103
- >
104
- <a-select-option
105
- v-if="mode === '查询'"
106
- key="999999"
107
- value="">全部
108
- </a-select-option>
109
- <template v-if="attr.keys">
110
- <a-select-option
111
- v-for="(item,index) in attr.keys"
112
- :key="index.value"
113
- :value="item.value + ''">
114
- {{ item.label }}
115
- </a-select-option>
116
- </template>
117
- <template v-else>
118
- <template
119
- v-if="attr.keyName.indexOf('logic@') !== -1 || attr.keyName.indexOf('config@') !== -1
120
- ||attr.keyName.indexOf('search@') !== -1 || attr.keyName.indexOf('search@') !== -1">
121
- <a-select-option
122
- v-for="(item,index) in option"
123
- :key="index.value"
124
- :value="item.value + ''">
125
- <template v-if="attr.keyName.indexOf('config@') !== -1 && item.status">
126
- <!-- 徽标(badge) -->
127
- <a-badge v-if="item.status !== 'gary'" :color="item.status" :text="item.label"/>
128
- <a-badge v-else color="#D9D9D9" :text="item.label"/>
129
- </template>
130
- <template v-else>
131
- {{ item.label }}
132
- </template>
133
- </a-select-option>
134
- </template>
135
- <template
136
- v-else-if="attr.keyName.indexOf('async ') !== -1 || attr.keyName.indexOf('function ') !== -1">
137
- <a-select-option
138
- v-for="(item,index) in optionForFunc"
139
- :key="index.value"
140
- :value="item.value + ''">
141
- <template>
142
- {{ item.label }}
143
- </template>
144
- </a-select-option>
145
- </template>
146
- <template v-else>
147
- <a-select-option
148
- v-for="item in $appdata.getDictionaryList(attr.keyName)"
149
- :key="item.value"
150
- :value="item.value + ''">
151
- <!-- 徽标(badge) -->
152
- <x-badge
153
- :badge-key="attr.keyName"
154
- :replaceText="item.text"
155
- :value="item.value"
156
- :service-name="serviceName"
157
- :env="env"/>
158
- </a-select-option>
159
- </template>
160
- </template>
161
- </a-select>
162
- <a-select
163
- v-else
164
- v-model="form[attr.model]"
165
- :disabled="disabled"
166
- @change="attr.dataChangeFunc && debouncedDataChangeFunc()"
167
- :filter-option="filterOption"
168
- :getPopupContainer="getPopupContainer"
169
- dropdownClassName="custom-dropdown"
170
- :dropdownMatchSelectWidth="false"
171
- :dropdownStyle="{ position: 'absolute'}"
172
- :placeholder="attr.placeholder ? attr.placeholder : '搜索' + attr.name"
173
- show-search
174
- @search="fetchFunction"
175
- >
176
- <template #notFoundContent>
177
- <a-spin v-if="searching" size="small"/>
178
- </template>
179
- <a-select-option
180
- v-if="mode === '查询'"
181
- key="999999"
182
- value="">全部
183
- </a-select-option>
184
- <a-select-option
185
- v-for="(item,index) in option"
186
- :key="index"
187
- :value="item.value + ''">{{ item.label }}
188
- </a-select-option>
189
- </a-select>
190
- </a-form-model-item>
191
- <a-form-model-item
192
- :rules="rules"
193
- v-else-if="attr.showMode === 'radioGroup'"
194
- :ref="attr.model"
195
- :label="showLabel?attr.name:undefined"
196
- :prop="attr.prop ? attr.prop : attr.model">
197
- <a-radio-group v-model="form[attr.model]">
198
- <a-radio-button v-for="modeItem in option" :key="modeItem.value" :value="modeItem.value">
199
- {{ modeItem.label }}
200
- </a-radio-button>
201
- </a-radio-group>
202
- </a-form-model-item>
203
- <a-form-model-item
204
- v-else-if="attr.showMode === 'clickChange' && option.length > 0"
205
- :ref="attr.model"
206
- :label="showLabel?attr.name:undefined"
207
- :prop="attr.prop ? attr.prop : attr.model">
208
- <XClickChangeBtn></XClickChangeBtn>
209
- </a-form-model-item>
210
- </x-form-col>
211
- <!-- 多选框 -->
212
- <x-form-col
213
- v-else-if="attr.type === 'checkbox' && show"
214
- :labelCol="labelCol"
215
- :flex="attr.flex">
216
- <a-form-model-item
217
- :rules="rules"
218
- v-if="!attr.showMode || mode === '查询' || attr.showMode === 'select' "
219
- :ref="attr.model"
220
- :label="showLabel?attr.name:undefined"
221
- :prop="attr.prop ? attr.prop : attr.model">
222
- <a-select
223
- style="width:100%"
224
- v-if="!attr.lazyLoad || attr.lazyLoad === 'false'"
225
- v-model="form[attr.model]"
226
- :disabled="disabled"
227
- :filter-option="filterOption"
228
- :getPopupContainer="getPopupContainer"
229
- :placeholder="attr.placeholder ? attr.placeholder : '请选择'"
230
- @change="attr.dataChangeFunc && debouncedDataChangeFunc()"
231
- mode="multiple"
232
- show-search
233
- allowClear
234
- >
235
- <template v-if="attr.keys">
236
- <a-select-option
237
- v-for="(item,index) in attr.keys"
238
- :key="index"
239
- :value="item.value + ''">
240
- {{ item.label }}
241
- </a-select-option>
242
- </template>
243
- <template v-else>
244
- <template
245
- v-if="attr.keyName.indexOf('logic@') !== -1 || attr.keyName.indexOf('config@') !== -1
246
- ||attr.keyName.indexOf('search@') !== -1 || attr.keyName.indexOf('search@') !== -1">
247
- <a-select-option
248
- v-for="(item,index) in option"
249
- :key="index"
250
- :value="item.value">{{ item.label }}
251
- </a-select-option>
252
- </template>
253
- <template v-else>
254
- <a-select-option
255
- v-for="item in $appdata.getDictionaryList(attr.keyName)"
256
- :key="item.value"
257
- :value="item.value + ''">{{ item.text }}
258
- </a-select-option>
259
- </template>
260
- </template>
261
- </a-select>
262
- <a-select
263
- v-else
264
- v-model="form[attr.model]"
265
- :disabled="disabled"
266
- :filter-option="filterOption"
267
- :getPopupContainer="getPopupContainer"
268
- :placeholder="attr.placeholder ? attr.placeholder : '搜索' + attr.name"
269
- mode="multiple"
270
- style="width:100%"
271
- @change="attr.dataChangeFunc && debouncedDataChangeFunc()"
272
- show-search
273
- allowClear
274
- @search="fetchFunction"
275
- >
276
- <template #notFoundContent>
277
- <a-spin v-if="searching" size="small"/>
278
- </template>
279
- <a-select-option
280
- v-for="(item,index) in option"
281
- :key="index"
282
- :value="item.value + ''">{{ item.label }}
283
- </a-select-option>
284
- </a-select>
285
- </a-form-model-item>
286
- <a-form-model-item
287
- :rules="rules"
288
- v-else
289
- :ref="attr.model"
290
- :label="showLabel?attr.name:undefined"
291
- :prop="attr.prop ? attr.prop : attr.model">
292
- <a-checkbox-group
293
- v-model="form[attr.model]"
294
- :options="option"
295
- @change="attr.dataChangeFunc && debouncedDataChangeFunc()"
296
- />
297
- </a-form-model-item>
298
- </x-form-col>
299
- <!-- 单选框 -->
300
- <x-form-col
301
- v-else-if="attr.type === 'radio' && show"
302
- :labelCol="labelCol"
303
- :flex="attr.flex">
304
- <a-form-model-item
305
- :rules="rules"
306
- v-if="!attr.showMode || attr.type === 'radio' "
307
- :ref="attr.model"
308
- :label="showLabel?attr.name:undefined"
309
- :prop="attr.prop ? attr.prop : attr.model">
310
- <a-radio-group
311
- v-model="form[attr.model]"
312
- @change="attr.dataChangeFunc && debouncedDataChangeFunc()"
313
- >
314
- <template v-if="attr.keys">
315
- <a-radio v-for="(item,index) in attr.keys" :key="index" :value="item.value">
316
- {{ item.label }}
317
- </a-radio>
318
- </template>
319
- <template v-else>
320
- <template
321
- v-if="attr.keyName.indexOf('logic@') !== -1 || attr.keyName.indexOf('config@') !== -1
322
- ||attr.keyName.indexOf('search@') !== -1 || attr.keyName.indexOf('search@') !== -1">
323
- <a-radio v-for="(item,index) in option" :key="index" :value="item.value">
324
- {{ item.label }}
325
- </a-radio>
326
- </template>
327
- <template v-else>
328
- <a-radio v-for="(item,index) in $appdata.getDictionaryList(attr.keyName)" :key="index" :value="item.value">
329
- {{ item.text }}
330
- </a-radio>
331
- </template>
332
- </template>
333
- </a-radio-group>
334
- </a-form-model-item>
335
- <a-form-model-item
336
- :rules="rules"
337
- v-else-if="attr.showMode === 'radioGroup'"
338
- :ref="attr.model"
339
- :label="showLabel?attr.name:undefined"
340
- :prop="attr.prop ? attr.prop : attr.model">
341
- <a-radio-group v-model="form[attr.model]">
342
- <a-radio-button v-for="modeItem in option" :key="modeItem.value" :value="modeItem.value">
343
- {{ modeItem.label }}
344
- </a-radio-button>
345
- </a-radio-group>
346
- </a-form-model-item>
347
- <a-form-model-item
348
- :rules="rules"
349
- v-else-if="attr.showMode === 'clickChange' && option.length > 0"
350
- :ref="attr.model"
351
- :label="showLabel?attr.name:undefined"
352
- :prop="attr.prop ? attr.prop : attr.model">
353
- <XClickChangeBtn></XClickChangeBtn>
354
- </a-form-model-item>
355
- </x-form-col>
356
- <!-- 时间 日期 框整合 -->
357
- <x-form-col
358
- v-else-if="['datePicker', 'rangePicker', 'yearPicker', 'monthPicker', 'yearRangePicker', 'monthRangePicker'].includes(attr.type) && show"
359
- :labelCol="labelCol"
360
- :flex="attr.flex">
361
- <a-form-model-item
362
- :rules="rules"
363
- :ref="attr.model"
364
- :label="showLabel?attr.name:undefined"
365
- :prop="attr.prop ? attr.prop : attr.model">
366
- <XFormDatePicker
367
- :attr="attr"
368
- :mode="mode"
369
- :disabled="disabled"
370
- :readOnly="readOnly"
371
- :showLabel="showLabel"
372
- @change="attr.dataChangeFunc && debouncedDataChangeFunc()"
373
- v-model="form[attr.model]"/>
374
- </a-form-model-item>
375
- </x-form-col>
376
- <!-- 文本域 -->
377
- <x-form-col
378
- v-else-if="attr.type === 'textarea' && show"
379
- :labelCol="labelCol"
380
- :flex="attr.flex">
381
- <!-- :style="layout === 'inline'?{width:'calc(100% - 60px)'}:{}"-->
382
- <a-form-model-item
383
- :rules="rules"
384
- :ref="attr.model"
385
- :label="showLabel?attr.name:undefined"
386
- :prop="attr.prop ? attr.prop : attr.model">
387
- <a-textarea
388
- v-model="form[attr.model]"
389
- style="width: 100%;"
390
- :disabled="disabled"
391
- :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')"
392
- :rows="4"/>
393
- </a-form-model-item>
394
- </x-form-col>
395
- <!-- 文件上传 -->
396
- <x-form-col
397
- v-else-if="(attr.type === 'file' || attr.type === 'image') && show"
398
- :labelCol="labelCol"
399
- :flex="attr.flex">
400
- <a-form-model-item
401
- :rules="rules"
402
- :ref="attr.model"
403
- :label="showLabel?attr.name:undefined"
404
- :prop="attr.prop ? attr.prop : attr.model">
405
- <upload
406
- :files="files"
407
- :images="images"
408
- :model="attr"
409
- v-bind="attr"
410
- :service-name="serviceName"
411
- @setFiles="setFiles"></upload>
412
- </a-form-model-item>
413
- </x-form-col>
414
- <!-- 省市区选择框 -->
415
- <x-form-col
416
- v-else-if="attr.type === 'citySelect' && show"
417
- :labelCol="labelCol"
418
- :flex="attr.flex">
419
- <a-form-model-item
420
- :rules="rules"
421
- :ref="attr.model"
422
- :label="showLabel?attr.name:undefined"
423
- :prop="attr.prop ? attr.prop : attr.model">
424
- <citySelect
425
- @change="attr.dataChangeFunc && debouncedDataChangeFunc()"
426
- ref="citySelect"
427
- v-model="form[attr.model]"
428
- :contexts="attr.contexts"
429
- :value-type="attr.valueType"
430
- :default-value="form[attr.model]"></citySelect>
431
- </a-form-model-item>
432
- </x-form-col>
433
- <!-- 地点搜索框 -->
434
- <x-form-col
435
- v-else-if="attr.type === 'addressSearch' && show"
436
- :labelCol="labelCol"
437
- :occupyCol="attr.occupyCol"
438
- :flex="attr.flex">
439
- <a-form-model-item
440
- :rules="rules"
441
- :ref="attr.model"
442
- :label="showLabel?attr.name:undefined"
443
- :prop="attr.prop ? attr.prop : attr.model">
444
- <address-search-combobox
445
- :emitFunc="emitFunc"
446
- :attr="attr"
447
- :read-only="readOnly"
448
- v-model="searchResult"
449
- :resultKeys="{ address: attr.model, coords: `${attr.model}_lng_lat` }"
450
- ref="addressSearchCombobox"
451
- searchResultType="Object"
452
- @onSelect="addressSearchComboboxSelect"
453
- @onDivisionsChange="onDivisionsChange"
454
- ></address-search-combobox>
455
- </a-form-model-item>
456
- </x-form-col>
457
- <!-- 人员选择框 -->
458
- <x-form-col
459
- v-else-if="attr.type === 'personSetting' && show"
460
- :labelCol="labelCol"
461
- :flex="attr.flex">
462
- <a-form-model-item
463
- :rules="rules"
464
- :ref="attr.model"
465
- :label="showLabel?attr.name:undefined"
466
- :prop="attr.prop ? attr.prop : attr.model">
467
- <PersonSetting v-model="form[attr.model]"></PersonSetting>
468
- </a-form-model-item>
469
- </x-form-col>
470
- <!-- 树形选择框 -->
471
- <x-form-col
472
- v-else-if="attr.type === 'treeSelect' && show"
473
- :labelCol="labelCol"
474
- :flex="attr.flex">
475
- <x-tree-select
476
- :rules="rules"
477
- @onChange="attr.dataChangeFunc && debouncedDataChangeFunc()"
478
- v-model="form[attr.model]"
479
- :attr="attr"
480
- @mounted="itemMounted"
481
- ref="xTreeSelect">
482
- </x-tree-select>
483
- </x-form-col>
484
- <!-- 列表选择框 -->
485
- <x-form-col
486
- v-else-if="attr.type === 'listSelect' && show"
487
- :labelCol="labelCol"
488
- :flex="attr.flex">
489
- <a-form-model-item
490
- :rules="rules"
491
- :ref="attr.model"
492
- :label="showLabel?attr.name:undefined"
493
- :style="layout === 'inline'&& attr.occupyCol && attr.occupyCol > 1? {width:`calc(100% - ${attr.occupyCol * 1.533}rem)`}:{}"
494
- :prop="attr.prop ? attr.prop : attr.model">
495
- <a-popover
496
- ref="rowChoosePopover"
497
- :visible="rowChoosePopoverVisible"
498
- title="选择数据"
499
- placement="bottom"
500
- trigger="focus"
501
- :arrowPointAtCenter="true"
502
- :overlayStyle="{ width: '1000px', height: '30vh' }">
503
- <template #content>
504
- <x-report
505
- v-if="isCover"
506
- :use-oss-for-img="false"
507
- :config-name="queryParamsName"
508
- :service-name="serviceName"
509
- :show-img-in-cell="true"
510
- :display-only="true"
511
- :edit-mode="false"
512
- :show-save-button="true"
513
- :no-padding="true"
514
- :dont-format="true"
515
- @rowChoose="rowChoose"
516
- @cancel="closeRowChooseInput"
517
- >
518
- </x-report>
519
- <x-form-table
520
- v-else
521
- title="请选择数据"
522
- :queryParamsName="queryParamsName"
523
- :rowSelectMode="true"
524
- :allowSelectRowNum="1"
525
- :service-name="serviceName"
526
- :fixed-query-form="rowChooseFixedQueryValue"
527
- @rowChoose="rowChoose"
528
- @afterQuery="rowChooseSearchAfterQuery"
529
- ref="rowChooseTable">
530
- <template #button>
531
- <a-button @click="closeRowChooseInput">
532
- 关闭
533
- </a-button>
534
- </template>
535
- </x-form-table>
536
- </template>
537
- <a-input
538
- v-model="form[attr.model]"
539
- :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')"
540
- @change="searchRowChooseData"
541
- @focus="showCloseRowChooseInput"/>
542
- </a-popover>
543
- </a-form-model-item>
544
- </x-form-col>
545
- <!-- 评分框 -->
546
- <x-form-col
547
- v-else-if="attr.type === 'rate' && show"
548
- :labelCol="labelCol"
549
- :flex="attr.flex">
550
- <a-form-model-item
551
- :rules="rules"
552
- :ref="attr.model"
553
- :label="showLabel?attr.name:undefined"
554
- :prop="attr.prop ? attr.prop : attr.model">
555
- <x-rate
556
- v-model="form[attr.model]"
557
- :mode="mode"
558
- :disabled="disabled"
559
- :query-type="attr.queryType"
560
- :max-count="attr.maxCount"
561
- :allow-half="attr.allowHalf"
562
- :icon="attr.rateIcon"
563
- :placeholder="attr.placeholder ? attr.placeholder : '请选择'+attr.name.replace(/\s*/g, '')"
564
- @change="attr.dataChangeFunc && debouncedDataChangeFunc()"
565
- />
566
- </a-form-model-item>
567
- </x-form-col>
568
- <!-- 区间选择器 -->
569
- <x-form-col
570
- v-else-if="attr.type === 'intervalPicker' && show"
571
- :labelCol="labelCol"
572
- :flex="attr.flex">
573
- <a-form-model-item
574
- :rules="rules"
575
- :ref="attr.model"
576
- :label="showLabel?attr.name:undefined"
577
- :prop="attr.prop ? attr.prop : attr.model">
578
- <x-interval-picker
579
- v-model="form[attr.model]"
580
- :mode="mode"
581
- :read-only="readOnly"
582
- :disabled="disabled && !readOnly"
583
- :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')"
584
- :start-placeholder="attr.startPlaceholder || '起始值'"
585
- :end-placeholder="attr.endPlaceholder || '结束值'"
586
- @blur="attr.inputOnBlurFunc && emitFunc(attr.inputOnBlurFunc,attr)"
587
- />
588
- </a-form-model-item>
589
- </x-form-col>
590
- <!-- 车牌号选择 -->
591
- <x-form-col
592
- v-else-if="attr.type === 'licensePlate' && show"
593
- :labelCol="labelCol"
594
- :flex="attr.flex">
595
- <a-form-model-item
596
- :rules="rules"
597
- :ref="attr.model"
598
- :label="showLabel?attr.name:undefined"
599
- :style="layout === 'inline'&& attr.occupyCol && attr.occupyCol > 1? {width:`calc(100% - ${attr.occupyCol * 1.533}rem)`}:{}"
600
- :prop="attr.prop ? attr.prop : attr.model">
601
- <!-- 如果配置了后置按钮插槽 -->
602
- <a-input
603
- v-if="mode ==='查询'"
604
- v-model="form[attr.model]"
605
- :whitespace="true"
606
- :read-only="readOnly"
607
- :disabled="disabled && !readOnly"
608
- style="width:100%"
609
- @blur="attr.inputOnBlurFunc && emitFunc(attr.inputOnBlurFunc,attr)"
610
- :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')"
611
- :ref="`${attr.model}input`"/>
612
- <x-license-plate
613
- v-else
614
- v-model="form[attr.model]"
615
- @change="attr.dataChangeFunc && debouncedDataChangeFunc()"
616
- ></x-license-plate>
617
- </a-form-model-item>
618
- </x-form-col>
619
- <!-- 录音 -->
620
- <x-form-col
621
- v-else-if="attr.type === 'recording' && show"
622
- :labelCol="labelCol"
623
- :flex="attr.flex">
624
- <recording
625
- ref="recording"
626
- @recordingData="recordingData"
627
- >
628
- </recording>
629
- </x-form-col>
630
- <!-- 表格录入 -->
631
- <x-form-col
632
- v-else-if="attr.type === 'rowEdit' && show"
633
- :labelCol="labelCol"
634
- :flex="attr.flex">
635
- <a-form-model-item
636
- :rules="rules"
637
- :ref="attr.model"
638
- :label="showLabel?attr.name:undefined"
639
- :prop="attr.prop ? attr.prop : attr.model">
640
- <x-form-table
641
- :key="'childTable_' + attr.model"
642
- :title="attr.name"
643
- :queryParamsName="attr.crud"
644
- :localEditMode="true"
645
- :fixed-query-form="childTableFixedQueryForm(attr)"
646
- :service-name="serviceName"
647
- @hook:mounted="(h)=>onComponentMounted(h, attr)"
648
- :ref="'childXFormTable_' + attr.model">
649
- </x-form-table>
650
- </a-form-model-item>
651
- </x-form-col>
652
- </template>
653
- <script>
654
- import { debounce } from 'ant-design-vue/lib/vc-table/src/utils'
655
- import XFormCol from '@vue2-client/base-client/components/common/XFormCol'
656
- import XBadge from '@vue2-client/base-client/components/common/XBadge'
657
- import CitySelect from '@vue2-client/base-client/components/common/CitySelect'
658
- import PersonSetting from '@vue2-client/base-client/components/common/PersonSetting'
659
- import AddressSearchCombobox from '@vue2-client/base-client/components/common/AddressSearchCombobox'
660
- import Upload from '@vue2-client/base-client/components/common/Upload'
661
- import moment from 'moment'
662
- import { getConfigByName, runLogic, getConfigByNameAsync } from '@vue2-client/services/api/common'
663
- import * as util from '@vue2-client/utils/util'
664
- import XTreeSelect from '@vue2-client/base-client/components/common/XForm/XTreeSelect'
665
- import { searchToListOption, searchToOption } from '@vue2-client/services/v3Api'
666
- import { mapState } from 'vuex'
667
- import { executeStrFunctionByContext } from '@vue2-client/utils/runEvalFunction'
668
- import XLicensePlate from '@vue2-client/base-client/components/common/XLicensePlate/XLicensePlate.vue'
669
- import XStatusButton from './XStatusButton.vue'
670
- import XClickChangeBtn from './itemComponent/XClickChangeBtn'
671
- import 'moment/locale/zh-cn'
672
- import XFormDatePicker from '@vue2-client/base-client/components/common/XDatePicker/index.vue'
673
- import XIntervalPicker from '@vue2-client/base-client/components/common/XIntervalPicker/XIntervalPicker.vue'
674
- import XRate from '@vue2-client/base-client/components/common/XRate/index.vue'
675
-
676
- export default {
677
- name: 'XFormItem',
678
- components: {
679
- XFormDatePicker,
680
- XFormTable: () => import('@vue2-client/base-client/components/common/XFormTable/XFormTable.vue'),
681
- Recording: () => import('@vue2-client/base-client/components/common/Recording/Recording.vue'),
682
- XReport: () => import('@vue2-client/base-client/components/common/XReportGrid/XReport.vue'),
683
- XLicensePlate,
684
- XTreeSelect,
685
- XFormCol,
686
- XBadge,
687
- CitySelect,
688
- PersonSetting,
689
- AddressSearchCombobox,
690
- Upload,
691
- XStatusButton,
692
- XClickChangeBtn,
693
- XIntervalPicker,
694
- XRate
695
- },
696
- data () {
697
- // 检索去抖
698
- this.fetchFunction = debounce(this.fetchFunction, 800)
699
- return {
700
- option: [],
701
- // 最后检索版本
702
- lastFetchId: 0,
703
- // 检索中
704
- searching: false,
705
- searchResult: '',
706
- optionForFunc: [],
707
- // 控制当前表单项是否展示
708
- show: true,
709
- // moment
710
- moment,
711
- // 行选择器浮层是否显示
712
- rowChoosePopoverVisible: false,
713
- // 行选择器CRUD固定查询值
714
- rowChooseFixedQueryValue: undefined
715
- }
716
- },
717
- props: {
718
- attr: {
719
- type: Object,
720
- default:
721
- () => {
722
- return {}
723
- }
724
- },
725
- form: {
726
- type: Object,
727
- required:
728
- true
729
- },
730
- disabled: {
731
- type: Boolean,
732
- default:
733
- () => {
734
- return false
735
- }
736
- },
737
- readOnly: {
738
- type: Boolean,
739
- default:
740
- () => {
741
- return false
742
- }
743
- },
744
- mode: {
745
- type: String,
746
- default:
747
- () => {
748
- return '查询'
749
- }
750
- },
751
- files: {
752
- type: Array,
753
- default:
754
- () => {
755
- return []
756
- }
757
- },
758
- images: {
759
- type: Array,
760
- default:
761
- () => {
762
- return []
763
- }
764
- },
765
- serviceName: {
766
- type: String,
767
- default:
768
- undefined
769
- },
770
- // 调用logic获取数据源的追加参数
771
- getDataParams: {
772
- type: Object,
773
- default:
774
- undefined
775
- },
776
- // 布局
777
- layout: {
778
- type: String,
779
- default:
780
- 'horizontal'
781
- },
782
- // 环境
783
- env: {
784
- type: String,
785
- default:
786
- () => {
787
- return 'prod'
788
- }
789
- },
790
- // 设置表单值
791
- setForm: {
792
- type: Function,
793
- default: (val) => {
794
- console.log(val)
795
- }
796
- },
797
- showLabel: {
798
- type: Boolean,
799
- default:
800
- () => {
801
- return true
802
- }
803
- },
804
- labelCol: {
805
- type: Object,
806
- default: () => {
807
- return { span: 8 }
808
- }
809
- },
810
- rules: {
811
- type: Array,
812
- default:
813
- () => {
814
- return undefined
815
- }
816
- }
817
- },
818
- provide () {
819
- return {
820
- FormItemContext: this
821
- }
822
- },
823
- created () {
824
- this.init()
825
- if (this.attr.keyName && (this.attr?.keyName?.toString().indexOf('async ') !== -1 || this.attr?.keyName?.toString()?.indexOf('function') !== -1)) {
826
- this.debouncedUpdateOptions = debounce(this.updateOptions, 200)
827
- }
828
- if (this.attr.dataChangeFunc) {
829
- this.debouncedDataChangeFunc = debounce(this.dataChangeFunc, 200)
830
- // 执行一次
831
- this.dataChangeFunc()
832
- }
833
- if (this.attr.showFormItemFunc) {
834
- this.debouncedShowFormItemFunc = debounce(this.showFormItemFunc, 100)
835
- // 执行一次
836
- this.showFormItemFunc()
837
- }
838
- if (this.attr.showQueryFormItemFunc) {
839
- this.debouncedShowQueryFormItemFunc = debounce(this.showQueryFormItemFunc, 100)
840
- // 执行一次
841
- this.showFormItemFunc()
842
- }
843
- // 人员联动框增加监听
844
- if (this?.attr?.keyName?.toString()?.startsWith('search@根据表单项[') && this?.attr?.keyName?.toString().endsWith(']联动人员')) {
845
- this.debouncedUserLinkFunc = debounce(() => this.updateResOptions('人员'), 200)
846
- }
847
- if (this?.attr?.keyName?.toString()?.startsWith('search@根据表单项[') && this?.attr?.keyName?.toString().endsWith(']联动部门')) {
848
- this.debouncedDepLinkFunc = debounce(() => this.updateResOptions('部门'), 200)
849
- }
850
- // xTreeSelect 自己调用 mounted
851
- if (this.attr.type !== 'treeSelect') {
852
- this.$emit('mounted', this.attr)
853
- }
854
- },
855
- computed: {
856
- ...mapState('account', { currUser: 'user' }),
857
- queryParamsName () {
858
- if (this.attr.keyName.startsWith('function')) {
859
- // 调用异步函数获取内容
860
- return executeStrFunctionByContext(this, this.attr.keyName, [this.form, runLogic, this.mode, getConfigByNameAsync])
861
- } else {
862
- // 按现有方式处理
863
- return this.attr.keyName.split('@')[this.attr.keyName.split('@').length - 1]
864
- }
865
- },
866
- // 判断弹出时是否Cover,弹出只支持Cover以及CRUD
867
- isCover () {
868
- // 如果 queryParamsName 为空,返回空
869
- if (!this.queryParamsName) {
870
- return false
871
- }
872
- const result = this.queryParamsName.endsWith('Cover')
873
- return result
874
- },
875
- },
876
- watch: {
877
- attr: {
878
- handler () {
879
- this.init()
880
- },
881
- deep: true
882
- },
883
- form: {
884
- handler (newVal, oldVal) {
885
- // 如果是从函数获取 options
886
- if (this.attr.keyName && (this.attr.keyName.toString().indexOf('async ') !== -1 || this.attr.keyName.toString().indexOf('function') !== -1)) {
887
- this.debouncedUpdateOptions()
888
- }
889
- // 如果有自定义是否展示表单项函数
890
- if (this.attr.showFormItemFunc) {
891
- this.debouncedShowFormItemFunc()
892
- }
893
- // 如果有自定义是否展示查询表单项函数
894
- if (this.attr.showQueryFormItemFunc) {
895
- this.debouncedShowQueryFormItemFunc()
896
- }
897
- // 地址搜索框赋值
898
- if (this.attr.type === 'addressSearch') {
899
- this.$refs.addressSearchCombobox.addressInput = this.form[this.attr.model]
900
- }
901
- // 数据源来自人员联动时更新数据
902
- if (this?.attr?.keyName?.toString()?.startsWith('search@根据表单项[') && this?.attr?.keyName?.toString().endsWith(']联动人员')) {
903
- this.debouncedUserLinkFunc()
904
- }
905
- // 数据源来自人员联动时更新数据
906
- if (this?.attr?.keyName?.toString()?.startsWith('search@根据表单项[') && this?.attr?.keyName?.toString().endsWith(']联动部门')) {
907
- this.debouncedDepLinkFunc()
908
- }
909
- },
910
- deep: true
911
- }
912
- },
913
- inject: {
914
- getComponentByName: {
915
- default: () => () => {
916
- console.warn('getComponentByName is not provided')
917
- return null // 或者返回一个默认的函数
918
- },
919
- },
920
- registerComponent: {
921
- default: () => () => {
922
- console.warn('registerComponent is not provided')
923
- return null // 或者返回一个默认的函数
924
- },
925
- },
926
- getSelf: {
927
- default: () => () => {
928
- console.warn('getSelf is not provided')
929
- return null // 或者返回一个默认的函数
930
- },
931
- },
932
- XFormContext: {
933
- default: () => () => {
934
- console.warn('XFormContext is not provided')
935
- return null // 或者返回一个默认的函数
936
- },
937
- },
938
- setRequired: {
939
- default: () => () => {
940
- console.warn('setRequired is not provided')
941
- return null // 或者返回一个默认的函数
942
- },
943
- },
944
- removeRequired: {
945
- default: () => () => {
946
- console.warn('removeRequired is not provided')
947
- return null // 或者返回一个默认的函数
948
- },
949
- }
950
- },
951
- methods: {
952
- // 把内部的crud表单录入放到表单中,以便外部可以调用
953
- onComponentMounted (h, attr) {
954
- console.log('crud表单', h)
955
- if (attr.crud) {
956
- this.registerComponent(attr.model, this.$refs['childXFormTable_' + attr.model])
957
- }
958
- },
959
- childTableFixedQueryForm (item) {
960
- console.log('传递的form', this.form)
961
- if (this.modifyModelData?.primaryKeyData) {
962
- const fixedForm = {}
963
- fixedForm[item.childTableForeignKeyName] = Object.values(this.modifyModelData.primaryKeyData)[0]
964
- return fixedForm
965
- }
966
- return null
967
- },
968
- // 动态生成事件绑定对象
969
- generateDynamicEvents (inputOnAfterFunc, attr) {
970
- const events = {}
971
- const states = this.parseStates(attr.inputOnAfterName, inputOnAfterFunc)
972
-
973
- states.forEach((state) => {
974
- // 动态绑定事件名到 emitFunc
975
- events[state.event] = () => {
976
- console.info('事件名', state.event)
977
- this.emitFunc(state.event, attr)
978
- }
979
- })
980
-
981
- return events // 返回 { state1Event: handler, state2Event: handler, ... }
982
- },
983
- parseStates (input, events) {
984
- const eventNames = events.split('|')
985
- return input.split('|').map((label, index) => ({
986
- label,
987
- event: eventNames[index] // 如果没有提供事件名称,则使用默认值
988
- }))
989
- },
990
- focusInput () {
991
- if (this.attr.defaultFocus) {
992
- this.$nextTick(h => {
993
- const el = this.$refs[`${this.attr.model}input`]?.$el
994
- let inputEl
995
- if (el) {
996
- if (el.tagName.toLowerCase() === 'input') {
997
- inputEl = el
998
- } else {
999
- inputEl = el.querySelector('input')
1000
- }
1001
- }
1002
- if (inputEl) {
1003
- inputEl.focus()
1004
- if (inputEl.type === 'number') {
1005
- if (inputEl.valueAsNumber) {
1006
- inputEl.setSelectionRange(0, inputEl.valueAsNumber.toString().length)
1007
- }
1008
- } else {
1009
- if (inputEl.value) {
1010
- inputEl.setSelectionRange(0, inputEl.value.length)
1011
- }
1012
- }
1013
- }
1014
- })
1015
- }
1016
- },
1017
- // 更新人员下拉框数据
1018
- async updateResOptions (type) {
1019
- if (this?.attr?.keyName?.toString()?.startsWith('search@根据表单项[') && this?.attr?.keyName?.toString()?.endsWith(`]联动${type}`)) {
1020
- const startIndex = this.attr.keyName.indexOf('[') + 1
1021
- const endIndex = this.attr.keyName.indexOf(']', startIndex)
1022
- const fromModel = this.attr.keyName.substring(startIndex, endIndex).replace('.', '_')
1023
- const formModelData = Array.isArray(this.form[fromModel])
1024
- ? this.form[fromModel]
1025
- : [this.form[fromModel]]
1026
- if (fromModel?.length && formModelData?.length) {
1027
- const searchData = { source: `获取${type}`, userid: this.currUser.id, filter: formModelData, filterType: fromModel.indexOf('org') > -1 ? 'org' : 'dep' }
1028
- await searchToListOption(searchData, res => {
1029
- this.getDataCallback(
1030
- res.filter(h => {
1031
- if (fromModel.indexOf('org') > -1) {
1032
- return formModelData?.includes(h.orgid || h.f_organization_id || h.parentid)
1033
- } else {
1034
- return formModelData?.includes(h?.parentid)
1035
- }
1036
- }
1037
- )
1038
- )
1039
- })
1040
- }
1041
- }
1042
- },
1043
- // js 函数作为数据源
1044
- async updateOptions () {
1045
- if (this.attr.keyName && (this.attr.keyName.indexOf('async ') !== -1 || this.attr.keyName.indexOf('function ') !== -1)) {
1046
- this.optionForFunc = await executeStrFunctionByContext(this, this.attr.keyName, [this.form, runLogic, this.mode, getConfigByNameAsync])
1047
- }
1048
- },
1049
- async dataChangeFunc () {
1050
- if (this.attr.dataChangeFunc) {
1051
- await executeStrFunctionByContext(this, this.attr.dataChangeFunc, [this.form, this.setForm, this.attr, util, this.mode, runLogic, getConfigByNameAsync])
1052
- }
1053
- },
1054
- async showFormItemFunc () {
1055
- if (this.attr.showFormItemFunc) {
1056
- const obj = executeStrFunctionByContext(this, this.attr.showFormItemFunc, [this.form, this.setForm, this.attr, util, this.mode])
1057
- // 判断是 bool 还是 obj 兼容
1058
- if (typeof obj === 'boolean') {
1059
- this.show = obj
1060
- } else if (obj && typeof obj === 'object') {
1061
- // obj 是一个对象,并且不是数组
1062
- this.show = obj?.show
1063
- this.readOnly = obj?.readOnly
1064
- }
1065
- } else {
1066
- this.show = true
1067
- }
1068
- },
1069
- async showQueryFormItemFunc () {
1070
- if (this.attr.showQueryFormItemFunc) {
1071
- const obj = executeStrFunctionByContext(this, this.attr.showQueryFormItemFunc, [this.form, this.setForm, this.attr, util, this.mode])
1072
- // 判断是 bool 还是 obj 兼容
1073
- if (typeof obj === 'boolean') {
1074
- this.show = obj
1075
- } else if (obj && typeof obj === 'object') {
1076
- // obj 是一个对象,并且不是数组
1077
- this.show = obj?.show
1078
- this.readOnly = obj?.readOnly
1079
- }
1080
- } else {
1081
- this.show = true
1082
- }
1083
- },
1084
- init () {
1085
- if (!this.attr.flex) {
1086
- if (this.mode === '新增/修改') {
1087
- if (['horizontal', 'vertical'].includes(this.layout) || ['textarea', 'file', 'image'].includes(this.attr.type)) {
1088
- // 新增修改表单 horizontal 模式下默认为一行
1089
- this.attr.flex = {
1090
- xs: 24,
1091
- sm: 24,
1092
- md: 24,
1093
- lg: 24,
1094
- xl: 24,
1095
- xxl: 24,
1096
- fullWidth: true
1097
- }
1098
- } else {
1099
- // 新增修改表单 vertical 模式下默认为1列
1100
- this.attr.flex = {
1101
- xs: 24,
1102
- sm: 12,
1103
- md: 8,
1104
- lg: 8,
1105
- xl: 6,
1106
- xxl: 6
1107
- }
1108
- }
1109
- } else {
1110
- this.attr.flex = {
1111
- xs: 24,
1112
- sm: 24,
1113
- md: 8,
1114
- lg: 6,
1115
- xl: 6,
1116
- xxl: 6
1117
- }
1118
- }
1119
- }
1120
- if (this.attr.keyName && typeof this.attr.keyName === 'string') {
1121
- if (this.attr.keyName.indexOf('logic@') !== -1) {
1122
- this.getData({}, res => this.getDataCallback(res))
1123
- } else if (this.attr.keyName.indexOf('search@') !== -1) {
1124
- // `tool.getFullTree(this.getRights().where(row.getType()==$organization$))`
1125
- // 判断是否根据角色查询
1126
- let source = this.attr.keyName.substring(7)
1127
- const userid = this.currUser.id
1128
- let roleName = 'roleName'
1129
- if (source.startsWith('根据角色[') && source.endsWith(']获取人员')) {
1130
- const startIndex = source.indexOf('[') + 1
1131
- const endIndex = source.indexOf(']', startIndex)
1132
- roleName = source.substring(startIndex, endIndex)
1133
- source = '根据角色获取人员'
1134
- }
1135
- const searchData = { source, userid, roleName }
1136
- // 判断是否根据某个表单项联动 仅返回列表结构并筛选
1137
- if (source.startsWith('根据表单项[') && source.endsWith(']联动人员')) {
1138
- this.updateResOptions('人员')
1139
- } else if (source.startsWith('根据表单项[') && source.endsWith(']联动部门')) {
1140
- this.updateResOptions('部门')
1141
- } else if (this.attr.type === 'select' || this.attr.type === 'checkbox') {
1142
- // 仅获取最内层数据
1143
- searchToListOption(searchData, res => this.getDataCallback(res))
1144
- } else {
1145
- // 其他资源通用逻辑
1146
- searchToOption(searchData, res => this.getDataCallback(res))
1147
- }
1148
- } else if (this.attr.keyName.indexOf('config@') !== -1) {
1149
- const configName = this.attr.keyName.substring(7)
1150
- getConfigByName(configName, this.serviceName, res => {
1151
- this.getDataCallback(res.value)
1152
- }, this.env === 'dev')
1153
- } else if (this.attr.keyName.indexOf('async ') !== -1 || this.attr.keyName.indexOf('function ') !== -1) {
1154
- this.updateOptions()
1155
- }
1156
- } else if (this.attr.keys) {
1157
- this.getDataCallback(this.attr.keys)
1158
- }
1159
- this.focusInput()
1160
- },
1161
- addressSearchComboboxSelect (data) {
1162
- this.form = Object.assign(this.form, JSON.parse(data))
1163
- },
1164
- onDivisionsChange (data) {
1165
- this.emitFunc('addressSearchComboboxSelect', {
1166
- key: this.attr.model,
1167
- value: data
1168
- })
1169
- },
1170
- getDataCallback (res) {
1171
- this.option = res
1172
- if (this.attr.type === 'treeSelect') {
1173
- this.$nextTick(() => {
1174
- this.$refs.xTreeSelect.init({
1175
- option: this.option,
1176
- form: this.form,
1177
- queryType: this.attr.queryType,
1178
- name: this.attr.name,
1179
- model: this.attr.model,
1180
- mode: this.mode,
1181
- disabled: this.disabled
1182
- })
1183
- })
1184
- } else if (this.attr.type === 'radio' || ['radioGroup', 'clickChange'].includes(this.attr.showMode)) {
1185
- this.initRadioValue()
1186
- }
1187
- },
1188
- initRadioValue () {
1189
- const model = this.attr.model
1190
- if (this.mode === '新增/修改' && (this.form[model] === undefined || this.form[model] === null) && !this.attr.prop) {
1191
- if (this.attr.keys && this.attr.keys.length > 1) {
1192
- this.form[model] = this.attr.keys[0].value
1193
- } else if (this.option.length > 1) {
1194
- this.form[model] = this.option[0].value
1195
- }
1196
- }
1197
- },
1198
- // 文件框时设置上传组件的值
1199
- setFiles (fileIds) {
1200
- if (!this.form[this.attr.model]) {
1201
- this.form[this.attr.model] = []
1202
- }
1203
- this.form[this.attr.model] = [...fileIds]
1204
- },
1205
- // 懒加载检索方法
1206
- fetchFunction (value) {
1207
- this.lastFetchId += 1
1208
- const fetchId = this.lastFetchId
1209
- this.option = []
1210
- this.searching = true
1211
- this.getData({
1212
- word: value
1213
- }, res => {
1214
- if (fetchId !== this.lastFetchId) {
1215
- return
1216
- }
1217
- this.option = res
1218
- this.searching = false
1219
- })
1220
- },
1221
- // 获取数据
1222
- getData (value, callbackFun) {
1223
- if (value !== '') {
1224
- const logicName = this.attr.keyName
1225
- const logic = logicName.substring(6)
1226
- // 调用logic前设置参数
1227
- if (this.getDataParams && this.getDataParams[this.attr.model]) {
1228
- Object.assign(value, this.getDataParams[this.attr.model])
1229
- }
1230
- runLogic(logic, Object.assign(value, {
1231
- orgId: this.currUser.orgid,
1232
- userId: this.currUser.id
1233
- }), this.serviceName, this.env === 'dev').then(res => {
1234
- callbackFun(res)
1235
- }).catch(e => {
1236
- callbackFun([])
1237
- console.error('获取数据失败:' + e)
1238
- })
1239
- }
1240
- },
1241
- filterOption (input, option) {
1242
- const child = option.componentOptions.children[0]
1243
- if (child.text) {
1244
- return child.text.toLowerCase().indexOf(input.toLowerCase()) >= 0
1245
- } else if (child.elm.innerText) {
1246
- return child.elm.innerText.toLowerCase().indexOf(input.toLowerCase()) >= 0
1247
- } else {
1248
- return child.child.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
1249
- }
1250
- },
1251
- // 表单项变更函数中调用 控制表单组中表单项组名为 groupName 的表单是否展示
1252
- // func:x-form-show(显示)/x-form-no-show(不显示)
1253
- emitShowFormFunc (func, groupName) {
1254
- this.emitFunc(func, groupName)
1255
- },
1256
- emitFunc (func, data) {
1257
- this.$emit('x-form-item-emit-func', func, data, data?.model ? this.form[data.model] : this.form)
1258
- },
1259
- itemMounted (h) {
1260
- this.$emit('mounted', h)
1261
- },
1262
- rowChoose (rows) {
1263
- this.$emit('rowChoose', rows, this.attr, this.closeRowChooseInput)
1264
- },
1265
- searchRowChooseData () {
1266
- if (this.searching) {
1267
- return
1268
- }
1269
- this.lastFetchId += 1
1270
- const fetchId = this.lastFetchId
1271
- this.searching = true
1272
- if (fetchId !== this.lastFetchId) {
1273
- return
1274
- }
1275
- this.rowChooseFixedQueryValue = []
1276
- this.rowChooseFixedQueryValue[this.attr.model] = this.form[this.attr.model]
1277
- this.$nextTick(() => {
1278
- this.$refs.rowChooseTable.refresh(true)
1279
- })
1280
- },
1281
- showCloseRowChooseInput () {
1282
- this.rowChoosePopoverVisible = true
1283
- },
1284
- closeRowChooseInput () {
1285
- this.rowChoosePopoverVisible = false
1286
- },
1287
- rowChooseSearchAfterQuery () {
1288
- this.searching = false
1289
- },
1290
- // 获取 recording 转换后的数据
1291
- getRecodingData () {
1292
- return this.$refs.recording.getRecordingData()
1293
- },
1294
- recordingData (data) {
1295
- this.emitFunc('recordingData', data)
1296
- },
1297
- getPopupContainer (triggerNode) {
1298
- return document.body
1299
- // return triggerNode.parentNode
1300
- },
1301
- }
1302
- }
1303
- </script>
1304
-
1305
- <style lang="less" scoped>
1306
- .custom-dropdown {
1307
- position: absolute;
1308
- z-index: 1050;
1309
- }
1310
- </style>
1
+ <template>
2
+ <!-- 输入框 -->
3
+ <x-form-col
4
+ v-if="attr.type === 'input' && show"
5
+ :occupyCol="attr.occupyCol"
6
+ :labelCol="labelCol"
7
+ :flex="attr.flex">
8
+ <a-form-model-item
9
+ :rules="rules"
10
+ :ref="attr.model"
11
+ :label="showLabel?attr.name:undefined"
12
+ :prop="attr.prop ? attr.prop : attr.model">
13
+ <!-- 如果配置了后置按钮插槽 -->
14
+ <a-input-group
15
+ v-if="((attr.inputOnAfterName && attr.inputOnAfterFunc) || (attr.inputOnAfterIcon && attr.inputOnAfterIconFunc)) && mode !== '查询'"
16
+ style="display: flex; width: 100%; padding: 4px 0"
17
+ compact>
18
+ <a-input
19
+ v-model="form[attr.model]"
20
+ :read-only="readOnly"
21
+ :disabled="disabled && !readOnly"
22
+ :whitespace="true"
23
+ @input="attr.dataChangeFunc && debouncedDataChangeFunc()"
24
+ :suffix="attr.inputSuffix && mode !== '新增' ? attr.inputSuffix : ''"
25
+ @blur="mode !== '查询' && attr.inputOnBlurFunc && emitFunc(attr.inputOnBlurFunc,attr)"
26
+ @keyup.enter="mode !== '查询' && attr.inputOnEnterFunc && emitFunc(attr.inputOnEnterFunc, attr)"
27
+ :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')"
28
+ :ref="`${attr.model}input`"/>
29
+ <a-button
30
+ v-if="attr.inputOnAfterName && attr.inputOnAfterFunc && !attr.inputOnAfterName.includes('|')"
31
+ style="width: auto; min-width: 4rem;max-width: 6rem"
32
+ type="primary"
33
+ @click="emitFunc(attr.inputOnAfterFunc,attr)">
34
+ {{ attr.inputOnAfterName }}
35
+ </a-button>
36
+ <!-- 仅可以配置 一个按钮 以及 一个图标插槽 -->
37
+ <a-button
38
+ style="width: 2rem; flex-shrink: 0;"
39
+ v-else-if="attr.inputOnAfterIcon"
40
+ :type="attr.inputOnAfterIcon && attr.inputOnAfterName ? 'primary' :''"
41
+ :icon="attr.inputOnAfterIcon || 'question'"
42
+ @click="emitFunc(attr.inputOnAfterIconFunc,attr)">
43
+ </a-button>
44
+ <!-- 状态按钮 -->
45
+ <x-status-button
46
+ v-else
47
+ :states="parseStates(attr.inputOnAfterName, attr.inputOnAfterFunc)"
48
+ v-on="generateDynamicEvents(attr.inputOnAfterFunc, attr)"
49
+ style="width: auto; min-width: 4rem; max-width: 6rem"
50
+ />
51
+ </a-input-group>
52
+ <a-input-number
53
+ v-else-if="attr.numberInput && !readOnly"
54
+ v-model="form[attr.model]"
55
+ :whitespace="true"
56
+ @change="attr.dataChangeFunc && debouncedDataChangeFunc()"
57
+ :disabled="disabled && !readOnly"
58
+ style="width:100%"
59
+ @blur="mode !== '查询' && attr.inputOnBlurFunc && emitFunc(attr.inputOnBlurFunc,attr)"
60
+ @keyup.enter="mode !== '查询' && attr.inputOnEnterFunc && emitFunc(attr.inputOnEnterFunc, attr)"
61
+ :suffix="attr.inputSuffix && mode !== '新增' ? attr.inputSuffix : ''"
62
+ :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')"
63
+ :ref="`${attr.model}input`"/>
64
+ <a-input
65
+ v-else
66
+ v-model="form[attr.model]"
67
+ :whitespace="true"
68
+ :read-only="readOnly"
69
+ :disabled="disabled && !readOnly"
70
+ @input="attr.dataChangeFunc && debouncedDataChangeFunc()"
71
+ :suffix="attr.inputSuffix && mode !== '新增' ? attr.inputSuffix : ''"
72
+ style="width:100%"
73
+ @blur="mode !== '查询' && attr.inputOnBlurFunc && emitFunc(attr.inputOnBlurFunc,attr)"
74
+ @keyup.enter="mode !== '查询' && attr.inputOnEnterFunc && emitFunc(attr.inputOnEnterFunc, attr)"
75
+ :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')"
76
+ :ref="`${attr.model}input`"/>
77
+ </a-form-model-item>
78
+ </x-form-col>
79
+ <!-- 下拉框 -->
80
+ <x-form-col
81
+ v-else-if="attr.type === 'select' && show"
82
+ :labelCol="labelCol"
83
+ :flex="attr.flex">
84
+ <a-form-model-item
85
+ :rules="rules"
86
+ v-if="!attr.showMode || mode === '查询' || attr.showMode === 'select' "
87
+ :ref="attr.model"
88
+ :label="showLabel?attr.name:undefined"
89
+ :prop="attr.prop ? attr.prop : attr.model">
90
+ <!-- <span slot="label" class="label-box">{{ showLabel?attr.name:undefined }}</span>-->
91
+ <a-select
92
+ v-if="!attr.lazyLoad || attr.lazyLoad === 'false'"
93
+ v-model="form[attr.model]"
94
+ :disabled="disabled"
95
+ @change="attr.dataChangeFunc && debouncedDataChangeFunc()"
96
+ :filter-option="filterOption"
97
+ :getPopupContainer="getPopupContainer"
98
+ dropdownClassName="custom-dropdown"
99
+ :dropdownMatchSelectWidth="false"
100
+ :dropdownStyle="{ position: 'absolute'}"
101
+ :placeholder="attr.placeholder ? attr.placeholder : '请选择'"
102
+ show-search
103
+ >
104
+ <a-select-option
105
+ v-if="mode === '查询'"
106
+ key="999999"
107
+ value="">全部
108
+ </a-select-option>
109
+ <template v-if="attr.keys">
110
+ <a-select-option
111
+ v-for="(item,index) in attr.keys"
112
+ :key="index.value"
113
+ :value="item.value + ''">
114
+ {{ item.label }}
115
+ </a-select-option>
116
+ </template>
117
+ <template v-else>
118
+ <template
119
+ v-if="attr.keyName.indexOf('logic@') !== -1 || attr.keyName.indexOf('config@') !== -1
120
+ ||attr.keyName.indexOf('search@') !== -1 || attr.keyName.indexOf('search@') !== -1">
121
+ <a-select-option
122
+ v-for="(item,index) in option"
123
+ :key="index.value"
124
+ :value="item.value + ''">
125
+ <template v-if="attr.keyName.indexOf('config@') !== -1 && item.status">
126
+ <!-- 徽标(badge) -->
127
+ <a-badge v-if="item.status !== 'gary'" :color="item.status" :text="item.label"/>
128
+ <a-badge v-else color="#D9D9D9" :text="item.label"/>
129
+ </template>
130
+ <template v-else>
131
+ {{ item.label }}
132
+ </template>
133
+ </a-select-option>
134
+ </template>
135
+ <template
136
+ v-else-if="attr.keyName.indexOf('async ') !== -1 || attr.keyName.indexOf('function ') !== -1">
137
+ <a-select-option
138
+ v-for="(item,index) in optionForFunc"
139
+ :key="index.value"
140
+ :value="item.value + ''">
141
+ <template>
142
+ {{ item.label }}
143
+ </template>
144
+ </a-select-option>
145
+ </template>
146
+ <template v-else>
147
+ <a-select-option
148
+ v-for="item in $appdata.getDictionaryList(attr.keyName)"
149
+ :key="item.value"
150
+ :value="item.value + ''">
151
+ <!-- 徽标(badge) -->
152
+ <x-badge
153
+ :badge-key="attr.keyName"
154
+ :replaceText="item.text"
155
+ :value="item.value"
156
+ :service-name="serviceName"
157
+ :env="env"/>
158
+ </a-select-option>
159
+ </template>
160
+ </template>
161
+ </a-select>
162
+ <a-select
163
+ v-else
164
+ v-model="form[attr.model]"
165
+ :disabled="disabled"
166
+ @change="attr.dataChangeFunc && debouncedDataChangeFunc()"
167
+ :filter-option="filterOption"
168
+ :getPopupContainer="getPopupContainer"
169
+ dropdownClassName="custom-dropdown"
170
+ :dropdownMatchSelectWidth="false"
171
+ :dropdownStyle="{ position: 'absolute'}"
172
+ :placeholder="attr.placeholder ? attr.placeholder : '搜索' + attr.name"
173
+ show-search
174
+ @search="fetchFunction"
175
+ >
176
+ <template #notFoundContent>
177
+ <a-spin v-if="searching" size="small"/>
178
+ </template>
179
+ <a-select-option
180
+ v-if="mode === '查询'"
181
+ key="999999"
182
+ value="">全部
183
+ </a-select-option>
184
+ <a-select-option
185
+ v-for="(item,index) in option"
186
+ :key="index"
187
+ :value="item.value + ''">{{ item.label }}
188
+ </a-select-option>
189
+ </a-select>
190
+ </a-form-model-item>
191
+ <a-form-model-item
192
+ :rules="rules"
193
+ v-else-if="attr.showMode === 'radioGroup'"
194
+ :ref="attr.model"
195
+ :label="showLabel?attr.name:undefined"
196
+ :prop="attr.prop ? attr.prop : attr.model">
197
+ <a-radio-group v-model="form[attr.model]">
198
+ <a-radio-button v-for="modeItem in option" :key="modeItem.value" :value="modeItem.value">
199
+ {{ modeItem.label }}
200
+ </a-radio-button>
201
+ </a-radio-group>
202
+ </a-form-model-item>
203
+ <a-form-model-item
204
+ v-else-if="attr.showMode === 'clickChange' && option.length > 0"
205
+ :ref="attr.model"
206
+ :label="showLabel?attr.name:undefined"
207
+ :prop="attr.prop ? attr.prop : attr.model">
208
+ <XClickChangeBtn></XClickChangeBtn>
209
+ </a-form-model-item>
210
+ </x-form-col>
211
+ <!-- 多选框 -->
212
+ <x-form-col
213
+ v-else-if="attr.type === 'checkbox' && show"
214
+ :labelCol="labelCol"
215
+ :flex="attr.flex">
216
+ <a-form-model-item
217
+ :rules="rules"
218
+ v-if="!attr.showMode || mode === '查询' || attr.showMode === 'select' "
219
+ :ref="attr.model"
220
+ :label="showLabel?attr.name:undefined"
221
+ :prop="attr.prop ? attr.prop : attr.model">
222
+ <a-select
223
+ style="width:100%"
224
+ v-if="!attr.lazyLoad || attr.lazyLoad === 'false'"
225
+ v-model="form[attr.model]"
226
+ :disabled="disabled"
227
+ :filter-option="filterOption"
228
+ :getPopupContainer="getPopupContainer"
229
+ :placeholder="attr.placeholder ? attr.placeholder : '请选择'"
230
+ @change="attr.dataChangeFunc && debouncedDataChangeFunc()"
231
+ mode="multiple"
232
+ show-search
233
+ allowClear
234
+ >
235
+ <template v-if="attr.keys">
236
+ <a-select-option
237
+ v-for="(item,index) in attr.keys"
238
+ :key="index"
239
+ :value="item.value + ''">
240
+ {{ item.label }}
241
+ </a-select-option>
242
+ </template>
243
+ <template v-else>
244
+ <template
245
+ v-if="attr.keyName.indexOf('logic@') !== -1 || attr.keyName.indexOf('config@') !== -1
246
+ ||attr.keyName.indexOf('search@') !== -1 || attr.keyName.indexOf('search@') !== -1">
247
+ <a-select-option
248
+ v-for="(item,index) in option"
249
+ :key="index"
250
+ :value="item.value">{{ item.label }}
251
+ </a-select-option>
252
+ </template>
253
+ <template v-else>
254
+ <a-select-option
255
+ v-for="item in $appdata.getDictionaryList(attr.keyName)"
256
+ :key="item.value"
257
+ :value="item.value + ''">{{ item.text }}
258
+ </a-select-option>
259
+ </template>
260
+ </template>
261
+ </a-select>
262
+ <a-select
263
+ v-else
264
+ v-model="form[attr.model]"
265
+ :disabled="disabled"
266
+ :filter-option="filterOption"
267
+ :getPopupContainer="getPopupContainer"
268
+ :placeholder="attr.placeholder ? attr.placeholder : '搜索' + attr.name"
269
+ mode="multiple"
270
+ style="width:100%"
271
+ @change="attr.dataChangeFunc && debouncedDataChangeFunc()"
272
+ show-search
273
+ allowClear
274
+ @search="fetchFunction"
275
+ >
276
+ <template #notFoundContent>
277
+ <a-spin v-if="searching" size="small"/>
278
+ </template>
279
+ <a-select-option
280
+ v-for="(item,index) in option"
281
+ :key="index"
282
+ :value="item.value + ''">{{ item.label }}
283
+ </a-select-option>
284
+ </a-select>
285
+ </a-form-model-item>
286
+ <a-form-model-item
287
+ :rules="rules"
288
+ v-else
289
+ :ref="attr.model"
290
+ :label="showLabel?attr.name:undefined"
291
+ :prop="attr.prop ? attr.prop : attr.model">
292
+ <a-checkbox-group
293
+ v-model="form[attr.model]"
294
+ :options="option"
295
+ @change="attr.dataChangeFunc && debouncedDataChangeFunc()"
296
+ />
297
+ </a-form-model-item>
298
+ </x-form-col>
299
+ <!-- 单选框 -->
300
+ <x-form-col
301
+ v-else-if="attr.type === 'radio' && show"
302
+ :labelCol="labelCol"
303
+ :flex="attr.flex">
304
+ <a-form-model-item
305
+ :rules="rules"
306
+ v-if="!attr.showMode || attr.type === 'radio' "
307
+ :ref="attr.model"
308
+ :label="showLabel?attr.name:undefined"
309
+ :prop="attr.prop ? attr.prop : attr.model">
310
+ <a-radio-group
311
+ v-model="form[attr.model]"
312
+ @change="attr.dataChangeFunc && debouncedDataChangeFunc()"
313
+ >
314
+ <template v-if="attr.keys">
315
+ <a-radio v-for="(item,index) in attr.keys" :key="index" :value="item.value">
316
+ {{ item.label }}
317
+ </a-radio>
318
+ </template>
319
+ <template v-else>
320
+ <template
321
+ v-if="attr.keyName.indexOf('logic@') !== -1 || attr.keyName.indexOf('config@') !== -1
322
+ ||attr.keyName.indexOf('search@') !== -1 || attr.keyName.indexOf('search@') !== -1">
323
+ <a-radio v-for="(item,index) in option" :key="index" :value="item.value">
324
+ {{ item.label }}
325
+ </a-radio>
326
+ </template>
327
+ <template v-else>
328
+ <a-radio v-for="(item,index) in $appdata.getDictionaryList(attr.keyName)" :key="index" :value="item.value">
329
+ {{ item.text }}
330
+ </a-radio>
331
+ </template>
332
+ </template>
333
+ </a-radio-group>
334
+ </a-form-model-item>
335
+ <a-form-model-item
336
+ :rules="rules"
337
+ v-else-if="attr.showMode === 'radioGroup'"
338
+ :ref="attr.model"
339
+ :label="showLabel?attr.name:undefined"
340
+ :prop="attr.prop ? attr.prop : attr.model">
341
+ <a-radio-group v-model="form[attr.model]">
342
+ <a-radio-button v-for="modeItem in option" :key="modeItem.value" :value="modeItem.value">
343
+ {{ modeItem.label }}
344
+ </a-radio-button>
345
+ </a-radio-group>
346
+ </a-form-model-item>
347
+ <a-form-model-item
348
+ :rules="rules"
349
+ v-else-if="attr.showMode === 'clickChange' && option.length > 0"
350
+ :ref="attr.model"
351
+ :label="showLabel?attr.name:undefined"
352
+ :prop="attr.prop ? attr.prop : attr.model">
353
+ <XClickChangeBtn></XClickChangeBtn>
354
+ </a-form-model-item>
355
+ </x-form-col>
356
+ <!-- 时间 日期 框整合 -->
357
+ <x-form-col
358
+ v-else-if="['datePicker', 'rangePicker', 'yearPicker', 'monthPicker', 'yearRangePicker', 'monthRangePicker'].includes(attr.type) && show"
359
+ :labelCol="labelCol"
360
+ :flex="attr.flex">
361
+ <a-form-model-item
362
+ :rules="rules"
363
+ :ref="attr.model"
364
+ :label="showLabel?attr.name:undefined"
365
+ :prop="attr.prop ? attr.prop : attr.model">
366
+ <XFormDatePicker
367
+ :attr="attr"
368
+ :mode="mode"
369
+ :disabled="disabled"
370
+ :readOnly="readOnly"
371
+ :showLabel="showLabel"
372
+ @change="attr.dataChangeFunc && debouncedDataChangeFunc()"
373
+ v-model="form[attr.model]"/>
374
+ </a-form-model-item>
375
+ </x-form-col>
376
+ <!-- 文本域 -->
377
+ <x-form-col
378
+ v-else-if="attr.type === 'textarea' && show"
379
+ :labelCol="labelCol"
380
+ :flex="attr.flex">
381
+ <!-- :style="layout === 'inline'?{width:'calc(100% - 60px)'}:{}"-->
382
+ <a-form-model-item
383
+ :rules="rules"
384
+ :ref="attr.model"
385
+ :label="showLabel?attr.name:undefined"
386
+ :prop="attr.prop ? attr.prop : attr.model">
387
+ <a-textarea
388
+ v-model="form[attr.model]"
389
+ style="width: 100%;"
390
+ :disabled="disabled"
391
+ :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')"
392
+ :rows="4"/>
393
+ </a-form-model-item>
394
+ </x-form-col>
395
+ <!-- 文件上传 -->
396
+ <x-form-col
397
+ v-else-if="(attr.type === 'file' || attr.type === 'image') && show"
398
+ :labelCol="labelCol"
399
+ :flex="attr.flex">
400
+ <a-form-model-item
401
+ :rules="rules"
402
+ :ref="attr.model"
403
+ :label="showLabel?attr.name:undefined"
404
+ :prop="attr.prop ? attr.prop : attr.model">
405
+ <upload
406
+ :files="files"
407
+ :images="images"
408
+ :model="attr"
409
+ v-bind="attr"
410
+ :service-name="serviceName"
411
+ @setFiles="setFiles"></upload>
412
+ </a-form-model-item>
413
+ </x-form-col>
414
+ <!-- 省市区选择框 -->
415
+ <x-form-col
416
+ v-else-if="attr.type === 'citySelect' && show"
417
+ :labelCol="labelCol"
418
+ :flex="attr.flex">
419
+ <a-form-model-item
420
+ :rules="rules"
421
+ :ref="attr.model"
422
+ :label="showLabel?attr.name:undefined"
423
+ :prop="attr.prop ? attr.prop : attr.model">
424
+ <citySelect
425
+ @change="attr.dataChangeFunc && debouncedDataChangeFunc()"
426
+ ref="citySelect"
427
+ v-model="form[attr.model]"
428
+ :contexts="attr.contexts"
429
+ :value-type="attr.valueType"
430
+ :default-value="form[attr.model]"></citySelect>
431
+ </a-form-model-item>
432
+ </x-form-col>
433
+ <!-- 地点搜索框 -->
434
+ <x-form-col
435
+ v-else-if="attr.type === 'addressSearch' && show"
436
+ :labelCol="labelCol"
437
+ :occupyCol="attr.occupyCol"
438
+ :flex="attr.flex">
439
+ <a-form-model-item
440
+ :rules="rules"
441
+ :ref="attr.model"
442
+ :label="showLabel?attr.name:undefined"
443
+ :prop="attr.prop ? attr.prop : attr.model">
444
+ <address-search-combobox
445
+ :emitFunc="emitFunc"
446
+ :attr="attr"
447
+ :read-only="readOnly"
448
+ v-model="searchResult"
449
+ :resultKeys="{ address: attr.model, coords: `${attr.model}_lng_lat` }"
450
+ ref="addressSearchCombobox"
451
+ searchResultType="Object"
452
+ @onSelect="addressSearchComboboxSelect"
453
+ @onDivisionsChange="onDivisionsChange"
454
+ ></address-search-combobox>
455
+ </a-form-model-item>
456
+ </x-form-col>
457
+ <!-- 人员选择框 -->
458
+ <x-form-col
459
+ v-else-if="attr.type === 'personSetting' && show"
460
+ :labelCol="labelCol"
461
+ :flex="attr.flex">
462
+ <a-form-model-item
463
+ :rules="rules"
464
+ :ref="attr.model"
465
+ :label="showLabel?attr.name:undefined"
466
+ :prop="attr.prop ? attr.prop : attr.model">
467
+ <PersonSetting v-model="form[attr.model]"></PersonSetting>
468
+ </a-form-model-item>
469
+ </x-form-col>
470
+ <!-- 树形选择框 -->
471
+ <x-form-col
472
+ v-else-if="attr.type === 'treeSelect' && show"
473
+ :labelCol="labelCol"
474
+ :flex="attr.flex">
475
+ <x-tree-select
476
+ :rules="rules"
477
+ @onChange="attr.dataChangeFunc && debouncedDataChangeFunc()"
478
+ v-model="form[attr.model]"
479
+ :attr="attr"
480
+ @mounted="itemMounted"
481
+ ref="xTreeSelect">
482
+ </x-tree-select>
483
+ </x-form-col>
484
+ <!-- 列表选择框 -->
485
+ <x-form-col
486
+ v-else-if="attr.type === 'listSelect' && show"
487
+ :labelCol="labelCol"
488
+ :flex="attr.flex">
489
+ <a-form-model-item
490
+ :rules="rules"
491
+ :ref="attr.model"
492
+ :label="showLabel?attr.name:undefined"
493
+ :style="layout === 'inline'&& attr.occupyCol && attr.occupyCol > 1? {width:`calc(100% - ${attr.occupyCol * 1.533}rem)`}:{}"
494
+ :prop="attr.prop ? attr.prop : attr.model">
495
+ <a-popover
496
+ ref="rowChoosePopover"
497
+ :visible="rowChoosePopoverVisible"
498
+ title="选择数据"
499
+ placement="bottom"
500
+ trigger="focus"
501
+ :arrowPointAtCenter="true"
502
+ :overlayStyle="{ width: '1000px', height: '30vh' }">
503
+ <template #content>
504
+ <x-report
505
+ v-if="isCover"
506
+ :use-oss-for-img="false"
507
+ :config-name="queryParamsName"
508
+ :service-name="serviceName"
509
+ :show-img-in-cell="true"
510
+ :display-only="true"
511
+ :edit-mode="false"
512
+ :show-save-button="true"
513
+ :no-padding="true"
514
+ :dont-format="true"
515
+ @rowChoose="rowChoose"
516
+ @cancel="closeRowChooseInput"
517
+ >
518
+ </x-report>
519
+ <x-form-table
520
+ v-else
521
+ title="请选择数据"
522
+ :queryParamsName="queryParamsName"
523
+ :rowSelectMode="true"
524
+ :allowSelectRowNum="1"
525
+ :service-name="serviceName"
526
+ :fixed-query-form="rowChooseFixedQueryValue"
527
+ @rowChoose="rowChoose"
528
+ @afterQuery="rowChooseSearchAfterQuery"
529
+ ref="rowChooseTable">
530
+ <template #button>
531
+ <a-button @click="closeRowChooseInput">
532
+ 关闭
533
+ </a-button>
534
+ </template>
535
+ </x-form-table>
536
+ </template>
537
+ <a-input
538
+ v-model="form[attr.model]"
539
+ :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')"
540
+ @change="searchRowChooseData"
541
+ @focus="showCloseRowChooseInput"/>
542
+ </a-popover>
543
+ </a-form-model-item>
544
+ </x-form-col>
545
+ <!-- 评分框 -->
546
+ <x-form-col
547
+ v-else-if="attr.type === 'rate' && show"
548
+ :labelCol="labelCol"
549
+ :flex="attr.flex">
550
+ <a-form-model-item
551
+ :rules="rules"
552
+ :ref="attr.model"
553
+ :label="showLabel?attr.name:undefined"
554
+ :prop="attr.prop ? attr.prop : attr.model">
555
+ <x-rate
556
+ v-model="form[attr.model]"
557
+ :mode="mode"
558
+ :disabled="disabled"
559
+ :query-type="attr.queryType"
560
+ :max-count="attr.maxCount"
561
+ :allow-half="attr.allowHalf"
562
+ :icon="attr.rateIcon"
563
+ :placeholder="attr.placeholder ? attr.placeholder : '请选择'+attr.name.replace(/\s*/g, '')"
564
+ @change="attr.dataChangeFunc && debouncedDataChangeFunc()"
565
+ />
566
+ </a-form-model-item>
567
+ </x-form-col>
568
+ <!-- 区间选择器 -->
569
+ <x-form-col
570
+ v-else-if="attr.type === 'intervalPicker' && show"
571
+ :labelCol="labelCol"
572
+ :flex="attr.flex">
573
+ <a-form-model-item
574
+ :rules="rules"
575
+ :ref="attr.model"
576
+ :label="showLabel?attr.name:undefined"
577
+ :prop="attr.prop ? attr.prop : attr.model">
578
+ <x-interval-picker
579
+ v-model="form[attr.model]"
580
+ :mode="mode"
581
+ :read-only="readOnly"
582
+ :disabled="disabled && !readOnly"
583
+ :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')"
584
+ :start-placeholder="attr.startPlaceholder || '起始值'"
585
+ :end-placeholder="attr.endPlaceholder || '结束值'"
586
+ @blur="attr.inputOnBlurFunc && emitFunc(attr.inputOnBlurFunc,attr)"
587
+ />
588
+ </a-form-model-item>
589
+ </x-form-col>
590
+ <!-- 车牌号选择 -->
591
+ <x-form-col
592
+ v-else-if="attr.type === 'licensePlate' && show"
593
+ :labelCol="labelCol"
594
+ :flex="attr.flex">
595
+ <a-form-model-item
596
+ :rules="rules"
597
+ :ref="attr.model"
598
+ :label="showLabel?attr.name:undefined"
599
+ :style="layout === 'inline'&& attr.occupyCol && attr.occupyCol > 1? {width:`calc(100% - ${attr.occupyCol * 1.533}rem)`}:{}"
600
+ :prop="attr.prop ? attr.prop : attr.model">
601
+ <!-- 如果配置了后置按钮插槽 -->
602
+ <a-input
603
+ v-if="mode ==='查询'"
604
+ v-model="form[attr.model]"
605
+ :whitespace="true"
606
+ :read-only="readOnly"
607
+ :disabled="disabled && !readOnly"
608
+ style="width:100%"
609
+ @blur="attr.inputOnBlurFunc && emitFunc(attr.inputOnBlurFunc,attr)"
610
+ :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')"
611
+ :ref="`${attr.model}input`"/>
612
+ <x-license-plate
613
+ v-else
614
+ v-model="form[attr.model]"
615
+ @change="attr.dataChangeFunc && debouncedDataChangeFunc()"
616
+ ></x-license-plate>
617
+ </a-form-model-item>
618
+ </x-form-col>
619
+ <!-- 录音 -->
620
+ <x-form-col
621
+ v-else-if="attr.type === 'recording' && show"
622
+ :labelCol="labelCol"
623
+ :flex="attr.flex">
624
+ <recording
625
+ ref="recording"
626
+ @recordingData="recordingData"
627
+ >
628
+ </recording>
629
+ </x-form-col>
630
+ <!-- 表格录入 -->
631
+ <x-form-col
632
+ v-else-if="attr.type === 'rowEdit' && show"
633
+ :labelCol="labelCol"
634
+ :flex="attr.flex">
635
+ <a-form-model-item
636
+ :rules="rules"
637
+ :ref="attr.model"
638
+ :label="showLabel?attr.name:undefined"
639
+ :prop="attr.prop ? attr.prop : attr.model">
640
+ <x-form-table
641
+ :key="'childTable_' + attr.model"
642
+ :title="attr.name"
643
+ :queryParamsName="attr.crud"
644
+ :localEditMode="true"
645
+ :fixed-query-form="childTableFixedQueryForm(attr)"
646
+ :service-name="serviceName"
647
+ @hook:mounted="(h)=>onComponentMounted(h, attr)"
648
+ :ref="'childXFormTable_' + attr.model">
649
+ </x-form-table>
650
+ </a-form-model-item>
651
+ </x-form-col>
652
+ </template>
653
+ <script>
654
+ import { debounce } from 'ant-design-vue/lib/vc-table/src/utils'
655
+ import XFormCol from '@vue2-client/base-client/components/common/XFormCol'
656
+ import XBadge from '@vue2-client/base-client/components/common/XBadge'
657
+ import CitySelect from '@vue2-client/base-client/components/common/CitySelect'
658
+ import PersonSetting from '@vue2-client/base-client/components/common/PersonSetting'
659
+ import AddressSearchCombobox from '@vue2-client/base-client/components/common/AddressSearchCombobox'
660
+ import Upload from '@vue2-client/base-client/components/common/Upload'
661
+ import moment from 'moment'
662
+ import { getConfigByName, runLogic, getConfigByNameAsync } from '@vue2-client/services/api/common'
663
+ import * as util from '@vue2-client/utils/util'
664
+ import XTreeSelect from '@vue2-client/base-client/components/common/XForm/XTreeSelect'
665
+ import { searchToListOption, searchToOption } from '@vue2-client/services/v3Api'
666
+ import { mapState } from 'vuex'
667
+ import { executeStrFunctionByContext } from '@vue2-client/utils/runEvalFunction'
668
+ import XLicensePlate from '@vue2-client/base-client/components/common/XLicensePlate/XLicensePlate.vue'
669
+ import XStatusButton from './XStatusButton.vue'
670
+ import XClickChangeBtn from './itemComponent/XClickChangeBtn'
671
+ import 'moment/locale/zh-cn'
672
+ import XFormDatePicker from '@vue2-client/base-client/components/common/XDatePicker/index.vue'
673
+ import XIntervalPicker from '@vue2-client/base-client/components/common/XIntervalPicker/XIntervalPicker.vue'
674
+ import XRate from '@vue2-client/base-client/components/common/XRate/index.vue'
675
+
676
+ export default {
677
+ name: 'XFormItem',
678
+ components: {
679
+ XFormDatePicker,
680
+ XFormTable: () => import('@vue2-client/base-client/components/common/XFormTable/XFormTable.vue'),
681
+ Recording: () => import('@vue2-client/base-client/components/common/Recording/Recording.vue'),
682
+ XReport: () => import('@vue2-client/base-client/components/common/XReportGrid/XReport.vue'),
683
+ XLicensePlate,
684
+ XTreeSelect,
685
+ XFormCol,
686
+ XBadge,
687
+ CitySelect,
688
+ PersonSetting,
689
+ AddressSearchCombobox,
690
+ Upload,
691
+ XStatusButton,
692
+ XClickChangeBtn,
693
+ XIntervalPicker,
694
+ XRate
695
+ },
696
+ data () {
697
+ // 检索去抖
698
+ this.fetchFunction = debounce(this.fetchFunction, 800)
699
+ return {
700
+ option: [],
701
+ // 最后检索版本
702
+ lastFetchId: 0,
703
+ // 检索中
704
+ searching: false,
705
+ searchResult: '',
706
+ optionForFunc: [],
707
+ // 控制当前表单项是否展示
708
+ show: true,
709
+ // moment
710
+ moment,
711
+ // 行选择器浮层是否显示
712
+ rowChoosePopoverVisible: false,
713
+ // 行选择器CRUD固定查询值
714
+ rowChooseFixedQueryValue: undefined
715
+ }
716
+ },
717
+ props: {
718
+ attr: {
719
+ type: Object,
720
+ default:
721
+ () => {
722
+ return {}
723
+ }
724
+ },
725
+ form: {
726
+ type: Object,
727
+ required:
728
+ true
729
+ },
730
+ disabled: {
731
+ type: Boolean,
732
+ default:
733
+ () => {
734
+ return false
735
+ }
736
+ },
737
+ readOnly: {
738
+ type: Boolean,
739
+ default:
740
+ () => {
741
+ return false
742
+ }
743
+ },
744
+ mode: {
745
+ type: String,
746
+ default:
747
+ () => {
748
+ return '查询'
749
+ }
750
+ },
751
+ files: {
752
+ type: Array,
753
+ default:
754
+ () => {
755
+ return []
756
+ }
757
+ },
758
+ images: {
759
+ type: Array,
760
+ default:
761
+ () => {
762
+ return []
763
+ }
764
+ },
765
+ serviceName: {
766
+ type: String,
767
+ default:
768
+ undefined
769
+ },
770
+ // 调用logic获取数据源的追加参数
771
+ getDataParams: {
772
+ type: Object,
773
+ default:
774
+ undefined
775
+ },
776
+ // 布局
777
+ layout: {
778
+ type: String,
779
+ default:
780
+ 'horizontal'
781
+ },
782
+ // 环境
783
+ env: {
784
+ type: String,
785
+ default:
786
+ () => {
787
+ return 'prod'
788
+ }
789
+ },
790
+ // 设置表单值
791
+ setForm: {
792
+ type: Function,
793
+ default: (val) => {
794
+ console.log(val)
795
+ }
796
+ },
797
+ showLabel: {
798
+ type: Boolean,
799
+ default:
800
+ () => {
801
+ return true
802
+ }
803
+ },
804
+ labelCol: {
805
+ type: Object,
806
+ default: () => {
807
+ return { span: 8 }
808
+ }
809
+ },
810
+ rules: {
811
+ type: Array,
812
+ default:
813
+ () => {
814
+ return undefined
815
+ }
816
+ }
817
+ },
818
+ provide () {
819
+ return {
820
+ FormItemContext: this
821
+ }
822
+ },
823
+ created () {
824
+ this.init()
825
+ if (this.attr.keyName && (this.attr?.keyName?.toString().indexOf('async ') !== -1 || this.attr?.keyName?.toString()?.indexOf('function') !== -1)) {
826
+ this.debouncedUpdateOptions = debounce(this.updateOptions, 200)
827
+ }
828
+ if (this.attr.dataChangeFunc) {
829
+ this.debouncedDataChangeFunc = debounce(this.dataChangeFunc, 200)
830
+ // 执行一次
831
+ this.dataChangeFunc()
832
+ }
833
+ if (this.attr.showFormItemFunc) {
834
+ this.debouncedShowFormItemFunc = debounce(this.showFormItemFunc, 100)
835
+ // 执行一次
836
+ this.showFormItemFunc()
837
+ }
838
+ if (this.attr.showQueryFormItemFunc) {
839
+ this.debouncedShowQueryFormItemFunc = debounce(this.showQueryFormItemFunc, 100)
840
+ // 执行一次
841
+ this.showFormItemFunc()
842
+ }
843
+ // 人员联动框增加监听
844
+ if (this?.attr?.keyName?.toString()?.startsWith('search@根据表单项[') && this?.attr?.keyName?.toString().endsWith(']联动人员')) {
845
+ this.debouncedUserLinkFunc = debounce(() => this.updateResOptions('人员'), 200)
846
+ }
847
+ if (this?.attr?.keyName?.toString()?.startsWith('search@根据表单项[') && this?.attr?.keyName?.toString().endsWith(']联动部门')) {
848
+ this.debouncedDepLinkFunc = debounce(() => this.updateResOptions('部门'), 200)
849
+ }
850
+ // xTreeSelect 自己调用 mounted
851
+ if (this.attr.type !== 'treeSelect') {
852
+ this.$emit('mounted', this.attr)
853
+ }
854
+ },
855
+ computed: {
856
+ ...mapState('account', { currUser: 'user' }),
857
+ queryParamsName () {
858
+ if (this.attr.keyName.startsWith('function')) {
859
+ // 调用异步函数获取内容
860
+ return executeStrFunctionByContext(this, this.attr.keyName, [this.form, runLogic, this.mode, getConfigByNameAsync])
861
+ } else {
862
+ // 按现有方式处理
863
+ return this.attr.keyName.split('@')[this.attr.keyName.split('@').length - 1]
864
+ }
865
+ },
866
+ // 判断弹出时是否Cover,弹出只支持Cover以及CRUD
867
+ isCover () {
868
+ // 如果 queryParamsName 为空,返回空
869
+ if (!this.queryParamsName) {
870
+ return false
871
+ }
872
+ const result = this.queryParamsName.endsWith('Cover')
873
+ return result
874
+ },
875
+ },
876
+ watch: {
877
+ attr: {
878
+ handler () {
879
+ this.init()
880
+ },
881
+ deep: true
882
+ },
883
+ form: {
884
+ handler (newVal, oldVal) {
885
+ // 如果是从函数获取 options
886
+ if (this.attr.keyName && (this.attr.keyName.toString().indexOf('async ') !== -1 || this.attr.keyName.toString().indexOf('function') !== -1)) {
887
+ this.debouncedUpdateOptions()
888
+ }
889
+ // 如果有自定义是否展示表单项函数
890
+ if (this.attr.showFormItemFunc) {
891
+ this.debouncedShowFormItemFunc()
892
+ }
893
+ // 如果有自定义是否展示查询表单项函数
894
+ if (this.attr.showQueryFormItemFunc) {
895
+ this.debouncedShowQueryFormItemFunc()
896
+ }
897
+ // 地址搜索框赋值
898
+ if (this.attr.type === 'addressSearch') {
899
+ this.$refs.addressSearchCombobox.addressInput = this.form[this.attr.model]
900
+ }
901
+ // 数据源来自人员联动时更新数据
902
+ if (this?.attr?.keyName?.toString()?.startsWith('search@根据表单项[') && this?.attr?.keyName?.toString().endsWith(']联动人员')) {
903
+ this.debouncedUserLinkFunc()
904
+ }
905
+ // 数据源来自人员联动时更新数据
906
+ if (this?.attr?.keyName?.toString()?.startsWith('search@根据表单项[') && this?.attr?.keyName?.toString().endsWith(']联动部门')) {
907
+ this.debouncedDepLinkFunc()
908
+ }
909
+ },
910
+ deep: true
911
+ }
912
+ },
913
+ inject: {
914
+ getComponentByName: {
915
+ default: () => () => {
916
+ console.warn('getComponentByName is not provided')
917
+ return null // 或者返回一个默认的函数
918
+ },
919
+ },
920
+ registerComponent: {
921
+ default: () => () => {
922
+ console.warn('registerComponent is not provided')
923
+ return null // 或者返回一个默认的函数
924
+ },
925
+ },
926
+ getSelf: {
927
+ default: () => () => {
928
+ console.warn('getSelf is not provided')
929
+ return null // 或者返回一个默认的函数
930
+ },
931
+ },
932
+ XFormContext: {
933
+ default: () => () => {
934
+ console.warn('XFormContext is not provided')
935
+ return null // 或者返回一个默认的函数
936
+ },
937
+ },
938
+ setRequired: {
939
+ default: () => () => {
940
+ console.warn('setRequired is not provided')
941
+ return null // 或者返回一个默认的函数
942
+ },
943
+ },
944
+ removeRequired: {
945
+ default: () => () => {
946
+ console.warn('removeRequired is not provided')
947
+ return null // 或者返回一个默认的函数
948
+ },
949
+ }
950
+ },
951
+ methods: {
952
+ // 把内部的crud表单录入放到表单中,以便外部可以调用
953
+ onComponentMounted (h, attr) {
954
+ console.log('crud表单', h)
955
+ if (attr.crud) {
956
+ this.registerComponent(attr.model, this.$refs['childXFormTable_' + attr.model])
957
+ }
958
+ },
959
+ childTableFixedQueryForm (item) {
960
+ console.log('传递的form', this.form)
961
+ if (this.modifyModelData?.primaryKeyData) {
962
+ const fixedForm = {}
963
+ fixedForm[item.childTableForeignKeyName] = Object.values(this.modifyModelData.primaryKeyData)[0]
964
+ return fixedForm
965
+ }
966
+ return null
967
+ },
968
+ // 动态生成事件绑定对象
969
+ generateDynamicEvents (inputOnAfterFunc, attr) {
970
+ const events = {}
971
+ const states = this.parseStates(attr.inputOnAfterName, inputOnAfterFunc)
972
+
973
+ states.forEach((state) => {
974
+ // 动态绑定事件名到 emitFunc
975
+ events[state.event] = () => {
976
+ console.info('事件名', state.event)
977
+ this.emitFunc(state.event, attr)
978
+ }
979
+ })
980
+
981
+ return events // 返回 { state1Event: handler, state2Event: handler, ... }
982
+ },
983
+ parseStates (input, events) {
984
+ const eventNames = events.split('|')
985
+ return input.split('|').map((label, index) => ({
986
+ label,
987
+ event: eventNames[index] // 如果没有提供事件名称,则使用默认值
988
+ }))
989
+ },
990
+ focusInput () {
991
+ if (this.attr.defaultFocus) {
992
+ this.$nextTick(h => {
993
+ const el = this.$refs[`${this.attr.model}input`]?.$el
994
+ let inputEl
995
+ if (el) {
996
+ if (el.tagName.toLowerCase() === 'input') {
997
+ inputEl = el
998
+ } else {
999
+ inputEl = el.querySelector('input')
1000
+ }
1001
+ }
1002
+ if (inputEl) {
1003
+ inputEl.focus()
1004
+ if (inputEl.type === 'number') {
1005
+ if (inputEl.valueAsNumber) {
1006
+ inputEl.setSelectionRange(0, inputEl.valueAsNumber.toString().length)
1007
+ }
1008
+ } else {
1009
+ if (inputEl.value) {
1010
+ inputEl.setSelectionRange(0, inputEl.value.length)
1011
+ }
1012
+ }
1013
+ }
1014
+ })
1015
+ }
1016
+ },
1017
+ // 更新人员下拉框数据
1018
+ async updateResOptions (type) {
1019
+ if (this?.attr?.keyName?.toString()?.startsWith('search@根据表单项[') && this?.attr?.keyName?.toString()?.endsWith(`]联动${type}`)) {
1020
+ const startIndex = this.attr.keyName.indexOf('[') + 1
1021
+ const endIndex = this.attr.keyName.indexOf(']', startIndex)
1022
+ const fromModel = this.attr.keyName.substring(startIndex, endIndex).replace('.', '_')
1023
+ const formModelData = Array.isArray(this.form[fromModel])
1024
+ ? this.form[fromModel]
1025
+ : [this.form[fromModel]]
1026
+ if (fromModel?.length && formModelData?.length) {
1027
+ const searchData = { source: `获取${type}`, userid: this.currUser.id, filter: formModelData, filterType: fromModel.indexOf('org') > -1 ? 'org' : 'dep' }
1028
+ await searchToListOption(searchData, res => {
1029
+ this.getDataCallback(
1030
+ res.filter(h => {
1031
+ if (fromModel.indexOf('org') > -1) {
1032
+ return formModelData?.includes(h.orgid || h.f_organization_id || h.parentid)
1033
+ } else {
1034
+ return formModelData?.includes(h?.parentid)
1035
+ }
1036
+ }
1037
+ )
1038
+ )
1039
+ })
1040
+ }
1041
+ }
1042
+ },
1043
+ // js 函数作为数据源
1044
+ async updateOptions () {
1045
+ if (this.attr.keyName && (this.attr.keyName.indexOf('async ') !== -1 || this.attr.keyName.indexOf('function ') !== -1)) {
1046
+ this.optionForFunc = await executeStrFunctionByContext(this, this.attr.keyName, [this.form, runLogic, this.mode, getConfigByNameAsync])
1047
+ }
1048
+ },
1049
+ async dataChangeFunc () {
1050
+ if (this.attr.dataChangeFunc) {
1051
+ await executeStrFunctionByContext(this, this.attr.dataChangeFunc, [this.form, this.setForm, this.attr, util, this.mode, runLogic, getConfigByNameAsync])
1052
+ }
1053
+ },
1054
+ async showFormItemFunc () {
1055
+ if (this.attr.showFormItemFunc) {
1056
+ const obj = executeStrFunctionByContext(this, this.attr.showFormItemFunc, [this.form, this.setForm, this.attr, util, this.mode])
1057
+ // 判断是 bool 还是 obj 兼容
1058
+ if (typeof obj === 'boolean') {
1059
+ this.show = obj
1060
+ } else if (obj && typeof obj === 'object') {
1061
+ // obj 是一个对象,并且不是数组
1062
+ this.show = obj?.show
1063
+ this.readOnly = obj?.readOnly
1064
+ }
1065
+ } else {
1066
+ this.show = true
1067
+ }
1068
+ },
1069
+ async showQueryFormItemFunc () {
1070
+ if (this.attr.showQueryFormItemFunc) {
1071
+ const obj = executeStrFunctionByContext(this, this.attr.showQueryFormItemFunc, [this.form, this.setForm, this.attr, util, this.mode])
1072
+ // 判断是 bool 还是 obj 兼容
1073
+ if (typeof obj === 'boolean') {
1074
+ this.show = obj
1075
+ } else if (obj && typeof obj === 'object') {
1076
+ // obj 是一个对象,并且不是数组
1077
+ this.show = obj?.show
1078
+ this.readOnly = obj?.readOnly
1079
+ }
1080
+ } else {
1081
+ this.show = true
1082
+ }
1083
+ },
1084
+ init () {
1085
+ if (!this.attr.flex) {
1086
+ if (this.mode === '新增/修改') {
1087
+ if (['horizontal', 'vertical'].includes(this.layout) || ['textarea', 'file', 'image'].includes(this.attr.type)) {
1088
+ // 新增修改表单 horizontal 模式下默认为一行
1089
+ this.attr.flex = {
1090
+ xs: 24,
1091
+ sm: 24,
1092
+ md: 24,
1093
+ lg: 24,
1094
+ xl: 24,
1095
+ xxl: 24,
1096
+ fullWidth: true
1097
+ }
1098
+ } else {
1099
+ // 新增修改表单 vertical 模式下默认为1列
1100
+ this.attr.flex = {
1101
+ xs: 24,
1102
+ sm: 12,
1103
+ md: 8,
1104
+ lg: 8,
1105
+ xl: 6,
1106
+ xxl: 6
1107
+ }
1108
+ }
1109
+ } else {
1110
+ this.attr.flex = {
1111
+ xs: 24,
1112
+ sm: 24,
1113
+ md: 8,
1114
+ lg: 6,
1115
+ xl: 6,
1116
+ xxl: 6
1117
+ }
1118
+ }
1119
+ }
1120
+ if (this.attr.keyName && typeof this.attr.keyName === 'string') {
1121
+ if (this.attr.keyName.indexOf('logic@') !== -1) {
1122
+ this.getData({}, res => this.getDataCallback(res))
1123
+ } else if (this.attr.keyName.indexOf('search@') !== -1) {
1124
+ // `tool.getFullTree(this.getRights().where(row.getType()==$organization$))`
1125
+ // 判断是否根据角色查询
1126
+ let source = this.attr.keyName.substring(7)
1127
+ const userid = this.currUser.id
1128
+ let roleName = 'roleName'
1129
+ if (source.startsWith('根据角色[') && source.endsWith(']获取人员')) {
1130
+ const startIndex = source.indexOf('[') + 1
1131
+ const endIndex = source.indexOf(']', startIndex)
1132
+ roleName = source.substring(startIndex, endIndex)
1133
+ source = '根据角色获取人员'
1134
+ }
1135
+ const searchData = { source, userid, roleName }
1136
+ // 判断是否根据某个表单项联动 仅返回列表结构并筛选
1137
+ if (source.startsWith('根据表单项[') && source.endsWith(']联动人员')) {
1138
+ this.updateResOptions('人员')
1139
+ } else if (source.startsWith('根据表单项[') && source.endsWith(']联动部门')) {
1140
+ this.updateResOptions('部门')
1141
+ } else if (this.attr.type === 'select' || this.attr.type === 'checkbox') {
1142
+ // 仅获取最内层数据
1143
+ searchToListOption(searchData, res => this.getDataCallback(res))
1144
+ } else {
1145
+ // 其他资源通用逻辑
1146
+ searchToOption(searchData, res => this.getDataCallback(res))
1147
+ }
1148
+ } else if (this.attr.keyName.indexOf('config@') !== -1) {
1149
+ const configName = this.attr.keyName.substring(7)
1150
+ getConfigByName(configName, this.serviceName, res => {
1151
+ this.getDataCallback(res.value)
1152
+ }, this.env === 'dev')
1153
+ } else if (this.attr.keyName.indexOf('async ') !== -1 || this.attr.keyName.indexOf('function ') !== -1) {
1154
+ this.updateOptions()
1155
+ }
1156
+ } else if (this.attr.keys) {
1157
+ this.getDataCallback(this.attr.keys)
1158
+ }
1159
+ this.focusInput()
1160
+ },
1161
+ addressSearchComboboxSelect (data) {
1162
+ this.form = Object.assign(this.form, JSON.parse(data))
1163
+ },
1164
+ onDivisionsChange (data) {
1165
+ this.emitFunc('addressSearchComboboxSelect', {
1166
+ key: this.attr.model,
1167
+ value: data
1168
+ })
1169
+ },
1170
+ getDataCallback (res) {
1171
+ this.option = res
1172
+ if (this.attr.type === 'treeSelect') {
1173
+ this.$nextTick(() => {
1174
+ this.$refs.xTreeSelect.init({
1175
+ option: this.option,
1176
+ form: this.form,
1177
+ queryType: this.attr.queryType,
1178
+ name: this.attr.name,
1179
+ model: this.attr.model,
1180
+ mode: this.mode,
1181
+ disabled: this.disabled
1182
+ })
1183
+ })
1184
+ } else if (this.attr.type === 'radio' || ['radioGroup', 'clickChange'].includes(this.attr.showMode)) {
1185
+ this.initRadioValue()
1186
+ }
1187
+ },
1188
+ initRadioValue () {
1189
+ const model = this.attr.model
1190
+ if (this.mode === '新增/修改' && (this.form[model] === undefined || this.form[model] === null) && !this.attr.prop) {
1191
+ if (this.attr.keys && this.attr.keys.length > 1) {
1192
+ this.form[model] = this.attr.keys[0].value
1193
+ } else if (this.option.length > 1) {
1194
+ this.form[model] = this.option[0].value
1195
+ }
1196
+ }
1197
+ },
1198
+ // 文件框时设置上传组件的值
1199
+ setFiles (fileIds) {
1200
+ if (!this.form[this.attr.model]) {
1201
+ this.form[this.attr.model] = []
1202
+ }
1203
+ this.form[this.attr.model] = [...fileIds]
1204
+ },
1205
+ // 懒加载检索方法
1206
+ fetchFunction (value) {
1207
+ this.lastFetchId += 1
1208
+ const fetchId = this.lastFetchId
1209
+ this.option = []
1210
+ this.searching = true
1211
+ this.getData({
1212
+ word: value
1213
+ }, res => {
1214
+ if (fetchId !== this.lastFetchId) {
1215
+ return
1216
+ }
1217
+ this.option = res
1218
+ this.searching = false
1219
+ })
1220
+ },
1221
+ // 获取数据
1222
+ getData (value, callbackFun) {
1223
+ if (value !== '') {
1224
+ const logicName = this.attr.keyName
1225
+ const logic = logicName.substring(6)
1226
+ // 调用logic前设置参数
1227
+ if (this.getDataParams && this.getDataParams[this.attr.model]) {
1228
+ Object.assign(value, this.getDataParams[this.attr.model])
1229
+ }
1230
+ runLogic(logic, Object.assign(value, {
1231
+ orgId: this.currUser.orgid,
1232
+ userId: this.currUser.id
1233
+ }), this.serviceName, this.env === 'dev').then(res => {
1234
+ callbackFun(res)
1235
+ }).catch(e => {
1236
+ callbackFun([])
1237
+ console.error('获取数据失败:' + e)
1238
+ })
1239
+ }
1240
+ },
1241
+ filterOption (input, option) {
1242
+ const child = option.componentOptions.children[0]
1243
+ if (child.text) {
1244
+ return child.text.toLowerCase().indexOf(input.toLowerCase()) >= 0
1245
+ } else if (child.elm.innerText) {
1246
+ return child.elm.innerText.toLowerCase().indexOf(input.toLowerCase()) >= 0
1247
+ } else {
1248
+ return child.child.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
1249
+ }
1250
+ },
1251
+ // 表单项变更函数中调用 控制表单组中表单项组名为 groupName 的表单是否展示
1252
+ // func:x-form-show(显示)/x-form-no-show(不显示)
1253
+ emitShowFormFunc (func, groupName) {
1254
+ this.emitFunc(func, groupName)
1255
+ },
1256
+ emitFunc (func, data) {
1257
+ this.$emit('x-form-item-emit-func', func, data, data?.model ? this.form[data.model] : this.form)
1258
+ },
1259
+ itemMounted (h) {
1260
+ this.$emit('mounted', h)
1261
+ },
1262
+ rowChoose (rows) {
1263
+ this.$emit('rowChoose', rows, this.attr, this.closeRowChooseInput)
1264
+ },
1265
+ searchRowChooseData () {
1266
+ if (this.searching) {
1267
+ return
1268
+ }
1269
+ this.lastFetchId += 1
1270
+ const fetchId = this.lastFetchId
1271
+ this.searching = true
1272
+ if (fetchId !== this.lastFetchId) {
1273
+ return
1274
+ }
1275
+ this.rowChooseFixedQueryValue = []
1276
+ this.rowChooseFixedQueryValue[this.attr.model] = this.form[this.attr.model]
1277
+ this.$nextTick(() => {
1278
+ this.$refs.rowChooseTable.refresh(true)
1279
+ })
1280
+ },
1281
+ showCloseRowChooseInput () {
1282
+ this.rowChoosePopoverVisible = true
1283
+ },
1284
+ closeRowChooseInput () {
1285
+ this.rowChoosePopoverVisible = false
1286
+ },
1287
+ rowChooseSearchAfterQuery () {
1288
+ this.searching = false
1289
+ },
1290
+ // 获取 recording 转换后的数据
1291
+ getRecodingData () {
1292
+ return this.$refs.recording.getRecordingData()
1293
+ },
1294
+ recordingData (data) {
1295
+ this.emitFunc('recordingData', data)
1296
+ },
1297
+ getPopupContainer (triggerNode) {
1298
+ return document.body
1299
+ // return triggerNode.parentNode
1300
+ },
1301
+ }
1302
+ }
1303
+ </script>
1304
+
1305
+ <style lang="less" scoped>
1306
+ .custom-dropdown {
1307
+ position: absolute;
1308
+ z-index: 1050;
1309
+ }
1310
+ </style>