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,1177 @@
1
+ <style lang="scss" scoped>
2
+ .plug-biflow{user-select: none;width: 100%; height: 100%; }
3
+ .node-tree{height: 96%;margin-top: 4%;margin-left: 4.5%;}
4
+ .flow-graph{position: relative; width: 100%; height: 100%; background: var(--cx-colorBg2);
5
+ .mini-map{position: absolute; right: .1rem; bottom: .1rem;}
6
+ .tool-bar{position: absolute; right: .1rem; top: .1rem; z-index: 10;}
7
+ }
8
+ :deep .flow-graph .x6-graph-svg{background: none;width: 100%;height: 100%;}
9
+ </style>
10
+
11
+ <template>
12
+ <cx-layout class="plug-biflow" :size="size" padding>
13
+ <cx-region region="west" :width="treeWidth" style="width: 2.8rem;height: 100%;padding-right:.12rem;background-color: #fff;;" gutter splitable border>
14
+ <BfNodeTree class="node-tree" ref="tree"
15
+ :size="size"
16
+ />
17
+ </cx-region>
18
+ <cx-region region="center" class="cx-of-h" style="width: 100%;height: 100%;">
19
+ <div class="flow-graph" ref="graph">
20
+ <div class="mini-map" ref="miniMap"></div>
21
+ <cx-tool-bar data-html2canvas-ignore class="tool-bar" v-bind="toolcfg" @tool-click="onClickTool"></cx-tool-bar>
22
+ <cx-r-menu ref="menuNode" style="background: var(--cx-colorBg1)"
23
+ :data="menus1"
24
+ @item-click="onRMenu"
25
+ />
26
+ <cx-r-menu ref="menuEdge" style="background: var(--cx-colorBg1)"
27
+ :data="menus2"
28
+ @item-click="onRMenu"
29
+ >
30
+ </cx-r-menu>
31
+ </div>
32
+ </cx-region>
33
+ </cx-layout>
34
+ </template>
35
+
36
+ <script>
37
+ /**
38
+ * 修改记录:
39
+ * 24-07-10 张发勇 首次提交
40
+ */
41
+
42
+ /**
43
+ * 插件 - BI 流程
44
+ *
45
+ * 调用说明:
46
+ * @param {Object} params
47
+ * @param {String} [params.mode = icon] 模式(icon - 图标模式, rect - 图框模式)
48
+ * @param {String} [params.router = smooth] 路由(smooth - 弧线,manhattan - 正交连线)
49
+ * @param {Boolean} [params.editable = true] 是否可编辑
50
+ * @param {Number} [params.dirid] 默认导入的流程所在目录
51
+ * @param {Number} [params.flowName] 默认导入的流程名字
52
+ * @param {Array} [params.data] 默认设置的参数
53
+ */
54
+
55
+ import { register } from '@antv/x6-vue-shape'
56
+ import { Edge, Graph, Shape } from '@antv/x6'
57
+ import { Keyboard } from '@antv/x6-plugin-keyboard'
58
+ import { Transform } from '@antv/x6-plugin-transform'
59
+ import { Selection } from '@antv/x6-plugin-selection'
60
+ import { Snapline } from '@antv/x6-plugin-snapline'
61
+ import { Clipboard } from '@antv/x6-plugin-clipboard'
62
+ import { History } from '@antv/x6-plugin-history'
63
+ import { Export } from '@antv/x6-plugin-export'
64
+ import html2canvas from 'html2canvas'
65
+ import { defineAsyncComponent } from 'vue'
66
+
67
+ import BfNodeTree from './coms/NodeTree.vue'
68
+ import CustomParts from './parts'
69
+ import BfApi from './BfApi'
70
+ export default
71
+ {
72
+ mixins: [cx.mixin.IPlugBase],
73
+ components: { BfNodeTree },
74
+ data()
75
+ {
76
+ return {
77
+ treeWidth: '1.75rem',
78
+ menus1: [], // 右键 - 结点
79
+ menus2: [], // 右键 - 边
80
+ curSel: null, // 当前选择的对象 node / edge
81
+ running: false, // 当前是否正在运行
82
+ toolcfg:
83
+ {
84
+ mode: 'horizontal',
85
+ subToolMode: 'vertical',
86
+ subToolPlace: 'bottom',
87
+ showTip: false,
88
+ tipPlace: 'top',
89
+ grpGap: '0.03rem',
90
+ tools: BfApi.getToolbar()
91
+ },
92
+ tableList: [] // 运行结果表
93
+ }
94
+ },
95
+
96
+ watch:
97
+ {
98
+ running: function(newVal, oldVal)
99
+ {
100
+ // 运行时需要禁用编辑功能
101
+ this.disToolbar('disRun', !!newVal)
102
+ }
103
+ },
104
+
105
+ created()
106
+ {
107
+ const ps = this.params
108
+
109
+ // 扩展
110
+ this.graph = null // graph 对象
111
+ this.editable = cx.base.defVal(ps.editable, true)
112
+ this.isDynaPort = true // 是否动态添加连接桩
113
+ this.dynaPort = null // 动态扩展连接桩
114
+ this.mode = cx.base.defVal(ps.mode, 'icon') // 模式(icon-图标模式, 1-图框模式)
115
+ this.shape = null // shape 信息
116
+ this.router = cx.base.defVal(ps.router, 'smooth') // 路由方式( smooth - 弧线;manhattan - 正交连线 )
117
+
118
+ this.menus1 = BfApi.getNodeMenu()
119
+ this.menus2 = BfApi.getEdgeMenu()
120
+ this.conValues = new cx.bf.FlowValues() // 构造条件计算的对象
121
+ this.conFlds = new cx.dc.ExpFields() // 判断条件的字段对象
122
+ this.conVals = new cx.dc.ExpValues() // 判断条件的值对象
123
+
124
+ this.runParams = [] // 配置的运行参数(配置信息),配置好的参数设置到了 graph._params_
125
+
126
+ // 禁用非编辑状态的功能
127
+ this.disToolbar('disEdit', !this.editable)
128
+ },
129
+
130
+ mounted()
131
+ {
132
+ const ps = this.params
133
+
134
+ this.initGraph()
135
+ this.register()
136
+ this.bindKey()
137
+ this.bindEvents()
138
+
139
+ this.setShape(this.mode)
140
+ this.setRouter(this.router)
141
+
142
+ // 加载默认的流程
143
+ if (ps.dirid && ps.flowName)
144
+ {
145
+ cx.bf.core.importFlow(this, this.params.bfData)
146
+ .catch(this.onError)
147
+ }
148
+ if (ps.data)
149
+ this.setParams(ps.data)
150
+
151
+ // 此处需求保存运行结果
152
+ cx.events.listen(this, 'Bf-Run', data =>
153
+ {
154
+ this.tableList.push(data)
155
+ })
156
+
157
+ this.$nextTick(() =>
158
+ {
159
+ this.graph.zoomTo(1)
160
+ this.graph.centerContent()
161
+ })
162
+ },
163
+
164
+ unmounted()
165
+ {
166
+ cx.run.closeRun('BfRunHis')
167
+ },
168
+
169
+ methods:
170
+ {
171
+ /**
172
+ * 初始化 X6-Graph对象
173
+ * @method
174
+ */
175
+ initGraph()
176
+ {
177
+ const self = this
178
+
179
+ self.graph = new Graph(
180
+ {
181
+ container: self.$refs.graph, // 画布容器
182
+ snapline: true, // 对齐线
183
+ autoResize: true, // 画布自适应缩放
184
+ Clipboard: true, // 剪切板,用于复制/黏贴节点和边
185
+ selecting: true, //
186
+ onPortRendered: self.onPortRendered, // 动态添加 port
187
+ background:
188
+ {
189
+ color: 'var(--cx-colorBg5)'
190
+ }, // 背景
191
+ grid:
192
+ {
193
+ visible: true,
194
+ type: 'dot',
195
+ size: 20, // 网点间距
196
+ args:
197
+ {
198
+ color: '#616161', // 网点颜色 - 采用的是 Canvas画图,不支持cx颜色变量!!
199
+ thickness: 1 // 网点大小
200
+ }
201
+ }, // 网格
202
+ mousewheel:
203
+ {
204
+ enabled: true,
205
+ minScale: 0.2,
206
+ maxScale: 4,
207
+ modifiers: ['ctrl', 'meta'] // 画布缩放控制按键
208
+ }, // 鼠标滚轮
209
+ panning:
210
+ {
211
+ enabled: true,
212
+ eventTypes: ['leftMouseDown', 'mouseWheel']
213
+ }, // 画布平移
214
+ connecting:
215
+ {
216
+ connectionPoint: 'anchor',
217
+ snap: true, // 自动吸附
218
+ allowBlank: false, // 是否允许连接到画布空白位置的点
219
+ allowMulti: false, // 是否允许在相同的起始节点和终止之间创建多条边
220
+ allowLoop: false, // 是否允许创建循环连线,即边的起始节点和终止节点为同一节点
221
+ highlight: true, // 拖动边时,是否高亮显示所有可用的节点
222
+ highlighting:
223
+ {
224
+ magnetAdsorbed:
225
+ {
226
+ name: 'stroke',
227
+ args:
228
+ {
229
+ attrs:
230
+ {
231
+ fill: 'purple',
232
+ stroke: '#555555'
233
+ }
234
+ }
235
+ }
236
+ },
237
+ /**
238
+ // 以下代码用于边增加线条
239
+ // router:
240
+ // {
241
+ // name: 'manhattan' // 对路径添加额外的点
242
+ // },
243
+ */
244
+ connector:
245
+ {
246
+ name: 'smooth' // 平滑连线
247
+ /**
248
+ // 以下代码用于边增加线条
249
+ // name: 'rounded',
250
+ // args:
251
+ // {
252
+ // radius: 8
253
+ // }
254
+ */
255
+ }, // 边渲染到画布后的样式
256
+ createEdge()
257
+ {
258
+ return new Shape.Edge(
259
+ {
260
+ attrs: cx.bf.core.defEdgeAttr(),
261
+ zIndex: 0
262
+ })
263
+ },
264
+ validateConnection({ targetMagnet })
265
+ {
266
+ return !!targetMagnet
267
+ }
268
+ }
269
+ })
270
+ self.graph.use(new Export())
271
+ // 插件 X6 注册
272
+ self.graph
273
+ .use(new Transform(
274
+ {
275
+ resizing: true, // 允许调整节点宽高
276
+ rotating: false // 不允许旋转节点
277
+ }))
278
+ .use(new Selection(
279
+ {
280
+ enabled: true,
281
+ showNodeSelectionBox: false, // 隐藏选择节点的盒子样式
282
+ multiple: true, // 允许按住shift+左键选择多个节点
283
+ rubberEdge: true,
284
+ rubberNode: true,
285
+ modifiers: 'shift',
286
+ rubberband: true
287
+ })) // 选择
288
+ .use(new Snapline())
289
+ .use(new Keyboard())
290
+ .use(new Clipboard())
291
+ .use(new History({ enabled: true }))
292
+
293
+ // 把图形设置给树
294
+ self.getTree().setBiFlow(self)
295
+
296
+ // 自定义部分
297
+ self.graph._params_ = {}
298
+ self.graph.setParams = function(params) // 设置参数
299
+ {
300
+ this._params_ = params || {}
301
+ }
302
+
303
+ self.graph.getParam = function(key) // 取参数
304
+ {
305
+ return this._params_[key] || ''
306
+ }
307
+ },
308
+
309
+ /**
310
+ * 注册部件(如Node显示成 Rect)
311
+ * @method
312
+ */
313
+ register()
314
+ {
315
+ CustomParts.forEach(part =>
316
+ register(
317
+ {
318
+ ...{ ...part.registerOpts, ...part.data() },
319
+ component: part
320
+ })
321
+ )
322
+ },
323
+
324
+ /**
325
+ * 绑定快捷键
326
+ * @method
327
+ */
328
+ bindKey()
329
+ {
330
+ const self = this
331
+ const graph = self.graph
332
+
333
+ // 复制
334
+ graph.bindKey(['meta+c', 'ctrl+c'], () =>
335
+ {
336
+ const olds = graph.getSelectedCells()
337
+ if (olds.length > 0)
338
+ {
339
+ const cells = graph.copy(olds)
340
+
341
+ for (let cell of cells)
342
+ cx.bf.core.setNodeObj(cell)
343
+ }
344
+ return false
345
+ })
346
+
347
+ // 剪切
348
+ graph.bindKey(['meta+x', 'ctrl+x'], () =>
349
+ {
350
+ const cells = graph.getSelectedCells()
351
+ if (cells.length)
352
+ graph.cut(cells)
353
+ return false
354
+ })
355
+
356
+ // 粘贴
357
+ graph.bindKey(['meta+v', 'ctrl+v'], () =>
358
+ {
359
+ if (!graph.isClipboardEmpty())
360
+ {
361
+ const cells = graph.paste({ offset: 80 })
362
+
363
+ for (let cell of cells)
364
+ cx.bf.core.setNodeObj(cell)
365
+
366
+ graph.cleanSelection()
367
+ graph.select(cells)
368
+ }
369
+ return false
370
+ })
371
+
372
+ // undo
373
+ graph.bindKey(['meta+z', 'ctrl+z'], () =>
374
+ {
375
+ if (graph.canUndo())
376
+ graph.undo()
377
+ return false
378
+ })
379
+
380
+ // redo
381
+ graph.bindKey(['meta+y', 'ctrl+y'], () =>
382
+ {
383
+ if (graph.canRedo())
384
+ graph.redo()
385
+ return false
386
+ })
387
+
388
+ // select all
389
+ graph.bindKey(['meta+a', 'ctrl+a'], () =>
390
+ {
391
+ const nodes = graph.getNodes()
392
+ if (nodes)
393
+ graph.select(nodes)
394
+ })
395
+
396
+ // delete
397
+ graph.bindKey(['backspace', 'delete'], () =>
398
+ {
399
+ const cells = graph.getSelectedCells()
400
+ if (cells.length)
401
+ graph.removeCells(cells)
402
+ })
403
+
404
+ // zoom
405
+ graph.bindKey(['ctrl+1', 'meta+1'], () =>
406
+ {
407
+ self.zoomIn()
408
+ })
409
+
410
+ graph.bindKey(['ctrl+2', 'meta+2'], () =>
411
+ {
412
+ self.zoomOut()
413
+ })
414
+ },
415
+
416
+ /**
417
+ * 绑定事件
418
+ * @method
419
+ */
420
+ bindEvents()
421
+ {
422
+ const self = this
423
+ const graph = self.graph
424
+ const container = self.$refs.graph
425
+
426
+ const showPorts = (ports, show) =>
427
+ {
428
+ for (let i = 0, len = ports.length; i < len; i++)
429
+ ports[i].style.visibility = show ? 'visible' : 'hidden'
430
+ }
431
+
432
+ // 鼠标进入
433
+ graph.on('node:mouseenter', () =>
434
+ {
435
+ const ports = container.querySelectorAll('.x6-port-body')
436
+ showPorts(ports, true)
437
+ })
438
+
439
+ // 鼠标离开
440
+ graph.on('node:mouseleave', () =>
441
+ {
442
+ const ports = container.querySelectorAll('.x6-port-body')
443
+ showPorts(ports, false)
444
+ })
445
+
446
+ // 右键 连接线
447
+ graph.on('edge:contextmenu', ({ e, x, y, edge, view }) =>
448
+ {
449
+ e.stopPropagation()
450
+ self.curSel = edge
451
+
452
+ self.hideRMenu(e)
453
+ self.makeFldVal(edge)
454
+ cx.dc.Plug.state(self.menus2, self.conVals, self.conFlds)
455
+ self.$refs.menuEdge.show(e)
456
+ })
457
+
458
+ // 右键 节点
459
+ graph.on('node:contextmenu', ({ e, x, y, node, cell }) =>
460
+ {
461
+ e.stopPropagation()
462
+ self.curSel = node
463
+ self.hideRMenu(e)
464
+ self.makeFldVal(node)
465
+ cx.dc.Plug.state(self.menus1, self.conVals, self.conFlds)
466
+ self.$refs.menuNode.show(e)
467
+ })
468
+
469
+ // 监听连接线创建事件
470
+ graph.on('edge:connected', ({ edge, previousView, currentView }) =>
471
+ {
472
+ // 如果存在回路,则删除不要
473
+ if (cx.bf.core.existLoop(graph))
474
+ {
475
+ graph.removeEdge(edge.id)
476
+ self.$showMsgErr(cx.bf.core.locErr('existLoop'))
477
+ return
478
+ }
479
+
480
+ // 验证输入数量
481
+ if (!cx.bf.core.edgeExist(graph, edge))
482
+ {
483
+ graph.removeEdge(edge.id)
484
+ this.$showMsgErr(cx.bf.core.locErr('inOutLimt'))
485
+ return
486
+ }
487
+
488
+ if (self.isDynaPort)
489
+ self.dynaPort = cx.bf.core.dynaPort(graph, edge)
490
+
491
+ edge.setLabels('') // 设置标签
492
+ edge.setData(
493
+ {
494
+ exp: '', // 设置条件
495
+ status: cx.consts.ST_DEFAULT, // 状态
496
+ data: [] // 数据
497
+ })
498
+ })
499
+
500
+ // 监听连接线选中事件
501
+ graph.on('edge:selected', edge =>
502
+ {
503
+ self.curSel = Edge
504
+ })
505
+
506
+ // 监听节点选中事件
507
+ graph.on('node:selected', node =>
508
+ {
509
+ self.curSel = node
510
+ })
511
+ },
512
+
513
+ /**
514
+ * 动态添加连接桩
515
+ * @method
516
+ */
517
+ onPortRendered({ node, port })
518
+ {
519
+ if (!port.attrs.delEdge)
520
+ return
521
+ delete port.attrs.delEdge
522
+
523
+ const self = this
524
+ const dynaPort = self.dynaPort
525
+
526
+ if (dynaPort)
527
+ {
528
+ // eslint-disable-next-line
529
+ if (node == dynaPort.from.node && dynaPort.from.dyna)
530
+ dynaPort.from.dyna = 0
531
+ // eslint-disable-next-line
532
+ if (node == dynaPort.to.node && dynaPort.to.dyna)
533
+ dynaPort.to.dyna = 0
534
+
535
+ if (!dynaPort.from.dyna && !dynaPort.to.dyna)
536
+ {
537
+ const edge = self.graph.addEdge(
538
+ {
539
+ source: { cell: dynaPort.from.node.id, port: dynaPort.from.portId },
540
+ target: { cell: dynaPort.to.node.id, port: dynaPort.to.portId },
541
+ attrs: dynaPort.edge.store.data.attrs
542
+ })
543
+
544
+ edge.setLabels('')
545
+ edge.setData(
546
+ {
547
+ exp: '',
548
+ status: cx.consts.ST_DEFAULT,
549
+ data: []
550
+ })
551
+
552
+ self.graph.removeEdge(dynaPort.edge.id)
553
+ self.dynaPort = null
554
+ }
555
+ }
556
+ },
557
+
558
+ // 得到结点的组件对象
559
+ getNodeCom()
560
+ {
561
+ return defineAsyncComponent(_ => cx.base.loadModule(this.shape.url))
562
+ },
563
+
564
+ /**
565
+ * 设置结点画图的形状
566
+ * @param {String} mode 绘图形状( icon / rect )
567
+ */
568
+ setShape(mode)
569
+ {
570
+ this.mode = mode
571
+ this.shape = BfApi.getShape(mode)
572
+
573
+ switch (mode)
574
+ {
575
+ case 'icon':
576
+ this.setRouter('smooth')
577
+ this.isDynaPort = false
578
+ break
579
+ case 'rect':
580
+ this.setRouter('manhattan')
581
+ this.isDynaPort = true
582
+ break
583
+ }
584
+ },
585
+
586
+ /**
587
+ * 设置边路由
588
+ * @param {String} mode 路由方式( smooth - 弧线;manhattan - 正交连线 )
589
+ */
590
+ setRouter(mode)
591
+ {
592
+ switch (mode)
593
+ {
594
+ case 'smooth':
595
+ this.router = mode
596
+ this.graph.options.connecting.connector =
597
+ {
598
+ name: mode
599
+ }
600
+ delete this.graph.options.connecting.router
601
+ break
602
+ case 'manhattan':
603
+ this.router = mode
604
+ this.graph.options.connecting.connector =
605
+ {
606
+ name: 'rounded',
607
+ args:
608
+ {
609
+ radius: 8
610
+ }
611
+ }
612
+ this.graph.options.connecting.router =
613
+ {
614
+ name: mode
615
+ }
616
+ break
617
+ }
618
+ },
619
+
620
+ /**
621
+ * 默认设置的参数
622
+ * @method
623
+ * @param {Array} obj 配置数据({ key: String, value: String })
624
+ */
625
+ setParams(data)
626
+ {
627
+ for (let i in data)
628
+ this.graph.setParams(data[i])
629
+ },
630
+
631
+
632
+ /**
633
+ * 点击工具条
634
+ * @method
635
+ */
636
+ onClickTool({ tool, pTool, oldTool })
637
+ {
638
+ switch (tool.name)
639
+ {
640
+ case 'back':
641
+ cx.run.runPlug('Znckycmx')
642
+ break
643
+ case 'runAll':
644
+ this.tableList = []
645
+ cx.bf.plug.runAll({ context: this })
646
+ break
647
+ case 'zoomIn':
648
+ this.zoomIn()
649
+ break
650
+ case 'zoomOut':
651
+ this.zoomOut()
652
+ break
653
+ case 'import':
654
+ cx.bf.plug.importJson({ context: this })
655
+ break
656
+ case 'export':
657
+ cx.bf.plug.exportJson({ context: this })
658
+ break
659
+ case 'icon':
660
+ case 'rect':
661
+ this.setShape(tool.name)
662
+ break
663
+ case 'smooth':
664
+ case 'manhattan':
665
+ this.setRouter(tool.name)
666
+ break
667
+ case 'params':
668
+ cx.bf.plug.setRunParams({ context: this })
669
+ break
670
+ case 'newFlow':
671
+ this.graph.clearCells()
672
+ break
673
+ case 'save':
674
+ this.exportJson()
675
+
676
+ break
677
+ }
678
+ },
679
+
680
+ /**
681
+ * 拖拽方式添加结点
682
+ * @method
683
+ */
684
+ addNodeDrop(evt, nodeData)
685
+ {
686
+ const self = this
687
+ const cfg = nodeData.att
688
+ const pos = self.graph.pageToLocal(evt.clientX, evt.clientY)
689
+ const obj = cx.bf.factory.getNodeObj(cfg)
690
+ const ports = self.getNodePort(obj)
691
+ const label = cx.bf.core.locAtt(cx.consts.TAB_BFNODE, cfg)
692
+
693
+ const data =
694
+ {
695
+ name: cfg.name, // 结点命名,用于后续多路径数据处理
696
+ title: label,
697
+ icon: cfg.icon,
698
+ cfgName: cfg.name, // 结点配置名
699
+ obj,
700
+ bgColor: cx.bf.core.defBgNode()
701
+ }
702
+
703
+ const item =
704
+ {
705
+ shape: self.shape.shape,
706
+ content: self.getNodeCom()
707
+ }
708
+
709
+ pos.x -= self.shape.width // 定位,目前定的宽度是300
710
+
711
+ const node = self.graph.addNode(
712
+ {
713
+ ...item,
714
+ ...pos,
715
+ ports
716
+ })
717
+
718
+ node.setData(data)
719
+ },
720
+
721
+ /**
722
+ * 根据结点配置,得到默认的连接桩
723
+ * @method
724
+ * @param {IBfNodeBase} obj 结点对象
725
+ * @returns {Object} { groups: { top: Port }, items: [ { group: 'top'} ] }
726
+ */
727
+ getNodePort(obj)
728
+ {
729
+ const positions = cx.bf.core.portPositions()
730
+ const groups = {}
731
+ const items = []
732
+ let pos, group
733
+
734
+ for (pos of positions)
735
+ groups[pos] = this.getDefPort(pos)
736
+
737
+ for (group in groups)
738
+ items.push({ group })
739
+
740
+ return { groups, items }
741
+ },
742
+
743
+ /**
744
+ * 导入结点时,得到全部连接桩的信息
745
+ * @method
746
+ * @param {Array.<Items>} ports 连接桩信息
747
+ * @returns {Object} { groups: { top: Port }, items: [ { group: 'top'} ] }
748
+ */
749
+ getNodePortImp(ports)
750
+ {
751
+ const positions = cx.bf.core.portPositions()
752
+ const groups = {}
753
+ const items = []
754
+ let pos, port
755
+
756
+ for (pos of positions)
757
+ groups[pos] = this.getDefPort(pos)
758
+
759
+ for (port of ports)
760
+ items.push({ group: port[1] })
761
+
762
+ return { groups, items }
763
+ },
764
+
765
+ // 获得默认的连接桩信息
766
+ getDefPort(position)
767
+ {
768
+ return {
769
+ position,
770
+ attrs: cx.bf.core.defPortAttr()
771
+ }
772
+ },
773
+
774
+ // 隐藏右边菜单
775
+ hideRMenu(event)
776
+ {
777
+ this.$refs.menuNode.hide(event)
778
+ this.$refs.menuEdge.hide(event)
779
+ },
780
+
781
+ // 生成条件表达式计算的字段信息、值
782
+ makeFldVal(cell)
783
+ {
784
+ this.conFlds.clear()
785
+ this.conVals.clear()
786
+ this.conValues.values(this.conFlds, this.conVals, cell, null, this)
787
+ },
788
+
789
+ // 取插件运行参数
790
+ plugParams(key, curNode)
791
+ {
792
+ switch (key)
793
+ {
794
+ case '{context}':
795
+ return this
796
+ case '{values}':
797
+ return this.conVals.values
798
+ case '{curNode}':
799
+ return curNode ? curNode : this.curSel
800
+ case '{selection}':
801
+ return this.selection
802
+ }
803
+ },
804
+
805
+ /**
806
+ * 点击插件
807
+ * @method
808
+ * @param {Object} oper 点击的操作
809
+ * @param {Array} args 参数
810
+ */
811
+ onRMenu(oper, args)
812
+ {
813
+ this.makeFldVal(this.curSel)
814
+ cx.dc.Plug.execute(oper, this.plugParams, this.curSel, this.selection, this)
815
+ },
816
+
817
+ /**
818
+ * 放大
819
+ * @method
820
+ */
821
+ zoomIn()
822
+ {
823
+ const zoom = this.graph.zoom()
824
+ if (zoom < 1.5)
825
+ this.graph.zoom(0.1)
826
+ },
827
+
828
+ /**
829
+ * 缩小
830
+ * @method
831
+ */
832
+ zoomOut()
833
+ {
834
+ const zoom = this.graph.zoom()
835
+ if (zoom > 0.5)
836
+ this.graph.zoom(-0.1)
837
+ },
838
+
839
+ /**
840
+ * 取树对象
841
+ * @method
842
+ */
843
+ getTree()
844
+ {
845
+ return this.$refs.tree
846
+ },
847
+
848
+ // 设置 toolbar 的状态
849
+ disToolbar(colname, disabled)
850
+ {
851
+ for (let grps of this.toolcfg.tools)
852
+ this._disToolbar(grps, colname, disabled)
853
+ },
854
+
855
+ // 递归设置 toolbar 的状态
856
+ _disToolbar(tools, colname, disabled)
857
+ {
858
+ for (let tool of tools)
859
+ {
860
+ if (tool[colname])
861
+ tool.disabled = disabled
862
+
863
+ if (tool.children)
864
+ this._disToolbar(tool.children, colname, disabled)
865
+ }
866
+ },
867
+
868
+ exportJson()
869
+ {
870
+ let self = this
871
+ if (this.params.bfData)
872
+ {
873
+ self.exportFlow(this, this.params.bfData).then((res) =>
874
+ {
875
+ // 当为任务数据时要更新结果
876
+ if (this.params.rwData && this.params.rwData.id)
877
+ {
878
+ this.uploadRw()
879
+ this.$showMsg('保存成功', 'success')
880
+ }
881
+ else
882
+ this.$showMsg('保存成功', 'success')
883
+ }).catch((e) =>
884
+ {
885
+ this.$showMsg('保存失败', 'error')
886
+ })
887
+ }
888
+ else
889
+ {
890
+ this.$prompt('请输入名称', '', {
891
+ confirmButtonText: '确定',
892
+ cancelButtonText: '取消'
893
+ }).then(({ value }) =>
894
+ {
895
+ self.exportFlow(this, {
896
+ dirid: 99,
897
+ filename: value
898
+ }).then((res) =>
899
+ {
900
+ // 当为任务数据时要更新结果
901
+ if (this.params.rwData)
902
+ {
903
+ this.$showMsg('保存成功', 'success')
904
+ this.uploadRw()
905
+ }
906
+ else
907
+ this.$showMsg('保存成功', 'success')
908
+ }).catch(() =>
909
+ {
910
+ this.$showMsg('保存失败', 'error')
911
+ })
912
+ }).catch(() =>
913
+ {
914
+ })
915
+ }
916
+ },
917
+
918
+ // 当存在任务时更新
919
+ uploadRw()
920
+ {
921
+ let tabList = this.tableList.map((item) =>
922
+ {
923
+ return {
924
+ id: item.id,
925
+ inNum: item.inNum,
926
+ outNum: item.outNum,
927
+ status: item.status,
928
+ task: item.task,
929
+ time: item.time,
930
+ _status: item._status,
931
+ _time: item._time,
932
+ cell: {
933
+ data: {
934
+ result: item?.cell?.data?.result
935
+ }
936
+ }
937
+ }
938
+ })
939
+ let tabdata = JSON.stringify(tabList)
940
+ // 修改成矿预测任务状态
941
+ let uptObj =
942
+ {
943
+ id: this.params.rwData.id,
944
+ state: 1,
945
+ resultdata: tabdata
946
+ }
947
+ cx.svr.data.update($app.TabConst.ckycrwglb.major, $app.TabConst.ckycrwglb.minor, uptObj).then(res =>
948
+ {
949
+ // this.$showMsg('保存成功', 'success')
950
+ }).catch(() =>
951
+ {
952
+ this.$showMsg('保存失败', 'error')
953
+ })
954
+ },
955
+
956
+ async exportFlow(ctx, flow, options)
957
+ {
958
+ const graph = ctx.graph
959
+ const runParams = ctx.runParams
960
+ const nodes = []
961
+ const edges = []
962
+ const ids = {}
963
+ const nodeAll = graph.getNodes()
964
+ const edgeAll = graph.getEdges()
965
+ let id = 0
966
+ let cell, cellData, data, position, size, obj, cfg, port, out, label
967
+
968
+ // 先建立 ID 索引(只需建结点,连接桩的索引)
969
+ for (cell of nodeAll)
970
+ {
971
+ cellData = cell.store.data
972
+ ids[cell.id] = id++
973
+ for (port of cellData.ports.items)
974
+ ids[port.id] = id++
975
+ }
976
+
977
+ for (cell of nodeAll)
978
+ {
979
+ cellData = cell.store.data // cell.store.data
980
+ data = cellData.data // cell.store.data.data
981
+ position = cellData.position // 位置
982
+ size = cellData.size // 大小
983
+ obj = data.obj // 对象
984
+ cfg = obj.cfg // 配置
985
+
986
+ out =
987
+ {
988
+ id: ids[cell.id],
989
+ pos: [position.x, position.y], // position
990
+ size: [size.width, size.height], // size
991
+ cfged: data.isConfiged ? 1 : 0, // 是否正确配置
992
+ cfg: data.cfgName, // 配置对象名
993
+ title: data.title, // 标题
994
+ ports: [], // 连接桩
995
+ obj: {} // 配置对象
996
+ }
997
+ // eslint-disable-next-line
998
+ if (data.name != cfg.name) // 名字没有修改,则不记录
999
+ out.name = data.name
1000
+ // eslint-disable-next-line
1001
+ if (data.bgColor != cx.bf.core.defBgNode()) // 没有修改默认的背景颜色,不记录
1002
+ out.bg = data.bgColor
1003
+ for (port of cellData.ports.items) // 连接桩
1004
+ out.ports.push([ids[port.id], port.group])
1005
+ obj.toJSON(out.obj)
1006
+ let cfgList = ['excel', 'grd', 'point', 'polyline', 'polygon', 'kd']
1007
+ if (cfgList.includes(out.cfg))
1008
+ delete out.obj.formData
1009
+
1010
+ nodes.push(out)
1011
+ }
1012
+
1013
+ for (cell of edgeAll)
1014
+ {
1015
+ cellData = cell.store.data // cell.store.data.
1016
+ data = cellData.data // cell.store.data.data
1017
+ label = cx.bf.core.getEdgeLabel(cell) // label
1018
+ out =
1019
+ {
1020
+ source: [ids[cellData.source.cell], ids[cellData.source.port]],
1021
+ target: [ids[cellData.target.cell], ids[cellData.target.port]]
1022
+ }
1023
+ if (label) // 标题没有修改,则不记录
1024
+ out.label = label
1025
+ if (data.exp) // 条件没有修改,则不记录
1026
+ out.exp = data.exp
1027
+ edges.push(out)
1028
+ }
1029
+
1030
+ // 完整的JSON
1031
+ obj =
1032
+ {
1033
+ v: '0.2',
1034
+ mode: ctx.mode,
1035
+ router: ctx.router,
1036
+ nodes,
1037
+ edges,
1038
+ params: graph._params_
1039
+ }
1040
+
1041
+ // 额外信息
1042
+ if (options && options.beforeExport)
1043
+ options.beforeExport(obj)
1044
+
1045
+ const content = JSON.stringify(obj)
1046
+
1047
+ // 简化版
1048
+ delete obj.mode
1049
+ delete obj.router
1050
+ for (cell of nodes)
1051
+ {
1052
+ delete cell.pos
1053
+ delete cell.size
1054
+ delete cell.cfged
1055
+ delete cell.ports
1056
+ delete cell.bgColor
1057
+ }
1058
+ out = []
1059
+ for (cell of edges)
1060
+ out.push([cell.source[0], cell.target[0]])
1061
+ obj.edges = out
1062
+ const content2 = JSON.stringify(obj)
1063
+ // 写入数据库
1064
+ const att =
1065
+ {
1066
+ dirid: flow.dirid,
1067
+ name: flow.filename,
1068
+ content,
1069
+ content2,
1070
+ length: content.length,
1071
+ params: runParams && runParams.length > 0 ? JSON.stringify(runParams) : '',
1072
+ uperson: $g.user.name,
1073
+ userid: $g.user.id
1074
+ }
1075
+
1076
+ if (flow.id)
1077
+ {
1078
+ // 修改数据
1079
+ att.id = flow.id
1080
+ delete att.dirid
1081
+ delete att.name
1082
+ let img = await this.getImg()
1083
+ let str = flow.memo ? JSON.parse(flow.memo) : null
1084
+ let data = {
1085
+ isFb: str ? str.isFb : '',
1086
+ kcId: str ? str.kcId : '',
1087
+ mxsm: str ? str.mxsm : '',
1088
+ imgUrl: img
1089
+ }
1090
+ att.memo = JSON.stringify(data)
1091
+ return cx.svr.attOper.update(cx.consts.SYSTAB, cx.consts.TAB_BFFLOW, att, att)
1092
+ }
1093
+ else
1094
+ {
1095
+ let img = await this.getImg()
1096
+ // 修改数据
1097
+ let data = {
1098
+ imgUrl: img
1099
+ }
1100
+ att.memo = JSON.stringify(data)
1101
+ // 增加数据
1102
+ return cx.svr.attOper.insert(cx.consts.SYSTAB, cx.consts.TAB_BFFLOW, att, 1)
1103
+ }
1104
+ },
1105
+
1106
+ getZoomScale()
1107
+ {
1108
+ let scale = 1
1109
+ if (this.graph.model.getAllCellsBBox().width / this.$refs.graph.clientWidth > 1)
1110
+ scale = this.$refs.graph.clientWidth / this.graph.model.getAllCellsBBox().width
1111
+ else if (this.graph.model.getAllCellsBBox().height / this.$refs.graph.clientHeight > 1)
1112
+ scale = this.$refs.graph.clientHeight / this.graph.model.getAllCellsBBox().height
1113
+ else scale = 1
1114
+ return scale - 0.1
1115
+ },
1116
+
1117
+ zoomToOverview()
1118
+ {
1119
+ let scale = this.getZoomScale()
1120
+ this.graph.zoomTo(scale)
1121
+ this.graph.centerContent()
1122
+ },
1123
+
1124
+ // 生成截图
1125
+ async getImg()
1126
+ {
1127
+ this.zoomToOverview()
1128
+ let that = this
1129
+ this.$refs.graph.style.position = 'relative'
1130
+ let canvas = await html2canvas(that.$refs.graph, {
1131
+ useCORS: true, // 允许跨域
1132
+ foreignObjectRendering: true, // 在浏览器支持的情况下使用ForeignObject模式渲染图片
1133
+ ignoreElements: (e) =>
1134
+ {
1135
+ if (e.contains(that.$refs.graph) || that.$refs.graph.contains(e) || e.getAttribute('data-html2canvas') != null)
1136
+
1137
+ return false
1138
+
1139
+ return true
1140
+ }
1141
+ })
1142
+ let imgData = canvas.toDataURL('image/webp')
1143
+ this.$refs.graph.style.top = '0rem'
1144
+ this.$refs.graph.style.left = '0rem'
1145
+ return imgData
1146
+ },
1147
+
1148
+ imageBase64ToBlob(urlData, type = 'image/jpeg')
1149
+ {
1150
+ try
1151
+ {
1152
+ let arr = urlData.split(',')
1153
+ let mime = arr[0].match(/:(.*?);/)[1] || type
1154
+ // 去掉url的头,并转化为byte
1155
+ let bytes = window.atob(arr[1])
1156
+ // 处理异常,将ascii码小于0的转换为大于0
1157
+ var ab = new ArrayBuffer(bytes.length)
1158
+ // 生成视图(直接针对内存):8位无符号整数,长度1个字节
1159
+ let ia = new Uint8Array(ab)
1160
+ for (let i = 0; i < bytes.length; i++)
1161
+ ia[i] = bytes.charCodeAt(i)
1162
+ return new Blob([ab], {
1163
+ type: mime
1164
+ })
1165
+ }
1166
+ catch (e)
1167
+ {
1168
+ var ab = new ArrayBuffer(0)
1169
+ return new Blob([ab], {
1170
+ type: type
1171
+ })
1172
+ }
1173
+ }
1174
+ }
1175
+ }
1176
+
1177
+ </script>