今天学习获取数据
在摩尔云平台找到要修改的主视图,然后点击操作功能,点击新增,直接输入名字获取数据,然后,显示顺序15,显示是,点击确定,然后就是自定义类上面输入创建的类名,点击源码,进去后将代码复制到eclipse,去创建一个类,在复制,然后就是去修改代码,
java
package com.more.test.testmodule;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.more.fw.core.base.core.action.ModelAction;
import com.more.fw.core.common.method.CommMethod;
import com.more.fw.core.common.method.Constants;
import com.more.fw.core.common.method.StringUtils;
import com.more.fw.core.dbo.model.service.ModelService;
import com.more.fw.core.dbo.model.service.impl.base.FuncService;
import com.more.mes.common.CommonMethod;
import com.more.mes.common.model.QueryParamModel;
/**
* 要根据对应的视图模型/基础信息:视图公用类的名称来替换继承类FuncService
*
*/
public class GetShareResultInfo implements FuncService {
private Log log = LogFactory.getLog(this.getClass());
@Override
public String exeFunc(ModelAction modelAction, ModelService modelService) {
HttpServletRequest request = modelAction.getRequest();
modelAction.setFormId("80e7dbef360c407d8c7c81dbf6cbed37");
String formId = "80e7dbef360c407d8c7c81dbf6cbed37";
String dataAuth = String.valueOf(modelAction.getRequest().getSession().getAttribute("mcDataAuth"));
String subSortCol = request.getParameter("subSortCol");
String subSortColOrder = request.getParameter("SORT_DOC_NO");//
String isFirstLoad = request.getParameter("isFirstLoad");// 判断是否是首次加载
Map<String, String> map = new HashMap<String, String>();
String sqlWhere = "";
String searchSql = "";
String orderBy = "";
String statusSqlWhere = "";
List<Map> dataList = new ArrayList<>();
String sql = "select T1.CREATE_USER,T1.DEPT_ID,T1.ID,T1.CREATE_TIME,T1.EDIT_USER,T1.EDIT_TIME,T1.DATA_AUTH,T1.DATA_AUTH AS DATA_AUTH_ID,T1.DOC_NO,T1.ITEM_NAME,T1.ITEM_CODE,T1.ITEM_SPEC,T1.PLAN_QTY,T1.MEMO from T_WMS_TABLE_TEST T1" + " WHERE 1 = 1" + " AND T1.DATA_AUTH = :DATA_AUTH ";
List<QueryParamModel> list = CommonMethod.getQueryParam(request);
for (QueryParamModel queryParamModel : list) {
String value = queryParamModel.getValue();
String keyName = queryParamModel.getName();
if (queryParamModel.getName().equals("ITEM_NAME") && StringUtils.isNotBlank(value)) {
searchSql += " AND T1.ITEM_NAME" + queryParamModel.getQueryValue();
} else if (queryParamModel.getName().equals("ITEM_CODE") && StringUtils.isNotBlank(value)) {
searchSql += " AND T1.ITEM_CODE" + queryParamModel.getQueryValue();
} else {
if (StringUtils.isNotBlank(value)) {
searchSql += " AND T1." + queryParamModel.getName() + queryParamModel.getQueryValue();
}
}
}
map.put("DATA_AUTH", dataAuth);
// 表单配置默认排序
orderBy = StringUtils.isNotBlank(CommonMethod.getSortString(modelAction.getFormId(), "T1"))
? " ORDER BY " + CommonMethod.getSortString(modelAction.getFormId(), "T1")
: "";
// 点击排序
if (StringUtils.isNotBlank(subSortCol)) {
orderBy = " ORDER BY T1." + subSortCol + (subSortColOrder.equals("2") ? " desc" : " asc");
}
dataList = modelService.listSql(sql + sqlWhere + searchSql, modelAction.getPage(), map, orderBy, null);
modelAction.getAjaxDataMap(modelAction.getFormId(), modelAction.getPage(), dataList);
return modelAction.outJson(CommMethod.bean2Json(modelAction.getViewAjaxMap()),
Constants.CHARACTER_ENCODING_UTF_8);
}
}
下面的代码是获取数据的固定代码 ,除了String sql 那串代码,他是需要你要查询的表,用sql语句写查询语句找到对应的数据,dataAuth是组织机构,利用map的键值对方法去使用
java
HttpServletRequest request = modelAction.getRequest();
modelAction.setFormId("80e7dbef360c407d8c7c81dbf6cbed37");
String formId = "80e7dbef360c407d8c7c81dbf6cbed37";
String dataAuth = String.valueOf(modelAction.getRequest().getSession().getAttribute("mcDataAuth"));
String subSortCol = request.getParameter("subSortCol");
String subSortColOrder = request.getParameter("SORT_DOC_NO");//
String isFirstLoad = request.getParameter("isFirstLoad");// 判断是否是首次加载
Map<String, String> map = new HashMap<String, String>();
String sqlWhere = "";
String searchSql = "";
String orderBy = "";
String statusSqlWhere = "";
List<Map> dataList = new ArrayList<>();
String sql = "select T1.CREATE_USER,T1.DEPT_ID,T1.ID,T1.CREATE_TIME,T1.EDIT_USER,T1.EDIT_TIME,T1.DATA_AUTH,T1.DATA_AUTH AS DATA_AUTH_ID,T1.DOC_NO,T1.ITEM_NAME,T1.ITEM_CODE,T1.ITEM_SPEC,T1.PLAN_QTY,T1.MEMO from T_WMS_TABLE_TEST T1" + " WHERE 1 = 1" + " AND T1.DATA_AUTH = :DATA_AUTH ";
下面的也是固定方法
java
package com.more.test.testmodule;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.more.fw.core.base.core.action.ModelAction;
import com.more.fw.core.common.method.CommMethod;
import com.more.fw.core.common.method.Constants;
import com.more.fw.core.common.method.StringUtils;
import com.more.fw.core.dbo.model.service.ModelService;
import com.more.fw.core.dbo.model.service.impl.base.FuncService;
import com.more.mes.common.CommonMethod;
import com.more.mes.common.model.QueryParamModel;
/**
* 要根据对应的视图模型/基础信息:视图公用类的名称来替换继承类FuncService
*
*/
public class GetShareResultInfo implements FuncService {
private Log log = LogFactory.getLog(this.getClass());
@Override
public String exeFunc(ModelAction modelAction, ModelService modelService) {
HttpServletRequest request = modelAction.getRequest();
modelAction.setFormId("80e7dbef360c407d8c7c81dbf6cbed37");
String formId = "80e7dbef360c407d8c7c81dbf6cbed37";
String dataAuth = String.valueOf(modelAction.getRequest().getSession().getAttribute("mcDataAuth"));
String subSortCol = request.getParameter("subSortCol");
String subSortColOrder = request.getParameter("SORT_DOC_NO");//
String isFirstLoad = request.getParameter("isFirstLoad");// 判断是否是首次加载
Map<String, String> map = new HashMap<String, String>();
String sqlWhere = "";
String searchSql = "";
String orderBy = "";
String statusSqlWhere = "";
List<Map> dataList = new ArrayList<>();
String sql = "select T1.CREATE_USER,T1.DEPT_ID,T1.ID,T1.CREATE_TIME,T1.EDIT_USER,T1.EDIT_TIME,T1.DATA_AUTH,T1.DATA_AUTH AS DATA_AUTH_ID,T1.DOC_NO,T1.ITEM_NAME,T1.ITEM_CODE,T1.ITEM_SPEC,T1.PLAN_QTY,T1.MEMO from T_WMS_TABLE_TEST T1" + " WHERE 1 = 1" + " AND T1.DATA_AUTH = :DATA_AUTH ";
List<QueryParamModel> list = CommonMethod.getQueryParam(request);
for (QueryParamModel queryParamModel : list) {
String value = queryParamModel.getValue();
String keyName = queryParamModel.getName();
if (queryParamModel.getName().equals("ITEM_NAME") && StringUtils.isNotBlank(value)) {
searchSql += " AND T1.ITEM_NAME" + queryParamModel.getQueryValue();
} else if (queryParamModel.getName().equals("ITEM_CODE") && StringUtils.isNotBlank(value)) {
searchSql += " AND T1.ITEM_CODE" + queryParamModel.getQueryValue();
} else {
if (StringUtils.isNotBlank(value)) {
searchSql += " AND T1." + queryParamModel.getName() + queryParamModel.getQueryValue();
}
}
}
map.put("DATA_AUTH", dataAuth);
// 表单配置默认排序
orderBy = StringUtils.isNotBlank(CommonMethod.getSortString(modelAction.getFormId(), "T1"))
? " ORDER BY " + CommonMethod.getSortString(modelAction.getFormId(), "T1")
: "";
// 点击排序
if (StringUtils.isNotBlank(subSortCol)) {
orderBy = " ORDER BY T1." + subSortCol + (subSortColOrder.equals("2") ? " desc" : " asc");
}
dataList = modelService.listSql(sql + sqlWhere + searchSql, modelAction.getPage(), map, orderBy, null);
modelAction.getAjaxDataMap(modelAction.getFormId(), modelAction.getPage(), dataList);
return modelAction.outJson(CommMethod.bean2Json(modelAction.getViewAjaxMap()),
Constants.CHARACTER_ENCODING_UTF_8);
}
}
然后就是前端页面,
html
<%-- 平台公用头文件 --%>
<%@ page language="java" errorPage="/plf/error.jsp" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" deferredSyntaxAllowedAsLiteral="true" %>
<%@page import="com.more.fw.core.dbo.model.dao.PaginationImpl"%>
<%@ include file="/plf/common/pub_tag.jsp"%>
<%@page import="com.more.fw.core.staticresource.PlfStaticRes"%>
<%-- 异步查询列表,页面加载前 --%>
<jsp:include page="/plf/page/mesdemo/commCode/commCode.jsp">
<jsp:param name="modelName" value="VIEW_TYPE_30" />
<jsp:param name="location" value="beforePageLoad" />
</jsp:include>
<head>
<title>
<dict:lang value="测试操作" />
</title>
<%-- 平台公用meta --%>
<%@ include file="/plf/common/pub_meta.jsp"%>
<%-- 平台公用head,包括公用IMG、CSS、JS资源文件 --%>
<jsp:include page="/plf/common/fp/pub_head_fp.jsp">
<jsp:param name="popDivWinFp" value="1" />
<jsp:param name="datePicker" value="1" />
<jsp:param name="chosen" value="1" />
<jsp:param name="msData" value="1" />
<jsp:param name="scroll" value="1" />
<jsp:param name="jqueryprint" value="1" />
<jsp:param name="queryViewType" value="1" />
</jsp:include>
<jsp:include page="/plf/common/pub_dom.jsp">
<jsp:param name="needValidate" value="1" />
</jsp:include>
<%-- 业务模型公用JS页面 --%>
<%@ include file="/plf/page/common/buss/bussCommJs.jsp"%>
<%-- 公用列表JS页面 --%>
<%@ include file="/plf/page/common/buss/listCommJs.jsp"%>
<bu:header formId ="80e7dbef360c407d8c7c81dbf6cbed37"/>
<%-- 在head里面要插入平台的代码 --%>
<jsp:include page="/plf/page/mesdemo/commCode/commCode.jsp">
<jsp:param name="modelName" value="VIEW_TYPE_30" />
<jsp:param name="location" value="inHead" />
</jsp:include>
<%-- 产品静态资源 --%>
<style>
div.customized-rmenu-container {
position:absolute;
visibility:hidden;
top:0;
text-align: center;
padding: 2px;
min-width: 80px;
z-index: 100000;
}
div.customized-rmenu-container dl{
top:0;
padding: 0;
border: 1px solid #d2d2d2;
background-color: #fff;
border-radius: 2px;
box-shadow: 0 2px 4px rgba(0,0,0,.12);
box-sizing: border-box;
}
div.customized-rmenu-container dl dd{
padding: 0px 6px;
cursor: pointer;
line-height: 30px;
}
div.customized-rmenu-container dl dd:hover{
background-color:#ccc;
color:white;
}
div.customized-rmenu-container dl hr{
margin:0px;
background-color: #ccc;
height: 1px;
border: none;
}
</style>
</head>
<body>
<div id="rMenu" class="customized-rmenu-container"></div>
<div id="childTableRMenu" class="customized-rmenu-container">
<dl>
<dd onclick="showChildTableCustomizedColumns()"><dict:lang value='调整列' /></dd>
</dl>
</div>
<div class="content-in">
<div class="dlist">
<div class="hd query-hd">
<bu:func2 viewId="be2de936cc174f569c1c3b8393f5aa0f" />
</div>
<div class="bd query-bd">
<div class="search-box">
<form id="searchForm" name="searchForm" action="${path}buss/bussModel.ms" method="post">
<%-- 视图页面数据查询区域 --%>
<jsp:include page="/plf/page/mesdemo/commCode/commCode.jsp">
<jsp:param name="modelName" value="VIEW_TYPE_30" />
<jsp:param name="location" value="searchForm" />
</jsp:include>
<div class="query-condition">
<bu:newsearch deal_mark="1" viewId="be2de936cc174f569c1c3b8393f5aa0f" />
</div>
</form>
<a href="javascript:void(0);" class="more"></a>
</div>
<form id="listForm" name="listForm" action="${path}buss/bussModel.ms?<s:property value='%{@com.more.fw.core.common.method.ConstantsMc@FUNC_CODE}' />=<s:property value='%{FUNC_CODE}' />" method="post">
<%-- 视图页面数据表格区域 --%>
<jsp:include page="/plf/page/mesdemo/commCode/commCode.jsp">
<jsp:param name="modelName" value="VIEW_TYPE_30" />
<jsp:param name="location" value="listForm" />
</jsp:include>
<%-- 视图页面表格区域平台默认的数据项 --%>
<input type="hidden" name="formPage80e7dbef360c407d8c7c81dbf6cbed37" id="formPage80e7dbef360c407d8c7c81dbf6cbed37" value="${formPage80e7dbef360c407d8c7c81dbf6cbed37}"/>
<input type="hidden" name="formId" id="formId1" value='80e7dbef360c407d8c7c81dbf6cbed37'/>
<input type="hidden" id="subRelColIds" name="subRelColIds" value='null'/>
<input type="hidden" id="subFormIds" name="subFormIds" value='null'/>
<div class="panel-ajax datagrid datagrid-div1" id="80e7dbef360c407d8c7c81dbf6cbed37">
<div class="datagrid-div2 datagrid-div6 datagrid-view-ajax" id="datagrid-view-ajax80e7dbef360c407d8c7c81dbf6cbed37" style="">
<div class="datagrid-header">
<div class="datagrid-header-inner" id="datagrid-header-inner80e7dbef360c407d8c7c81dbf6cbed37">
<bu:table cssClass="datagrid-htable fixedTable datagrid-div6 datagrid-htable-kz" id="datagrid-htable80e7dbef360c407d8c7c81dbf6cbed37">
<s:set name="_$type" value="'view'" />
<tbody class="isParentsTitle">
<bu:tr cssClass="datagrid-header-row datagrid-title-ajax" id="datagrid-title-ajax">
<td class="datagrid-cell" name="noprintset_SEQ" style="width:30px; text-align:center;" ><bu:thSeq formId="80e7dbef360c407d8c7c81dbf6cbed37" i18n="1"/></td>
<td class="datagrid-cell no-print" style="width:30px; text-align:center"><span><input type="checkbox" id="selectAll_80e7dbef360c407d8c7c81dbf6cbed37" onclick="_selectAjaxTableAllData(this,'80e7dbef360c407d8c7c81dbf6cbed37')" style="cursor: pointer;"title="全选"/></span></td>
<td name="noprintset_DOC_NO" class="datagrid-cell"><bu:uitn colNo="DOC_NO" formId="80e7dbef360c407d8c7c81dbf6cbed37" /></td>
<td name="noprintset_ITEM_NAME" class="datagrid-cell"><bu:uitn colNo="ITEM_NAME" formId="80e7dbef360c407d8c7c81dbf6cbed37" /></td>
<td name="noprintset_ITEM_CODE" class="datagrid-cell"><bu:uitn colNo="ITEM_CODE" formId="80e7dbef360c407d8c7c81dbf6cbed37" /></td>
<td name="noprintset_ITEM_SPEC" class="datagrid-cell"><bu:uitn colNo="ITEM_SPEC" formId="80e7dbef360c407d8c7c81dbf6cbed37" /></td>
<td name="noprintset_PLAN_QTY" class="datagrid-cell"><bu:uitn colNo="PLAN_QTY" formId="80e7dbef360c407d8c7c81dbf6cbed37" /></td>
<td name="noprintset_MEMO" class="datagrid-cell"><bu:uitn colNo="MEMO" formId="80e7dbef360c407d8c7c81dbf6cbed37" /></td>
</bu:tr>
</tbody>
</bu:table>
</div>
</div>
<div class="datagrid-body datagrid-div3 datagrid-body-ajax" id="tableDiv80e7dbef360c407d8c7c81dbf6cbed37" onscroll="ajaxTableScroll(this,'80e7dbef360c407d8c7c81dbf6cbed37')">
<table class="datagrid-btable fixedTable dblClick" id="datagrid-btable-ajax80e7dbef360c407d8c7c81dbf6cbed37">
<tbody id="tbody_80e7dbef360c407d8c7c81dbf6cbed37" class="isParents">
</tbody>
</table>
</div>
</div>
</div>
<div id="printset_div" style="background-color: white;margin-top: 50px;display:none;">
<div class="hd" style="background-color: #f6f5f7;height: 35px;">
<div class="optn" style="top:45px;right:30px;">
<button type="button" onclick="printset_17('80e7dbef360c407d8c7c81dbf6cbed37','1');"><dict:lang value="打印" /></button>
</div>
</div>
<div style="height: 390px;overflow:auto;border-top: 1px solid #eaeaea;">
<table id="printset_tab" class="basic-table" style="text-align: center;margin-top:10px;">
<tr>
<td style="width: 100px;text-align: right;"><dict:lang value="列字段" /></td>
<td style="padding-left: 5px;"><dict:lang value="是否打印" /></td>
<td style="padding-left: 5px;"><dict:lang value="打印列宽" /></td>
</tr>
<tr>
<td style="width: 100px;text-align: right;"><span><dict:lang value="序号" /></span></td>
<td style="padding-left: 5px;">
<input type="checkbox" name="SEQ" value="1" checked="checked" />
</td>
<td style="padding-left: 5px;">
<input type="text" name="SEQ" value="30" title_name="序号" />px
</td>
</tr>
<tr>
<td style="width: 100px;text-align: right;"><span>单据号</span></td>
<td style="padding-left: 5px;">
<input type="checkbox" name="DOC_NO" value="1" checked="checked" />
</td>
<td style="padding-left: 5px;">
<input type="text" name="DOC_NO" value="" title_name="单据号" />px
</td>
</tr>
<tr>
<td style="width: 100px;text-align: right;"><span>物料名称</span></td>
<td style="padding-left: 5px;">
<input type="checkbox" name="ITEM_NAME" value="1" checked="checked" />
</td>
<td style="padding-left: 5px;">
<input type="text" name="ITEM_NAME" value="" title_name="物料名称" />px
</td>
</tr>
<tr>
<td style="width: 100px;text-align: right;"><span>物料料号</span></td>
<td style="padding-left: 5px;">
<input type="checkbox" name="ITEM_CODE" value="1" checked="checked" />
</td>
<td style="padding-left: 5px;">
<input type="text" name="ITEM_CODE" value="" title_name="物料料号" />px
</td>
</tr>
<tr>
<td style="width: 100px;text-align: right;"><span>物料规格</span></td>
<td style="padding-left: 5px;">
<input type="checkbox" name="ITEM_SPEC" value="1" checked="checked" />
</td>
<td style="padding-left: 5px;">
<input type="text" name="ITEM_SPEC" value="" title_name="物料规格" />px
</td>
</tr>
<tr>
<td style="width: 100px;text-align: right;"><span>计划数量</span></td>
<td style="padding-left: 5px;">
<input type="checkbox" name="PLAN_QTY" value="1" checked="checked" />
</td>
<td style="padding-left: 5px;">
<input type="text" name="PLAN_QTY" value="" title_name="计划数量" />px
</td>
</tr>
<tr>
<td style="width: 100px;text-align: right;"><span>备注</span></td>
<td style="padding-left: 5px;">
<input type="checkbox" name="MEMO" value="1" checked="checked" />
</td>
<td style="padding-left: 5px;">
<input type="text" name="MEMO" value="" title_name="备注" />px
</td>
</tr>
</table>
</div>
</div>
<c:if test="${formPage80e7dbef360c407d8c7c81dbf6cbed37==1}">
<div class="center" data-type="80e7dbef360c407d8c7c81dbf6cbed37" >
<s:include value="/plf/page/fp/paginationPopMultAx.jsp?listDataFn=listAjaxTable&formId=80e7dbef360c407d8c7c81dbf6cbed37&showLoading=0" />
</div>
</c:if>
<input type="hidden" name="tableCount" id="tableCount" value='1' />
</form>
</div>
</div>
</div>
<bu:submit viewId="be2de936cc174f569c1c3b8393f5aa0f" />
<%-- 平台预留在JS加载前执行的代码片段 --%>
<jsp:include page="/plf/page/mesdemo/commCode/commCode.jsp">
<jsp:param name="modelName" value="VIEW_TYPE_30" />
<jsp:param name="location" value="beforeJsLoad" />
</jsp:include>
<bu:script viewId="be2de936cc174f569c1c3b8393f5aa0f" />
<%-- 主列表JS,如查询方法 --%>
<jsp:include page="/plf/page/mesdemo/commCode/commCode.jsp">
<jsp:param name="modelName" value="VIEW_TYPE_30" />
<jsp:param name="location" value="jsLoading" />
</jsp:include>
<%-- 生成异步表格 --%>
<script>
/*更新表头信息、打印信息并查询列表数据
*formId:表单id
*isAbandonedSearch:是否禁止查询数据,不传则默认查询
*callbackFunc:表头、打印信息页面重组完成回调函数
*/
function updateColumnsData(formId,isAbandonedSearch,callbackFunc){
mcUpdateColumnsData(formId,isAbandonedSearch,callbackFunc);
}
<%--生成异步表格-自定义显示列--%>
/*生成异步表格-自定义显示列
*ms:后台接口返回的数据
*formId:表单id
*tableColumnsData:列数据对象 {leftList:左侧固定列数据, showList:主/右侧列数据}
*callbackFunc:数据页面重组完成回调函数
*/
function createTable2(ms,formId,tableColumnsData,callbackFunc){
mcCreateTable2(ms,formId,tableColumnsData,callbackFunc);
}
<%--生成异步表格--%>
function createTableModel(ms,formId){
var arrHtml = [];
var arrLeftHtml = [];
var uiTxt = ms.uiTxt(formId)==null?[]:ms.uiTxt(formId);
var trClass = ms.trClass(formId);
var trStyle = ms.trStyle(formId);
var trEvent = ms.trEvent(formId);
var colNo = $("#relColVals").val();
if(formId=='80e7dbef360c407d8c7c81dbf6cbed37'){<%--FM-T_WMS_PRODUCTION_TEST--%>
$.each(uiTxt,function(i,v){
var backgroudColor = (i+1)%2 == 0 ? "tr-hover" : "";
arrHtml.push("<tr class='datagrid-row "+backgroudColor+" "+trClass+"' id='"+v.ID+"' abbr='"+v.ID+"' style='cursor: pointer;"+trStyle+"' "+trEvent+">");
arrHtml.push("<input type='hidden' name='ID' value='"+v.ID+"' />");
arrHtml.push("<input type='hidden' id='DATA_AUTH_ID_"+v.ID+"' value='"+v.DATA_AUTH_ID+"' />");
getRelColVal(arrHtml,v,colNo);
arrHtml.push("<td class='datagrid-cell' name='noprintset_SEQ' style='width:30px;text-align:center;' ><span class='_noedit'>"+v._SEQ+"</span></td>");
arrHtml.push("<td class='datagrid-cell no-print' style='width:30px;text-align:center;' ><span class='_noedit'>");
arrHtml.push("<input type='checkbox' name='"+formId+"$ID' value='"+v.ID+"' class='isSubmit _selectdata' style='cursor: pointer;margin:0'>");
arrHtml.push("</td>");
arrHtml.push("<td colno='DOC_NO' name='noprintset_DOC_NO' class='datagrid-cell "+ms.tdClass(formId, 'DOC_NO')+"' style='"+ms.tdStyle(formId, 'DOC_NO')+"' "+ms.tdEvent(formId, 'DOC_NO')+">")
arrHtml.push("<span colno='DOC_NO' class='"+ms.uiClass(formId, 'DOC_NO')+"' style='"+ms.uiStyle(formId, 'DOC_NO')+"' "+ms.uiEvent(formId, 'DOC_NO')+" title='"+ms.titleAttr(formId,'DOC_NO','IS_TITLE_ATTR',v)+"' >"+v['DOC_NO']+"</span>")
arrHtml.push("</td>");
arrHtml.push("<td colno='ITEM_NAME' name='noprintset_ITEM_NAME' class='datagrid-cell "+ms.tdClass(formId, 'ITEM_NAME')+"' style='"+ms.tdStyle(formId, 'ITEM_NAME')+"' "+ms.tdEvent(formId, 'ITEM_NAME')+">")
arrHtml.push("<span colno='ITEM_NAME' class='"+ms.uiClass(formId, 'ITEM_NAME')+"' style='"+ms.uiStyle(formId, 'ITEM_NAME')+"' "+ms.uiEvent(formId, 'ITEM_NAME')+" title='"+ms.titleAttr(formId,'ITEM_NAME','IS_TITLE_ATTR',v)+"' >"+v['ITEM_NAME']+"</span>")
arrHtml.push("</td>");
arrHtml.push("<td colno='ITEM_CODE' name='noprintset_ITEM_CODE' class='datagrid-cell "+ms.tdClass(formId, 'ITEM_CODE')+"' style='"+ms.tdStyle(formId, 'ITEM_CODE')+"' "+ms.tdEvent(formId, 'ITEM_CODE')+">")
arrHtml.push("<span colno='ITEM_CODE' class='"+ms.uiClass(formId, 'ITEM_CODE')+"' style='"+ms.uiStyle(formId, 'ITEM_CODE')+"' "+ms.uiEvent(formId, 'ITEM_CODE')+" title='"+ms.titleAttr(formId,'ITEM_CODE','IS_TITLE_ATTR',v)+"' >"+v['ITEM_CODE']+"</span>")
arrHtml.push("</td>");
arrHtml.push("<td colno='ITEM_SPEC' name='noprintset_ITEM_SPEC' class='datagrid-cell "+ms.tdClass(formId, 'ITEM_SPEC')+"' style='"+ms.tdStyle(formId, 'ITEM_SPEC')+"' "+ms.tdEvent(formId, 'ITEM_SPEC')+">")
arrHtml.push("<span colno='ITEM_SPEC' class='"+ms.uiClass(formId, 'ITEM_SPEC')+"' style='"+ms.uiStyle(formId, 'ITEM_SPEC')+"' "+ms.uiEvent(formId, 'ITEM_SPEC')+" title='"+ms.titleAttr(formId,'ITEM_SPEC','IS_TITLE_ATTR',v)+"' >"+v['ITEM_SPEC']+"</span>")
arrHtml.push("</td>");
arrHtml.push("<td colno='PLAN_QTY' name='noprintset_PLAN_QTY' class='datagrid-cell "+ms.tdClass(formId, 'PLAN_QTY')+"' style='"+ms.tdStyle(formId, 'PLAN_QTY')+"' "+ms.tdEvent(formId, 'PLAN_QTY')+">")
arrHtml.push("<span colno='PLAN_QTY' class='"+ms.uiClass(formId, 'PLAN_QTY')+"' style='"+ms.uiStyle(formId, 'PLAN_QTY')+"' "+ms.uiEvent(formId, 'PLAN_QTY')+" title='"+ms.titleAttr(formId,'PLAN_QTY','IS_TITLE_ATTR',v)+"' >"+v['PLAN_QTY']+"</span>")
arrHtml.push("</td>");
arrHtml.push("<td colno='MEMO' name='noprintset_MEMO' class='datagrid-cell "+ms.tdClass(formId, 'MEMO')+"' style='"+ms.tdStyle(formId, 'MEMO')+"' "+ms.tdEvent(formId, 'MEMO')+">")
arrHtml.push("<span colno='MEMO' class='"+ms.uiClass(formId, 'MEMO')+"' style='"+ms.uiStyle(formId, 'MEMO')+"' "+ms.uiEvent(formId, 'MEMO')+" title='"+ms.titleAttr(formId,'MEMO','IS_TITLE_ATTR',v)+"' >"+v['MEMO']+"</span>")
arrHtml.push("</td>");
arrHtml.push("</tr>")
});
if($("#leftTableDiv"+formId).length>0){
$("#left-tbody_"+formId).html(arrLeftHtml.join(""));
}
setCrossWiseScroll(formId,arrHtml);
$("#tbody_"+formId).html(arrHtml.join(""));
}
setNumColWidth(formId);
clearAllSelect();
setTableWidth(formId);
setScroll(formId);
}
</script><script>
<%--生成异步表格--%>
function createTableModel_print(ms,formId){
var arrHtml = [];
var arrLeftHtml = [];
var uiTxt = ms.uiTxt(formId)==null?[]:ms.uiTxt(formId);
var trClass = ms.trClass(formId);
var trStyle = ms.trStyle(formId);
var trEvent = ms.trEvent(formId);
var colNo = $("#relColVals").val();
if(formId=='80e7dbef360c407d8c7c81dbf6cbed37'){<%--FM-T_WMS_PRODUCTION_TEST--%>
$.each(uiTxt,function(i,v){
var backgroudColor = (i+1)%2 == 0 ? "tr-hover" : "";
arrHtml.push("<tr class='datagrid-row "+backgroudColor+" "+trClass+"' id='"+v.ID+"' abbr='"+v.ID+"' style='cursor: pointer;"+trStyle+"' "+trEvent+">");
arrHtml.push("<input type='hidden' name='ID' value='"+v.ID+"' />");
getRelColVal(arrHtml,v,colNo);
arrHtml.push("<td class='datagrid-cell' name='noprintset_SEQ' style='width:30px;text-align:center;' ><span class='_noedit'>"+v._SEQ+"</span></td>");
arrHtml.push("<td colno='DOC_NO' name='noprintset_DOC_NO' class='datagrid-cell "+ms.tdClass(formId, 'DOC_NO')+"' style='"+ms.tdStyle(formId, 'DOC_NO')+"' "+ms.tdEvent(formId, 'DOC_NO')+">")
arrHtml.push("<span colno='DOC_NO' class='"+ms.uiClass(formId, 'DOC_NO')+"' style='"+ms.uiStyle(formId, 'DOC_NO')+"' "+ms.uiEvent(formId, 'DOC_NO')+" title='"+ms.titleAttr(formId,'DOC_NO','IS_TITLE_ATTR',v)+"' >"+v['DOC_NO']+"</span>")
arrHtml.push("</td>");
arrHtml.push("<td colno='ITEM_NAME' name='noprintset_ITEM_NAME' class='datagrid-cell "+ms.tdClass(formId, 'ITEM_NAME')+"' style='"+ms.tdStyle(formId, 'ITEM_NAME')+"' "+ms.tdEvent(formId, 'ITEM_NAME')+">")
arrHtml.push("<span colno='ITEM_NAME' class='"+ms.uiClass(formId, 'ITEM_NAME')+"' style='"+ms.uiStyle(formId, 'ITEM_NAME')+"' "+ms.uiEvent(formId, 'ITEM_NAME')+" title='"+ms.titleAttr(formId,'ITEM_NAME','IS_TITLE_ATTR',v)+"' >"+v['ITEM_NAME']+"</span>")
arrHtml.push("</td>");
arrHtml.push("<td colno='ITEM_CODE' name='noprintset_ITEM_CODE' class='datagrid-cell "+ms.tdClass(formId, 'ITEM_CODE')+"' style='"+ms.tdStyle(formId, 'ITEM_CODE')+"' "+ms.tdEvent(formId, 'ITEM_CODE')+">")
arrHtml.push("<span colno='ITEM_CODE' class='"+ms.uiClass(formId, 'ITEM_CODE')+"' style='"+ms.uiStyle(formId, 'ITEM_CODE')+"' "+ms.uiEvent(formId, 'ITEM_CODE')+" title='"+ms.titleAttr(formId,'ITEM_CODE','IS_TITLE_ATTR',v)+"' >"+v['ITEM_CODE']+"</span>")
arrHtml.push("</td>");
arrHtml.push("<td colno='ITEM_SPEC' name='noprintset_ITEM_SPEC' class='datagrid-cell "+ms.tdClass(formId, 'ITEM_SPEC')+"' style='"+ms.tdStyle(formId, 'ITEM_SPEC')+"' "+ms.tdEvent(formId, 'ITEM_SPEC')+">")
arrHtml.push("<span colno='ITEM_SPEC' class='"+ms.uiClass(formId, 'ITEM_SPEC')+"' style='"+ms.uiStyle(formId, 'ITEM_SPEC')+"' "+ms.uiEvent(formId, 'ITEM_SPEC')+" title='"+ms.titleAttr(formId,'ITEM_SPEC','IS_TITLE_ATTR',v)+"' >"+v['ITEM_SPEC']+"</span>")
arrHtml.push("</td>");
arrHtml.push("<td colno='PLAN_QTY' name='noprintset_PLAN_QTY' class='datagrid-cell "+ms.tdClass(formId, 'PLAN_QTY')+"' style='"+ms.tdStyle(formId, 'PLAN_QTY')+"' "+ms.tdEvent(formId, 'PLAN_QTY')+">")
arrHtml.push("<span colno='PLAN_QTY' class='"+ms.uiClass(formId, 'PLAN_QTY')+"' style='"+ms.uiStyle(formId, 'PLAN_QTY')+"' "+ms.uiEvent(formId, 'PLAN_QTY')+" title='"+ms.titleAttr(formId,'PLAN_QTY','IS_TITLE_ATTR',v)+"' >"+v['PLAN_QTY']+"</span>")
arrHtml.push("</td>");
arrHtml.push("<td colno='MEMO' name='noprintset_MEMO' class='datagrid-cell "+ms.tdClass(formId, 'MEMO')+"' style='"+ms.tdStyle(formId, 'MEMO')+"' "+ms.tdEvent(formId, 'MEMO')+">")
arrHtml.push("<span colno='MEMO' class='"+ms.uiClass(formId, 'MEMO')+"' style='"+ms.uiStyle(formId, 'MEMO')+"' "+ms.uiEvent(formId, 'MEMO')+" title='"+ms.titleAttr(formId,'MEMO','IS_TITLE_ATTR',v)+"' >"+v['MEMO']+"</span>")
arrHtml.push("</td>");
arrHtml.push("</tr>")
});
if($("#leftTableDiv"+formId).length>0){
$("#left-tbody_"+formId).html(arrLeftHtml.join(""));
}
setCrossWiseScroll(formId,arrHtml);
$("#tbody_print_"+formId).html(arrHtml.join(""));
}
setNumColWidth(formId);
clearAllSelect();
setTableWidth(formId);
setScroll(formId);
}
//2024-01-09 PZJ 添加 重写获取主表数据
var sortNum=0;
var currentcolnum;
// 点击排序
function _sortData(thisObj,colnum){
currentcolnum=colnum;
_sortIcon(thisObj,colnum,sortNum);
var mainId=$(thisObj).parents(".main").attr("id");
if(mainId=="main"){
listAjaxTable("80e7dbef360c407d8c7c81dbf6cbed37");
currentcolnum="";
}
}
function listAjaxTable(paginationImpl){
util.showLoading("处理中...");
$("#tbody_80e7dbef360c407d8c7c81dbf6cbed37").empty();
var dataAuth = $("#DATA_AUTH").val();
var url = "${path}buss/bussModel_exeFunc.ms?funcMId=7153b19d1ae4406fac15432d18aacc73";
var searchParams = _getSearchParams();
var isFirstLoad = firstLoadThisPage(paginationImpl);
var currentPage = isFirstLoad? 1 : _GLO_FORM_PAGE_MAP[paginationImpl].currentPage;
var pageRecord = isFirstLoad? 100 : _GLO_FORM_PAGE_MAP[paginationImpl].pageRecord;
// ypy 2022.4.17 点击排序
var subSortColOrder= $("#SORT_"+currentcolnum).val();
$.ajax({
type:"post",
dataType:"json",
url:url+"&"+searchParams,
data:{
"dataAuth":dataAuth,
"page.currentPage":_GLO_FORM_PAGE_MAP[paginationImpl].currentPage,
"page.pageRecord": pageRecord,
"ITEM_NAME": currentcolnum,
"isFirstLoad": isFirstLoad,
"subSortColOrder": subSortColOrder
},
success:function(data){
util.closeLoading();
if(null==data){
return;
}
var ms = new MSdata(data);
var page = ms.page("80e7dbef360c407d8c7c81dbf6cbed37");
createTableModel(ms,"80e7dbef360c407d8c7c81dbf6cbed37");
pageFun(page,"80e7dbef360c407d8c7c81dbf6cbed37");
},
error:function(msg){
util.closeLoading();
_TOOL_PRO.showAjaxErrorMsg(msg);
}
})
}
function _getSearchParams() {
let searchParams = $("#searchForm").serialize()+"&"+$("#searchFormTop").serialize().replace(/searchParaList/g,'searchTopParaList');
return searchParams;
}
//初始化
function init(){
$("select[name='searchParaList[5]._PAGE_SEARCH_VALUE']").val("N");
listAjaxTable('80e7dbef360c407d8c7c81dbf6cbed37');
}
//搜索
function query(){
listAjaxTable('80e7dbef360c407d8c7c81dbf6cbed37');
}
</script>
<%-- 平台异步分页相关JS方法 --%>
<script type="text/javascript" src="${path}plf/page/fp/js/paginationMultAx.js?_mc_res_version=<%=PlfStaticRes.PaginationMultAx_JS %>"></script>
<%-- 表单结束区域 --%>
<%@ include file="/plf/common/fp/pub_dom_fp.jsp"%>
</body>
<%-- 平台公用的底部代码区域 --%>
<%@ include file="/plf/common/pub_end.jsp"%>
<%-- 页面结束 --%>
<jsp:include page="/plf/page/mesdemo/commCode/commCode.jsp">
<jsp:param name="modelName" value="VIEW_TYPE_30" />
<jsp:param name="location" value="pageOver" />
</jsp:include>
记得添加一下前端代码,