#macro editGrid id="grid" query="" view_model="" uipk="" onSelectRow="" remoteDataSource="false" showImport="false" showExport="false" showSearch="false" entrys="" loadComplete="" rowNum="50" rowList="[50,100,200]" pager="gridPager" hasPager="false" readonly="false" sorterItems="" shrinkToFit="true" datatype="json" multiselect="false" editType="inline" clientFooter="false" sumColModel="[]" serverFooter="false" rownumbers="true" isShowJumpButton="false">
<#if readonly == "true">
<#global grid_readonly="true">
<#else>
<#global grid_readonly="false">
#if>
<#if editType == "inline">
<#assign cellEdit="true">
<#elseif editType == "form">
<#assign cellEdit="false">
#if>
<#if hasPager == "true">
#if>
#macro>
<#--
-->
<#-- grid列属性配置
sensitiveRule 脱敏配置,格式:sensitiveRule="{'isOpen':true|false,'name':''}" name 脱敏规则名称;动态列表配置格式{'sensitiveRule':{'isOpen':true|false,'name':''}}
-->
<#macro gridColumn entryName name label width=150 align="left" frozen="false" hidden="false" key="false" editable="true" formatoptions="" customformatter="" customparam="" formatter="" rowspan="" fieldspan="" required="false" sortKey="" sorttype="" uipk="" ctrl="" sortable="true" thalign="left" sensitiveRule="">
<#if fieldPermEntrysForm(model, name, entryName)>
colNames.push("${label}");
var columnOptions = {name: "${name}",label:"${label}", frozen:${frozen},width: ${width},thalign:"${thalign}", align: "${align}" , hidden: ${hidden}, key:${key},editable:${editable}, sorttype:"${sorttype}"};
if(cellEdit == false){
columnOptions.editable = false;
}
<#if grid_readonly == "false" && editable == "false">
columnOptions.classes = 'disabled';
#if>
<#if sensitiveRule != "">
columnOptions.sensitiveRule = ${sensitiveRule};
#if>
<#if sortable != "">
columnOptions.sortable = ${sortable};
#if>
<#if customformatter != "">
columnOptions.formatter = ${customformatter};
#if>
<#if customparam != "">
columnOptions.customparam = ${customparam};
#if>
<#if formatoptions != "">
columnOptions.formatoptions = ${formatoptions};
#if>
<#if formatter != "">
columnOptions.formatter = "${formatter}";
#if>
<#if rowspan != "">
columnOptions.rowspan = ${rowspan};
#if>
<#if fieldspan != "">
columnOptions.fieldspan = ${fieldspan};
#if>
<#if sortKey != "">
columnOptions.sortKey = ${sortKey};
#if>
<#nested>
colModel.push(columnOptions);
if(columnOptions.formatter == "promptBox"){
if(dataGrid_option.datatype == "json"){
columnModel += columnOptions.name+".*,";
columnOptions.name = columnOptions.name+".*";
}else{
columnModel += columnOptions.name+",";
}
}else{
columnModel += columnOptions.name + ",";
}
#if>
#macro>
<#--
新增表格编辑多语言字段解析,对应grid.wafeditor.js celleditor.shrMultiLangBox
-->
<#macro multiLangBox maxlength="" trimAll="false">
columnOptions.formatter = "shrMultiLangBox";
<#if maxlength != "">
columnOptions.editoptions = {inputJson:{maxlength:${maxlength},trimAll:${trimAll}}};
<#else>
columnOptions.editoptions = {};
#if>
columnOptions.edittype = "shrMultiLangBox";
<#nested>
#macro>
<#--
新增表格编辑多语言字段解析,对应grid.wafeditor.js celleditor.shrMultiLangArea
-->
<#macro multiLangArea maxlength="" trimAll="false">
<#if maxlength != "">
columnOptions.editoptions = {inputJson:{maxlength:${maxlength},trimAll:${trimAll}}};
<#else>
columnOptions.editoptions = {};
#if>
columnOptions.edittype = "shrMultiLangArea";
<#nested>
#macro>
<#macro text maxlength="">
<#if maxlength != "">
columnOptions.editoptions = {inputJson:{maxlength:${maxlength}}};
<#else>
columnOptions.editoptions = {};
#if>
columnOptions.edittype = "shrtext";
<#nested>
#macro>
<#macro checkbox>
columnOptions.formatter = "checkbox";
columnOptions.edittype = "checkbox";
columnOptions.editoptions = {};
<#nested>
#macro>
<#--
decimalPrecision:视图配置数值小数位,此配置优先
ignoreDecimalFormatter:忽略数值格式化,显示数据库原始值
roundType:四舍五入方式
-->
<#macro numberField decimalPrecision="" formatType="number" ignoreDecimalFormatter="false" roundType="round">
columnOptions.formatter = "numberfield";
columnOptions.edittype = "numberfield";
columnOptions.editoptions = {inputJson:{id:"txt_"+columnOptions.name,name:columnOptions.name,decimalPrecision:${decimalPrecision},formatType:"${formatType}",ignoreDecimalFormatter:${ignoreDecimalFormatter},roundType:"${roundType}"}};
<#nested>
#macro>
<#macro textarea maxlength="">
columnOptions.formatter = "shrTextArea";
columnOptions.edittype = "shrTextArea";
<#if maxlength != "">
columnOptions.editoptions = {inputJson:{maxlength:${maxlength}}};
<#else>
columnOptions.editoptions = {};
#if>
<#nested>
#macro>
<#macro select enumSource="">
columnOptions.formatter = "shrselect";
columnOptions.edittype = "shrselect";
columnOptions.editoptions = {selectJson:{id:"selStatus",name:"status",enumSource:"${enumSource}"},enumSource:{},urlSource:shr.getContextPath() + "/selectEnum.do?method=getSelectEnumData&enumSource=${enumSource}"};
<#nested>
#macro>
<#macro datePicker dateFormat="">
columnOptions.formatter = "datepicker";
columnOptions.edittype = "shrdatepicker";
columnOptions.editoptions = {datepickerjson:{id:"dp_autoSize",name:"dp_autoSize",dateFormat:"${dateFormat}"}};
columnOptions.editoptions.validateJson = {errMsg:"dateISO:'${freemarkerMultLan.msg070!"freemarkerMultLan.msg070"}'",rules:"dateISO:true",validatetrigger:"focus keyup datachange"};
<#nested>
#macro>
<#--
showTimeZoneForCtrl: bos提供参数showTimeZoneForCtrl,如果为false,则不转换;不支持视图配置。
isAutoTimeZoneTrans: 视图配置优先,视图配置为false则不转换;视图未配置,元数据字段扩展属性isAutoTimeZoneTrans配置为false则不转换;其他情况需要转换。
isShowUTC:时区是否显示isShowUTC
isReadonlyUTC:时区是否可编辑isReadonlyUTC
isRemoveSeconds: true,//配置是否去除时间格式化中的秒
isRemoveDay: false,//配置是否去除日期格式化中的天
ctrlType:格式化类型 TimeStamp/Date/Time,配合utcUser中pattern使用
-->
<#macro dateTimePicker dateTimeFormat="yyyy-MM-dd HH:mm" minuteStep ="" showTimeZoneForCtrl="true" isAutoTimeZoneTrans="true" isShowUTC="true" isReadonlyUTC="true" isRemoveSeconds="true" isRemoveDay="false" ctrlType="">
<#if ctrlType == "TimeStamp">
columnOptions.width = 255;
#if>
columnOptions.formatter = 'shrDateTimePicker';
columnOptions.edittype = 'shrDateTimePicker';
columnOptions.editoptions = {datepickerjson:{id:"dp_autoSize",name:"dp_autoSize",minuteStep:"${minuteStep}",showTimeZoneForCtrl:${showTimeZoneForCtrl},isAutoTimeZoneTrans:${isAutoTimeZoneTrans},isShowUTC:${isShowUTC},isReadonlyUTC:${isReadonlyUTC},isRemoveSeconds:${isRemoveSeconds},isRemoveDay:${isRemoveDay},ctrlType:"${ctrlType}"}};
<#nested>
#macro>
<#--
--集团管控新增参数说明 2017/07/11 tiangang_yang
-- isHRBaseItem 判断是否是s-HR集团管控基础资料,是:true,不是:false,必须写的参数
-- filterConfig 过滤配置框 可选
-- bizFilterFields 业务单据需要过滤的字段属性名称,如:hrOrgUnit,name。多个用逗号隔开 ,可选,不传默认业务组织:hrOrgUnit
-- f7ReKeyValue 获取F7界面存放key和name的字段,以键值对字符串形式传入,如果不传入,其他类型的F7不变,基础资料默认:BaseInfo.id:BaseInfo.name,可选
-- isTree ="false" F7是左树右表,取数逻辑公共
-- treeUrl = "" F7是左树右表,取数逻辑根据url来取
-- isEnableExpFilter="" F7默认不启用过滤表达式过滤 add by tiangang_yang on 2021/03/09
--pgSizes="true" ,为false就隐藏表格的分页控件 add by jacky_xiang on 2021/09/08
--dataShowMode="layout" ,f7的打开方式,默认为layout即弹出方式,还可配置为下拉方式。 add by jacky_xiang on 2021/11/09
-->
<#macro promptBox query="" uipk="" filter="" class="" readonly="" multiselect="false" isTree ="false" treeUrl = "" searchFields="" isHRBaseItem = "false" bizFilterFields = "" f7ReKeyValue = "" filterConfig="" afterOnchangeClearFields="" displayFormat="" isHROrg="false" isAdminOrg="false" isContainLowerOrg="false" searchLikePattern="any" isEnableExpFilter="" pgSizes="true" dataShowMode="layout">
columnOptions.formatter = "promptBox";
columnOptions.edittype = "promptBox";
var f7Json = {subWidgetName:"shrPromptGrid",searchFields:"${searchFields}"};
f7Json.subWidgetOptions = {title:columnOptions.label,uipk:"${uipk}",query:"${query}",filter:"${filter}",multiselect:${multiselect},isTree:${isTree},treeUrl:"${treeUrl}",isContainLowerOrg:${isContainLowerOrg},isAdminOrg:${isAdminOrg},pgSizes:${pgSizes},f7SearchConfig:${getF7SearchConfig(uipk,displayFormat)},dataShowMode:"${dataShowMode}"};
<#if afterOnchangeClearFields != "">
f7Json.afterOnchangeClearFields = "${afterOnchangeClearFields}";
#if>
<#if displayFormat != "">
f7Json.displayFormat = '{${displayFormat}}';
#if>
<#if isHROrg != "">
f7Json.isHROrg = ${isHROrg};
#if>
<#if isAdminOrg != "">
f7Json.isAdminOrg = ${isAdminOrg};
#if>
<#if searchLikePattern != "">
f7Json.searchLikePattern = "${searchLikePattern}";
#if>
<#if isEnableExpFilter != "">
f7Json.subWidgetOptions.isEnableExpFilter = ${isEnableExpFilter};
#if>
<#if isHRBaseItem == "true">
f7Json.subWidgetOptions.isHRBaseItem = ${isHRBaseItem};
<#if filterConfig == "">
f7Json.subWidgetOptions.filterConfig = [{name:'isComUse',value:true,alias:'${freemarkerMultLan.msg065!"freemarkerMultLan.msg065"}',widgetType:'checkbox'}];
<#else>
f7Json.subWidgetOptions.filterConfig = ${filterConfig};
#if>
<#if bizFilterFields == "">
f7Json.subWidgetOptions.bizFilterFields = "hrOrgUnit";
<#else>
f7Json.subWidgetOptions.bizFilterFields = "${bizFilterFields}";
#if>
<#if f7ReKeyValue == "">
f7Json.subWidgetOptions.f7ReKeyValue = "BaseInfo.id:BaseInfo.name";
<#else>
f7Json.subWidgetOptions.f7ReKeyValue = "${f7ReKeyValue}";
#if>
f7Json.subWidgetName = 'specialPromptGrid';
#if>
columnOptions.editoptions = {f7Json:f7Json};
<#--columnOptions.editoptions.f7Json.subWidgetOptions = {title:columnOptions.label,uipk:"${uipk}",query:"${query}",filter:"${filter}"};-->
<#nested>
#macro>
<#macro linkButton id="" onclick="" tagClass="" caption="">
if(columnOptions.formatoptions == null){
columnOptions.formatoptions = [];
}
columnOptions.formatter = "operations";
columnOptions.formatoptions.push({linkJson:{caption:"${caption}",id:"${id}",onclick:"${onclick}",tagClass:"${tagClass}"},onclick:"${onclick}",visible:true});
<#nested>
#macro>
<#macro validator rules="" errMsg="" validatetrigger="focus keyup datachange">
<#if grid_readonly == "false">
var validateJson = columnOptions.editoptions.validateJson;
if(validateJson == null){
columnOptions.editoptions.validateJson = {errMsg:"${errMsg}",rules:"${rules}",validatetrigger:"${validatetrigger}"};
}else{
columnOptions.editoptions.validateJson = {errMsg:validateJson.errMsg+",${errMsg}",rules:validateJson.rules+",${rules}",validatetrigger:"${validatetrigger}"};
}
if(columnOptions.editoptions.validateJson.rules.indexOf('required:true') >= 0 && columnOptions.editable && cellEdit){
columnOptions.classes = 'required';
}
#if>
#macro>
<#--
rowNum:分录分页显示页数
rowList:分录分页选项,确定每页数据条数
-->
<#macro editGridContainer gridId readonly="" entryName="entrys" hasPager="false" shrinkToFit="true" remoteDataSource="false" showImport="false" showExport="false" showSearch="false" editType="inline" rownumbers="true" rowNum="50" rowList="[50,100,200]" isShowJumpButton="false">
<@ctrl.row>
<@ctrl.cell colSpan=12>
<@e.editGridToolbar gridId="${gridId}" showImport="${showImport}" showExport="${showExport}" hasPager="${hasPager}" showSearch="{showSearch}" readonly="${readonly}" />
<@e.editGrid id="${gridId}" entrys="${collectionFormater(model, entryName,remoteDataSource)}" hasPager="${hasPager}" remoteDataSource="${remoteDataSource}" readonly="${readonly}" shrinkToFit="${shrinkToFit}" editType="${editType}" rownumbers="${rownumbers}" rowNum="${rowNum}" rowList="${rowList}" isShowJumpButton="${isShowJumpButton}">
<#nested>
@e.editGrid>
@ctrl.cell>
<#-- 占位 -->
<@ctrl.cell colSpan=1 />
@ctrl.row>
#macro>
<#macro editGridToolbar gridId readonly="" showImport="false" showExport="false" hasPager="false" showSearch="false">
<#if readonly != "true">
#if>
#macro>