progressShow.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <template>
  2. <div class="app-container">
  3. <div class="main-area">
  4. <div class="show-header">
  5. <div class="tag-list">
  6. <div class="tag-item">
  7. <!-- <div class="circle"></div> -->
  8. <i class="el-icon-circle-check icon"></i>
  9. <span>已完成</span>
  10. </div>
  11. <div class="tag-item">
  12. <i class="el-icon-warning icon"></i>
  13. <span>触发异常</span>
  14. </div>
  15. <div class="tag-item">
  16. <i class="el-icon-warning-outline icon"></i>
  17. <span>新插入</span>
  18. </div>
  19. <div class="tag-item">
  20. <span class="current-node">当前节点</span>
  21. </div>
  22. </div>
  23. <div class="search-list">
  24. <div class="search-tab">
  25. <el-radio-group v-model="processType">
  26. <el-radio-button :label="1">进行</el-radio-button>
  27. <el-radio-button :label="2">完成</el-radio-button>
  28. </el-radio-group>
  29. </div>
  30. <div class="search-input">
  31. <el-input placeholder="请输入..." v-model="queryString">
  32. <el-button slot="append" icon="el-icon-search"></el-button>
  33. </el-input>
  34. </div>
  35. </div>
  36. </div>
  37. <div class="show-body">
  38. <TaskList
  39. v-for="(item, index) of tableData"
  40. :key="index + 1"
  41. :cardData="item"
  42. ></TaskList>
  43. <pagination
  44. v-show="total > 0"
  45. :total="total"
  46. :page.sync="queryParams.pageNum"
  47. :limit.sync="queryParams.pageSize"
  48. @pagination="getList"
  49. />
  50. </div>
  51. </div>
  52. </div>
  53. </template>
  54. <script>
  55. import TaskList from "./components/taskList.vue";
  56. import { processList } from "@/api/bpmprocess/run/executeProcess";
  57. import getNodeSequence from "@/utils/bpmn/getNodeSequence";
  58. import { xmlStr2XmlObj } from "@/utils/bpmn/xml";
  59. export default {
  60. name: "ProgressShow",
  61. props: [],
  62. components: { TaskList },
  63. data() {
  64. return {
  65. processType: 1,
  66. queryString: "",
  67. total: 0,
  68. queryParams: {
  69. pageNum: 1,
  70. pageSize: 5,
  71. },
  72. tableData: [], //列表数据
  73. };
  74. },
  75. computed: {},
  76. methods: {
  77. // 获取列表数据
  78. getList() {
  79. processList(this.queryParams).then((res) => {
  80. if (res.code == 200) {
  81. this.tableData = this.getTableData(
  82. res.rows.map((item) => item.resultMap)
  83. );
  84. this.total = res.total;
  85. } else {
  86. this.$message.error("网络异常,请稍后再试");
  87. }
  88. });
  89. },
  90. // 获取表格展示数据
  91. getTableData(dataList) {
  92. let res = [];
  93. res = dataList.map((item) => {
  94. let baseObj = {
  95. benTaskProcessKey: item.bepTaskKey, //任务编号
  96. bepTaskName: item.bepTaskName, //任务名称
  97. benCreateTime: item.benCreateTime, //开始或结束时间 需要根据bepTaskProcessState状态 来判定
  98. currentNodeKey: item.benTaskNodeKey, //当前节点key
  99. cardList: [],
  100. };
  101. let xmlObj = xmlStr2XmlObj(item.bepTaskProcessXmlContent);
  102. baseObj.cardList = getNodeSequence(xmlObj);
  103. return baseObj;
  104. });
  105. res = this.setNodeState(res);
  106. return res;
  107. },
  108. // 设置节点完成情况
  109. setNodeState(res) {
  110. res.forEach((re) => {
  111. let nowKey = re.currentNodeKey;
  112. let isDone = true;
  113. re.cardList.forEach((item) => {
  114. if (item.nodeId == nowKey) {
  115. isDone = false;
  116. item.isDone = isDone;
  117. item.isNow = true;
  118. } else {
  119. item.isDone = isDone;
  120. item.isNow = false;
  121. }
  122. });
  123. // 当最后一个节点就是当前节点时置为完成状态
  124. let lastNode = re.cardList[re.cardList.length - 1];
  125. if (re.currentNodeKey == lastNode.nodeId) {
  126. lastNode.isDone = true;
  127. lastNode.isNow = false;
  128. }
  129. });
  130. return res;
  131. },
  132. },
  133. mounted() {
  134. this.getList();
  135. },
  136. activated() {
  137. this.getList();
  138. },
  139. };
  140. </script>
  141. <style scoped lang="scss">
  142. .app-container {
  143. padding: 15px 15px;
  144. box-sizing: border-box;
  145. .main-area {
  146. box-shadow: 0 1px 15px 1px rgb(69 65 78 / 8%);
  147. background-color: #fff;
  148. .show-header {
  149. border-bottom: 1px solid #ebedf2;
  150. display: flex;
  151. align-items: center;
  152. justify-content: space-between;
  153. padding: 0px 20px 0px 20px;
  154. height: 50px;
  155. .tag-list {
  156. display: flex;
  157. align-items: center;
  158. .tag-item {
  159. display: flex;
  160. align-items: center;
  161. margin-right: 15px;
  162. font-size: 16px;
  163. .circle {
  164. width: 15px;
  165. height: 15px;
  166. background-color: rgb(104, 221, 104);
  167. border-radius: 50%;
  168. margin-right: 5px;
  169. }
  170. .icon {
  171. margin-right: 5px;
  172. }
  173. .current-node {
  174. display: inline-block;
  175. border: 2px solid #34bfa3;
  176. padding: 2px 5px;
  177. margin: 2px 40px 2px 10px;
  178. }
  179. }
  180. }
  181. .search-list {
  182. display: flex;
  183. .search-tab {
  184. margin-right: 20px;
  185. }
  186. }
  187. }
  188. .show-body {
  189. padding: 25px;
  190. }
  191. }
  192. }
  193. </style>