toTBGoods.jsp 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
  2. <%@include file="/context/mytags.jsp" %>
  3. <!DOCTYPE html >
  4. <html>
  5. <head>
  6. <title>根据当前登录用户id查询项目名称列表Part</title>
  7. <t:base type="jquery,easyui,tools"></t:base>
  8. </head>
  9. <body style="overflow-y: hidden" scroll="no">
  10. <input id="ids" type="hidden" value=${ids}>
  11. <input id="row" type="hidden" value=${row}>
  12. <input id="maintenanceStatus" type="hidden" value="${maintenanceStatus}">
  13. <t:datagrid name="goodsInfoList" checkbox="false" pagination="true" fitColumns="true" title="选择货品"
  14. actionUrl="tBMaterialController.do?goodsdatagrid&maintenanceStatus=${maintenanceStatus}" idField="id"
  15. fit="true" queryMode="group"
  16. onLoadSuccess="initCheck">
  17. <t:dgCol align="center" title="主键" field="id" hidden="true" queryMode="single" width="120"></t:dgCol>
  18. <t:dgCol align="center" title="货品分类" query="false" field="belongCategory" dictionary="t_b_goods_category,category_code,category_name, and parent_categoryid is not NULL "
  19. width="50"></t:dgCol>
  20. <t:dgCol align="center" title="货品名称" query="true" field="goodsName" queryMode="single" width="50"></t:dgCol>
  21. <t:dgCol align="center" title="计量单位" query="false" field="baseUnit" dictionary="metering_calcu_unit"
  22. queryMode="single"
  23. width="50"></t:dgCol>
  24. <t:dgCol align="center" title="规格型号" query="false" field="specification" queryMode="single" width="50"></t:dgCol>
  25. <t:dgCol align="center" title="货品单价(元)" hidden="true" query="false" field="defaultProvider" queryMode="single"
  26. width="50"></t:dgCol>
  27. </t:datagrid>
  28. </body>
  29. </html>
  30. <script type="text/javascript">
  31. //默认选中
  32. function initCheck(data) {
  33. var ids = "${ids}";
  34. var idArr = ids.split(",");
  35. for (var i = 0; i < idArr.length; i++) {
  36. if (idArr[i] != "") {
  37. $("#goodsInfoList").datagrid("selectRecord", idArr[i]);
  38. }
  39. }
  40. }
  41. //编写自定义JS代码获得输入框中的值等父级页面调用取值
  42. function getReason() {
  43. var strId = "";
  44. var strBelongCategory = "";
  45. var strGoodsName = "";
  46. var strBaseUnit = "";
  47. var strSpecification = "";
  48. var defaultProvider = ""
  49. var selectRows = $("#goodsInfoList").datagrid('getSelections');
  50. for (var i = 0; i < selectRows.length; i++) {
  51. for (var key in selectRows[i]) {
  52. if (key == "id") {
  53. if (strId.length > 0) {
  54. strId += "," + selectRows[i][key];
  55. } else {
  56. strId = selectRows[i][key];
  57. }
  58. }
  59. if (key == "belongCategory") {
  60. if (strBelongCategory.length > 0) {
  61. strBelongCategory += "," + selectRows[i][key];
  62. } else {
  63. strBelongCategory = selectRows[i][key];
  64. }
  65. }
  66. if (key == "goodsName") {
  67. if (strGoodsName.length > 0) {
  68. strGoodsName += "," + selectRows[i][key];
  69. } else {
  70. strGoodsName = selectRows[i][key];
  71. }
  72. }
  73. if (key == "baseUnit") {
  74. if (strBaseUnit.length > 0) {
  75. strBaseUnit += "," + selectRows[i][key];
  76. } else {
  77. strBaseUnit = selectRows[i][key];
  78. }
  79. }
  80. if (key == "specification") {
  81. if (strSpecification.length > 0) {
  82. strSpecification += "," + selectRows[i][key];
  83. } else {
  84. strSpecification = selectRows[i][key];
  85. }
  86. }
  87. if (key == "defaultProvider") {
  88. if (defaultProvider.length > 0) {
  89. defaultProvider += "," + selectRows[i][key];
  90. } else {
  91. defaultProvider = selectRows[i][key];
  92. }
  93. }
  94. }
  95. }
  96. var maintenanceStatus = $("#maintenanceStatus").val();
  97. //获取计量单位(中文名)
  98. var baseUnitShowName = $(".datagrid-row-selected").find("[field='baseUnit']").find("div").html();
  99. //获取货品分类(中文名)
  100. var belongCategory = $(".datagrid-row-selected").find("[field='belongCategory']").find("div").html();
  101. //为true的话代表是耗材维修页面
  102. if (maintenanceStatus == "ture") {
  103. if (belongCategory.indexOf("车辆") >= 0) {
  104. 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}"}]}';
  105. } else {
  106. return '{"code":5001,"status":false,"msg":"请选择货品分类包含“车辆”关键字的货品"}'
  107. }
  108. } else {
  109. //为false的话代表不是耗材维修页面
  110. if (belongCategory.indexOf("车辆") < 0) {
  111. 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}"}]}';
  112. } else {
  113. return '{"code":5001,"status":false,"msg":"请选择货品分类包含“车辆”关键字以外的货品"}'
  114. }
  115. }
  116. }
  117. function getSelectedRow() {
  118. var selectRows = $("#goodsInfoList").datagrid('getSelections');
  119. return selectRows;
  120. }
  121. </script>