一厂MES,含注塑,喷涂,冲孔
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.
 
 
 
 
 

550 lines
21 KiB

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CommonlyInspectionVersion.aspx.cs" Inherits="MESWebSite.Manage.CommonlyInspectionVersion" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="/CSS/Basics.css" rel="stylesheet" />
<link href="/Scripts/jquery-easyui-1.4.3/themes/metro/easyui.css" rel="stylesheet" type="text/css" />
<link href="/Scripts/jquery-easyui-1.4.3/themes/icon.css" rel="stylesheet" type="text/css" />
<link href="/Scripts/jquery-easyui-1.4.3/themes/color.css" rel="stylesheet" type="text/css" />
<script src="/Scripts/jquery-easyui-1.4.3/jquery.min.js" type="text/javascript"></script>
<script src="/Scripts/jquery-easyui-1.4.3/jquery.easyui.min.js" type="text/javascript"></script>
<script src="/Scripts/jquery-easyui-1.4.3/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script src="/Scripts/MyJs.js" type="text/javascript"></script>
<style>
#w td {
padding: 5px 5px;
text-align: left;
vertical-align: middle;
}
#w .title {
vertical-align: middle;
text-align: right;
width: 80px;
height: 40px;
padding: 0px;
}
p {
padding: 0px 5px;
font-size: small;
font-family: 微软雅黑;
margin: 0px;
}
.tree-folder-open, .tree-folder, .tree-file {
display: none;
}
.datagrid {
text-align: center;
}
.editclClose, .editclOpen {
text-decoration: none;
color: #000000;
display: inline-block;
padding: 0 5px;
border-radius: 5px;
}
.editclOpen {
background: green;
}
.editclClose {
background: red;
}
</style>
<title>点检版本管理</title>
<script>
</script>
</head>
<body>
<form id="form1" runat="server">
<div class="top">
<table style="width: 100%">
<tr style="display: flex;flex-direction: row; flex-wrap: wrap;">
<td><span class="title">点检版本管理</span>
</td>
<td style="width: 100px;"></td>
<td style="width: 250px;">设备:
<select id="device_id_s" class="easyui-combobox" style="width: 180px; height: 30px;"
data-options="valueField: 'DeviceID',textField: 'DeviceName'">
</select></td>
<td style="width: 80px;"><a class="topsearchBtn">查询</a></td>
<td style="width: 80px">
<a class="topaddBtn">新增</a>
</td>
<td style="width: 80px">
<a class="toppenBtn">编辑</a>
</td>
<td style="width: 85px">
<a class="topdelBtn">删除</a>
</td>
</tr>
</table>
</div>
<table id="tb" title="点检版本列表" style="width: 99%;">
</table>
<!-- 编辑窗口 -->
<div id="w" style="padding: 10px; visibility: hidden" title="编辑">
<table cellpadding="0" cellspacing="0">
<tr>
<td class="title" style="width: 50px; padding-left: 20px;">
<p>
设备:
</p>
</td>
<td>
<select id="device_id" class="easyui-combobox" style="width: 234px; height: 36px;"
data-options="valueField: 'DeviceID',textField: 'DeviceName'">
</select>
</td>
</tr>
<tr>
<td class="title" style="width: 110px;">
<p>
版本号:
</p>
</td>
<td colspan="2">
<input id="Version" type="text" class="text" style="width: 230px; height: 30px;" />
</td>
</tr>
<tr>
<td class="title" style="width: 110px;">
<p>
点检内容:
</p>
</td>
<td colspan="2">
<div class="easyui-panel">
<ul id="tt"></ul>
</div>
</td>
</tr>
<tr>
<td class="title">
<p>
备注:
</p>
</td>
<td colspan="2">
<input id="Description" type="text" class="text" style="width: 230px; height: 30px;" />
</td>
</tr>
</table>
</div>
<!-- 编辑窗口 - footer -->
<div id="ft" style="padding: 10px; text-align: center; background-color: #f9f9f9; visibility: hidden">
<a class="saveBtn" id="saveBtn">保存</a>
</div>
<input id="UserID" type="text" hidden="hidden" runat="server" />
<script>
/**************** 全局变量 ***************/
var PrimaryID; //要编辑的id
var dg = $('#tb'); //表格
var isEdit = false; //是否为编辑状态
/**************** DOM加载 ***************/
$(function () {
$.ajaxSetup({
cache: false //关闭AJAX缓存
});
//新增按钮点击
$('.topaddBtn').first().click(function () {
isEdit = false;
$('#device_id').combobox({
url: '/HttpHandlers/DeviceHandler.ashx?method=QueryForCombobox',
onLoadSuccess: function () {
var val = $(this).combobox('getData');
$(this).combobox('select', val[0].DeviceID);
},
onSelect: function (row) {
$('#tt').tree({
url: '/HttpHandlers/CheckItemHandler.ashx?method=QueryContentList&DeviceID=' + row.DeviceID + '',
checkbox: true,
onLoadSuccess: function (node, data) {
var tree = $(this);
if (data) {
$(data).each(function (index, d) {
tree.tree('expandAll');
});
}
}
});
}
});
$('#w').window('open');
});
//编辑按钮点击
$('.toppenBtn').first().click(function () {
isEdit = true;
initEidtWidget();
});
//删除按钮
$('.topdelBtn').first().click(function () {
$.messager.confirm('提示框', '你确定要删除吗?', function (r) {
if (r) {
deleteInfos();
}
});
});
//搜索按钮
$('.topsearchBtn').first().click(function () {
SearchInfo();
});
//保存按钮
$('#saveBtn').bind('click', function () {
SaveInfo(isEdit);
});
//下拉框加载
$('#device_id_s').combobox('reload', '/HttpHandlers/DeviceHandler.ashx?method=QueryForCombobox');
//编辑窗口加载
$('#w').window({
modal: true,
closed: true,
minimizable: false,
maximizable: false,
collapsible: false,
width: 460,
height: 500,
footer: '#ft',
top: 20,
onBeforeClose: function () { clearw(); },
onBeforeOpen: function () {
$('#w').css('visibility', 'visible');
$('#ft').css('visibility', 'visible');
}
});
dg = $('#tb').datagrid({
fitColumns: true,
nowrap: false,
striped: true,
collapsible: false,
url: "/HttpHandlers/CommonlyInspectionVersionHandler.ashx?method=QueryList",
//sortName: 'sortNumber',
//sortOrder: 'asc'
remoteSort: false,
columns: [[
{ field: 'ID', title: 'ID', hidden: true },
{ field: 'DeviceID', title: '设备名称', hidden: true },
{ field: 'IsUseing', title: '是否启用', hidden: true },
{ field: 'DeviceName', title: '设备名称', sortable: 'true', width: 200 },
{ field: 'Version', title: '版本号', sortable: 'true', width: 100 },
{ field: 'Description', title: '备注', sortable: 'true', width: 100 },
{ field: 'IsUseingName', title: '是否启用', sortable: 'true', width: 100 },
{
field: 'Operation', title: '操作', sortable: 'true', width: 150,
formatter: function (value, row) {
if (row.IsUseing == 0) {
return '<a class="editclOpen" onclick="optUseing(\'' + row.ID + '\', 1)" href="javascript:void(0)">启用</a>'
}
else {
return '<a class="editclClose" onclick="closeInfo(\'' + row.ID + '\', 0)" href="javascript:void(0)">停用</a>'
}
}
},
{
field: 'CreateTime', title: '创建时间', sortable: 'true', width: 100,
formatter: function (date) {
var pa = /.*\((.*)\)/;
var unixtime = date.match(pa)[1].substring(0, 10);
return getTime(unixtime);
}
}
]],
pagination: true,//表示在datagrid设置分页
rownumbers: true,
singleSelect: true
});
dg.datagrid('getPager').pagination({
pageSize: 10,
pageNumber: 1,
pageList: [10, 20, 30, 40, 50],
beforePageText: '第',//页数文本框前显示的汉字
afterPageText: '页 共 {pages} 页',
displayMsg: '当前显示 {from} - {to} 条记录 共 {total} 条记录',
});
});
/**************** 主要业务程序 ***************/
//新增 / 编辑
function SaveInfo(isEdit) {
var ID = isEdit == true ? PrimaryID : "";
var DeviceID = $('#device_id').combo('getValue');
var Version = $('#Version').val();
var Description = $('#Description').val();
var userid = $('#UserID').val();
//获取一般保全点检项目ID
var nodes = $('#tt').tree('getChecked');
var s = '';
for (var i = 0; i < nodes.length; i++) {
if (nodes[i].id != "-1") {
if (s != '') { s += ','; }
s += nodes[i].id;
}
}
var InspectionId = s;
if (Version == "") {
$.messager.alert('提示', '版本号不能为空,请重新输入', 'warning');
return;
}
var Sid = new Array();
var model = {
ID: ID,
InspectionId: InspectionId,
DeviceID: DeviceID,
Version: Version,
Description: Description,
UserID: userid,
method: 'SaveInfo'
};
SaveModel(model);
}
function SaveModel(model) {
$.ajax({
type: "POST",
async: false,
url: "/HttpHandlers/CommonlyInspectionVersionHandler.ashx",
data: model,
success: function (data) {
if (data == 'true') {
$.messager.alert('提示', '已保存', 'info');
dg.datagrid('reload');
$('#w').window('close');
}
else {
$.messager.alert('提示', '保存失败,请查看是否版本号重复', 'warning');
}
},
error: function () {
}
});
}
//查询方法
function SearchInfo() {
var DeviceID = $('#device_id_s').combo('getValue');
var queryParams = {
DeviceID: DeviceID
};
dg.datagrid({
queryParams: queryParams
});
dg.datagrid('reload');
}
//编辑时加载窗体数据
function initEidtWidget() {
var selRows = dg.datagrid('getSelections');
if (selRows.length > 1) {
$.messager.alert('提示', '每次只能编辑一条记录,请重新选取', 'warning');
return;
} else if (selRows.length == 0) {
$.messager.alert('提示', '请选择一条记录进行编辑', 'warning');
return;
}
//窗体数据初始化
var row = selRows[0];
PrimaryID = row.ID;
$('#device_id').combobox({
url: '/HttpHandlers/DeviceHandler.ashx?method=QueryForCombobox',
onLoadSuccess: function () {
var val = $(this).combobox('getData');
$(this).combobox('select', row.DeviceID);
},
onSelect: function (row2) {
$('#tt').tree({
url: '/HttpHandlers/CheckItemHandler.ashx?method=QueryContentList&DeviceID=' + row2.DeviceID + '',
checkbox: true,
onLoadSuccess: function (node, data) {
var tree = $(this);
if (data) {
//tree.tree('expandAll');
console.log("树形结构开始");
//tree checkbox 自动选中
$.ajax({
url: "/HttpHandlers/CommonlyInspectionHandler.ashx",
dataType: "json",
cache: false,
data: encodeURI("Cid=" + row.ID + "&method=QueryCheckList"),
async: false,
success: function (data) {
console.log(data);
$(data).each(function (i, obj) {
var node = $("#tt").tree('find', obj.id);
if (node) {
$('#tt').tree('check', node.target);
}
});
},
error: function () { alert("发送请求失败"); }
})
console.log("树形结构结束");
}
}
});
}
});
$('#Version').val(row.Version);
$('#Description').val(row.Description);
$('#w').window('open');
}
//删除方法
function deleteInfos() {
var selRows = dg.datagrid('getSelections');
if (selRows.length > 1) {
$.messager.alert('提示', '每次只能删除一条记录,请重新选取', 'warning');
return;
} else if (selRows.length == 0) {
$.messager.alert('提示', '请选择一条记录进行删除', 'warning');
return;
}
var row = selRows[0];
var model = {
ID: row.ID,
Version: row.Version,
method: 'DelInfo'
};
$.ajax({
url: "/HttpHandlers/CommonlyInspectionVersionHandler.ashx",
data: model,
async: false,
success: function (data) {
if (data == 'true') {
dg.datagrid('reload');
}
},
error: function () {
}
});
}
//启停方法
function optUseing(ID, opt) {
var model = {
ID: ID,
method: 'OpenInfo'
};
console.log(ID);
$.ajax({
url: "/HttpHandlers/CommonlyInspectionVersionHandler.ashx",
data: model,
async: false,
success: function (data) {
if (data == 'true') {
$.messager.alert('提示', '已启用', 'info');
dg.datagrid('reload');
}
else {
$.messager.alert('提示', '启用失败', 'warning');
}
},
error: function () {
}
});
}
//停用方法
function closeInfo() {
var selRows = dg.datagrid('getSelections');
if (selRows.length > 1) {
$.messager.alert('提示', '每次只能停用一条记录,请重新选取', 'warning');
return;
} else if (selRows.length == 0) {
$.messager.alert('提示', '请选择一条记录进行停用', 'warning');
return;
}
var row = selRows[0];
var model = {
ID: row.ID,
method: 'CloseInfo'
};
$.ajax({
url: "/HttpHandlers/CommonlyInspectionVersionHandler.ashx",
data: model,
async: false,
success: function (data) {
if (data == 'true') {
$.messager.alert('提示', '已停用', 'info');
dg.datagrid('reload');
}
},
error: function () {
}
});
}
//删除复选框
function unCheck() {
var nodes = $('#tt').tree('getChecked');//获取选中的树复选框
for (var i = 0; i < nodes.length; i++) {
$('#tt').tree('uncheck', nodes[i].target);
}
}
/**************** 辅助业务程序 ***************/
/**********************************************/
/***************** 窗体程序 *******************/
/**********************************************/
//编辑窗口关闭清空数据
function clearw() {
$('#device_id').combobox('clear');
$('#Version').val('');
$('#Description').val('');
//unCheck()
}
function reloadfl_id() {
$('#device_id').combobox('reload', '/HttpHandlers/DeviceHandler.ashx?method=QueryForCombobox');
}
</script>
</form>
</body>
</html>