You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

337 lines
14 KiB

2 months ago
  1. @{
  2. ViewBag.Title = "Index";
  3. Layout = "~/Views/Shared/_Index.cshtml";
  4. }
  5. <script src="~/Content/js/datepicker/WdatePicker.js"></script>
  6. <script>
  7. $(document).ready(function () {
  8. $("input.cell").keyup(function (e) {
  9. switch (e.keyCode) {
  10. // up arrow
  11. case 40:
  12. $(this).parent()
  13. .parent()
  14. .next()
  15. .children("td")
  16. .children("input.cell[name="
  17. + $(this).attr("name") + "]")
  18. .focus();
  19. break;
  20. // down arrow
  21. case 38:
  22. $(this).parent()
  23. .parent()
  24. .prev()
  25. .children("td")
  26. .children("input.cell[name="
  27. + $(this).attr("name") + "]")
  28. .focus();
  29. break;
  30. }
  31. });
  32. });</script>
  33. <script>
  34. $(function () {
  35. gridList();
  36. })
  37. function gridList() {
  38. var $gridList = $("#gridList");
  39. var queryJson = {
  40. QUOTATIONCODE: $("#txt_QUOTATIONCODE").val(),
  41. RFQCODE: $("#txt_RFQCODE").val(),
  42. RFQName: $("#txt_RFQName").val(),
  43. ItemCode: $("#txt_ItemCode").val(),
  44. ItemName: $("#txt_ItemName").val(),
  45. BeginDate: $("#txt_BeginDate").val(),
  46. EndDate: $("#txt_EndDate").val(),
  47. StatusNew: $("#cb-StatusNew").val(),
  48. StatusPublish: $("#cb-StatusPublish").val(),
  49. StatusClose: $("#cb-StatusClose").val(),
  50. ReleaseState: $("#selShow").val(),
  51. }
  52. $gridList.dataGrid({
  53. cellEdit: true,
  54. url: "/SRM/PriceInquiry/GetGridJsonByPN" + "?" + Math.random(),
  55. postData: { queryJson: JSON.stringify(queryJson) },
  56. height: $(window).height() - 270,
  57. width: $(window).width() - 300,
  58. colModel: [
  59. { label: "主键", name: "ASNID", hidden: true, key: true },
  60. {
  61. label: '操作', width: 100, align: 'center',
  62. formatter: btnLook
  63. },
  64. { label: '报价单单号', name: 'QUOTATIONCODE', width: 250, align: 'left' },
  65. /* { label: '采购组织', name: 'PURCHUGNAME', width: 100, align: 'left' },*/
  66. { label: '询价单单号', name: 'RFQCODE', width: 250, align: 'left' },
  67. { label: '询价单名称', name: 'RFQNAME', width: 250, align: 'left' },
  68. //{
  69. // label: '物料类型', name: 'ITEMTYPE', width: 100, align: 'left',
  70. // formatter: function (cellvalue) {
  71. // if (cellvalue == "Real") {
  72. // return "正式物料";
  73. // } else if (cellvalue == "Temp") {
  74. // return "临时物料";
  75. // }
  76. // else { return ""; }
  77. // }
  78. //},
  79. {
  80. label: '单据状态', name: 'STATUS', width: 100, align: 'left', hidden: true,
  81. formatter: function (cellvalue) {
  82. if (cellvalue == "New") {
  83. return "新增";
  84. } else if (cellvalue == "Publish") {
  85. return "已发布";
  86. }
  87. else if (cellvalue == "Close") {
  88. return "关闭";
  89. }
  90. else { return ""; }
  91. }
  92. },
  93. {
  94. label: '报价单状态', name: 'QUOSTATUS', width: 60, align: 'left',
  95. formatter: function (cellvalue, options, rowObject) {
  96. debugger;
  97. var html = "";
  98. if (rowObject.QUOSTATUS == "YBJ") {
  99. html += '<span class=\'label label-success\'>已报价</span>';
  100. } else if (rowObject.QUOSTATUS == "PricingApprove") {
  101. html += '<span class=\'label label-warning\'>定价通过</span>';
  102. } else if (rowObject.QUOSTATUS == "Back") {
  103. html += '<span class=\'label label-danger\'>退回</span>';
  104. } else if (rowObject.QUOSTATUS == "WBJ") {
  105. html += '<span class=\'label label-danger\'>未报价</span>';
  106. }
  107. return cellvalue = html;
  108. }
  109. },
  110. { label: '询价单创建日期', name: 'CREATEDATE', width: 150, align: 'left' },
  111. { label: '创建人', name: 'CREATEUSER', width: 100, align: 'left' },
  112. { label: 'WorkPoint', name: 'WorkPoint', width: 100, align: 'left',hidden:true },
  113. { label: '报价单创建时间', name: 'LOGTIME', hidden: true },
  114. ],
  115. gridComplete: function () {
  116. },
  117. pager: "#gridPager",
  118. sortorder: "desc",
  119. //sortname:'LOGTIME asc,CREATEDATE desc',
  120. sortname: "CREATEDATE",
  121. viewrecords: true,
  122. //multiselect: true,
  123. gridComplete: function () {
  124. var strIds = $("#gridList").jqGrid("getDataIDs");
  125. for (var i = 0; i < strIds.length; i++) {
  126. var strValue = $("#gridList").jqGrid("getCell", strIds[i], "STATUS");//得到单元格数据
  127. if (strValue == "3")
  128. $("#" + strIds[i]).find("td").css("background-color", "pink");
  129. }
  130. },
  131. rowNum: 10000
  132. });
  133. $("#warehouse a.btn-default").click(function () {
  134. $("#warehouse a.btn-default").removeClass("active");
  135. $(this).addClass("active");
  136. $('#btn_search').trigger("click");
  137. });
  138. debugger;
  139. //需要优化
  140. $("#btn_search").click(function () {
  141. if ($("#cb-StatusNew").prop('checked') == true) {
  142. debugger;
  143. $("#cb-StatusNew").val("New");
  144. }
  145. if ($("#cb-StatusPublish").prop('checked') == true) {
  146. $("#cb-StatusPublish").val('Publish');
  147. }
  148. if ($("#cb-StatusClose").prop('checked') == true) {
  149. $("#cb-StatusClose").val('Close')
  150. }
  151. var warehouse = $("#warehouse a.active").attr('data-value');
  152. var queryJson = {
  153. QUOTATIONCODE: $("#txt_QUOTATIONCODE").val(),
  154. RFQCODE: $("#txt_RFQCODE").val(),
  155. RFQName: $("#txt_RFQName").val(),
  156. ItemCode: $("#txt_ItemCode").val(),
  157. ItemName: $("#txt_ItemName").val(),
  158. BeginDate: $("#txt_BeginDate").val(),
  159. EndDate: $("#txt_EndDate").val(),
  160. ReleaseState: $("#selShow").val(),
  161. StatusNew: $("#cb-StatusNew").val(),
  162. StatusPublish: $("#cb-StatusPublish").val(),
  163. StatusClose: $("#cb-StatusClose").val(),
  164. }
  165. $gridList.jqGrid('setGridParam', {
  166. postData: { queryJson: JSON.stringify(queryJson) },
  167. }).trigger('reloadGrid');
  168. });
  169. }
  170. function btnLook(cellvalue, options, rowObject) {
  171. //return cellvalue = "<a class=\"btn btn-info dropdown-text\" onclick=\"UpLoadClick('" + rowObject.RFQCODE + "','" + rowObject.QUOTATIONCODE + "')\">报价</a>";
  172. if (rowObject.STATUS == 'Publish') {
  173. return cellvalue = "<a class=\"btn btn-info dropdown-text\" onclick=\"UpLoadClick('" + rowObject.RFQCODE + "','" + rowObject.QUOTATIONCODE + "','" + rowObject.STATUS + "','" + rowObject.WorkPoint + "')\">报价</a>";
  174. }
  175. else {
  176. return cellvalue = "<a class=\"btn btn-info dropdown-text\" onclick=\"UpLoadClick('" + rowObject.RFQCODE + "','" + rowObject.QUOTATIONCODE + "','" + rowObject.STATUS + "','" + rowObject.WorkPoint + "')\">查看</a>";
  177. }
  178. }
  179. function UpLoadClick(RFQCODE, QUOTATIONCODE, STATUS, WorkPoint) {
  180. //var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  181. //if (ids.length != 1) {
  182. // $.modalAlert("请选择一行数据进行查看!");
  183. // return;
  184. //}
  185. debugger;
  186. if (QUOTATIONCODE == "暂未报价") {
  187. QUOTATIONCODE = '';
  188. }
  189. $.modalOpen2({
  190. id: "Cartonaddtest",
  191. title: "详细信息",
  192. url: "/SRM/PriceInquiry/QuotedPriceDetail?RFQCODE=" + RFQCODE + "&" + Math.random() + "&QUOTATIONCODE=" + QUOTATIONCODE + "&STATUS=" + encodeURI(encodeURI(STATUS)) + "&WorkPoint=" + WorkPoint,
  193. width: "95%",
  194. height: "95%",
  195. btn: null
  196. });
  197. }
  198. debugger;
  199. function ChcekboxChange() {
  200. debugger;
  201. $("#changechaeckbox").find("input[type='checkbox']").each(function (i, n) {
  202. if ($(this).prop('checked') == false) {
  203. $(this).val("");
  204. }
  205. });
  206. }
  207. </script>
  208. <iframe id="ifrm" src="" width="0" height="0"></iframe>
  209. <div class="topPanel" style="height:125px">
  210. <div class="search">
  211. <table>
  212. <tr>
  213. <td>
  214. <label>报价单单号:</label>
  215. </td>
  216. <td>
  217. <div class="input-group">
  218. <input id="txt_QUOTATIONCODE" type="text" class="form-control" placeholder="报价单编号" style="width: 150px;">
  219. </div>
  220. </td>
  221. <td>
  222. <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;询价单单号:</label>
  223. </td>
  224. <td>
  225. <div class="input-group">
  226. <input id="txt_RFQCODE" type="text" class="form-control" placeholder="询价单编号" style="width: 150px;">
  227. </div>
  228. </td>
  229. <td>
  230. <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;询价单名称:</label>
  231. </td>
  232. <td>
  233. <div class="input-group">
  234. <input id="txt_RFQName" type="text" class="form-control" placeholder="询价单名称" style="width: 150px;">
  235. </div>
  236. </td>
  237. <td style="display:none">
  238. <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;物料编码:</label>
  239. </td>
  240. <td style="display:none">
  241. <div class="input-group">
  242. <input id="txt_ItemCode" type="text" class="form-control" placeholder="物料编码" style="width: 150px;">
  243. </div>
  244. </td>
  245. </tr>
  246. <tr>
  247. <td style="display:none">
  248. <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;物料名称:</label>
  249. </td>
  250. <td style="display:none">
  251. <div class="input-group">
  252. <input id="txt_ItemName" type="text" class="form-control" placeholder="物料名称" style="width: 150px;">
  253. </div>
  254. </td>
  255. <td>
  256. <label>开始时间(从):</label>
  257. </td>
  258. <td>
  259. <div class="input-group">
  260. <input type="text" name="txt_BeginDate" id="txt_BeginDate" class="form-control" style="width: 150px;" maxlength="10" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" placeholder="开始时间(从)" />
  261. </div>
  262. </td>
  263. <td>
  264. <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;开始时间(到):</label>
  265. </td>
  266. <td>
  267. <div class="input-group">
  268. <input type="text" name="txt_EndDate" id="txt_EndDate" class="form-control" style="width: 150px;" maxlength="10" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd', minDate: txt_BeginDate.value })" placeholder="开始时间(到)" />
  269. </div>
  270. </td>
  271. <td>
  272. <label>&nbsp;&nbsp;&nbsp;询价状态:</label>
  273. </td>
  274. <td>
  275. <div class="input-group">
  276. <select id="selShow" name="F_Target" class="form-control" style="width: 100px;">
  277. <option value="1">显示全部</option>
  278. <option value="2">已报价</option>
  279. <option value="0" selected="selected">未报价</option>
  280. </select>
  281. </div>
  282. </td>
  283. <td>&nbsp;&nbsp;&nbsp;</td>
  284. <td>
  285. <span class="input-group-btn">
  286. <button id="btn_search" type="button" class="btn btn-info"><i class="fa fa-search"></i></button>
  287. </span>
  288. </td>
  289. <td style="padding-left: 10px;"></td>
  290. </tr>
  291. <tr>
  292. <td style="display:none">
  293. <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;单据状态:</label>
  294. </td>
  295. <td style="display:none">
  296. <div class="input-group" id="changechaeckbox">
  297. <input type="checkbox" name="State" value="" id="cb-StatusNew" style="width:30px" onchange="ChcekboxChange()" /><label for="cb-NoQuotedPrice">新增</label>
  298. <input type="checkbox" name="State" value="" id="cb-StatusPublish" style="width:30px" onchange="ChcekboxChange()" /><label for="cb-QuotedPrice">已发布</label>
  299. <input type="checkbox" name="State" value="" id="cb-StatusClose" style="width:30px" onchange="ChcekboxChange()" /><label for="cb-Close">关闭</label>
  300. </div>
  301. </td>
  302. </tr>
  303. </table>
  304. </div>
  305. </div>
  306. <div class="gridPanel">
  307. <table id="gridList"></table>
  308. <div id="gridPager"></div>
  309. </div>