dwsurveydesign.js 4.6 KB
Newer Older
doc_wei's avatar
doc_wei 已提交
1 2 3 4 5 6 7 8 9 10
layui.config({
	base: basePath, 
	version: skyeyeVersion
}).define(['jquery', 'winui'], function (exports) {
	winui.renderColor();
	layui.use(['form'], function (form) {
		var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
	    var $ = layui.$,
	    form = layui.form;
	    
doc_wei's avatar
doc_wei 已提交
11
	    //基本题型
doc_wei's avatar
doc_wei 已提交
12 13 14 15 16 17 18
	    var _basemodel = getFileContent('tpl/dwsurveydesign/dragmodel/basemodel/radioQuModel.tpl')
	    				+ getFileContent('tpl/dwsurveydesign/dragmodel/basemodel/checkboxQuModel.tpl')
	    				+ getFileContent('tpl/dwsurveydesign/dragmodel/basemodel/fillblankQuModel.tpl')
	    				+ getFileContent('tpl/dwsurveydesign/dragmodel/basemodel/scoreQuModel.tpl')
	    				+ getFileContent('tpl/dwsurveydesign/dragmodel/basemodel/orderQuModel.tpl')
	    				+ getFileContent('tpl/dwsurveydesign/dragmodel/basemodel/mfillblankQuModel.tpl');
	    
doc_wei's avatar
doc_wei 已提交
19
	    //矩阵题型
doc_wei's avatar
doc_wei 已提交
20 21 22 23 24
	    var _rectanglemodel = getFileContent('tpl/dwsurveydesign/dragmodel/rectanglemodel/chenRadioQuModel.tpl')
						+ getFileContent('tpl/dwsurveydesign/dragmodel/rectanglemodel/chenCheckboxQuModel.tpl')
						+ getFileContent('tpl/dwsurveydesign/dragmodel/rectanglemodel/chenScoreQuModel.tpl')
						+ getFileContent('tpl/dwsurveydesign/dragmodel/rectanglemodel/chenFillblankQuModel.tpl');
	    
doc_wei's avatar
doc_wei 已提交
25
	    //辅助组件
doc_wei's avatar
doc_wei 已提交
26 27 28
	    var _auxiliarymodel = getFileContent('tpl/dwsurveydesign/dragmodel/auxiliarymodel/pageQuModel.tpl')
						+ getFileContent('tpl/dwsurveydesign/dragmodel/auxiliarymodel/paragraphQuModel.tpl');
	    
doc_wei's avatar
doc_wei 已提交
29
	    //操作
doc_wei's avatar
doc_wei 已提交
30 31 32
	    var _operationmodel = getFileContent('tpl/dwsurveydesign/dragmodel/operationmodel/surveyAttrSetToolbar.tpl')
						+ getFileContent('tpl/dwsurveydesign/dragmodel/operationmodel/surveyStyleEditToolbar.tpl');
	    
doc_wei's avatar
doc_wei 已提交
33
	    //常用题型
doc_wei's avatar
doc_wei 已提交
34 35 36 37 38 39 40 41 42 43 44 45 46
	    var _commonlyusedmodel = getFileContent('tpl/dwsurveydesign/dragmodel/commonlyusedmodel/userNameQuModel.tpl')
						+ getFileContent('tpl/dwsurveydesign/dragmodel/commonlyusedmodel/phoneNoQuModel.tpl')
						+ getFileContent('tpl/dwsurveydesign/dragmodel/commonlyusedmodel/addressQuModel.tpl')
						+ getFileContent('tpl/dwsurveydesign/dragmodel/commonlyusedmodel/birthdayQuModel.tpl')
						+ getFileContent('tpl/dwsurveydesign/dragmodel/commonlyusedmodel/emailQuModel.tpl')
						+ getFileContent('tpl/dwsurveydesign/dragmodel/commonlyusedmodel/genderQuModel.tpl')
						+ getFileContent('tpl/dwsurveydesign/dragmodel/commonlyusedmodel/educationQuModel.tpl')
						+ getFileContent('tpl/dwsurveydesign/dragmodel/commonlyusedmodel/cityQuModel.tpl')
						+ getFileContent('tpl/dwsurveydesign/dragmodel/commonlyusedmodel/maritalQuModel.tpl')
						+ getFileContent('tpl/dwsurveydesign/dragmodel/commonlyusedmodel/companyQuModel.tpl')
						+ getFileContent('tpl/dwsurveydesign/dragmodel/commonlyusedmodel/salaryQuModel.tpl')
						+ getFileContent('tpl/dwsurveydesign/dragmodel/commonlyusedmodel/dateQuModel.tpl');
	    
doc_wei's avatar
doc_wei 已提交
47 48 49
	    //各种模板
	    var _varioustemplates = getFileContent('tpl/dwsurveydesign/varioustemplates.tpl');
	    
doc_wei's avatar
doc_wei 已提交
50 51 52 53 54
	    $("#_basemodel").html(_basemodel);
	    $("#_rectanglemodel").html(_rectanglemodel);
	    $("#_auxiliarymodel").html(_auxiliarymodel);
	    $("#_operationmodel").html(_operationmodel);
	    $("#_commonlyusedmodel").html(_commonlyusedmodel);
doc_wei's avatar
doc_wei 已提交
55
	    $("body").append(_varioustemplates);
doc_wei's avatar
doc_wei 已提交
56
	    
doc_wei's avatar
doc_wei 已提交
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
	    showGrid({
		 	id: "showForm",
		 	url: reqBasePath + "dwsurveydirectory003",
		 	params: {rowId: parent.rowId},
		 	pagination: false,
		 	template: getFileContent('tpl/dwsurveydesign/dwsurveydesignbean.tpl'),
		 	ajaxSendLoadBefore: function(hdb){
		 	},
		 	ajaxSendAfter:function(json){
		 		
		 		
		 		form.render();
			    form.on('submit(formAddBean)', function (data) {
			    	//表单验证
			        if (winui.verifyForm(data.elem)) {
			        	var params = {
		        			surveyName: $("#surveyName").val(),
			        	};
//			        	AjaxPostUtil.request({url:reqBasePath + "dwsurveydirectory002", params:params, type:'json', callback:function(json){
//			 	   			if(json.returnCode == 0){
//				 	   			parent.layer.close(index);
//				 	        	parent.refreshCode = '0';
//			 	   			}else{
//			 	   				top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
//			 	   			}
//			 	   		}});
			        }
			        return false;
			    });
		 	}
doc_wei's avatar
doc_wei 已提交
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
	    });
	    
	    //取消
	    $("body").on("click", "#cancle", function(){
	    	parent.layer.close(index);
	    });
	    
	    //选项卡切换
	    $("body").on("click", "#tabType li", function(){
	    	$("#tabType li").removeClass("current");
	    	$(this).addClass("current");
	    	$(".tools_tab_div").css('display','none');
	    	$("#" + $(this).attr("id").replace("_li", "")).css('display','block');
	    });
	    
	});
	    
});