bootstrap

bootstrap常用方法

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'youpassword' WITH GRANT OPTION;
<li>
	订单类型:<select name="status" th:with="type=${@dict.getType('st_order_type')}">
	<option value="">所有</option>
	<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
	</select>
</li>

//密码验证
confirm_password: {  
    required: true,  
    minlength: 5,  
    equalTo: "#password"  
}  

var orderTypeCode = [[${@dict.getType('st_order_type')}]];

{选择参数
	field: 'status',
	title: '状态',
	align: "left",
	formatter: function(value, item, index) {
		return $.table.selectDictLabel(datas, item.status);
	}
},
{//选择字典的值
	field : 'orderType', 
	title : '订单类型',
	sortable: false,
	formatter: function(value, row, index) {
		return $.table.selectDictLabel(orderTypeCode, value);
	}
},
{链接
	field : 'orderId', 
	title : '订单ID',
	formatter: function(value, row, index) {
		 return '+ row.orderId + '\')">' + value + '';
	}
},
{//鼠标悬停事件
	field : 'scanData', 
	title : '扫描内容',
	formatter: function(value, row, index) {
		var actions = [];
		actions.push('');
		setTimeout(function(){ $("[data-toggle='popover']").popover(); }, 1000);
		return actions.join('');
	}
},
{//如果状态是“00”,返回值
	field : 'cardNum', 
	title : '操作票卡数量',
	sortable: false,
	formatter: function(value, row, index) {
		if(row["orderStatus"]!="00"){
			return value;
		}else{
			return null;
		}
	}
},

