zbcx_ckyc 1.0.0

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 (249) hide show
  1. package/README.md +3 -0
  2. package/package.json +90 -0
  3. package/src/plugins/app/com/CesiumTool.js +730 -0
  4. package/src/plugins/app/com/MapMethods.js +355 -0
  5. package/src/plugins/app/com/MapTool.vue +772 -0
  6. package/src/plugins/app/com/MenuRouter.vue +157 -0
  7. package/src/plugins/app/com/ParamsDes.vue +35 -0
  8. package/src/plugins/app/com/SelCoorSys.vue +235 -0
  9. package/src/plugins/app/com/WebProj4.js +32 -0
  10. package/src/plugins/app/com/measure.js +127 -0
  11. package/src/plugins/app/com/yx.js +238 -0
  12. package/src/plugins/app/modelmanagement/D3DrawGraph.js +708 -0
  13. package/src/plugins/app/modelmanagement/MineralGo.vue +241 -0
  14. package/src/plugins/app/modelmanagement/MineralModel.vue +1203 -0
  15. package/src/plugins/app/modelmanagement/ModelCloudmap.vue +69 -0
  16. package/src/plugins/app/modelmanagement/ModelMst.vue +60 -0
  17. package/src/plugins/app/modelmanagement/ModelSy.vue +173 -0
  18. package/src/plugins/app/modelmanagement/ModelTp.vue +51 -0
  19. package/src/plugins/app/modelmanagement/ModelUpload.vue +774 -0
  20. package/src/plugins/app/znycpjxt/Api.js +714 -0
  21. package/src/plugins/app/znycpjxt/Bf/AttFactory.js +25 -0
  22. package/src/plugins/app/znycpjxt/Bf/IAnomalyhandle.js +102 -0
  23. package/src/plugins/app/znycpjxt/Bf/IComposeanomaly.js +140 -0
  24. package/src/plugins/app/znycpjxt/Bf/IContinueanaly.js +138 -0
  25. package/src/plugins/app/znycpjxt/Bf/IContrastanaly.js +138 -0
  26. package/src/plugins/app/znycpjxt/Bf/ICustomNode.js +145 -0
  27. package/src/plugins/app/znycpjxt/Bf/IDerivanaly.js +139 -0
  28. package/src/plugins/app/znycpjxt/Bf/IFilterananly.js +141 -0
  29. package/src/plugins/app/znycpjxt/Bf/IMeananaly.js +137 -0
  30. package/src/plugins/app/znycpjxt/Bf/IModelNodeBase.js +135 -0
  31. package/src/plugins/app/znycpjxt/Bf/IMoveaverage.js +135 -0
  32. package/src/plugins/app/znycpjxt/Bf/IReducepole.js +141 -0
  33. package/src/plugins/app/znycpjxt/Bf/ISmoothanaly.js +135 -0
  34. package/src/plugins/app/znycpjxt/Bf/ITrendanaly.js +144 -0
  35. package/src/plugins/app/znycpjxt/Bf/IVector2grd.js +144 -0
  36. package/src/plugins/app/znycpjxt/Bf/IYcfj.js +84 -0
  37. package/src/plugins/app/znycpjxt/Bf/IYcxxjs.js +105 -0
  38. package/src/plugins/app/znycpjxt/Bf/IYgsbtq.js +112 -0
  39. package/src/plugins/app/znycpjxt/Bf/IYgtxrh.js +112 -0
  40. package/src/plugins/app/znycpjxt/Bf/Iinteranaly.js +135 -0
  41. package/src/plugins/app/znycpjxt/Bf/index.js +44 -0
  42. package/src/plugins/app/znycpjxt/Bf/input/InputData.js +21 -0
  43. package/src/plugins/app/znycpjxt/Bf/input/InputExcel.js +28 -0
  44. package/src/plugins/app/znycpjxt/Bf/input/InputKd.js +31 -0
  45. package/src/plugins/app/znycpjxt/Bqqd/Bqqd.vue +380 -0
  46. package/src/plugins/app/znycpjxt/Bqqd/BqqdMap.vue +1046 -0
  47. package/src/plugins/app/znycpjxt/Bqqd/SetOpacity.vue +101 -0
  48. package/src/plugins/app/znycpjxt/Bqqd/SjzxTree.vue +244 -0
  49. package/src/plugins/app/znycpjxt/Bqqd/YclsjjTree.vue +212 -0
  50. package/src/plugins/app/znycpjxt/Bqqd/api/DsjzxApi.js +37 -0
  51. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmx.vue +161 -0
  52. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxgl/CfgGloalParams.vue +92 -0
  53. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxgl/CfgNodeFlds.vue +102 -0
  54. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxgl/CfgNodeParams.vue +277 -0
  55. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxgl/Ckycmxgl.vue +303 -0
  56. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxgl/SetLabelParam.vue +68 -0
  57. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxgl/SetModelParam.vue +69 -0
  58. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxtab/Ckycmxtab.vue +107 -0
  59. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxtab/Dtzzylwl.vue +156 -0
  60. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxtab/Jjsjwl.vue +230 -0
  61. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxtab/Sjsl.vue +126 -0
  62. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxtab/Zcxlj.vue +128 -0
  63. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxtab/Zjq.vue +123 -0
  64. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxtab/Zstp.vue +271 -0
  65. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxtab/Zzylwl.vue +149 -0
  66. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxtab/coms/ParamsData.vue +323 -0
  67. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxtab/coms/ParamsDataNew.vue +336 -0
  68. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxtab/coms/QqtEcharts.vue +137 -0
  69. package/src/plugins/app/znycpjxt/Ckycmx/Ckycrwgl/Ckycrwgl.vue +290 -0
  70. package/src/plugins/app/znycpjxt/CusTools/CodeApi.js +83 -0
  71. package/src/plugins/app/znycpjxt/CusTools/CodeEditor/CodeEditor.md +36 -0
  72. package/src/plugins/app/znycpjxt/CusTools/CodeEditor/CodeEditor.vue +227 -0
  73. package/src/plugins/app/znycpjxt/CusTools/CodeEditor/PlugCodeEditor.vue +78 -0
  74. package/src/plugins/app/znycpjxt/CusTools/CodeEditor/demo/basic.png +0 -0
  75. package/src/plugins/app/znycpjxt/CusTools/CodeEditor/demo/basic.vue +27 -0
  76. package/src/plugins/app/znycpjxt/CusTools/DmbjForm.vue +76 -0
  77. package/src/plugins/app/znycpjxt/CusTools/DmfbForm.vue +351 -0
  78. package/src/plugins/app/znycpjxt/CusTools/GjForm.vue +206 -0
  79. package/src/plugins/app/znycpjxt/CusTools/Gjbjyfb.vue +200 -0
  80. package/src/plugins/app/znycpjxt/CusTools/ParamSelect.vue +222 -0
  81. package/src/plugins/app/znycpjxt/CusTools/ParamSelect2.vue +204 -0
  82. package/src/plugins/app/znycpjxt/CusTools/Zngjj.vue +105 -0
  83. package/src/plugins/app/znycpjxt/DataAnlyModel/DataAnlyModel.vue +134 -0
  84. package/src/plugins/app/znycpjxt/DataAnlyModel/Hgfx/HgfxEcharts.vue +98 -0
  85. package/src/plugins/app/znycpjxt/DataAnlyModel/Hgfx/HgfxTab.vue +73 -0
  86. package/src/plugins/app/znycpjxt/DataAnlyModel/Hgfx.vue +101 -0
  87. package/src/plugins/app/znycpjxt/DataAnlyModel/Jctj/JctjjgTab.vue +70 -0
  88. package/src/plugins/app/znycpjxt/DataAnlyModel/Jctj/Plzft.vue +154 -0
  89. package/src/plugins/app/znycpjxt/DataAnlyModel/Jctj.vue +118 -0
  90. package/src/plugins/app/znycpjxt/DataAnlyModel/Jlfx/JlfxImg.vue +80 -0
  91. package/src/plugins/app/znycpjxt/DataAnlyModel/Jlfx.vue +91 -0
  92. package/src/plugins/app/znycpjxt/DataAnlyModel/PCAfx/PcaTab.vue +161 -0
  93. package/src/plugins/app/znycpjxt/DataAnlyModel/PCAfx.vue +101 -0
  94. package/src/plugins/app/znycpjxt/DataAnlyModel/Qqt/QqtEcharts.vue +202 -0
  95. package/src/plugins/app/znycpjxt/DataAnlyModel/Qqt.vue +88 -0
  96. package/src/plugins/app/znycpjxt/DataAnlyModel/Xgxfx/XgxfxImg.vue +80 -0
  97. package/src/plugins/app/znycpjxt/DataAnlyModel/Xgxfx.vue +96 -0
  98. package/src/plugins/app/znycpjxt/DatasetMan/CreateDataset.vue +296 -0
  99. package/src/plugins/app/znycpjxt/DatasetMan/DatasetMan.vue +141 -0
  100. package/src/plugins/app/znycpjxt/DatasetMan/PreData.js +91 -0
  101. package/src/plugins/app/znycpjxt/DatasetMan/PreData.vue +545 -0
  102. package/src/plugins/app/znycpjxt/DatasetMan/PreDataApi.js +101 -0
  103. package/src/plugins/app/znycpjxt/DatasetMan/SelData.vue +186 -0
  104. package/src/plugins/app/znycpjxt/DatasetMan/SjTree.vue +130 -0
  105. package/src/plugins/app/znycpjxt/DatasetMan/Sjj.vue +478 -0
  106. package/src/plugins/app/znycpjxt/DatasetMan/Yclsjj.vue +445 -0
  107. package/src/plugins/app/znycpjxt/DatasetMan/Yssjj.vue +389 -0
  108. package/src/plugins/app/znycpjxt/DocList/DocList.vue +496 -0
  109. package/src/plugins/app/znycpjxt/DocList/unit/DocItem.vue +137 -0
  110. package/src/plugins/app/znycpjxt/ExceptHandlModel/AnomalyExtraction/Dchj.vue +107 -0
  111. package/src/plugins/app/znycpjxt/ExceptHandlModel/AnomalyExtraction/GeophysicalAnomaly.vue +115 -0
  112. package/src/plugins/app/znycpjxt/ExceptHandlModel/AnomalyExtraction/Jxyt.vue +98 -0
  113. package/src/plugins/app/znycpjxt/ExceptHandlModel/AnomalyExtraction/Lbjs.vue +127 -0
  114. package/src/plugins/app/znycpjxt/ExceptHandlModel/AnomalyExtraction/Pjcjs.vue +103 -0
  115. package/src/plugins/app/znycpjxt/ExceptHandlModel/AnomalyExtraction/Qdjs.vue +103 -0
  116. package/src/plugins/app/znycpjxt/ExceptHandlModel/ExceptHandlModel.vue +163 -0
  117. package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/Cdjs.vue +102 -0
  118. package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/Czfx.vue +163 -0
  119. package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/GetFormData.vue +343 -0
  120. package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/Hdpj.vue +100 -0
  121. package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/Pjtd.vue +90 -0
  122. package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/Qsfx.vue +109 -0
  123. package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/ResultOnlyData.vue +121 -0
  124. package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/ResultTable.vue +231 -0
  125. package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/UniversalComputing.vue +139 -0
  126. package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/Xgxsjs.vue +93 -0
  127. package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/Xxsjs.vue +90 -0
  128. package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/Ycfj.vue +116 -0
  129. package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/Yhcl.vue +100 -0
  130. package/src/plugins/app/znycpjxt/ExceptHandlModel/extgeoanomalies/AnomalsGard.vue +91 -0
  131. package/src/plugins/app/znycpjxt/ExceptHandlModel/extgeoanomalies/Dqhxycht.vue +113 -0
  132. package/src/plugins/app/znycpjxt/ExceptHandlModel/extgeoanomalies/GeocAnomalies.vue +99 -0
  133. package/src/plugins/app/znycpjxt/ExceptHandlModel/extgeoanomalies/JgTableList.vue +203 -0
  134. package/src/plugins/app/znycpjxt/ExceptHandlModel/extgeoanomalies/Lszcl.vue +110 -0
  135. package/src/plugins/app/znycpjxt/ExceptHandlModel/extgeoanomalies/Ycxxjs.vue +116 -0
  136. package/src/plugins/app/znycpjxt/ExceptHandlModel/geoAnomalyExtraction/GeoAnomalyExtraction.vue +108 -0
  137. package/src/plugins/app/znycpjxt/ExceptHandlModel/geoAnomalyExtraction/coms/AttWeight.vue +99 -0
  138. package/src/plugins/app/znycpjxt/ExceptHandlModel/geoAnomalyExtraction/coms/Ckdctq.vue +98 -0
  139. package/src/plugins/app/znycpjxt/ExceptHandlModel/geoAnomalyExtraction/coms/LeftForm.vue +266 -0
  140. package/src/plugins/app/znycpjxt/ExceptHandlModel/ygyctq/Ygsbtq.vue +150 -0
  141. package/src/plugins/app/znycpjxt/ExceptHandlModel/ygyctq/Ygtxrh.vue +107 -0
  142. package/src/plugins/app/znycpjxt/ExceptHandlModel/ygyctq/ygyctq.vue +98 -0
  143. package/src/plugins/app/znycpjxt/Index/DataCard.vue +45 -0
  144. package/src/plugins/app/znycpjxt/Index/Index.vue +123 -0
  145. package/src/plugins/app/znycpjxt/Rzgl/Rzgl.vue +156 -0
  146. package/src/plugins/app/znycpjxt/coms/CmapColor.vue +70 -0
  147. package/src/plugins/app/znycpjxt/coms/CustomFileView.vue +343 -0
  148. package/src/plugins/app/znycpjxt/coms/CustomForm.vue +220 -0
  149. package/src/plugins/app/znycpjxt/coms/GrdView.vue +355 -0
  150. package/src/plugins/app/znycpjxt/coms/LeftForm.vue +195 -0
  151. package/src/plugins/app/znycpjxt/coms/MakeData.js +472 -0
  152. package/src/plugins/app/znycpjxt/coms/PreView.js +55 -0
  153. package/src/plugins/app/znycpjxt/coms/RightContent.vue +71 -0
  154. package/src/plugins/app/znycpjxt/coms/TableEarth.vue +259 -0
  155. package/src/plugins/app/znycpjxt/intellPred/ModelList.vue +200 -0
  156. package/src/plugins/app/znycpjxt/intellPred/coms/D3DrawGraph.js +634 -0
  157. package/src/plugins/app/znycpjxt/intellPred/coms/MineralGo.vue +249 -0
  158. package/src/plugins/app/znycpjxt/intellPred/coms/ModelCard.vue +298 -0
  159. package/src/plugins/app/znycpjxt/intellPred/coms/ModelEdit.vue +292 -0
  160. package/src/plugins/app/znycpjxt/intellPred/coms/ModelSpecif.vue +46 -0
  161. package/src/plugins/app/znycpjxt/intellPred/intellPred.vue +71 -0
  162. package/src/plugins/bf/BfApi.js +92 -0
  163. package/src/plugins/bf/BfColAdd.vue +78 -0
  164. package/src/plugins/bf/BfColEdit.vue +68 -0
  165. package/src/plugins/bf/BfColFilter.vue +112 -0
  166. package/src/plugins/bf/BfDataGroup.vue +80 -0
  167. package/src/plugins/bf/BfDataPreview.vue +118 -0
  168. package/src/plugins/bf/BfDataStat.vue +81 -0
  169. package/src/plugins/bf/BfDuplicateDel.vue +82 -0
  170. package/src/plugins/bf/BfProcCall.vue +82 -0
  171. package/src/plugins/bf/BfRunHis.vue +289 -0
  172. package/src/plugins/bf/BfRunParams.vue +94 -0
  173. package/src/plugins/bf/BfSaveFlow.vue +186 -0
  174. package/src/plugins/bf/BfSelFlow.vue +123 -0
  175. package/src/plugins/bf/BfTabCombine.vue +127 -0
  176. package/src/plugins/bf/BfTabJoin.vue +108 -0
  177. package/src/plugins/bf/BfTabMerge.vue +68 -0
  178. package/src/plugins/bf/BfTabReader.vue +126 -0
  179. package/src/plugins/bf/BfValFormat.vue +68 -0
  180. package/src/plugins/bf/BfValNumber.vue +68 -0
  181. package/src/plugins/bf/BfValProc.vue +78 -0
  182. package/src/plugins/bf/BfValSort.vue +78 -0
  183. package/src/plugins/bf/BiFlow.vue +1177 -0
  184. package/src/plugins/bf/IBfPlug.js +205 -0
  185. package/src/plugins/bf/coms/ColAdd.vue +75 -0
  186. package/src/plugins/bf/coms/ColEdit.vue +52 -0
  187. package/src/plugins/bf/coms/ColList.vue +91 -0
  188. package/src/plugins/bf/coms/DataGroup.vue +90 -0
  189. package/src/plugins/bf/coms/DataStat.vue +67 -0
  190. package/src/plugins/bf/coms/EditTable.vue +161 -0
  191. package/src/plugins/bf/coms/NodeTree.vue +105 -0
  192. package/src/plugins/bf/coms/PlugCmd.vue +95 -0
  193. package/src/plugins/bf/coms/RunParams.vue +68 -0
  194. package/src/plugins/bf/coms/TabCombine.vue +60 -0
  195. package/src/plugins/bf/coms/TabJoin.vue +69 -0
  196. package/src/plugins/bf/coms/ValFormat.vue +53 -0
  197. package/src/plugins/bf/coms/ValProc.vue +77 -0
  198. package/src/plugins/bf/coms/ValSort.vue +89 -0
  199. package/src/plugins/bf/parts/Icon.vue +105 -0
  200. package/src/plugins/bf/parts/Rect.vue +98 -0
  201. package/src/plugins/bf/parts/index.js +11 -0
  202. package/src/plugins/cxMixin/IAttBase.js +78 -0
  203. package/src/plugins/cxMixin/IAttDlg.js +45 -0
  204. package/src/plugins/cxMixin/IAttProc.js +98 -0
  205. package/src/plugins/cxMixin/IComBase.js +42 -0
  206. package/src/plugins/cxMixin/IContextMenu.js +74 -0
  207. package/src/plugins/cxMixin/IDataAcce.js +1106 -0
  208. package/src/plugins/cxMixin/IDataList.js +775 -0
  209. package/src/plugins/cxMixin/IDataMan.js +1670 -0
  210. package/src/plugins/cxMixin/IDataMan2.js +2561 -0
  211. package/src/plugins/cxMixin/IDataProc.js +379 -0
  212. package/src/plugins/cxMixin/IDatagrid.js +234 -0
  213. package/src/plugins/cxMixin/IEditableDg.js +477 -0
  214. package/src/plugins/cxMixin/IExpBase.js +51 -0
  215. package/src/plugins/cxMixin/IFormBase.js +29 -0
  216. package/src/plugins/cxMixin/IGridBpm.js +732 -0
  217. package/src/plugins/cxMixin/IGridData.js +109 -0
  218. package/src/plugins/cxMixin/IOperMore.js +323 -0
  219. package/src/plugins/cxMixin/IPlugBase.js +341 -0
  220. package/src/plugins/cxMixin/ISendCode.js +86 -0
  221. package/src/plugins/cxMixin/ISinglePage.js +112 -0
  222. package/src/plugins/cxMixin/ITags.js +81 -0
  223. package/src/plugins/cxe/CxeMap.vue +61 -0
  224. package/src/plugins/home/HeadNav.vue +194 -0
  225. package/src/plugins/home/Home.vue +59 -0
  226. package/src/plugins/home/HomePage.vue +237 -0
  227. package/src/plugins/home/Login.vue +139 -0
  228. package/src/plugins/zbcxCesium/coms/GraDrawBarWgt.vue +176 -0
  229. package/src/plugins/zbcxCesium/coms/baseMapSwitch/BaseMap.scss +42 -0
  230. package/src/plugins/zbcxCesium/coms/baseMapSwitch/BaseMap.vue +59 -0
  231. package/src/plugins/zbcxCesium/coms/dataPreview/DataPreview.vue +526 -0
  232. package/src/plugins/zbcxCesium/coms/dataPreview/DataPreviewPlug.vue +79 -0
  233. package/src/plugins/zbcxCesium/coms/dataPreview/ReadShpFile.js +42 -0
  234. package/src/plugins/zbcxCesium/coms/legend/Legend.vue +78 -0
  235. package/src/plugins/zbcxCesium/coms/popup/dialog-left-bg.png +0 -0
  236. package/src/plugins/zbcxCesium/coms/popup/index.js +88 -0
  237. package/src/plugins/zbcxCesium/coms/popup/index.vue +93 -0
  238. package/src/plugins/zbcxCesium/pub/LoadGeojson.js +44 -0
  239. package/src/plugins/zbcxCesium/pub/LoadModel.js +128 -0
  240. package/src/plugins/zbcxCesium/pub/LoadOgc.js +226 -0
  241. package/src/plugins/zbcxCesium/pub/Opacity.vue +139 -0
  242. package/src/plugins/zbcxCesium/pub/PubCxe.js +97 -0
  243. package/src/plugins/zbcxCesium/pub/SceneSet.vue +178 -0
  244. package/src/plugins/zbcxCesium/pub/ShowEffect.vue +216 -0
  245. package/src/plugins/zbcxCesium/pub/TMeasure.vue +122 -0
  246. package/src/plugins/zbcxCesium/pub/ToDefView3.vue +109 -0
  247. package/src/plugins/zbcxCesium/pub/getWmsGetCapabilities.js +127 -0
  248. package/src/plugins/zbcxCesium/utils/ShpToGeoJson.js +24 -0
  249. package/src/plugins/zbcxCesium/utils/WebProj4.js +32 -0
