作者 赵超

小工具 赵超

  1 +package com.tianbo.controller.fendan;
  2 +
  3 +import java.util.HashMap;
  4 +import java.util.List;
  5 +import java.util.Map;
  6 +
  7 +import javax.servlet.http.HttpServletRequest;
  8 +
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.stereotype.Controller;
  11 +import org.springframework.ui.ModelMap;
  12 +import org.springframework.web.bind.annotation.RequestBody;
  13 +import org.springframework.web.bind.annotation.RequestMapping;
  14 +import org.springframework.web.bind.annotation.RequestMethod;
  15 +import org.springframework.web.bind.annotation.RequestParam;
  16 +import org.springframework.web.bind.annotation.ResponseBody;
  17 +
  18 +import com.tianbo.model.ManifestLoad;
  19 +import com.tianbo.model.Originmanifestmaster;
  20 +import com.tianbo.model.Originmanifestsecondary;
  21 +import com.tianbo.service.FenDanService;
  22 +import com.tianbo.service.LostService;
  23 +import com.tianbo.util.DateUtils;
  24 +import com.tianbo.util.json.AjaxJson;
  25 +import com.tianbo.util.json.JsonConversion;
  26 +
  27 +@Controller
  28 +public class FenDanController {
  29 +
  30 + @Autowired
  31 + private FenDanService fendanService;
  32 +
  33 + @RequestMapping("/fendan")
  34 + public String fendao(ModelMap model, HttpServletRequest request) {
  35 + return "fendan/fendanlist";
  36 + }
  37 +
  38 + @ResponseBody
  39 + @RequestMapping(value = "fendanList")
  40 + public String getList(HttpServletRequest request, int page, int limit) {
  41 + int start = (page - 1) * limit + 1;
  42 + int end = page * limit;
  43 + List<Originmanifestmaster> lost = fendanService.getList(start, end);
  44 + System.out.println(lost.size());
  45 + Originmanifestmaster ft = new Originmanifestmaster();
  46 + int count = fendanService.FendanCount(ft);
  47 + Map<String, Object> map = new HashMap<>();
  48 + if (!lost.isEmpty()) {
  49 + map.put("code", 0);
  50 + map.put("count", count);
  51 + map.put("msg", "success");
  52 + map.put("data", lost);
  53 + } else {
  54 + map.put("code", -1);
  55 + map.put("msg", "请检查网络连接或重试");
  56 + map.put("data", "");
  57 + }
  58 + return JsonConversion.writeMapJSON(map);
  59 + }
  60 + @ResponseBody
  61 + @RequestMapping(value = "fendanList2")
  62 + public String getList2(HttpServletRequest request, int page, int limit) {
  63 + int start = (page - 1) * limit + 1;
  64 + int end = page * limit;
  65 + List<Originmanifestmaster> lost = fendanService.getListfd(start, end);
  66 + System.out.println(lost.size());
  67 + Originmanifestmaster ft = new Originmanifestmaster();
  68 + int count = fendanService.FendanCount1(ft);
  69 + Map<String, Object> map = new HashMap<>();
  70 + if (!lost.isEmpty()) {
  71 + map.put("code", 0);
  72 + map.put("count", count);
  73 + map.put("msg", "success");
  74 + map.put("data", lost);
  75 + } else {
  76 + map.put("code", -1);
  77 + map.put("msg", "请检查网络连接或重试");
  78 + map.put("data", "");
  79 + }
  80 + return JsonConversion.writeMapJSON(map);
  81 + }
  82 +
  83 + @ResponseBody
  84 + @RequestMapping(value = "fendanselectByParam")
  85 + public String selectByParam(HttpServletRequest request,int page,int limit,String waybillnomaster,String flightno,String flightdate){
  86 + int start = (page-1)*limit+1;
  87 + int end = page*limit;
  88 + System.out.println(flightdate);
  89 + List<Originmanifestmaster> lost = fendanService.fdselectByParam(start,end,waybillnomaster,flightno,flightdate);
  90 + Originmanifestmaster fs = new Originmanifestmaster();
  91 + fs.setWaybillnomaster(waybillnomaster);
  92 + fs.setFlightno(flightno);
  93 + int count = fendanService.FendanCount1(fs);
  94 + System.out.println(count);
  95 + Map<String,Object> map = new HashMap<>();
  96 + if(!lost.isEmpty()){
  97 + map.put("code", 0);
  98 + map.put("count", count);
  99 + map.put("msg", "success");
  100 + map.put("data", lost);
  101 + }else {
  102 + map.put("code", -1);
  103 + map.put("msg", "无此条件信息");
  104 + map.put("data", "");
  105 + }
  106 + return JsonConversion.writeMapJSON(map);
  107 + }
  108 +
  109 + @ResponseBody
  110 + @RequestMapping(value = "fendanselectByParam2")
  111 + public String selectByParam2(HttpServletRequest request,int page,int limit,String waybillnomaster,String flightno,String flightdate){
  112 + int start = (page-1)*limit+1;
  113 + int end = page*limit;
  114 + System.out.println(flightdate);
  115 + List<Originmanifestmaster> lost = fendanService.fdselectByParam1(start,end,flightno,flightdate);
  116 + Originmanifestmaster fs = new Originmanifestmaster();
  117 + fs.setFlightno(flightno);
  118 + System.out.println(flightdate);
  119 + fs.setFlightDate(flightdate);
  120 + int count = fendanService.FendanCount(fs);
  121 + System.out.println(count);
  122 + Map<String,Object> map = new HashMap<>();
  123 + if(!lost.isEmpty()){
  124 + map.put("code", 0);
  125 + map.put("count", count);
  126 + map.put("msg", "success");
  127 + map.put("data", lost);
  128 + }else {
  129 + map.put("code", -1);
  130 + map.put("msg", "无此条件信息");
  131 + map.put("data", "");
  132 + }
  133 + return JsonConversion.writeMapJSON(map);
  134 + }
  135 +
  136 + /**
  137 + * 挂分担
  138 + * @param fendanupdate
  139 + * @param list
  140 + * @return
  141 + */
  142 + @ResponseBody
  143 + @RequestMapping(value = "fendanupdate", method = RequestMethod.POST)
  144 + public AjaxJson fendanupdate(HttpServletRequest request,@RequestBody List<Originmanifestmaster> list) {
  145 + String message = null;
  146 + AjaxJson j = new AjaxJson();
  147 +
  148 + try {
  149 + //循环json数组
  150 + List<Originmanifestmaster> listone=list; for (Originmanifestmaster
  151 + originmanifestmaster : listone) {
  152 + String autoid=originmanifestmaster.getAutoid();
  153 + String waybillnomaster=originmanifestmaster.getWaybillnomaster();
  154 + Originmanifestsecondary oy=new Originmanifestsecondary();
  155 + oy.setOriginmanifestmasterautoid(autoid);
  156 + oy.setWaybillnomaster(waybillnomaster);
  157 + fendanService.updatefendan(oy);
  158 + System.out.println(originmanifestmaster.getAutoid());
  159 + }
  160 + j.setSuccess(true);
  161 + message = "修改状态成功";
  162 +
  163 + } catch (Exception e) {
  164 + j.setSuccess(false);
  165 + message = "修改状态失败";
  166 + e.printStackTrace();
  167 + }
  168 + j.setMsg(message);
  169 + return j;
  170 + }
  171 +
  172 +
  173 + /**
  174 + * 删除
  175 + * @param fendanupdate
  176 + * @param list
  177 + * @return
  178 + */
  179 + @ResponseBody
  180 + @RequestMapping(value = "felfd", method = RequestMethod.POST)
  181 + public AjaxJson delfd(HttpServletRequest request,@RequestBody List<Originmanifestmaster> list) {
  182 + String message = null;
  183 + System.out.println("---------"+list);
  184 + AjaxJson j = new AjaxJson();
  185 +
  186 + try {
  187 + //循环json数组
  188 +
  189 + List<Originmanifestmaster> listone=list; for (Originmanifestmaster
  190 + originmanifestmaster : listone) {
  191 + String autoid=originmanifestmaster.getAutoid();
  192 + String waybillnomaster=originmanifestmaster.getWaybillnomaster();
  193 + String param=originmanifestmaster.getParam();
  194 + Originmanifestsecondary oy=new Originmanifestsecondary();
  195 + oy.setOriginmanifestmasterautoid(autoid);
  196 + oy.setWaybillnomaster(waybillnomaster);
  197 + oy.setWaybillnosecondary(param);
  198 + fendanService.delfd(oy);
  199 + System.out.println(originmanifestmaster.getAutoid());
  200 + }
  201 + j.setSuccess(true);
  202 + message = "删除状态成功";
  203 +
  204 + }catch (Exception e) {
  205 + j.setSuccess(false);
  206 + message = "删除状态失败";
  207 + e.printStackTrace();
  208 + }
  209 + j.setMsg(message);
  210 + return j;
  211 + }
  212 +
  213 + @RequestMapping(value ="edit")
  214 + public String edit(ModelMap model,HttpServletRequest request) {
  215 + model.put("ftId", request.getParameter("id"));
  216 + return "fendan/edit";
  217 + }
  218 + /**
  219 + * 编辑或新增
  220 + * @param lost
  221 + * @param redirectAttributes
  222 + * @return
  223 + */
  224 + @ResponseBody
  225 + @RequestMapping(value = "upeditForm")
  226 + public AjaxJson upeditForm(ModelMap model,HttpServletRequest request) {
  227 +
  228 + String flightdate = request.getParameter("flightdate");
  229 + String oldflightdate = request.getParameter("id");
  230 + String flightno = request.getParameter("flyno");
  231 + System.out.println(oldflightdate);
  232 + String message = null;
  233 + AjaxJson j = new AjaxJson();
  234 +
  235 + try {
  236 + Originmanifestmaster or=new Originmanifestmaster();
  237 + or.setFlightDate(flightdate);
  238 + or.setParam(oldflightdate);
  239 + or.setFlightno(flightno);
  240 + System.out.println("++++++++++++++"+or.getFlightDate());
  241 + /* lostService.saveorupdate(manifest); */
  242 + fendanService.updateriqi(or);
  243 + System.out.println(flightdate);
  244 + j.setSuccess(true);
  245 + message = "修改成功";
  246 + } catch (Exception e) {
  247 + j.setSuccess(false);
  248 + message = "修改失败";
  249 + e.printStackTrace();
  250 + }
  251 + j.setMsg(message);
  252 + return j;
  253 + }
  254 +
  255 +}
  1 +package com.tianbo.controller.fendan;
  2 +
  3 +import javax.servlet.http.HttpServletRequest;
  4 +
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.stereotype.Controller;
  7 +import org.springframework.ui.ModelMap;
  8 +import org.springframework.web.bind.annotation.RequestMapping;
  9 +
  10 +import com.tianbo.service.FenDanService;
  11 +
  12 +@Controller
  13 +public class UpdateDate {
  14 + @Autowired
  15 + private FenDanService fendanService;
  16 +
  17 + @RequestMapping("/updatedate")
  18 + public String fendao(ModelMap model, HttpServletRequest request) {
  19 + System.out.println("---");
  20 + return "fendan/UpdateDate";
  21 + }
  22 + @RequestMapping("/delfendan")
  23 + public String delfendan(ModelMap model, HttpServletRequest request) {
  24 + System.out.println("---");
  25 + return "fendan/delfendan";
  26 + }
  27 +}
  1 +package com.tianbo.mapper;
  2 +
  3 +import java.util.List;
  4 +
  5 +import org.apache.ibatis.annotations.Param;
  6 +
  7 +import com.tianbo.model.ManifestLoad;
  8 +import com.tianbo.model.Originmanifestmaster;
  9 +import com.tianbo.model.Originmanifestsecondary;
  10 +
  11 +public interface FenDanMapper {
  12 + List<Originmanifestmaster> getList(@Param("start")int start, @Param("end")int end);
  13 +
  14 + List<Originmanifestmaster> getListfd(@Param("start")int start, @Param("end")int end);
  15 +
  16 + int getCount(Originmanifestmaster mf);
  17 +
  18 + int getCount2(Originmanifestmaster mf);
  19 +
  20 + List<Originmanifestmaster> fdselectByParam(@Param("start")int start, @Param("end")int end, @Param("waybillnomaster")String waybillnomaster,@Param("flightno")String flightno,@Param("flightdate")String flightdate);
  21 +
  22 + int updatefendan(Originmanifestsecondary oy);
  23 +
  24 + int updateriqi(Originmanifestmaster oy);
  25 +
  26 + int delfd(Originmanifestsecondary oy);
  27 +
  28 + List<Originmanifestmaster> fdselectByParam1(@Param("start")int start, @Param("end")int end,@Param("flightno")String flightno,@Param("flightdate")String flightdate);
  29 +
  30 + List<Originmanifestmaster> findautoid(Originmanifestmaster oy);
  31 +
  32 +}
