您现在的位置是:首页 >>LayuiLayui

layui选中状态,以编辑页面为例。

zhang2021-09-23 16:38:45【Layui】人已围观

简介:
<!--#include file="coachFun.asp" --><%getCoach%><!DOCTYPE html><html>...

<!--#include file="coachFun.asp" -->
<%
getCoach
%>
<!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="../../../static/layui/css/layui.css" media="all">
<link rel="stylesheet" href="../../../static/layui/css/diy.css" media="all">
<style type="text/css">
.layui-form .layui-form-item {
float: left;
clear: none;
width: 310px;
}
</style>
</head>
<body>
<div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list" style="padding: 20px 30px 0 0;">
<div class="layui-form-item">
<label class="layui-form-label">日期</label>
<div class="layui-input-inline layui-form-mid">
<%=AddTime%>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">提交人</label>
<div class="layui-input-inline layui-form-mid">
<%if AddUser>0 then%>
<%=conn.exec("select TrueName from CxCms_TableContent1 where CID="&AddUser,"r1")(0)%>
<%end if%>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">考生姓名</label>
<%if checkPermission("管理员") then%>
<div class="layui-input-inline">
<input type="text" name="TrueName" value="<%=TrueName%>" placeholder="请输入考生姓名" autocomplete="off" class="layui-input">
</div>
<%else%>
<div class="layui-input-inline layui-form-mid">
<%=TrueName%>
</div>
<%end if%>
</div>
<div class="layui-form-item">
<label class="layui-form-label">手机号</label>
<%if checkPermission("管理员") then%>
<div class="layui-input-inline">
<input type="text" name="Mobile" value="<%=Mobile%>" placeholder="请输入手机号" autocomplete="off" class="layui-input">
</div>
<%else%>
<div class="layui-input-inline layui-form-mid">
<%=Mobile%>
</div>
<%end if%>
</div>
<div class="layui-form-item">
<label class="layui-form-label">QQ</label>
<%if checkPermission("管理员") then%>
<div class="layui-input-inline">
<input type="text" name="QQ" value="<%=QQ%>" placeholder="请输入QQ" autocomplete="off" class="layui-input">
</div>
<%else%>
<div class="layui-input-inline layui-form-mid">
<%=QQ%>
</div>
<%end if%>
</div>
<div class="layui-form-item">
<label class="layui-form-label">报考学校</label>
<%if checkPermission("管理员") then%>
<div class="layui-input-inline">
<input type="text" name="School" value="<%=School%>" placeholder="请输入报考学校" autocomplete="off" class="layui-input">
</div>
<%else%>
<div class="layui-input-inline layui-form-mid">
<%=School%>
</div>
<%end if%>
</div>
<div class="layui-form-item">
<label class="layui-form-label">学院</label>
<%if checkPermission("管理员") then%>
<div class="layui-input-inline">
<input type="text" name="College" value="<%=College%>" placeholder="请输入学院" autocomplete="off" class="layui-input">
</div>
<%else%>
<div class="layui-input-inline layui-form-mid">
<%=College%>
</div>
<%end if%>
</div>
<div class="layui-form-item">
<label class="layui-form-label">专业</label>
<%if checkPermission("管理员") then%>
<div class="layui-input-inline">
<input type="text" name="Major" value="<%=Major%>" placeholder="请输入专业" autocomplete="off" class="layui-input">
</div>
<%else%>
<div class="layui-input-inline layui-form-mid">
<%=Major%>
</div>
<%end if%>
</div>
<div class="layui-form-item">
<label class="layui-form-label">考试科目</label>
<%if checkPermission("管理员") then%>
<div class="layui-input-inline">
<input type="text" name="ExamSubject" value="<%=ExamSubject%>" placeholder="请输入考试科目" autocomplete="off" class="layui-input">
</div>
<%else%>
<div class="layui-input-inline layui-form-mid">
<%=ExamSubject%>
</div>
<%end if%>
</div>
<div class="layui-form-item">
<label class="layui-form-label">学生情况</label>
<%if checkPermission("管理员") then%>
<div class="layui-input-inline">
<input type="text" name="StuInfo" value="<%=StuInfo%>" placeholder="请输入学生情况" autocomplete="off" class="layui-input">
</div>
<%else%>
<div class="layui-input-inline layui-form-mid">
<%=StuInfo%>
</div>
<%end if%>
</div>
<div class="layui-form-item">
<label class="layui-form-label">本科学校</label>
<%if checkPermission("管理员") then%>
<div class="layui-input-inline">
<input type="text" name="bkxx" value="<%=bkxx%>" placeholder="请输入本科学校" autocomplete="off" class="layui-input">
</div>
<%else%>
<div class="layui-input-inline layui-form-mid">
<%=bkxx%>
</div>
<%end if%>
</div>
<div class="layui-form-item">
<label class="layui-form-label">本科学院</label>
<%if checkPermission("管理员") then%>
<div class="layui-input-inline">
<input type="text" name="bkxy" value="<%=bkxy%>" placeholder="请输入本科学院" autocomplete="off" class="layui-input">
</div>
<%else%>
<div class="layui-input-inline layui-form-mid">
<%=bkxy%>
</div>
<%end if%>
</div>
<div class="layui-form-item">
<label class="layui-form-label">班型</label>
<%if checkPermission("管理员") then%>
<div class="layui-input-inline">
<input type="text" name="ClassType" value="<%=ClassType%>" placeholder="请输入班型" autocomplete="off" class="layui-input">
</div>
<%else%>
<div class="layui-input-inline layui-form-mid">
<%=ClassType%>
</div>
<%end if%>
</div>
<div class="layui-form-item">
<label class="layui-form-label">收费</label>
<%if checkPermission("管理员") then%>
<div class="layui-input-inline">
<input type="text" name="PayMoney" value="<%=PayMoney%>" placeholder="请输入收费金额" autocomplete="off" class="layui-input">
</div>
<%else%>
<div class="layui-input-inline layui-form-mid">
<%=PayMoney%>
</div>
<%end if%>
</div>
<div class="layui-form-item" style="width: 100%;">
<label class="layui-form-label">具体要求</label>
<%if checkPermission("管理员") then%>
<div class="layui-input-inline" style="width: 500px;">
<input type="text" name="Require" value="<%=Require%>" placeholder="请输入具体要求" autocomplete="off" class="layui-input">
</div>
<%else%>
<div class="layui-input-inline layui-form-mid">
<%=Require%>
</div>
<%end if%>
</div>
<div class="layui-form-item">
<label class="layui-form-label">教务人员</label>
<%if checkPermission("管理员") or checkPermission("教务主任") or checkPermission("教务校长") then%>
<div class="layui-input-inline">
<select name="AcademicStaff" lay-verify="required" lay-search>
<option value="">请选择</option>
<%
set rs=conn.exec("select CID,TrueName from CxCms_TableContent1 where UserType like '%教务人员%' and ContentStatus=1","r1")
Do While Not rs.Eof
if rs(0)=CInt(AcademicStaff) then
echo "<option value=""" &rs(0)& """ selected>" &rs(1)& "</option>" & vbcr
else
echo "<option value=""" &rs(0)& """>" &rs(1)& "</option>" & vbcr
end if
rs.MoveNext
Loop
rs.Close:Set rs = Nothing
%>
</select>
</div>
<%else%>
<div class="layui-input-inline layui-form-mid">
<%if AcademicStaff>0 then%>
<%=conn.exec("select TrueName from CxCms_TableContent1 where CID="&AcademicStaff,"r1")(0)%>
<%end if%>
</div>
<%end if%>
</div>
<div class="layui-form-item">
<label class="layui-form-label">进度</label>
<%if checkPermission("管理员") or checkPermission("教务") then%>
<div class="layui-input-inline">
<select name="State" lay-verify="required" lay-search>
<option value="">请选择</option>
<option value="教务已分配" <% if State="教务已分配" then echo"selected" end if %>>教务已分配</option>
<option value="教师已找到" <% if State="教师已找到" then echo"selected" end if %>>教师已找到</option>
<option value="第一节已上完" <% if State="第一节已上完" then echo"selected" end if %>>第一节已上完</option>
<option value="第二节已上完" <% if State="第二节已上完" then echo"selected" end if %>>第二节已上完</option>
<option value="课时的1/4" <% if State="课时的1/4" then echo"selected" end if %>>课时的1/4</option>
<option value="课时的2/4" <% if State="课时的2/4" then echo"selected" end if %>>课时的2/4</option>
<option value="课时的3/4" <% if State="课时的3/4" then echo"selected" end if %>>课时的3/4</option>
<option value="已完成" <% if State="已完成" then echo"selected" end if %>>已完成</option>
<option value="已退款" <% if State="已退款" then echo"selected" end if %>>已退款</option>
</select>
</div>
<%else%>
<div class="layui-input-inline layui-form-mid">
<%=State%>
</div>
<%end if%>
</div>
<div class="layui-form-item" style="width: 100%;">
<label class="layui-form-label">备注</label>
<%if checkPermission("管理员") then%>
<div class="layui-input-inline" style="width: 500px;">
<textarea name="Remark" placeholder="请输入备注" class="layui-textarea"><%=Remark%></textarea>
</div>
<%else%>
<div class="layui-input-inline layui-form-mid" style="width: 500px;">
<%=Remark%>
</div>
<%end if%>
</div>
<div class="layui-form-item layui-hide">
<input name="id" type="hidden" value="<%=id%>" >
<input type="button" lay-submit lay-filter="layuiadmin-app-form-submit" id="layuiadmin-app-form-submit" value="确认编辑">
</div>
</div>

<script src="../../../static/layui/layui.js"></script>
<script src="../../../static/js/function.js"></script>
<script>
layui.use(['layer', 'form'], function(){
var $ = layui.$
,layer = layui.layer
,form = layui.form;
//监听提交
form.on('submit(layuiadmin-app-form-submit)', function(data){
var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
var loading=parent.layer.msg("正在保存修改,请稍后...",{icon:16,shade:[0.3, '#666'],time:false});
//提交 Ajax 开始
$.ajax({
type: 'POST',
url: '?action=edit',//发送请求
data: formEncode(data.field),
dataType : "json",
success: function(data) {
parent.layer.close(loading);
if(data.status=="success"){
layer.confirm('保存成功,是否需要刷新列表页面数据?',{btn: ['是','否']}, function(){
parent.layui.table.reload('LAY-app-content-list');
parent.layer.close(index);
},function(){
parent.layer.close(index);
});
}
else{
layer.msg(decodeUnicode(data.msg), {icon: 2,time: 2*1000,shift: 6});
}
},
error:function(data,textStatus,errorThrown){
parent.layer.close(loading);
layer.msg("服务器返回"+data.status+"错误,请检查原因!", {icon: 2,time: 2*1000,shift: 6});
/*jqXHR对象的信息*/
console.log('错误代码 --> ',data.responseText);
console.log('状态码 --> ',data.status);
console.log('当前状态 --> ',data.readyState);
console.log('错误描述 --> ',data.statusText);
/*其他两个参数的信息*/
console.log('返回状态 --> ',textStatus);
console.log('错误描述 --> ',errorThrown);
}

});
//提交 Ajax 结束
});
})
</script>

</body>
</html>


注意:select里面选中用selected,input里面选中用checked,使用的时候注意区分。

例如:

<select name="State" lay-verify="required" lay-search>
<option value="">请选择</option>
<option value="教务已分配" <% if State="教务已分配" then echo"selected" end if %>>教务已分配</option>
<option value="教师已找到" <% if State="教师已找到" then echo"selected" end if %>>教师已找到</option>
<option value="第一节已上完" <% if State="第一节已上完" then echo"selected" end if %>>第一节已上完</option>
<option value="第二节已上完" <% if State="第二节已上完" then echo"selected" end if %>>第二节已上完</option>
<option value="课时的1/4" <% if State="课时的1/4" then echo"selected" end if %>>课时的1/4</option>
<option value="课时的2/4" <% if State="课时的2/4" then echo"selected" end if %>>课时的2/4</option>
<option value="课时的3/4" <% if State="课时的3/4" then echo"selected" end if %>>课时的3/4</option>
<option value="已完成" <% if State="已完成" then echo"selected" end if %>>已完成</option>
<option value="已退款" <% if State="已退款" then echo"selected" end if %>>已退款</option>
</select>



<input type="radio" name="GraduationStatus" value="是" title="是" <% if GraduationStatus="是" then echo"checked" end if %> disabled>
<input type="radio" name="GraduationStatus" value="否" title="否" <% if GraduationStatus="否" then echo"checked" end if %> disabled>








文章评论

    评论加载中...

标签云

站点信息

  • 建站时间:2018-11-17
  • 文章统计:141篇文章
  • 微信交流:扫描二维码,添加我
在线客服
在线客服
在线咨询:
点击这里给我发消息技术交流
点击这里给我发消息技术交流
点击这里给我发消息技术交流
电话咨询:
(微信同步)
15629136039
微信二维码