CreateWorkflow.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <div class="container-fluid">
  3. <div class="row m-row">
  4. <div
  5. v-for="(item, index) in menuItems"
  6. :key="item.no"
  7. class="col-lg-2 col-md-3 col-sm-4 col-xs-6"
  8. >
  9. <a
  10. :class="type(index)"
  11. style="
  12. background-color: #337ab7;
  13. width: 100%;
  14. height: 100%;
  15. margin: 0 auto;
  16. border: 1px solid #fff;
  17. border-radius: 10px;
  18. text-align: center;
  19. "
  20. @click="open(item)"
  21. >
  22. <div class="menu-icon">
  23. <span :class="item.icon" />
  24. </div>
  25. <p class="menu-text">
  26. {{ item.name }}
  27. </p>
  28. </a>
  29. </div>
  30. </div>
  31. <Loading v-if="loading" />
  32. </div>
  33. </template>
  34. <script>
  35. import Common from '../common/Common.js';
  36. import { Uuid } from 'pc-component-v3';
  37. import WindowClientUtil from '../resource/dictionary/WindowClientUtil.js';
  38. import WindowServerUtil from '../resource/dictionary/WindowServerUtil.js';
  39. export default {
  40. components: {
  41. },
  42. data: function () {
  43. return {
  44. menuItems: [],
  45. loading: false,
  46. };
  47. },
  48. mounted: function () {
  49. this.init();
  50. },
  51. methods: {
  52. init: function () {
  53. var _self = this;
  54. _self.loading=true;
  55. $.ajax({
  56. url: Common.getApiURL('MenuResource/findNeedApproveMenuDtoByRoleId'),
  57. type: 'GET',
  58. dataType: 'json',
  59. beforeSend: function (request) {
  60. Common.addTokenToRequest(request);
  61. },
  62. success: function (data) {
  63. _self.loading=false;
  64. _self.menuItems = data;
  65. },
  66. error: function (XMLHttpRequest, textStatus, errorThrown) {
  67. _self.loading=false;
  68. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  69. },
  70. });
  71. },
  72. type: function (index) {
  73. var typeNum = index % 5;
  74. switch (typeNum) {
  75. case 0:
  76. return 'btn btn-primary';
  77. case 1:
  78. return 'btn btn-info';
  79. case 2:
  80. return 'btn btn-success';
  81. case 3:
  82. return 'btn btn-warning';
  83. case 4:
  84. return 'btn btn-danger';
  85. default:
  86. return;
  87. }
  88. },
  89. open: function (menuItem) {
  90. var _self = this;
  91. _self.loading=true;
  92. var windowId = menuItem.curdWindowNo;
  93. WindowServerUtil.getWindowById(
  94. windowId,
  95. function (data) {
  96. var tab = data.tabs[0];
  97. _self.loading=false;
  98. window.open(
  99. Common.getRedirectUrl(
  100. '#/desktop/window/window-edit/create/' +
  101. windowId +
  102. '/' +
  103. tab.tabIndex +
  104. '?currPage=' +
  105. 1 +
  106. '&totalCount=' +
  107. 1 +
  108. '&uuid=' +
  109. Uuid.createUUID(),
  110. ),
  111. );
  112. },
  113. function () {
  114. _self.loading=false;
  115. },
  116. );
  117. },
  118. },
  119. };
  120. </script>
  121. <style>
  122. .menu-box {
  123. background-color: red;
  124. width: 100%;
  125. height: 100%;
  126. margin: 0 auto;
  127. border: 1px solid #fff;
  128. border-radius: 10px;
  129. text-align: center;
  130. }
  131. .menu-icon {
  132. width: 100%;
  133. height: 60px;
  134. color: #337ab7;
  135. }
  136. .menu-icon span {
  137. font-size: 35px;
  138. line-height: 60px;
  139. margin: 0px;
  140. width: 100%;
  141. color: white;
  142. }
  143. .menu-text {
  144. font-size: 16px;
  145. overflow: hidden;
  146. text-overflow: ellipsis;
  147. white-space: nowrap;
  148. color: white;
  149. }
  150. </style>