bpm 的 OA 请假的列表的接入

This commit is contained in:
YunaiV 2022-01-22 19:20:00 +08:00
parent ec978c4441
commit cc9a2199b1
11 changed files with 67 additions and 494 deletions

View File

@ -13,36 +13,21 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
* 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成
*/
@Data
public class OALeaveBaseVO {
public class BpmOALeaveBaseVO {
@ApiModelProperty(value = "流程id")
private String processInstanceId;
@ApiModelProperty(value = "状态", required = true)
private Integer status;
@ApiModelProperty(value = "申请人id", required = true)
private String userId;
@ApiModelProperty(value = "开始时间", required = true)
@ApiModelProperty(value = "请假的开始时间", required = true)
@NotNull(message = "开始时间不能为空")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date startTime;
@ApiModelProperty(value = "结束时间", required = true)
@ApiModelProperty(value = "请假的结束时间", required = true)
@NotNull(message = "结束时间不能为空")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date endTime;
@ApiModelProperty(value = "请假类型")
private String leaveType;
@ApiModelProperty(value = "请假类型", required = true, example = "1", notes = "参见 bpm_oa_type 枚举")
private Integer type;
@ApiModelProperty(value = "原因")
@ApiModelProperty(value = "原因", required = true, example = "阅读芋道源码")
private String reason;
@ApiModelProperty(value = "申请时间", required = true)
@NotNull(message = "申请时间不能为空")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date applyTime;
}

View File

@ -12,21 +12,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@ApiModel("请假申请创建 Request VO")
@Data
public class OALeaveCreateReqVO {
@ApiModelProperty(value = "请假的开始时间", required = true)
@NotNull(message = "开始时间不能为空")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date startTime;
@ApiModelProperty(value = "请假的结束时间", required = true)
@NotNull(message = "结束时间不能为空")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date endTime;
@ApiModelProperty(value = "请假类型", required = true, example = "1", notes = "参见 bpm_oa_type")
private Integer type;
@ApiModelProperty(value = "原因", required = true, example = "阅读芋道源码")
private String reason;
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class OALeaveCreateReqVO extends BpmOALeaveBaseVO {
}

View File

@ -2,14 +2,31 @@ package cn.iocoder.yudao.adminserver.modules.bpm.controller.oa.vo;
import lombok.*;
import io.swagger.annotations.*;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotNull;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ApiModel("请假申请 Response VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class OALeaveRespVO extends OALeaveBaseVO {
public class OALeaveRespVO extends BpmOALeaveBaseVO {
@ApiModelProperty(value = "请假表单主键", required = true)
@ApiModelProperty(value = "请假表单主键", required = true, example = "1024")
private Long id;
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 bpm_process_instance_result 枚举")
private Integer result;
@ApiModelProperty(value = "申请时间", required = true)
@NotNull(message = "申请时间不能为空")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date createTime;
@ApiModelProperty(value = "流程id")
private String processInstanceId;
}

View File

@ -18,7 +18,7 @@ public interface BpmOALeaveMapper extends BaseMapperX<OALeaveDO> {
default PageResult<OALeaveDO> selectPage(Long userId, OALeavePageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<OALeaveDO>()
.eqIfPresent(OALeaveDO::getId, userId)
.eqIfPresent(OALeaveDO::getUserId, userId)
.eqIfPresent(OALeaveDO::getResult, reqVO.getResult())
.eqIfPresent(OALeaveDO::getType, reqVO.getType())
.likeIfPresent(OALeaveDO::getReason, reqVO.getReason())

View File

@ -9,15 +9,6 @@ export function createLeave(data) {
})
}
// 更新请假申请
export function updateLeave(data) {
return request({
url: '/oa/leave/update',
method: 'put',
data: data
})
}
// 删除请假申请
export function deleteLeave(id) {
return request({
@ -37,7 +28,7 @@ export function getLeave(id) {
// 获得请假申请分页
export function getLeavePage(query) {
return request({
url: '/oa/leave/page',
url: '/bpm/oa/leave/page',
method: 'get',
params: query
})
@ -57,13 +48,3 @@ export function getLeaveApplyMembers() {
method: 'get'
})
}
// 导出请假申请 Excel
export function exportLeaveExcel(query) {
return request({
url: '/oa/leave/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -130,26 +130,12 @@ export const constantRoutes = [
children: [
{
path: 'leave/apply',
component: (resolve) => require(['@/views/oa/leave/apply/index'], resolve),
component: (resolve) => require(['@/views/bpm/oa/leave/create'], resolve),
name: '请假表单-申请',
meta: { title: '请假表单-申请', icon: 'form' }
}
]
},
{
path: '/flow',
component: Layout,
hidden: true,
redirect: 'noredirect',
children: [
{
path: 'leave/approve',
component: (resolve) => require(['@/views/oa/leave/approve/index'], resolve),
name: '请假表单-审批',
meta: { title: '请假表单-审批', icon: 'form' }
}
]
},
{
path: '/bpm',
component: Layout,

View File

@ -42,7 +42,7 @@ export const DICT_TYPE = {
BPM_PROCESS_INSTANCE_RESULT: 'bpm_process_instance_result',
BPM_TASK_ASSIGN_SCRIPT: 'bpm_task_assign_script',
OA_LEAVE_STATUS: 'flow_status', // todo 芋艿:可以删除
OA_LEAVE_TYPE: 'oa_leave_type'
BPM_OA_LEAVE_TYPE: 'bpm_oa_leave_type'
}
/**

View File

@ -41,7 +41,7 @@
import { createFormKeyLeave} from "@/api/oa/leave"
import { getDictDataLabel, getDictDatas, DICT_TYPE } from '@/utils/dict'
export default {
name: "ApplyLeave",
name: "LeaveCreate",
components: {
},
data() {
@ -65,7 +65,7 @@ export default {
statusFormat(row, column) {
return getDictDataLabel(DICT_TYPE.OA_LEAVE_STATUS, row.status)
},
leaveTypeDictData: getDictDatas(DICT_TYPE.OA_LEAVE_TYPE),
leaveTypeDictData: getDictDatas(DICT_TYPE.BPM_OA_LEAVE_TYPE),
leaveStatusData: getDictDatas(DICT_TYPE.OA_LEAVE_STATUS)
};
},

View File

@ -3,44 +3,24 @@
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="流程id" prop="processInstanceId">
<el-input v-model="queryParams.processInstanceId" placeholder="请输入流程id" clearable size="small" @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态">
<el-option
v-for="dict in leaveStatusData"
:key="parseInt(dict.value)"
:label="dict.label"
:value="parseInt(dict.value)"
/>
<el-form-item label="请假类型" prop="type">
<el-select v-model="queryParams.type" placeholder="请选择请假类型" clearable>
<el-option v-for="dict in leaveTypeDictData" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
<el-form-item label="开始时间">
<el-date-picker v-model="dateRangeStartTime" size="small" style="width: 240px" value-format="yyyy-MM-dd"
<el-form-item label="申请时间">
<el-date-picker v-model="dateRangeCreateTime" size="small" style="width: 240px" value-format="yyyy-MM-dd"
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" />
</el-form-item>
<el-form-item label="结束时间">
<el-date-picker v-model="dateRangeEndTime" size="small" style="width: 240px" value-format="yyyy-MM-dd"
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" />
</el-form-item>
<el-form-item label="请假类型" prop="leaveType">
<el-select v-model="queryParams.leaveType" placeholder="请选择请假类型">
<el-option
v-for="dict in leaveTypeDictData"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
<el-form-item label="结果" prop="result">
<el-select v-model="queryParams.result" placeholder="请选择流结果" clearable size="small">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT)"
:key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select>
</el-form-item>
<el-form-item label="原因" prop="reason">
<el-input v-model="queryParams.reason" placeholder="请输入原因" clearable size="small" @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="申请时间">
<el-date-picker v-model="dateRangeApplyTime" size="small" style="width: 240px" value-format="yyyy-MM-dd"
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@ -57,9 +37,8 @@
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="请假表单主键" align="center" prop="id" />
<el-table-column label="状态" align="center" prop="status" :formatter="statusFormat" />
<el-table-column label="申请人id" align="center" prop="userId" />
<el-table-column label="申请编号" align="center" prop="id" />
<el-table-column label="状态" align="center" prop="result" :formatter="resultFormat" />
<el-table-column label="开始时间" align="center" prop="startTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.startTime) }}</span>
@ -70,17 +49,17 @@
<span>{{ parseTime(scope.row.endTime) }}</span>
</template>
</el-table-column>
<el-table-column label="请假类型" align="center" prop="leaveType" :formatter="leaveTypeFormat" />
<el-table-column label="请假类型" align="center" prop="type" :formatter="typeFormat" />
<el-table-column label="原因" align="center" prop="reason" />
<el-table-column label="申请时间" align="center" prop="applyTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.applyTime) }}</span>
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleStep(scope.row)">审批进度</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleDetail(scope.row)">详情</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleProcessDetail(scope.row)">审批进度</el-button>
</template>
</el-table-column>
</el-table>
@ -129,7 +108,7 @@
<el-form-item label="开始时间" >{{ parseTime(form.startTime) }}</el-form-item>
<el-form-item label="结束时间" prop="endTime">{{ parseTime(form.endTime) }}</el-form-item>
<el-form-item label="请假类型" prop="leaveType">
{{ getDictDataLabel(DICT_TYPE.OA_LEAVE_TYPE, form.leaveType) }}
{{ getDictDataLabel(DICT_TYPE.BPM_OA_LEAVE_TYPE, form.leaveType) }}
</el-form-item>
<el-form-item label="原因" prop="reason">{{form.reason}}</el-form-item>
<el-form-item label="申请时间" prop="applyTime">{{ parseTime(form.applyTime) }}</el-form-item>
@ -140,27 +119,13 @@
</div>
</el-dialog>
<el-dialog :title="title" :visible.sync="dialogStepsVisible" width="750px" append-to-body>
<el-steps :active="stepActive" finish-status="success" >
<el-step :title="stepTitle(item)" :description="stepAssignee(item.assignee)" icon="el-icon-edit" v-for="(item) in handleTask.historyTask"></el-step>
</el-steps>
<br/>
<div v-html="svgUrl"></div>
<el-steps direction="vertical" :active="stepActive">
<el-step :title="stepTitle(item)" :description="stepDes(item)" v-for="(item) in handleTask.historyTask"></el-step>
</el-steps>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="dialogStepsVisible = false"> </el-button>
<el-button @click="dialogStepsVisible = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { createLeave, updateLeave, getLeaveApplyMembers, getLeave, getLeavePage, exportLeaveExcel } from "@/api/oa/leave"
import { createLeave, getLeaveApplyMembers, getLeave, getLeavePage} from "@/api/oa/leave"
import { getDictDataLabel, getDictDatas, DICT_TYPE } from '@/utils/dict'
import { processHistorySteps,getHighlightImg } from '@/api/oa/todo'
export default {
name: "Leave",
components: {
@ -179,13 +144,8 @@ export default {
title: "",
//
open: false,
//
dialogDetailVisible: false,
//
dialogStepsVisible: false,
dateRangeStartTime: [],
dateRangeEndTime: [],
dateRangeApplyTime: [],
dateRangeCreateTime: [],
//
queryParams: {
pageNo: 1,
@ -198,88 +158,27 @@ export default {
},
//
form: {},
svgUrl: "",
handleTask: {
historyTask:[],
taskVariable: "",
formObject: {}
},
steps:[{
stepName:"步骤一"
}],
//
rules: {
startTime: [{ required: true, message: "开始时间不能为空", trigger: "blur" }],
endTime: [{ required: true, message: "结束时间不能为空", trigger: "blur" }],
applyTime: [{ required: true, message: "申请时间不能为空", trigger: "blur" }],
},
statusFormat(row, column) {
return getDictDataLabel(DICT_TYPE.OA_LEAVE_STATUS, row.status)
},
leaveTypeFormat(row, column) {
return getDictDataLabel(DICT_TYPE.OA_LEAVE_TYPE, row.leaveType)
},
leaveTypeDictData: getDictDatas(DICT_TYPE.OA_LEAVE_TYPE),
leaveStatusData: getDictDatas(DICT_TYPE.OA_LEAVE_STATUS)
leaveTypeDictData: getDictDatas(DICT_TYPE.BPM_OA_LEAVE_TYPE),
leaveResultData: getDictDatas(DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT),
dialogDetailVisible: false, // TODO
};
},
created() {
this.getList();
},
computed: {
stepActive: function () {
let idx = 0;
for (let i = 0; i < this.handleTask.historyTask.length; i++) {
if (this.handleTask.historyTask[i].status === 1) {
idx = idx + 1;
} else {
break;
}
}
return idx;
},
stepTitle() {
return function (item) {
let name = item.stepName;
if (item.status === 1) {
name += '(已完成)'
}
if (item.status === 0) {
name += '(进行中)'
}
return name;
}
},
stepDes() {
return function (item) {
let desc = "";
if (item.status === 1) {
desc += "审批人:[" + item.assignee + "] 审批意见: [" + item.comment + "] 审批时间: " + this.parseTime(item.endTime);
}
return desc;
}
},
stepAssignee() {
return function (assignee) {
let desc = "";
if(assignee){
desc += "办理人:[" + assignee + "]";
}else{
desc += "办理人未签收";
}
return desc;
}
}
},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
//
let params = {...this.queryParams};
this.addBeginAndEndTime(params, this.dateRangeStartTime, 'startTime');
this.addBeginAndEndTime(params, this.dateRangeEndTime, 'endTime');
this.addBeginAndEndTime(params, this.dateRangeApplyTime, 'applyTime');
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
//
getLeavePage(params).then(response => {
this.list = response.data.list;
@ -296,7 +195,6 @@ export default {
reset() {
this.form = {
id: undefined,
processInstanceId: undefined,
status: undefined,
userId: undefined,
startTime: undefined,
@ -316,7 +214,7 @@ export default {
resetQuery() {
this.dateRangeStartTime = [];
this.dateRangeEndTime = [];
this.dateRangeApplyTime = [];
this.dateRangeCreateTime = [];
this.resetForm("queryForm");
this.handleQuery();
},
@ -344,21 +242,16 @@ export default {
this.title = "请假详情";
});
},
/** 查看审批进度的操作 */
handleProcessDetail(row) {
this.$router.push({ path: "/bpm/process-instance/detail", query: { id: row.processInstanceId}});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
updateLeave(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
return;
}
//
createLeave(this.form).then(response => {
this.msgSuccess("新增成功");
@ -367,39 +260,12 @@ export default {
});
});
},
/** 审批进度 */
handleStep(row) {
const that = this;
const id = row.processInstanceId;
processHistorySteps(id).then(response => {
this.handleTask.historyTask = response.data;
this.dialogStepsVisible = true
this.title = "审批进度";
getHighlightImg(row.processInstanceId).then(response => {
that.svgUrl = response
})
});
resultFormat(row, column) {
return getDictDataLabel(DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT, row.result)
},
typeFormat(row, column) {
return getDictDataLabel(DICT_TYPE.BPM_OA_LEAVE_TYPE, row.type)
},
/** 导出按钮操作 */
handleExport() {
//
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.addBeginAndEndTime(params, this.dateRangeStartTime, 'startTime');
this.addBeginAndEndTime(params, this.dateRangeEndTime, 'endTime');
this.addBeginAndEndTime(params, this.dateRangeApplyTime, 'applyTime');
//
this.$confirm('是否确认导出所有请假申请数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return exportLeaveExcel(params);
}).then(response => {
this.downloadExcel(response, '请假申请.xls');
})
}
}
};
</script>

View File

@ -1,36 +0,0 @@
<template>
<div class="app-container">
<el-row>
<div>TODO @芋艿, 待办请假和 已办请假感觉可以做成通用不同的业务表单对应的待办任务和已办任务可以通用或许可以想个更通用的名字 </div>
</el-row>
</div>
</template>
<script>
import { getStartForm } from "@/api/oa/flow";
export default {
name: "Flow",
components: {
},
data() {
return {
//
form: {},
rules: {
}
};
},
created() {
},
methods: {
// leave() {
// getStartForm('leave-formkey').then(response => {
// const route = response.data;
// this.$router.replace(route);
// });
// }
}
};
</script>

View File

@ -1,212 +0,0 @@
<template>
<div class="app-container">
<el-tabs type="border-card">
<el-tab-pane label="任务处理">
<el-form ref="form" :model="form" label-width="80px">
<el-row :gutter="20">
<el-col :span="6"><el-form-item label="申请人" >{{form.userId}}</el-form-item></el-col>
<el-col :span="6">
<el-form-item label="请假类型" prop="leaveType">
{{ getDictDataLabel(DICT_TYPE.OA_LEAVE_TYPE, form.leaveType) }}
</el-form-item>
</el-col>
<el-col :span="6"><el-form-item label="原因" prop="reason">{{form.reason}}</el-form-item></el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="6"><el-form-item label="开始时间" >{{ parseTime(form.startTime) }}</el-form-item></el-col>
<el-col :span="6"><el-form-item label="结束时间" prop="endTime">{{ parseTime(form.endTime) }}</el-form-item></el-col>
<el-form-item label="申请时间" prop="applyTime">{{ parseTime(form.applyTime) }}</el-form-item>
</el-row>
</el-form>
<el-divider></el-divider>
<el-form ref="taskForm" :model="leaveApprove" :rules="rules" label-width="80px">
<el-form-item label="是否同意" prop="approved">
<el-select v-model="leaveApprove.approved" placeholder="是否同意" v-on:change="approveChange">
<el-option
v-for="dict in approvedData"
:key="parseInt(dict.value)"
:label="dict.label"
:value="parseInt(dict.value)"
/>
</el-select>
</el-form-item>
<el-form-item label="处理意见" prop="comment">
<el-col :span="11">
<el-input
type="textarea"
:rows="3"
v-model="leaveApprove.comment">
</el-input>
</el-col>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm"> </el-button>
</el-form-item>
</el-form>
</el-tab-pane>
<el-tab-pane label="历史跟踪">
<el-steps :active="stepActive" simple finish-status="success">
<el-step :title="stepTitle(item)" icon="el-icon-edit" v-for="(item) in handleTask.historyTask" ></el-step>
</el-steps>
<br/>
<el-steps direction="vertical" :active="stepActive" space="65px">
<el-step :title="stepTitle(item)" :description="stepDes(item)" v-for="(item) in handleTask.historyTask" ></el-step>
</el-steps>
</el-tab-pane>
<el-tab-pane label="流程图">
<div v-html="highlightSvgUrl"></div>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import { getLeave,getLeaveApplyMembers } from "@/api/oa/leave"
import { completeTask,taskSteps, getHighlightImg } from "@/api/oa/todo";
import { getDictDataLabel, getDictDatas, DICT_TYPE } from '@/utils/dict'
export default {
name: "ApproveLeave",
components: {
},
data() {
return {
//
form: {},
//
rules: {
comment: [{ required: true, message: "意见不能为空", trigger: "blur" }]
},
handleTask: {
historyTask:[]
},
leaveApprove: {
approved : 1,
variables: {
hr: "",
pm: "",
bm: ""
},
taskId: "",
processInstanceId: "",
comment: "同意"
},
approvedData: [
{
value: 1,
label: '同意'
},
{
value: 0,
label: '不同意'
}
],
highlightSvgUrl: "",
statusFormat(row, column) {
return getDictDataLabel(DICT_TYPE.OA_LEAVE_STATUS, row.status)
},
leaveTypeDictData: getDictDatas(DICT_TYPE.OA_LEAVE_TYPE),
leaveStatusData: getDictDatas(DICT_TYPE.OA_LEAVE_STATUS)
};
},
computed:{
stepActive: function () {
let idx = 0;
for(let i=0; i<this.handleTask.historyTask.length; i++){
if(this.handleTask.historyTask[i].status === 1){
idx= idx+1;
}else{
break;
}
}
return idx;
},
stepTitle() {
return function (item) {
let name = item.stepName;
if (item.status === 1) {
name += '(已完成)'
}
if (item.status === 0) {
name += '(进行中)'
}
return name;
}
},
stepDes(){
return function (item) {
let desc = "";
if (item.status === 1) {
desc+="审批人:["+ item.assignee +"] 审批意见: [" + item.comment + "] 审批时间: " + this.parseTime(item.endTime);
}
return desc;
}
}
},
created() {
const businessKey = this.$route.query.businessKey;
const taskId = this.$route.query.taskId;
this.leaveApprove.taskId = taskId;
this.leaveApprove.processInstanceId = this.$route.query.processInstanceId;
this.getForm(businessKey);
this.getHighlightImg(this.leaveApprove.processInstanceId);
},
methods: {
getHighlightImg(processInstanceId){
getHighlightImg(processInstanceId).then(response => {
console.log(response)
this.highlightSvgUrl = response
})
},
/** 提交按钮 */
submitForm() {
this.$refs["taskForm"].validate(valid => {
if (!valid) {
return;
}
if (this.leaveApprove.approved == 1) {
this.leaveApprove.variables["approved"] = true;
}
if (this.leaveApprove.approved == 0) {
this.leaveApprove.variables["approved"] = false;
}
completeTask(this.leaveApprove).then(response => {
this.msgSuccess("执行任务成功");
this.$store.dispatch('tagsView/delView', this.$route).then(({ visitedViews }) => {
//if (this.isActive(this.$route)) {
this.$router.push({path: '/oa/todo'})
//}
})
})
});
},
getForm(id){
getLeave(id).then(response => {
this.form = response.data;
});
const data = {
taskId : this.leaveApprove.taskId,
businessKey: id,
}
taskSteps(data).then(response => {
this.handleTask = response.data;
});
getLeaveApplyMembers().then(response => {
this.leaveApprove.variables.hr = response.data.hr;
this.leaveApprove.variables.bm = response.data.bm;
this.leaveApprove.variables.pm = response.data.pm;
});
},
approveChange(){
if (this.leaveApprove.approved === 1) {
this.leaveApprove.comment = "同意"
}
if(this.leaveApprove.approved === 0){
this.leaveApprove.comment = "不同意"
}
}
}
};
</script>