planProjectFlowEdit.js 2.1 KB
Newer Older
doc_wei's avatar
doc_wei 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14
layui.config({
	base: basePath, 
	version: skyeyeVersion
}).extend({
    window: 'js/winui.window'
}).define(['window', 'jquery', 'winui'], function (exports) {
	winui.renderColor();
	layui.use(['form'], function (form) {
		var index = parent.layer.getFrameIndex(window.name);
	    var $ = layui.$,
	    	form = layui.form;
	    
		showGrid({
		 	id: "showForm",
15
		 	url: sysMainMation.businessFlowBasePath + "planprojectflow004",
doc_wei's avatar
doc_wei 已提交
16 17 18 19 20 21 22 23 24 25 26
		 	params: {rowId: parent.rowId},
		 	pagination: false,
			method: "GET",
		 	template: $("#beanTemplate").html(),
		 	ajaxSendLoadBefore: function(hdb){
		 		//是否共享
		 		hdb.registerHelper("compare2", function(v1, options){
					if(v1 == '2'){//公开分享
						return 'checked';
					}else if(v1 == '1'){//不分享
						return '';
doc_wei's avatar
doc_wei 已提交
27
					} else {
doc_wei's avatar
doc_wei 已提交
28 29 30 31 32 33 34 35
						return '';
					}
				});
		 		hdb.registerHelper("compare3", function(v1, options){
					if(v1 == '2'){//公开分享
						return 'true';
					}else if(v1 == '1'){//不分享
						return 'false';
doc_wei's avatar
doc_wei 已提交
36
					} else {
doc_wei's avatar
doc_wei 已提交
37 38 39 40
						return 'false';
					}
				});
		 	},
W
weizhiqiang 已提交
41
		 	ajaxSendAfter:function (json) {
doc_wei's avatar
doc_wei 已提交
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
		 		
		 		$("#projectName").html(parent.projectName);
		 		
		 		matchingLanguage();
		 		form.render();
		 		
		 		//是否共享
		 		form.on('switch(isShare)', function (data) {
		 			$(data.elem).val(data.elem.checked);
		 		});
		 		
		 		form.on('submit(formEditBean)', function (data) {
			        if (winui.verifyForm(data.elem)) {
			        	var params = {
		        			rowId: parent.rowId,
		        			title: $("#title").val(),
			        	};
			        	
			        	if(data.field.isShare){
			        		params.isShare = '2';
doc_wei's avatar
doc_wei 已提交
62
			        	} else {
doc_wei's avatar
doc_wei 已提交
63 64 65
			        		params.isShare = '1';
			        	}
			        	
66
			        	AjaxPostUtil.request({url: sysMainMation.businessFlowBasePath + "planprojectflow005", params: params, type: 'json', method: "PUT", callback: function (json) {
67 68
							parent.layer.close(index);
							parent.refreshCode = '0';
doc_wei's avatar
doc_wei 已提交
69 70 71 72 73 74 75 76 77
			 	   		}});
			        }
			        return false;
			    });
		 		
		 	}
	    });
		
	    //取消
doc_wei's avatar
doc_wei 已提交
78
	    $("body").on("click", "#cancle", function() {
doc_wei's avatar
doc_wei 已提交
79 80 81 82 83
	    	parent.layer.close(index);
	    });
	    
	});
});