/** * 解析字段通用方法 * @param {any} mainTable 字段表单的数据 * @param {any} mapAttr 字段属性 * @param {any} dataSet 数据返回的结果集 */ function InitAthMapAttrOfCtrlFool(mainTable, mapAttr,dataSet) { var defValue = ""; if (mainTable!=null) defValue = GetPara(mapAttr.Name, mainTable) var eleHtml = ''; //外部数据源类型. if (mapAttr.LGType == "0" && mapAttr.MyDataType == "1" && mapAttr.UIContralType == 1) { if (mapAttr.UIIsEnable == 0) { var ctrl = ""; defValue = ConvertDefVal(mainTable, mapAttr.DefVal, mapAttr.KeyOfEn + "T"); if (defValue == '' || defValue == null) defValue = '无'; ctrl += ""; return ctrl; } return ""; } //外键类型. if (mapAttr.LGType == "2" && mapAttr.MyDataType == "1") { var data = dataSet[mapAttr.UIBindKey]; //枚举类型. if (mapAttr.UIIsEnable == 1) enableAttr = ""; else enableAttr = "disabled='disabled'"; return ""; } //添加文本框 ,日期控件等. //AppString if (mapAttr.MyDataType == "1") { //不是外键 if (mapAttr.UIHeight <= 40) //普通的文本框. return ""; if (mapAttr.AtPara && mapAttr.AtPara.indexOf("@IsRichText=1") >= 0) { var eleHtml = ""; //如果是富文本就使用百度 UEditor if (mapAttr.UIIsEnable == "0") { //只读状态直接 div 展示富文本内容 eleHtml += "
" + defValue + "
"; } else { document.BindEditorMapAttr = mapAttr; //存到全局备用 //设置编辑器的默认样式 var styleText = "text-align:left;font-size:12px;"; styleText += "width:100%;"; styleText += "height:" + mapAttr.UIHeight + "px;"; //注意这里 name 属性是可以用来绑定表单提交时的字段名字的 id 是特殊约定的. eleHtml += ""; } eleHtml = "
" + eleHtml + "
"; return eleHtml } //普通的大块文本. return "