/*!
|
* 版本: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 += '<div class="row" name="row' + item.name + '0" label="' + item.label + '" item="' + item.name + '" control="panel" button="' + item.button + '" data=\'' + JSON.stringify(item.data) + '\'><div class="col-sm-12">';
|
htmls += ' <div class="ibox float-e-margins">';
|
htmls += ' <div class="ibox-title"><h5>';
|
if (item.label != '' && item.label != undefined) {
|
if (item.button == true) {
|
htmls += '<i class="fa fa-list"></i> ' + item.label + ' <span style=\'color:#63B8FF\'>1</span>';
|
}
|
else {
|
htmls += ' <i class="fa fa-list"></i> ' + item.label
|
}
|
}
|
else {
|
htmls += '' + item.label
|
}
|
htmls += '</h5><div class="ibox-tools" > <a class="collapse-link" onclick="collapseBox(this);"><i class="fa fa-chevron-up" title="折叠/展开明细"></i></a> ';
|
//添加按钮
|
if ( item.button == true) {
|
htmls += '<a class="collapse-link bootstro" data-bootstro-placement="left" data-bootstro-content="明细数据操作:<span style=\'color:blue\'> [ + ]</span>增加一条明细数据;<span style=\'color:Red\'>[ - ]</span>删除此条明细;" >';
|
htmls += ' <i class="fa fa-plus-square" style="color:#2b4490" title="新增明细" item="' + item.name + '0" onclick="addpanel(this,true); "></i> ';
|
htmls += ' <i class="fa fa-minus-square" style="color:red" title="删除明细" onclick="deldoc(\'' + item.name + '0\');"></i>';
|
htmls += ' </a>';
|
}
|
htmls += ' </div></div>';
|
htmls += ' <div id="div_content" class="ibox-content"><div class="row" ';
|
|
$.each(item, function (key, value) {
|
if (key == "name") {
|
htmls += ' key="' + value + '" ';
|
if (item.button == true && item.button != undefined) {
|
htmls += ' ' + key + '="' + value + '0" ';
|
}
|
else {
|
htmls += ' ' + key + '="' + value + '" ';
|
}
|
}
|
else {
|
htmls += ' ' + key + '="' + value + '" ';
|
}
|
if (typeof (value) == "object") {
|
htmls += ' ' + key + '=\'' + JSON.stringify(value) + '\' ';
|
}
|
});
|
htmls += '>';
|
htmls += createdg(item.data, isEdit);
|
|
htmls += ' </div></div>';
|
|
htmls += ' </div>';
|
htmls += ' </div>';
|
}
|
else {
|
//重写
|
if (n == 0) { allcount = 0; }
|
if ((!item.addvisible && !item.editvisible && item.addvisible != undefined && item.editvisible != undefined)||(item.labtype=='hr')) {
|
|
}
|
else {
|
//添加状态时,修改状态未写
|
allcount++;
|
}
|
|
var ctrlhtml = '';
|
var musthtml = '';
|
var gptypehtml = "";
|
var attrhtml = '';
|
var col = 0;
|
var coltem = 0;
|
var coltemlable = 0;
|
var before = 0;
|
var after = 0;
|
before = allcount;
|
if (item.labtype == 'hr') { //item.labtype == 'textarea' ||
|
item.colcount = 3;
|
}
|
if (item.colcount != undefined) {
|
col = item.colcount;
|
}
|
else {
|
col = 1;
|
}
|
//if (item.labtype == 'hr') { col = 0;}
|
allcount += col - 1;
|
after = allcount;
|
//if (((allcount) % 3 == 0 && allcount != 0&&col>1)) {
|
// htmls += '</div>';
|
//}
|
//当控件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 += '</div>';
|
//}
|
//加载各个控件的属性值
|
$.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 += '<div class="clearfix layer-area" style="margin: 5px" ' + gptypehtml + ' >';
|
//}
|
/* #region label操作*/
|
//必填项加红*支持
|
if (item.ismust == true) {
|
musthtml = '<i class="red">*</i>';
|
}
|
|
if (item.labtype == 'label') {
|
|
coltem = col * 4;
|
if (!item.addvisible && !item.editvisible && item.addvisible != undefined && item.editvisible != undefined) {
|
htmls += '<label ' + gptypehtml + ' class="control-label" style="display:none;">' + item.label + '</label>';
|
}
|
else {
|
if ((item.addvisible || item.addvisible == undefined) && !isEdit) {
|
htmls += '<div ' + gptypehtml + ' class="col-sm-' + coltem + ' col-md-' + coltem + '"><label class="control-label" >' + item.label + '</label></div>';
|
}
|
if ((item.editvisible || item.editvisible == undefined) && isEdit) {
|
htmls += '<div ' + gptypehtml + ' class="col-sm-' + coltem + ' col-md-' + coltem + '"><label class="control-label">' + item.label + '</label></div>';
|
}
|
}
|
}
|
else {
|
coltemlable = col * 2;
|
var tooltiphtml=""
|
var toolltipfa = "";
|
if (item.tooltip != undefined)
|
{
|
tooltiphtml = ' data-toggle="tooltip" data-placement="bottom" title="' + item.tooltip + '"';
|
toolltipfa = '<span style="color:blue">?</span>';
|
}
|
|
|
|
if (!item.addvisible && !item.editvisible && item.addvisible != undefined && item.editvisible != undefined && item.labtype != 'hr') {
|
htmls += '<label ' + gptypehtml + ' class="col-sm-' + coltemlable + ' col-md-' + coltemlable + ' control-label" ' + tooltiphtml + ' style="display:none;">' + item.label + toolltipfa + musthtml + '</label> ';
|
}
|
else {
|
//if ((item.colcount + (allcount % 3)) > 3) {
|
// htmls += '<div class="clearfix layer-area" style="margin: 5px" ' + gptypehtml + ' >';
|
//}
|
if (item.labtype == 'textarea') {
|
htmls += '<div class="clearfix"></div>';
|
}
|
if ((item.addvisible || item.addvisible == undefined) && !isEdit && item.labtype != 'hr') {
|
htmls += '<label ' + gptypehtml + ' class="text-right col-sm-' + coltemlable + ' col-md-' + coltemlable + ' control-label" ' + tooltiphtml + ' style="padding-right:0px;">' + item.label + toolltipfa + musthtml + '</label> ';
|
}
|
if ((item.editvisible || item.editvisible == undefined) && isEdit && item.labtype != 'hr') {
|
htmls += '<label ' + gptypehtml + ' class="text-right col-sm-' + coltemlable + ' col-md-' + coltemlable + ' control-label" ' + tooltiphtml + ' style="padding-right:0px;">' + item.label + toolltipfa + musthtml + '</label> ';
|
}
|
|
}
|
}
|
if (item.labtype == "grid") {
|
htmls = '<table class="col-sm-12 col-md-12" col=\'' + JSON.stringify(item.dataCol) + '\' style=" width:100% ;height:100%';
|
if (item.addvisible != undefined) {
|
if (item.addvisible) {
|
htmls += ' display:block;"';
|
}
|
else {
|
htmls += ' display:none;"';
|
}
|
htmls += ' addvisible=' + item.addvisible;
|
}
|
else {
|
htmls += '"';
|
}
|
htmls += attrhtml;
|
htmls += '></table>';
|
}
|
|
if (item.labtype == "null") {
|
coltem = col * 4;
|
htmls += '<div class="form-group col-sm-' + coltem + ' col-md-' + coltem + '" ' + attrhtml + '></div>';
|
|
}
|
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 += '<div style="border-top: 1px dashed ' + item.color + ';color: #fff;background-color: #fff;height: 1px;margin: 20px 0;' + hrdisplay + '" ' + attrhtml + '></div>';
|
|
}
|
if (item.labtype == "txt") {
|
ctrlhtml = '<input type="text" class="form-control"';
|
if (item.maxlength != undefined) {
|
ctrlhtml += ' maxlength="' + item.maxlength + '" ';
|
}
|
|
//新增时不可编辑
|
if (item.disabled != undefined && item.disabled) {
|
ctrlhtml += ' disabled="" ';
|
}
|
if (!item.addvisible && !item.editvisible && item.addvisible != undefined && item.editvisible != undefined) {
|
ctrlhtml += ' style="display:none;" ';
|
}
|
else {
|
if ((item.addvisible || item.addvisible == undefined) && !isEdit) {
|
ctrlhtml += ' style="display:block;" ';
|
}
|
else {
|
if (!item.addvisible && item.addvisible != undefined && !isEdit) {
|
ctrlhtml += ' style="display:none;" ';
|
}
|
}
|
if ((item.editvisible || item.editvisible == undefined) && isEdit) {
|
ctrlhtml += ' style="display:block;" ';
|
}
|
}
|
if (item.capital != undefined) {
|
ctrlhtml += ' capital="' + item.capital + '" oninput="OnInput(\'' + item.name + '\',\'' + item.capital + '\')" onpropertychange="OnPropChanged(\'' + item.name + '\',\'' + item.capital + '\')"';
|
}
|
if (item.total != undefined) {
|
ctrlhtml += ' total="' + item.total + '" oninput="OnInputTotal(\'' + item.name + '\',\'' + item.total + '\')" onpropertychange="OnPropChangedTotal(\'' + item.name + '\',\'' + item.total + '\')"';
|
|
}
|
if (item.defultvalue != undefined) {
|
ctrlhtml += ' value="' + item.defultvalue + '" ';
|
}
|
|
ctrlhtml += attrhtml + '/>';
|
}
|
if (item.labtype == "number") {
|
ctrlhtml = '<input type="number" class="form-control"';
|
if (item.maxlength != undefined) {
|
ctrlhtml += ' maxlength="' + item.maxlength + '" ';
|
}
|
//新增时不可编辑
|
if (item.disabled != undefined && item.disabled) {
|
ctrlhtml += ' disabled="" ';
|
}
|
if (!item.addvisible && !item.editvisible && item.addvisible != undefined && item.editvisible != undefined) {
|
ctrlhtml += ' style="display:none;" ';
|
}
|
else {
|
if ((item.addvisible || item.addvisible == undefined) && !isEdit) {
|
ctrlhtml += ' style="display:block;" ';
|
}
|
else {
|
if (!item.addvisible && item.addvisible != undefined && !isEdit) {
|
ctrlhtml += ' style="display:none;" ';
|
}
|
}
|
if ((item.editvisible || item.editvisible == undefined) && isEdit) {
|
ctrlhtml += ' style="display:block;" ';
|
}
|
}
|
if (item.capital != undefined) {
|
ctrlhtml += ' capital="' + item.capital + '" oninput="OnInput(\'' + item.name + '\',\'' + item.capital + '\')" onpropertychange="OnPropChanged(\'' + item.name + '\',\'' + item.capital + '\')"';
|
}
|
if (item.total != undefined) {
|
ctrlhtml += ' total="' + item.total + '" oninput="OnInputTotal(\'' + item.name + '\',\'' + item.total + '\')" onpropertychange="OnPropChangedTotal(\'' + item.name + '\',\'' + item.total + '\')"';
|
|
}
|
if (item.defultvalue != undefined) {
|
ctrlhtml += ' value="' + item.defultvalue + '" ';
|
}
|
|
ctrlhtml += attrhtml + '/>';
|
}
|
if (item.labtype == 'date') {
|
ctrlhtml = '<div class="input-group date"> <span class="input-group-addon"><i class="fa fa-calendar"></i></span> <input class="layer-date form-control timebg" ';
|
//新增时不可编辑
|
//if (item.disabled != null && item.disabled != '' && item.disabled != undefined && item.disabled) {
|
// ctrlhtml += ' disabled="disabled" ';
|
//}
|
//else
|
//{
|
// //否则只读
|
ctrlhtml += ' readonly="readonly"';
|
//}
|
if (!item.addvisible && !item.editvisible && item.addvisible != undefined && item.editvisible != undefined) {
|
ctrlhtml += ' style="display:none;" ';
|
}
|
else {
|
if ((item.addvisible || item.addvisible == undefined) && !isEdit) {
|
ctrlhtml += ' style="display:block;" ';
|
}
|
else {
|
if (!item.addvisible && item.addvisible != undefined && !isEdit) {
|
ctrlhtml += ' style="display:none;" ';
|
}
|
}
|
if ((item.editvisible || item.editvisible == undefined) && isEdit) {
|
ctrlhtml += ' style="display:block;" ';
|
}
|
}
|
if (item.defultvalue != undefined) {
|
ctrlhtml += ' value="' + item.defultvalue + '" ';
|
}
|
ctrlhtml += attrhtml;
|
var changeevent = "";
|
if (item.choose != undefined) {
|
changeevent = ",choose:" + item.choose;
|
}
|
var starttimehtml = "";
|
//var starttimehtml = "hh:mm:ss";
|
// starttimehtml = "09:00:00";
|
// starttimehtml = "18:00:00";
|
if (item.starttime != undefined) {
|
starttimehtml = item.starttime;
|
}
|
|
// ctrlhtml += ' onclick="laydate({istime: true, format: \'YYYY-MM-DD hh:mm:ss\'' + changeevent + '})" />';
|
ctrlhtml += ' onclick="laydate({ festival: true ,istoday: false,istime: true,start:laydate.now(0, \'YYYY-MM-DD' + starttimehtml + '\') , format: \'YYYY-MM-DD\'' + changeevent + '})" /> </div>';
|
}
|
if (item.labtype == 'dateHM') {
|
ctrlhtml = '<div class="input-group date"> <span class="input-group-addon"><i class="fa fa-calendar"></i></span> <input class="layer-date form-control timebg" ';
|
//新增时不可编辑
|
//if (item.disabled != null && item.disabled != '' && item.disabled != undefined && item.disabled) {
|
// ctrlhtml += ' disabled="disabled" ';
|
//}
|
//else
|
//{
|
// //否则只读
|
ctrlhtml += ' readonly="readonly"';
|
//}
|
if (!item.addvisible && !item.editvisible && item.addvisible != undefined && item.editvisible != undefined) {
|
ctrlhtml += ' style="display:none;" ';
|
}
|
else {
|
if ((item.addvisible || item.addvisible == undefined) && !isEdit) {
|
ctrlhtml += ' style="display:block;" ';
|
}
|
else {
|
if (!item.addvisible && item.addvisible != undefined && !isEdit) {
|
ctrlhtml += ' style="display:none;" ';
|
}
|
}
|
if ((item.editvisible || item.editvisible == undefined) && isEdit) {
|
ctrlhtml += ' style="display:block;" ';
|
}
|
}
|
if (item.defultvalue != undefined) {
|
ctrlhtml += ' value="' + item.defultvalue + '" ';
|
}
|
ctrlhtml += attrhtml;
|
var changeevent = "";
|
if (item.choose != undefined) {
|
changeevent = ",choose:" + item.choose;
|
}
|
var starttimehtml = "";
|
//var starttimehtml = "hh:mm:ss";
|
// starttimehtml = "09:00:00";
|
// starttimehtml = "18:00:00";
|
if (item.starttime != undefined) {
|
starttimehtml = item.starttime;
|
}
|
|
// ctrlhtml += ' onclick="laydate({istime: true, format: \'YYYY-MM-DD hh:mm:ss\'' + changeevent + '})" />';
|
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 + '})" /> </div>';
|
}
|
if (item.labtype == 'clockpicker')
|
{
|
ctrlhtml = '<div class="input-group clockpicker" data-autoclose="true"> <input type="text" class="form-control timebg" ';
|
|
ctrlhtml += ' readonly="readonly"';
|
if (item.defultvalue != undefined) {
|
ctrlhtml += ' value="' + item.defultvalue + '" ';
|
}
|
ctrlhtml += attrhtml + '/>';
|
ctrlhtml += '<span class="input-group-addon"><span class="fa fa-clock-o"></span></span>';
|
ctrlhtml += '</div>';
|
}
|
if (item.labtype == 'checkbox') {
|
ctrlhtml = '';
|
//支持多个多选框
|
if (item.data != '' && item.data != undefined && item.data != null) {
|
$.each(item.data, function (i, checkboxitem) {
|
ctrlhtml += '<label class="checkbox-inline i-checks"><input type="checkbox" value="' + checkboxitem.value + '"';
|
ctrlhtml += attrhtml;
|
//新增时不可编辑
|
if (item.disabled != null && item.disabled != '' && item.disabled != undefined && item.disabled) {
|
ctrlhtml += ' disabled="" ';
|
}
|
if (!item.addvisible && !item.editvisible && item.addvisible != undefined && item.editvisible != undefined) {
|
ctrlhtml += ' style="display:none;" ';
|
}
|
else {
|
if ((item.addvisible || item.addvisible == undefined) && !isEdit) {
|
ctrlhtml += ' style="display:block;" ';
|
}
|
else {
|
if (!item.addvisible && item.addvisible != undefined && !isEdit) {
|
ctrlhtml += ' style="display:none;" ';
|
}
|
}
|
if ((item.editvisible || item.editvisible == undefined) && isEdit) {
|
ctrlhtml += ' style="display:block;" ';
|
}
|
}
|
ctrlhtml += '><i></i>' + checkboxitem.text + '</label>';
|
|
});
|
}
|
else {
|
ctrlhtml = '<label class="checkbox-inline i-checks"><input type="checkbox" value=""';
|
|
//新增时不可编辑
|
if (item.disabled != null && item.disabled != '' && item.disabled != undefined && item.disabled) {
|
ctrlhtml += ' disabled="" ';
|
}
|
ctrlhtml += attrhtml;
|
//新增时不可编辑
|
if (item.disabled != null && item.disabled != '' && item.disabled != undefined && item.disabled) {
|
ctrlhtml += ' disabled="" ';
|
}
|
if (!item.addvisible && !item.editvisible && item.addvisible != undefined && item.editvisible != undefined) {
|
ctrlhtml += ' style="display:none;" ';
|
}
|
else {
|
if ((item.addvisible || item.addvisible == undefined) && !isEdit) {
|
ctrlhtml += ' style="display:block;" ';
|
}
|
else {
|
if (!item.addvisible && item.addvisible != undefined && !isEdit) {
|
ctrlhtml += ' style="display:none;" ';
|
}
|
}
|
if ((item.editvisible || item.editvisible == undefined) && isEdit) {
|
ctrlhtml += ' style="display:block;" ';
|
}
|
}
|
ctrlhtml += '><i></i></label>';
|
}
|
}
|
|
if (item.labtype == 'upload') {
|
ctrlhtml += '<div class="input-group"';
|
if (!item.addvisible && !item.editvisible && item.addvisible != undefined && item.editvisible != undefined) {
|
ctrlhtml += ' style="display:none;" ';
|
}
|
else {
|
if ((item.addvisible || item.addvisible == undefined) && !isEdit) {
|
ctrlhtml += '';
|
}
|
else {
|
if (!item.addvisible && item.addvisible != undefined && !isEdit) {
|
ctrlhtml += ' style="display:none;" ';
|
}
|
}
|
if ((item.editvisible || item.editvisible == undefined) && isEdit) {
|
ctrlhtml += '';
|
}
|
}
|
ctrlhtml += attrhtml;
|
ctrlhtml += '></div>';
|
}
|
if (item.labtype == 'combox') {
|
var showcohtm = "";
|
if (item.iscanadd != undefined && item.iscanadd)
|
{
|
showcohtm = "或录入";
|
}
|
ctrlhtml = '<select data-placeholder="选择' + showcohtm + item.label + '..."'
|
if (item.iscanadd != undefined && item.iscanadd) {
|
ctrlhtml += ' class="chosen-container chosen-container-single"'
|
}
|
else {
|
ctrlhtml += ' class="chosen-select form-control"'
|
}
|
ctrlhtml += 'tabindex="2" style="width:100%;';
|
if (!item.addvisible && !item.editvisible && item.addvisible != undefined && item.editvisible != undefined) {
|
ctrlhtml += ' display:none;" ';
|
}
|
else {
|
if ((item.addvisible || item.addvisible == undefined) && !isEdit) {
|
ctrlhtml += '"';
|
}
|
else {
|
if (!item.addvisible && item.addvisible != undefined && !isEdit) {
|
ctrlhtml += ' display:none;" ';
|
}
|
}
|
if ((item.editvisible || item.editvisible == undefined) && isEdit) {
|
ctrlhtml += '"';
|
}
|
}
|
|
//新增时不可编辑
|
if (item.disabled != undefined && item.disabled) {
|
ctrlhtml += ' disabled="" ';
|
}
|
ctrlhtml += attrhtml;
|
|
ctrlhtml += '><option value="" hassubinfo="true" >选择' + showcohtm + item.label + '...</option>';
|
//对有数据的下拉框支持
|
$.each(item.data, function (n, selectitem) {
|
ctrlhtml += '<option value="' + selectitem.code + '" hassubinfo="true">' + selectitem.label + '</option>';
|
});
|
//支持ajax的下拉框数据【未做】
|
ctrlhtml += '</select>';
|
}
|
//密码支持
|
if (item.labtype == 'password') {
|
ctrlhtml += '<input name="' + item.name + '" type="password" labtype="' + item.labtype + '" placeholder="请输入' + item.label + '" class="form-control"';
|
if (!item.addvisible && !item.editvisible && item.addvisible != undefined && item.editvisible != undefined) {
|
ctrlhtml += ' style="display:none;" ';
|
}
|
else {
|
if ((item.addvisible || item.addvisible == undefined) && !isEdit) {
|
ctrlhtml += ' style="display:block;" ';
|
}
|
else {
|
if (!item.addvisible && item.addvisible != undefined && !isEdit) {
|
ctrlhtml += ' style="display:none;" ';
|
}
|
}
|
if ((item.editvisible || item.editvisible == undefined) && isEdit) {
|
ctrlhtml += ' style="display:block;" ';
|
}
|
}
|
//新增时不可编辑
|
if (item.disabled != undefined && item.disabled) {
|
ctrlhtml += ' readonly="readonly" ';
|
}
|
if (item.defultvalue != undefined) {
|
ctrlhtml += ' value="' + item.defultvalue + '" ';
|
}
|
ctrlhtml += attrhtml;
|
ctrlhtml += '/>';
|
}
|
|
if (item.labtype == 'email') {
|
ctrlhtml += '<input type="email" placeholder="' + item.label + '" class="form-control"';
|
if (!item.addvisible && !item.editvisible && item.addvisible != undefined && item.editvisible != undefined) {
|
ctrlhtml += ' style="display:none;" ';
|
}
|
else {
|
if ((item.addvisible || item.addvisible == undefined) && !isEdit) {
|
ctrlhtml += ' style="display:block;" ';
|
}
|
else {
|
if (!item.addvisible && item.addvisible != undefined && !isEdit) {
|
ctrlhtml += ' style="display:none;" ';
|
}
|
}
|
if ((item.editvisible || item.editvisible == undefined) && isEdit) {
|
ctrlhtml += ' style="display:block;" ';
|
}
|
}
|
//新增时不可编辑
|
if (item.disabled != undefined && item.disabled) {
|
ctrlhtml += ' readonly="readonly" ';
|
}
|
if (item.defultvalue != undefined)
|
ctrlhtml += attrhtml;
|
ctrlhtml += '/>';
|
}
|
/* #endregion*/
|
|
/* #region textarea支持*/
|
if (item.labtype == 'textarea') {
|
ctrlhtml += '<textarea type="textarea" class="form-control"';
|
|
if (item.maxlength != undefined)
|
{
|
ctrlhtml += ' maxlength="' + item.maxlength + '" ';
|
}
|
|
if (!item.addvisible && !item.editvisible && item.addvisible != undefined && item.editvisible != undefined) {
|
ctrlhtml += ' style="display:none;" ';
|
}
|
else {
|
if ((item.addvisible || item.addvisible == undefined) && !isEdit) {
|
ctrlhtml += ' style="display:block;" ';
|
}
|
else {
|
if (!item.addvisible && item.addvisible != undefined && !isEdit) {
|
ctrlhtml += ' style="display:none;" ';
|
}
|
}
|
if ((item.editvisible || item.editvisible == undefined) && isEdit) {
|
ctrlhtml += ' style="display:block;" ';
|
}
|
}
|
//新增时不可编辑
|
if (item.disabled != null && item.disabled != '' && item.disabled != undefined && item.disabled) {
|
ctrlhtml += ' readonly="readonly" ';
|
}
|
if (item.defultvalue != undefined) {
|
ctrlhtml += ' value="' + item.defultvalue + '"';
|
}
|
ctrlhtml += attrhtml;
|
ctrlhtml += '></textarea>';
|
}
|
/* #endregion*/
|
|
/* #region radio支持*/
|
if (item.labtype == 'radio') {
|
if (item.data != null && item.data != undefined && item.data != '') {
|
var rdindex = 0;
|
$.each(item.data, function (i, radioitem) {
|
ctrlhtml += '<label class="checkbox-inline i-checks"><input type="radio" value="' + radioitem.value + '"';
|
if (rdindex == 0)
|
{
|
ctrlhtml += ' checked ';
|
}
|
//新增时不可编辑
|
if (item.disabled != null && item.disabled != '' && item.disabled != undefined && item.disabled) {
|
ctrlhtml += ' disabled="" ';
|
}
|
ctrlhtml += attrhtml;
|
ctrlhtml += '> <i></i> ' + radioitem.text + '</label>';
|
rdindex++;
|
});
|
}
|
else {
|
ctrlhtml += '<label class="checkbox-inline i-checks"><input type="radio" value="' + item.name + '"';
|
|
//新增时不可编辑
|
if (item.disabled != null && item.disabled != '' && item.disabled != undefined && item.disabled) {
|
ctrlhtml += ' disabled="" ';
|
}
|
ctrlhtml += '> <i></i> ' + item.label + '</label>';
|
}
|
}
|
/* #endregion*/
|
|
/* #region explain支持*/
|
if (item.labtype == 'explain') {
|
ctrlhtml += '<div class="alert alert-success"';
|
ctrlhtml += attrhtml;
|
ctrlhtml += '>' + item.label + '</div>';
|
}
|
/* #endregion*/
|
|
/* #region itxt支持*/
|
if (item.labtype == 'itxt') {
|
ctrlhtml += '<div class="input-group"';
|
if (!item.addvisible && !item.editvisible && item.addvisible != undefined && item.editvisible != undefined) {
|
ctrlhtml += ' style="display:none;" ';
|
}
|
else {
|
if ((item.addvisible || item.addvisible == undefined) && !isEdit) {
|
ctrlhtml += '';
|
}
|
else {
|
if (!item.addvisible && item.addvisible != undefined && !isEdit) {
|
ctrlhtml += ' style="display:none;" ';
|
}
|
}
|
if ((item.editvisible || item.editvisible == undefined) && isEdit) {
|
ctrlhtml += '';
|
}
|
}
|
ctrlhtml += attrhtml;
|
ctrlhtml += '></div>';
|
}
|
if ((!item.addvisible && !item.editvisible && item.addvisible != undefined && item.editvisible != undefined || item.labtype == 'null')) { }
|
else {
|
if ((col + (allcount % 3)) > 3) {
|
allcount += col + (3 - (allcount % 3));
|
}
|
coltem = col * 4;
|
if (item.labtype == 'textarea') coltem = 10;
|
if (item.labtype == 'hr') {
|
ctrlhtml = ' <div class="col-sm-12 col-md-12" ' + gptypehtml + ' >' + ctrlhtml + '</div>';
|
}
|
else {
|
ctrlhtml = ' <div class="form-group col-sm-' + coltem + ' col-md-' + coltem + '" ' + gptypehtml + ' >' + ctrlhtml + '</div>';
|
}
|
}
|
|
if (item.labtype != 'grid') {
|
htmls += ctrlhtml;
|
}
|
//if((allcount) % 3 == 0 && allcount != 0){
|
// htmls += '</div>';
|
//}
|
|
if (n == (JsonData.length-1)) {
|
htmls += '</div>';
|
}
|
|
col = 0;
|
}
|
}
|
});
|
return htmls;
|
}
|
//创建控件
|
function create(JsonData, divid, isEdit) {
|
var htmls = '';
|
htmls = createdg(JsonData, isEdit);
|
$('#' + divid).append(htmls);
|
};
|
|
//人民币转换成大写
|
function convertCurrency(currencyDigits, name) {
|
var n = $("input[name='" + currencyDigits + "']").val();
|
if (!/^(-?[0-9]\d*)(\.\d+)?$/.test(n)) {
|
|
$("input[name='" + name + "']").val("数据不正确,非法");
|
|
|
}
|
var isfu = false;
|
if (n == undefined)
|
{
|
$("input[name='" + name + "']").val("数据不正确,undefined");
|
return;
|
}
|
|
if (n.indexOf("-") == 0) {
|
n = n.substr(1);
|
isfu = true;
|
}
|
|
|
var unit = "千百拾亿千百拾万千百拾元角分", str = "";
|
n += "00";
|
var p = n.indexOf('.');
|
if (p >= 0)
|
n = n.substring(0, p) + n.substr(p + 1, 2);
|
unit = unit.substr(unit.length - n.length);
|
for (var i = 0; i < n.length; i++)
|
str += '零壹贰叁肆伍陆柒捌玖'.charAt(n.charAt(i)) + unit.charAt(i);
|
var outputCharacters = str.replace(/零(千|百|拾|角)/g, "零").replace(/(零)+/g, "零").replace(/零(万|亿|元)/g, "$1").replace(/(亿)万|壹(拾)/g, "$1$2").replace(/^元零?|零分/g, "").replace(/元$/g, "元整");
|
|
//获取人民币大写
|
$("input[name='" + name + "']").val( (isfu==true?"负":"") + outputCharacters);
|
}
|