<!DOCTYPE html>
|
<html>
|
<head>
|
<meta charset="utf-8" />
|
<title>新增/编辑项目类别</title>
|
<meta name="renderer" content="webkit">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
<link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
|
<link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
|
</head>
|
<body>
|
|
<div id="layout1" class="layui-fluid">
|
<div class="layui-row layui-col-space15">
|
<div class="layui-col-md12">
|
<div class="layui-card">
|
<form id="form" class="layui-form" lay-filter="component-form-group" action="">
|
<div class="layui-card-header">
|
<div class="layui-btn-group">
|
|
<button type="button" id="add-btn" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Saver">保存</button>
|
<button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Exit">退出</button>
|
|
</div>
|
|
</div>
|
<div class="layui-card-body">
|
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
|
|
<h1 style="text-align:center;"><b>项目类别</b></h1>
|
<div class="layui-tab-content">
|
<div class="layui-tab-item layui-show">
|
<div class="layui-form-item">
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 120px">代码:</label>
|
<div class="layui-input-inline">
|
<input class="layui-input" name="HNumber" lay-verify="HNumber" id="HNumber" autocomplete="off" >
|
<input name="HItemID" id="HItemID" autocomplete="off" type="hidden">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 120px">名称:</label>
|
<div class="layui-input-inline">
|
<input class="layui-input" name="HName" id="HName" autocomplete="off">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 120px">助记码:</label>
|
<div class="layui-input-inline">
|
<input class="layui-input" name="HHelpCode" id="HHelpCode" autocomplete="off">
|
</div>
|
</div>
|
</div>
|
<div class="layui-form-item">
|
<label class="layui-form-label" style="width: 120px">使用组织:</label>
|
<div class="layui-input-inline">
|
<select name="HUSEORGID" id="HUSEORGID" lay-verify="HUSEORGID">
|
</select>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 120px">使用状态:</label>
|
<div class="layui-input-inline">
|
<select name="HUseFlag" id="HUseFlag" lay-verify="HUseFlag">
|
<option value="未检测" selected>未检测</option>
|
<option value="未使用">未使用</option>
|
<option value="已使用">已使用</option>
|
</select>
|
</div>
|
</div>
|
|
</div>
|
<div class="layui-form-item">
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 120px"> 禁用标志:</label>
|
<div class="layui-input-inline">
|
<input type="checkbox" name="HStopflag" id="HStopflag" lay-skin="primary" title="" value="">
|
</div>
|
</div>
|
</div>
|
<div class="layui-form-item">
|
<div class="layui-col-xs11">
|
<label class="layui-form-label"> 备注:</label>
|
<div class="layui-input-block">
|
<input class="layui-input" name="HRemark" id="HRemark" autocomplete="off">
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
</form>
|
</div>
|
</div>
|
</div>
|
</div>
|
|
<script src="../../../layuiadmin/layui/layui.js"></script>
|
<script src="../../../layuiadmin/Scripts/json2.js"></script>
|
<script src="../../../layuiadmin/Scripts/jquery-1.4.1.js"></script>
|
<script src="../../../layuiadmin/Scripts/webConfig.js"></script>
|
<script src="../../../layuiadmin/PubCustom.js"></script>
|
<script>
|
//获取参数
|
var params = get_UrlVars();
|
if (typeof (params[params[0]]) == "undefined") {
|
var OperationType = 1;//操作类型
|
} else {
|
var OperationType = params[params[0]];//操作类型
|
var linterid = params[params[1]];//源单id
|
var HSouceBillType = params[params[2]];//源单类型
|
}
|
|
layui.config({
|
base: '../../../layuiadmin/' //静态资源所在路径
|
}).extend({
|
index: 'lib/index' //主入口模块
|
}).use(['index', 'form', 'laydate', 'table', 'element'], function () {
|
//#region 公共变量
|
var $ = layui.$
|
, admin = layui.admin
|
, layer = layui.layer
|
, table = layui.table
|
, form = layui.form
|
, laydate = layui.laydate
|
, element = layui.element;
|
//#endregion
|
//#region 进入页面即加载
|
|
//初始化界面
|
set_ClearBill();
|
//判断操作类型
|
if (OperationType == 1) {//无源单
|
set_AddFNew();
|
|
|
}
|
else if (OperationType == 3) {//编辑
|
set_EditFromGrid();
|
}
|
else {
|
layer.alert("未知操作类型!", { icon: 5 });
|
}
|
//#endregion
|
|
//#region 触发事件:包括form.on(){}格式的所有点击事件、选择事件等
|
//保存
|
form.on('submit(Saver)', function (data) {//保存
|
|
var isEndCheck = document.getElementById("HStopflag").checked;
|
isEndCheck == true ? data.field.HStopflag = 'true' : data.field.HStopflag = 'false';//将数组合并成字符串
|
|
var sMainStr = JSON.stringify(data.field) + ";" + sessionStorage["HUserName"];
|
$.ajax(
|
{
|
type: "POST",
|
url: GetWEBURL() + "SaveGy_ProjectClassList", //方法所在页面和方法名
|
async: true,
|
data: { "msg": sMainStr },
|
dataType: "json",
|
success: function (data) {
|
if (data.count == 1) { // 说明验证成功了,
|
layer.msg(data.Message, { icon: 1 });
|
$('#add-btn').addClass("layui-btn-disabled").attr("disabled", true);
|
}
|
else {
|
f_alert(data.Message);
|
console.log("Reason" + sMainStr + "sub:" + JSON.stringify(layui.table.cache.mainTable));
|
}
|
layer.closeAll("loading");
|
},
|
error: function (err) {
|
|
f_alert("错误:" + err);
|
console.log("Reason" + sMainStr);
|
}
|
});
|
});
|
//退出
|
form.on('submit(Exit)', function (data) {//
|
if (linterid == undefined) {
|
//关闭页签
|
Pub_Close(2);
|
}
|
else {
|
//关闭页签
|
Pub_Close(1);
|
}
|
});
|
|
//监听提交
|
form.verify({
|
numberOrEmpty: function (value, item) {
|
// if (value != '') {
|
if (!/^\d+$/.test(value)) {
|
return '不能为空或数字或者0';
|
}
|
//}
|
}
|
});
|
//#endregion
|
|
|
//#region 当前页面面所有的方法
|
|
//初始化界面
|
function set_ClearBill() {
|
Organ();
|
}
|
//无源单新增
|
function set_AddFNew() {
|
$("#HItemID").val("0");
|
|
}
|
//编辑
|
function set_EditFromGrid() {
|
$("#HItemID").val(linterid);
|
set_EditForm(linterid); //编辑获取表头
|
}
|
//编辑加载表头
|
function set_EditForm(linterid) {
|
//查询检验方案单是否存在
|
$.ajax({
|
url: GetWEBURL() + "GetGy_ProjectClassDetail",
|
type: "GET",
|
data: {
|
"HID": linterid
|
},
|
success: function (result) {
|
if (result.code == 1) { // 说明验证成功了,
|
var data = result.data.h_v_Gy_ProjectClass[0];
|
$("#HItemID").val(data.HItemID);//代码ID
|
$("#HNumber").val(data.项目类别代码);//代码
|
$("#HName").val(data.项目类别名称);//名称
|
$("#HEnglishName").val(data.英文名称);//助记码
|
$("#HHelpCode").val(data.助记码);//助记码
|
$("#HUSEORGID").val(data.创建组织);//使用组织
|
$("#HUseFlag ").val(data.使用状态);//使用状态
|
$("#HRemark").val(data.备注);//备注
|
$("input[name='HStopflag']").attr("checked", data.禁用标志 == "是" ? true : false);//true:选中 false:不选中
|
layui.form.render();//实时渲染选中和不选中的样式,最好添加这句话
|
|
} else {
|
layer.alert(result.msg, { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
|
}
|
}, error: function () {
|
layer.alert("发生错误!", { icon: 5 });
|
}
|
});
|
}
|
|
//
|
function f_alert(sMsg) {
|
layer.alert(sMsg, { icon: 5 });
|
|
}
|
//获取登录页组织列
|
function Organ() {
|
var Organization = '';
|
$.ajax({
|
type: "get",
|
url: GetWEBURL() + "/Web/GetOrganizations",
|
success: function (result) {
|
if (result.count == 1) { // 说明验证成功了,
|
var data = result.data;
|
for (var i = 0; i < data.length; i++) {
|
Organization += '<option style="color:blue;" value="' + data[i].ID + '">' + data[i].Name + '</option>';
|
}
|
$("#HUSEORGID").append(Organization);
|
$("#HUSEORGID").val(sessionStorage["OrganizationID"])
|
form.render('select');
|
}
|
layer.closeAll("loading");
|
}
|
})
|
}
|
//#endregion
|
});
|
|
</script>
|
</body>
|
</html>
|