| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
- <%@include file="/context/mytags.jsp" %>
- <!DOCTYPE html >
- <html>
- <head>
- <title>根据当前登录用户id查询项目名称列表Part</title>
- <t:base type="jquery,easyui,tools"></t:base>
- </head>
- <body style="overflow-y: hidden" scroll="no">
- <input id="ids" type="hidden" value=${ids}>
- <input id="row" type="hidden" value=${row}>
- <input id="maintenanceStatus" type="hidden" value="${maintenanceStatus}">
- <t:datagrid name="goodsInfoList" checkbox="false" pagination="true" fitColumns="true" title="选择货品"
- actionUrl="tBMaterialController.do?goodsdatagrid&maintenanceStatus=${maintenanceStatus}" idField="id"
- fit="true" queryMode="group"
- onLoadSuccess="initCheck">
- <t:dgCol align="center" title="主键" field="id" hidden="true" queryMode="single" width="120"></t:dgCol>
- <t:dgCol align="center" title="货品分类" query="false" field="belongCategory" dictionary="t_b_goods_category,category_code,category_name, and parent_categoryid is not NULL "
- width="50"></t:dgCol>
- <t:dgCol align="center" title="货品名称" query="true" field="goodsName" queryMode="single" width="50"></t:dgCol>
- <t:dgCol align="center" title="计量单位" query="false" field="baseUnit" dictionary="metering_calcu_unit"
- queryMode="single"
- width="50"></t:dgCol>
- <t:dgCol align="center" title="规格型号" query="false" field="specification" queryMode="single" width="50"></t:dgCol>
- <t:dgCol align="center" title="货品单价(元)" hidden="true" query="false" field="defaultProvider" queryMode="single"
- width="50"></t:dgCol>
- </t:datagrid>
- </body>
- </html>
- <script type="text/javascript">
- //默认选中
- function initCheck(data) {
- var ids = "${ids}";
- var idArr = ids.split(",");
- for (var i = 0; i < idArr.length; i++) {
- if (idArr[i] != "") {
- $("#goodsInfoList").datagrid("selectRecord", idArr[i]);
- }
- }
- }
- //编写自定义JS代码获得输入框中的值等父级页面调用取值
- function getReason() {
- var strId = "";
- var strBelongCategory = "";
- var strGoodsName = "";
- var strBaseUnit = "";
- var strSpecification = "";
- var defaultProvider = ""
- var selectRows = $("#goodsInfoList").datagrid('getSelections');
- for (var i = 0; i < selectRows.length; i++) {
- for (var key in selectRows[i]) {
- if (key == "id") {
- if (strId.length > 0) {
- strId += "," + selectRows[i][key];
- } else {
- strId = selectRows[i][key];
- }
- }
- if (key == "belongCategory") {
- if (strBelongCategory.length > 0) {
- strBelongCategory += "," + selectRows[i][key];
- } else {
- strBelongCategory = selectRows[i][key];
- }
- }
- if (key == "goodsName") {
- if (strGoodsName.length > 0) {
- strGoodsName += "," + selectRows[i][key];
- } else {
- strGoodsName = selectRows[i][key];
- }
- }
- if (key == "baseUnit") {
- if (strBaseUnit.length > 0) {
- strBaseUnit += "," + selectRows[i][key];
- } else {
- strBaseUnit = selectRows[i][key];
- }
- }
- if (key == "specification") {
- if (strSpecification.length > 0) {
- strSpecification += "," + selectRows[i][key];
- } else {
- strSpecification = selectRows[i][key];
- }
- }
- if (key == "defaultProvider") {
- if (defaultProvider.length > 0) {
- defaultProvider += "," + selectRows[i][key];
- } else {
- defaultProvider = selectRows[i][key];
- }
- }
- }
- }
- var maintenanceStatus = $("#maintenanceStatus").val();
- //获取计量单位(中文名)
- var baseUnitShowName = $(".datagrid-row-selected").find("[field='baseUnit']").find("div").html();
- //获取货品分类(中文名)
- var belongCategory = $(".datagrid-row-selected").find("[field='belongCategory']").find("div").html();
- //为true的话代表是耗材维修页面
- if (maintenanceStatus == "ture") {
- if (belongCategory.indexOf("车辆") >= 0) {
- return '{"code":200,"status":true,"msg":"成功","data":[{"strId":"' + strId + '","defaultProvider":"' + defaultProvider + '","strBelongCategory":"' + strBelongCategory + '","strBelongCategoryShowName":"' + belongCategory + '","strGoodsName":"' + strGoodsName + '","strBaseUnit":"' + strBaseUnit + '","strBaseUnitShowName":"' + baseUnitShowName + '","strSpecification":"' + strSpecification + '","row":"${row}"}]}';
- } else {
- return '{"code":5001,"status":false,"msg":"请选择货品分类包含“车辆”关键字的货品"}'
- }
- } else {
- //为false的话代表不是耗材维修页面
- if (belongCategory.indexOf("车辆") < 0) {
- return '{"code":200,"status":true,"msg":"成功","data":[{"strId":"' + strId + '","defaultProvider":"' + defaultProvider + '","strBelongCategory":"' + strBelongCategory + '","strBelongCategoryShowName":"' + belongCategory + '","strGoodsName":"' + strGoodsName + '","strBaseUnit":"' + strBaseUnit + '","strBaseUnitShowName":"' + baseUnitShowName + '","strSpecification":"' + strSpecification + '","row":"${row}"}]}';
- } else {
- return '{"code":5001,"status":false,"msg":"请选择货品分类包含“车辆”关键字以外的货品"}'
- }
- }
- }
- function getSelectedRow() {
- var selectRows = $("#goodsInfoList").datagrid('getSelections');
- return selectRows;
- }
- </script>
|