mooho-base-admin-plus 0.1.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 (283) hide show
  1. package/.env +5 -0
  2. package/.env.development +0 -0
  3. package/.env.production +0 -0
  4. package/.eslintignore +11 -0
  5. package/.eslintrc.js +47 -0
  6. package/.prettierrc +15 -0
  7. package/README.md +18 -0
  8. package/dist/favicon.ico +0 -0
  9. package/dist/mooho-base-admin-plus.min.esm.js +131746 -0
  10. package/dist/mooho-base-admin-plus.min.js +279 -0
  11. package/dist/setting.js +31 -0
  12. package/dist/static/images/app-barcode.png +0 -0
  13. package/dist/static/images/login/bg.png +0 -0
  14. package/dist/static/images/login/logo.png +0 -0
  15. package/dist/static/images/login/password-active.png +0 -0
  16. package/dist/static/images/login/password-default.png +0 -0
  17. package/dist/static/images/login/signIn-img.png +0 -0
  18. package/dist/static/images/login/user-active.png +0 -0
  19. package/dist/static/images/login/user-default.png +0 -0
  20. package/dist/static/images/logo-dark.png +0 -0
  21. package/dist/static/images/logo-small.png +0 -0
  22. package/dist/static/images/logo.png +0 -0
  23. package/dist/static/images/logo.svg +510 -0
  24. package/dist/static/images/no-image.png +0 -0
  25. package/dist/style.css +4 -0
  26. package/index.html +18 -0
  27. package/other/pda.vue +28 -0
  28. package/package.json +59 -0
  29. package/public/favicon.ico +0 -0
  30. package/public/setting.js +31 -0
  31. package/public/static/images/app-barcode.png +0 -0
  32. package/public/static/images/login/bg.png +0 -0
  33. package/public/static/images/login/logo.png +0 -0
  34. package/public/static/images/login/password-active.png +0 -0
  35. package/public/static/images/login/password-default.png +0 -0
  36. package/public/static/images/login/signIn-img.png +0 -0
  37. package/public/static/images/login/user-active.png +0 -0
  38. package/public/static/images/login/user-default.png +0 -0
  39. package/public/static/images/logo-dark.png +0 -0
  40. package/public/static/images/logo-small.png +0 -0
  41. package/public/static/images/logo.png +0 -0
  42. package/public/static/images/logo.svg +510 -0
  43. package/public/static/images/no-image.png +0 -0
  44. package/src/App.vue +60 -0
  45. package/src/api/application.js +35 -0
  46. package/src/api/customModel.js +187 -0
  47. package/src/api/customPage.js +15 -0
  48. package/src/api/customTable.js +24 -0
  49. package/src/api/dataSource.js +93 -0
  50. package/src/api/dataView.js +199 -0
  51. package/src/api/dictType.js +23 -0
  52. package/src/api/entityView.js +13 -0
  53. package/src/api/enum.js +15 -0
  54. package/src/api/filterColumn.js +16 -0
  55. package/src/api/model.js +244 -0
  56. package/src/api/movePlan.js +29 -0
  57. package/src/api/notification.js +28 -0
  58. package/src/api/openApiPermission.js +25 -0
  59. package/src/api/permission.js +51 -0
  60. package/src/api/planJob.js +15 -0
  61. package/src/api/process.js +23 -0
  62. package/src/api/processDef.js +36 -0
  63. package/src/api/processInst.js +16 -0
  64. package/src/api/rolePermission.js +17 -0
  65. package/src/api/roleProperty.js +36 -0
  66. package/src/api/shortcut.js +20 -0
  67. package/src/api/system.js +23 -0
  68. package/src/api/task.js +56 -0
  69. package/src/api/taskQueue.js +24 -0
  70. package/src/api/user.js +45 -0
  71. package/src/api/viewColumn.js +16 -0
  72. package/src/assets/svg/body.svg +17 -0
  73. package/src/assets/svg/header-theme-dark.svg +40 -0
  74. package/src/assets/svg/header-theme-primary.svg +40 -0
  75. package/src/assets/svg/header-top.svg +40 -0
  76. package/src/assets/svg/icon-happy.svg +1 -0
  77. package/src/assets/svg/icon-sad.svg +1 -0
  78. package/src/assets/svg/icon-social-bilibili.svg +1 -0
  79. package/src/assets/svg/icon-social-dingding.svg +1 -0
  80. package/src/assets/svg/icon-social-facebook.svg +1 -0
  81. package/src/assets/svg/icon-social-juejin.svg +1 -0
  82. package/src/assets/svg/icon-social-qq.svg +1 -0
  83. package/src/assets/svg/icon-social-twitter.svg +1 -0
  84. package/src/assets/svg/icon-social-wechat.svg +1 -0
  85. package/src/assets/svg/icon-social-weibo.svg +1 -0
  86. package/src/assets/svg/icon-social-zhihu.svg +1 -0
  87. package/src/assets/svg/nav-theme-dark.svg +40 -0
  88. package/src/assets/svg/nav-theme-light.svg +40 -0
  89. package/src/components/copyright/index.vue +28 -0
  90. package/src/components/home/notice-list.vue +62 -0
  91. package/src/components/home/shortcut.vue +125 -0
  92. package/src/components/input/dialog-select.vue +301 -0
  93. package/src/components/input/item-select.vue +195 -0
  94. package/src/components/link/index.vue +54 -0
  95. package/src/components/richEditor/index.vue +86 -0
  96. package/src/components/upload/file-upload.vue +84 -0
  97. package/src/components/upload/upload-attachment.vue +119 -0
  98. package/src/components/upload/upload-image.vue +212 -0
  99. package/src/components/view/column-check.vue +223 -0
  100. package/src/components/view/column-edit.vue +850 -0
  101. package/src/components/view/column-select.vue +206 -0
  102. package/src/components/view/condition-edit.vue +164 -0
  103. package/src/components/view/filter-edit.vue +633 -0
  104. package/src/components/view/filter-setting.vue +126 -0
  105. package/src/components/view/form-setting-layout.vue +375 -0
  106. package/src/components/view/form-setting.vue +247 -0
  107. package/src/components/view/group-column.vue +104 -0
  108. package/src/components/view/group-method.vue +104 -0
  109. package/src/components/view/mixin.js +72 -0
  110. package/src/components/view/modal-form-filter.vue +319 -0
  111. package/src/components/view/modal-form-sort.vue +248 -0
  112. package/src/components/view/modal-form.vue +453 -0
  113. package/src/components/view/modal-table.vue +471 -0
  114. package/src/components/view/table-filter.vue +702 -0
  115. package/src/components/view/table-setting.vue +533 -0
  116. package/src/components/view/view-chart.vue +423 -0
  117. package/src/components/view/view-form-draggable.vue +837 -0
  118. package/src/components/view/view-form.vue +1444 -0
  119. package/src/components/view/view-table.vue +2261 -0
  120. package/src/components/workflow/flow-chart.vue +846 -0
  121. package/src/directive/focus.js +10 -0
  122. package/src/directive/tabHide.js +9 -0
  123. package/src/i18n/index.js +15 -0
  124. package/src/i18n/locale/en-US.js +1 -0
  125. package/src/i18n/locale/lang.js +1 -0
  126. package/src/i18n/locale/zh-CN.js +1 -0
  127. package/src/i18n/locale.js +102 -0
  128. package/src/index.js +222 -0
  129. package/src/layouts/basic-layout/header-breadcrumb/index.vue +122 -0
  130. package/src/layouts/basic-layout/header-collapse/index.vue +44 -0
  131. package/src/layouts/basic-layout/header-fullscreen/index.vue +19 -0
  132. package/src/layouts/basic-layout/header-i18n/index.vue +45 -0
  133. package/src/layouts/basic-layout/header-log/index.vue +41 -0
  134. package/src/layouts/basic-layout/header-logo/index.vue +23 -0
  135. package/src/layouts/basic-layout/header-notice/index.vue +218 -0
  136. package/src/layouts/basic-layout/header-reload/index.vue +21 -0
  137. package/src/layouts/basic-layout/header-search/index.vue +37 -0
  138. package/src/layouts/basic-layout/header-setting/index.vue +219 -0
  139. package/src/layouts/basic-layout/header-user/index.vue +175 -0
  140. package/src/layouts/basic-layout/i18n.js +50 -0
  141. package/src/layouts/basic-layout/index.vue +280 -0
  142. package/src/layouts/basic-layout/menu-head/index.vue +120 -0
  143. package/src/layouts/basic-layout/menu-head/title.vue +48 -0
  144. package/src/layouts/basic-layout/menu-side/index.vue +113 -0
  145. package/src/layouts/basic-layout/menu-side/menu-collapse.vue +76 -0
  146. package/src/layouts/basic-layout/menu-side/menu-item.vue +31 -0
  147. package/src/layouts/basic-layout/menu-side/menu-title.vue +56 -0
  148. package/src/layouts/basic-layout/menu-side/submenu.vue +31 -0
  149. package/src/layouts/basic-layout/mixins/click-item.js +21 -0
  150. package/src/layouts/basic-layout/mixins/sider-menu-badge.js +13 -0
  151. package/src/layouts/basic-layout/mixins/translate-title.js +11 -0
  152. package/src/layouts/basic-layout/tabs/index.vue +192 -0
  153. package/src/layouts/basic-layout/water-mark/index.vue +29 -0
  154. package/src/libs/lodop/index.js +145 -0
  155. package/src/libs/random_str.js +10 -0
  156. package/src/libs/request/index.js +158 -0
  157. package/src/libs/system/index.js +234 -0
  158. package/src/libs/util.cookies.js +44 -0
  159. package/src/libs/util.db.js +13 -0
  160. package/src/libs/util.js +55 -0
  161. package/src/libs/util.log.js +88 -0
  162. package/src/libs/water-mark.js +44 -0
  163. package/src/menu/header.js +20 -0
  164. package/src/menu/modules/dashboard.js +23 -0
  165. package/src/menu/sider.js +12 -0
  166. package/src/mixins/app.js +9 -0
  167. package/src/mixins/page.js +643 -0
  168. package/src/pages/account/login.vue +101 -0
  169. package/src/pages/common/home.vue +169 -0
  170. package/src/pages/common/task-form.vue +350 -0
  171. package/src/pages/common/todo.vue +31 -0
  172. package/src/pages/system/apiLog.vue +79 -0
  173. package/src/pages/system/applicationType.vue +182 -0
  174. package/src/pages/system/customPage.vue +62 -0
  175. package/src/pages/system/customTable.vue +98 -0
  176. package/src/pages/system/dict.vue +36 -0
  177. package/src/pages/system/dictType.vue +58 -0
  178. package/src/pages/system/entityView.vue +38 -0
  179. package/src/pages/system/error/404.vue +6 -0
  180. package/src/pages/system/extendColumn.vue +99 -0
  181. package/src/pages/system/formView.vue +136 -0
  182. package/src/pages/system/log.vue +55 -0
  183. package/src/pages/system/notice.vue +26 -0
  184. package/src/pages/system/openApi.vue +26 -0
  185. package/src/pages/system/openUser.vue +66 -0
  186. package/src/pages/system/organization.vue +98 -0
  187. package/src/pages/system/organizationType.vue +26 -0
  188. package/src/pages/system/permission.vue +175 -0
  189. package/src/pages/system/planJob.vue +40 -0
  190. package/src/pages/system/printTemplate.vue +48 -0
  191. package/src/pages/system/process.vue +79 -0
  192. package/src/pages/system/processType.vue +26 -0
  193. package/src/pages/system/role.vue +395 -0
  194. package/src/pages/system/rolePropertyEdit.vue +480 -0
  195. package/src/pages/system/sequenceSetting.vue +26 -0
  196. package/src/pages/system/systemData.vue +52 -0
  197. package/src/pages/system/tableView.vue +386 -0
  198. package/src/pages/system/taskQueue.vue +48 -0
  199. package/src/pages/system/user.vue +250 -0
  200. package/src/pages/template/processPage.vue +243 -0
  201. package/src/pages/template/reportPage.vue +66 -0
  202. package/src/pages/template/viewPage.vue +139 -0
  203. package/src/plugins/auth/index.js +21 -0
  204. package/src/plugins/error/index.js +31 -0
  205. package/src/plugins/index.js +24 -0
  206. package/src/plugins/sweetalert2/index.js +20 -0
  207. package/src/router/dynamic.js +183 -0
  208. package/src/router/index.js +84 -0
  209. package/src/setting.js +202 -0
  210. package/src/store/index.js +9 -0
  211. package/src/store/modules/admin/index.js +16 -0
  212. package/src/store/modules/admin/modules/account.js +103 -0
  213. package/src/store/modules/admin/modules/cache.js +119 -0
  214. package/src/store/modules/admin/modules/dataView.js +112 -0
  215. package/src/store/modules/admin/modules/db.js +231 -0
  216. package/src/store/modules/admin/modules/i18n.js +87 -0
  217. package/src/store/modules/admin/modules/layout.js +115 -0
  218. package/src/store/modules/admin/modules/loader.js +44 -0
  219. package/src/store/modules/admin/modules/log.js +77 -0
  220. package/src/store/modules/admin/modules/menu.js +338 -0
  221. package/src/store/modules/admin/modules/page.js +466 -0
  222. package/src/store/modules/admin/modules/user.js +96 -0
  223. package/src/store/modules/admin/modules/viewPage.js +34 -0
  224. package/src/styles/common.less +47 -0
  225. package/src/styles/css/default.css +510 -0
  226. package/src/styles/css/login.css +1217 -0
  227. package/src/styles/default/index.less +6 -0
  228. package/src/styles/font/demo.css +539 -0
  229. package/src/styles/font/demo_index.html +372 -0
  230. package/src/styles/font/icon-demo/demo.css +539 -0
  231. package/src/styles/font/icon-demo/demo_index.html +423 -0
  232. package/src/styles/font/icon-demo/iconfont.css +61 -0
  233. package/src/styles/font/icon-demo/iconfont.eot +0 -0
  234. package/src/styles/font/icon-demo/iconfont.js +1 -0
  235. package/src/styles/font/icon-demo/iconfont.svg +59 -0
  236. package/src/styles/font/icon-demo/iconfont.ttf +0 -0
  237. package/src/styles/font/icon-demo/iconfont.woff +0 -0
  238. package/src/styles/font/icon-demo/iconfont.woff2 +0 -0
  239. package/src/styles/font/iconfont.css +47 -0
  240. package/src/styles/font/iconfont.js +1 -0
  241. package/src/styles/font/iconfont.json +65 -0
  242. package/src/styles/font/iconfont.ttf +0 -0
  243. package/src/styles/font/iconfont.woff +0 -0
  244. package/src/styles/font/iconfont.woff2 +0 -0
  245. package/src/styles/font/ionicons.svg +870 -0
  246. package/src/styles/font/ionicons.ttf +0 -0
  247. package/src/styles/font/ionicons.woff +0 -0
  248. package/src/styles/font/ionicons.woff2 +0 -0
  249. package/src/styles/index.less +7 -0
  250. package/src/styles/layout/basic-layout/layout.less +527 -0
  251. package/src/styles/layout/basic-layout/menu.less +274 -0
  252. package/src/styles/layout/index.less +2 -0
  253. package/src/styles/setting.less +6 -0
  254. package/styleguide.config.js +22 -0
  255. package/test/api/barcode.js +50 -0
  256. package/test/api/inbound.js +47 -0
  257. package/test/api/interfaceLog.js +15 -0
  258. package/test/api/interfaceQueue.js +15 -0
  259. package/test/api/interfaceServer.js +29 -0
  260. package/test/api/movePlan.js +50 -0
  261. package/test/api/movePlanItem.js +13 -0
  262. package/test/api/moveType.js +22 -0
  263. package/test/api/openApiPermission.js +25 -0
  264. package/test/api/outbound.js +40 -0
  265. package/test/api/permission.js +34 -0
  266. package/test/api/rolePermission.js +17 -0
  267. package/test/api/user.js +40 -0
  268. package/test/api/viewColumn.js +16 -0
  269. package/test/api/warehouse.js +13 -0
  270. package/test/api/warehouseMoveType.js +18 -0
  271. package/test/main.js +55 -0
  272. package/test/package.js +33 -0
  273. package/test/pages/home/index.vue +22 -0
  274. package/test/pages/task/test.vue +28 -0
  275. package/test/pages/test/dataViewTest.vue +28 -0
  276. package/test/pages/test/logReport.vue +25 -0
  277. package/test/pages/test/testPage.vue +38 -0
  278. package/test/router/routes.js +88 -0
  279. package/test/setting.env.js +22 -0
  280. package/test/styles/css/custom.css +0 -0
  281. package/test/styles/css/login.css +1217 -0
  282. package/vite.config.js +72 -0
  283. package/vue.config.js +20 -0
