You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

7 lines
7.7 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/*!
* 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('<i class="fa fa-arrows" style="color:#aaa;cursor:move"></i>')}},classes:"columnSort"},{header:"列名",name:"columnName",width:110,frozen:true,formatter:function(d,b,c,a){if(c.status==Global.STATUS_DELETE){return'<span title="已被删除的列,保存后下次将不可见" style="color:red">'+c.columnName+' <i class="fa icon-question"></i></span>'}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:'属性名称 <i class="fa icon-question" title="实体对象的属性字段支持复杂格式:对象名.属性名|属性名2例如用户user.userCode|userName主要用于树选择组件如果子表则写主表实体类名 + 主键例如formEntity.entityId"></i>',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:'栅格 <i class="fa icon-question" title="栅格定义:行/标签/输入框"></i>',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:'<span title="强制新行、换行,强制输出一个&lt;div class=&quot;row&quot;&gt;&lt;/div&gt;">新行</span>',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();