{//订单处理/废弃/删除:如果状态不是“02”或者不是“03”,“处理按钮”
	title: '操作',
	align: 'center',
	formatter: function(value, row, index) {
	var actions = [];
	if(row["orderStatus"]!="02"&&row["orderStatus"]!="03")
	{
		actions.push('+ editFlag + '" href="#" onclick="submit(\'' + row.orderId + '\')">处理 ');
	}else{
		actions.push('+ editFlag + '" href="#" onclick="submit(\'' + row.orderId + '\')">查看 ');
	}
	if(row["orderStatus"]!="02"&&row["orderStatus"]!="03")
	{
		actions.push('+ removeFlag + '" href="#" onclick="abandon(\'' + row.orderId + '\')">废弃 ');
	}
	if(row["orderStatus"]=="00")
	{
		actions.push('+ removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.orderId + '\')">删除 ');
	}                        
	return actions.join('');
	}
}],

**********************************************************************************
{//如果不是已处理,“生成订单按钮”
	title: '操作',
	align: 'center',
	formatter: function(value, row, index) {
		var actions = [];
		var isNotDeal=row["dealFlag"]!=1;
		if(isNotDeal){
			actions.push('+ editFlag + '" href="#" onclick="generateOrder(\'' + row.id + '\')">生成订单 ');
		}
		//actions.push('删除');
		return actions.join('');
	}
}]
@RequiresPermissions("stock:rfidScanRecord:edit")
@Log(title = "rfid扫描记录", businessType = BusinessType.DELETE)
@PostMapping("/generate/{id}")
@ResponseBody
public AjaxResult generateOrder(@PathVariable("id") Integer id) {
	return orderGenerateService.generateOrder(id, ShiroUtils.getLoginName());
}
**********************************************************************************

$(function() {
	$("input[name='orderStatus']").attr("disabled","disabled");//"disabled"不可选
	var cardStatusType = [[${@dict.getType('st_card_status')}]];
	$("input:radio[name='orderType']").on('ifChecked', function(event){
	var type=$(this).val()
	if(type=="00"){
		$("[name='storageIdSelect']").show();
		$("[name='stOrderSubTypeIn']").show();
		$("[name='stOrderSubTypeOut']").hide();
		$("#btnSelStorage").show();
	}else{
		$("[name='storageIdSelect']").hide();
		$("[name='stOrderSubTypeIn']").hide();
		$("[name='stOrderSubTypeOut']").show();
		$("#btnSelStorage").hide();
	}
});
******************************************************************
 {
	title: '操作',
	align: 'center',
	formatter: function(value, row, index) {
		var actions = [];
		var isNotAuth=row["deviceStatus"]!="1";
		if(isNotAuth){
			actions.push('+ authFlag + '"href="#" onclick="authDevice(\'' + row.id + '\')">授权 ');
		}
		if(!isNotAuth){
			actions.push('+ authFlag + '"href="#" onclick="authDevice(\'' + row.id + '\')">取消授权 ');
		}
		actions.push('+ editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')">编辑 ');
		actions.push('+ removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')">删除');
		return actions.join('');
	}
}]
};
$.table.init(options);
);
//授权方法
function authDevice(id){
	var url = prefix + "/authDevice";
	var data = {"id":id};
	$.operate.submit(url, "post", "json", data);
}  

**********************************************************************************
<li class="select-time">//搜索时间
	<label>创建时间: </label><input type="text" class="time-input" id="createBeginTime" placeholder="开始时间" name="params[createBeginTime]"/>
	<span>-</span>
	<input type="text" class="time-input" id="createEndTime" placeholder="结束时间" name="params[createEndTime]"/>
</li>
//XML文件:
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
	AND date_format(scate_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
	AND date_format(scate_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if>
**********************************************************************************

<textarea id="remark" name="remark" class="form-control">[[*{remark}]]</textarea>

visible: false 不显示
digits: true 输入整数

{//订单子类型
field : 'orderSubType', 
title : '订单子类型',
sortable: false,
formatter: function(value, row, index) {
	if(row["orderType"]=="00"){
		return $.table.selectDictLabel(orderSubTypeIn, value);
	}else{
		return $.table.selectDictLabel(orderSubTypeOut, value);
	}
}
},

.XML模糊查询:
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
	select u.user_id, u.dept_id, u.login_name, u.user_name, u.email, u.phonenumber, u.password, u.idcard, u.sex, u.avatar, u.salt, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name from sys_user u
	left join sys_dept d on u.dept_id = d.dept_id
	where u.del_flag = '0'
	<if test="loginName != null and loginName != ''">
		AND u.login_name like concat('%', #{loginName}, '%')
	</if>
	<if test="status != null and status != ''">
		AND u.status = #{status}
	</if>
	<if test="phonenumber != null and phonenumber != ''">
		AND u.phonenumber like concat('%', #{phonenumber}, '%')
	</if>
	<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
		AND date_format(u.create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
	</if>
	<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
		AND date_format(u.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
	</if>
	<if test="deptId != null and deptId != 0">
		AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE FIND_IN_SET (#{deptId},ancestors) ))
	</if>
	<!-- 数据范围过滤 -->
	${params.dataScope}
</select>

**********************************************************************************

/**
 * 修改保存出入库订单明细
 */
@RequiresPermissions("stock:orderDetail:edit")
@Log(title = "批量更新库位", businessType = BusinessType.UPDATE)
@PostMapping("/batchEdit")
@ResponseBody
public AjaxResult batchEdit(String ids,String storageId){
	String[] arr = Convert.toStrArray(ids);
	for (String id : arr) {
		OrderDetail orderDetail = new OrderDetail();
		orderDetail.setDetailId(Integer.valueOf(id));
		orderDetail.setStorageId(storageId);
		orderDetailService.updateOrderDetail(orderDetail);
	}
	return AjaxResult.success();
}

//批量删除
<delete id="deleteRfidScanRecordByIds" parameterType="String">
	delete from st_rfid_scan_record where id in
	<foreach item="id" collection="array" open="(" separator="," close=")"> #{id} </foreach>
</delete>

**********************************************************************************
<a class="btn btn btn-primary btn-del disabled" id="btnSelStorage" onclick="batchUpdateStorage()" shiro:hasPermission="stock:orderDetail:edit">
	<i class="fa fa-edit"></i> 批量选择库位
</a>
//批量选择库位
function batchUpdateStorage(){
	var rows = $.common.isEmpty($.table._option.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns($.table._option.uniqueId);
	if (rows.length == 0) {
		$.modal.alertWarning("请至少选择一条记录");
		return;
	}
	selectStorageTree(rows.join())
}
**********************************************************************************
$().ready(function() {  
 $("#signupForm").validate({  
        rules: {  
   firstname: "required",  
   email: {  
    required: true,  
    email: true  
   },  
   password: {  
    required: true,  
    minlength: 5  
   },  
   confirm_password: {  
    required: true,  
    minlength: 5,  
    equalTo: "#password"  
   }  
  },  
        messages: {  
   firstname: "请输入姓名",  
   email: {  
    required: "请输入Email地址",  
    email: "请输入正确的email地址"  
   },  
   password: {  
    required: "请输入密码",  
    minlength: jQuery.format("密码不能小于{0}个字符")  
   },  
   confirm_password: {  
    required: "请输入确认密码",  
    minlength: "确认密码不能小于5个字符",  
    equalTo: "两次输入密码不一致不一致"  
   }  
  }  
    });  
});  
//messages处,如果某个控件没有message,将调用默认的信息  
********************************************************************
//选择项表格
function selectScenicNo() {
	var options = {
		title: '景区选择',
		width: "600",
		url: prefix + "/select/",
		callBack: doSubmit
	};
	$.modal.openTable(options);
        	
}    
function doSubmit(index, layero){
	var body = layer.getChildFrame('body', index);
	var selectVal=body.find('#selectObject').val();
	if(!selectVal){
		alert("请选择数据");
	}else{
		var list = body.find('#selectObject').val();
		var obj = JSON.parse(list);//将json字符串解析成对象,
		var scenicNo = obj.scenicNo;//获取对象的属性
		document.getElementById('scenicNo').value=(scenicNo);//设置input的值
		//选择完scenicNo后查找对应的游玩项目
        		
		$.ajax({
			url: ctx + "scenic/scenicAdminUser/add/" + scenicNo ,
			type: "post",
			dataType: "json",
			success: function(result){
				var resData = result.projectList;//projectList对象
				var msgData = result.msg;
				
				var str = "";	
				for(var i = 0 ; i < resData.length ; i ++){
					str += " + resData[i].projectName + "";
				}
				str += "
"; $("#pro_show").html(str); /* $('.col-sm-3 control-label').iCheck(); $('.col-sm-8').iCheck(); $('.check-box').iCheck(); $('#operateProject').iCheck(); */ } }); layer.close(index); } } ***************************************************************** <form id="signupForm" method="get" action=""> <p> <label for="firstname">Firstname</label> <input id="firstname" name="firstname" /> </p> <p> <label for="email">E-Mail</label> <input id="email" name="email" /> </p> <p> <label for="password">Password</label> <input id="password" name="password" type="password" /> </p> <p> <label for="confirm_password">确认密码</label> <input id="confirm_password" name="confirm_password" type="password" /> </p> <p> <input class="submit" type="submit" value="Submit"/> </p> </form> /** 景区设备编号唯一 */ public ScenicDeviceInfo checkDeviceNoUnique(@Param("id")int id ,@Param("deviceNo") String deviceNo); <div class="form-group"> <label class="col-sm-3 control-label">性别:</label> <div class="col-sm-8"> <select id="sex" class="form-control m-b" th:with="type=${@dict.getType('sys_user_sex')}"> <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option> </select> </div> </div> <div class="form-group"> <label class="col-sm-3 control-label">状态:</label> <div class="col-sm-8"> <div class="onoffswitch"> <input type="checkbox" th:checked="true" class="onoffswitch-checkbox" id="status" name="status"> <label class="onoffswitch-label" for="status"> <span class="onoffswitch-inner"></span> <span class="onoffswitch-switch"></span> </label> </div> </div> </div> <div class="form-group"> <label class="col-sm-3 control-label">岗位:</label> <div class="col-sm-8"> <select id="post" name="post" class="form-control select2-hidden-accessible" multiple=""> <option th:each="post:${posts}" th:value="${post.postId}" th:text="${post.postName}" th:disabled="${post.status == '1'}"></option> </select> </div> </div> <div class="form-group"> <label class="col-sm-3 control-label">角色:</label> <div class="col-sm-8"> <label th:each="role:${roles}" class="check-box"> <input name="role" type="checkbox" th:value="${role.roleId}" th:text="${role.roleName}" th:disabled="${role.status == '1'}"> </label> </div> </div> @PathVariable绑定URI模板变量值 @PathVariable是用来获得请求url中的动态参数的 @PathVariable用于将请求URL中的模板变量映射到功能处理方法的参数上。//配置url和方法的一个关系@RequestMapping("item/{itemId}") @RequestMapping 来映射请求,也就是通过它来指定控制器可以处理哪些URL请求,类似于struts的action请求 @responsebody表示该方法的返回结果直接写入HTTP response body中 *一般在异步获取数据时使用,在使用@RequestMapping后,返回值通常解析为跳转路径,加上@responsebody后返回结果不会被解析为跳转路径,而是直接写入HTTP response *body中。 *比如异步获取json数据,加上@responsebody后,会直接返回json数据。* *@Pathvariable注解绑定它传过来的值到方法的参数上 用于将请求URL中的模板变量映射到功能处理方法的参数上,即取出uri模板中的变量作为参数 ********************************************************************************** 审核/回退 function AuditHandler(status) { if ($.validate.form()) { var type=$("[name='orderType']:checked").val(); var intype=$("[name='orderSubType']:checked").val(); if(type=="01"){ if(!intype||intype <= "04"){ layer.msg("请选择出库子类型"); return false ; } } else if(type=="00"){ if(!intype||intype >= "10"){ layer.msg("请选择入库子类型"); return false ; } } var data=$('#form-order-edit').serialize(); data=data+"&checkStatus="+status; if(data.indexOf("orderType=")<0){ var type=$("[name='orderType']:checked").val(); data=data+"&orderType="+type; } $.operate.save(prefix + "/audit", data); } } //选择按钮 <li class="select-operate"> <label>仓库编号:</label><input type="text" name="storageId" id="storageId"/> <a class="btn btn-success btn-xs" onclick="selectStorageTree()"> <i class="fa fa-search"></i> 选择 </a> </li> //提交 function submitHandler() { if ($.validate.form()) { var type=$("[name='orderType']:checked").val(); var intype=$("[name='orderSubType']:checked").val(); if(type=="01"){ if(!intype||intype <= "04"){ layer.msg("请选择出库子类型"); return false ; } } else if(type=="00"){ if(!intype||intype >= "10"){ layer.msg("请选择入库子类型"); return false ; } var data=$("#bootstrap-table").bootstrapTable('getData'); for(var i=0;i<data.length;i++){ if(!data[i].storageId){ layer.msg('请选择仓库,rfid:'+data[i].rfidId); return; } } } var data=$('#form-order-edit').serialize(); if(data.indexOf("orderType=")<0){ var type=$("[name='orderType']:checked").val(); data=data+"&orderType="+type; } $.operate.save(prefix + "/submit", data); } } //入库必须选择仓库 if (OrderTypeEnum.InStock.getCode().equals(order.getOrderType())&&!StringUtils.isEmpty(sb.toString())) { return AjaxResult.error(sb.toString()+"请选择仓库"); } return AjaxResult.success("提交成功"); return $.common.trim($("#userName").val()); ********************************************************************************** 触发器 CREATE TRIGGER 触发器名 BEFORE|AFTER 触发事件 ON 表名 FOR EACH ROW BEGIN 执行语句列表 END removeAll: function() { var rows = $.common.isEmpty($.table._option.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns($.table._option.uniqueId); if (rows.length == 0) { $.modal.alertWarning("请至少选择一条记录"); return; } $.modal.confirm("确认要删除选中的" + rows.length + "条数据吗?", function() { var url = $.table._option.removeUrl; var data = { "ids": rows.join() }; $.operate.submit(url, "post", "json", data); }); }, exportExcel: function(formId) { var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId; $.modal.loading("正在导出数据,请稍后..."); $.post($.table._option.exportUrl, $("#" + currentId).serializeArray(), function(result) { if (result.code == web_status.SUCCESS) { window.location.href = ctx + "common/download?fileName=" + result.msg + "&delete=" + true; } else { $.modal.alertError(result.msg); } $.modal.closeLoading(); }); } // 保存信息 save: function(url, data) { $.modal.loading("正在处理中,请稍后..."); var config = { url: url, type: "post", dataType: "json", data: data, success: function(result) { $.operate.saveSuccess(result); } }; $.ajax(config) }, //提交 submit: function(url, type, dataType, data) { $.modal.loading("正在处理中,请稍后..."); var config = { url: url, type: type, dataType: dataType, data: data, success: function(result) { $.operate.ajaxSuccess(result); } }; $.ajax(config) },

你可能感兴趣的:(spring)