/*! * Copyright (c) 2013-Now http://jeesite.com All rights reserved. * * @author ThinkGem * @version 2019-1-6 */ $("#dataGrid").dataGrid({data:columnList,datatype:"local",rowNum:3000,sortableColumn:false,dataId:"aa",autoGridHeight:function(){return $(window).height()-$(".nav-tabs").outerHeight()-$(".box-footer").outerHeight()-95},autoGridWidth:function(){return $(".main-content").width()-25},columnModel:[{header:"编码",name:"id",frozen:true,hidden:true,editable:true},{header:"状态",name:"status",frozen:true,hidden:true,editable:true},{header:"列名",name:"columnSort",width:30,frozen:true,align:"center",editable:true,edittype:"text",editoptions:{maxlength:"8","class":"form-control required digits hide columnSort",dataInit:function(a){if($(a).val()==""){$(a).val($(a).closest("table").find("tr").length*10)}$(a).parent().append('')}},classes:"columnSort"},{header:"列名",name:"columnName",width:110,frozen:true,formatter:function(d,b,c,a){if(c.status==Global.STATUS_DELETE){return''+c.columnName+' '}return c.columnName}},{header:"列名",name:"columnName",frozen:true,hidden:true,editable:true},{header:"列说明",name:"comments",width:110,frozen:true,editable:true,edittype:"text",editoptions:{maxlength:"100","class":"form-control required"}},{header:"字段类型",name:"columnType",hidden:true,editable:true},{header:"字段类型",name:"columnType",width:110,formatter:function(d,b,c,a){return c.columnType}},{header:"属性类型",name:"attrType",width:90,editable:true,edittype:"select",editoptions:{"class":"form-control required","data-msg-required":"请选择属性类型",items:(config.attrTypeList),itemLabel:"label",itemValue:"value",dataInit:function(a){$(a).select2().on("change",function(){try{$(this).valid()}catch(b){}})}}},{header:'属性名称 ',name:"fullAttrName",width:100,editable:true,edittype:"text",editoptions:{maxlength:"100","class":"form-control required","data-msg-required":"请选择属性名称"}},{header:"主键",name:"isPk",width:40,align:"center",editable:true,edittype:"checkbox",editoptions:{"class":"form-control",value:"1",dataInit:function(a){$(a).iCheck().on("change",function(){try{$(this).valid()}catch(b){}})}}},{header:"插入",name:"isInsert",width:40,align:"center",editable:true,edittype:"checkbox",editoptions:{"class":"form-control",value:"1",dataInit:function(a){$(a).iCheck().on("change",function(){try{$(this).valid()}catch(b){}})}}},{header:"更新",name:"isUpdate",width:40,align:"center",editable:true,edittype:"checkbox",editoptions:{"class":"form-control",value:"1",dataInit:function(a){$(a).iCheck().on("change",function(){try{$(this).valid()}catch(b){}})}}},{header:"列表",name:"isList",width:40,align:"center",editable:true,edittype:"checkbox",editoptions:{"class":"form-control",value:"1",dataInit:function(a){$(a).iCheck().on("change",function(){try{$(this).valid()}catch(b){}})}}},{header:"查询",name:"isQuery",width:40,align:"center",editable:true,edittype:"checkbox",editoptions:{"class":"form-control",value:"1",dataInit:function(a){$(a).iCheck().on("change",function(){try{$(this).valid()}catch(b){}})}}},{header:"匹配方式",name:"queryType",width:100,editable:true,edittype:"select",editoptions:{"class":"form-control required","data-msg-required":"请选择匹配方式",items:(config.queryTypeList),itemLabel:"label",itemValue:"value",dataInit:function(a){$(a).select2().on("change",function(){try{$(this).valid()}catch(b){}})}}},{header:"编辑",name:"isEdit",width:40,align:"center",editable:true,edittype:"checkbox",editoptions:{"class":"form-control",value:"1",dataInit:function(a){$(a).iCheck().on("change",function(){try{$(this).valid()}catch(b){}})}}},{header:"必填",name:"isRequired",width:40,align:"center",editable:true,edittype:"checkbox",editoptions:{"class":"form-control",value:"1",dataInit:function(a){$(a).iCheck().on("change",function(){try{$(this).valid()}catch(b){}})}}},{header:"控件类型",name:"showType",width:120,editable:true,edittype:"select",editoptions:{"class":"form-control required","data-msg-required":"请选择控件类型",items:(config.showTypeList),itemLabel:"label",itemValue:"value",dataInit:function(a){$(a).select2().on("change",function(){try{$(this).valid()}catch(b){}})}}},{header:'栅格 ',name:"optionMap['gridRowCol']",width:90,editable:true,edittype:"select",editoptions:{"class":"form-control",items:(config.gridRowColList),itemLabel:"label",itemValue:"value",dataInit:function(a){$(a).select2().on("change",function(){try{$(this).valid()}catch(b){}})}}},{header:'新行',name:"optionMap['isNewLine']",align:"center",width:40,editable:true,edittype:"checkbox",editoptions:{"class":"form-control",value:"1",dataInit:function(a){$(a).iCheck().on("change",function(){try{$(this).valid()}catch(b){}})}}},{header:"字典类型",name:"optionMap['dictType']",width:120,formatter:function(d,b,c,a){b.colModel.data[b.rowId+"_dictName"]=js.val(c,"optionMap.dictName");return b.colModel.data[b.rowId]},unformat:function(c,b,a){return b.colModel.data[b.rowId]+"|"+b.colModel.data[b.rowId+"_dictName"]},editable:true,edittype:"custom",editoptions:{custom_element:function(b,a){return js.template("treeselectTpl",{id:"dict_"+a.id.replace(/[\'\[\]]/g,"_"),title:"字段类型",name:"optionMap['dictType']",value:b.split("|")[0],labelName:"optionMap['dictName']",labelValue:b.split("|")[1],url:ctx+"/sys/dictType/treeData",isReturnValue:"true",cssClass:""})}}},{header:"字段验证",name:"optionMap['fieldValid']",width:170,editable:true,edittype:"select",editoptions:{"class":"form-control",multiple:true,items:(config.fieldValidList),itemLabel:"label",itemValue:"value",dataInit:function(a){$(a).select2().on("change",function(){try{$(this).valid()}catch(b){}})}}}],groupHeaders:{twoLevel:[{startColumnName:"id",numberOfColumns:13,titleText:"字段"},{startColumnName:"isList",numberOfColumns:3,titleText:"列表"},{startColumnName:"isEdit",numberOfColumns:7,titleText:"表单"}]},editGrid:true,editGridInitRowNum:0,editGridInitAllRowEdit:true,editGridAddRowBtn:$("#dataGridAdd"),editGridAddRowInitData:{id:"",status:Global.STATUS_NORMAL},editGridInputFormListName:"columnList",editGridInputFormListAttrs:"id,status,columnName,comments,columnType,attrType,fullAttrName,isPk,isRequired,isInsert,isUpdate,columnSort,isList,isQuery,queryType,isEdit,showType,optionMap['isNewLine'],optionMap['gridRowCol'],optionMap['fieldValid'],optionMap['dictType'],optionMap['dictName']",ajaxSuccess:function(a){$("#dataGrid_columnSort").attr("colspan","2").next().hide()}});$("#dataGrid").tableDnD({onDragClass:"dragClass",dragHandle:"columnSort",onDrop:function(a,b){$(a).find("input.columnSort").each(function(c){$(this).val((c+1)*10)})}});$("#inputForm").validate({ignore:":hidden",submitHandler:function(a){if((op=="step1"||op=="step2")&&$("#tab-1").hasClass("active")){$("#btnSave").removeClass("hide");$('[href="#tab-2"]').click();return false}js.ajaxSubmitForm($(a),function(b){js.showMessage(b.message);if(b.result==Global.TRUE){if($("#genFlag").val()=="0"){location=ctx+"/gen/genTable/form?tableName="+tableName+"&op=step3"}else{js.closeCurrentTabPage(function(c){c.page()})}}},"json")}});$("#tplCategory").change(function(){$(".options").addClass("hide");var a=$(this).val();if(a!=""){$("."+$(this).val()).removeClass("hide")}}).change();