@@ -0,0 +1,846 @@
1
+ <!-- eslint-disable max-len -->
2
+ <template>
3
+ <div>
4
+ <Modal ref="modal" v-model="opened" scrollable :mask-closable="layout.maskClosable" :draggable="layout.draggable" :sticky="true" :reset-drag-position="true" :width="'90VW'">
5
+ <template #header>
6
+ <div>
7
+ <slot name="header">
8
+ <span class="title">{{ data.process ? data.process.name : '流程定义' }}</span>
9
+ <span class="description">Process Defination</span>
10
+ </slot>
11
+ </div>
12
+ </template>
13
+ <div class="ivu-ml-8 ivu-mr-8">
14
+ <svg
15
+ id="svg"
16
+ xmlns="http://www.w3.org/2000/svg"
17
+ version="1.1"
18
+ width="100%"
19
+ height="650"
20
+ style="-moz-user-select: none; -webkit-user-select: none; user-select: none"
21
+ @mouseup="mouseUp"
22
+ @mousemove="mousemove"
23
+ >
24
+ <defs>
25
+ <symbol id="iconUser" viewBox="0 0 1024 1024">
26
+ <path
27
+ d="M908 799.542857a427.428571 427.428571 0 0 0-92.114286-136.571428 429.291429 429.291429 0 0 0-136.571428-92.114286c-0.457143-0.228571-0.914286-0.342857-1.371429-0.571429C749.142857 518.857143 795.428571 435.085714 795.428571 340.571429c0-156.571429-126.857143-283.428571-283.428571-283.428572S228.571429 184 228.571429 340.571429c0 94.514286 46.285714 178.285714 117.485714 229.828571-0.457143 0.228571-0.914286 0.342857-1.371429 0.571429-51.2 21.6-97.142857 52.571429-136.571428 92.114285a429.291429 429.291429 0 0 0-92.114286 136.571429A424.8 424.8 0 0 0 82.285714 957.485714a9.142857 9.142857 0 0 0 9.142857 9.371429h68.571429c5.028571 0 9.028571-4 9.142857-8.914286 2.285714-88.228571 37.714286-170.857143 100.342857-233.485714 64.8-64.8 150.857143-100.457143 242.514286-100.457143s177.714286 35.657143 242.514286 100.457143C817.142857 787.085714 852.571429 869.714286 854.857143 957.942857c0.114286 5.028571 4.114286 8.914286 9.142857 8.914286h68.571429a9.142857 9.142857 0 0 0 9.142857-9.371429c-1.142857-54.628571-12.457143-107.771429-33.714286-157.942857zM512 537.142857c-52.457143 0-101.828571-20.457143-138.971429-57.6S315.428571 393.028571 315.428571 340.571429c0-52.457143 20.457143-101.828571 57.6-138.971429S459.542857 144 512 144s101.828571 20.457143 138.971429 57.6S708.571429 288.114286 708.571429 340.571429c0 52.457143-20.457143 101.828571-57.6 138.971428S564.457143 537.142857 512 537.142857z"
28
+ ></path>
29
+ </symbol>
30
+ <symbol id="iconApi" viewBox="0 0 1024 1024">
31
+ <path
32
+ d="M975.657143 96.914286l-48.457143-48.457143c-1.828571-1.828571-4.114286-2.628571-6.514286-2.628572s-4.685714 0.914286-6.514285 2.628572l-86.971429 86.971428a227.737143 227.737143 0 0 0-128.114286-39.2c-58.514286 0-117.028571 22.285714-161.714285 66.971429L420.914286 279.657143a9.177143 9.177143 0 0 0 0 12.914286L731.428571 603.085714c1.828571 1.828571 4.114286 2.628571 6.514286 2.628572 2.285714 0 4.685714-0.914286 6.514286-2.628572l116.457143-116.457143c78.742857-78.857143 88-200.8 27.771428-289.714285l86.971429-86.971429c3.542857-3.657143 3.542857-9.485714 0-13.028571zM805.828571 431.657143l-67.885714 67.885714-213.485714-213.485714 67.885714-67.885714c28.457143-28.457143 66.4-44.228571 106.742857-44.228572 40.342857 0 78.171429 15.657143 106.742857 44.228572 28.457143 28.457143 44.228571 66.4 44.228572 106.742857 0 40.342857-15.771429 78.171429-44.228572 106.742857z m-217.371428 120a9.177143 9.177143 0 0 0-12.914286 0L499.428571 627.771429 396.228571 524.571429l76.228572-76.228572c3.542857-3.542857 3.542857-9.371429 0-12.914286L430.857143 393.828571a9.177143 9.177143 0 0 0-12.914286 0L341.714286 470.057143l-49.142857-49.142857a8.971429 8.971429 0 0 0-6.514286-2.628572c-2.285714 0-4.685714 0.914286-6.514286 2.628572L163.2 537.371429c-78.742857 78.857143-88 200.8-27.771429 289.714285l-86.971428 86.971429a9.177143 9.177143 0 0 0 0 12.914286l48.457143 48.457142c1.828571 1.828571 4.114286 2.628571 6.514285 2.628572s4.685714-0.914286 6.514286-2.628572l86.971429-86.971428c38.514286 26.171429 83.314286 39.2 128.114285 39.2 58.514286 0 117.028571-22.285714 161.714286-66.971429l116.457143-116.457143c3.542857-3.542857 3.542857-9.371429 0-12.914285l-49.142857-49.142857 76.228571-76.228572c3.542857-3.542857 3.542857-9.371429 0-12.914286l-41.828571-41.371428zM431.657143 805.828571a150.08 150.08 0 0 1-106.742857 44.228572c-40.342857 0-78.171429-15.657143-106.742857-44.228572a150.08 150.08 0 0 1-44.228572-106.742857c0-40.342857 15.657143-78.171429 44.228572-106.742857l67.885714-67.885714 213.485714 213.485714-67.885714 67.885714z"
33
+ ></path>
34
+ </symbol>
35
+ <marker id="arrowStart" markerWidth="10" markerHeight="10" refX="2" refY="2" orient="auto">
36
+ <circle cx="2" cy="2" r="2" fill="#000" />
37
+ </marker>
38
+ <marker id="arrowEnd" markerWidth="10" markerHeight="10" refX="6" refY="2" orient="auto">
39
+ <path d="M0,0 L0,4 L6,2 Z" style="fill: #000" />
40
+ </marker>
41
+ <path v-for="(item, index) in data.outcomes" :key="index" :id="'outcome_' + item.pid" :d="getOutcomPath(item)" />
42
+ </defs>
43
+ <rect fill="#ddd" stroke-width="0" rx="0" stroke="#000" :x="10" :y="10" :width="30 * 2 + setting.rectWidth" :height="630"></rect>
44
+ <!-- 开始 -->
45
+ <template v-for="(item, index) in displayActivities" :key="index">
46
+ <template v-if="item.activityType === 'Begin'">
47
+ <rect
48
+ fill="#fff"
49
+ stroke-width="2"
50
+ rx="25"
51
+ stroke="#000"
52
+ :x="item.x - setting.rectWidth / 2"
53
+ :y="item.y - setting.rectHeight / 2"
54
+ :width="setting.rectWidth"
55
+ :height="setting.rectHeight"
56
+ ></rect>
57
+ <text fill="#000" :x="item.x" :y="item.y" :font-size="setting.rectFontSize" text-anchor="middle" dominant-baseline="middle">
58
+ {{ item.name }}
59
+ </text>
60
+ <rect
61
+ opacity="0"
62
+ rx="25"
63
+ :x="item.x - setting.rectWidth / 2"
64
+ :y="item.y - setting.rectHeight / 2"
65
+ :width="setting.rectWidth"
66
+ :height="setting.rectHeight"
67
+ @mousedown="e => mousedownActivity(item, e)"
68
+ @mouseup="mouseupActivity(item)"
69
+ @dblclick="dblclickActivity(item, index)"
70
+ ></rect>
71
+ </template>
72
+ <!-- 结束 -->
73
+ <template v-else-if="item.activityType === 'End'">
74
+ <rect
75
+ fill="#fff"
76
+ stroke-width="2"
77
+ rx="25"
78
+ stroke="#000"
79
+ :x="item.x - setting.rectWidth / 2"
80
+ :y="item.y - setting.rectHeight / 2"
81
+ :width="setting.rectWidth"
82
+ :height="setting.rectHeight"
83
+ ></rect>
84
+ <text fill="#000" :x="item.x" :y="item.y" :font-size="setting.rectFontSize" text-anchor="middle" dominant-baseline="middle">
85
+ {{ item.name }}
86
+ </text>
87
+ <rect
88
+ opacity="0"
89
+ rx="25"
90
+ :x="item.x - setting.rectWidth / 2"
91
+ :y="item.y - setting.rectHeight / 2"
92
+ :width="setting.rectWidth"
93
+ :height="setting.rectHeight"
94
+ @mousedown="e => mousedownActivity(item, e)"
95
+ @mouseup="mouseupActivity(item)"
96
+ @dblclick="dblclickActivity(item, index)"
97
+ ></rect>
98
+ </template>
99
+ <!-- 交互 -->
100
+ <template v-else-if="item.activityType === 'Interactive'">
101
+ <rect
102
+ fill="#fff"
103
+ stroke-width="2"
104
+ rx="5"
105
+ stroke="#000"
106
+ :x="item.x - setting.rectWidth / 2"
107
+ :y="item.y - setting.rectHeight / 2"
108
+ :width="setting.rectWidth"
109
+ :height="setting.rectHeight"
110
+ ></rect>
111
+ <use
112
+ :x="item.x - setting.rectWidth / 2 + 2"
113
+ :y="item.y - setting.rectHeight / 2 + 2"
114
+ :width="setting.rectHeight / 3"
115
+ :height="setting.rectHeight / 3"
116
+ href="#iconUser"
117
+ ></use>
118
+ <text fill="#000" :x="item.x" :y="item.y" :font-size="setting.rectFontSize" text-anchor="middle" dominant-baseline="middle">
119
+ {{ item.name }}
120
+ </text>
121
+ <rect
122
+ opacity="0"
123
+ rx="5"
124
+ :x="item.x - setting.rectWidth / 2"
125
+ :y="item.y - setting.rectHeight / 2"
126
+ :width="setting.rectWidth"
127
+ :height="setting.rectHeight"
128
+ @mousedown="e => mousedownActivity(item, e)"
129
+ @mouseup="mouseupActivity(item)"
130
+ @dblclick="dblclickActivity(item, index)"
131
+ ></rect>
132
+ </template>
133
+ <!-- 判断 -->
134
+ <template v-if="item.activityType === 'Judgement'">
135
+ <polygon
136
+ :points="
137
+ item.x -
138
+ setting.rectWidth / 2 +
139
+ ' ' +
140
+ item.y +
141
+ ' ' +
142
+ item.x +
143
+ ' ' +
144
+ (item.y - setting.rectHeight / 2) +
145
+ ' ' +
146
+ (item.x + setting.rectWidth / 2) +
147
+ ' ' +
148
+ item.y +
149
+ ' ' +
150
+ item.x +
151
+ ' ' +
152
+ (item.y + setting.rectHeight / 2)
153
+ "
154
+ fill="#fff"
155
+ stroke-width="2"
156
+ stroke="#000"
157
+ ></polygon>
158
+ <text fill="#000" :x="item.x" :y="item.y" :font-size="setting.rectFontSize" text-anchor="middle" dominant-baseline="middle">
159
+ {{ item.name }}
160
+ </text>
161
+ <polygon
162
+ opacity="0"
163
+ :points="
164
+ item.x -
165
+ setting.rectWidth / 2 +
166
+ ' ' +
167
+ item.y +
168
+ ' ' +
169
+ item.x +
170
+ ' ' +
171
+ (item.y - setting.rectHeight / 2) +
172
+ ' ' +
173
+ (item.x + setting.rectWidth / 2) +
174
+ ' ' +
175
+ item.y +
176
+ ' ' +
177
+ item.x +
178
+ ' ' +
179
+ (item.y + setting.rectHeight / 2)
180
+ "
181
+ @mousedown="e => mousedownActivity(item, e)"
182
+ @mouseup="mouseupActivity(item)"
183
+ @dblclick="dblclickActivity(item, index)"
184
+ ></polygon>
185
+ </template>
186
+ <!-- API -->
187
+ <template v-if="item.activityType === 'Service'">
188
+ <rect
189
+ fill="#fff"
190
+ stroke-width="2"
191
+ rx="5"
192
+ stroke="#000"
193
+ :x="item.x - setting.rectWidth / 2"
194
+ :y="item.y - setting.rectHeight / 2"
195
+ :width="setting.rectWidth"
196
+ :height="setting.rectHeight"
197
+ ></rect>
198
+ <use
199
+ :x="item.x - setting.rectWidth / 2 + 2"
200
+ :y="item.y - setting.rectHeight / 2 + 2"
201
+ :width="setting.rectHeight / 3"
202
+ :height="setting.rectHeight / 3"
203
+ href="#iconApi"
204
+ ></use>
205
+ <text fill="#000" :x="item.x" :y="item.y" :font-size="setting.rectFontSize" text-anchor="middle" dominant-baseline="middle">
206
+ {{ item.name }}
207
+ </text>
208
+ <rect
209
+ opacity="0"
210
+ rx="5"
211
+ :x="item.x - setting.rectWidth / 2"
212
+ :y="item.y - setting.rectHeight / 2"
213
+ :width="setting.rectWidth"
214
+ :height="setting.rectHeight"
215
+ @mousedown="e => mousedownActivity(item, e)"
216
+ @mouseup="mouseupActivity(item)"
217
+ @dblclick="dblclickActivity(item, index)"
218
+ ></rect>
219
+ </template>
220
+ <!-- 并行开始 -->
221
+ <template v-if="item.activityType === 'ParallelStart'">
222
+ <line
223
+ :x1="item.x - setting.rectWidth / 2"
224
+ :y1="item.y - setting.rectHeight / 6"
225
+ :x2="item.x + setting.rectWidth / 2"
226
+ :y2="item.y - setting.rectHeight / 6"
227
+ style="stroke: rgb(0, 0, 0); stroke-width: 2"
228
+ ></line>
229
+ <line
230
+ :x1="item.x - setting.rectWidth / 2"
231
+ :y1="item.y + setting.rectHeight / 6"
232
+ :x2="item.x + setting.rectWidth / 2"
233
+ :y2="item.y + setting.rectHeight / 6"
234
+ style="stroke: rgb(0, 0, 0); stroke-width: 2"
235
+ ></line>
236
+ <text fill="#000" :x="item.x" :y="item.y + setting.rectHeight / 2" :font-size="setting.rectFontSize" text-anchor="middle" dominant-baseline="middle">
237
+ {{ item.name }}
238
+ </text>
239
+ <rect
240
+ :x="item.x - setting.rectWidth / 2"
241
+ :y="item.y - setting.rectHeight / 2"
242
+ :width="setting.rectWidth"
243
+ :height="setting.rectHeight"
244
+ opacity="0"
245
+ @mousedown="e => mousedownActivity(item, e)"
246
+ @mouseup="mouseupActivity(item)"
247
+ @dblclick="dblclickActivity(item, index)"
248
+ ></rect>
249
+ </template>
250
+ <!-- 并行结束 -->
251
+ <template v-if="item.activityType === 'ParallelEnd'">
252
+ <circle :cx="item.x" :cy="item.y" :r="setting.rectHeight / 3" stroke="black" stroke-width="2" fill="#fff"></circle>
253
+ <text fill="#000" :x="item.x" :y="item.y + (setting.rectHeight * 3) / 5" :font-size="setting.rectFontSize" text-anchor="middle" dominant-baseline="middle">
254
+ {{ item.name }}
255
+ </text>
256
+ <rect
257
+ :x="item.x - setting.rectWidth / 2"
258
+ :y="item.y - setting.rectHeight / 2"
259
+ :width="setting.rectWidth"
260
+ :height="setting.rectHeight"
261
+ opacity="0"
262
+ @mousedown="e => mousedownActivity(item, e)"
263
+ @mouseup="mouseupActivity(item)"
264
+ @dblclick="dblclickActivity(item, index)"
265
+ ></rect>
266
+ </template>
267
+ <!-- 中心点 -->
268
+ <circle
269
+ :cx="item.x"
270
+ :cy="item.y"
271
+ v-if="!item.isTool"
272
+ r="7"
273
+ stroke="black"
274
+ stroke-width="0"
275
+ fill="orange"
276
+ :opacity="item.activeCenter ? 0.4 : 0"
277
+ @mouseenter="mouseenterCenter(item)"
278
+ @mouseleave="mouseleaveCenter(item)"
279
+ @mousedown="mousedownCenter(item)"
280
+ @mouseup="mouseupActivity(item)"
281
+ />
282
+ </template>
283
+ <template v-for="(item, index) in data.outcomes" :key="index">
284
+ <line
285
+ :x1="getOutcomePoint(item).fromPoint.x"
286
+ :y1="getOutcomePoint(item).fromPoint.y"
287
+ :x2="getOutcomePoint(item).toPoint.x"
288
+ :y2="getOutcomePoint(item).toPoint.y"
289
+ style="stroke: rgb(0, 0, 0); stroke-width: 2"
290
+ marker-start="url(#arrowStart)"
291
+ marker-end="url(#arrowEnd)"
292
+ @dblclick="dblclickOutcome(item, index)"
293
+ ></line>
294
+ <text fill="#000" :font-size="setting.lineFontSize" text-anchor="middle" :dominant-baseline="'text-after-edge'" @dblclick="dblclickOutcome(item, index)">
295
+ <textPath :href="'#outcome_' + item.pid" startOffset="50%">
296
+ {{ item.name }}
297
+ </textPath>
298
+ </text>
299
+ </template>
300
+ <line
301
+ v-if="isCreatingOutcome"
302
+ :x1="activityFrom.x"
303
+ :y1="activityFrom.y"
304
+ :x2="current.x"
305
+ :y2="current.y"
306
+ style="stroke: rgb(0, 0, 0); stroke-width: 2; pointer-events: none"
307
+ marker-start="url(#arrowStart)"
308
+ marker-end="url(#arrowEnd)"
309
+ ></line>
310
+ </svg>
311
+ </div>
312
+ <template #footer>
313
+ <div>
314
+ <slot name="footer">
315
+ <Button type="primary" custom-icon="fa fa-save" @click="save">保存</Button>
316
+ <Button type="primary" custom-icon="fa fa-upload" @click="publish">发布</Button>
317
+ </slot>
318
+ <Button type="default" custom-icon="fa fa-times" @click="close">关闭</Button>
319
+ </div>
320
+ </template>
321
+ </Modal>
322
+ <modal-form ref="interactiveForm" view-code="InteractiveActivityEdit" @on-change="interactiveFormChange">
323
+ <template #footer>
324
+ <Button type="primary" custom-icon="fa fa-save" @click="saveActivity">确定</Button>
325
+ <Button type="warning" custom-icon="fa fa-times" @click="removeActivity">删除</Button>
326
+ </template>
327
+ <template #bottom>
328
+ <view-table
329
+ ref="destinationRoleParamTable"
330
+ title="角色参数"
331
+ v-show="$refs.interactiveForm && $refs.interactiveForm.data && $refs.interactiveForm.data.destinationMode == 'Role'"
332
+ :static="true"
333
+ :parent-data="data"
334
+ view-code="DestinationRoleParam"
335
+ ></view-table>
336
+ </template>
337
+ <template #column="{ data, code }">
338
+ <template v-if="code == 'rejectActivityPid'">
339
+ <Select v-model="data[code]" clearable placeholder="退回发起人" :transfer="true" v-if="activities">
340
+ <Option
341
+ v-for="item in activities.filter(item => {
342
+ return (
343
+ item.pid != data.pid &&
344
+ (item.activityType == 'Interactive' || item.activityType == 'Judgement' || item.activityType == 'Service' || item.activityType == 'ParallelStart')
345
+ );
346
+ })"
347
+ :key="item.pid"
348
+ :value="item.pid"
349
+ >
350
+ {{ item.name }}
351
+ </Option>
352
+ </Select>
353
+ </template>
354
+ </template>
355
+ </modal-form>
356
+ <modal-form ref="serviceForm" view-code="ServiceActivityEdit">
357
+ <template #footer>
358
+ <Button type="primary" custom-icon="fa fa-save" @click="saveActivity">确定</Button>
359
+ <Button type="warning" custom-icon="fa fa-times" @click="removeActivity">删除</Button>
360
+ </template>
361
+ </modal-form>
362
+ <modal-form ref="activityForm" view-code="ActivityEdit">
363
+ <template #footer>
364
+ <Button type="primary" custom-icon="fa fa-save" @click="saveActivity">确定</Button>
365
+ <Button type="warning" custom-icon="fa fa-times" @click="removeActivity">删除</Button>
366
+ </template>
367
+ </modal-form>
368
+ <modal-form ref="judgementOutcomeForm" view-code="JudgementOutcomeEdit">
369
+ <template #footer>
370
+ <Button type="primary" custom-icon="fa fa-save" @click="saveOutcome">确定</Button>
371
+ <Button type="warning" custom-icon="fa fa-times" @click="removeOutcome">删除</Button>
372
+ </template>
373
+ </modal-form>
374
+ <modal-form ref="outcomeForm" view-code="OutcomeEdit">
375
+ <template #footer>
376
+ <Button type="primary" custom-icon="fa fa-save" @click="saveOutcome">确定</Button>
377
+ <Button type="warning" custom-icon="fa fa-times" @click="removeOutcome">删除</Button>
378
+ </template>
379
+ </modal-form>
380
+ </div>
381
+ </template>
382
+ <script>
383
+ import enumApi from '../../api/enum';
384
+ import mixinPage from '../../mixins/page';
385
+ import modelApi from '../../api/model';
386
+ import processDefApi from '../../api/processDef';
387
+
388
+ export default {
389
+ mixins: [mixinPage],
390
+ components: {},
391
+ props: {},
392
+ data() {
393
+ return {
394
+ opened: false,
395
+ current: {},
396
+ offset: {},
397
+ movingActivity: null,
398
+ isMoving: false,
399
+ isCreatingOutcome: false,
400
+ activityFrom: null,
401
+ setting: {
402
+ rectWidth: 100,
403
+ rectHeight: 50,
404
+ rectFontSize: 13,
405
+ lineFontSize: 12
406
+ },
407
+ newActivity: null,
408
+ editActivity: null,
409
+ editOutcome: null,
410
+ toolbars: [],
411
+ data: {}
412
+ };
413
+ },
414
+ computed: {
415
+ displayActivities() {
416
+ let activities = this.toolbars;
417
+ if (this.data && this.data.activities) {
418
+ activities = activities.concat(this.data.activities);
419
+ }
420
+
421
+ if (this.newActivity) {
422
+ activities.push(this.newActivity);
423
+ }
424
+
425
+ return activities;
426
+ },
427
+ activities() {
428
+ return this.data.activities;
429
+ }
430
+ },
431
+ async created() {
432
+ this.toolbars = [];
433
+ const src = await enumApi.query('ActivityType');
434
+ let index = 0;
435
+
436
+ src.forEach(item => {
437
+ this.toolbars.push({
438
+ isTool: true,
439
+ x: 10 + 30 + this.setting.rectWidth / 2,
440
+ y: 10 + 30 + (this.setting.rectHeight + 20) * index + this.setting.rectHeight / 2,
441
+ activityType: item.id,
442
+ name: item.name
443
+ });
444
+
445
+ index++;
446
+ });
447
+ },
448
+ methods: {
449
+ // 打开界面
450
+ async open(params) {
451
+ this.opened = true;
452
+
453
+ const res = await processDefApi.getChart(params);
454
+
455
+ this.data = res;
456
+ },
457
+ // 关闭
458
+ close() {
459
+ this.opened = false;
460
+ },
461
+ // 保存
462
+ save() {
463
+ this.confirm('确定要保存一个未激活的新版本吗?', async () => {
464
+ await processDefApi.save(this.data);
465
+ this.success('保存成功!');
466
+ });
467
+ },
468
+ // 发布
469
+ publish() {
470
+ this.confirm('确定要发布一个新版本并激活吗?', async () => {
471
+ await processDefApi.publish(this.data);
472
+ this.success('发布成功!');
473
+ this.opened = false;
474
+ });
475
+ },
476
+ // 获取Outcom的起始点
477
+ getOutcomeStartPoint(outcome) {
478
+ let activity = this.data.activities.find(activity => activity.pid == outcome.activityFromPid);
479
+ return { x: activity.x, y: activity.y };
480
+ },
481
+ // 获取Outcom的结束点
482
+ getOutcomeEndPoint(outcome) {
483
+ let activity = this.data.activities.find(activity => activity.pid == outcome.activityToPid);
484
+ return { x: activity.x, y: activity.y };
485
+ },
486
+ // 获取Outcome路径
487
+ getOutcomPath(outcome) {
488
+ if (this.getOutcomeStartPoint(outcome).x > this.getOutcomeEndPoint(outcome).x) {
489
+ return (
490
+ 'M ' +
491
+ this.getOutcomeEndPoint(outcome).x +
492
+ ' ' +
493
+ this.getOutcomeEndPoint(outcome).y +
494
+ ' L ' +
495
+ this.getOutcomeStartPoint(outcome).x +
496
+ ' ' +
497
+ this.getOutcomeStartPoint(outcome).y
498
+ );
499
+ } else {
500
+ return (
501
+ 'M ' +
502
+ this.getOutcomeStartPoint(outcome).x +
503
+ ' ' +
504
+ this.getOutcomeStartPoint(outcome).y +
505
+ ' L ' +
506
+ this.getOutcomeEndPoint(outcome).x +
507
+ ' ' +
508
+ this.getOutcomeEndPoint(outcome).y
509
+ );
510
+ }
511
+ },
512
+ // 获取Outcome的两端点
513
+ getOutcomePoint(outcome) {
514
+ let activityFrom = this.data.activities.find(activity => activity.pid == outcome.activityFromPid);
515
+ let activityTo = this.data.activities.find(activity => activity.pid == outcome.activityToPid);
516
+
517
+ let result = {
518
+ fromPoint: this.getPointOfIntersection(activityFrom, { x: activityTo.x, y: activityTo.y }),
519
+ toPoint: this.getPointOfIntersection(activityTo, { x: activityFrom.x, y: activityFrom.y })
520
+ };
521
+
522
+ return result;
523
+ },
524
+ // 获取两个点之间的距离
525
+ getDistBetweenPoints(point1, point2) {
526
+ return Math.sqrt((point2.x - point1.x) * (point2.x - point1.x) + (point2.y - point1.y) * (point2.y - point1.y));
527
+ },
528
+ // 获取线与图形的交叉点
529
+ getPointOfIntersection(activity, point) {
530
+ let result = {};
531
+ let width = this.setting.rectWidth;
532
+ let height = this.setting.rectHeight;
533
+
534
+ if (activity.activityType == 'ParallelEnd') {
535
+ width = (this.setting.rectHeight / 3) * 2;
536
+ height = (this.setting.rectHeight / 3) * 2;
537
+ }
538
+
539
+ // 中心点
540
+ let centerPoint = {
541
+ x: activity.x,
542
+ y: activity.y
543
+ };
544
+
545
+ if (Math.abs(point.x - centerPoint.x) <= width / 2 && Math.abs(point.y - centerPoint.y) <= height / 2) {
546
+ //activity.activityType == 'Manual') {
547
+ result = centerPoint;
548
+ } else {
549
+ let angle = Math.abs((Math.atan((centerPoint.x - point.x) / (centerPoint.y - point.y)) * 180.0) / Math.PI);
550
+ let angle2 = Math.abs((Math.atan(width / height) * 180.0) / Math.PI);
551
+ let radio = height < width ? height / 2 : width / 2;
552
+
553
+ if (angle <= angle2) {
554
+ if (centerPoint.x < point.x) {
555
+ result.x = centerPoint.x + Math.tan((Math.PI * angle) / 180.0) * radio;
556
+ } else {
557
+ result.x = centerPoint.x - Math.tan((Math.PI * angle) / 180.0) * radio;
558
+ }
559
+
560
+ if (centerPoint.y < point.y) {
561
+ result.y = centerPoint.y + height / 2;
562
+ } else {
563
+ result.y = centerPoint.y - height / 2;
564
+ }
565
+ } else {
566
+ if (centerPoint.x < point.x) {
567
+ result.x = centerPoint.x + width / 2;
568
+ } else {
569
+ result.x = centerPoint.x - width / 2;
570
+ }
571
+
572
+ if (centerPoint.y < point.y) {
573
+ result.y = centerPoint.y + Math.tan((Math.PI * (90 - angle)) / 180.0) * radio;
574
+ } else {
575
+ result.y = centerPoint.y - Math.tan((Math.PI * (90 - angle)) / 180.0) * radio;
576
+ }
577
+ }
578
+ }
579
+ // } elseif (false) {
580
+ // if (Math.abs(point.x - centerPoint.x) <= width / 2 && Math.abs(point.y - centerPoint.y) <= height / 2) {
581
+ // result = centerPoint;
582
+ // } else {
583
+ // var radial = (width < height ? width : height) / 2;
584
+ // var bc = getDistBetweenPoints(point, centerPoint);
585
+ // result.x = centerPoint.x - ((centerPoint.x - point.x) * radial) / bc;
586
+ // result.y = centerPoint.y - ((centerPoint.y - point.y) * radial) / bc;
587
+ // }
588
+ // }
589
+
590
+ return result;
591
+ },
592
+ // 鼠标按钮在活动上按下
593
+ mousedownActivity(activity, e) {
594
+ if (activity.isTool) {
595
+ // 从工具栏拖动
596
+ this.newActivity = this.copy(activity);
597
+ this.movingActivity = this.newActivity;
598
+ } else {
599
+ // 普通拖动
600
+ this.movingActivity = activity;
601
+ }
602
+
603
+ this.offset.x = activity.x - e.layerX;
604
+ this.offset.y = activity.y - e.layerY;
605
+ this.isMoving = true;
606
+ },
607
+ // 鼠标按钮在活动上抬起
608
+ mouseupActivity(activity) {
609
+ if (this.isCreatingOutcome) {
610
+ if (this.activityFrom.pid == activity.pid) {
611
+ return;
612
+ }
613
+
614
+ if (
615
+ this.data.outcomes.some(outcome => {
616
+ return outcome.activityFromPid == this.activityFrom.pid && outcome.activityToPid == activity.pid;
617
+ })
618
+ ) {
619
+ this.error('结果已存在,不能重复创建!');
620
+ return;
621
+ }
622
+
623
+ // 新建Outcome
624
+ this.data.outcomes.push({
625
+ processID: this.data.processID,
626
+ pid: this.getNewOutcomeID(),
627
+ activityFromPid: this.activityFrom.pid,
628
+ activityToPid: activity.pid,
629
+ outcomeType: 'Custom',
630
+ code: '',
631
+ name: '',
632
+ ruleData: null,
633
+ orderNo: 0
634
+ });
635
+ }
636
+ },
637
+ // 鼠标双击活动
638
+ dblclickActivity(activity) {
639
+ if (!activity.isTool) {
640
+ this.editActivity = activity;
641
+ if (activity.activityType == 'Interactive') {
642
+ // 角色参数表格
643
+ let data = [];
644
+
645
+ if (activity.destinationRoleParam) {
646
+ data = JSON.parse(activity.destinationRoleParam);
647
+ }
648
+
649
+ this.$refs.destinationRoleParamTable.loadData(data);
650
+ this.$refs.interactiveForm.openDefault(activity);
651
+ } else if (activity.activityType == 'Service') {
652
+ this.$refs.serviceForm.openDefault(activity);
653
+ } else {
654
+ this.$refs.activityForm.openDefault(activity);
655
+ }
656
+ }
657
+ },
658
+ // 鼠标双击结果
659
+ dblclickOutcome(outcome) {
660
+ this.editOutcome = this.copy(outcome);
661
+
662
+ let activity = this.data.activities.find(item => {
663
+ return item.pid == outcome.activityFromPid;
664
+ });
665
+
666
+ if (activity.activityType == 'Judgement') {
667
+ this.$refs.judgementOutcomeForm.openDefault(this.editOutcome);
668
+ } else {
669
+ this.$refs.outcomeForm.openDefault(this.editOutcome);
670
+ }
671
+ },
672
+ // 鼠标按钮抬起
673
+ mouseUp(e) {
674
+ if (this.isMoving && this.movingActivity && this.movingActivity.isTool) {
675
+ // 从工具栏拖动
676
+ if (e.layerX > 10 + 30 * 2 + this.setting.rectWidth + this.setting.rectWidth / 2) {
677
+ // 拖出工具栏范围
678
+ this.newActivity.processID = this.data.processID;
679
+ this.newActivity.isTool = false;
680
+ this.newActivity.pid = this.getNewActivityID();
681
+ this.data.activities.push(this.newActivity);
682
+ }
683
+
684
+ this.newActivity = null;
685
+ }
686
+
687
+ this.isCreatingOutcome = false;
688
+ this.isMoving = false;
689
+ },
690
+ // 鼠标移动
691
+ mousemove(e) {
692
+ this.current.x = e.layerX;
693
+ this.current.y = e.layerY;
694
+ //this.$forceUpdate();
695
+
696
+ if (this.isMoving) {
697
+ this.movingActivity.x = e.layerX + this.offset.x;
698
+ this.movingActivity.y = e.layerY + this.offset.y;
699
+ }
700
+ },
701
+ // 鼠标移入活动中心位置
702
+ mouseenterCenter(activity) {
703
+ if (!activity.isTool) {
704
+ activity.activeCenter = true;
705
+ }
706
+ },
707
+ // 鼠标移出活动中心位置
708
+ mouseleaveCenter(activity) {
709
+ activity.activeCenter = false;
710
+ },
711
+ // 活动中心位置按下鼠标
712
+ mousedownCenter(activity) {
713
+ if (activity.activeCenter) {
714
+ // 添加Outcome
715
+ this.isCreatingOutcome = true;
716
+ this.activityFrom = activity;
717
+ }
718
+ },
719
+ // 获取新的Activity id
720
+ getNewActivityID() {
721
+ let id = 0;
722
+ this.data.activities.forEach(item => {
723
+ if (item.pid > id) {
724
+ id = item.pid;
725
+ }
726
+ });
727
+
728
+ return ++id;
729
+ },
730
+ // 获取新的Outcome id
731
+ getNewOutcomeID() {
732
+ let id = 0;
733
+ this.data.outcomes.forEach(item => {
734
+ if (item.pid > id) {
735
+ id = item.pid;
736
+ }
737
+ });
738
+
739
+ return ++id;
740
+ },
741
+ // 保存活动
742
+ saveActivity() {
743
+ let index = this.data.activities.findIndex(item => {
744
+ return item.pid == this.editActivity.pid;
745
+ });
746
+
747
+ if (this.editActivity.activityType == 'Interactive') {
748
+ let data = this.$refs.interactiveForm.getFullData();
749
+ data.destinationRoleParam = JSON.stringify(this.$refs.destinationRoleParamTable.data);
750
+ this.data.activities.splice(index, 1, data);
751
+ this.$refs.interactiveForm.close();
752
+ } else if (this.editActivity.activityType == 'Service') {
753
+ this.data.activities.splice(index, 1, this.$refs.serviceForm.getFullData());
754
+ this.$refs.serviceForm.close();
755
+ } else {
756
+ this.data.activities.splice(index, 1, this.$refs.activityForm.getFullData());
757
+ this.$refs.activityForm.close();
758
+ }
759
+ },
760
+ // 删除活动
761
+ removeActivity() {
762
+ this.confirm('确定要删除该节点及全部关联结果吗?', () => {
763
+ let index = this.data.activities.findIndex(item => {
764
+ return item.pid == this.editActivity.pid;
765
+ });
766
+
767
+ this.data.activities.splice(index, 1);
768
+
769
+ this.data.outcomes = this.data.outcomes.filter(item => {
770
+ return item.activityFromPid != this.editActivity.pid && item.activityToPid != this.editActivity.pid;
771
+ });
772
+
773
+ if (this.editActivity.activityType == 'Interactive') {
774
+ this.$refs.interactiveForm.close();
775
+ } else if (this.editActivity.activityType == 'Service') {
776
+ this.$refs.serviceForm.close();
777
+ } else {
778
+ this.$refs.activityForm.close();
779
+ }
780
+ });
781
+ },
782
+ // 保存结果
783
+ saveOutcome() {
784
+ let index = this.data.outcomes.findIndex(item => {
785
+ return item.pid == this.editOutcome.pid;
786
+ });
787
+
788
+ let activity = this.data.activities.find(item => {
789
+ return item.pid == this.editOutcome.activityFromPid;
790
+ });
791
+
792
+ if (activity.activityType == 'Judgement') {
793
+ this.data.outcomes.splice(index, 1, this.$refs.judgementOutcomeForm.getFullData());
794
+ this.$refs.judgementOutcomeForm.close();
795
+ } else {
796
+ this.data.outcomes.splice(index, 1, this.$refs.outcomeForm.getFullData());
797
+ this.$refs.outcomeForm.close();
798
+ }
799
+ },
800
+ // 删除结果
801
+ removeOutcome() {
802
+ this.confirm('确定要删除该结果吗?', () => {
803
+ let index = this.data.outcomes.findIndex(item => {
804
+ return item.pid == this.editOutcome.pid;
805
+ });
806
+
807
+ this.data.outcomes.splice(index, 1);
808
+
809
+ let activity = this.data.activities.find(item => {
810
+ return item.pid == this.editOutcome.activityFromPid;
811
+ });
812
+
813
+ if (activity.activityType == 'Judgement') {
814
+ this.$refs.judgementOutcomeForm.close();
815
+ } else {
816
+ this.$refs.outcomeForm.close();
817
+ }
818
+ });
819
+ },
820
+ // 交互表单数据变更
821
+ async interactiveFormChange(sender) {
822
+ // this.$refs.interactiveForm.columns.find(item => {
823
+ // return item.code == 'destinationRoleID';
824
+ // }).isShow = !this.$refs.interactiveForm.data.isOriginator;
825
+
826
+ if (sender && sender.code == 'destinationRoleID') {
827
+ if (this.$refs.interactiveForm.data.destinationRoleID) {
828
+ const res = await modelApi.query('RoleProperty', { roleID: this.$refs.interactiveForm.data.destinationRoleID });
829
+
830
+ let data = res.data.map(item => {
831
+ return {
832
+ rolePropertyCode: item.propertyCode,
833
+ name: item.propertyName,
834
+ processPropertyCode: null
835
+ };
836
+ });
837
+
838
+ this.$refs.destinationRoleParamTable.loadData(data);
839
+ } else {
840
+ this.$refs.destinationRoleParamTable.loadData([]);
841
+ }
842
+ }
843
+ }
844
+ }
845
+ };
846
+ </script>