documentaryAdd.js 2.2 KB
Newer Older
doc_wei's avatar
doc_wei 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

// 商机管理
layui.config({
	base: basePath, 
	version: skyeyeVersion
}).extend({
    window: 'js/winui.window'
}).define(['window', 'jquery', 'winui', 'laydate', 'textool'], function (exports) {
	winui.renderColor();
	layui.use(['form'], function (form) {
		var index = parent.layer.getFrameIndex(window.name);
	    var $ = layui.$,
	    	laydate = layui.laydate,
	    	textool = layui.textool;

	    //跟单时间
		laydate.render({
			elem : '#documentaryTime',
			type : 'datetime',
			trigger : 'click'
		});
		
		textool.init({
	    	eleId: 'detail',
	    	maxlength: 200,
26
	    	tools: ['count', 'copy', 'reset']
doc_wei's avatar
doc_wei 已提交
27
	    });
doc_wei's avatar
doc_wei 已提交
28 29 30 31 32 33

		// 获取已上线的跟单分类列表
		sysCustomerUtil.queryCrmDocumentaryTypeIsUpList(function (data){
			$("#typeId").html(getDataUseHandlebars(getFileContent('tpl/template/select-option.tpl'), data));
			form.render('select');
			opportunityFrom();
doc_wei's avatar
doc_wei 已提交
34
		});
doc_wei's avatar
doc_wei 已提交
35

doc_wei's avatar
doc_wei 已提交
36 37 38 39
		//商机
		function opportunityFrom(){
			showGrid({
			 	id: "opportunityId",
doc_wei's avatar
doc_wei 已提交
40
			 	url: flowableBasePath + "opportunity008",
doc_wei's avatar
doc_wei 已提交
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
			 	params: {},
			 	pagination: false,
			 	template: getFileContent('tpl/template/select-option.tpl'),
			 	ajaxSendLoadBefore: function(hdb){
			 	},
			 	ajaxSendAfter:function(j){
			 		form.render('select');
			 	}
			});
		}

		skyeyeEnclosure.init('enclosureUpload');
		matchingLanguage();
 		form.render();
 	    form.on('submit(formAddBean)', function (data) {
 	        if (winui.verifyForm(data.elem)) {
 	        	var params = {
        			detail: $("#detail").val(),
        			documentaryTime: $("#documentaryTime").val(),
					typeId: $("#typeId").val(),
					opportunityId: $("#opportunityId").val(),
					enclosureInfo: skyeyeEnclosure.getEnclosureIdsByBoxId('enclosureUpload')
 	        	};
doc_wei's avatar
doc_wei 已提交
64
 	        	AjaxPostUtil.request({url: flowableBasePath + "documentary002", params: params, type: 'json', callback: function(json){
doc_wei's avatar
doc_wei 已提交
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
	 	   			if (json.returnCode == 0){
		 	   			parent.layer.close(index);
		 	        	parent.refreshCode = '0';
	 	   			} else {
	 	   				winui.window.msg(json.returnMessage, {icon: 2, time: 2000});
	 	   			}
	 	   		}});
 	        }
 	        return false;
 	    });
 	    
	    $("body").on("click", "#cancle", function(){
	    	parent.layer.close(index);
	    });
	});
});