CreateWorkflow.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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. _self.loading=false;
  97. if(data.errorCode != 0){
  98. Notify.error('Error', data.errorMessage, false);
  99. return;
  100. }
  101. var tab = data.data.tabs[0];
  102. window.open(
  103. Common.getRedirectUrl(
  104. '#/desktop/window/window-edit/create/' +
  105. windowId +
  106. '/' +
  107. tab.tabIndex +
  108. '?currPage=' +
  109. 1 +
  110. '&totalCount=' +
  111. 1 +
  112. '&uuid=' +
  113. Uuid.createUUID(),
  114. ),
  115. );
  116. },
  117. function () {
  118. _self.loading=false;
  119. },
  120. );
  121. },
  122. },
  123. };
  124. </script>
  125. <style>
  126. .menu-box {
  127. background-color: red;
  128. width: 100%;
  129. height: 100%;
  130. margin: 0 auto;
  131. border: 1px solid #fff;
  132. border-radius: 10px;
  133. text-align: center;
  134. }
  135. .menu-icon {
  136. width: 100%;
  137. height: 60px;
  138. color: #337ab7;
  139. }
  140. .menu-icon span {
  141. font-size: 35px;
  142. line-height: 60px;
  143. margin: 0px;
  144. width: 100%;
  145. color: white;
  146. }
  147. .menu-text {
  148. font-size: 16px;
  149. overflow: hidden;
  150. text-overflow: ellipsis;
  151. white-space: nowrap;
  152. color: white;
  153. }
  154. </style>