vue2-client 1.12.39 → 1.12.40

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