作者 赵超

小工具 赵超

package com.tianbo.controller.fendan;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.tianbo.model.ManifestLoad;
import com.tianbo.model.Originmanifestmaster;
import com.tianbo.model.Originmanifestsecondary;
import com.tianbo.service.FenDanService;
import com.tianbo.service.LostService;
import com.tianbo.util.DateUtils;
import com.tianbo.util.json.AjaxJson;
import com.tianbo.util.json.JsonConversion;
@Controller
public class FenDanController {
@Autowired
private FenDanService fendanService;
@RequestMapping("/fendan")
public String fendao(ModelMap model, HttpServletRequest request) {
return "fendan/fendanlist";
}
@ResponseBody
@RequestMapping(value = "fendanList")
public String getList(HttpServletRequest request, int page, int limit) {
int start = (page - 1) * limit + 1;
int end = page * limit;
List<Originmanifestmaster> lost = fendanService.getList(start, end);
System.out.println(lost.size());
Originmanifestmaster ft = new Originmanifestmaster();
int count = fendanService.FendanCount(ft);
Map<String, Object> map = new HashMap<>();
if (!lost.isEmpty()) {
map.put("code", 0);
map.put("count", count);
map.put("msg", "success");
map.put("data", lost);
} else {
map.put("code", -1);
map.put("msg", "请检查网络连接或重试");
map.put("data", "");
}
return JsonConversion.writeMapJSON(map);
}
@ResponseBody
@RequestMapping(value = "fendanList2")
public String getList2(HttpServletRequest request, int page, int limit) {
int start = (page - 1) * limit + 1;
int end = page * limit;
List<Originmanifestmaster> lost = fendanService.getListfd(start, end);
System.out.println(lost.size());
Originmanifestmaster ft = new Originmanifestmaster();
int count = fendanService.FendanCount1(ft);
Map<String, Object> map = new HashMap<>();
if (!lost.isEmpty()) {
map.put("code", 0);
map.put("count", count);
map.put("msg", "success");
map.put("data", lost);
} else {
map.put("code", -1);
map.put("msg", "请检查网络连接或重试");
map.put("data", "");
}
return JsonConversion.writeMapJSON(map);
}
@ResponseBody
@RequestMapping(value = "fendanselectByParam")
public String selectByParam(HttpServletRequest request,int page,int limit,String waybillnomaster,String flightno,String flightdate){
int start = (page-1)*limit+1;
int end = page*limit;
System.out.println(flightdate);
List<Originmanifestmaster> lost = fendanService.fdselectByParam(start,end,waybillnomaster,flightno,flightdate);
Originmanifestmaster fs = new Originmanifestmaster();
fs.setWaybillnomaster(waybillnomaster);
fs.setFlightno(flightno);
int count = fendanService.FendanCount1(fs);
System.out.println(count);
Map<String,Object> map = new HashMap<>();
if(!lost.isEmpty()){
map.put("code", 0);
map.put("count", count);
map.put("msg", "success");
map.put("data", lost);
}else {
map.put("code", -1);
map.put("msg", "无此条件信息");
map.put("data", "");
}
return JsonConversion.writeMapJSON(map);
}
@ResponseBody
@RequestMapping(value = "fendanselectByParam2")
public String selectByParam2(HttpServletRequest request,int page,int limit,String waybillnomaster,String flightno,String flightdate){
int start = (page-1)*limit+1;
int end = page*limit;
System.out.println(flightdate);
List<Originmanifestmaster> lost = fendanService.fdselectByParam1(start,end,flightno,flightdate);
Originmanifestmaster fs = new Originmanifestmaster();
fs.setFlightno(flightno);
System.out.println(flightdate);
fs.setFlightDate(flightdate);
int count = fendanService.FendanCount(fs);
System.out.println(count);
Map<String,Object> map = new HashMap<>();
if(!lost.isEmpty()){
map.put("code", 0);
map.put("count", count);
map.put("msg", "success");
map.put("data", lost);
}else {
map.put("code", -1);
map.put("msg", "无此条件信息");
map.put("data", "");
}
return JsonConversion.writeMapJSON(map);
}
/**
* 挂分担
* @param fendanupdate
* @param list
* @return
*/
@ResponseBody
@RequestMapping(value = "fendanupdate", method = RequestMethod.POST)
public AjaxJson fendanupdate(HttpServletRequest request,@RequestBody List<Originmanifestmaster> list) {
String message = null;
AjaxJson j = new AjaxJson();
try {
//循环json数组
List<Originmanifestmaster> listone=list; for (Originmanifestmaster
originmanifestmaster : listone) {
String autoid=originmanifestmaster.getAutoid();
String waybillnomaster=originmanifestmaster.getWaybillnomaster();
Originmanifestsecondary oy=new Originmanifestsecondary();
oy.setOriginmanifestmasterautoid(autoid);
oy.setWaybillnomaster(waybillnomaster);
fendanService.updatefendan(oy);
System.out.println(originmanifestmaster.getAutoid());
}
j.setSuccess(true);
message = "修改状态成功";
} catch (Exception e) {
j.setSuccess(false);
message = "修改状态失败";
e.printStackTrace();
}
j.setMsg(message);
return j;
}
/**
* 删除
* @param fendanupdate
* @param list
* @return
*/
@ResponseBody
@RequestMapping(value = "felfd", method = RequestMethod.POST)
public AjaxJson delfd(HttpServletRequest request,@RequestBody List<Originmanifestmaster> list) {
String message = null;
System.out.println("---------"+list);
AjaxJson j = new AjaxJson();
try {
//循环json数组
List<Originmanifestmaster> listone=list; for (Originmanifestmaster
originmanifestmaster : listone) {
String autoid=originmanifestmaster.getAutoid();
String waybillnomaster=originmanifestmaster.getWaybillnomaster();
String param=originmanifestmaster.getParam();
Originmanifestsecondary oy=new Originmanifestsecondary();
oy.setOriginmanifestmasterautoid(autoid);
oy.setWaybillnomaster(waybillnomaster);
oy.setWaybillnosecondary(param);
fendanService.delfd(oy);
System.out.println(originmanifestmaster.getAutoid());
}
j.setSuccess(true);
message = "删除状态成功";
}catch (Exception e) {
j.setSuccess(false);
message = "删除状态失败";
e.printStackTrace();
}
j.setMsg(message);
return j;
}
@RequestMapping(value ="edit")
public String edit(ModelMap model,HttpServletRequest request) {
model.put("ftId", request.getParameter("id"));
return "fendan/edit";
}
/**
* 编辑或新增
* @param lost
* @param redirectAttributes
* @return
*/
@ResponseBody
@RequestMapping(value = "upeditForm")
public AjaxJson upeditForm(ModelMap model,HttpServletRequest request) {
String flightdate = request.getParameter("flightdate");
String oldflightdate = request.getParameter("id");
String flightno = request.getParameter("flyno");
System.out.println(oldflightdate);
String message = null;
AjaxJson j = new AjaxJson();
try {
Originmanifestmaster or=new Originmanifestmaster();
or.setFlightDate(flightdate);
or.setParam(oldflightdate);
or.setFlightno(flightno);
System.out.println("++++++++++++++"+or.getFlightDate());
/* lostService.saveorupdate(manifest); */
fendanService.updateriqi(or);
System.out.println(flightdate);
j.setSuccess(true);
message = "修改成功";
} catch (Exception e) {
j.setSuccess(false);
message = "修改失败";
e.printStackTrace();
}
j.setMsg(message);
return j;
}
}
... ...
package com.tianbo.controller.fendan;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import com.tianbo.service.FenDanService;
@Controller
public class UpdateDate {
@Autowired
private FenDanService fendanService;
@RequestMapping("/updatedate")
public String fendao(ModelMap model, HttpServletRequest request) {
System.out.println("---");
return "fendan/UpdateDate";
}
@RequestMapping("/delfendan")
public String delfendan(ModelMap model, HttpServletRequest request) {
System.out.println("---");
return "fendan/delfendan";
}
}
... ...
package com.tianbo.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.tianbo.model.ManifestLoad;
import com.tianbo.model.Originmanifestmaster;
import com.tianbo.model.Originmanifestsecondary;
public interface FenDanMapper {
List<Originmanifestmaster> getList(@Param("start")int start, @Param("end")int end);
List<Originmanifestmaster> getListfd(@Param("start")int start, @Param("end")int end);
int getCount(Originmanifestmaster mf);
int getCount2(Originmanifestmaster mf);
List<Originmanifestmaster> fdselectByParam(@Param("start")int start, @Param("end")int end, @Param("waybillnomaster")String waybillnomaster,@Param("flightno")String flightno,@Param("flightdate")String flightdate);
int updatefendan(Originmanifestsecondary oy);
int updateriqi(Originmanifestmaster oy);
int delfd(Originmanifestsecondary oy);
List<Originmanifestmaster> fdselectByParam1(@Param("start")int start, @Param("end")int end,@Param("flightno")String flightno,@Param("flightdate")String flightdate);
List<Originmanifestmaster> findautoid(Originmanifestmaster oy);
}
... ...
... ... @@ -97,8 +97,18 @@ public class Originmanifestmaster {
private String specificConsigneePhone;
private String consigneePhone;
private String param;
public String getAutoid() {
public String getParam() {
return param;
}
public void setParam(String param) {
this.param = param;
}
public String getAutoid() {
return autoid;
}
... ...
package com.tianbo.service;
import java.util.List;
import com.tianbo.model.ManifestLoad;
import com.tianbo.model.Originmanifestmaster;
import com.tianbo.model.Originmanifestsecondary;
public interface FenDanService {
List<Originmanifestmaster> getList(int start, int end);
List<Originmanifestmaster> getListfd(int start, int end);
int FendanCount(Originmanifestmaster mf);
int FendanCount1(Originmanifestmaster mf);
List<Originmanifestmaster> fdselectByParam(int start, int end, String waybillnomaste,String flightno,String flightdate);
List<Originmanifestmaster> fdselectByParam1(int start, int end, String flightno,String flightdate);
int updatefendan(Originmanifestsecondary oy);
List<Originmanifestmaster> findautoid(Originmanifestmaster oy);
int updateriqi(Originmanifestmaster oy);
int delfd(Originmanifestsecondary oy);
}
... ...
package com.tianbo.service.imp;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.tianbo.mapper.FenDanMapper;
import com.tianbo.model.ManifestLoad;
import com.tianbo.model.Originmanifestmaster;
import com.tianbo.model.Originmanifestsecondary;
import com.tianbo.service.FenDanService;
@Service
@Transactional
public class FenDanServerImp implements FenDanService {
@Autowired
private FenDanMapper fendanDao;
@Override
public List<Originmanifestmaster> getList(int start, int end) {
return fendanDao.getList(start, end);
}
@Override
public int FendanCount(Originmanifestmaster mf) {
return fendanDao.getCount(mf);
}
@Override
public List<Originmanifestmaster> fdselectByParam(int start, int end, String waybillnomaster,String flightno,String flightdate) {
return fendanDao.fdselectByParam(start,end,waybillnomaster,flightno,flightdate);
}
@Override
public int updatefendan(Originmanifestsecondary oy) {
// TODO Auto-generated method stub
return fendanDao.updatefendan(oy);
}
@Override
public int updateriqi(Originmanifestmaster oy) {
// TODO Auto-generated method stub
return fendanDao.updateriqi(oy);
}
@Override
public int delfd(Originmanifestsecondary oy) {
// TODO Auto-generated method stub
return fendanDao.delfd(oy);
}
@Override
public List<Originmanifestmaster> fdselectByParam1(int start, int end,String flightno,String flightdate) {
// TODO Auto-generated method stub
return fendanDao.fdselectByParam1(start,end,flightno,flightdate);
}
@Override
public int FendanCount1(Originmanifestmaster mf) {
// TODO Auto-generated method stub
return fendanDao.getCount2(mf);
}
@Override
public List<Originmanifestmaster> getListfd(int start, int end) {
// TODO Auto-generated method stub
return fendanDao.getListfd(start, end);
}
@Override
public List<Originmanifestmaster> findautoid(Originmanifestmaster oy) {
// TODO Auto-generated method stub
return fendanDao.findautoid(oy);
}
}
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.tianbo.mapper.FenDanMapper">
<select id="getListfd"
resultType="com.tianbo.model.Originmanifestmaster">
SELECT
T2.*
FROM
( SELECT ROWNUM RN, T.* FROM (
select mas.waybillnomaster,mas.flightno,mas.flight_date as flightdate,mas.autoid,''as waybillnosecondary from ORIGINMANIFESTMASTER mas
union
select one.waybillnomaster,two.flightno,two.flight_date as flightdate,two.autoid,one.waybillnosecondary from ORIGINMANIFESTSECONDARY one right join ORIGINMANIFESTMASTER two on one.originmanifestmasterautoid=two.autoid
)T ) T2
WHERE
RN BETWEEN #{start} AND #{end}
</select>
<select id="getList"
resultType="com.tianbo.model.Originmanifestmaster">
SELECT
T2.*
FROM
( SELECT ROWNUM RN, T.* FROM ( SELECT * FROM ( SELECT
AUTOID, WAYBILLNOMASTER, SEGMENT, ORIGINATINGSTATION, DESTINATIONSTATION, TOTALWEIGHT, TOTALPIECE, MANIFESTTOTALPIECE, MANIFESTTOTALWEIGHT, FLIGHTNO, PRODUCTNAME, CUSTOMSSTATUS, CARRIER1, ARRIVALSTATION1, CARRIER2, ARRIVALSTATION2, CARRIER3, ARRIVALSTATION3, PAYMODE, SPECIALGOODSCODE, CUSTOMSCODE, SHIPPERNAME, SHIPPERADDRESS, CONSIGNEENAME, CONSIGNEEADDRESS, RECEIPTINFORMATION, CREATEDATE, FLIGHT_DATE as flightDate, STATUS, ISBATCH, ORIGINATINGSTATION_BILL, DESTINATIONSTATION_BILL, REPORTORDER, ISLAST, SHIPPER_CODE, SHIPPER_COUNTRYCODE, SHIPPER_PHONE, SHIPPER_FAX, CONSIGNEE_CODE, CONSIGNEE_COUNTRYCODE, CONSIGNEE_FAX, SPECIFIC_CONSIGNEENAME, SPECIFIC_CONSIGNEE_PHONE, CONSIGNEE_PHONE
FROM
originmanifestmaster ) ORDER BY createdate DESC ) T ) T2
WHERE
RN BETWEEN #{start} AND #{end}
</select>
<select id="getCount" parameterType="com.tianbo.model.Originmanifestmaster" resultType="java.lang.Integer" >
select count(*) from originmanifestmaster
WHERE 1=1
<if test="flightno != null and flightno != ''">
AND FLIGHTNO=#{flightno}
</if>
<if test="waybillnomaster != null and waybillnomaster != ''">
AND waybillnomaster=#{waybillnomaster}
</if>
<if test="flightDate != null and flightDate != ''">
and FLIGHT_DATE= "TO_DATE"(#{flightDate},'yyyy-mm-dd' )
</if>
</select>
<select id="findautoid" parameterType="com.tianbo.model.Originmanifestmaster" resultType="com.tianbo.model.Originmanifestmaster" >
select * from ORIGINMANIFESTMASTER
where
<if test="waybillnomaster != null and waybillnomaster != ''">
waybillnomaster=#{waybillnomaster}
</if>
</select>
<select id="getCount2" parameterType="com.tianbo.model.Originmanifestmaster" resultType="java.lang.Integer" >
<choose>
<when test="waybillnomaster != null and waybillnomaster != ''">
select count(*) from
(select mas.waybillnomaster,mas.flightno,mas.flight_date,mas.autoid,''as waybillnosecondary from ORIGINMANIFESTMASTER mas where mas.waybillnomaster=#{waybillnomaster}
union
select one.waybillnomaster,two.flightno,two.flight_date,two.autoid,one.waybillnosecondary from ORIGINMANIFESTSECONDARY one right join ORIGINMANIFESTMASTER two on one.originmanifestmasterautoid=two.autoid where one.waybillnomaster=#{waybillnomaster}
)
</when >
<otherwise>
select count(*) from
(select mas.waybillnomaster,mas.flightno,mas.flight_date as flightdate,mas.autoid,''as waybillnosecondary from ORIGINMANIFESTMASTER mas
union
select one.waybillnomaster,two.flightno,two.flight_date as flightdate,two.autoid,one.waybillnosecondary from ORIGINMANIFESTSECONDARY one right join ORIGINMANIFESTMASTER two on one.originmanifestmasterautoid=two.autoid
)
</otherwise>
</choose>
</select>
<select id="fdselectByParam" resultType="com.tianbo.model.Originmanifestmaster">
SELECT
T2.*
FROM
( SELECT ROWNUM RN, T.* FROM (
<if test="waybillnomaster != null and waybillnomaster != ''">
select*from(
select mas.waybillnomaster,mas.flightno,mas.flight_date as flightDate,mas.autoid,''as param from ORIGINMANIFESTMASTER mas where mas.waybillnomaster=#{waybillnomaster}
union
select one.waybillnomaster,two.flightno,two.flight_date as flightDate,two.autoid,one.waybillnosecondary as param from ORIGINMANIFESTSECONDARY one right join ORIGINMANIFESTMASTER two on one.originmanifestmasterautoid=two.autoid where one.waybillnomaster=#{waybillnomaster}
) order by param desc
</if>
)T ) T2
WHERE
RN BETWEEN #{start} AND #{end}
</select>
<select id="fdselectByParam1" resultType="com.tianbo.model.Originmanifestmaster">
SELECT
T2.*
FROM
( SELECT ROWNUM RN, T.* FROM ( SELECT flightno,flight_date as flightDate FROM ORIGINMANIFESTMASTER
<if test="flightno != null and flightno != ''">
where flightno = #{flightno,jdbcType=VARCHAR}
</if>
<if test="flightdate != null and flightdate !='' ">
and FLIGHT_DATE= "TO_DATE"(#{flightdate},'yyyy-mm-dd' )
</if>
) T ) T2
WHERE
RN BETWEEN #{start} AND #{end}
</select>
<update id="updatefendan" parameterType="com.tianbo.model.Originmanifestsecondary" >
update ORIGINMANIFESTSECONDARY
<set >
<if test="originmanifestmasterautoid != null" >
originmanifestmasterautoid = #{originmanifestmasterautoid,jdbcType=VARCHAR},
</if>
</set>
where waybillnomaster = #{waybillnomaster,jdbcType=VARCHAR}
</update>
<update id="updateriqi" parameterType="com.tianbo.model.Originmanifestmaster" >
update originmanifestmaster
<set>
<if test="flightDate != null ">
FLIGHT_DATE= "TO_DATE"(#{flightDate},'yyyy-mm-dd' )
</if>
</set>
where flightno = #{flightno,jdbcType=VARCHAR}
and
FLIGHT_DATE= "TO_DATE"(#{param},'yyyy-mm-dd' )
</update>
<delete id="delfd" parameterType="com.tianbo.model.Originmanifestsecondary">
DELETE FROM
ORIGINMANIFESTSECONDARY
where
<if test="originmanifestmasterautoid != null" >
originmanifestmasterautoid = #{originmanifestmasterautoid,jdbcType=VARCHAR}
</if>
<if test="waybillnosecondary != null" >
and Waybillnosecondary = #{waybillnosecondary,jdbcType=VARCHAR}
</if>
</delete>
</mapper>
\ No newline at end of file
... ...
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<!doctype html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>修改航班日期</title>
<script src="<%=basePath%>static/easyui/jquery.min.js"></script>
<link href="<%=basePath%>static/layui2.4.5/css/layui.css"
rel="stylesheet">
<script src="<%=basePath%>static/layui2.4.5/layui.js"></script>
<script type="text/javascript"
src="<%=basePath%>static/layer-v3.0.3/layer/layer.js"></script>
<style>
body {
}
</style>
<script type="text/html" id="barDemo">
<a class="layui-btn layui-btn-xs" lay-event="edit">修改航班日期</a>
</script>
</head>
<body>
<br />
<blockquote class="layui-elem-quote" align="left">航班号查询</blockquote>
<div class="layui-inline">
<div class="layui-inline">
<label class="layui-form-label"
style="font-size: 15px; font-weight: bold; width: 70px;">航班号:</label>
<div class="layui-input-inline">
<input type="text" name="flightno" id="flightno" autocomplete="off"
class="layui-input" style="text-transform: uppercase;"
onkeyup="this.value=this.value.toUpperCase()" />
</div>
<div class="layui-inline">
<label class="layui-form-label"
style="font-weight: bold; font-size: 15px; width: 80px;">航班日期:</label>
<div class="layui-input-inline">
<input type="text" autocomplete="off" class="layui-input" id="flightdate" name="flightdate"/>
</div>
</div>
</div>
</div>
<div class="layui-inline">
<button class="layui-btn layui-btn-radius" lay-submit=""
id="searchBtn" data-type="getInfo">查询</button>
</div>
<input id="handle_status" value="" hidden="hidden">
<br />
<br />
<blockquote class="layui-elem-quote" align="left">运单明细</blockquote>
<table class="layui-hide" id="test" lay-filter="test"></table>
<script type="text/html" id="barDemo">
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<!-- 注意:如果你直接复制所有代码到本地,上述js路径需要改成你本地的 -->
<script>
layui.use('table', function() {
var table = layui.table;
table.render({
elem : '#test',
url : '<%=basePath%>fendanList',
toolbar : '#toolbarDemo',
title : '用户数据表',
cols : [ [ {
type : 'checkbox',
fixed : 'left'
}, {
field : 'flightno',
title : '航班号',
width : 300,
fixed : 'left',
sort : true
}, {
field :'flightDate',
title : '航班日期',
width : 300
},{fixed: 'right', title:'操作',align:'center', toolbar: '#barDemo', width:300}
] ],
page : true
});
var _tools = {
func1: function(){
console.log('func1');
var flightno=$('#flightno').val();
var flightdate=$('#flightdate').val();
table.reload('test', { //表格的id
url:'<%=basePath%>fendanselectByParam2',
page:{
curr:1, //从第一页开始
limit:1
},
where: {
'flightno':$.trim(flightno),
'flightdate':$.trim(flightdate)
}
});
}
}
window.tools = _tools;
//监听行工具事件
table.on('tool(test)', function(obj) {
var data = obj.data;
//console.log(obj)
if (obj.event === 'edit') {
if (data) {
$('#flightno').val(data.flightno);
var id = data.id;
layer.open({
type: 2,
title: "落装申请",
shade: 0.8,
id: (new Date()).valueOf(), //设定一个id,防止重复弹出 时间戳1280977330748
moveType: 1, //拖拽模式,0或者1
type: 2,
skin: 'layui-layer-rim', //加上边框
/* area: [window.screen.width / 2 + 'px', window.screen.height / 2 + 'px'], //宽高 */
area: ['692px', '372px'],
maxmin: true, //开启最大化最小化按钮
content: "<%=basePath %>edit?id="+id,
success: function (layero, index) {
// 获取子页面的iframe
var iframe = window['layui-layer-iframe' + index];
// 向子页面的全局函数child传参
iframe.child(data);
}
})
} else {
alert("请选择运单")
}
}
});
$('#searchBtn').on('click',function(){
var type = $(this).data('type');
console.log(type);
active[type] ? active[type].call(this) : '';
});
// 点击获取数据
var active = {
getInfo: function () {
var flightno=$('#flightno').val();
var flightdate=$('#flightdate').val();
/* if (flightno) { */
var index = layer.msg('查询中,请稍候...',{icon: 16,time:false,shade:0});
setTimeout(function(){
table.reload('test', { //表格的id
url:'<%=basePath%>fendanselectByParam2',
page:{
curr:1, //从第一页开始
limit:10
},
where: {
'flightno':$.trim(flightno),
'flightdate':$.trim(flightdate)
}
});
layer.close(index);
},800);
/* } else {
layer.msg("请输入航班号");
} */
},
};
});
</script>
<script type="text/javascript">
layui.use(['form', 'laydate'], function(){
var form = layui.form
,laydate = layui.laydate;
//日期
laydate.render({
elem: '#flightdate'
});
});
</script>
</body>
</html>
\ No newline at end of file
... ...
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<!doctype html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>删分单</title>
<script src="<%=basePath%>static/easyui/jquery.min.js"></script>
<link href="<%=basePath%>static/layui2.4.5/css/layui.css"
rel="stylesheet">
<script src="<%=basePath%>static/layui2.4.5/layui.js"></script>
<script type="text/javascript"
src="<%=basePath%>static/layer-v3.0.3/layer/layer.js"></script>
<script src="<%=basePath%>static/DataTableExtend.js"></script>
<style>
body {
}
</style>
</head>
<body>
<br />
<blockquote class="layui-elem-quote" align="left">删分单</blockquote>
<div class="layui-inline">
<div class="layui-inline">
<label class="layui-form-label"
style="font-weight: bold; font-size: 15px; width: 70px;">运单号:</label>
<div class="layui-input-inline">
<input type="text" name="waybillnomaster" autocomplete="off"
class="layui-input" id="waybillnomaster" />
</div>
</div>
</div>
<div class="layui-inline">
<button class="layui-btn layui-btn-radius" lay-submit="" id="searchBtn"
data-type="getInfo">查询</button>
</div>
<br />
<br />
<blockquote class="layui-elem-quote" align="left">运单明细</blockquote>
<table class="layui-hide" id="test" lay-filter="test"></table>
<script type="text/html" id="toolbarDemo">
</script>
<script type="text/html" id="barDemo">
{{#console.log(d.param=='')}}
{{# if(d.param==''){ }}
<a class="layui-btn layui-btn-danger layui-btn-xs layui-btn-disabled" >主单</a>
{{# } else { }}
<a class="layui-btn layui-btn-danger layui-btn-xs " lay-event="del">删除</a>
{{# } }}
</script>
<!-- 注意:如果你直接复制所有代码到本地,上述js路径需要改成你本地的 -->
<script>
layui.use('table', function() {
var table = layui.table;
table.render({
elem : '#test',
url : '<%=basePath%>fendanList2',
toolbar : '#toolbarDemo',
title : '用户数据表',
cols : [ [ {
field : 'waybillnomaster',
title : '主单号',
width : 300,
edit : 'text'
}, {
field : 'flightno',
title : '航班号',
width : 300,
edit : 'text'
},{
field : 'flightDate',
title : '航班日期',
width : 300,
edit : 'text'
},{
field : 'param',
title : '分单号',
width : 300,
edit : 'text'
},{fixed: 'right',
title:'操作',
align:'center',
toolbar: '#barDemo',
width:300}
] ],
page : true,
done: function (res, curr, count) {// 表格渲染完成之后的回调
$(".layui-table th").css("font-weight", "bold");
LayUIDataTable.SetJqueryObj($);
var currentRowDataList = LayUIDataTable.ParseDataTable(function (index, currentData, rowData) {})
console.log(currentRowDataList);
console.log(currentRowDataList);
$.each(currentRowDataList, function (index, obj) {
/* LayUIDataTable.HideField('param'); */
if (obj['param'] && obj['param'].value == '') {
obj['param'].row.css({"background-color": "#CAE1FF"});
}else{
obj['param'].row.css({"background-color": "#CD6090"});
}
});
}
});
//头工具栏事件
table.on('toolbar(test)', function(obj) {
var checkStatus = table.checkStatus(obj.config.id);
switch (obj.event) {
case 'getCheckData':
var data = checkStatus.data;
console.log(data);
/* var autoid=data[0].autoid;
var flightno=data[0].flightno;
console.log(autoid);
console.log(flightno); */
layer.confirm('删除', function(index){
$.ajax({
type : "post",
url : "<%=basePath %>felfd",
data : JSON.stringify(data),
contentType:"application/json",
success: function(data){
if(data.success){
layer.alert( data.msg, function () {
layer.closeAll();
var waybillnomaster=$('#waybillnomaster').val();
setTimeout(function(){
table.reload('test', { //表格的id
url:'<%=basePath%>fendanselectByParam',
page:{
curr:1 //从第一页开始
},
where: {
'waybillnomaster':$.trim(waybillnomaster),
}
});});
});
}
},
error: function() {
layer.alert("更改失败,请重试");
}
});
});
break;
case 'getCheckLength':
var data = checkStatus.data;
var datalength = data.length;
if(datalength>1){
layer.alert("不能同时修改两个");
}else{
var id = data.id;
layer.open({
type: 2,
title: "落装申请",
shade: 0.8,
id: (new Date()).valueOf(), //设定一个id,防止重复弹出 时间戳1280977330748
moveType: 1, //拖拽模式,0或者1
type: 2,
skin: 'layui-layer-rim', //加上边框
area: ['450px', '400px'],
maxmin: true, //开启最大化最小化按钮
content: "<%=basePath %>edit?id="+id,
success: function (layero, index) {
// 获取子页面的iframe
var iframe = window['layui-layer-iframe' + index];
// 向子页面的全局函数child传参
iframe.child(data);
}
});
}
break;
case 'isAll':
layer.msg(checkStatus.isAll ? '全选' : '未全选');
break;
}
;
});
//监听行工具事件
table.on('tool(test)', function(obj) {
var data = obj.data;
//console.log(obj)
if (obj.event === 'del') {
layer.confirm('真的删除行么', function(index) {
var arrayObj = new Array();
arrayObj[0]=data;
console.log(arrayObj);
/* obj.del();
layer.close(index); */
$.ajax({
type : "post",
url : "<%=basePath %>felfd",
data : JSON.stringify(arrayObj),
contentType:"application/json",
success: function(data){
if(data.success){
layer.alert( data.msg, function () {
layer.closeAll();
var waybillnomaster=$('#waybillnomaster').val();
setTimeout(function(){
table.reload('test', { //表格的id
url:'<%=basePath%>fendanselectByParam',
page:{
curr:1 //从第一页开始
},
where: {
'waybillnomaster':$.trim(waybillnomaster),
}
});});
});
}
},
error: function() {
layer.alert("更改失败,请重试");
}
});
layer.close(index);
});
} else if (obj.event === 'edit') {
layer.prompt({
formType : 2,
value : data.email
}, function(value, index) {
obj.update({
email : value
});
layer.close(index);
});
}
});
$('#searchBtn').on('click',function(){
var type = $(this).data('type');
console.log(type);
active[type] ? active[type].call(this) : '';
});
// 点击获取数据
var active = {
getInfo: function () {
var waybillnomaster=$('#waybillnomaster').val();
/* if (flightno) { */
var index = layer.msg('查询中,请稍候...',{icon: 16,time:false,shade:0});
setTimeout(function(){
table.reload('test', { //表格的id
url:'<%=basePath %>fendanselectByParam',
page:{
curr:1 //从第一页开始
},
where: {
'waybillnomaster':$.trim(waybillnomaster)
}
});
layer.close(index);
},800);
/* } else {
layer.msg("请输入航班号");
} */
},
};
});
</script>
<script type="text/javascript">
layui.use(['form', 'laydate'], function(){
var form = layui.form
,laydate = layui.laydate;
//日期
laydate.render({
elem: '#flightdate'
});
});
</script>
</body>
</html>
\ No newline at end of file
... ...
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page isELIgnored="false"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!doctype html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>落装申请修改</title>
<%-- <link href="<%=basePath %>static/css/login.css" rel="stylesheet"> --%>
<link href="<%=basePath %>static/layui2.4.5/css/layui.css" rel="stylesheet">
<style type="text/css">
.layui-input-b1ock {
margin-left: 510px;
min-height: 36px;
}
</style>
<script src="<%=basePath %>static/easyui/jquery.min.js"></script>
<script src="<%=basePath %>static/layui2.4.5/layui.js"></script>
<script type="text/javascript" src="<%=basePath %>static/layer-v3.0.3/layer/layer.js"></script>
<script>
var olddate="";
var flyno="";
function child(d) {
$("#flightdate").val(d.flightDate.substring(0,10));
olddate=d.flightDate.substring(0,10);
flyno=d.flightno;
console.log(olddate);
}
layui.use(['layer', 'form','laydate'], function(){
var layer = layui.layer
,laydate=layui.laydate
,form = layui.form;
//监听提交
form.on('submit(demo1)', function(data){
if(check()){
editForm(data.field);
}
return false;
});
});
function editForm(data){
data.id=olddate;
data.flyno=flyno;
$.ajax({
type : "post",
url : "<%=basePath %>upeditForm",
data : data,
success: function(data){
if(data.success){
layer.alert( data.msg, function () {
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
parent.$('#flightdate').val($("#flightdate").val());
console.log(data.flightDat);
parent.tools.func1();
});
}else{
layer.alert( data.msg, function () {
window.parent.location.reload(); //刷新父页面
parent.layer.close(index); //关闭当前弹窗
});
}
},
error: function() {
layer.alert("保存失败,请重试");
}
});
}
</script>
</head >
<body style="margin: auto">
<blockquote class="layui-elem-quote">运单信息编辑</blockquote>
<hr>
<form class="layui-form" action="" lay-filter="example">
<input type="hidden" id="id" name="id" autocomplete="off" class="layui-input" >
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">航班日期</label>
<div class="layui-input-inline">
<input type="text" id="flightdate" name="flightdate" autocomplete="off" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item" >
<div class="layui-input-b1ock">
<button class="layui-btn" lay-submit="" lay-filter="demo1">
<c:if test="${empty ftId }">保存</c:if>
<c:if test="${not empty ftId}">修改</c:if>
</button>
</div>
</div>
</form>
<script type="text/javascript">
layui.use(['form', 'laydate'], function(){
var form = layui.form
,laydate = layui.laydate;
//日期
laydate.render({
elem: '#flightdate'
});
});
function check(){
var flightdate = $("#flightdate").val();
var regs = /[a-z]/i;
if(flightdate==''){
$("#flightdate").focus();
layer.tips('请输入航班日期', '#flightdate', {
tips: [1, '#0FA6D8'] //还可配置颜色
});
return false;
}
return true;
}
</script>
</body >
</html >
\ No newline at end of file
... ...
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<!doctype html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>进港原始分批业务挂分单</title>
<script src="<%=basePath%>static/easyui/jquery.min.js"></script>
<link href="<%=basePath%>static/layui2.4.5/css/layui.css"
rel="stylesheet">
<script src="<%=basePath%>static/layui2.4.5/layui.js"></script>
<script type="text/javascript"
src="<%=basePath%>static/layer-v3.0.3/layer/layer.js"></script>
<script src="<%=basePath%>static/DataTableExtend.js"></script>
<style>
body {
}
</style>
</head>
<body>
<br />
<blockquote class="layui-elem-quote" align="left">挂分担</blockquote>
<div class="layui-inline">
<div class="layui-inline">
<label class="layui-form-label"
style="font-weight: bold; font-size: 15px; width: 70px;">运单号:</label>
<div class="layui-input-inline">
<input type="text" name="waybillnomaster" autocomplete="off"
class="layui-input" id="waybillnomaster" />
</div>
</div>
</div>
<div class="layui-inline">
<button class="layui-btn layui-btn-radius" lay-submit=""
id="searchBtn" data-type="getInfo">查询</button>
</div>
<br />
<br />
<blockquote class="layui-elem-quote" align="left">运单明细</blockquote>
<table class="layui-hide" id="test" lay-filter="test"></table>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-radius layui-btn-sm" lay-event="getCheckData">挂分单</button>
</div>
</script>
<script type="text/html" id="barDemo">
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" >删除</a>
</script>
<!-- 注意:如果你直接复制所有代码到本地,上述js路径需要改成你本地的 -->
<script>
layui.use('table', function() {
var table = layui.table;
table.render({
elem : '#test',
url : '<%=basePath%>fendanList2',
toolbar : '#toolbarDemo',
title : '用户数据表',
cols : [ [ {
type : 'checkbox',
fixed : 'left'
}, {
field : 'flightno',
title : '航班号',
width : 300,
edit : 'text'
},{
field : 'flightDate',
title : '航班日期',
width : 300,
edit : 'text'
}, {
field : 'param',
title : '分单号',
width : 300,
edit : 'text'
}
] ],
page : true,
done: function (res, curr, count) {// 表格渲染完成之后的回调
$(".layui-table th").css("font-weight", "bold");
LayUIDataTable.SetJqueryObj($);
var currentRowDataList = LayUIDataTable.ParseDataTable(function (index, currentData, rowData) {})
console.log(currentRowDataList);
console.log(currentRowDataList);
$.each(currentRowDataList, function (index, obj) {
/* LayUIDataTable.HideField('param'); */
if (obj['param'] && obj['param'].value == '') {
obj['param'].row.css({"background-color": "#CAE1FF"});
}else{
obj['param'].row.css({"background-color": "#CD6090"});
}
});
}
});
//头工具栏事件
table.on('toolbar(test)', function(obj) {
var checkStatus = table.checkStatus(obj.config.id);
switch (obj.event) {
case 'getCheckData':
var data = checkStatus.data;
console.log(data[0].waybillnomaster);
/* var autoid=data[0].autoid;
var flightno=data[0].flightno;
console.log(autoid);
console.log(flightno); */
layer.confirm('您确定要挂单吗', function(index){
$.ajax({
type : "post",
url : "<%=basePath%>fendanupdate",
data : JSON.stringify(data),
contentType:"application/json",
success: function(data){
if(data.success){
layer.alert( data.msg, function () {
var index = parent.layer.getFrameIndex(window.name);
console.log(index);
layer.closeAll();
var waybillnomaster=$('#waybillnomaster').val();
setTimeout(function(){
table.reload('test', { //表格的id
url:'<%=basePath%>fendanselectByParam',
page:{
curr:1 //从第一页开始
},
where: {
'waybillnomaster':$.trim(waybillnomaster),
}
});});
});
}
},
<%-- $('#waybillnomaster').val(data[0].waybillnomaster);
var flightno=$('#waybillnomaster').val();
setTimeout(function(){
table.reload('test', { //表格的id
url:'<%=basePath%>fendanselectByParam',
page:{
curr:1 //从第一页开始
},
where: {
'waybillnomaster':$.trim(waybillnomaster),
}
});}); --%>
error: function() {
layer.alert("更改失败,请重试");
}
});
});
break;
case 'getCheckLength':
var data = checkStatus.data;
var datalength = data.length;
if(datalength>1){
layer.alert("不能同时修改两个");
}else{
var id = data.id;
layer.open({
type: 2,
title: "落装申请",
shade: 0.8,
id: (new Date()).valueOf(), //设定一个id,防止重复弹出 时间戳1280977330748
moveType: 1, //拖拽模式,0或者1
type: 2,
skin: 'layui-layer-rim', //加上边框
area: ['450px', '400px'],
maxmin: true, //开启最大化最小化按钮
content: "<%=basePath%>edit?id="+id,
success: function (layero, index) {
// 获取子页面的iframe
var iframe = window['layui-layer-iframe' + index];
// 向子页面的全局函数child传参
iframe.child(data);
}
});
}
break;
case 'isAll':
layer.msg(checkStatus.isAll ? '全选' : '未全选');
break;
}
;
});
//监听行工具事件
table.on('tool(test)', function(obj) {
var data = obj.data;
//console.log(obj)
if (obj.event === 'del') {
layer.confirm('真的删除行么', function(index) {
obj.del();
layer.close(index);
});
} else if (obj.event === 'edit') {
layer.prompt({
formType : 2,
value : data.email
}, function(value, index) {
obj.update({
email : value
});
layer.close(index);
});
}
});
$('#searchBtn').on('click',function(){
var type = $(this).data('type');
console.log(type);
active[type] ? active[type].call(this) : '';
});
// 点击获取数据
var active = {
getInfo: function () {
var waybillnomaster=$('#waybillnomaster').val();
/* if (flightno) { */
var index = layer.msg('查询中,请稍候...',{icon: 16,time:false,shade:0});
setTimeout(function(){
table.reload('test', { //表格的id
url:'<%=basePath%>fendanselectByParam',
page:{
curr:1 //从第一页开始
},
where: {
'waybillnomaster':$.trim(waybillnomaster)
}
});
layer.close(index);
},800);
/* } else {
layer.msg("请输入航班号");
} */
},
};
});
</script>
<script type="text/javascript">
layui.use(['form', 'laydate'], function(){
var form = layui.form
,laydate = layui.laydate;
//日期
laydate.render({
elem: '#flightdate'
});
});
</script>
</body>
</html>
\ No newline at end of file
... ...
var LayUIDataTable = (function () {
var rowData = {};
var $;
function checkJquery () {
if (!$) {
console.log("未获取jquery对象,请检查是否在调用ConvertDataTable方法之前调用SetJqueryObj进行设置!")
return false;
} else return true;
}
/**
* 转换数据表格。
* @param callback 双击行的回调函数,该回调函数返回三个参数,分别为:当前点击行的索引值、当前点击单元格的值、当前行数据
* @returns {Array} 返回当前数据表当前页的所有行数据。数据结构:<br/>
* [
* {字段名称1:{value:"当前字段值",cell:"当前字段所在单元格td对象",row:"当前字段所在行tr对象"}}
* ,{字段名称2:{value:"",cell:"",row:""}}
* ]
* @constructor
*/
function ConvertDataTable (callback) {
if (!checkJquery()) return;
var dataList = [];
var rowData = {};
var trArr = $(".layui-table-body.layui-table-main tr");// 行数据
if (!trArr || trArr.length == 0) {
console.log("未获取到相关行数据,请检查数据表格是否渲染完毕!");
return;
}
$.each(trArr, function (index, trObj) {
var currentClickRowIndex;
var currentClickCellValue;
$(trObj).dblclick(function (e) {
var returnData = {};
var currentClickRow = $(e.currentTarget);
currentClickRowIndex = currentClickRow.data("index");
currentClickCellValue = e.target.innerHTML
$.each(dataList[currentClickRowIndex], function (key, obj) {
returnData[key] = obj.value;
});
callback(currentClickRowIndex, currentClickCellValue, returnData);
});
var tdArrObj = $(trObj).find('td');
rowData = {};
// 每行的单元格数据
$.each(tdArrObj, function (index_1, tdObj) {
var td_field = $(tdObj).data("field");
rowData[td_field] = {};
rowData[td_field]["value"] = $($(tdObj).html()).html();
rowData[td_field]["cell"] = $(tdObj);
rowData[td_field]["row"] = $(trObj);
})
dataList.push(rowData);
})
return dataList;
}
return {
/**
* 设置JQuery对象,第一步操作。如果你没有在head标签里面引入jquery且未执行该方法的话,ParseDataTable方法、HideField方法会无法执行,出现找不到 $ 的错误。如果你是使用LayUI内置的Jquery,可以
* var $ = layui.jquery 然后把 $ 传入该方法
* @param jqueryObj
* @constructor
*/
SetJqueryObj: function (jqueryObj) {
$ = jqueryObj;
}
/**
* 转换数据表格
*/
, ParseDataTable: ConvertDataTable
/**
* 隐藏字段
* @param fieldName 要隐藏的字段名(field名称)参数可为字符串(隐藏单列)或者数组(隐藏多列)
* @constructor
*/
, HideField: function (fieldName) {
if (!checkJquery()) return;
if (fieldName instanceof Array) {
$.each(fieldName, function (index, field) {
$("[data-field='" + field + "']").css('display', 'none');
})
} else if (typeof fieldName === 'string') {
$("[data-field='" + fieldName + "']").css('display', 'none');
} else {
}
}
}
})();
\ No newline at end of file
... ...