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

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

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

Loading…
Cancel
Save