|
@@ -22,14 +22,22 @@
|
|
|
</div>
|
|
|
<div class="search-list">
|
|
|
<div class="search-tab">
|
|
|
- <el-radio-group v-model="processType">
|
|
|
- <el-radio-button :label="1">进行</el-radio-button>
|
|
|
- <el-radio-button :label="2">完成</el-radio-button>
|
|
|
+ <el-radio-group
|
|
|
+ v-model="queryParams.taskProcessState"
|
|
|
+ @change="getList"
|
|
|
+ >
|
|
|
+ <el-radio-button label="3">已完成</el-radio-button>
|
|
|
+ <el-radio-button label="0">进行中</el-radio-button>
|
|
|
+ <el-radio-button label="">所有</el-radio-button>
|
|
|
</el-radio-group>
|
|
|
</div>
|
|
|
<div class="search-input">
|
|
|
<el-input placeholder="请输入..." v-model="queryString">
|
|
|
- <el-button slot="append" icon="el-icon-search"></el-button>
|
|
|
+ <el-button
|
|
|
+ slot="append"
|
|
|
+ @click="getList"
|
|
|
+ icon="el-icon-search"
|
|
|
+ ></el-button>
|
|
|
</el-input>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -38,6 +46,7 @@
|
|
|
<TaskList
|
|
|
v-for="(item, index) of tableData"
|
|
|
:key="index + 1"
|
|
|
+ :num="index + 1"
|
|
|
:cardData="item"
|
|
|
></TaskList>
|
|
|
<pagination
|
|
@@ -54,7 +63,7 @@
|
|
|
|
|
|
<script>
|
|
|
import TaskList from "./components/taskList.vue";
|
|
|
-import { processList } from "@/api/bpmprocess/run/executeProcess";
|
|
|
+import { processList, getListLog } from "@/api/bpmprocess/run/executeProcess";
|
|
|
import getNodeSequence from "@/utils/bpmn/getNodeSequence";
|
|
|
import { xmlStr2XmlObj } from "@/utils/bpmn/xml";
|
|
|
export default {
|
|
@@ -63,12 +72,13 @@ export default {
|
|
|
components: { TaskList },
|
|
|
data() {
|
|
|
return {
|
|
|
- processType: 1,
|
|
|
+ // processType: 1,
|
|
|
queryString: "",
|
|
|
total: 0,
|
|
|
queryParams: {
|
|
|
pageNum: 1,
|
|
|
- pageSize: 5,
|
|
|
+ pageSize: 10,
|
|
|
+ taskProcessState: "0",
|
|
|
},
|
|
|
tableData: [], //列表数据
|
|
|
};
|
|
@@ -77,7 +87,18 @@ export default {
|
|
|
methods: {
|
|
|
// 获取列表数据
|
|
|
getList() {
|
|
|
- processList(this.queryParams).then((res) => {
|
|
|
+ getListLog(this.queryParams).then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.tableData = this.getTableData(
|
|
|
+ res.rows.map((item) => item.resultMap)
|
|
|
+ );
|
|
|
+ console.log(this.tableData);
|
|
|
+ this.total = res.total;
|
|
|
+ } else {
|
|
|
+ this.$message.error("网络异常,请稍后再试");
|
|
|
+ }
|
|
|
+
|
|
|
+ return;
|
|
|
if (res.code == 200) {
|
|
|
this.tableData = this.getTableData(
|
|
|
res.rows.map((item) => item.resultMap)
|
|
@@ -93,17 +114,22 @@ export default {
|
|
|
let res = [];
|
|
|
res = dataList.map((item) => {
|
|
|
let baseObj = {
|
|
|
- benTaskProcessKey: item.bepTaskKey, //任务编号
|
|
|
- bepTaskName: item.bepTaskName, //任务名称
|
|
|
- benCreateTime: item.benCreateTime, //开始或结束时间 需要根据bepTaskProcessState状态 来判定
|
|
|
- currentNodeKey: item.benTaskNodeKey, //当前节点key
|
|
|
+ benTaskProcessKey: item.taskKey, //任务编号
|
|
|
+ bepTaskName: item.taskName, //任务名称
|
|
|
+ benCreateTime: item.nodeLogList[0].taskNodeType
|
|
|
+ ? item.nodeLogList[0].createTime
|
|
|
+ : "", //开始或结束时间 需要根据bepTaskProcessState状态 来判定
|
|
|
+ currentNodeKey: item.taskNodeNextKey, //当前节点key
|
|
|
cardList: [],
|
|
|
+ doneNodeList: item.nodeLogList,
|
|
|
};
|
|
|
- let xmlObj = xmlStr2XmlObj(item.bepTaskProcessXmlContent);
|
|
|
+ let xmlObj = xmlStr2XmlObj(item.taskProcessXmlContent);
|
|
|
baseObj.cardList = getNodeSequence(xmlObj);
|
|
|
return baseObj;
|
|
|
});
|
|
|
- res = this.setNodeState(res);
|
|
|
+ res = this.nodeHandler(res); //合并两个节点数组
|
|
|
+ res = this.sortHandler(res); //排序
|
|
|
+ // res = this.setNodeState(res);
|
|
|
return res;
|
|
|
},
|
|
|
// 设置节点完成情况
|
|
@@ -131,6 +157,77 @@ export default {
|
|
|
|
|
|
return res;
|
|
|
},
|
|
|
+
|
|
|
+ // 合并两个节点数组
|
|
|
+ nodeHandler(processList) {
|
|
|
+ let res = processList.map((item, index) => {
|
|
|
+ console.log(
|
|
|
+ JSON.parse(JSON.stringify(item.cardList)),
|
|
|
+ JSON.parse(JSON.stringify(item.doneNodeList)),
|
|
|
+ item.currentNodeKey
|
|
|
+ );
|
|
|
+ item.doneNodeList.forEach((node) => {
|
|
|
+ Object.assign(node, {
|
|
|
+ isDone: true,
|
|
|
+ isNow: false,
|
|
|
+ nodeId: node.taskNodeKey,
|
|
|
+ nodeInfo: {
|
|
|
+ localName: node.taskNodeType,
|
|
|
+ id: "",
|
|
|
+ name: node.taskNodeName,
|
|
|
+ nodeDescription: "",
|
|
|
+ industryType: "",
|
|
|
+ normalScriptKey: "",
|
|
|
+ normalScriptTriggerType: node.taskNodeExecuteType,
|
|
|
+ executeUserType: "",
|
|
|
+ executeUser: "",
|
|
|
+ virtuallyRole: "",
|
|
|
+ },
|
|
|
+ });
|
|
|
+ });
|
|
|
+ let currentIndex = item.cardList.findIndex(
|
|
|
+ (node) => node.nodeId == item.currentNodeKey
|
|
|
+ );
|
|
|
+ console.log(currentIndex, item.cardList.length);
|
|
|
+ // while(currentIndex<item.cardList.length){}
|
|
|
+ for (let i = currentIndex; i < item.cardList.length; i++) {
|
|
|
+ if (i == currentIndex) {
|
|
|
+ item.cardList[i].isNow = true;
|
|
|
+ if (i == item.cardList.length - 1) {
|
|
|
+ item.cardList[i].isDone = true;
|
|
|
+ } else {
|
|
|
+ item.cardList[i].isDone = false;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ item.cardList[i].isDone = false;
|
|
|
+ item.cardList[i].isNow = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (currentIndex == item.cardList.length - 1) {
|
|
|
+ item.cardList.splice(0, currentIndex + 1);
|
|
|
+ } else {
|
|
|
+ item.cardList.splice(0, currentIndex);
|
|
|
+ }
|
|
|
+
|
|
|
+ item.cardList.unshift(...item.doneNodeList);
|
|
|
+ console.log(item.cardList);
|
|
|
+ item.cardList.forEach((node, index) => {
|
|
|
+ node.num = index + 1;
|
|
|
+ });
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ return res;
|
|
|
+ },
|
|
|
+
|
|
|
+ // 任务排序
|
|
|
+ sortHandler(processList) {
|
|
|
+ processList.sort((a, b) => {
|
|
|
+ let time_a = new Date(a.doneNodeList[0].createTime)?.getTime();
|
|
|
+ let time_b = new Date(b.doneNodeList[0].createTime)?.getTime();
|
|
|
+ return time_b - time_a;
|
|
|
+ });
|
|
|
+ return processList;
|
|
|
+ },
|
|
|
},
|
|
|
mounted() {
|
|
|
this.getList();
|