<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PaperInfoEdit.aspx.cs" Inherits="CY.WebForm.Pages.sysInquiry.PaperInfoEdit" enableEventValidation="false" %>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
<head runat="server">
|
<title>新增/修改纸张</title>
|
<uc:CMSHead ID="CMSHead1" runat="server" />
|
<script type="text/javascript">
|
//正数正则表达式
|
var reg1 = /^\d+(?=\.{0,1}\d+$|$)/;
|
//整数正则表达式
|
var reg2 = /^-?\d+$/;
|
$(
|
function () {
|
$("#hidResult").val($("#txtResultGramWeights").val());
|
|
$("#btnAddGramWeight").click(
|
function () {
|
var txtGramWeights = $("#txtGramWeights").val();
|
var lblGramWeights = $("#txtResultGramWeights").val();
|
if (txtGramWeights == "") {
|
top.Dialog.alert("请输入要新增的克重", function () {
|
});
|
return;
|
}
|
else {
|
var msg = "";
|
var txtGramWeightArry = txtGramWeights.split('|');
|
for (var i = 0; i < txtGramWeightArry.length; i++) {
|
if (!reg2.test(txtGramWeightArry[i])) {
|
msg = "新增的克重" + txtGramWeightArry[i] + "必须是整数";
|
top.Dialog.alert(msg, function () {
|
});
|
return;
|
}
|
var lblGramWeightArry = lblGramWeights.split('|');
|
for (var j = 0; j < lblGramWeightArry.length; j++) {
|
if (txtGramWeightArry[i] == lblGramWeightArry[j]) {
|
msg = "新增的克重" + txtGramWeightArry[i] + "已存在";
|
top.Dialog.alert(msg, function () {
|
});
|
return;
|
}
|
}
|
}
|
if (lblGramWeights != "") {
|
$("#txtResultGramWeights").val(lblGramWeights + "|" + txtGramWeights);
|
}
|
else {
|
$("#txtResultGramWeights").val(txtGramWeights);
|
}
|
$("#txtGramWeights").val("");
|
}
|
}
|
);
|
|
$("#btnDeleteGramWeight").click(
|
function () {
|
var txtGramWeights = $("#txtGramWeights").val();
|
var lblGramWeights = $("#txtResultGramWeights").val();
|
if (txtGramWeights == "") {
|
top.Dialog.alert("请输入要删除的克重", function () {
|
});
|
return;
|
}
|
else {
|
var msg = "";
|
var leftValue = "";
|
var txtGramWeightArry = txtGramWeights.split('|');
|
var lblGramWeightArry = lblGramWeights.split('|');
|
for (var i = 0; i < lblGramWeightArry.length; i++) {
|
if (!IsExist(txtGramWeightArry, lblGramWeightArry[i]))
|
leftValue += lblGramWeightArry[i] + "|";
|
}
|
if (leftValue != "") {
|
leftValue = leftValue.substring(0, leftValue.length - 1);
|
}
|
$("#txtResultGramWeights").val(leftValue);
|
$("#txtGramWeights").val("");
|
}
|
}
|
);
|
|
$("#txtResultGramWeights").blur(
|
function () {
|
var newValue = $(this).val();
|
if (newValue == "") {
|
top.Dialog.alert("克重不能为空", function () {
|
});
|
return;
|
}
|
var newValueArry = newValue.split('|');
|
for (var i = 0; i < newValueArry.length; i++) {
|
if (IsRepeat(newValueArry, newValueArry[i])) {
|
top.Dialog.alert("克重不能重复", function () {
|
});
|
$("#txtResultGramWeights").val($("#hidResult").val());
|
return;
|
}
|
}
|
$("#hidResult").val($("#txtResultGramWeights").val());
|
}
|
);
|
|
cbkAllSelChecked();
|
var isChecked = true;
|
$(":checkbox[id*=cbkAllSel]").click(
|
function () {
|
if (this.checked) {
|
isChecked = true;
|
}
|
else {
|
isChecked = false;
|
}
|
$("input:checkbox").each(
|
function () {
|
$(this).attr("checked", isChecked);
|
}
|
);
|
BindDefaultBrand();
|
}
|
);
|
$("input:checkbox[id!=cbkAllSel]").click(
|
function () {
|
cbkAllSelChecked();
|
BindDefaultBrand();
|
}
|
);
|
|
$("#ddlDefaultBrand").change(
|
function () {
|
$("#hidSelBrandId").val($(this).val());
|
}
|
);
|
}
|
);
|
|
//判断在数组中是否存在
|
function IsExist(gramWeightArry,value)
|
{
|
for(var i=0;i<gramWeightArry.length;i++)
|
{
|
if(value==gramWeightArry[i])
|
{
|
return true;
|
}
|
}
|
return false;
|
}
|
|
//判断是否重复
|
function IsRepeat(gramWeightArry, value) {
|
var num=0;
|
for(var i=0;i<gramWeightArry.length;i++)
|
{
|
if(value==gramWeightArry[i])
|
{
|
num++;
|
}
|
if(num==2)
|
{
|
return true;
|
}
|
}
|
return false;
|
}
|
|
//控制全选状态
|
function cbkAllSelChecked() {
|
var isAllChecked = true;
|
$("input:checkbox[id!=cbkAllSel]").each(
|
function () {
|
if (!this.checked) {
|
isAllChecked = false;
|
}
|
}
|
);
|
$(":checkbox[id*=cbkAllSel]").attr("checked", isAllChecked);
|
}
|
|
//绑定默认品牌
|
function BindDefaultBrand() {
|
var selArry = [];
|
var option = "";
|
$("input:checkbox[id!=cbkAllSel]").each(
|
function () {
|
if (this.checked) {
|
option += "<option value=\"" + $(this).val() + "\">" + $(this).next().text() + "</option>";
|
selArry.push($(this).val());
|
}
|
}
|
);
|
$("#ddlDefaultBrand").html("");
|
$("#ddlDefaultBrand").html(option);
|
if (selArry.length > 0) {
|
var hidDefaultBrandId = $("#hidDefaultBrandId").val();
|
if (IsExist(selArry, hidDefaultBrandId)) {
|
$("#hidSelBrandId").val(hidDefaultBrandId);
|
$("#ddlDefaultBrand").val(hidDefaultBrandId);
|
}
|
else {
|
$("#hidSelBrandId").val(selArry[0]);
|
}
|
}
|
}
|
|
|
function CanOpeate() {
|
var isCanOpeate = false;
|
$("input:checkbox[id!=cbkAllSel]").each(
|
function () {
|
if (this.checked) {
|
isCanOpeate = true;
|
}
|
}
|
);
|
if (!isCanOpeate) {
|
top.Dialog.alert("请至少选择一个品牌", function () {
|
});
|
return false;
|
}
|
else {
|
return true;
|
}
|
}
|
</script>
|
</head>
|
<body>
|
<form id="form1" runat="server" class="form">
|
<table class="tableStyle">
|
<tr><td class="ali03">纸张类别:</td><td><asp:DropDownList ID="ddlPaperType"
|
runat="server" CssClass="Sreq" msg="请选择纸张类别" keepdefaultstyle='true'
|
AutoPostBack="true" onselectedindexchanged="ddlPaperType_SelectedIndexChanged"></asp:DropDownList></td></tr>
|
<tr><td class="ali03">纸张名称:</td><td><input runat="server" id="txtPaperName" type="text" style="width:150px" class="req" msg="纸张名称不能为空"/></td></tr>
|
<tr><td class="ali03">克重:</td><td><div>新增克重:<asp:TextBox ID="txtGramWeights" runat="server" style="width:200px"></asp:TextBox><input type="button" id="btnAddGramWeight" value="新增克重"/> <input type="button" id="btnDeleteGramWeight" value="删除克重"/></div><div style="color:Red">注:新增删除克重都可以以“|”间隔数字进行批量操作,如:70|80|90</div><div>已增克重:<asp:TextBox ID="txtResultGramWeights" runat="server" Width="300px"></asp:TextBox></div></td></tr>
|
<%--<tr><td class="ali03">品牌列表:</td><td>
|
<asp:CheckBoxList ID="cbkBrandList" runat="server" RepeatColumns="5" RepeatDirection="Horizontal">
|
</asp:CheckBoxList>
|
<input type="checkbox" id="cbkAllSel" />全选
|
</td></tr>
|
<tr><td class="ali03">默认品牌:</td><td><asp:DropDownList ID="ddlDefaultBrand" runat="server" CssClass="Sreq" msg="请选择默认品牌" keepdefaultstyle='true'></asp:DropDownList></td></tr>--%>
|
<tr><td class="ali03 ">是否有效:</td><td><asp:DropDownList ID="ddlStatus" runat="server"><asp:ListItem Value="True" Text="有效"></asp:ListItem><asp:ListItem Value="False" Text="无效"></asp:ListItem></asp:DropDownList></td></tr>
|
<tr><td class="ali03 ">排序顺序:</td><td><input id="txtOrerNum" type="text" runat="server" class="req int" msg="排序不能为空" value="1" /></td></tr>
|
<tr><td class="ali03"></td><td><asp:Button ID="btnSubmit" Text="提交" runat="server" OnClick="btnSubmit_Click"/> <input type="button" id="btnClose" value="关闭" onclick="RefreshDIVOpener();"/></td></tr>
|
</table>
|
<input type="hidden" id="hidResult" />
|
<input type="hidden" id="hidDefaultBrandId" runat="server" />
|
<input type="hidden" id="hidSelBrandId" runat="server" />
|
</form>
|
</body>
|
</html>
|