天津投入产出系统后端
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.
 
 
 
 
 
 

301 lines
11 KiB

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/AppMaster.Master"
Inherits="System.Web.Mvc.ViewPage<QMAPP.MD.Web.Models.PbomItemModel>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
PBOM树管理
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%=Html.QPEdit() %>
<table>
<%--<tr>
<td>
<div title="PBOM" style="padding:5px;" align="left">
<%=Html.QTreeView("PbomItemTree", "/Pbom/GetTreeData?PBOM_CODE=" + Model.PBOM_CODE, false)%>
</div>
</td>
</tr>--%>
<tr>
<td>
<div class="panel datagrid">
<table id="tg"></table>
</div>
</td>
</tr>
</table>
<%=Html.QPEnd() %>
<%=Html.Hidden("selectKey")%>
<%=Html.HiddenFor(p => p.PBOM_CODE)%>
<%=Html.HiddenFor(p => p.ROUTE_CODE)%>
<%=Html.HiddenFor(p => p.MATERIAL_CODE)%>
<%=Html.HiddenFor(p => p.PID)%>
<%=Html.Hidden("PBOM_CODE_PAR")%>
<%=Html.Hidden("MATERIAL_CODE_PAR")%>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ToolContent" runat="server">
<table id="_tableButton" cellpadding="0" cellspacing="0">
<tr>
<td>
<%-- <%=Html.QTButtonSearch("PbomItem", "List", "List(1)", QMAPP.Common.Web.SystemLimit.isLimt)%>
--%>
<%=Html.QTButtonAdd("PbomItem", "Add", "Add();", QMAPP.Common.Web.SystemLimit.isLimt)%>
<%-- <%=Html.QTButtonUpdate("PbomItem", "Edit", "Edit()", QMAPP.Common.Web.SystemLimit.isLimt)%>
--%>
<%=Html.QTButtonDelete("PbomItem", "Delete", "Delete()", QMAPP.Common.Web.SystemLimit.isLimt)%>
<%=Html.QTButton("return", "List", QMFrameWork.WebUI.IconCls.back, "Return();", (s, f) => { return true; })%>
</td>
</tr>
</table>
<script language="javascript" type="text/javascript">
var parentCode = "";
var myCode = "";
var pid = "";
var isChildren = false;
var isAll = 0;
$(function () {
ListTreegrid();
});
/*响应节点点击事件*/
function onClickRow(row) {
//debugger;
pid = row.PID;
myCode = row.Id;
var parent = $('#tg').treegrid('getParent', row.PID);
if (parent == null) {
//alert("根节点");
//return;
parentCode = "";
} else {
parentCode = parent.Id;
}
var children = $('#tg').treegrid('getChildren', row.PID);
isChildren = false;
if (children[0] != null) {
// alert("子节点");
// return;
//有子节点
isChildren = true;
}
}
//查询
// function List() {
// //debugger ;
// isAll = 0;
// ListTreegrid();
// }
// function ListCode() {
// //debugger;
// isAll = 1;
// ListTreegrid();
// }
//刷新treegrid
function ListTreegrid() {
var PBOM_CODE = $("#PBOM_CODE").val();
// //汉字乱码
// var MATERIAL_NAME = escape($("#MATERIAL_NAME").val());
// var COLOR = $('#COLOR').combobox('getValue');
// var HBTYPE = $('#HBTYPE').combobox('getValue');
$('#tg').treegrid({
// title: 'TreeGrid with Footer',
// iconCls: 'icon-ok',
width: 1160,
height: 466,
rownumbers: false,
animate: false,
collapsible: true,
fitColumns: true,
url: '/Pbom/GetTreeGrid?PBOM_CODE=' + PBOM_CODE,
method: 'get',
idField: 'PID',
treeField: 'Text',
showFooter: false,
onClickRow: onClickRow,
columns: [[
{ title: 'PID', field: 'PID', width: 0, hidden: true },
{ title: '物料名称', field: 'Text', width: 240 },
{ title: '物料号', field: 'Id', width: 120 },
{ title: 'PBOM', field: 'PBOM_CODE', width: 100 },
{ title: '数量', field: 'UNIT_SUM', width: 50 },
// { title: '配置', field: 'HBTYPE', width: 50 },
// { title: '包装数量', field: 'STD_QTY', width: 50 },
// { title: '外购件', field: 'OUTSOURCE', width: 50 },
// { title: '描述', field: 'REMARK', width: 100 }
]]
});
}
//查询
function List() {
// location.reload();
ListTreegrid();
}
//添加treeGrid
function Add() {
// debugger;
var ROUTE_CODE = $('#ROUTE_CODE').val();
var PBOM_CODE = $('#PBOM_CODE').val();
if (pid != "") {
//添加子
openAppWindow1('添加PBOM',
'PbomItemTreeEdit?PID=' + pid + '&isEdit=1&ROUTE_CODE=' + ROUTE_CODE,
'520',
'480');
} else {
//添加根
openAppWindow1('添加PBOM',
'PbomItemTreeEdit?PID=' + PBOM_CODE + '&isEdit=0&ROUTE_CODE=' + ROUTE_CODE,
'520',
'480');
}
}
//添加PBOM
function AddTreeOld() {
// debugger;
var ROUTE_CODE = $('#ROUTE_CODE').val();
var PBOM_CODE = $('#PBOM_CODE').val();
var tree = $('#PbomItemTree');
if (tree[0].childElementCount >0) {
var node = $('#PbomItemTree').tree('getSelected');
if (node == null) {
// MSI("提示", "请选择父PBOM。");
// return;
//添加根
openAppWindow1('添加PBOM',
'PbomItemTreeEdit?PID=' + PBOM_CODE + '&isEdit=0&ROUTE_CODE=' + ROUTE_CODE,
'520',
'480');
} else {
//添加子
openAppWindow1('添加PBOM', 'PbomItemTreeEdit?PID=' + node.id + '&isEdit=1&ROUTE_CODE=' + ROUTE_CODE, '520', '480');
}
} else {
//添加根
openAppWindow1('添加PBOM', 'PbomItemTreeEdit?PID=' + PBOM_CODE + '&isEdit=0&ROUTE_CODE=' + ROUTE_CODE, '520', '480');
}
}
//编辑PBOM
// function Edit() {
// var node = $('#PbomItemTree').tree('getSelected');
// if (node == null) {
// MSI("提示", "请选择PBOM。");
// return;
// }
// openAppWindow1('编辑PBOM', 'PbomItemTreeEdit?PID=' + node.id + '&isEdit=2', '520', '480');
// }
//删除PBOM
function Delete() {
if (pid == "") {
MSI("提示", "请选择PBOM。");
return;
}
//debugger;
if (isChildren) {
MSI("提示", "PBOM下有数据不允许删除。");
return;
}
MSQ("提示", "确定要删除选中的PBOM吗?", function () {
$.ajax({
type: "POST",
url: "/Pbom/PbomItemTreeDelete?PID=" +pid,
cache: false,
async: false,
dataType: "json",
data: {},
success: function (data) {
MSI("提示", data);
// if (data == "删除成功") {
// $('#PbomItemTree').tree('remove', node.target);
// }
},
error: function () {
//alert("no");
}
});
//$('#PbomItemTree').tree('remove', node.target);
$('#tg').treegrid('remove', pid);
});
}
//删除PBOM
function DeleteTreeOld() {
var node = $('#PbomItemTree').tree('getSelected');
if (node == null) {
MSI("提示", "请选择PBOM。");
return;
}
//debugger;
if (node.children != undefined) {
if (node.children.length > 0) {
MSI("提示", "PBOM下有数据不允许删除。");
return;
}
}
MSQ("提示", "确定要删除选中的PBOM吗?", function () {
$.ajax({
type: "POST",
url: "/Pbom/PbomItemTreeDelete?PID=" + node.id,
cache: false,
async: false,
dataType: "json",
data: {},
success: function (data) {
MSI("提示", data);
// if (data == "删除成功") {
// $('#PbomItemTree').tree('remove', node.target);
// }
},
error: function () {
//alert("no");
}
});
$('#PbomItemTree').tree('remove', node.target);
});
}
//添加节点
// function AddNode(id, code, text) {
// var node = $('#PbomItemTree').tree('getSelected');
// $('#PbomItemTree').tree('append', {
// parent: (node ? node.target : null),
// data: [{
// id: id,
// code: code,
// text: text,
// checked: true
// }]
// });
// }
// //更新节点
// function UpdateNode(id, text) {
// var node = $('#PbomItemTree').tree('getSelected');
// if (node) {
// node.text = text;
// $('#PbomItemTree').tree('update', node);
// }
// }
//返回
function Return() {
var returnUrl = "/Pbom/List";
window.location.href = returnUrl;
}
</script>
</asp:Content>