优化代码

This commit is contained in:
java110 2021-08-16 19:22:01 +08:00
parent 67858c82c4
commit 486f6fdf84
4 changed files with 69 additions and 71 deletions

View File

@ -70,7 +70,6 @@
return; return;
} }
vc.component.addOaWorkflowInfo.communityId = vc.getCurrentCommunity().communityId;
//不提交数据将数据 回调给侦听处理 //不提交数据将数据 回调给侦听处理
if (vc.notNull($props.callBackListener)) { if (vc.notNull($props.callBackListener)) {
vc.emit($props.callBackListener, $props.callBackFunction, vc.component.addOaWorkflowInfo); vc.emit($props.callBackListener, $props.callBackFunction, vc.component.addOaWorkflowInfo);
@ -79,7 +78,7 @@
} }
vc.http.apiPost( vc.http.apiPost(
'oaWorkflow.saveOaWorkflow', '/oaWorkflow/saveOaWorkflow',
JSON.stringify(vc.component.addOaWorkflowInfo), JSON.stringify(vc.component.addOaWorkflowInfo),
{ {
emulateJSON: true emulateJSON: true

View File

@ -19,9 +19,8 @@
}, },
methods: { methods: {
deleteOaWorkflow: function () { deleteOaWorkflow: function () {
vc.component.deleteOaWorkflowInfo.communityId = vc.getCurrentCommunity().communityId;
vc.http.apiPost( vc.http.apiPost(
'oaWorkflow.deleteOaWorkflow', '/oaWorkflow/deleteOaWorkflow',
JSON.stringify(vc.component.deleteOaWorkflowInfo), JSON.stringify(vc.component.deleteOaWorkflowInfo),
{ {
emulateJSON: true emulateJSON: true

View File

@ -1,110 +1,110 @@
(function(vc,vm){ (function (vc, vm) {
vc.extends({ vc.extends({
data:{ data: {
editOaWorkflowInfo:{ editOaWorkflowInfo: {
flowId:'', flowId: '',
flowName:'', flowName: '',
flowType:'', flowType: '',
describle:'', describle: '',
} }
}, },
_initMethod:function(){ _initMethod: function () {
}, },
_initEvent:function(){ _initEvent: function () {
vc.on('editOaWorkflow','openEditOaWorkflowModal',function(_params){ vc.on('editOaWorkflow', 'openEditOaWorkflowModal', function (_params) {
vc.component.refreshEditOaWorkflowInfo(); vc.component.refreshEditOaWorkflowInfo();
$('#editOaWorkflowModel').modal('show'); $('#editOaWorkflowModel').modal('show');
vc.copyObject(_params, vc.component.editOaWorkflowInfo ); vc.copyObject(_params, vc.component.editOaWorkflowInfo);
vc.component.editOaWorkflowInfo.communityId = vc.getCurrentCommunity().communityId; vc.component.editOaWorkflowInfo.communityId = vc.getCurrentCommunity().communityId;
}); });
}, },
methods:{ methods: {
editOaWorkflowValidate:function(){ editOaWorkflowValidate: function () {
return vc.validate.validate({ return vc.validate.validate({
editOaWorkflowInfo:vc.component.editOaWorkflowInfo editOaWorkflowInfo: vc.component.editOaWorkflowInfo
},{ }, {
'editOaWorkflowInfo.flowName':[ 'editOaWorkflowInfo.flowName': [
{ {
limit:"required", limit: "required",
param:"", param: "",
errInfo:"流程名称不能为空" errInfo: "流程名称不能为空"
}, },
{ {
limit:"maxLength", limit: "maxLength",
param:"64", param: "64",
errInfo:"流程名称超过64位" errInfo: "流程名称超过64位"
}, },
], ],
'editOaWorkflowInfo.flowType':[ 'editOaWorkflowInfo.flowType': [
{ {
limit:"required", limit: "required",
param:"", param: "",
errInfo:"流程类型不能为空" errInfo: "流程类型不能为空"
}, },
{ {
limit:"maxLength", limit: "maxLength",
param:"12", param: "12",
errInfo:"流程类型不能为空" errInfo: "流程类型不能为空"
}, },
], ],
'editOaWorkflowInfo.describle':[ 'editOaWorkflowInfo.describle': [
{ {
limit:"maxLength", limit: "maxLength",
param:"200", param: "200",
errInfo:"备注内容不能超过200" errInfo: "备注内容不能超过200"
}, },
], ],
'editOaWorkflowInfo.flowId':[ 'editOaWorkflowInfo.flowId': [
{ {
limit:"required", limit: "required",
param:"", param: "",
errInfo:"工作流ID不能为空" errInfo: "工作流ID不能为空"
}] }]
}); });
}, },
editOaWorkflow:function(){ editOaWorkflow: function () {
if(!vc.component.editOaWorkflowValidate()){ if (!vc.component.editOaWorkflowValidate()) {
vc.toast(vc.validate.errInfo); vc.toast(vc.validate.errInfo);
return ; return;
} }
vc.http.apiPost( vc.http.apiPost(
'oaWorkflow.updateOaWorkflow', '/oaWorkflow/updateOaWorkflow',
JSON.stringify(vc.component.editOaWorkflowInfo), JSON.stringify(vc.component.editOaWorkflowInfo),
{ {
emulateJSON:true emulateJSON: true
}, },
function(json,res){ function (json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0); //vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
let _json = JSON.parse(json); let _json = JSON.parse(json);
if (_json.code == 0) { if (_json.code == 0) {
//关闭model //关闭model
$('#editOaWorkflowModel').modal('hide'); $('#editOaWorkflowModel').modal('hide');
vc.emit('oaWorkflowManage','listOaWorkflow',{}); vc.emit('oaWorkflowManage', 'listOaWorkflow', {});
return ; return;
} }
vc.message(_json.msg); vc.message(_json.msg);
}, },
function(errInfo,error){ function (errInfo, error) {
console.log('请求失败处理'); console.log('请求失败处理');
vc.message(errInfo); vc.message(errInfo);
}); });
}, },
refreshEditOaWorkflowInfo:function(){ refreshEditOaWorkflowInfo: function () {
vc.component.editOaWorkflowInfo= { vc.component.editOaWorkflowInfo = {
flowId:'', flowId: '',
flowName:'', flowName: '',
flowType:'', flowType: '',
describle:'', describle: '',
} }
} }
} }
}); });
})(window.vc,window.vc.component); })(window.vc, window.vc.component);

View File

@ -41,7 +41,7 @@
}; };
//发送get请求 //发送get请求
vc.http.apiGet('oaWorkflow.listOaWorkflows', vc.http.apiGet('/oaWorkflow/queryOaWorkflow',
param, param,
function (json, res) { function (json, res) {
var _oaWorkflowManageInfo = JSON.parse(json); var _oaWorkflowManageInfo = JSON.parse(json);