contactsEdit.js 1.8 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.$;
	    
	    showGrid({
		 	id: "showForm",
doc_wei's avatar
doc_wei 已提交
15 16
		 	url: flowableBasePath + "queryContactsMationById",
		 	params: {id: parent.rowId},
doc_wei's avatar
doc_wei 已提交
17
		 	pagination: false,
doc_wei's avatar
doc_wei 已提交
18 19
			method: 'GET',
		 	template: $("#beanTemplate").html(),
W
weizhiqiang 已提交
20
		 	ajaxSendLoadBefore: function(hdb) {
doc_wei's avatar
doc_wei 已提交
21
		 	},
W
weizhiqiang 已提交
22
		 	ajaxSendAfter: function (json) {
doc_wei's avatar
doc_wei 已提交
23 24 25 26 27 28 29
		 		$("input:radio[name=isDefault][value=" + json.bean.isDefault + "]").attr("checked", true);
		 		
		 		matchingLanguage();
		 		form.render();
		 	    form.on('submit(formEditBean)', function (data) {
		 	        if (winui.verifyForm(data.elem)) {
		 	        	var params = {
doc_wei's avatar
doc_wei 已提交
30 31 32 33
	 	        			id: parent.rowId,
							objectId: parent.objectId,
							objectKey: parent.objectKey,
							name: $("#name").val(),
doc_wei's avatar
doc_wei 已提交
34 35 36 37 38 39 40 41 42 43
		 	        		contacts: $("#contacts").val(),
		 	        		department: $("#department").val(),
		 	        		job: $("#job").val(),
		 	        		workPhone: $("#workPhone").val(),
		 	        		mobilePhone: $("#mobilePhone").val(),
		 	        		email: $("#email").val(),
		 	        		qq: $("#qq").val(),
		 	        		wechat: $("#wechat").val(),
		 	        		isDefault: $("input[name='isDefault']:checked").val()
	 	 	        	};
doc_wei's avatar
doc_wei 已提交
44
	 	 	        	AjaxPostUtil.request({url: reqBasePath + "writeContactsMation", params: params, type: 'json', method: 'POST', callback: function (json) {
45 46
							parent.layer.close(index);
							parent.refreshCode = '0';
doc_wei's avatar
doc_wei 已提交
47 48 49 50 51 52 53
	 		 	   		}});
		 	        }
		 	        return false;
		 	    });
		 	}
		});
		
doc_wei's avatar
doc_wei 已提交
54
	    $("body").on("click", "#cancle", function() {
doc_wei's avatar
doc_wei 已提交
55 56 57 58
	    	parent.layer.close(index);
	    });
	});
});