@@ -0,0 +1,2561 @@
1
+ /**
2
+ * 修改记录:
3
+ * 20-07-18 张发勇 增加一个函数 setAttOper(operCol),用于派生类自定义属性相关的操作按钮,简化派生类的代码
4
+ * 20-08-04 张发勇 增加一个函数 initAtt(att),用于输入属性之前,在派生类初始化属性(特殊情况下修改字段值)
5
+ * 21-02-19 张发勇 增加 onEditRow, 响应 event: edit-row
6
+ * 21-02-24 张发勇 增加 maxColWidth = 275, fontSize = 14, padding = 15 便于派生类修改
7
+ * 21-04-04 张发勇 增加函数 operView, operEdit, operDel 便于定制
8
+ * 21-06-09 张发勇 去掉前端直接传递表达式给后端,增加参数 sqlCfg, 支持 query, queryUnion
9
+ * 21-11-04 张发勇 去掉了 __update(), 增加了 getCur()
10
+ * 22-05-20 张发勇 升级到 element-plus
11
+ * 删除 useOperCols
12
+ * 删除 usePage
13
+ * selections -> selection
14
+ * page-change -> page-chang / pagesize-change
15
+ * onClickRow -> onRowClick
16
+ * onRowDblClick -> onRowDblClick
17
+ * onSelectionChange -> onSelectionChange
18
+ * onButtonClick -> onButtonClick
19
+ * onPageChange -> onPageChange
20
+ * 22-06-11 张发勇 js -> vue
21
+ * 23-05-31 张 清 放开init方法中operCols、cols空数组声明,解决多次调用init时保留上次的数据
22
+ * 23-07-16 张发勇 增加函数,exportData()-根据当前的查询条件去导出的数据,getDispCols()-,取当前显示的列名
23
+ * 23-07-31 张发勇 _upd()函数,增加数据修改标记,否则可输入的数据没有修改,保存按钮不可点击
24
+ * 23-08-12 张发勇 sqlexp.querPara()修改了参数,去掉major,minor
25
+ * 23-08-17 张清 更新注释,修改自动计算的默认参数,解决表头多行显示问题
26
+ * 23-08-23 张发勇 新增 tabCfgName, cfgFlds
27
+ * [retAtt = 0] 插入/修改是否返回数据(默认0,当editable = true的时候,默认值修改为 1)
28
+ * 支持列过滤
29
+ * 23-09-10 张发勇 beforeUpd() 去掉了加密功能,由属性编辑组件自己负责加密
30
+ * 23-09-13 张发勇 支持自己加入额外的字段
31
+ * 23-09-16 张发勇 字段信息需要深拷贝,后面会修改。
32
+ * 23-09-18 张发勇 支持 字段 / 属性 数据格式化、可视化
33
+ * 23-12-03 张发勇 去掉 onButtonClick, button-click, opers, calcOpers
34
+ * 新增 beforeDDVisible, rmenus, conFlds, conVals, conValues
35
+ * 23-12-06 张清 修复major、minor模式不显示字段
36
+ * 新增 setOpers, pluginState(), makeOpers()
37
+ * 新增 clearSelection()
38
+ * col.sortable 支持 custom
39
+ * 23-12-18 张清 增加 pluginState 默认函数中 conValues 缺省时对show、enable配置的处理
40
+ * 23-12-28 张发勇 增加 initPlugs() 支持非配置模式的插件配置
41
+ * 操作列的按钮 show-icon, show-title 默认由 cx.config.operCol 配置
42
+ * 24-01-01 张发勇 修改 dg.table.dropdown ->dg.table.operCfg
43
+ * 24-01-03 张发勇 BUG:没有配置右边键的时候,代码判断有BUG
44
+ * 24-01-05 张清 增加多选删除接口,解决多选删除表格不刷新bug
45
+ * 24-03-26 张发勇 解决 按钮点击 响应错误,在 plugin-click 里面需要更新 values
46
+ * 24-03-26 张清 把create中的变量移到initVariable方法,解决多次运行时历史数据未清除
47
+ * 24-04-02 张发勇 如果 tabcfg 没有设置 value, 默认设置 conValues = new cx.dc.IValuesBase
48
+ * 24-04-23 张发勇 修改列排序方式,对于使用排序的列,同时点击排序进行数据请求的,必须把sortable = custom,否则使用显示文本排序
49
+ * 24-04-24 张清 增加processQryData接口,支持查询完预处理数据
50
+ */
51
+
52
+ /**
53
+ * cx.mixin.IDataMan2
54
+ * 混淆类 - 数据管理(基于DataGrid)
55
+ *
56
+ * @module cx.mixin.IDataMan2
57
+ * @memberof cx.mixin
58
+ *
59
+ * @property {Number} major 接口-实体主类型,major和minor用于指定数据表和获取cx_fld中字段定义。与tabCfgName至少使用一种参数方式
60
+ * @property {Number} minor 接口-实体子类型
61
+ * @property {String} tabCfgName 接口-cx_tabcfg表中的name,对字段的展示配置。比major、minor优先级高
62
+ * @property {Array} [flds = null] 接口-要创建的的字段对象序列,null时就是用major/minor或mtabCfgName对应表的字段数据
63
+ * @property {Object} [dg] 接口-DataGrid对象
64
+ * @property {Boolean} [useExp = true] 接口-是否启用属性查询条件输入
65
+ * @property {Boolean} [useExpMore = true] 接口-是否启用属性查询条件输入(More)
66
+ * @property {Boolean} [noExpDispAll = false] 接口-没有查询条件显示所有数据
67
+ * @property {Boolean} [editable = false] 接口-是否可编辑
68
+ * @property {Number} [maxColWidth = 275] 接口-最大列宽(dynaWidth=true时用于计算列宽)
69
+ * @property {Number} [fontSize = 14] 接口-默认字体大小(dynaWidth=true时用于计算列宽)
70
+ * @property {Number} [padding = 20] 接口-padding值(dynaWidth=true时用于计算列宽)
71
+ * @property {Boolean} [dynaWidth = true] 接口-动态计算列宽,根据数据内容计算宽度,覆盖字段设置宽度
72
+ * @property {Number} [retAtt = 1] 接口-插入/修改是否返回数据(默认0,当editable = true的时候,默认值修改为 1)
73
+ * @property {cx.SqlEx} [defExp = null] 接口-默认条件(有自定义条件之后即删除),用 cx.sqlexp.from([['id', '>', 0]]) 构造
74
+ * @property {cx.SqlEx} [fixedExp = null] 接口-固定条件(任何时候都加上的条件)
75
+ * @property {Object} [unionQuery = null] 接口-联合查询参数
76
+ * @property {String} [unionQuery.mainAlias] 接口-主表别名(例如: "a")
77
+ * @property {String} [orderby] 接口-排序,asc(升序) desc(降序)
78
+ * @property {Object} [sqlCfg] 接口-SQL 配置
79
+ * @property {String} sqlCfg.key 接口-sqlexp 表的 name
80
+ * @property {String} sqlCfg.vals 接口-传递给 sqlexp 的值
81
+ * @property {String} sqlCfg.orderby 接口-排序信息
82
+ * @property {Object} [dynaForm] 接口-动态表单配置对象,属性录入/查看时可定制,其它参数见 cx.form
83
+ * @property {String} dynaForm.inputForm 接口-录入表单key
84
+ * @property {String} dynaForm.editForm 接口-修改表单key
85
+ * @property {String} dynaForm.viewForm 接口-查看表单key
86
+ */
87
+ export default
88
+ {
89
+ /** @member {Object} entity 实体对象 */
90
+ /** @member {cx.AttBase} attObj 属性对象 */
91
+ /** @member {String} tabName 表名,地图服务配置fld时构造字段对象,tabName 和 major,minor 至少要有一个 */
92
+ /** @member {Object} tabCfg 表格配置信息 (cx_tabcfg 信息) */
93
+ /** @member {Object} visuals 可视化配置 */
94
+ /** @member {Array} cfgFlds 显示的字段信息序列 */
95
+ /** @member {Array} expFlds 条件表达式字段列表 */
96
+ /** @member {Array.<String>} expRange 条件输入里面用于输入范围的列列表,由 tabCfg的range配置生成 */
97
+ /** @member {Array.<String>} expExclude 条件输入里面排除的列列表 */
98
+ /** @member {Object} queryPara SQL查询参数 */
99
+ /** @member {Object} attExp 条件表达式对象 */
100
+ /** @member {Array} list 数据 */
101
+ /** @member {Object} selected 当前选中的行 */
102
+ /** @member {Array.<Object>} selection 复选框选中的全部行 */
103
+ /** @member {Boolean} ready 是否初始化完成,尤其attObj是异步创建,必须ready后使用 */
104
+ data()
105
+ {
106
+ return {
107
+ flds: null,
108
+ expFlds: [],
109
+ list: [],
110
+ cols: [],
111
+
112
+ editable: false,
113
+ useExpMore: true,
114
+
115
+ selected: null, // 当前选中行
116
+ selection: [], // 多选数据
117
+ rmenus: [], // 右边键菜单(如果 cx_tabcfg 配置了 value 字段,则自动创建该对象)
118
+
119
+ // DataGrid组件的的datagrid默认参数
120
+ dg:
121
+ {
122
+ pages: true, // 是否使用分页
123
+ table:
124
+ {
125
+ elAtts:
126
+ {
127
+ border: true, // 是否带有纵向边框
128
+ stripe: true, // 是否为斑马纹 table
129
+ showSummary: false, // 是否在表尾显示合计行
130
+ 'row-style': ({ row, rowIndex }) => this.onRowStyle({ row, rowIndex }), // 行的 style 的回调方法,也可以使用一个固定的 Object 为所有行设置一样的 Style。
131
+ 'cell-style': ({ row, column, rowIndex, columnIndex }) => this.onCellStyle({ row, column, rowIndex, columnIndex }) // 单元格的 style 的回调方法,也可以使用一个固定的 Object 为所有单元格设置一样的 Style。
132
+ },
133
+ fitWidth: true, // 宽度自适应
134
+ multiple: false, // 是否支持多选
135
+ selectOnClick: true, // 点击某一行时会触发select选择事件,如果multiple多选模式会更新复选框的状态
136
+ operFix: 'right', // 操作列固定右边
137
+ list: [], // 数据列表
138
+ cols: [], // 列信息
139
+ operCols: [], // 操作列信息
140
+ operCfg: {}, // 操作列下拉信息(参见组件 cx-oper-group 的属性 dropdown)
141
+ pluginState: (plug, args) => this.pluginState(plug, args),
142
+ beforeDDVisible: (args) => this.beforeDropdown(args) // 消息响应函数-下拉操作展开之前的函数
143
+ },
144
+ page:
145
+ {
146
+ total: 0, // 数据量
147
+ currentPage: 1, // 当前页码
148
+ pageSize: cx.consts.PAGE_SIZE, // 每页记录数
149
+ pageSizes: cx.consts.PAGE_SIZES // 分页标准
150
+ }
151
+ }
152
+ }
153
+ },
154
+
155
+ /** @member {Boolean} enable1 选中一行数据 */
156
+ /** @member {Object} dgAtts DataGrid 属性 */
157
+ /** @member {Object} dgEvts DataGrid 事件 */
158
+ /** @member {Object} expAtts 表达式输入 属性 */
159
+ /** @member {Object} expEvts 表达式输入 事件 */
160
+ computed:
161
+ {
162
+ // 选中一行数据
163
+ enable1()
164
+ {
165
+ return !!this.selected
166
+ },
167
+
168
+ // DataGrid 属性
169
+ dgAtts()
170
+ {
171
+ return {
172
+ size: this.size,
173
+ datagrid: this.dg,
174
+ rmenus: this.rmenus
175
+ }
176
+ },
177
+
178
+ // DataGrid 事件
179
+ dgEvts()
180
+ {
181
+ return {
182
+ 'sort-change': (name, sort) => this.onSortChange(name, sort),
183
+ 'row-click': (att) => this.onRowClick(att),
184
+ 'row-dblclick': (att) => this.onRowDblClick(att),
185
+ 'selection-change': (selection) => this.onSelectionChange(selection),
186
+ 'plugin-click': (oper, att) => this.onPluginClick(oper, att),
187
+ 'edit-row': (oldRowIndex, newRowIndwx) => this.onEditRow(oldRowIndex, newRowIndwx),
188
+ 'pagesize-change': (pagesize) => this.onPagesizeChage(pagesize),
189
+ 'page-change': (pageno) => this.onPageChange(pageno),
190
+ 'row-contextmenu': (row, column, event) => this.onConextMmenu(row, column, event)
191
+ }
192
+ },
193
+
194
+ // 表达式输入 属性
195
+ expAtts()
196
+ {
197
+ return {
198
+ size: this.size,
199
+ flds: this.expFlds,
200
+ 'show-more': this.useExpMore
201
+ }
202
+ },
203
+
204
+ // 表达式输入 事件
205
+ expEvts()
206
+ {
207
+ return {
208
+ 'exp-search': () => this.onExpSearch(),
209
+ 'exp-clear': () => this.onExpClear(),
210
+ 'exp-more': () => this.onExpMore()
211
+ }
212
+ }
213
+ },
214
+
215
+ emits: ['sort-change', 'row-click', 'row-dblclick', 'selection-change'],
216
+
217
+ created()
218
+ {
219
+ // 添加属性, 非响应式
220
+ this.initVariable()
221
+ },
222
+
223
+ /**
224
+ * @method
225
+ */
226
+ mounted()
227
+ {
228
+ const self = this
229
+
230
+ // 监听
231
+ cx.events.listen(self, 'AttInsert', (params) =>
232
+ {
233
+ // eslint-disable-next-line
234
+ if (params.major == self.major && params.minor == self.minor)
235
+ {
236
+ self.attObj.numberize(params.newAtt)
237
+ self.afterAdd(params.newAtt)
238
+ self.gridAdd(params.newAtt)
239
+ ++this.dg.page.total
240
+ }
241
+ })
242
+
243
+ cx.events.listen(self, 'AttDelete', (params) =>
244
+ {
245
+ // eslint-disable-next-line
246
+ if (params.major == self.major && params.minor == self.minor)
247
+ {
248
+ self.afterDel(params.oldAtt)
249
+ self.gridDel(params.oldAtt)
250
+ --this.dg.page.total
251
+ }
252
+ })
253
+ cx.events.listen(self, 'AttsDelete', (params) =>
254
+ {
255
+ // eslint-disable-next-line
256
+ if (params.major == self.major && params.minor == self.minor)
257
+ {
258
+ params.oldAtts.forEach(item =>
259
+ {
260
+ self.afterDel(item)
261
+ self.gridDel(item)
262
+ })
263
+ this.dg.page.total = this.dg.page.total - params.oldAtts.length
264
+ }
265
+ })
266
+ cx.events.listen(self, 'AttUpdate', (params) =>
267
+ {
268
+ // eslint-disable-next-line
269
+ if (params.major == self.major && params.minor == self.minor)
270
+ {
271
+ self.attObj.numberize(params.newAtt)
272
+ self.afterUpd(params.newAtt)
273
+ self.gridUpd(params.newAtt, params.oldAtt)
274
+ }
275
+ })
276
+
277
+ self.init()
278
+ .catch(self.onError)
279
+ },
280
+
281
+ /**
282
+ * unmounted 钩子
283
+ * @method
284
+ */
285
+ beforeUnmount()
286
+ {
287
+ cx.events.unlisten(this)
288
+ // cx.run.closeRun('ExpMoreInput')
289
+
290
+ // 保存用户习惯
291
+ if (this.tabCfgName && this.colsSel)
292
+ cx.data.saveHabit(this.tabCfgName, { cols: this.colsSel }, this.habitId)
293
+ },
294
+
295
+ /**
296
+ * 混合方法
297
+ * @class
298
+ */
299
+ methods:
300
+ {
301
+ /**
302
+ * 初始化
303
+ * @method
304
+ */
305
+ async init()
306
+ {
307
+ const self = this
308
+
309
+ // DataGrid赋值
310
+ self.dg.table.list = self.list
311
+
312
+ // 初始化
313
+ const onInit = async(tabCfg) =>
314
+ {
315
+ let entity
316
+
317
+ // 根据表名设置 major, minor, tabName
318
+ if (tabCfg.tab && !self.major && !self.minor)
319
+ {
320
+ self.tabName = tabCfg.tab
321
+ entity = $g.entity.byName(tabCfg.tab)
322
+ if (entity)
323
+ {
324
+ self.major = entity.major
325
+ self.minor = entity.minor
326
+ }
327
+ }
328
+ if (self.major || self.minor || self.tabName)
329
+ {
330
+ // 实体信息
331
+ if (!entity)
332
+ entity = $g.entity.byMajMin(self.major, self.minor) || $g.entity.byName(self.tabName)
333
+ self.entity = entity
334
+ if (!self.entity)
335
+ {
336
+ self.$showSvr('noPermision')
337
+ return
338
+ }
339
+
340
+ // 取表对象
341
+ self.attObj = await $g.attFactory.byMajMin(self.major, self.minor, { flds: self.flds, tabname: self.tabName })
342
+
343
+ // 以后代码完全是兼容,有的代码直接取 this.flds (IAttBase)
344
+ if (!self.flds)
345
+ self.flds = self.attObj.flds
346
+
347
+ self.initTabCfg(tabCfg)
348
+
349
+ // 把配置的信息覆盖过来
350
+ self.attExp = self.defExp // 默认条件
351
+
352
+ // 条件表达式
353
+ self.expFlds = this.getExpFlds()
354
+ }
355
+
356
+ // 构造操作列
357
+ const operCols = self.getOpers()
358
+ // 把右边键的插件放到操作列
359
+ if (operCols.length > 0 && self.rmenus)
360
+ cx.array.appendArr(operCols[0].btns, self.rmenus)
361
+ self.dg.table.operCols = operCols
362
+
363
+ // 构造DataGrid列
364
+ const cols = self.getCols()
365
+ if (self.getEditCols)
366
+ self.attObj.makeEdit(cols, self.getEditCols())
367
+
368
+ // 修改组件排序方式,否则用内存字符串排序
369
+ for (let col of cols)
370
+ {
371
+ if (col.sortable)
372
+ col.sortable = 'custom'
373
+ }
374
+
375
+ self.cols = cols
376
+ self.dg.table.cols = self.grpDisp(cols)
377
+
378
+ // 属性可视化
379
+ self.makeVisual()
380
+
381
+ self.ready = 1
382
+
383
+ // 发起默认查询
384
+ if (self.fixedExp || self.attExp || self.unionQuery || self.sqlCfg.key || (!self.attExp && self.noExpDispAll))
385
+ {
386
+ self.makeQueryPara()
387
+ self.refresh()
388
+ }
389
+ }
390
+
391
+ // 取表配置信息
392
+ let tabCfg
393
+
394
+ if (self.tabCfgName)
395
+ {
396
+ const batch =
397
+ [
398
+ // 表格配置
399
+ {
400
+ type: cx.consts.SVR_QRY,
401
+ data:
402
+ {
403
+ _major: cx.consts.SYSTAB,
404
+ _minor: cx.consts.TAB_TABCFG,
405
+ _key: 'TabCfg',
406
+ vals: self.tabCfgName
407
+ }
408
+ },
409
+ cx.data.paramsBatchHabit(self.tabCfgName)
410
+ ]
411
+ cx.svr.data.batch(batch)
412
+ .then(ret =>
413
+ {
414
+ tabCfg = ret[0].data.length > 0 ? cx.converter.toJSON(ret[0].data[0]) : {}
415
+ const habit = ret[1].data.length > 0 ? cx.converter.toJSON(ret[1].data[0]) : {}
416
+
417
+ tabCfg.dispSel = habit.value ? habit.value.cols : null
418
+ self.habitId = habit.id
419
+
420
+ // 如果设置了 value, 则产生一个对象出来
421
+ if (tabCfg.value)
422
+ {
423
+ self.conValues = cx.base.newObj(tabCfg.value)
424
+ self.conFlds = new cx.dc.ExpFields() // 判断条件的字段对象
425
+ self.conVals = new cx.dc.ExpValues() // 判断条件的值对象
426
+ }
427
+
428
+ // 设置了分组
429
+ if (tabCfg.grps)
430
+ {
431
+ self.colGrps = tabCfg.grps
432
+ delete tabCfg.grps
433
+ }
434
+
435
+ // 如果设置了 plugs,则产生插件
436
+ if (tabCfg.plugs)
437
+ {
438
+ self.initPlugs(tabCfg.plugs)
439
+ .then(ret =>
440
+ {
441
+ onInit(tabCfg)
442
+ })
443
+ .catch(self.onError)
444
+ }
445
+ else
446
+ onInit(tabCfg)
447
+ })
448
+ .catch(self.onError)
449
+ }
450
+ else
451
+ {
452
+ tabCfg = {}
453
+
454
+ if (self.plugs)
455
+ {
456
+ self.initPlugs(self.plugs)
457
+ .then(ret =>
458
+ {
459
+ onInit(tabCfg)
460
+ })
461
+ .catch(self.onError)
462
+ }
463
+ else
464
+ onInit(tabCfg)
465
+ }
466
+ },
467
+
468
+ /**
469
+ * 初始化变量
470
+ * @method
471
+ */
472
+ initVariable()
473
+ {
474
+ // 添加属性, 非响应式
475
+ this.major = 0
476
+ this.minor = 0
477
+ this.tabName = ''
478
+ this.retAtt = 1
479
+ this.flds = null
480
+ this.entity = null
481
+ this.attObj = null
482
+
483
+ this.useExp = true
484
+ this.noExpDispAll = false
485
+ this.expRange = null
486
+ this.expExclude = null
487
+
488
+ this.defExp = null
489
+ this.fixedExp = null
490
+ this.unionQuery = null
491
+ this.sqlCfg = { key: '', vals: '', orderby: '' }
492
+
493
+ this.attExp = null
494
+ this.queryPara = {}
495
+ this.orderby = ''
496
+
497
+ this.maxColWidth = 275
498
+ this.fontSize = 14
499
+ this.padding = 20
500
+ this.dynaWidth = true
501
+
502
+ this.cols = [] // 在表格中显示的列
503
+
504
+ // 下面的属性不能使用响应式,否则造成大量的刷新
505
+ this.conFlds = null // 条件计算的字段信息
506
+ this.conVals = null // 条件计算的值
507
+ this.conValues = null // 提供值的对象(如果 cx_tabcfg 配置了 value 字段,则自动创建该对象)
508
+
509
+ this.tabCfgName = '' // 表格配置名
510
+ this.tabCfg = {} // 表格配置对象
511
+ this.cfgFlds = [] // 配置字段
512
+ this.colGrps = null // 字段分组
513
+ this.visuals = {} // 可视化字段配置(放在这里会变成响应式,带来严重的性能问题,切记!!!), 非响应式
514
+ this.colsSel = null // 当前选中的字段,因为到 beforUnmount 的时候, dg.table.cols 已经没有了
515
+ this.habitId = 0 // 用户习惯ID
516
+
517
+ // 复制cx.config.operCol
518
+ cx.config.cfgOperCfg(this.dg.table.operCfg, cx.config.operCol)
519
+ },
520
+
521
+ /**
522
+ * 表格配置信息
523
+ * @param {*} cols
524
+ */
525
+ initTabCfg(tabCfg)
526
+ {
527
+ // 1. 为了支持能把联表的字段显示正常,配置的时候 disporder 可以 < 0
528
+ // 2. 如果设置了显示字段,则默认值显示设置的字段,否则把 disporder != 0 的都显示出来
529
+ // 3. 如果设置了隐藏字段,则都不显示,过滤,搜索 都不出现
530
+ // 4. 如果设置了条件字段,则按照条件显示,否则按照 qrylevel = 1 的显示
531
+ // 5. 如果设置了范围条件的字段,则把其按照 range 的方式显示
532
+ // 6. 如果设置了不按照范围显示的字段,则把其按照 value 的方式显示
533
+
534
+ this.tabCfg = tabCfg
535
+
536
+ // 配置的字段信息
537
+ const flds = this.flds || this.attObj.flds
538
+ const cfgFlds = this.cfgFlds
539
+ const map = {} // 显示的列建索引
540
+ let fld, fld1
541
+
542
+ // 先把字段拷贝进来
543
+ for (fld of flds)
544
+ {
545
+ fld = cx.base.deepCopy({}, fld) // 拷贝出来
546
+ cfgFlds.push(fld)
547
+ map[fld.colname] = fld
548
+ }
549
+
550
+ // 再把定制字段和引用字段纳入
551
+ if (tabCfg.flds)
552
+ {
553
+ let arrName, added
554
+
555
+ for (fld1 of tabCfg.flds)
556
+ {
557
+ added = 0
558
+
559
+ // 拷贝一个新的字段,因为这里会修改数据,切记!!!
560
+ // 如果是引用了别的表的字段
561
+ if (fld1.ref)
562
+ {
563
+ arrName = fld1.ref.split(':')
564
+ // eslint-disable-next-line
565
+ if (arrName.length == 2)
566
+ fld = $g.field.getFld(arrName[0], arrName[1])
567
+ else
568
+ fld = map[arrName[0]]
569
+ if (!fld)
570
+ {
571
+ console.log('fld error: ' + fld1.ref)
572
+ continue
573
+ }
574
+ fld = cx.base.deepCopy({}, fld)
575
+ fld.colname = fld1.colname
576
+ cfgFlds.push(fld)
577
+ map[fld.colname] = fld
578
+ added = 1
579
+ }
580
+ else
581
+ {
582
+ fld = map[fld1.colname]
583
+ if (!fld)
584
+ {
585
+ fld = cx.fld.defFldDb(this.tabName, fld1.colname) // 不是字段里面的,构造一个默认字段
586
+ cfgFlds.push(fld)
587
+ map[fld.colname] = fld
588
+ added = 1
589
+ }
590
+ }
591
+
592
+ // 覆盖部分配置信息,其他部分信息,在显示字段里面去覆盖
593
+ if (cx.base.isNNull(fld1.title))
594
+ {
595
+ // 覆盖字段的标题
596
+ fld._label = cx.base.locOrStr(fld1.title)
597
+ fld.namec = fld._label
598
+ }
599
+ if (fld1.type)
600
+ fld.disptype = cx.fld.fldType(fld1.type)
601
+ if (cx.base.isNNull(fld1.isnum))
602
+ fld.isnum = fld1.isnum
603
+ if (cx.base.isNNull(fld1.disporder))
604
+ fld.disporder = fld1.disporder
605
+
606
+ if (!fld.params)
607
+ fld.params = {}
608
+ if (fld1.format)
609
+ fld.params.format = fld1.format
610
+ if (fld1.visual)
611
+ fld.params.visual = fld1.visual
612
+ if (fld1.valid)
613
+ fld.params.valid = fld1.valid
614
+ if (fld1.unit)
615
+ fld.params.unit = fld1.unit
616
+
617
+ if (added) // 添加了字段则把这个字段放到属性里面,解决 format 的问题
618
+ {
619
+ fld = cx.base.deepCopy({}, fld)
620
+ fld.disporder = 0 // 不显示
621
+ fld.nullable = 1 // 可为空
622
+ fld.defval = '' // 没有默认值
623
+ flds.push(fld)
624
+ }
625
+ }
626
+ }
627
+
628
+ // 隐藏字段
629
+ if (tabCfg.hide)
630
+ {
631
+ tabCfg.hide = tabCfg.hide.split(',')
632
+ for (fld1 of tabCfg.hide)
633
+ {
634
+ fld = map[fld1]
635
+ if (fld)
636
+ {
637
+ fld.disporder = 0 // 不显示
638
+ fld.qrylevel = 0 // 不能搜索
639
+ }
640
+ }
641
+ }
642
+
643
+ // 条件表达式的列
644
+ if (tabCfg.exp)
645
+ {
646
+ // 把原本作为条件表达式的字段去掉
647
+ cfgFlds.forEach(fld =>
648
+ {
649
+ // eslint-disable-next-line
650
+ if (fld.qrylevel == 1)
651
+ fld.qrylevel = 2 // 变成更多的时候查询
652
+ })
653
+
654
+ // 如果设置了 exp,则默认的字段序号需要改变
655
+ // 把设置搜索的字段 qrylevel = 1
656
+ tabCfg.exp = tabCfg.exp.split(',')
657
+ for (fld1 of tabCfg.exp)
658
+ {
659
+ // eslint-disable-next-line
660
+ fld = map[fld1]
661
+ if (fld)
662
+ fld.qrylevel = 1
663
+ }
664
+ }
665
+
666
+ // 排除搜索的列
667
+ if (tabCfg.noexp)
668
+ {
669
+ tabCfg.noexp = tabCfg.noexp.split(',')
670
+ for (fld1 of tabCfg.noexp)
671
+ {
672
+ // eslint-disable-next-line
673
+ fld = map[fld1]
674
+ if (fld)
675
+ fld.qrylevel = 0
676
+ }
677
+ }
678
+
679
+ // 对字段排序
680
+ cx.util.sortNum(this.cfgFlds, 'disporder')
681
+
682
+ // 如果设置了默认的显示字段,则需要调整到设定的顺序
683
+ const map2 = {}
684
+ let order = 1
685
+
686
+ // 先设置好默认显示出来的全部顺序
687
+ if (tabCfg.disp)
688
+ {
689
+ tabCfg.disp = tabCfg.disp.split(',')
690
+ for (fld1 of tabCfg.disp)
691
+ {
692
+ fld = map[fld1]
693
+ if (fld)
694
+ {
695
+ fld.disporder = order
696
+ map2[fld.colname] = order
697
+ order++
698
+ }
699
+ }
700
+ }
701
+ else
702
+ {
703
+ tabCfg.disp = []
704
+ cfgFlds.forEach(fld =>
705
+ {
706
+ if (fld.disporder)
707
+ tabCfg.disp.push(fld.colname)
708
+ })
709
+ }
710
+
711
+ // 如果用户过滤了列,再把用户的列显示出来
712
+ if (tabCfg.dispSel)
713
+ {
714
+ tabCfg.dispSel = tabCfg.dispSel.split(',')
715
+ for (fld1 of tabCfg.dispSel)
716
+ {
717
+ fld = map[fld1]
718
+ if (fld)
719
+ {
720
+ // 如果是默认显示的列,则已经设置好了
721
+ if (!map2[fld1])
722
+ {
723
+ fld.disporder = order
724
+ map2[fld.colname] = order
725
+ order++
726
+ tabCfg.disp.push(fld1)
727
+ }
728
+ }
729
+ }
730
+ }
731
+
732
+ // 对可以显示的字段重新排序
733
+ if (tabCfg.disp)
734
+ {
735
+ cfgFlds.forEach(fld =>
736
+ {
737
+ if (fld.disporder && !map2[fld.colname])
738
+ fld.disporder = order++
739
+ })
740
+
741
+ // 对字段再次排序
742
+ cx.util.sortNum(this.cfgFlds, 'disporder')
743
+ }
744
+
745
+ // 条件 - 范围
746
+ if (tabCfg.rang)
747
+ this.expRange = tabCfg.rang.split(',')
748
+
749
+ // 条件 - 去掉范围
750
+ if (tabCfg.norang)
751
+ this.expExclude = tabCfg.norang.split(',')
752
+
753
+ // 传递的参数
754
+ if (tabCfg.params)
755
+ cx.base.extend(this, tabCfg.params)
756
+ },
757
+
758
+ /**
759
+ * 字段分组显示
760
+ * @methid
761
+ * @param {Array.<col>} cols 字段数组
762
+ * @returns {Array.<col>} 构造成树结构显示成分组
763
+ */
764
+ grpDisp(cols)
765
+ {
766
+ /**
767
+ * 分组配置如下:
768
+ [
769
+ {
770
+ [grp: String], // 用于多语言, grp.{table}.{grp} 作为词条
771
+ title: String, // 默认标题(如果没有取到词条)
772
+ [children: Array.<grp>] // 儿子结点
773
+ [cols: String] // 放在该分组的列名(colname),逗号分隔
774
+ }
775
+ ]
776
+ */
777
+
778
+ if (!this.colGrps)
779
+ return cols
780
+
781
+ const tree = []
782
+ let count = 1, item
783
+
784
+ // 建对照
785
+ for (item of cols)
786
+ item.visible = true
787
+
788
+ // 递归组织成树
789
+ const _makeTree = (result, grpInfo) =>
790
+ {
791
+ let key = ''
792
+ const grp =
793
+ {
794
+ colname: `_${count++}`,
795
+ title: '',
796
+ align: 'center',
797
+ visible: true,
798
+ children: []
799
+ }
800
+
801
+ // 列标题
802
+ if (grpInfo.grp)
803
+ {
804
+ key = `fld.${this.entity.name}.${grpInfo.grp}`
805
+ grp.title = this.$loc(key)
806
+ }
807
+ // eslint-disable-next-line
808
+ if (!grp.title || grp.title == key)
809
+ grp.title = grpInfo.title
810
+
811
+ result.push(grp)
812
+
813
+ // 把列加入到组下面去
814
+ if (grpInfo.cols)
815
+ {
816
+ const map = {}
817
+ let col
818
+
819
+ // 建对照
820
+ for (col of grpInfo.cols.split(','))
821
+ map[col] = 1
822
+
823
+ for (col of cols)
824
+ {
825
+ // eslint-disable-next-line
826
+ key = col.colname[0] == '_' ? col.colname.substring(1) : col.colname
827
+
828
+ // 判断列名要不要加入到组
829
+ if (map[key])
830
+ {
831
+ grp.children.push(col)
832
+ delete map[key]
833
+ }
834
+ }
835
+ }
836
+
837
+ // 递归
838
+ if (grpInfo.children)
839
+ {
840
+ for (let child of grpInfo.children)
841
+ _makeTree(grp.children, child)
842
+ }
843
+ }
844
+
845
+ for (item of this.colGrps)
846
+ _makeTree(tree, item)
847
+
848
+ return tree
849
+ },
850
+
851
+ /**
852
+ * 初始化插件信息
853
+ * @method
854
+ * @param {String} plugs 配置插件(多个用,分隔)
855
+ * @returns {Promise}
856
+ */
857
+ initPlugs(plugs)
858
+ {
859
+ return cx.dc.Plug.plugs(plugs.split())
860
+ .then(ret =>
861
+ {
862
+ this.rmenus = ret
863
+
864
+ this.makeOpers(ret)
865
+ return ret
866
+ })
867
+ },
868
+
869
+ /**
870
+ * 构造数据可视化对象
871
+ * @method
872
+ */
873
+ makeVisual()
874
+ {
875
+ // -------------------------------------------
876
+ // 按照这样的格式设置
877
+ // {
878
+ // 1: // 列索引
879
+ // {
880
+ // colname: 'completed', // 字段名
881
+ // visual: Object // 可视化对象
882
+ // }
883
+ // }
884
+
885
+ const visuals = {}
886
+ const cols = []
887
+ let colno = this.dg.table.multiple ? 1 : 0 // 多选的时候,前面多了选择列
888
+ let col, colname, visual
889
+
890
+ for (col of this.cols)
891
+ {
892
+ if (col.visible)
893
+ {
894
+ colno++
895
+
896
+ colname = col.colname
897
+ // eslint-disable-next-line
898
+ if (colname[0] == '_')
899
+ colname = colname.substring(1)
900
+ cols.push(colname)
901
+
902
+ if (col.visual) // 配置的规则
903
+ {
904
+ visual = cx.datavsl.get(col.visual)
905
+ if (visual)
906
+ visuals[colno] = { colname, visual }
907
+ }
908
+ }
909
+ }
910
+
911
+ this.visuals = visuals
912
+ this.colsSel = cols.toString()
913
+ },
914
+
915
+ /**
916
+ * 行样式
917
+ * @method
918
+ * @param {Object} opts 参数对象
919
+ * @param {Object} pts.aatt 行数据
920
+ * @param {Number} pts.arowIndex 行索引
921
+ * @returns {Object} 样式对象
922
+ */
923
+ onRowStyle({ att, rowIndex })
924
+ {
925
+ },
926
+
927
+ /**
928
+ * 单元格样式
929
+ * @method
930
+ * @param {Object} opts 参数对象
931
+ * @param {Object} opts.att 行数据
932
+ * @param {Object} opts.column 列数据
933
+ * @param {Number} opts.rowIndex 行索引
934
+ * @param {Number} opts.columnIndex 列索引
935
+ * @returns {Object} 样式对象
936
+ */
937
+ onCellStyle({ row, column, rowIndex, columnIndex })
938
+ {
939
+ const obj = this.visuals[columnIndex]
940
+
941
+ if (obj)
942
+ {
943
+ // eslint-disable-next-line
944
+ if (obj.visual.attMode == cx.consts.FLDMODE)
945
+ return obj.visual.visual(row[obj.colname])
946
+ else
947
+ return obj.visual.visual(row)
948
+ }
949
+ },
950
+
951
+ /**
952
+ * 按列头排序
953
+ * @method
954
+ * @param {String} name 排序字段
955
+ * @param {String} order 排序方式
956
+ */
957
+ onSortChange(name, order)
958
+ {
959
+ if (name)
960
+ {
961
+ // eslint-disable-next-line
962
+ if (name[0] == '_')
963
+ name = name.substring(1)
964
+ }
965
+ if (name && order)
966
+ this.orderby = (this.unionQuery && this.unionQuery.mainAlias ? this.unionQuery.mainAlias + '.' : '') + name + ' ' + order
967
+ else
968
+ this.orderby = ''
969
+ this.query()
970
+ },
971
+
972
+ /**
973
+ * 点击行
974
+ * @method
975
+ * @param {Object} att 行数据
976
+ */
977
+ onRowClick(att)
978
+ {
979
+ this.selected = att
980
+
981
+ /**
982
+ * 单击行事件
983
+ * @event row-click
984
+ * @param {Object} setected 单击行的数据
985
+ */
986
+ this.$emit('row-click', att)
987
+ },
988
+
989
+ /**
990
+ * 双击行
991
+ * @method
992
+ * @param {Object} att 行数据
993
+ */
994
+ onRowDblClick(att)
995
+ {
996
+ this.selected = att
997
+
998
+ /**
999
+ * 双击行事件
1000
+ * @event row-dbclick
1001
+ * @param {Object} setected 双击行的数据
1002
+ */
1003
+ this.$emit('row-dbclick', att)
1004
+ },
1005
+
1006
+ /**
1007
+ * 选择发生变化
1008
+ * @method
1009
+ * @param {Array} selection 选中的行数据
1010
+ */
1011
+ onSelectionChange(selection)
1012
+ {
1013
+ this.selection = selection
1014
+
1015
+ /**
1016
+ * 勾选行事件
1017
+ * @event selection-change
1018
+ * @param {Array.<Object>} selection 复选框选中的全部行
1019
+ */
1020
+ this.$emit('selection-change', selection)
1021
+ },
1022
+
1023
+ /**
1024
+ * 消息响应函数-每页数据量变化
1025
+ * @method
1026
+ * @param {Number} pagesize 选中的页码
1027
+ */
1028
+ onPagesizeChage(pagesize)
1029
+ {
1030
+ if (this.dg.page.pageSize !== pagesize)
1031
+ this.dg.page.pageSize = pagesize
1032
+
1033
+ this.queryPara.pagesize = pagesize
1034
+ this.queryPara.pageno = 1
1035
+ this.query()
1036
+ },
1037
+
1038
+ /**
1039
+ * 消息响应函数-选中某页
1040
+ * @method
1041
+ * @param {Number} pageNo 选中的页码
1042
+ */
1043
+ onPageChange(pageNo)
1044
+ {
1045
+ if (this.dg.page.currentPage !== pageNo)
1046
+ this.dg.page.currentPage = pageNo
1047
+
1048
+ if (this.queryPara.pageno !== pageNo)
1049
+ {
1050
+ this.queryPara.pageno = pageNo < 1 ? 1 : pageNo
1051
+ this.query()
1052
+ }
1053
+ },
1054
+
1055
+ /**
1056
+ * 右键菜单
1057
+ * @method
1058
+ * @param {Object} row 当前行
1059
+ * @param {Object} column 列信息
1060
+ * @param {Object} event 事件
1061
+ */
1062
+ onConextMmenu(row, column, event)
1063
+ {
1064
+ this.hideRMenu(event)
1065
+
1066
+ if (row !== this.selected)
1067
+ {
1068
+ this.getDatagrid().getTable().getElTable().setCurrentRow(row)
1069
+ this.selected = row
1070
+ this.$emit('row-click', row)
1071
+ }
1072
+
1073
+ if (this.rmenus.length > 0)
1074
+ {
1075
+ this.makeFldVal(row)
1076
+ cx.dc.Plug.state(this.rmenus, this.conVals, this.conFlds)
1077
+ }
1078
+
1079
+ this.showRMenu(event)
1080
+ },
1081
+
1082
+ /**
1083
+ * 显示右边键菜单
1084
+ * @method
1085
+ * @param {Object} event 事件对象
1086
+ */
1087
+ showRMenu(event)
1088
+ {
1089
+ this.getDatagrid().getRMenu().show(event)
1090
+ },
1091
+
1092
+ /**
1093
+ * 隐藏右边键菜单
1094
+ * @method
1095
+ * @param {Object} event 事件对象
1096
+ */
1097
+ hideRMenu(event)
1098
+ {
1099
+ this.getDatagrid().getRMenu().hide(event)
1100
+ },
1101
+
1102
+ /**
1103
+ * 确定插件当前的状态
1104
+ * @method
1105
+ * @param {Object} plug 插件对象
1106
+ * @param {Object} args 参数
1107
+ * @returns {Object} { visible: Boolean, disabled: Boolean }
1108
+ */
1109
+ pluginState(plug, args)
1110
+ {
1111
+ // 这里没有调用关闭函数,是因为 hideMenu 需要参数 event
1112
+ // this.hideRMenu(null)
1113
+ if (this.conValues)
1114
+ {
1115
+ this.makeFldVal(args)
1116
+ return cx.dc.Plug.state2(plug, this.conVals, this.conFlds)
1117
+ }
1118
+
1119
+ // 根据配置控制
1120
+ let show = true
1121
+ if (cx.base.isFunc(plug.show))
1122
+ show = plug.show(args)
1123
+ else if (cx.base.isNNull(plug.show))
1124
+ show = plug.show
1125
+
1126
+ let enable = true
1127
+ if (cx.base.isFunc(plug.enable))
1128
+ enable = plug.enable(args)
1129
+ else if (cx.base.isNNull(plug.enable))
1130
+ enable = plug.enable
1131
+
1132
+ return { visible: show, disabled: !enable }
1133
+ },
1134
+
1135
+ /**
1136
+ * 消息响应函数-下拉操作展开之前
1137
+ * @method
1138
+ * @param {Object} args 参数
1139
+ */
1140
+ beforeDropdown(args)
1141
+ {
1142
+ // 这里没有调用关闭函数,是因为 hideMenu 需要参数 event
1143
+ // this.hideRMenu(null)
1144
+ this.makeFldVal(args)
1145
+ cx.dc.Plug.state(this.rmenus, this.conVals, this.conFlds)
1146
+ },
1147
+
1148
+ // 生成条件表达式计算的字段信息、值
1149
+ makeFldVal(att)
1150
+ {
1151
+ if (this.conValues)
1152
+ {
1153
+ this.conFlds.clear()
1154
+ this.conVals.clear()
1155
+ this.conValues.values(this.conFlds, this.conVals, att, null, this)
1156
+ }
1157
+ },
1158
+
1159
+ // 取插件运行参数
1160
+ plugParams(key, curNode)
1161
+ {
1162
+ switch (key)
1163
+ {
1164
+ case '{context}':
1165
+ return this
1166
+ case '{values}':
1167
+ return this.conVals.values
1168
+ case '{curNode}':
1169
+ return curNode ? curNode : this.selected
1170
+ case '{selection}':
1171
+ return this.selection
1172
+ }
1173
+ },
1174
+
1175
+ /**
1176
+ * 点击插件
1177
+ * @method
1178
+ * @param {Object} oper 点击的操作
1179
+ * @param {Array} args 行数据
1180
+ */
1181
+ onPluginClick(oper, args)
1182
+ {
1183
+ // 预防点击的时候,没有改变 values 里面的值
1184
+ const att = args ? args : this.selected
1185
+
1186
+ if (this.conValues)
1187
+ {
1188
+ this.makeFldVal(att)
1189
+ cx.dc.Plug.state2(oper, this.conVals, this.conFlds)
1190
+ }
1191
+
1192
+ cx.dc.Plug.execute(oper, this.plugParams, att, this.selection, this)
1193
+ },
1194
+
1195
+ /**
1196
+ * 消息响应函数-根据自定义表达式搜索
1197
+ * @method
1198
+ */
1199
+ onExpSearch()
1200
+ {
1201
+ // 默认查询
1202
+ if (!this.makeAttExp())
1203
+ return
1204
+
1205
+ const defExp = cx.sqlexp.getDefExp() // 空表达式
1206
+ const page = this.getDatagrid().getPage()
1207
+
1208
+ cx.sqlexp.merge(defExp, this.fixedExp, this.attExp)
1209
+ this.queryPara = cx.sqlexp.queryPara(defExp, this.dg.pages ? this.dg.page.pageSize : 0)
1210
+ if (page)
1211
+ page.currentPage = 1
1212
+ this.query()
1213
+ },
1214
+
1215
+ /**
1216
+ * 消息响应函数-根据自定义表达式搜索
1217
+ * @method
1218
+ */
1219
+ onExpClear()
1220
+ {
1221
+ for (let fld of this.expFlds)
1222
+ {
1223
+ fld.value = ''
1224
+ fld.value1 = ''
1225
+ fld.value2 = ''
1226
+ }
1227
+ },
1228
+
1229
+ /**
1230
+ * 消息响应函数-更多条件过滤
1231
+ * @method
1232
+ */
1233
+ onExpMore()
1234
+ {
1235
+ const self = this
1236
+ const params =
1237
+ {
1238
+ flds: self.expFlds,
1239
+ unionQuery: self.unionQuery,
1240
+ onOk: (attExp) =>
1241
+ {
1242
+ const defExp = cx.sqlexp.getDefExp() // 空表达式
1243
+
1244
+ self.attExp = attExp
1245
+ cx.sqlexp.merge(defExp, self.fixedExp, self.attExp)
1246
+ self.queryPara = cx.sqlexp.queryPara(defExp, self.dg.pages ? self.dg.page.pageSize : 0)
1247
+
1248
+ self.query()
1249
+ }
1250
+ }
1251
+ cx.run.runPlug('ExpMoreInput', params)
1252
+ },
1253
+
1254
+ /**
1255
+ * 字段可视化发生变化
1256
+ */
1257
+ onFldVisible(col)
1258
+ {
1259
+ this.updColsWidth()
1260
+ this.makeVisual()
1261
+ },
1262
+
1263
+ /**
1264
+ * 消息响应函数-刷新
1265
+ * @method
1266
+ */
1267
+ onRefresh()
1268
+ {
1269
+ this.clearSelection()
1270
+ this.refresh()
1271
+ },
1272
+
1273
+ /**
1274
+ * 消息响应函数-刷新一条记录
1275
+ * @method
1276
+ */
1277
+ onRefreshA()
1278
+ {
1279
+ this.refreshA()
1280
+ },
1281
+
1282
+ /**
1283
+ * 事件 edit-row 响应函数
1284
+ * @param {Number} oldRowIndex 旧行
1285
+ * @param {Number} newRowIndex 新行
1286
+ */
1287
+ onEditRow(oldRowIndex, newRowIndex)
1288
+ {
1289
+ },
1290
+
1291
+ /**
1292
+ * 取当前选中的行
1293
+ * @method
1294
+ * @returns {Object}
1295
+ */
1296
+ getSelected()
1297
+ {
1298
+ return this.selected
1299
+ },
1300
+
1301
+ /**
1302
+ * 返回当前行
1303
+ * @method
1304
+ * @returns {Object}
1305
+ */
1306
+ getCur()
1307
+ {
1308
+ return this.selected
1309
+ },
1310
+
1311
+ /**
1312
+ * 获取缺省的exp-input条件列字段信息
1313
+ * @method
1314
+ * @returns {Array} 返回条件字段对象序列
1315
+ */
1316
+ getDefExpFlds()
1317
+ {
1318
+ let expFlds = []
1319
+ if (this.useExp)
1320
+ this.attObj.makeExp(expFlds, this.expRange, this.expExclude, this.cfgFlds)
1321
+
1322
+ return expFlds
1323
+ },
1324
+
1325
+ /**
1326
+ * 获取的exp-input条件列字段信息
1327
+ * @method
1328
+ * @returns {Array} 返回条件字段对象序列
1329
+ */
1330
+ getExpFlds()
1331
+ {
1332
+ return this.getDefExpFlds()
1333
+ },
1334
+
1335
+ /**
1336
+ * 获取缺省的datagrid列字段信息
1337
+ * @method
1338
+ * @returns {Array} 返回datagrid列字段
1339
+ */
1340
+ getDefCols()
1341
+ {
1342
+ return cx.datagrid.getDefCols2(this.cfgFlds, this.tabCfg)
1343
+ },
1344
+
1345
+ /**
1346
+ * 获取datagrid列字段信息
1347
+ * @method
1348
+ * @returns {Array} 返回datagrid列字段
1349
+ */
1350
+ getCols()
1351
+ {
1352
+ return this.getDefCols()
1353
+ },
1354
+
1355
+ /**
1356
+ * 设置全部操作的配置
1357
+ * @method
1358
+ * @param {Array} opers 操作数组o
1359
+ * @returns {Object} this
1360
+ */
1361
+ makeOpers(opers)
1362
+ {
1363
+ const operCfg = this.dg.table.operCfg
1364
+
1365
+ for (let oper of opers)
1366
+ {
1367
+ if (cx.base.isNNull(operCfg.showTitle))
1368
+ oper.showTitle = operCfg.showTitle
1369
+ if (cx.base.isNNull(operCfg.showIcon))
1370
+ oper.showIcon = operCfg.showIcon
1371
+ }
1372
+ },
1373
+
1374
+ /**
1375
+ * 设置操作的下拉菜单
1376
+ * @param {Boolean} [showTitle] 是否显示标题
1377
+ * @param {Boolean} [showIcon] 是否显示图标
1378
+ */
1379
+ setOpers(showTitle, showIcon)
1380
+ {
1381
+ cx.config.setOperCfg(this.dg.table.operCfg, showTitle, showIcon)
1382
+ },
1383
+
1384
+ /**
1385
+ * 取操作按钮信息
1386
+ * @method
1387
+ * @returns {Array.<Object>} 操作列对象序列
1388
+ * @example
1389
+ * [{
1390
+ * colname: String,
1391
+ * title: String,
1392
+ * width: Number,
1393
+ * max: Nunber,
1394
+ * [align: String = 'center']
1395
+ * btns: [{name: String, title: String, onClick: Function}]
1396
+ * }]
1397
+ */
1398
+ getOpers()
1399
+ {
1400
+ return this.getDefOpers()
1401
+ },
1402
+
1403
+ /**
1404
+ * 取默认操作按钮信息
1405
+ * @method
1406
+ * @returns {Array.<Object>} 操作列对象序列,默认只有一个对象,btns属性是该列的按钮
1407
+ * @example
1408
+ * [{
1409
+ * colname: String,
1410
+ * title: String,
1411
+ * width: Number,
1412
+ * max: Nunber,
1413
+ * [align: String = 'center']
1414
+ * btns: [{name: String, title: String, onClick: Function}]
1415
+ * }]
1416
+ */
1417
+ getDefOpers()
1418
+ {
1419
+ // 增/删/改/查操作
1420
+ const operCol = this.getColOper()
1421
+ if (!this.editable)
1422
+ this.addOperView(operCol)
1423
+ else
1424
+ {
1425
+ this.addOperEdit(operCol)
1426
+ .addOperDel(operCol)
1427
+ }
1428
+ this.setAttOper(operCol)
1429
+
1430
+ return [operCol]
1431
+ },
1432
+
1433
+ /**
1434
+ * 设置属性相关的按钮
1435
+ * @method
1436
+ * @abstract
1437
+ * @param {Object} operCol 操作列
1438
+ * @returns {Object} this
1439
+ */
1440
+ setAttOper(operCol)
1441
+ {
1442
+ return this
1443
+ },
1444
+
1445
+ /**
1446
+ * 操作列
1447
+ * @method
1448
+ * @returns {Object}
1449
+ */
1450
+ getColOper()
1451
+ {
1452
+ return { colname: 'rud_', title: this.$locBase('oper'), width: this.editable ? 95 : 70, max: 3, align: 'center', btns: [] }
1453
+ },
1454
+
1455
+ /**
1456
+ * 增加操作-浏览
1457
+ * @method
1458
+ * @param {Object} operCol 操作列
1459
+ * @returns {Object} this
1460
+ */
1461
+ addOperView(operCol)
1462
+ {
1463
+ const oper = cx.datagrid.getOper('view_', this.$locBase('view'), '')
1464
+
1465
+ oper.enable = (att) => true
1466
+ oper.show = (att) => !this.editable || !!att.completed || (this.editable && !!att.procinstid)
1467
+ oper.onClick = (att) =>
1468
+ {
1469
+ this._view(att)
1470
+ }
1471
+
1472
+ this.operView(oper)
1473
+ operCol.btns.push(oper)
1474
+ return this
1475
+ },
1476
+
1477
+ /**
1478
+ * 增加操作-编辑
1479
+ * @method
1480
+ * @param {Object} operCol 操作列
1481
+ * @returns {Object} this
1482
+ */
1483
+ addOperEdit(operCol)
1484
+ {
1485
+ const oper = cx.datagrid.getOper('edit_', this.$locBase('edit'), '')
1486
+
1487
+ oper.type = 'warning'
1488
+ oper.enable = (att) => true
1489
+ oper.show = (att) => !!this.editable && !att.completed && !att.procinstid
1490
+ oper.onClick = (att) =>
1491
+ {
1492
+ this._upd(att)
1493
+ }
1494
+ // oper.icon = cx.config.icon.edit
1495
+ // oper.showLabel = false
1496
+
1497
+ this.operEdit(oper)
1498
+ operCol.btns.push(oper)
1499
+ return this
1500
+ },
1501
+
1502
+ /**
1503
+ * 增加操作-删除
1504
+ * @method
1505
+ * @param {Object} operCol 操作列
1506
+ * @returns {Object} this
1507
+ */
1508
+ addOperDel(operCol)
1509
+ {
1510
+ const oper = cx.datagrid.getOper('del_', this.$locBase('del'), '')
1511
+
1512
+ oper.type = 'danger'
1513
+ oper.enable = (att) => true
1514
+ oper.show = (att) => !!this.editable && !att.completed && !att.bill
1515
+ oper.onClick = (att) =>
1516
+ {
1517
+ this._del(att)
1518
+ }
1519
+ // oper.icon = cx.config.icon.del
1520
+ // oper.showIcon = false
1521
+
1522
+ this.operDel(oper)
1523
+ operCol.btns.push(oper)
1524
+ return this
1525
+ },
1526
+
1527
+ /**
1528
+ * 增加操作-完成->未完成
1529
+ * @method
1530
+ * @param {Object} operCol 操作列
1531
+ * @returns {Object} this
1532
+ */
1533
+ addOperCompelete(operCol)
1534
+ {
1535
+ const oper = cx.datagrid.getOper('uncomp_', this.$loc('cx.btnUncompelete'), '')
1536
+
1537
+ oper.type = 'warning'
1538
+ oper.enable = (att) => true
1539
+ oper.show = (att) => !!this.editable && att.completed && !att.procinstid
1540
+ oper.onClick = (att) =>
1541
+ {
1542
+ this._complete(att, 0)
1543
+ }
1544
+
1545
+ operCol.btns.push(oper)
1546
+ return this
1547
+ },
1548
+
1549
+ /**
1550
+ * 增加操作-详情
1551
+ * @method
1552
+ * @param {Object} operCol 操作列
1553
+ * @returns {Object} this
1554
+ */
1555
+ addOperDetail(operCol)
1556
+ {
1557
+ const oper = cx.datagrid.getOper('detail_', this.$locBase('detail'), '')
1558
+
1559
+ oper.enable = (att) => true
1560
+ oper.show = (att) => att.procinstid
1561
+ oper.onClick = (att) =>
1562
+ {
1563
+ this._detail(att)
1564
+ }
1565
+
1566
+ operCol.btns.push(oper)
1567
+ return this
1568
+ },
1569
+
1570
+ /**
1571
+ * 定制函数-操作/查看
1572
+ * @method
1573
+ * @param {Object} oper 操作对象
1574
+ */
1575
+ operView(oper)
1576
+ {
1577
+ },
1578
+
1579
+ /**
1580
+ * 定制函数-操作/编辑
1581
+ * @method
1582
+ * @param {Object} oper 操作对象
1583
+ */
1584
+ operEdit(oper)
1585
+ {
1586
+ },
1587
+
1588
+ /**
1589
+ * 定制函数-操作/删除
1590
+ * @method
1591
+ * @param {Object} oper 操作对象
1592
+ */
1593
+ operDel(oper)
1594
+ {
1595
+ },
1596
+
1597
+ /**
1598
+ * 异常处理函数
1599
+ * @method
1600
+ * @param {Object} err 异常对象
1601
+ */
1602
+ onError(err)
1603
+ {
1604
+ // this.$processing.close()
1605
+ this.$showRet(err)
1606
+ },
1607
+
1608
+ /**
1609
+ * 刷新
1610
+ * @method
1611
+ */
1612
+ refresh()
1613
+ {
1614
+ if (this.dg.pages)
1615
+ {
1616
+ this.queryPara.init = 0 // 重新查询
1617
+ this.queryPara.pageno = 1
1618
+ this.queryPara.pagesize = this.dg.page.pageSize
1619
+ }
1620
+ this.query()
1621
+ },
1622
+
1623
+ /**
1624
+ * 刷新当前页
1625
+ * @method
1626
+ */
1627
+ refreshPage()
1628
+ {
1629
+ if (this.dg.pages)
1630
+ this.queryPara.init = 0 // 重新查询
1631
+
1632
+ this.query()
1633
+ },
1634
+
1635
+ /**
1636
+ * 刷新一条记录
1637
+ * @method
1638
+ refreshA(att)
1639
+ {
1640
+ if (!att)
1641
+ att = this.selected
1642
+ if (!att)
1643
+ return
1644
+
1645
+ cx.svr.data.queryId(this.major, this.minor, att.id)
1646
+ .then(ret =>
1647
+ {
1648
+ this.gridUpd(ret, att)
1649
+ })
1650
+ },
1651
+
1652
+ /**
1653
+ * 更新列的宽度
1654
+ */
1655
+ updColsWidth()
1656
+ {
1657
+ cx.datagrid.makeColsFitWidth(this.cols, this.list, this.maxColWidth, this.fontSize, this.padding)
1658
+ },
1659
+
1660
+ /**
1661
+ * 向数据库发查询请求
1662
+ * @method
1663
+ */
1664
+ query()
1665
+ {
1666
+ // 回调函数
1667
+ const onSuccess = async ret =>
1668
+ {
1669
+ let data = [], total = 0
1670
+ let att
1671
+
1672
+ this.$processing.close()
1673
+
1674
+ if (ret instanceof Array)
1675
+ {
1676
+ data = ret
1677
+ total = 0
1678
+ }
1679
+ else
1680
+ {
1681
+ data = ret.data
1682
+ total = ret.total
1683
+ }
1684
+
1685
+ // 当前选中行还在不在?
1686
+ if (this.selected)
1687
+ {
1688
+ if (!cx.array.get1(data, { id: this.selected }))
1689
+ this.selected = null
1690
+ }
1691
+ data = await this.processQryData(data, this)
1692
+
1693
+ // 显示数据
1694
+ for (att of data)
1695
+ this.getDisp(att)
1696
+
1697
+ this.afterQuery()
1698
+
1699
+ if (this.dg.pages)
1700
+ {
1701
+ if (!this.queryPara.init)
1702
+ {
1703
+ this.queryPara.init = 1
1704
+ this.dg.page.total = total
1705
+ }
1706
+ }
1707
+
1708
+ cx.array.appendArr(this.list, data)
1709
+
1710
+ // 根据数据和字段更新列宽度
1711
+ if (this.dynaWidth)
1712
+ this.updColsWidth()
1713
+ }
1714
+
1715
+ // 装配参数
1716
+ if (this.sqlCfg.key)
1717
+ {
1718
+ this.queryPara._key = this.sqlCfg.key
1719
+
1720
+ // eslint-disable-next-line
1721
+ if (this.sqlCfg.vals != undefined && this.sqlCfg.vals != null && this.sqlCfg.vals !== '')
1722
+ this.queryPara.vals = this.sqlCfg.vals
1723
+
1724
+ if (this.sqlCfg.orderby)
1725
+ this.queryPara.orderby = this.sqlCfg.orderby
1726
+ if (this.sqlCfg.args)
1727
+ this.queryPara.args = this.sqlCfg.args
1728
+ }
1729
+ if (this.orderby)
1730
+ this.queryPara.orderby = this.orderby
1731
+
1732
+ if (this.queryPara.args.length < 1 && !this.sqlCfg.key) // 如果没有条件表达式
1733
+ {
1734
+ if (this.noExpDispAll) // 没有查询条件显示所有数据
1735
+ {
1736
+ this.queryPara.args = [['id', '>', 0]]
1737
+ this.queryPara.orderby = 'id desc'
1738
+ }
1739
+ else
1740
+ return
1741
+ }
1742
+ if (!this.queryPara.args)
1743
+ delete this.queryPara.args
1744
+
1745
+ this.beforeQuery()
1746
+ cx.array.clear(this.dg.table.list)
1747
+ this.runSvr(onSuccess)
1748
+ },
1749
+
1750
+ /**
1751
+ * 调取服务进行查询
1752
+ * @method
1753
+ * @param {Function} onSuccess 查询成功后的回调函数
1754
+ */
1755
+ runSvr(onSuccess)
1756
+ {
1757
+ // 发起调用
1758
+ this.$processing.show()
1759
+ cx.svr.data.query(this.major, this.minor, this.queryPara)
1760
+ .then(onSuccess)
1761
+ .catch(err =>
1762
+ {
1763
+ this.$processing.close()
1764
+ this.onError(err)
1765
+ })
1766
+ },
1767
+
1768
+ /**
1769
+ * 产生查询参数
1770
+ * @method
1771
+ */
1772
+ makeQueryPara()
1773
+ {
1774
+ const exp = cx.sqlexp.getDefExp() // 空表达式
1775
+
1776
+ cx.sqlexp.merge(exp, this.fixedExp, this.attExp)
1777
+ this.queryPara = cx.sqlexp.queryPara(exp, this.dg.pages ? this.dg.page.pageSize : 0)
1778
+ },
1779
+
1780
+ /**
1781
+ * 根据当前的查询条件,返回数据,导出数据
1782
+ * @returns {Promise}
1783
+ */
1784
+ exportData()
1785
+ {
1786
+ const self = this
1787
+ const sqlCfg = self.sqlCfg
1788
+ const exp = cx.sqlexp.getDefExp() // 空表达式
1789
+ cx.sqlexp.merge(exp, self.fixedExp, self.attExp)
1790
+
1791
+ const params = cx.sqlexp.queryPara(exp, 0)
1792
+
1793
+ if (sqlCfg.key)
1794
+ {
1795
+ params._key = sqlCfg.key
1796
+
1797
+ // eslint-disable-next-line
1798
+ if (sqlCfg.vals != undefined && sqlCfg.vals != null && sqlCfg.vals !== '')
1799
+ params.vals = sqlCfg.vals
1800
+
1801
+ if (sqlCfg.orderby)
1802
+ params.orderby = sqlCfg.orderby
1803
+ if (sqlCfg.args)
1804
+ params.args = sqlCfg.args
1805
+ }
1806
+ if (self.orderby)
1807
+ params.orderby = self.orderby
1808
+
1809
+ if (params.args.length < 1 && !sqlCfg.key) // 如果没有条件表达式
1810
+ {
1811
+ if (self.noExpDispAll) // 没有查询条件显示所有数据
1812
+ {
1813
+ params.args = [['id', '>', 0]]
1814
+ params.orderby = 'id desc'
1815
+ }
1816
+ }
1817
+ if (params.args.length < 1)
1818
+ delete params.args
1819
+
1820
+ // 发起调用
1821
+ return cx.svr.data.query(self.major, self.minor, params)
1822
+ .then(ret =>
1823
+ {
1824
+ for (let att of ret)
1825
+ self.getDisp(att)
1826
+
1827
+ return ret
1828
+ })
1829
+ },
1830
+
1831
+ /**
1832
+ * 根据当前的getCols(),取当前显示的列名
1833
+ * @returns { cols: Array.<String>, colInfs: {colname: {_label: ..., }} }
1834
+ */
1835
+ getDispCols()
1836
+ {
1837
+ const _cols = this.getCols()
1838
+ const cols = [], colInfs = {}
1839
+ let colname, title
1840
+
1841
+ _cols.forEach(item =>
1842
+ {
1843
+ colname = item.colname
1844
+ title = item.title
1845
+ // eslint-disable-next-line
1846
+ if (colname[0] == '_')
1847
+ colname = colname.substring(1)
1848
+ cols.push(colname)
1849
+ if (title)
1850
+ colInfs[colname] = { _label: title }
1851
+ })
1852
+ return { cols, colInfs }
1853
+ },
1854
+
1855
+ /**
1856
+ * 取对象的显示信息
1857
+ * @method
1858
+ * @param {Object} att 属性对象
1859
+ * @returns {Object} this
1860
+ */
1861
+ getDisp(att)
1862
+ {
1863
+ this._getDisp(att)
1864
+ return this
1865
+ },
1866
+
1867
+ /**
1868
+ * 取对象的显示信息
1869
+ * @method
1870
+ * @private
1871
+ * @param {Object} att 属性对象
1872
+ * @returns {Object} this
1873
+ */
1874
+ _getDisp(att)
1875
+ {
1876
+ this.attObj.numberize(att)
1877
+ this.attObj.decode(att)
1878
+ this.attObj.getDisp(att)
1879
+ return this
1880
+ },
1881
+
1882
+ /**
1883
+ * 添加新项到datagrid列表
1884
+ * @method
1885
+ * @param {Object} attNew 新属性
1886
+ */
1887
+ gridAdd(attNew)
1888
+ {
1889
+ this.getDisp(attNew)
1890
+ cx.array.insert(this.list, attNew)
1891
+ },
1892
+
1893
+ /**
1894
+ * 从datagrid删除项
1895
+ * @method
1896
+ * @param {Object} attOld 旧属性
1897
+ */
1898
+ gridDel(attOld)
1899
+ {
1900
+ cx.array.remove(this.list, { id: attOld.id })
1901
+ // eslint-disable-next-line
1902
+ if (this.selected && this.selected.id == attOld.id)
1903
+ this.selected = null
1904
+ },
1905
+
1906
+ /**
1907
+ * 更新datagrid项
1908
+ * @method
1909
+ * @param {Object} attNew 新属性
1910
+ * @param {Object} attOld 旧属性
1911
+ */
1912
+ gridUpd(attNew, attOld)
1913
+ {
1914
+ let item, i, j
1915
+
1916
+ for (i = this.list.length - 1; i >= 0; i--)
1917
+ {
1918
+ item = this.list[i]
1919
+ // eslint-disable-next-line
1920
+ if (item.id == attNew.id)
1921
+ {
1922
+ for (j in attNew)
1923
+ item[j] = attNew[j]
1924
+ this.getDisp(item)
1925
+ }
1926
+ }
1927
+ },
1928
+
1929
+ /**
1930
+ * 生成用户自定义的条件表达式,放在attExp对象里面
1931
+ * @method
1932
+ * @returns {Boolean} 是否正确生成表达式
1933
+ */
1934
+ makeAttExp()
1935
+ {
1936
+ const exp = cx.sqlexp.getDefExp() // 空表达式
1937
+ const attExp = this.getExp()
1938
+
1939
+ cx.sqlexp.merge(exp, attExp)
1940
+ this.attExp = exp
1941
+ return true
1942
+ },
1943
+
1944
+ /**
1945
+ * 提交-增加
1946
+ * @method
1947
+ * @param {Object} att 新属性
1948
+ */
1949
+ submitAdd(att, plug)
1950
+ {
1951
+ if (!this.beforeAdd(att, plug))
1952
+ {
1953
+ return new Promise((resolve) =>
1954
+ {
1955
+ resolve(false)
1956
+ })
1957
+ }
1958
+ return cx.svr.attOper.insert(this.major, this.minor, att, this.retAtt)
1959
+ .then(ret =>
1960
+ {
1961
+ return true
1962
+ // 这里没有额外代码,是因为该类增加了数据增删改监听
1963
+ })
1964
+ },
1965
+
1966
+ /**
1967
+ * 提交-删除
1968
+ * @method
1969
+ * @param {Object} att 属性
1970
+ */
1971
+ submitDel(att)
1972
+ {
1973
+ if (!att)
1974
+ return
1975
+ if (!this.beforeDel(att))
1976
+ return
1977
+
1978
+ cx.svr.attOper.del(this.major, this.minor, att)
1979
+ .then(ret =>
1980
+ {
1981
+ // eslint-disable-next-line
1982
+ if (att == this.selected)
1983
+ this.selected = null
1984
+
1985
+ // 这里没有额外代码,是因为该类增加了数据增删改监听
1986
+ })
1987
+ .catch(this.onError)
1988
+ },
1989
+
1990
+ /**
1991
+ * 提交-删除多个
1992
+ * @method
1993
+ * @param {Array.<Object>} atts 属性序列
1994
+ */
1995
+ submitDels(atts)
1996
+ {
1997
+ if (!atts.length)
1998
+ return
1999
+ if (!this.beforeDels(atts))
2000
+ return
2001
+
2002
+ cx.svr.attOper.dels(this.major, this.minor, atts)
2003
+ .then(ret =>
2004
+ {
2005
+ this.selection = []
2006
+ // eslint-disable-next-line
2007
+ if (atts.find(item => item == this.selected))
2008
+ this.selected = null
2009
+
2010
+ // 这里没有额外代码,是因为该类增加了数据增删改监听
2011
+ })
2012
+ .catch(this.onError)
2013
+ },
2014
+
2015
+ /**
2016
+ * 提交-修改
2017
+ * @method
2018
+ * @param {Object} attNew 新属性
2019
+ * @param {Object} attOld 旧属性
2020
+ */
2021
+ submitUpd(attNew, attOld)
2022
+ {
2023
+ return new Promise((resolve) =>
2024
+ {
2025
+ resolve(true)
2026
+ })
2027
+ // 这里没有额外代码,是因为该类增加了数据增删改监听,并且很多地方是界面提供了修改数据功能
2028
+ },
2029
+
2030
+ /**
2031
+ * 提交-开启/关闭
2032
+ * @method
2033
+ * @param {Object} att 新属性
2034
+ * @param {Number} state 状态值(0-未结束 1-结束)
2035
+ */
2036
+ submitComp(att, state)
2037
+ {
2038
+ const attNew =
2039
+ {
2040
+ id: att.id,
2041
+ completed: state,
2042
+ cols: 'completed'
2043
+ }
2044
+
2045
+ if (state === 0)
2046
+ {
2047
+ attNew.procinstid = ''
2048
+ attNew.bill = ''
2049
+ }
2050
+
2051
+ cx.svr.attOper.update(this.major, this.minor, attNew, att)
2052
+ .then(ret =>
2053
+ {
2054
+ // this.afterUpd(att)
2055
+ // this.gridUpd(attNew, att)
2056
+ })
2057
+ .catch(this.onError)
2058
+ },
2059
+
2060
+ /**
2061
+ * 根据属性删除实体
2062
+ * @private
2063
+ * @method
2064
+ * @param {Object} att 属性
2065
+ */
2066
+ _del(att)
2067
+ {
2068
+ if (!att)
2069
+ return
2070
+
2071
+ this.$cfm('del')
2072
+ .then(() =>
2073
+ {
2074
+ this.submitDel(att)
2075
+ })
2076
+ .catch(() =>
2077
+ {
2078
+ })
2079
+ },
2080
+
2081
+ /**
2082
+ * 根据属性删除实体
2083
+ * @private
2084
+ * @method
2085
+ * @param {Array.<Object>} atts 属性序列
2086
+ */
2087
+ _dels(atts = [])
2088
+ {
2089
+ if (atts.length === 0)
2090
+ return
2091
+
2092
+ this.$cfm('del')
2093
+ .then(() =>
2094
+ {
2095
+ this.submitDels(atts)
2096
+ })
2097
+ .catch(() =>
2098
+ {
2099
+ })
2100
+ },
2101
+
2102
+ /**
2103
+ * 根据属性查看实体
2104
+ * @private
2105
+ * @method
2106
+ * @param {Object} att 属性
2107
+ */
2108
+ _view(att)
2109
+ {
2110
+ if (!att)
2111
+ return
2112
+
2113
+ // 弹出输入界面
2114
+ const params =
2115
+ {
2116
+ major: this.major,
2117
+ minor: this.minor,
2118
+ title: this.getEntityName(),
2119
+ att: att,
2120
+ editable: false,
2121
+ closable: true,
2122
+ mode: cx.consts.MODE_VIEW
2123
+ }
2124
+
2125
+ // 基于配置文件的定义表单
2126
+ if (this.dynaForm?.viewForm)
2127
+ cx.form.attEdit(this.dynaForm.viewForm, params)
2128
+ // 基于数据库的默认表单
2129
+ else
2130
+ cx.form.attEditNoCfg(params)
2131
+ },
2132
+
2133
+ /**
2134
+ * 根据属性编辑实体
2135
+ * @private
2136
+ * @method
2137
+ * @param {Object} att 属性
2138
+ * @param {Boolean} [changed = false] 数据改变标记
2139
+ */
2140
+ _upd(att, changed)
2141
+ {
2142
+ if (!att)
2143
+ return
2144
+
2145
+ const params =
2146
+ {
2147
+ major: this.major,
2148
+ minor: this.minor,
2149
+ title: this.getEntityName(),
2150
+ att: att,
2151
+ editable: true,
2152
+ closable: true,
2153
+ mode: cx.consts.MODE_EDIT,
2154
+ retAtt: this.retAtt,
2155
+ beforeUpd: (att) => this.beforeUpd(att),
2156
+ onOk: (attNew, attOld) => this.submitUpd(attNew, attOld)
2157
+ }
2158
+
2159
+ if (changed)
2160
+ params.changed = !!changed
2161
+
2162
+ // 基于配置文件的定义表单
2163
+ if (this.dynaForm?.viewForm)
2164
+ cx.form.attEdit(this.dynaForm.viewForm, params)
2165
+ // 基于数据库的默认表单
2166
+ else
2167
+ cx.form.attEditNoCfg(params)
2168
+ },
2169
+
2170
+ /**
2171
+ * 根据属性开启/关闭
2172
+ * @private
2173
+ * @method
2174
+ * @param {Object} att 属性
2175
+ * @param {Number} state 状态值(0-未结束 1-结束)
2176
+ */
2177
+ _complete(att, state)
2178
+ {
2179
+ if (!att)
2180
+ return
2181
+
2182
+ this.$cfmMsg(this.$loc('cx.cfmUncomplete'))
2183
+ .then(() =>
2184
+ {
2185
+ this.submitComp(att, state)
2186
+ })
2187
+ .catch(() =>
2188
+ {
2189
+ })
2190
+ },
2191
+
2192
+ /**
2193
+ * 根据属性查看详情
2194
+ * @private
2195
+ * @method
2196
+ * @param {Object} att 属性
2197
+ */
2198
+ _detail(att)
2199
+ {
2200
+ if (!att)
2201
+ return
2202
+
2203
+ // 查找表对应的流程
2204
+ const proc = cx.array.get1($g.init.procs, { tabname: this.entity.name })
2205
+
2206
+ if (proc)
2207
+ {
2208
+ const plug = proc.plugins.detail
2209
+
2210
+ if (plug)
2211
+ {
2212
+ const params =
2213
+ {
2214
+ major: this.major,
2215
+ minor: this.minor,
2216
+ att,
2217
+ editable: false,
2218
+ task: null
2219
+ }
2220
+ // 上面没有传 comments 参数
2221
+
2222
+ cx.base.execute(plug, [params])
2223
+ }
2224
+ }
2225
+ },
2226
+
2227
+ /**
2228
+ * 根据ID删除实体
2229
+ * @method
2230
+ * @param {Number} id ID
2231
+ */
2232
+ del(id)
2233
+ {
2234
+ this._del(cx.array.get1(this.list, { id: parseInt(id) }))
2235
+ },
2236
+
2237
+ /**
2238
+ * 根据ID删除实体
2239
+ * @method
2240
+ * @param {Number} id ID
2241
+ */
2242
+ view(id)
2243
+ {
2244
+ this._view(cx.array.get1(this.list, { id: parseInt(id) }))
2245
+ },
2246
+
2247
+ /**
2248
+ * 根据ID修改实体
2249
+ * @method
2250
+ * @param {Number} id ID
2251
+ */
2252
+ upd(id)
2253
+ {
2254
+ this._upd(cx.array.get1(this.list, { id: parseInt(id) }))
2255
+ },
2256
+
2257
+ /**
2258
+ * 根据ID开启
2259
+ * @method
2260
+ * @param {Number} id ID
2261
+ */
2262
+ complete(id)
2263
+ {
2264
+ this._complete(cx.array.get1(this.list, { id: parseInt(id) }), 0)
2265
+ },
2266
+
2267
+ /**
2268
+ * 根据ID修改实体
2269
+ * @method
2270
+ * @param {Number} id ID
2271
+ */
2272
+ detail(id)
2273
+ {
2274
+ this._detail(cx.array.get1(this.list, { id: parseInt(id) }))
2275
+ },
2276
+
2277
+ /**
2278
+ * 消息响应函数-添加
2279
+ * @method
2280
+ */
2281
+ onAdd()
2282
+ {
2283
+ // 弹出输入界面
2284
+ const params =
2285
+ {
2286
+ major: this.major,
2287
+ minor: this.minor,
2288
+ title: this.getEntityName(),
2289
+ onOk: (att, plug) => this.submitAdd(att, plug)
2290
+ }
2291
+
2292
+ // 基于配置文件的定义表单
2293
+ if (this.dynaForm?.inputForm)
2294
+ {
2295
+ params.values = this.defVal()
2296
+ cx.form.attInput(this.dynaForm.inputForm, params)
2297
+ }
2298
+ // 基于数据库的默认表单
2299
+ else
2300
+ {
2301
+ params.att = this.defVal()
2302
+ cx.form.attInputNoCfg(params)
2303
+ }
2304
+ },
2305
+
2306
+ /**
2307
+ * 带属性进行添加操作
2308
+ * @param {Object} att 带进来的属性信息
2309
+ * @param {String} [title] 带进来的标题
2310
+ * @method
2311
+ */
2312
+ addWithAtt(att, title)
2313
+ {
2314
+ // 弹出输入界面
2315
+ const params =
2316
+ {
2317
+ major: this.major,
2318
+ minor: this.minor,
2319
+ title: title ? title : this.getEntityName(),
2320
+ onOk: (att, plug) => this.submitAdd(att, plug)
2321
+ }
2322
+
2323
+ // 基于配置文件的定义表单
2324
+ if (this.dynaForm?.inputForm)
2325
+ {
2326
+ params.values = cx.base.extend(this.defVal(), att)
2327
+ cx.form.attInput(this.dynaForm.inputForm, params)
2328
+ }
2329
+ // 基于数据库的默认表单
2330
+ else
2331
+ {
2332
+ params.att = cx.base.extend(this.defVal(), att)
2333
+ cx.form.attInputNoCfg(params)
2334
+ }
2335
+ },
2336
+
2337
+ /**
2338
+ * 消息响应函数-删除
2339
+ * @method
2340
+ */
2341
+ onDel()
2342
+ {
2343
+ this._del(this.getCur())
2344
+ },
2345
+
2346
+ /**
2347
+ * 消息响应函数-修改
2348
+ * @method
2349
+ */
2350
+ onUpd()
2351
+ {
2352
+ this._upd(this.getCur())
2353
+ },
2354
+
2355
+ /**
2356
+ * 消息响应函数-属性查看
2357
+ * @method
2358
+ */
2359
+ onView()
2360
+ {
2361
+ this._view(this.getCur())
2362
+ },
2363
+
2364
+ /**
2365
+ * 消息响应函数-明细
2366
+ * @method
2367
+ */
2368
+ onDetail()
2369
+ {
2370
+ const att = this.getCur()
2371
+ if (att)
2372
+ this.detail(att.id)
2373
+ },
2374
+
2375
+ /**
2376
+ * 取默认值
2377
+ * @method
2378
+ * @returns {Object} 默认属性(如果没有缓存数据,则返回NULL)
2379
+ */
2380
+ defVal()
2381
+ {
2382
+ const att = this.attObj.getDefVal()
2383
+ cx.att.getCacheAtt(this.major, this.minor, att)
2384
+ this.initAtt(att)
2385
+ return att
2386
+ },
2387
+
2388
+ /**
2389
+ * 用于输入属性之前,在派生类初始化属性(特殊情况下修改字段值)
2390
+ * @method
2391
+ * @param {Object} att 属性对象
2392
+ */
2393
+ initAtt(att)
2394
+ {
2395
+ },
2396
+
2397
+ /**
2398
+ * 添加属性之前的接口
2399
+ * @method
2400
+ * @param {Object} att 属性对象
2401
+ */
2402
+ beforeAdd(att)
2403
+ {
2404
+ this.attObj.encode(att)
2405
+ return true
2406
+ },
2407
+
2408
+ /**
2409
+ * 添加属性之后的接口
2410
+ * @method
2411
+ * @param {Object} att 属性对象
2412
+ */
2413
+ afterAdd(att)
2414
+ {
2415
+ },
2416
+
2417
+ /**
2418
+ * 删除属性之前的接口
2419
+ * @method
2420
+ * @param {Object} att 属性对象
2421
+ */
2422
+ beforeDel(att)
2423
+ {
2424
+ return true
2425
+ },
2426
+
2427
+ /**
2428
+ * 删除属性之前的接口
2429
+ * @method
2430
+ * @param {Array.<Object>} atts 属性序列
2431
+ */
2432
+ beforeDels(att)
2433
+ {
2434
+ return true
2435
+ },
2436
+
2437
+ /**
2438
+ * 删除属性之后的接口
2439
+ * @method
2440
+ * @param {Object} att 属性对象
2441
+ */
2442
+ afterDel(att)
2443
+ {
2444
+ },
2445
+
2446
+ /**
2447
+ * 修改属性之前的接口
2448
+ * @method
2449
+ * @param {Object} att 属性对象
2450
+ */
2451
+ beforeUpd(att)
2452
+ {
2453
+ // this.attObj.encode(att)
2454
+ return true
2455
+ },
2456
+
2457
+ /**
2458
+ * 修改属性之后的接口
2459
+ * @method
2460
+ * @param {Object} att 属性对象
2461
+ */
2462
+ afterUpd(att)
2463
+ {
2464
+ },
2465
+
2466
+ /**
2467
+ * 查询之后并处理成表格显示数据的接口
2468
+ * @method
2469
+ */
2470
+ afterQuery()
2471
+ {
2472
+ },
2473
+
2474
+ /**
2475
+ * 查询之后数据预处理接口
2476
+ * @method
2477
+ * @param {Array.<Data>} data 查询的原始数据序列
2478
+ * @param {Object} ctx 当前文本上下午
2479
+ * @returns {Promise}
2480
+ */
2481
+ processQryData(data, ctx)
2482
+ {
2483
+ return new Promise((resolve, reject) =>
2484
+ {
2485
+ resolve(data)
2486
+ })
2487
+ },
2488
+
2489
+ /**
2490
+ * 查询之前的接口
2491
+ * @method
2492
+ */
2493
+ beforeQuery()
2494
+ {
2495
+ },
2496
+
2497
+ /**
2498
+ * 取实体信息
2499
+ * @method
2500
+ * @returns {Object} 返回实体信息
2501
+ */
2502
+ getEntity()
2503
+ {
2504
+ return this.entity
2505
+ },
2506
+
2507
+ /**
2508
+ * 取实体名称
2509
+ * @method
2510
+ * @returns {String} 返回实体信息
2511
+ */
2512
+ getEntityName()
2513
+ {
2514
+ return cx.i18n.locEntity(this.entity)
2515
+ },
2516
+
2517
+ /**
2518
+ * 取插件名
2519
+ * @method
2520
+ * @param {Number} type 类型
2521
+ * @param {Object} [att] 属性(当前需要发起流程的属性)
2522
+ * @returns {String}
2523
+ */
2524
+ getPluginName(type, att)
2525
+ {
2526
+ switch (type)
2527
+ {
2528
+ case cx.consts.PROC_START: return 'ProcStart'
2529
+ case cx.consts.PROC_PROGRESS: return 'ProcProgress'
2530
+ case cx.consts.PROC_TRACE: return 'ProcTrace'
2531
+ case cx.consts.ATT_ADD:
2532
+ return 'AttInput'
2533
+ case cx.consts.ATT_EDIT:
2534
+ case cx.consts.ATT_VIEW:
2535
+ return 'AttEdit'
2536
+ }
2537
+ return ''
2538
+ },
2539
+
2540
+ /**
2541
+ * 取 Datagrid 对象
2542
+ * @method
2543
+ * @returns {Object}
2544
+ */
2545
+ getDatagrid()
2546
+ {
2547
+ return this.$refs.datagrid
2548
+ },
2549
+
2550
+ /**
2551
+ * 取 清除选择
2552
+ * @method
2553
+ */
2554
+ clearSelection()
2555
+ {
2556
+ this.$refs.datagrid.getTable().getElTable().clearSelection()
2557
+ this.selection = []
2558
+ this.selected = null
2559
+ }
2560
+ }
2561
+ }