/*! * 版本:1.0 * 创建内容:流程编辑界面操作 * 创建日期:2016年8月26日 * 创建人:liucq * * 修改内容:1、空白 2、编辑页面 3、编辑页获取数据 4、新增只读 5、编辑只读 6、grid * 修改日期:2016年8月31日 * 修改人:liucq */ /* //----------------------------------------------------- 内容:流程编辑界面操作 创建日期:2016年8月26日 //----------------------------------------------------- */ //----------------------------------------------------- // 创建控件 //----------------------------------------------------- //var Control = {}; //Control.create = function (JsonData, divid) { // return create(JsonData, divid); //}; function createdg(JsonData, isEdit) { var htmls = ''; var count = 0; var allcount = 0; var hashr = ''; $.each(JsonData, function (n, item) { var labtype = ''; var name = ''; if (item.labtype == "panel" && item.name == "userpanel") { //用户控件加载 var html = createdg(item.data); $("#userpanel").append(html); } else { if (item.labtype == "panel") { //分组加载 htmls += '
'; htmls += '
'; htmls += '
'; if (item.label != '' && item.label != undefined) { if (item.button == true) { htmls += ' ' + item.label + ' 1'; } else { htmls += '  ' + item.label } } else { htmls += '' + item.label } htmls += '
  '; //添加按钮 if ( item.button == true) { htmls += ''; htmls += '   '; htmls += ' '; htmls += ' '; } htmls += '
'; htmls += '
1)) { // htmls += '
'; //} //当控件3个为一行开始 || item.labtype == 'textarea' //if (((before-1) % 3 == 0 && (before-1) != 0)||(before%3==2&&col==3)||(before%3==0&&col==2)||(before%3==0&&col==3)) { // htmls += '
'; //} //加载各个控件的属性值 $.each(item, function (key, value) { if (value != undefined) { if (typeof (value) == "object") { //if (Object.prototype.toString.call(value).toLowerCase() == "[object object]") { attrhtml += ' ' + key + '=\'' + JSON.stringify(value) + '\' '; //} //else { // if (Object.prototype.toString.call(value).toLowerCase() === '[object array]') { // var newarry = value.join(','); // attrhtml += ' ' + key + '=\'' + newarry + '\' '; // } //} } else { // console.log(key + value + '-' + typeof (value)); attrhtml += ' ' + key + '="' + value + '" '; } } }); if (item.grouptype != undefined) { gptypehtml = "grouptype='" + item.grouptype + "'"; } //if ((before % 3 == 1) || after % 3 == 1) { // htmls += '
'; //} /* #region label操作*/ //必填项加红*支持 if (item.ismust == true) { musthtml = '*'; } if (item.labtype == 'label') { coltem = col * 4; if (!item.addvisible && !item.editvisible && item.addvisible != undefined && item.editvisible != undefined) { htmls += ''; } else { if ((item.addvisible || item.addvisible == undefined) && !isEdit) { htmls += '
'; } if ((item.editvisible || item.editvisible == undefined) && isEdit) { htmls += '
'; } } } else { coltemlable = col * 2; var tooltiphtml="" var toolltipfa = ""; if (item.tooltip != undefined) { tooltiphtml = ' data-toggle="tooltip" data-placement="bottom" title="' + item.tooltip + '"'; toolltipfa = '?'; } if (!item.addvisible && !item.editvisible && item.addvisible != undefined && item.editvisible != undefined && item.labtype != 'hr') { htmls += ' '; } else { //if ((item.colcount + (allcount % 3)) > 3) { // htmls += '
'; //} if (item.labtype == 'textarea') { htmls += '
'; } if ((item.addvisible || item.addvisible == undefined) && !isEdit && item.labtype != 'hr') { htmls += ' '; } if ((item.editvisible || item.editvisible == undefined) && isEdit && item.labtype != 'hr') { htmls += ' '; } } } if (item.labtype == "grid") { htmls = ''; } if (item.labtype == 'hr') { var hrdisplay = ''; if (!item.addvisible && !item.editvisible && item.addvisible != undefined && item.editvisible != undefined) { hrdisplay += 'display:none;'; } else { if ((item.addvisible || item.addvisible == undefined) && !isEdit) { hrdisplay += 'display:block;'; } else { if (!item.addvisible && item.addvisible != undefined && !isEdit) { hrdisplay += 'display:none;'; } } if ((item.editvisible || item.editvisible == undefined) && isEdit) { hrdisplay += 'display:block;'; } } if (item.color == '' || item.color == undefined) { item.color = '#e7eaec'; } ctrlhtml += '
'; } if (item.labtype == "txt") { ctrlhtml = ''; } if (item.labtype == "number") { ctrlhtml = ''; } if (item.labtype == 'date') { ctrlhtml = '
'; ctrlhtml += ' onclick="laydate({ festival: true ,istoday: false,istime: true,start:laydate.now(0, \'YYYY-MM-DD' + starttimehtml + '\') , format: \'YYYY-MM-DD\'' + changeevent + '})" />
'; } if (item.labtype == 'dateHM') { ctrlhtml = '
'; ctrlhtml += ' onclick="laydate({ festival: true ,istoday: false,istime: true,start:laydate.now(0, \'YYYY-MM-DD hh:mm' + starttimehtml + '\') , format: \'YYYY-MM-DD hh:mm\'' + changeevent + '})" />
'; } if (item.labtype == 'clockpicker') { ctrlhtml = '
'; ctrlhtml += ''; ctrlhtml += '
'; } if (item.labtype == 'checkbox') { ctrlhtml = ''; //支持多个多选框 if (item.data != '' && item.data != undefined && item.data != null) { $.each(item.data, function (i, checkboxitem) { ctrlhtml += '