fix(流程任务): 优化代码

1.任务意见校验
2.部分字段增加注释
approve-sys
tony 4 years ago
parent 6cfec4ef7f
commit 5f3d4ca76c

@ -122,10 +122,11 @@ export default {
rules: {}, // rules: {}, //
variablesForm: {}, // variablesForm: {}, //
taskForm:{ taskForm:{
returnTaskShow: false, returnTaskShow: false, // 退
defaultTaskShow: true, defaultTaskShow: true, //
comment:"", // comment:"", //
procInsId: "", // procInsId: "", //
instanceId: "", //
deployId: "", // deployId: "", //
taskId: "" ,// taskId: "" ,//
procDefId: "", // procDefId: "", //
@ -141,6 +142,7 @@ export default {
}, },
created() { created() {
this.taskForm.procInsId = this.$route.query && this.$route.query.procInsId; this.taskForm.procInsId = this.$route.query && this.$route.query.procInsId;
this.taskForm.instanceId = this.$route.query && this.$route.query.procInsId;
// //
this.taskForm.deployId = this.$route.query && this.$route.query.deployId; this.taskForm.deployId = this.$route.query && this.$route.query.deployId;
this.taskForm.procDefId = this.$route.query && this.$route.query.procDefId; this.taskForm.procDefId = this.$route.query && this.$route.query.procDefId;
@ -168,24 +170,24 @@ export default {
// }, 1000) // }, 1000)
}, },
methods: { methods: {
setIcon(val){ setIcon(val) {
if (val){ if (val) {
return "el-icon-check"; return "el-icon-check";
}else { } else {
return "el-icon-time"; return "el-icon-time";
} }
}, },
setColor(val){ setColor(val) {
if (val){ if (val) {
return "#2bc418"; return "#2bc418";
}else { } else {
return "#b3bdbb"; return "#b3bdbb";
} }
}, },
/** 流程流转记录 */ /** 流程流转记录 */
getFlowRecordList(procInsId,deployId){ getFlowRecordList(procInsId, deployId) {
const params = {procInsId: procInsId,deployId:deployId} const params = {procInsId: procInsId, deployId: deployId}
flowRecord(params).then(res =>{ flowRecord(params).then(res => {
this.flowRecordList = res.data.flowList; this.flowRecordList = res.data.flowList;
// //
if (res.data.formData) { if (res.data.formData) {
@ -210,42 +212,46 @@ export default {
}) })
}, },
/** 获取流程变量内容 */ /** 获取流程变量内容 */
processVariables(taskId){ processVariables(taskId) {
if (taskId) { if (taskId) {
getProcessVariables(taskId).then(res => { getProcessVariables(taskId).then(res => {
this.variables = res.data.variables; this.variables = res.data.variables;
this.variableOpen = true this.variableOpen = true
}) });
} }
}, },
/** 审批任务*/ /** 审批任务 */
handleComplete() { handleComplete() {
complete(this.taskForm).then(response => { this.$refs["taskForm"].validate(valid => {
this.msgSuccess(response.msg); if (valid) {
this.goBack(); complete(this.taskForm).then(response => {
}) this.msgSuccess(response.msg);
this.goBack();
});
}
});
}, },
/** 返回页面 */ /** 返回页面 */
goBack(){ goBack() {
// //
this.$store.dispatch("tagsView/delView", this.$route); this.$store.dispatch("tagsView/delView", this.$route);
this.$router.go(-1) this.$router.go(-1)
}, },
/** 接收子组件传的值 */ /** 接收子组件传的值 */
getData(data){ getData(data) {
if (data){ if (data) {
const variables = []; const variables = [];
data.fields.forEach(item =>{ data.fields.forEach(item => {
let variableData = {}; let variableData = {};
variableData.label = item.__config__.label variableData.label = item.__config__.label
// //
if (item.__config__.defaultValue instanceof Array){ if (item.__config__.defaultValue instanceof Array) {
const array = []; const array = [];
item.__config__.defaultValue.forEach(val =>{ item.__config__.defaultValue.forEach(val => {
array.push(val) array.push(val)
}) })
variableData.val = array; variableData.val = array;
}else { } else {
variableData.val = item.__config__.defaultValue variableData.val = item.__config__.defaultValue
} }
variables.push(variableData) variables.push(variableData)
@ -255,19 +261,19 @@ export default {
}, },
/** 申请流程表单数据提交 */ /** 申请流程表单数据提交 */
submitForm(data) { submitForm(data) {
if (data){ if (data) {
const variableList = []; const variableList = [];
data.fields.forEach(item =>{ data.fields.forEach(item => {
let variableData = {}; let variableData = {};
variableData.label = item.__config__.label variableData.label = item.__config__.label
// //
if (item.__config__.defaultValue instanceof Array){ if (item.__config__.defaultValue instanceof Array) {
const array = []; const array = [];
item.__config__.defaultValue.forEach(val =>{ item.__config__.defaultValue.forEach(val => {
array.push(val) array.push(val)
}) })
variableData.val = array; variableData.val = array;
}else { } else {
variableData.val = item.__config__.defaultValue variableData.val = item.__config__.defaultValue
} }
variableList.push(variableData) variableList.push(variableData)
@ -277,7 +283,7 @@ export default {
"variables": variableList "variables": variableList
} }
// //
definitionStart(this.taskForm.procDefId,JSON.stringify(variables)).then(res => { definitionStart(this.taskForm.procDefId, JSON.stringify(variables)).then(res => {
this.msgSuccess(res.msg); this.msgSuccess(res.msg);
this.goBack(); this.goBack();
}) })
@ -286,10 +292,14 @@ export default {
}, },
/** 驳回任务 */ /** 驳回任务 */
handleReject() { handleReject() {
rejectTask(this.taskForm).then(res => { this.$refs["taskForm"].validate(valid => {
this.msgSuccess(res.msg); if (valid) {
this.goBack(); rejectTask(this.taskForm).then(res => {
}) this.msgSuccess(res.msg);
this.goBack();
});
}
});
}, },
/** 可退回任务列表 */ /** 可退回任务列表 */
handleReturn() { handleReturn() {
@ -306,11 +316,15 @@ export default {
this.returnTaskList = []; this.returnTaskList = [];
}, },
/** 提交退回任务 */ /** 提交退回任务 */
submitReturnTask(){ submitReturnTask() {
returnTask(this.taskForm).then(res => { this.$refs["taskForm"].validate(valid => {
this.msgSuccess(res.msg); if (valid) {
this.goBack() returnTask(this.taskForm).then(res => {
}) this.msgSuccess(res.msg);
this.goBack()
});
}
});
} }
} }
}; };

Loading…
Cancel
Save