@@ -97,8 +97,18 @@ public class Originmanifestmaster { @@ -97,8 +97,18 @@ public class Originmanifestmaster {
97 private String specificConsigneePhone; 97 private String specificConsigneePhone;
98 98
99 private String consigneePhone; 99 private String consigneePhone;
  100 +
  101 + private String param;
100 102
101 - public String getAutoid() { 103 + public String getParam() {
  104 + return param;
  105 + }
  106 +
  107 + public void setParam(String param) {
  108 + this.param = param;
  109 + }
  110 +
  111 + public String getAutoid() {
102 return autoid; 112 return autoid;
103 } 113 }
104 114
  1 +package com.tianbo.service;
  2 +
  3 +import java.util.List;
  4 +
  5 +import com.tianbo.model.ManifestLoad;
  6 +import com.tianbo.model.Originmanifestmaster;
  7 +import com.tianbo.model.Originmanifestsecondary;
  8 +
  9 +public interface FenDanService {
  10 + List<Originmanifestmaster> getList(int start, int end);
  11 +
  12 + List<Originmanifestmaster> getListfd(int start, int end);
  13 +
  14 + int FendanCount(Originmanifestmaster mf);
  15 +
  16 + int FendanCount1(Originmanifestmaster mf);
  17 +
  18 + List<Originmanifestmaster> fdselectByParam(int start, int end, String waybillnomaste,String flightno,String flightdate);
  19 +
  20 + List<Originmanifestmaster> fdselectByParam1(int start, int end, String flightno,String flightdate);
  21 +
  22 + int updatefendan(Originmanifestsecondary oy);
  23 +
  24 + List<Originmanifestmaster> findautoid(Originmanifestmaster oy);
  25 +
  26 + int updateriqi(Originmanifestmaster oy);
  27 +
  28 + int delfd(Originmanifestsecondary oy);
  29 +
  30 +}
  1 +package com.tianbo.service.imp;
  2 +
  3 +import java.util.List;
  4 +
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.stereotype.Service;
  7 +import org.springframework.transaction.annotation.Transactional;
  8 +import com.tianbo.mapper.FenDanMapper;
  9 +import com.tianbo.model.ManifestLoad;
  10 +import com.tianbo.model.Originmanifestmaster;
  11 +import com.tianbo.model.Originmanifestsecondary;
  12 +import com.tianbo.service.FenDanService;
  13 +
  14 +@Service
  15 +@Transactional
  16 +public class FenDanServerImp implements FenDanService {
  17 + @Autowired
  18 + private FenDanMapper fendanDao;
  19 +
  20 + @Override
  21 + public List<Originmanifestmaster> getList(int start, int end) {
  22 + return fendanDao.getList(start, end);
  23 + }
  24 +
  25 + @Override
  26 + public int FendanCount(Originmanifestmaster mf) {
  27 + return fendanDao.getCount(mf);
  28 + }
  29 +
  30 + @Override
  31 + public List<Originmanifestmaster> fdselectByParam(int start, int end, String waybillnomaster,String flightno,String flightdate) {
  32 + return fendanDao.fdselectByParam(start,end,waybillnomaster,flightno,flightdate);
  33 + }
  34 +
  35 + @Override
  36 + public int updatefendan(Originmanifestsecondary oy) {
  37 + // TODO Auto-generated method stub
  38 + return fendanDao.updatefendan(oy);
  39 +
  40 + }
  41 +
  42 + @Override
  43 + public int updateriqi(Originmanifestmaster oy) {
  44 + // TODO Auto-generated method stub
  45 + return fendanDao.updateriqi(oy);
  46 + }
  47 +
  48 + @Override
  49 + public int delfd(Originmanifestsecondary oy) {
  50 + // TODO Auto-generated method stub
  51 + return fendanDao.delfd(oy);
  52 + }
  53 +
  54 + @Override
  55 + public List<Originmanifestmaster> fdselectByParam1(int start, int end,String flightno,String flightdate) {
  56 + // TODO Auto-generated method stub
  57 + return fendanDao.fdselectByParam1(start,end,flightno,flightdate);
  58 + }
  59 +
  60 + @Override
  61 + public int FendanCount1(Originmanifestmaster mf) {
  62 + // TODO Auto-generated method stub
  63 + return fendanDao.getCount2(mf);
  64 + }
  65 +
  66 + @Override
  67 + public List<Originmanifestmaster> getListfd(int start, int end) {
  68 + // TODO Auto-generated method stub
  69 + return fendanDao.getListfd(start, end);
  70 + }
  71 +
  72 + @Override
  73 + public List<Originmanifestmaster> findautoid(Originmanifestmaster oy) {
  74 + // TODO Auto-generated method stub
  75 + return fendanDao.findautoid(oy);
  76 + }
  77 +
  78 +}
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="com.tianbo.mapper.FenDanMapper">
  4 + <select id="getListfd"
  5 + resultType="com.tianbo.model.Originmanifestmaster">
  6 + SELECT
  7 + T2.*
  8 + FROM
  9 + ( SELECT ROWNUM RN, T.* FROM (
  10 + select mas.waybillnomaster,mas.flightno,mas.flight_date as flightdate,mas.autoid,''as waybillnosecondary from ORIGINMANIFESTMASTER mas
  11 + union
  12 + 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
  13 + )T ) T2
  14 + WHERE
  15 + RN BETWEEN #{start} AND #{end}
  16 + </select>
  17 + <select id="getList"
  18 + resultType="com.tianbo.model.Originmanifestmaster">
  19 + SELECT
  20 + T2.*
  21 + FROM
  22 + ( SELECT ROWNUM RN, T.* FROM ( SELECT * FROM ( SELECT
  23 + 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
  24 + FROM
  25 + originmanifestmaster ) ORDER BY createdate DESC ) T ) T2
  26 + WHERE
  27 + RN BETWEEN #{start} AND #{end}
  28 + </select>
  29 + <select id="getCount" parameterType="com.tianbo.model.Originmanifestmaster" resultType="java.lang.Integer" >
  30 + select count(*) from originmanifestmaster
  31 + WHERE 1=1
  32 + <if test="flightno != null and flightno != ''">
  33 + AND FLIGHTNO=#{flightno}
  34 + </if>
  35 + <if test="waybillnomaster != null and waybillnomaster != ''">
  36 + AND waybillnomaster=#{waybillnomaster}
  37 + </if>
  38 + <if test="flightDate != null and flightDate != ''">
  39 + and FLIGHT_DATE= "TO_DATE"(#{flightDate},'yyyy-mm-dd' )
  40 + </if>
  41 + </select>
  42 + <select id="findautoid" parameterType="com.tianbo.model.Originmanifestmaster" resultType="com.tianbo.model.Originmanifestmaster" >
  43 + select * from ORIGINMANIFESTMASTER
  44 + where
  45 + <if test="waybillnomaster != null and waybillnomaster != ''">
  46 + waybillnomaster=#{waybillnomaster}
  47 + </if>
  48 + </select>
  49 + <select id="getCount2" parameterType="com.tianbo.model.Originmanifestmaster" resultType="java.lang.Integer" >
  50 + <choose>
  51 + <when test="waybillnomaster != null and waybillnomaster != ''">
  52 + select count(*) from
  53 + (select mas.waybillnomaster,mas.flightno,mas.flight_date,mas.autoid,''as waybillnosecondary from ORIGINMANIFESTMASTER mas where mas.waybillnomaster=#{waybillnomaster}
  54 + union
  55 + 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}
  56 + )
  57 + </when >
  58 + <otherwise>
  59 + select count(*) from
  60 + (select mas.waybillnomaster,mas.flightno,mas.flight_date as flightdate,mas.autoid,''as waybillnosecondary from ORIGINMANIFESTMASTER mas
  61 + union
  62 + 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
  63 + )
  64 + </otherwise>
  65 + </choose>
  66 + </select>
  67 + <select id="fdselectByParam" resultType="com.tianbo.model.Originmanifestmaster">
  68 + SELECT
  69 + T2.*
  70 + FROM
  71 + ( SELECT ROWNUM RN, T.* FROM (
  72 + <if test="waybillnomaster != null and waybillnomaster != ''">
  73 + select*from(
  74 + select mas.waybillnomaster,mas.flightno,mas.flight_date as flightDate,mas.autoid,''as param from ORIGINMANIFESTMASTER mas where mas.waybillnomaster=#{waybillnomaster}
  75 + union
  76 + 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}
  77 + ) order by param desc
  78 + </if>
  79 + )T ) T2
  80 + WHERE
  81 + RN BETWEEN #{start} AND #{end}
  82 + </select>
  83 + <select id="fdselectByParam1" resultType="com.tianbo.model.Originmanifestmaster">
  84 + SELECT
  85 + T2.*
  86 + FROM
  87 + ( SELECT ROWNUM RN, T.* FROM ( SELECT flightno,flight_date as flightDate FROM ORIGINMANIFESTMASTER
  88 + <if test="flightno != null and flightno != ''">
  89 + where flightno = #{flightno,jdbcType=VARCHAR}
  90 + </if>
  91 + <if test="flightdate != null and flightdate !='' ">
  92 + and FLIGHT_DATE= "TO_DATE"(#{flightdate},'yyyy-mm-dd' )
  93 + </if>
  94 + ) T ) T2
  95 + WHERE
  96 + RN BETWEEN #{start} AND #{end}
  97 + </select>
  98 +
  99 + <update id="updatefendan" parameterType="com.tianbo.model.Originmanifestsecondary" >
  100 + update ORIGINMANIFESTSECONDARY
  101 + <set >
  102 + <if test="originmanifestmasterautoid != null" >
  103 + originmanifestmasterautoid = #{originmanifestmasterautoid,jdbcType=VARCHAR},
  104 + </if>
  105 + </set>
  106 + where waybillnomaster = #{waybillnomaster,jdbcType=VARCHAR}
  107 + </update>
  108 +
  109 + <update id="updateriqi" parameterType="com.tianbo.model.Originmanifestmaster" >
  110 + update originmanifestmaster
  111 + <set>
  112 + <if test="flightDate != null ">
  113 + FLIGHT_DATE= "TO_DATE"(#{flightDate},'yyyy-mm-dd' )
  114 + </if>
  115 + </set>
  116 + where flightno = #{flightno,jdbcType=VARCHAR}
  117 + and
  118 + FLIGHT_DATE= "TO_DATE"(#{param},'yyyy-mm-dd' )
  119 + </update>
  120 +
  121 + <delete id="delfd" parameterType="com.tianbo.model.Originmanifestsecondary">
  122 + DELETE FROM
  123 + ORIGINMANIFESTSECONDARY
  124 + where
  125 + <if test="originmanifestmasterautoid != null" >
  126 + originmanifestmasterautoid = #{originmanifestmasterautoid,jdbcType=VARCHAR}
  127 + </if>
  128 + <if test="waybillnosecondary != null" >
  129 + and Waybillnosecondary = #{waybillnosecondary,jdbcType=VARCHAR}
  130 + </if>
  131 + </delete>
  132 +</mapper>
  1 +<%@ page language="java" contentType="text/html; charset=UTF-8"
  2 + pageEncoding="UTF-8"%>
  3 +<%
  4 + String path = request.getContextPath();
  5 + String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
  6 + + path + "/";
  7 +%>
  8 +<!doctype html>
  9 +<html lang="zh">
  10 +
  11 +<head>
  12 +<meta charset="utf-8">
  13 +<meta name="viewport" content="width=device-width, initial-scale=1">
  14 +<title>修改航班日期</title>
  15 +<script src="<%=basePath%>static/easyui/jquery.min.js"></script>
  16 +<link href="<%=basePath%>static/layui2.4.5/css/layui.css"
  17 + rel="stylesheet">
  18 +<script src="<%=basePath%>static/layui2.4.5/layui.js"></script>
  19 +<script type="text/javascript"
  20 + src="<%=basePath%>static/layer-v3.0.3/layer/layer.js"></script>
  21 +<style>
  22 +body {
  23 +
  24 +}
  25 +</style>
  26 +<script type="text/html" id="barDemo">
  27 + <a class="layui-btn layui-btn-xs" lay-event="edit">修改航班日期</a>
  28 + </script>
  29 +</head>
  30 +<body>
  31 + <br />
  32 + <blockquote class="layui-elem-quote" align="left">航班号查询</blockquote>
  33 + <div class="layui-inline">
  34 + <div class="layui-inline">
  35 + <label class="layui-form-label"
  36 + style="font-size: 15px; font-weight: bold; width: 70px;">航班号:</label>
  37 + <div class="layui-input-inline">
  38 + <input type="text" name="flightno" id="flightno" autocomplete="off"
  39 + class="layui-input" style="text-transform: uppercase;"
  40 + onkeyup="this.value=this.value.toUpperCase()" />
  41 + </div>
  42 + <div class="layui-inline">
  43 + <label class="layui-form-label"
  44 + style="font-weight: bold; font-size: 15px; width: 80px;">航班日期:</label>
  45 + <div class="layui-input-inline">
  46 + <input type="text" autocomplete="off" class="layui-input" id="flightdate" name="flightdate"/>
  47 + </div>
  48 + </div>
  49 + </div>
  50 + </div>
  51 + <div class="layui-inline">
  52 + <button class="layui-btn layui-btn-radius" lay-submit=""
  53 + id="searchBtn" data-type="getInfo">查询</button>
  54 + </div>
  55 + <input id="handle_status" value="" hidden="hidden">
  56 + <br />
  57 + <br />
  58 + <blockquote class="layui-elem-quote" align="left">运单明细</blockquote>
  59 + <table class="layui-hide" id="test" lay-filter="test"></table>
  60 +
  61 +
  62 + <script type="text/html" id="barDemo">
  63 + <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
  64 + <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
  65 +</script>
  66 +
  67 +
  68 +
  69 + <!-- 注意:如果你直接复制所有代码到本地,上述js路径需要改成你本地的 -->
  70 +
  71 + <script>
  72 + layui.use('table', function() {
  73 + var table = layui.table;
  74 +
  75 + table.render({
  76 + elem : '#test',
  77 + url : '<%=basePath%>fendanList',
  78 + toolbar : '#toolbarDemo',
  79 + title : '用户数据表',
  80 + cols : [ [ {
  81 + type : 'checkbox',
  82 + fixed : 'left'
  83 + }, {
  84 + field : 'flightno',
  85 + title : '航班号',
  86 + width : 300,
  87 + fixed : 'left',
  88 + sort : true
  89 + }, {
  90 + field :'flightDate',
  91 + title : '航班日期',
  92 + width : 300
  93 + },{fixed: 'right', title:'操作',align:'center', toolbar: '#barDemo', width:300}
  94 +
  95 + ] ],
  96 + page : true
  97 + });
  98 + var _tools = {
  99 + func1: function(){
  100 + console.log('func1');
  101 + var flightno=$('#flightno').val();
  102 + var flightdate=$('#flightdate').val();
  103 + table.reload('test', { //表格的id
  104 + url:'<%=basePath%>fendanselectByParam2',
  105 + page:{
  106 + curr:1, //从第一页开始
  107 + limit:1
  108 + },
  109 + where: {
  110 + 'flightno':$.trim(flightno),
  111 + 'flightdate':$.trim(flightdate)
  112 +
  113 + }
  114 + });
  115 +
  116 + }
  117 + }
  118 + window.tools = _tools;
  119 + //监听行工具事件
  120 + table.on('tool(test)', function(obj) {
  121 + var data = obj.data;
  122 + //console.log(obj)
  123 + if (obj.event === 'edit') {
  124 + if (data) {
  125 + $('#flightno').val(data.flightno);
  126 + var id = data.id;
  127 + layer.open({
  128 + type: 2,
  129 + title: "落装申请",
  130 + shade: 0.8,
  131 + id: (new Date()).valueOf(), //设定一个id,防止重复弹出 时间戳1280977330748
  132 + moveType: 1, //拖拽模式,0或者1
  133 + type: 2,
  134 + skin: 'layui-layer-rim', //加上边框
  135 + /* area: [window.screen.width / 2 + 'px', window.screen.height / 2 + 'px'], //宽高 */
  136 + area: ['692px', '372px'],
  137 + maxmin: true, //开启最大化最小化按钮
  138 + content: "<%=basePath %>edit?id="+id,
  139 + success: function (layero, index) {
  140 + // 获取子页面的iframe
  141 + var iframe = window['layui-layer-iframe' + index];
  142 + // 向子页面的全局函数child传参
  143 + iframe.child(data);
  144 + }
  145 + })
  146 +
  147 + } else {
  148 + alert("请选择运单")
  149 + }
  150 +
  151 +
  152 + }
  153 +
  154 + });
  155 +
  156 + $('#searchBtn').on('click',function(){
  157 + var type = $(this).data('type');
  158 + console.log(type);
  159 + active[type] ? active[type].call(this) : '';
  160 + });
  161 + // 点击获取数据
  162 + var active = {
  163 + getInfo: function () {
  164 + var flightno=$('#flightno').val();
  165 + var flightdate=$('#flightdate').val();
  166 + /* if (flightno) { */
  167 + var index = layer.msg('查询中,请稍候...',{icon: 16,time:false,shade:0});
  168 + setTimeout(function(){
  169 + table.reload('test', { //表格的id
  170 + url:'<%=basePath%>fendanselectByParam2',
  171 + page:{
  172 + curr:1, //从第一页开始
  173 + limit:10
  174 + },
  175 + where: {
  176 + 'flightno':$.trim(flightno),
  177 + 'flightdate':$.trim(flightdate)
  178 + }
  179 + });
  180 + layer.close(index);
  181 + },800);
  182 + /* } else {
  183 + layer.msg("请输入航班号");
  184 + } */
  185 +
  186 + },
  187 + };
  188 + });
  189 +
  190 + </script>
  191 + <script type="text/javascript">
  192 + layui.use(['form', 'laydate'], function(){
  193 + var form = layui.form
  194 + ,laydate = layui.laydate;
  195 +
  196 + //日期
  197 + laydate.render({
  198 + elem: '#flightdate'
  199 + });
  200 + });
  201 + </script>
  202 +</body>
  203 +</html>
  1 +<%@ page language="java" contentType="text/html; charset=UTF-8"
  2 + pageEncoding="UTF-8"%>
  3 +<%
  4 + String path = request.getContextPath();
  5 + String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
  6 + + path + "/";
  7 +%>
  8 +<!doctype html>
  9 +<html lang="zh">
  10 +
  11 +<head>
  12 +<meta charset="utf-8">
  13 +<meta name="viewport" content="width=device-width, initial-scale=1">
  14 +<title>删分单</title>
  15 +<script src="<%=basePath%>static/easyui/jquery.min.js"></script>
  16 +<link href="<%=basePath%>static/layui2.4.5/css/layui.css"
  17 + rel="stylesheet">
  18 +<script src="<%=basePath%>static/layui2.4.5/layui.js"></script>
  19 +<script type="text/javascript"
  20 + src="<%=basePath%>static/layer-v3.0.3/layer/layer.js"></script>
  21 + <script src="<%=basePath%>static/DataTableExtend.js"></script>
  22 +<style>
  23 +
  24 +body {
  25 +
  26 +}
  27 +</style>
  28 +</head>
  29 +<body>
  30 + <br />
  31 + <blockquote class="layui-elem-quote" align="left">删分单</blockquote>
  32 + <div class="layui-inline">
  33 + <div class="layui-inline">
  34 + <label class="layui-form-label"
  35 + style="font-weight: bold; font-size: 15px; width: 70px;">运单号:</label>
  36 + <div class="layui-input-inline">
  37 + <input type="text" name="waybillnomaster" autocomplete="off"
  38 + class="layui-input" id="waybillnomaster" />
  39 + </div>
  40 + </div>
  41 +
  42 + </div>
  43 + <div class="layui-inline">
  44 + <button class="layui-btn layui-btn-radius" lay-submit="" id="searchBtn"
  45 + data-type="getInfo">查询</button>
  46 + </div>
  47 + <br />
  48 + <br />
  49 + <blockquote class="layui-elem-quote" align="left">运单明细</blockquote>
  50 + <table class="layui-hide" id="test" lay-filter="test"></table>
  51 +
  52 + <script type="text/html" id="toolbarDemo">
  53 +</script>
  54 +
  55 + <script type="text/html" id="barDemo">
  56 + {{#console.log(d.param=='')}}
  57 + {{# if(d.param==''){ }}
  58 + <a class="layui-btn layui-btn-danger layui-btn-xs layui-btn-disabled" >主单</a>
  59 + {{# } else { }}
  60 + <a class="layui-btn layui-btn-danger layui-btn-xs " lay-event="del">删除</a>
  61 + {{# } }}
  62 +</script>
  63 +
  64 +
  65 +
  66 + <!-- 注意:如果你直接复制所有代码到本地,上述js路径需要改成你本地的 -->
  67 +
  68 + <script>
  69 + layui.use('table', function() {
  70 + var table = layui.table;
  71 +
  72 + table.render({
  73 + elem : '#test',
  74 + url : '<%=basePath%>fendanList2',
  75 + toolbar : '#toolbarDemo',
  76 + title : '用户数据表',
  77 + cols : [ [ {
  78 + field : 'waybillnomaster',
  79 + title : '主单号',
  80 + width : 300,
  81 + edit : 'text'
  82 + }, {
  83 + field : 'flightno',
  84 + title : '航班号',
  85 + width : 300,
  86 + edit : 'text'
  87 + },{
  88 + field : 'flightDate',
  89 + title : '航班日期',
  90 + width : 300,
  91 + edit : 'text'
  92 + },{
  93 + field : 'param',
  94 + title : '分单号',
  95 + width : 300,
  96 + edit : 'text'
  97 + },{fixed: 'right',
  98 + title:'操作',
  99 + align:'center',
  100 + toolbar: '#barDemo',
  101 + width:300}
  102 + ] ],
  103 + page : true,
  104 + done: function (res, curr, count) {// 表格渲染完成之后的回调
  105 + $(".layui-table th").css("font-weight", "bold");
  106 + LayUIDataTable.SetJqueryObj($);
  107 + var currentRowDataList = LayUIDataTable.ParseDataTable(function (index, currentData, rowData) {})
  108 + console.log(currentRowDataList);
  109 + console.log(currentRowDataList);
  110 + $.each(currentRowDataList, function (index, obj) {
  111 + /* LayUIDataTable.HideField('param'); */
  112 + if (obj['param'] && obj['param'].value == '') {
  113 + obj['param'].row.css({"background-color": "#CAE1FF"});
  114 +
  115 + }else{
  116 + obj['param'].row.css({"background-color": "#CD6090"});
  117 + }
  118 + });
  119 + }
  120 + });
  121 +
  122 + //头工具栏事件
  123 + table.on('toolbar(test)', function(obj) {
  124 + var checkStatus = table.checkStatus(obj.config.id);
  125 + switch (obj.event) {
  126 + case 'getCheckData':
  127 +
  128 + var data = checkStatus.data;
  129 + console.log(data);
  130 + /* var autoid=data[0].autoid;
  131 + var flightno=data[0].flightno;
  132 + console.log(autoid);
  133 + console.log(flightno); */
  134 + layer.confirm('删除', function(index){
  135 + $.ajax({
  136 + type : "post",
  137 + url : "<%=basePath %>felfd",
  138 + data : JSON.stringify(data),
  139 + contentType:"application/json",
  140 + success: function(data){
  141 + if(data.success){
  142 + layer.alert( data.msg, function () {
  143 + layer.closeAll();
  144 + var waybillnomaster=$('#waybillnomaster').val();
  145 + setTimeout(function(){
  146 + table.reload('test', { //表格的id
  147 + url:'<%=basePath%>fendanselectByParam',
  148 + page:{
  149 + curr:1 //从第一页开始
  150 + },
  151 + where: {
  152 + 'waybillnomaster':$.trim(waybillnomaster),
  153 + }
  154 + });});
  155 + });
  156 + }
  157 + },
  158 + error: function() {
  159 + layer.alert("更改失败,请重试");
  160 + }
  161 + });
  162 +
  163 + });
  164 + break;
  165 + case 'getCheckLength':
  166 + var data = checkStatus.data;
  167 + var datalength = data.length;
  168 + if(datalength>1){
  169 + layer.alert("不能同时修改两个");
  170 + }else{
  171 + var id = data.id;
  172 + layer.open({
  173 + type: 2,
  174 + title: "落装申请",
  175 + shade: 0.8,
  176 + id: (new Date()).valueOf(), //设定一个id,防止重复弹出 时间戳1280977330748
  177 + moveType: 1, //拖拽模式,0或者1
  178 + type: 2,
  179 + skin: 'layui-layer-rim', //加上边框
  180 + area: ['450px', '400px'],
  181 + maxmin: true, //开启最大化最小化按钮
  182 + content: "<%=basePath %>edit?id="+id,
  183 + success: function (layero, index) {
  184 + // 获取子页面的iframe
  185 + var iframe = window['layui-layer-iframe' + index];
  186 + // 向子页面的全局函数child传参
  187 + iframe.child(data);
  188 + }
  189 + });
  190 + }
  191 + break;
  192 + case 'isAll':
  193 + layer.msg(checkStatus.isAll ? '全选' : '未全选');
  194 + break;
  195 + }
  196 + ;
  197 + });
  198 +
  199 + //监听行工具事件
  200 + table.on('tool(test)', function(obj) {
  201 + var data = obj.data;
  202 + //console.log(obj)
  203 + if (obj.event === 'del') {
  204 + layer.confirm('真的删除行么', function(index) {
  205 + var arrayObj = new Array();
  206 + arrayObj[0]=data;
  207 + console.log(arrayObj);
  208 + /* obj.del();
  209 + layer.close(index); */
  210 + $.ajax({
  211 + type : "post",
  212 + url : "<%=basePath %>felfd",
  213 + data : JSON.stringify(arrayObj),
  214 + contentType:"application/json",
  215 + success: function(data){
  216 + if(data.success){
  217 + layer.alert( data.msg, function () {
  218 + layer.closeAll();
  219 + var waybillnomaster=$('#waybillnomaster').val();
  220 + setTimeout(function(){
  221 + table.reload('test', { //表格的id
  222 + url:'<%=basePath%>fendanselectByParam',
  223 + page:{
  224 + curr:1 //从第一页开始
  225 + },
  226 + where: {
  227 + 'waybillnomaster':$.trim(waybillnomaster),
  228 + }
  229 + });});
  230 + });
  231 + }
  232 + },
  233 + error: function() {
  234 + layer.alert("更改失败,请重试");
  235 + }
  236 + });
  237 + layer.close(index);
  238 + });
  239 + } else if (obj.event === 'edit') {
  240 + layer.prompt({
  241 + formType : 2,
  242 + value : data.email
  243 + }, function(value, index) {
  244 + obj.update({
  245 + email : value
  246 + });
  247 + layer.close(index);
  248 + });
  249 + }
  250 + });
  251 +
  252 +
  253 + $('#searchBtn').on('click',function(){
  254 + var type = $(this).data('type');
  255 + console.log(type);
  256 + active[type] ? active[type].call(this) : '';
  257 + });
  258 + // 点击获取数据
  259 + var active = {
  260 + getInfo: function () {
  261 + var waybillnomaster=$('#waybillnomaster').val();
  262 + /* if (flightno) { */
  263 + var index = layer.msg('查询中,请稍候...',{icon: 16,time:false,shade:0});
  264 + setTimeout(function(){
  265 + table.reload('test', { //表格的id
  266 + url:'<%=basePath %>fendanselectByParam',
  267 + page:{
  268 + curr:1 //从第一页开始
  269 + },
  270 + where: {
  271 + 'waybillnomaster':$.trim(waybillnomaster)
  272 + }
  273 + });
  274 + layer.close(index);
  275 + },800);
  276 + /* } else {
  277 + layer.msg("请输入航班号");
  278 + } */
  279 +
  280 + },
  281 + };
  282 +
  283 + });
  284 + </script>
  285 + <script type="text/javascript">
  286 + layui.use(['form', 'laydate'], function(){
  287 + var form = layui.form
  288 + ,laydate = layui.laydate;
  289 +
  290 + //日期
  291 + laydate.render({
  292 + elem: '#flightdate'
  293 + });
  294 + });
  295 + </script>
  296 + </body>
  297 +</html>
  1 +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2 +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
  3 +<%@ page isELIgnored="false"%>
  4 +<%
  5 + String path = request.getContextPath();
  6 + String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
  7 +%>
  8 +<!doctype html>
  9 +<html lang="zh">
  10 +<head>
  11 + <meta charset="utf-8">
  12 + <meta name="viewport" content="width=device-width, initial-scale=1">
  13 + <title>落装申请修改</title>
  14 + <%-- <link href="<%=basePath %>static/css/login.css" rel="stylesheet"> --%>
  15 + <link href="<%=basePath %>static/layui2.4.5/css/layui.css" rel="stylesheet">
  16 + <style type="text/css">
  17 + .layui-input-b1ock {
  18 + margin-left: 510px;
  19 + min-height: 36px;
  20 + }
  21 + </style>
  22 + <script src="<%=basePath %>static/easyui/jquery.min.js"></script>
  23 + <script src="<%=basePath %>static/layui2.4.5/layui.js"></script>
  24 + <script type="text/javascript" src="<%=basePath %>static/layer-v3.0.3/layer/layer.js"></script>
  25 +
  26 + <script>
  27 + var olddate="";
  28 + var flyno="";
  29 + function child(d) {
  30 + $("#flightdate").val(d.flightDate.substring(0,10));
  31 + olddate=d.flightDate.substring(0,10);
  32 + flyno=d.flightno;
  33 + console.log(olddate);
  34 + }
  35 + layui.use(['layer', 'form','laydate'], function(){
  36 + var layer = layui.layer
  37 + ,laydate=layui.laydate
  38 + ,form = layui.form;
  39 + //监听提交
  40 + form.on('submit(demo1)', function(data){
  41 + if(check()){
  42 + editForm(data.field);
  43 + }
  44 + return false;
  45 + });
  46 + });
  47 +
  48 + function editForm(data){
  49 + data.id=olddate;
  50 + data.flyno=flyno;
  51 + $.ajax({
  52 + type : "post",
  53 + url : "<%=basePath %>upeditForm",
  54 + data : data,
  55 + success: function(data){
  56 + if(data.success){
  57 + layer.alert( data.msg, function () {
  58 + var index = parent.layer.getFrameIndex(window.name);
  59 + parent.layer.close(index);
  60 + parent.$('#flightdate').val($("#flightdate").val());
  61 + console.log(data.flightDat);
  62 + parent.tools.func1();
  63 + });
  64 + }else{
  65 + layer.alert( data.msg, function () {
  66 + window.parent.location.reload(); //刷新父页面
  67 +
  68 + parent.layer.close(index); //关闭当前弹窗
  69 + });
  70 + }
  71 + },
  72 + error: function() {
  73 + layer.alert("保存失败,请重试");
  74 + }
  75 + });
  76 + }
  77 + </script>
  78 +
  79 +
  80 +
  81 +</head >
  82 +
  83 +<body style="margin: auto">
  84 +<blockquote class="layui-elem-quote">运单信息编辑</blockquote>
  85 +<hr>
  86 +<form class="layui-form" action="" lay-filter="example">
  87 +<input type="hidden" id="id" name="id" autocomplete="off" class="layui-input" >
  88 + <div class="layui-form-item">
  89 + <div class="layui-inline">
  90 + <label class="layui-form-label">航班日期</label>
  91 + <div class="layui-input-inline">
  92 + <input type="text" id="flightdate" name="flightdate" autocomplete="off" class="layui-input">
  93 + </div>
  94 + </div>
  95 + </div>
  96 + <div class="layui-form-item" >
  97 + <div class="layui-input-b1ock">
  98 + <button class="layui-btn" lay-submit="" lay-filter="demo1">
  99 + <c:if test="${empty ftId }">保存</c:if>
  100 + <c:if test="${not empty ftId}">修改</c:if>
  101 + </button>
  102 + </div>
  103 + </div>
  104 +</form>
  105 + <script type="text/javascript">
  106 + layui.use(['form', 'laydate'], function(){
  107 + var form = layui.form
  108 + ,laydate = layui.laydate;
  109 +
  110 + //日期
  111 + laydate.render({
  112 + elem: '#flightdate'
  113 + });
  114 + });
  115 +
  116 + function check(){
  117 + var flightdate = $("#flightdate").val();
  118 + var regs = /[a-z]/i;
  119 + if(flightdate==''){
  120 + $("#flightdate").focus();
  121 + layer.tips('请输入航班日期', '#flightdate', {
  122 + tips: [1, '#0FA6D8'] //还可配置颜色
  123 + });
  124 + return false;
  125 + }
  126 + return true;
  127 + }
  128 +
  129 + </script>
  130 + </body >
  131 +</html >
  1 +<%@ page language="java" contentType="text/html; charset=UTF-8"
  2 + pageEncoding="UTF-8"%>
  3 +<%
  4 + String path = request.getContextPath();
  5 + String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
  6 + + path + "/";
  7 +%>
  8 +<!doctype html>
  9 +<html lang="zh">
  10 +
  11 +<head>
  12 +<meta charset="utf-8">
  13 +<meta name="viewport" content="width=device-width, initial-scale=1">
  14 +<title>进港原始分批业务挂分单</title>
  15 +<script src="<%=basePath%>static/easyui/jquery.min.js"></script>
  16 +<link href="<%=basePath%>static/layui2.4.5/css/layui.css"
  17 + rel="stylesheet">
  18 +<script src="<%=basePath%>static/layui2.4.5/layui.js"></script>
  19 +<script type="text/javascript"
  20 + src="<%=basePath%>static/layer-v3.0.3/layer/layer.js"></script>
  21 + <script src="<%=basePath%>static/DataTableExtend.js"></script>
  22 +<style>
  23 +
  24 +body {
  25 +
  26 +}
  27 +</style>
  28 +</head>
  29 +<body>
  30 + <br />
  31 + <blockquote class="layui-elem-quote" align="left">挂分担</blockquote>
  32 + <div class="layui-inline">
  33 + <div class="layui-inline">
  34 + <label class="layui-form-label"
  35 + style="font-weight: bold; font-size: 15px; width: 70px;">运单号:</label>
  36 + <div class="layui-input-inline">
  37 + <input type="text" name="waybillnomaster" autocomplete="off"
  38 + class="layui-input" id="waybillnomaster" />
  39 + </div>
  40 + </div>
  41 +
  42 +
  43 + </div>
  44 + <div class="layui-inline">
  45 + <button class="layui-btn layui-btn-radius" lay-submit=""
  46 + id="searchBtn" data-type="getInfo">查询</button>
  47 + </div>
  48 + <br />
  49 + <br />
  50 + <blockquote class="layui-elem-quote" align="left">运单明细</blockquote>
  51 + <table class="layui-hide" id="test" lay-filter="test"></table>
  52 +
  53 + <script type="text/html" id="toolbarDemo">
  54 + <div class="layui-btn-container">
  55 + <button class="layui-btn layui-btn-radius layui-btn-sm" lay-event="getCheckData">挂分单</button>
  56 + </div>
  57 +</script>
  58 +
  59 + <script type="text/html" id="barDemo">
  60 + <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
  61 + <a class="layui-btn layui-btn-danger layui-btn-xs" >删除</a>
  62 +</script>
  63 +
  64 +
  65 +
  66 + <!-- 注意:如果你直接复制所有代码到本地,上述js路径需要改成你本地的 -->
  67 +
  68 + <script>
  69 + layui.use('table', function() {
  70 + var table = layui.table;
  71 +
  72 + table.render({
  73 + elem : '#test',
  74 + url : '<%=basePath%>fendanList2',
  75 + toolbar : '#toolbarDemo',
  76 + title : '用户数据表',
  77 + cols : [ [ {
  78 + type : 'checkbox',
  79 + fixed : 'left'
  80 + }, {
  81 + field : 'flightno',
  82 + title : '航班号',
  83 + width : 300,
  84 + edit : 'text'
  85 + },{
  86 + field : 'flightDate',
  87 + title : '航班日期',
  88 + width : 300,
  89 + edit : 'text'
  90 + }, {
  91 + field : 'param',
  92 + title : '分单号',
  93 + width : 300,
  94 + edit : 'text'
  95 + }
  96 + ] ],
  97 + page : true,
  98 + done: function (res, curr, count) {// 表格渲染完成之后的回调
  99 + $(".layui-table th").css("font-weight", "bold");
  100 + LayUIDataTable.SetJqueryObj($);
  101 + var currentRowDataList = LayUIDataTable.ParseDataTable(function (index, currentData, rowData) {})
  102 + console.log(currentRowDataList);
  103 + console.log(currentRowDataList);
  104 + $.each(currentRowDataList, function (index, obj) {
  105 + /* LayUIDataTable.HideField('param'); */
  106 + if (obj['param'] && obj['param'].value == '') {
  107 + obj['param'].row.css({"background-color": "#CAE1FF"});
  108 + }else{
  109 + obj['param'].row.css({"background-color": "#CD6090"});
  110 + }
  111 + });
  112 + }
  113 + });
  114 +
  115 + //头工具栏事件
  116 + table.on('toolbar(test)', function(obj) {
  117 + var checkStatus = table.checkStatus(obj.config.id);
  118 + switch (obj.event) {
  119 + case 'getCheckData':
  120 +
  121 + var data = checkStatus.data;
  122 + console.log(data[0].waybillnomaster);
  123 + /* var autoid=data[0].autoid;
  124 + var flightno=data[0].flightno;
  125 + console.log(autoid);
  126 + console.log(flightno); */
  127 + layer.confirm('您确定要挂单吗', function(index){
  128 + $.ajax({
  129 + type : "post",
  130 + url : "<%=basePath%>fendanupdate",
  131 + data : JSON.stringify(data),
  132 + contentType:"application/json",
  133 + success: function(data){
  134 + if(data.success){
  135 + layer.alert( data.msg, function () {
  136 + var index = parent.layer.getFrameIndex(window.name);
  137 + console.log(index);
  138 + layer.closeAll();
  139 + var waybillnomaster=$('#waybillnomaster').val();
  140 + setTimeout(function(){
  141 + table.reload('test', { //表格的id
  142 + url:'<%=basePath%>fendanselectByParam',
  143 + page:{
  144 + curr:1 //从第一页开始
  145 + },
  146 + where: {
  147 + 'waybillnomaster':$.trim(waybillnomaster),
  148 + }
  149 + });});
  150 + });
  151 + }
  152 + },
  153 + <%-- $('#waybillnomaster').val(data[0].waybillnomaster);
  154 + var flightno=$('#waybillnomaster').val();
  155 + setTimeout(function(){
  156 + table.reload('test', { //表格的id
  157 + url:'<%=basePath%>fendanselectByParam',
  158 + page:{
  159 + curr:1 //从第一页开始
  160 + },
  161 + where: {
  162 + 'waybillnomaster':$.trim(waybillnomaster),
  163 + }
  164 + });}); --%>
  165 + error: function() {
  166 + layer.alert("更改失败,请重试");
  167 + }
  168 + });
  169 + });
  170 + break;
  171 + case 'getCheckLength':
  172 + var data = checkStatus.data;
  173 + var datalength = data.length;
  174 + if(datalength>1){
  175 + layer.alert("不能同时修改两个");
  176 + }else{
  177 + var id = data.id;
  178 + layer.open({
  179 + type: 2,
  180 + title: "落装申请",
  181 + shade: 0.8,
  182 + id: (new Date()).valueOf(), //设定一个id,防止重复弹出 时间戳1280977330748
  183 + moveType: 1, //拖拽模式,0或者1
  184 + type: 2,
  185 + skin: 'layui-layer-rim', //加上边框
  186 + area: ['450px', '400px'],
  187 + maxmin: true, //开启最大化最小化按钮
  188 + content: "<%=basePath%>edit?id="+id,
  189 + success: function (layero, index) {
  190 + // 获取子页面的iframe
  191 + var iframe = window['layui-layer-iframe' + index];
  192 + // 向子页面的全局函数child传参
  193 + iframe.child(data);
  194 + }
  195 + });
  196 + }
  197 + break;
  198 + case 'isAll':
  199 + layer.msg(checkStatus.isAll ? '全选' : '未全选');
  200 + break;
  201 + }
  202 + ;
  203 + });
  204 +
  205 + //监听行工具事件
  206 + table.on('tool(test)', function(obj) {
  207 + var data = obj.data;
  208 + //console.log(obj)
  209 + if (obj.event === 'del') {
  210 + layer.confirm('真的删除行么', function(index) {
  211 + obj.del();
  212 + layer.close(index);
  213 + });
  214 + } else if (obj.event === 'edit') {
  215 + layer.prompt({
  216 + formType : 2,
  217 + value : data.email
  218 + }, function(value, index) {
  219 + obj.update({
  220 + email : value
  221 + });
  222 + layer.close(index);
  223 + });
  224 + }
  225 + });
  226 +
  227 +
  228 + $('#searchBtn').on('click',function(){
  229 + var type = $(this).data('type');
  230 + console.log(type);
  231 + active[type] ? active[type].call(this) : '';
  232 + });
  233 + // 点击获取数据
  234 + var active = {
  235 + getInfo: function () {
  236 + var waybillnomaster=$('#waybillnomaster').val();
  237 + /* if (flightno) { */
  238 + var index = layer.msg('查询中,请稍候...',{icon: 16,time:false,shade:0});
  239 + setTimeout(function(){
  240 + table.reload('test', { //表格的id
  241 + url:'<%=basePath%>fendanselectByParam',
  242 + page:{
  243 + curr:1 //从第一页开始
  244 + },
  245 + where: {
  246 + 'waybillnomaster':$.trim(waybillnomaster)
  247 + }
  248 + });
  249 + layer.close(index);
  250 + },800);
  251 + /* } else {
  252 + layer.msg("请输入航班号");
  253 + } */
  254 +
  255 + },
  256 + };
  257 +
  258 + });
  259 + </script>
  260 + <script type="text/javascript">
  261 + layui.use(['form', 'laydate'], function(){
  262 + var form = layui.form
  263 + ,laydate = layui.laydate;
  264 +
  265 + //日期
  266 + laydate.render({
  267 + elem: '#flightdate'
  268 + });
  269 + });
  270 + </script>
  271 +</body>
  272 +</html>
  1 +var LayUIDataTable = (function () {
  2 + var rowData = {};
  3 + var $;
  4 +
  5 + function checkJquery () {
  6 + if (!$) {
  7 + console.log("未获取jquery对象,请检查是否在调用ConvertDataTable方法之前调用SetJqueryObj进行设置!")
  8 + return false;
  9 + } else return true;
  10 + }
  11 +
  12 + /**
  13 + * 转换数据表格。
  14 + * @param callback 双击行的回调函数,该回调函数返回三个参数,分别为:当前点击行的索引值、当前点击单元格的值、当前行数据
  15 + * @returns {Array} 返回当前数据表当前页的所有行数据。数据结构:<br/>
  16 + * [
  17 + * {字段名称1:{value:"当前字段值",cell:"当前字段所在单元格td对象",row:"当前字段所在行tr对象"}}
  18 + * ,{字段名称2:{value:"",cell:"",row:""}}
  19 + * ]
  20 + * @constructor
  21 + */
  22 + function ConvertDataTable (callback) {
  23 + if (!checkJquery()) return;
  24 + var dataList = [];
  25 + var rowData = {};
  26 + var trArr = $(".layui-table-body.layui-table-main tr");// 行数据
  27 + if (!trArr || trArr.length == 0) {
  28 + console.log("未获取到相关行数据,请检查数据表格是否渲染完毕!");
  29 + return;
  30 + }
  31 + $.each(trArr, function (index, trObj) {
  32 + var currentClickRowIndex;
  33 + var currentClickCellValue;
  34 +
  35 + $(trObj).dblclick(function (e) {
  36 + var returnData = {};
  37 + var currentClickRow = $(e.currentTarget);
  38 + currentClickRowIndex = currentClickRow.data("index");
  39 + currentClickCellValue = e.target.innerHTML
  40 + $.each(dataList[currentClickRowIndex], function (key, obj) {
  41 + returnData[key] = obj.value;
  42 + });
  43 + callback(currentClickRowIndex, currentClickCellValue, returnData);
  44 + });
  45 + var tdArrObj = $(trObj).find('td');
  46 + rowData = {};
  47 + // 每行的单元格数据
  48 + $.each(tdArrObj, function (index_1, tdObj) {
  49 + var td_field = $(tdObj).data("field");
  50 + rowData[td_field] = {};
  51 + rowData[td_field]["value"] = $($(tdObj).html()).html();
  52 + rowData[td_field]["cell"] = $(tdObj);
  53 + rowData[td_field]["row"] = $(trObj);
  54 +
  55 + })
  56 + dataList.push(rowData);
  57 + })
  58 + return dataList;
  59 + }
  60 +
  61 + return {
  62 + /**
  63 + * 设置JQuery对象,第一步操作。如果你没有在head标签里面引入jquery且未执行该方法的话,ParseDataTable方法、HideField方法会无法执行,出现找不到 $ 的错误。如果你是使用LayUI内置的Jquery,可以
  64 + * var $ = layui.jquery 然后把 $ 传入该方法
  65 + * @param jqueryObj
  66 + * @constructor
  67 + */
  68 + SetJqueryObj: function (jqueryObj) {
  69 + $ = jqueryObj;
  70 + }
  71 +
  72 + /**
  73 + * 转换数据表格
  74 + */
  75 + , ParseDataTable: ConvertDataTable
  76 +
  77 + /**
  78 + * 隐藏字段
  79 + * @param fieldName 要隐藏的字段名(field名称)参数可为字符串(隐藏单列)或者数组(隐藏多列)
  80 + * @constructor
  81 + */
  82 + , HideField: function (fieldName) {
  83 + if (!checkJquery()) return;
  84 + if (fieldName instanceof Array) {
  85 + $.each(fieldName, function (index, field) {
  86 + $("[data-field='" + field + "']").css('display', 'none');
  87 + })
  88 + } else if (typeof fieldName === 'string') {
  89 + $("[data-field='" + fieldName + "']").css('display', 'none');
  90 + } else {
  91 +
  92 + }
  93 + }
  94 + }
  95 +})();