|
|
@{ ViewBag.Title = "Index"; Layout = "~/Views/Shared/_Index.cshtml"; } <link href="~/Content/js/select2/select2.min.css" rel="stylesheet" /> <link href="~/Content/js/dialog/dialog.css" rel="stylesheet" /> <script src="~/Content/js/datepicker/WdatePicker.js"></script> <script src="~/Content/js/select2/select2.min.js"></script> <script> $(function () { $.ajax({ url: "/SRM/InvAdd/ClearInvTemp?" + Math.random(), async: false, datatype: "json"
}) gridList(); })
function gridList() { debugger; //var status = ""; //if ($("#AddStatus").prop("checked") == true) // status += "'New'," //if ($("#PubStatus").prop("checked") == true) // status += "'Publish'," ////if ($("#ExamStatus").prop("checked") == true) //// status += "'Examine'," ////if ($("#HasExamStatus").prop("checked") == true) //// status += "'HasExamine'," //if ($("#CloseStatus").prop("checked") == true) // status += "'Close,'" var queryJson = { PruOrganize: $("#txt_poorg").val(), PruTeam: $("#txt_PoTeam").val(), RFQCode: $("#txt_RFQNO").val(), RFQName: $("#txt_INVName").val(), SupplierCode: $("#txt_VenCode").val(), SupplierName: $("#txt_VenName").val(), InvCode: $("#txt_INVCode").val(), InvName: $("#txt_INVName").val(), InvStd: $("#txt_INVStd").val(), TimeFrom: $("#txt_FromDate").val(), TimeTo: $("#txt_EndDate").val(), ReleaseState: $("#selShow").val(), } $("#gridList").dataGrid({ cellEdit: true, url: "/SRM/PriceInquiry/GetGridJson" + "?" + Math.random(), datatype:'json', postData: { JSON: JSON.stringify(queryJson) }, height: $(window).height() - 270, width: $(window).width() - 300, loadonce:false, colModel: [ { label: '操作', width: 130, align: 'center', formatter: btnLook, }, { label: '询价单号', name: 'RFQCODE', width: 120, align: 'left', key: true }, { label: '询价单名称', name: 'RFQNAME', width: 150, align: 'left' }, { label: '状态', name: 'STATUS', width: 60, align: 'left', formatter: function (cellvalue, options, rowObject) { debugger; var html = ""; if (rowObject.STATUS == "新增") { html += '<span class=\'label label-success\'>新增</span>'; } else if (rowObject.STATUS == "发布") { html += '<span class=\'label label-warning\'>发布</span>'; } else if (rowObject.STATUS == "关闭") { html += '<span class=\'label label-danger\'>关闭</span>'; } else if (rowObject.STATUS == "定价通过") { html += '<span class=\'label label-success\'>定价通过</span>'; } else if (rowObject.STATUS == "OA待审核") { html += '<span class=\'label label-warning\'>OA待审核</span>'; } else if (rowObject.STATUS == "OA已审核") { html += '<span class=\'label label-success\'>OA已审核</span>'; } else if (rowObject.STATUS == "OA审核拒绝") { html += '<span class=\'label label-danger\'>OA审核拒绝</span>'; } else if (rowObject.STATUS == "未分配") { html += '<span class=\'label label-info\'>未分配</span>'; } else if (rowObject.STATUS == "已分配") { html += '<span class=\'label label-success\'>已分配</span>'; } else if (rowObject.STATUS == "退回") { html += '<span class=\'label label-danger\'>退回</span>'; } return cellvalue = html; } },
{ label: 'HIDDSTATUS', name: 'HIDDSTATUS', width: 150, align: 'left',hidden:true }, { label: '开始日期', name: 'BEGINDATE', width: 150, align: 'left', hidden: true }, { label: 'ADDITION1', name: 'ADDITION1', width: 150, align: 'left', hidden: true }, { label: 'ADDITION2', name: 'ADDITION2', width: 150, align: 'left', hidden: true }, //{ label: '采购组织', name: 'PURORG', width: 100, align: 'left' }, //{ label: '采购负责人', name: 'PURTEAM', width: 100, align: 'left' }, { label: '单据创建时间', name: 'LOGDATE', width: 150, align: 'left' }, { label: '维护人', name: 'LOGUSER', width: 100, align: 'left' }, { label: '站点', name: 'workpoint', width: 90, align: 'left' }, ], pager: "#gridPager", sortorder: "desc", sortname: 'CREATETIME ', viewrecords: true, multiselect: true, gridComplete: function () {
}, rowNum: 10000, subGrid: true, // (1)开启子表格支持 subGridRowExpanded: function (subgrid_id, rowid) { // (2)子表格容器的id和需要展开子表格的行id,将传入此事件函数 $("#gridList").jqGrid("setSelection", rowid, false); bindSubGrid(subgrid_id, rowid) }, });
} function bindSubGrid(subgrid_id, rowid) { $("#gridList").jqGrid("setSelection", rowid, false); var subgrid_table_id; subgrid_table_id = subgrid_id + "_t"; // (3)根据subgrid_id定义对应的子表格的table的id
var subgrid_pager_id; subgrid_pager_id = subgrid_id + "_pgr" // (4)根据subgrid_id定义对应的子表格的pager的id
// (5)动态添加子报表的table和pager $("#" + subgrid_id).html("<table id='" + subgrid_table_id + "' class='scroll'></table><div id='" + subgrid_pager_id + "' class='scroll'></div>"); var RFQCODE = $("#gridList").jqGrid('getRowData', rowid).RFQCODE; var WorkPoint = $("#gridList").jqGrid('getRowData', rowid).workpoint; // (6)创建jqGrid对象 $("#" + subgrid_table_id).dataGrid({ cellEdit: true, url: "/SRM/SORRFQ/GetSubGridJson?RFQCODE=" + RFQCODE + "&WorkPoint=" + WorkPoint + "&" + Math.random(), // (7)子表格数据对应的url,注意传入的contact.id参数 colModel: [ { label: '主键', name: 'ID', width: 150, align: 'left', hidden: true, key: true }, { label: '物料代码', name: 'itemcode', width: 150, align: 'left' }, { label: '物料描述', name: 'itemname', width: 150, align: 'left' }, { label: '物料规格', name: 'invstd', width: 150, align: 'lreft' }, { label: '单位', name: 'unit', width: 50, align: 'left' }, { label: '询价备注', name: 'memo', width: 150, align: 'left' }, { label: '预计需求量', name: 'REQUESTQUANTITY', width: 50, align: 'left' }, ], multiselect: true, pager: subgrid_pager_id, //shrinkToFit: true,//宽度自适应 prmNames: { search: "search" }, viewrecords: true, height: "100%", rowNum: 20 }); } function Search() { debugger; //var status = ""; //if ($("#AddStatus").prop("checked") == true) // status += "'New'," //if ($("#PubStatus").prop("checked") == true) // status += "'Publish'," ////if ($("#ExamStatus").prop("checked") == true) //// status += "'Examine'," ////if ($("#HasExamStatus").prop("checked") == true) //// status += "'HasExamine'," //if ($("#CloseStatus").prop("checked") == true) // status += "'Close',"
var queryJson = { PruOrganize: $("#txt_poorg").val(), PruTeam: $("#txt_PoTeam").val(), RFQCode: $("#txt_RFQNO").val(), RFQName: $("#txt_RFQName").val(), SupplierCode: $("#txt_VenCode").val(), SupplierName: $("#txt_VenName").val(), InvCode: $("#txt_INVCode").val(), InvName: $("#txt_INVName").val(), InvStd: $("#txt_INVStd").val(), TimeFrom: $("#txt_FromDate").val(), TimeTo: $("#txt_EndDate").val(), ReleaseState: $("#selShow").val(),
} $("#gridList").jqGrid().setGridParam({ postData: { JSON: JSON.stringify(queryJson) } }).trigger('reloadGrid') } function btnpub() { debugger; var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); if (ids.length <= 0) { $.modalAlert("请选择要发布的数据!", "warning"); return; } for(var i=0;i<ids.length;i++){ var data = $("#gridList").jqGrid('getRowData', ids[i]); if (data.HIDDSTATUS != "新增") { $.modalAlert(data.RFQCODE + ":当前状态无法发布!", "warning"); return; }
} var json = JSON.stringify(ids)
$.ajax({ url: "/SRM/SORRFQ/Publish?json=" + json + "&" + Math.random(), async: false, success: function (data) { $.modalAlert(data, "warning"); } }) $("#gridList").jqGrid().setGridParam({ datatype: 'json' }).trigger('reloadGrid') }
function btnpubJS() { debugger; var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); if (ids.length <= 0) { $.modalAlert("请选择要发布的数据!", "warning"); return; } for (var i = 0; i < ids.length; i++) { var data = $("#gridList").jqGrid('getRowData', ids[i]); if (data.HIDDSTATUS == "新增" || data.HIDDSTATUS == "退回") { var json = JSON.stringify(ids)
$.ajax({ url: "/SRM/PriceInquiry/JSPublish?json=" + json + "&" + Math.random(), async: false, success: function (data) { $.modalAlert(data, "warning"); } }) $("#gridList").jqGrid().setGridParam({ datatype: 'json' }).trigger('reloadGrid')
} else { $.modalAlert(data.RFQCODE + ":当前状态无法发布!", "warning"); return; }
} }
function btn_close() { var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); if (ids.length <= 0) { $.modalAlert("请选择要关闭的数据!", "warning"); return; } var json = JSON.stringify(ids)
$.modalConfirm("请确认是否关闭询价单!", function (r) { if (r) { $.ajax({ url: "/SRM/SORRFQ/Close?json=" + json + "&" + Math.random(), async: false, success: function (data) { $("#gridList").jqGrid().setGridParam({ datatype: 'json' }).trigger('reloadGrid') $.modalAlert(data, "warning"); } }) } });
} function btnLook(cellvalue, options, rowObject) { if (rowObject.HIDDSTATUS == "新增" || rowObject.HIDDSTATUS == "退回") { return cellvalue = "<a class=\"btn btn-warning dropdown-text\" onclick=\"UpLoadClick1('" + rowObject.RFQCODE + "','" + rowObject.workpoint + "','" + rowObject.HIDDSTATUS + "')\">修改 </a> <a class=\"btn btn-info dropdown-text\" onclick=\"UpLoadRegistClickByDJ('" + rowObject.RFQCODE + "','" + rowObject.workpoint + "','" + rowObject.HIDDSTATUS + "')\">审核报价</a>"; } else { return cellvalue = "<a class=\"btn btn-warning dropdown-text\" onclick=\"UpLoadClick('" + rowObject.RFQCODE + "','" + rowObject.workpoint + "','" + rowObject.HIDDSTATUS + "')\">详情 </a> <a class=\"btn btn-info dropdown-text\" onclick=\"UpLoadRegistClickByDJ('" + rowObject.RFQCODE + "','" + rowObject.workpoint + "','" + rowObject.HIDDSTATUS + "')\">审核报价</a>"; } } //查看 function UpLoadClick(rfqcode, workpoint, HIDDSTATUS) { debugger; $.modalOpenClean({ id: "RFQ", title: "查看", url: "/SRM/RFQMes/Index?rfqcode=" + rfqcode + "&" + Math.random(), width: "90%", height: "90%", callBack: function (iframeId) { top.frames[iframeId].submitForm(); top.frames[iframeId].Close(); $("#gridList").jqGrid().setGridParam({ datatype: 'json' }).trigger('reloadGrid') }
}) }
function UpLoadRegistClick(rfqcode, workpoint, HIDDSTATUS) { $.modalOpenbyxu({ id: "RFQChange", title: "审核报价", url: "/SRM/RFQMes/WatchBJ" + "?rfqno=" + rfqcode + "&" + Math.random() + "&workpoint=" + workpoint + "&HIDDSTATUS=" + encodeURI(encodeURI(HIDDSTATUS)), width: "80%", height: "90%", callBack: function (iframeId) { debugger; top.frames[iframeId].submitForm(); $("#gridList").jqGrid().setGridParam({ datatype: 'json' }).trigger('reloadGrid') $.modalAlert(data, "warning"); $.modalClose(); alert("666"); //top.frames[iframeId].Close(); //$("#gridList").jqGrid().setGridParam({ datatype: 'json' }).trigger('reloadGrid')
}
})
} function UpLoadRegistClickByDJ(rfqcode, workpoint, HIDDSTATUS) { $.modalOpenbyxu({ id: "RFQChange", title: "审核报价", url: "/SRM/PriceInquiry/ReviewPrice" + "?rfqno=" + rfqcode + "&" + Math.random() + "&workpoint=" + workpoint + "&HIDDSTATUS=" + encodeURI(encodeURI(HIDDSTATUS)), width: "80%", height: "90%", callBack: function (iframeId) { debugger; top.frames[iframeId].submitForm(); $("#gridList").jqGrid().setGridParam({ datatype: 'json' }).trigger('reloadGrid') $.modalAlert(data, "warning"); $.modalClose(); alert("666"); //top.frames[iframeId].Close(); //$("#gridList").jqGrid().setGridParam({ datatype: 'json' }).trigger('reloadGrid')
}
})
}
//新增 function btnCreate() { debugger; var sfqcode=""; $.modalOpen2({ id: "PriceInquiryAdd", title: "新增", url: "/SRM/PriceInquiry/PriceInquiryAdd?" + Math.random() + "&status=" + 2, width: "95%", height: "95%", callBack: function (iframeId) { top.frames[iframeId].submitForm(); } }) }
//修改 function UpLoadClick1(rfqcode, workpoint, HIDDSTATUS) { debugger; if (HIDDSTATUS == "新增" || HIDDSTATUS == "退回") {
$.modalOpen2({ id: "RFQChange", title: "修改", url: "/SRM/PriceInquiry/PriceInquiryAdd?rfqcode=" + rfqcode + "&" + Math.random() + "&status=" + 1, width: "90%", height: "90%", callBack: function (iframeId) { top.frames[iframeId].submitForm(); }
}) } else { $.modalAlert("当亲状态不可修改!", "warning"); return; }
} function btn_delete() { //var ids = $("#gridList").jqGridRowValue().RFQCODE; var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); if (ids.lenth <= 0) { $.modalAlert("请选择要删除的数据!", "warning"); return; } for (var i = 0; i < ids.length; i++) { var data = $("#gridList").jqGrid('getRowData', ids[i]); if (data.HIDDSTATUS == "发布") { $.modalAlert(data.RFQCODE + ":当前订单已发布无法删除!", "warning"); return; } } var json = JSON.stringify(ids) $.modalConfirm("请确认是否删除询价单!", function (r) { if (r) {
$.ajax({ url: "/SRM/SORRFQ/DELETE?json=" + json + "&" + Math.random(), async: false, datatype: 'json', success: function (data) { $.modalAlert(data, "warning"); } }) $("#gridList").jqGrid().setGridParam({ datatype: 'json' }).trigger('reloadGrid') } });
}
function btn_CleanOA() { var rowdata = []; var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); if (ids.lenth <= 0) { $.modalAlert("请选择要撤销的数据!", "warning"); return; } for (var i = 0; i < ids.length; i++) { var data = $("#gridList").jqGrid('getRowData', ids[i]); if (data.HIDDSTATUS != "OA待审核") { $.modalAlert(data.RFQCODE + ":当前订单已发布无法撤销!", "warning"); return; } var obj = { RFQCODE: data.RFQCODE, ADDITION1: data.ADDITION1, ADDITION2: data.ADDITION2 } rowdata.push(obj); } Json = JSON.stringify(rowdata) $.ajax({ url: "/SRM/RFQMes/CleanAgreeByOA", data: { json: Json }, type: "post", dataType: "json", async: false, success: function (data) { //SetCols11(); //gridList1(); debugger; $("#gridList").jqGrid().setGridParam({ datatype: 'json' }).trigger('reloadGrid') $.modalAlert(data.message, data.state); }
}) }
//分配采购 function btnPurchaserPersAllocation() { debugger; var RFQCODE = ''; var PURORG = ''; var PURTEAM = ''; var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); if (ids.lenth <= 0) { $.modalAlert("请选择要分配的数据!", "warning"); return; } for (var i = 0; i < ids.length; i++) { var data = $("#gridList").jqGrid('getRowData', ids[i]); RFQCODE = data.RFQCODE PURTEAM = data.PURTEAM PURORG = data.PURORG if (data.HIDDSTATUS != "未分配") { $.modalAlert("当亲状态不可操作!", "warning"); return; } } $.modalOpen2({ id: "PurchaserAllocation", title: "分配采购", url: "/SRM/PriceInquiry/PurchaserAllocation?rfqcode=" + RFQCODE + "&" + Math.random() + "&status=" + 1 + "&PURTEAM=" + encodeURI(encodeURI(PURTEAM)) + "&PURORG=" + encodeURI(encodeURI(PURORG)), width: "95%", height: "95%", callBack: function (iframeId) { top.frames[iframeId].submitForm(); }
}) }
//分配供应商 function btnVendorPersAllocation() { debugger; var RFQCODE = ''; var PURORG = ''; var PURTEAM = ''; var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); if (ids.lenth <= 0) { $.modalAlert("请选择要分配的数据!", "warning"); return; } for (var i = 0; i < ids.length; i++) { var data = $("#gridList").jqGrid('getRowData', ids[i]); RFQCODE = data.RFQCODE PURTEAM = data.PURTEAM PURORG = data.PURORG if (data.HIDDSTATUS != "已分配") { $.modalAlert("当亲状态不可操作!", "warning"); return; } } $.modalOpen2({ id: "VendorPersAllocation", title: "分配供应商", url: "/SRM/PriceInquiry/VendorPersAllocation?rfqcode=" + RFQCODE + "&" + Math.random() + "&status=" + 1 + "&PURTEAM=" + encodeURI(encodeURI(PURTEAM)) + "&PURORG=" + encodeURI(encodeURI(PURORG)), width: "95%", height: "95%", callBack: function (iframeId) { top.frames[iframeId].submitForm(); }
}) }
</script> <div class="topPanel" style="height:200px"> <div class="toolbar"> <div class="btn-group"> <a id="CreateRFQ" authorize="yes" style="margin-left:3px;" class="btn btn-info" onclick="btnCreate()"><i class="fa fa-pencil-square-o"></i>新增</a> <a id="PubRFQ" authorize="yes" style="margin-left:3px;" class="btn btn-info" onclick="btnpub()"><i class="fa fa-pencil-square-o"></i>发布</a> <a id="btnpubJS" authorize="yes" style="margin-left:3px;" class="btn btn-info" onclick="btnpubJS()"><i class="fa fa-pencil-square-o"></i>技术发布</a> <a id="PurchaserPersAllocation" authorize="yes" style="margin-left:3px;" class="btn btn-info" onclick="btnPurchaserPersAllocation()"><i class="fa fa-pencil-square-o"></i>采购员分配</a> </div> <div class="btn-group" style="display:block;padding-left:2px;"> <a id="VendorPersAllocation" authorize="yes" style="margin-left:3px;" class="btn btn-info" onclick="btnVendorPersAllocation()"><i class="fa fa-pencil-square-o"></i>供应商分配</a> <a id="CloseRFQ" authorize="yes" style="margin-left:3px;" class="btn btn-warning" onclick="btn_close()"><i class="fa fa-pencil-square-o"></i>关闭</a> <a id="deleteRFQ" authorize="yes" style="margin-left:3px;" class="btn btn-danger" onclick="btn_delete()"><i class="fa fa-pencil-square-o"></i>删除</a> <a id="CleanOA" authorize="yes" style="margin-left:3px;" class="btn btn-danger" onclick="btn_CleanOA()"><i class="fa fa-pencil-square-o"></i>取消OA流程</a> <a class="btn btn-info" style="margin-left:3px;" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a> </div> <script>$('.toolbar').authorizeButton()</script> </div> <div class="search"> <table> <tr> <td> <label>询价单号:</label> </td> <td> <div class="input-group"> <input id="txt_RFQNO" type="text" class="form-control" placeholder="询价单号" style="width: 120px;"> </div> </td> <td> <label> 询价单名称:</label> </td> <td> <div class="input-group"> <input id="txt_RFQName" type="text" class="form-control" placeholder="询价单名称" style="width: 100px;"> </div> </td>
<td> <label> 单据日期(从):</label> </td> <td> <div class="input-group"> <input type="text" name="txt_FromDate" id="txt_FromDate" class="form-control" style="width: 100px;" maxlength="10" onclick=" WdatePicker({dateFmt:'yyyy-MM-dd'})" placeholder="单据日期(从)" />
</div> </td>
<td> <label> 单据日期(到):</label> </td> <td> <div class="input-group"> <input type="text" name="txt_NoDate" id="txt_EndDate" class="form-control" style="width: 100px;" maxlength="10" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd', minDate: txt_FromDate.value })" placeholder="单据日期(到)" />
</div> </td>
</tr> <tr> <td> <label>采购负责人:</label> </td> <td> <div class="input-group"> <input id="txt_PoTeam" type="text" class="form-control" placeholder="采购负责人" style="width: 120px;"> </div> </td>
<td> <label> 采购组织:</label> </td> <td> <div class="input-group"> <input type="text" name="txt_poorg" id="txt_poorg" class="form-control" style="width: 100px;" maxlength="10" placeholder="采购组织" /> </div> </td> <td> <label> 供应商编码:</label> </td> <td> <div class="input-group"> <input id="txt_VenCode" type="text" class="form-control" placeholder="供应商编码" style="width: 100px;">
</div> </td> <td> <label> 供应商名称:</label> </td> <td> <div class="input-group"> <input id="txt_VenName" type="text" class="form-control" placeholder="供应商名称" style="width: 100px;"> </div> </td>
</tr> <tr> <td> <label>物料编码:</label> </td> <td> <div class="input-group"> <input id="txt_INVCode" type="text" class="form-control" placeholder="物料编码" style="width: 120px;"> </div> </td>
<td> <label> 物料名称:</label> </td> <td> <div class="input-group"> <input id="txt_INVName" type="text" class="form-control" placeholder="物料名称" style="width: 100px;"> </div> </td>
<td> <label> 物料规格:</label> </td> <td> <div class="input-group"> <input id="txt_INVStd" type="text" class="form-control" placeholder="物料规格" style="width: 100px;"> </div> </td> <td> <label>询价单状态: </label> </td> <td> <div class="input-group"> <select id="selShow" name="F_Target" class="form-control" style="width: 100px;"> <option value="">显示全部</option> <option value="New" selected>新增</option> <option value="Publish">发布</option> <option value="PricingApprove">定价通过</option> <option value="Close">关闭</option> <option value="PricingApproveByOA">OA待审核</option> <option value="PricingApproveByOASH">OA已审核</option> <option value="PricingApproveByOABack">OA审核拒绝</option> </select> </div> </td> <td> </td> <td> <span class="input-group-btn"> <button id="btn_search" type="button" class="btn btn-info" onclick="Search()"><i class="fa fa-search"></i></button> </span> </td>
</tr>
</table> </div> </div> <div class="gridPanel"> <table id="gridList"></table> <div id="gridPager"></div> </div>
|