| | |
| | | if (data1.count == 1) { |
| | | var data = data1.data; |
| | | |
| | | var HPageLabelElementIDList = []; //页签元素ID列表 |
| | | var HPageLabelElementIDList = ["HBaseInfo", "HFileInfo","HOtherInfo"]; //页签元素ID列表 |
| | | var HElementCountByTab = {}; //记录各个页签显示的元素的个数 |
| | | var columnCount = 3; //页签中每行的元素数 |
| | | var columnCount = data[0].HRowElementCount; //页签中每行的元素数 |
| | | |
| | | for (var i = 0; i < data.length; i++) { |
| | | |
| | |
| | | "HElementID": data[i].HElementID |
| | | , "HElementLabel": data[i].HElementLabel |
| | | , "HDefaultValue": data[i].HDefaultValue |
| | | , "HFieldDataType": data[i].HFieldDataType |
| | | } |
| | | HIsMustElementList.push(HElement_IsMust); |
| | | } |
| | |
| | | element_level7_1.className = "layui-input"; |
| | | element_level7_1.setAttribute('lay-verify', data[i].HElementID); |
| | | element_level7_1.value = data[i].HDefaultValue; |
| | | |
| | | //判断文本数据类型,设置文本框允许输入的数据类型 |
| | | if (data[i].HFieldDataType == "Int32" || data[i].HFieldDataType == "Decimal") { |
| | | element_level7_1.type = "number"; |
| | | } else if (data[i].HFieldDataType == "text") { |
| | | element_level7_1.type = "text"; |
| | | } |
| | | |
| | | //判断是否禁用,是 则 禁止输入 |
| | | if (data[i].HIsDisabled == true) { |
| | | element_level7_1.readOnly = true; |
| | | element_level7_1.style = "background-color:#efefef4d;"; |
| | | } |
| | | |
| | | //判断是否设置最大长度,若设置则另文本框限制文本最大长度 |
| | | if (data[i].HFieldMaxLength != 0) { |
| | | element_level7_1.maxLength = data[i].HFieldMaxLength; |
| | | } |
| | | |
| | | element_level6_1.appendChild(element_level7_1); //将文本框添加到文本框元素的容器中 |
| | |
| | | , "filter": data[i].HElementID + "_Button" |
| | | }); |
| | | |
| | | //设置window对象的方法,用于子窗口调用返回数据 |
| | | var windowName = data[i].HSubWindowBackDataMethodName; |
| | | if (windowName != "") { |
| | | window[windowName] = function (obj) { |
| | | SubWindowBackData_BySubWindow(obj); |
| | | } |
| | | } |
| | | ////设置window对象的方法,用于子窗口调用返回数据 |
| | | //var windowName = data[i].HSubWindowBackDataMethodName; |
| | | //if (windowName != "") { |
| | | // window[windowName] = function (obj) { |
| | | // SubWindowBackData_BySubWindow(obj); |
| | | // } |
| | | //} |
| | | |
| | | var element_level8 = document.createElement('i'); //按钮中的按钮图标元素 |
| | | element_level8.className = "layui-icon layui-icon-search layuiadmin-button-btn"; |
| | |
| | | element_level7_1.style = "padding-left: 80px;"; |
| | | element_level7_1.setAttribute('lay-verify', data[i].HElementID); |
| | | element_level7_1.value = formatDate(new Date(), "yyyy-MM-dd"); |
| | | |
| | | //判断文本数据类型,设置文本框允许输入的数据类型 |
| | | if (data[i].HFieldDataType == "Date") { |
| | | element_level7_1.type = "date"; |
| | | } |
| | | |
| | | //判断是否禁用,是 则 禁止输入 |
| | | if (data[i].HIsDisabled == true) { |
| | | element_level7_1.readOnly = true; |
| | |
| | | element_level7_1.style = "background-color:#efefef4d;"; |
| | | } |
| | | |
| | | //判断是否设置最大长度,若设置则另文本框限制文本最大长度 |
| | | if (data[i].HFieldMaxLength != 0) { |
| | | element_level7_1.maxLength = data[i].HFieldMaxLength; |
| | | } |
| | | |
| | | element_level6_1.appendChild(element_level7_1); //将文本框添加到文本框元素的容器中 |
| | | |
| | | element_level5.appendChild(element_level6_1); //将文本框元素的容器添加到单据号元素的容器中 |
| | |
| | | var ID = event.currentTarget.id; //获取触发事件的元素的ID |
| | | for (var j = 0; j < buttonClickListenerList.length; j++) { |
| | | if (buttonClickListenerList[j].ID == ID) { //根据触发事件的元素的ID,定位到触发事件所需要的信息,调用相关方法并传参 |
| | | var title_temp = buttonClickListenerList[j].title_temp; |
| | | var url_temp = buttonClickListenerList[j].url_temp; |
| | | var HSubWindowBackData = buttonClickListenerList[j].HSubWindowBackData; |
| | | SubWindowBackData(title_temp, url_temp, HSubWindowBackData); |
| | | //var title_temp = buttonClickListenerList[j].title_temp; |
| | | //var url_temp = buttonClickListenerList[j].url_temp; |
| | | //var HSubWindowBackData = buttonClickListenerList[j].HSubWindowBackData; |
| | | //SubWindowBackData(title_temp, url_temp, HSubWindowBackData); |
| | | |
| | | var HSubWindowBackDataMethodName_layer = buttonClickListenerList[j].HSubWindowBackDataMethodName + "_layer"; |
| | | window[HSubWindowBackDataMethodName_layer](); |
| | | } |
| | | } |
| | | }); |
| | |
| | | //#region 非空验证_表头 |
| | | function AllowLoadData_BillMain(data) { |
| | | var ref = /^\d+(\.\d+)?$/; //非负数正则表达式 |
| | | var ref1 = /^[1-9]\d*$/; //正整数正则表达式 |
| | | |
| | | //#region 表头数据检验 |
| | | for (var i = 0; i < HIsMustElementList.length; i++) { |
| | | var temp = $("#" + HIsMustElementList[i].HElementID).val(); |
| | | if (HIsMustElementList[i].HDefaultValue == "") { |
| | | if (HIsMustElementList[i].HFieldDataType == "String" || HIsMustElementList[i].HFieldDataType == "DateTime") { |
| | | if (temp == "") { |
| | | layer.msg(HIsMustElementList[i].HElementLabel + "为必填项目,请检查是否填写数据!"); |
| | | return false; |
| | | } |
| | | } |
| | | else if (HIsMustElementList[i].HDefaultValue == "0") { |
| | | else if (HIsMustElementList[i].HFieldDataType == "Decimal") { |
| | | if (!ref.test(temp)) { |
| | | layer.msg(HIsMustElementList[i].HElementLabel + "为必填项目,请检查是否填写数据,数据为数字!"); |
| | | return false; |
| | | } |
| | | } |
| | | else if (HIsMustElementList[i].HFieldDataType == "Int32") { |
| | | if (!ref1.test(temp)) { |
| | | layer.msg(HIsMustElementList[i].HElementLabel + "为必填项目,请检查是否填写数据,数据为正整数!"); |
| | | return false; |
| | | } |
| | | } |
| | |
| | | //主表 赋值 |
| | | var formData = {}; |
| | | for (var i = 0; i < HEditValueList.length; i++) { |
| | | if (HEditValueList[i].HElementType == "日期") { |
| | | formData[HEditValueList[i].HElementID] = Format(new Date(tableMain[0][HEditValueList[i].HSetValueWhenEdit]), "yyyy-MM-dd"); |
| | | } else if (HEditValueList[i].HElementLabel.includes("日期")) { |
| | | formData[HEditValueList[i].HElementID] = Format(new Date(tableMain[0][HEditValueList[i].HSetValueWhenEdit]), "yyyy-MM-dd hh:mm:ss"); |
| | | if (HEditValueList[i].HFieldDataType == "Date") { |
| | | formData[HEditValueList[i].HElementID] = tableMain[0][HEditValueList[i].HFieldName]==null?'': Format(new Date(tableMain[0][HEditValueList[i].HFieldName]), "yyyy-MM-dd"); |
| | | } else if (HEditValueList[i].HFieldDataType == "DateTime") { |
| | | formData[HEditValueList[i].HElementID] = tableMain[0][HEditValueList[i].HFieldName]==null?'': Format(new Date(tableMain[0][HEditValueList[i].HFieldName]), "yyyy-MM-dd hh:mm:ss"); |
| | | } |
| | | else { |
| | | formData[HEditValueList[i].HElementID] = tableMain[0][HEditValueList[i].HSetValueWhenEdit]; |
| | | formData[HEditValueList[i].HElementID] = tableMain[0][HEditValueList[i].HFieldName]; |
| | | } |
| | | } |
| | | form.val("formData", formData); |