New file |
| | |
| | | package com.zy.crm.manager.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.zy.crm.common.web.BaseController; |
| | | import com.zy.crm.manager.entity.BusinessTrip; |
| | | import com.zy.crm.manager.service.BusinessTripService; |
| | | import com.zy.crm.manager.utils.CarNumberUtils; |
| | | import com.zy.crm.manager.utils.TimeCalculatorUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | | public class BusinessTripController extends BaseController { |
| | | |
| | | @Autowired |
| | | private BusinessTripService businessTripService; |
| | | |
| | | @RequestMapping(value = "/businessTrip/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") String id) { |
| | | return R.ok(businessTripService.selectById(String.valueOf(id))); |
| | | } |
| | | |
| | | @RequestMapping(value = "/businessTrip/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | EntityWrapper<BusinessTrip> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | return R.ok(businessTripService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | String[] dates = val.split(RANGE_TIME_LINK); |
| | | wrapper.ge(entry.getKey(), DateUtils.convert(dates[0])); |
| | | wrapper.le(entry.getKey(), DateUtils.convert(dates[1])); |
| | | } else { |
| | | wrapper.like(entry.getKey(), val); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @RequestMapping(value = "/businessTrip/add/auth") |
| | | @ManagerAuth |
| | | public R add(BusinessTrip businessTrip) { |
| | | |
| | | Date now = new Date(); |
| | | //判断车牌号 |
| | | if (businessTrip.getBusinessTransportation()==5 || businessTrip.getBusinessTransportation()==4){ |
| | | boolean carNumberBoolean = CarNumberUtils.isValidLicensePlate(businessTrip.getCarNumber()); |
| | | if (!carNumberBoolean){ |
| | | return R.error("请输入有效车牌号"); |
| | | } |
| | | } |
| | | businessTrip.setBusinessPeersId(System.currentTimeMillis()); |
| | | // businessTrip.setBusinessDuration(TimeCalculatorUtils.getDifferenceDayDouble(businessTrip.getBusinessStartTimeDay$(),businessTrip.getBusinessEndTimeDay$())); |
| | | businessTrip.setBusinessTripDays(TimeCalculatorUtils.getDifferenceDayInt(businessTrip.getBusinessStartTime(),businessTrip.getBusinessEndTime())); |
| | | businessTrip.setUserId(getUserId()); |
| | | businessTrip.setDeptId(getDeptId()); |
| | | businessTrip.setCreateTime(now); |
| | | businessTrip.setUserId(getUserId()); |
| | | businessTrip.setUpdateTime(now); |
| | | businessTrip.setStatus(0); |
| | | |
| | | businessTripService.insert(businessTrip); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/businessTrip/update/auth") |
| | | @ManagerAuth |
| | | public R update(BusinessTrip businessTrip){ |
| | | if (Cools.isEmpty(businessTrip) || null==businessTrip.getId()){ |
| | | return R.error(); |
| | | } |
| | | businessTripService.updateById(businessTrip); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/businessTrip/delete/auth") |
| | | @ManagerAuth |
| | | public R delete(@RequestParam(value="ids[]") Long[] ids){ |
| | | for (Long id : ids){ |
| | | businessTripService.deleteById(id); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/businessTrip/export/auth") |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | EntityWrapper<BusinessTrip> wrapper = new EntityWrapper<>(); |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("businessTrip")); |
| | | convert(map, wrapper); |
| | | List<BusinessTrip> list = businessTripService.selectList(wrapper); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/businessTripQuery/auth") |
| | | @ManagerAuth |
| | | public R query(String condition) { |
| | | EntityWrapper<BusinessTrip> wrapper = new EntityWrapper<>(); |
| | | wrapper.like("id", condition); |
| | | Page<BusinessTrip> page = businessTripService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (BusinessTrip businessTrip : page.getRecords()){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", businessTrip.getId()); |
| | | map.put("value", businessTrip.getId()); |
| | | result.add(map); |
| | | } |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @RequestMapping(value = "/businessTrip/check/column/auth") |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<BusinessTrip> wrapper = new EntityWrapper<BusinessTrip>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != businessTripService.selectOne(wrapper)){ |
| | | return R.parse(BaseRes.REPEAT).add(getComment(BusinessTrip.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.crm.manager.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.core.common.Cools; |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.crm.manager.utils.TimeCalculatorUtils; |
| | | import com.zy.crm.system.entity.Dic; |
| | | import com.zy.crm.system.service.DicService; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("man_business_trip") |
| | | public class BusinessTrip implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ID |
| | | */ |
| | | @ApiModelProperty(value= "ID") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 出差事由 |
| | | */ |
| | | @ApiModelProperty(value= "出差事由") |
| | | @TableField("business_trip_reasons") |
| | | private String businessTripReasons; |
| | | |
| | | /** |
| | | * 交通工具 |
| | | */ |
| | | @ApiModelProperty(value= "交通工具") |
| | | @TableField("business_transportation") |
| | | private Integer businessTransportation; |
| | | |
| | | /** |
| | | * 单程往返 |
| | | */ |
| | | @ApiModelProperty(value= "单程往返") |
| | | @TableField("business_return") |
| | | private Integer businessReturn; |
| | | |
| | | /** |
| | | * 出发省 |
| | | */ |
| | | @ApiModelProperty(value= "出发省") |
| | | @TableField("business_start_province") |
| | | private String businessStartProvince; |
| | | |
| | | /** |
| | | * 出发市 |
| | | */ |
| | | @ApiModelProperty(value= "出发市") |
| | | @TableField("business_start_city") |
| | | private String businessStartCity; |
| | | |
| | | /** |
| | | * 出发县 |
| | | */ |
| | | @ApiModelProperty(value= "出发县") |
| | | @TableField("business_start_district") |
| | | private String businessStartDistrict; |
| | | |
| | | /** |
| | | * 出发镇 |
| | | */ |
| | | @ApiModelProperty(value= "出发镇") |
| | | @TableField("business_start_town") |
| | | private String businessStartTown; |
| | | |
| | | /** |
| | | * 出发地 |
| | | */ |
| | | @ApiModelProperty(value= "出发地") |
| | | @TableField("business_start_addr") |
| | | private String businessStartAddr; |
| | | |
| | | /** |
| | | * 目的省 |
| | | */ |
| | | @ApiModelProperty(value= "目的省") |
| | | @TableField("business_end_province") |
| | | private String businessEndProvince; |
| | | |
| | | /** |
| | | * 目的市 |
| | | */ |
| | | @ApiModelProperty(value= "目的市") |
| | | @TableField("business_end_city") |
| | | private String businessEndCity; |
| | | |
| | | /** |
| | | * 目的县 |
| | | */ |
| | | @ApiModelProperty(value= "目的县") |
| | | @TableField("business_end_district") |
| | | private String businessEndDistrict; |
| | | |
| | | /** |
| | | * 目的镇 |
| | | */ |
| | | @ApiModelProperty(value= "目的镇") |
| | | @TableField("business_end_town") |
| | | private String businessEndTown; |
| | | |
| | | /** |
| | | * 目的地 |
| | | */ |
| | | @ApiModelProperty(value= "目的地") |
| | | @TableField("business_end_addr") |
| | | private String businessEndAddr; |
| | | |
| | | /** |
| | | * 出发日期 |
| | | */ |
| | | @ApiModelProperty(value= "出发日期") |
| | | @TableField("business_start_time") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date businessStartTime; |
| | | |
| | | /** |
| | | * 结束日期 |
| | | */ |
| | | @ApiModelProperty(value= "结束日期") |
| | | @TableField("business_end_time") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date businessEndTime; |
| | | |
| | | /** |
| | | * 出差时长 |
| | | */ |
| | | @ApiModelProperty(value= "出差时长") |
| | | @TableField("business_duration") |
| | | private Long businessDuration; |
| | | |
| | | /** |
| | | * 出差天数 |
| | | */ |
| | | @ApiModelProperty(value= "出差天数") |
| | | @TableField("business_trip_days") |
| | | private Integer businessTripDays; |
| | | |
| | | /** |
| | | * 出差备注 |
| | | */ |
| | | @ApiModelProperty(value= "出差备注") |
| | | @TableField("business_notes") |
| | | private String businessNotes; |
| | | |
| | | /** |
| | | * 出行人、同行人 |
| | | */ |
| | | @ApiModelProperty(value= "出行人、同行人") |
| | | @TableField("business_peers") |
| | | private String businessPeers; |
| | | |
| | | /** |
| | | * 同行人ID |
| | | */ |
| | | @ApiModelProperty(value= "同行人ID") |
| | | @TableField("business_peers_id") |
| | | private Long businessPeersId; |
| | | |
| | | /** |
| | | * 自驾私家车车牌号 |
| | | */ |
| | | @ApiModelProperty(value= "自驾私家车车牌号") |
| | | @TableField("car_number") |
| | | private String carNumber; |
| | | |
| | | /** |
| | | * 自驾私家车行程明细及公里数 |
| | | */ |
| | | @ApiModelProperty(value= "自驾私家车行程明细及公里数") |
| | | private String kilometers; |
| | | |
| | | /** |
| | | * 创建人 |
| | | */ |
| | | @ApiModelProperty(value= "创建人") |
| | | @TableField("user_id") |
| | | private Long userId; |
| | | |
| | | /** |
| | | * 所属部门 |
| | | */ |
| | | @ApiModelProperty(value= "所属部门") |
| | | @TableField("dept_id") |
| | | private Long deptId; |
| | | |
| | | /** |
| | | * hostId |
| | | */ |
| | | @ApiModelProperty(value= "hostId") |
| | | @TableField("host_id") |
| | | private Long hostId; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @ApiModelProperty(value= "创建时间") |
| | | @TableField("create_time") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | @ApiModelProperty(value= "更新时间") |
| | | @TableField("update_time") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 更新人员ID |
| | | */ |
| | | @ApiModelProperty(value= "更新人员ID") |
| | | @TableField("update_id") |
| | | private Long updateId; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | private String form; |
| | | |
| | | /** |
| | | * 进度 |
| | | */ |
| | | @ApiModelProperty(value= "进度") |
| | | private Integer settle; |
| | | |
| | | /** |
| | | * 流程进度 |
| | | */ |
| | | @ApiModelProperty(value= "流程进度") |
| | | @TableField("settle_msg") |
| | | private String settleMsg; |
| | | |
| | | /** |
| | | * 状态 1: 正常 0: 禁用 |
| | | */ |
| | | @ApiModelProperty(value= "状态 1: 已完成 0: 未完成 ") |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 类型 |
| | | */ |
| | | @ApiModelProperty(value= "类型") |
| | | @TableField("business_trip_type") |
| | | private Integer businessTripType; |
| | | |
| | | /** |
| | | * 类型 |
| | | */ |
| | | @ApiModelProperty(value= "开始时辰") |
| | | @TableField("business_start_time_day") |
| | | private Integer businessStartTimeDay; |
| | | |
| | | /** |
| | | * 类型 |
| | | */ |
| | | @ApiModelProperty(value= "结束时辰") |
| | | @TableField("business_end_time_day") |
| | | private Integer businessEndTimeDay; |
| | | |
| | | @TableField(exist = false) |
| | | private String pcdStart; |
| | | |
| | | @TableField(exist = false) |
| | | private String pcdEnd; |
| | | |
| | | public BusinessTrip() {} |
| | | |
| | | public BusinessTrip(String businessTripReasons, Integer businessTransportation, Integer businessReturn, String businessStartProvince, String businessStartCity, String businessStartDistrict, String businessStartTown, String businessStartAddr, String businessEndProvince, String businessEndCity, String businessEndDistrict, String businessEndTown, String businessEndAddr, Date businessStartTime, Date businessEndTime, Long businessDuration, Integer businessTripDays, String businessNotes, String businessPeers, Long businessPeersId, String carNumber, String kilometers, Long userId, Long deptId, Long hostId, Date createTime, Date updateTime, Long updateId, String form, Integer settle, String settleMsg, Integer status, Integer businessTripType, Integer businessStartTimeDay, Integer businessEndTimeDay) { |
| | | this.businessTripReasons = businessTripReasons; |
| | | this.businessTransportation = businessTransportation; |
| | | this.businessReturn = businessReturn; |
| | | this.businessStartProvince = businessStartProvince; |
| | | this.businessStartCity = businessStartCity; |
| | | this.businessStartDistrict = businessStartDistrict; |
| | | this.businessStartTown = businessStartTown; |
| | | this.businessStartAddr = businessStartAddr; |
| | | this.businessEndProvince = businessEndProvince; |
| | | this.businessEndCity = businessEndCity; |
| | | this.businessEndDistrict = businessEndDistrict; |
| | | this.businessEndTown = businessEndTown; |
| | | this.businessEndAddr = businessEndAddr; |
| | | this.businessStartTime = businessStartTime; |
| | | this.businessEndTime = businessEndTime; |
| | | this.businessDuration = businessDuration; |
| | | this.businessTripDays = businessTripDays; |
| | | this.businessNotes = businessNotes; |
| | | this.businessPeers = businessPeers; |
| | | this.businessPeersId = businessPeersId; |
| | | this.carNumber = carNumber; |
| | | this.kilometers = kilometers; |
| | | this.userId = userId; |
| | | this.deptId = deptId; |
| | | this.hostId = hostId; |
| | | this.createTime = createTime; |
| | | this.updateTime = updateTime; |
| | | this.updateId = updateId; |
| | | this.form = form; |
| | | this.settle = settle; |
| | | this.settleMsg = settleMsg; |
| | | this.status = status; |
| | | this.businessTripType = businessTripType; |
| | | this.businessStartTimeDay = businessStartTimeDay; |
| | | this.businessEndTimeDay = businessEndTimeDay; |
| | | } |
| | | |
| | | // BusinessTrip businessTrip = new BusinessTrip( |
| | | // null, // 出差事由[非空] |
| | | // null, // 交通工具[非空] |
| | | // null, // 单程往返[非空] |
| | | // null, // 出发省 |
| | | // null, // 出发市 |
| | | // null, // 出发县 |
| | | // null, // 出发镇 |
| | | // null, // 出发地[非空] |
| | | // null, // 目的省 |
| | | // null, // 目的市 |
| | | // null, // 目的县 |
| | | // null, // 目的镇 |
| | | // null, // 目的地[非空] |
| | | // null, // 出发日期[非空] |
| | | // null, // 结束日期[非空] |
| | | // null, // 出差时长 |
| | | // null, // 出差天数 |
| | | // null, // 出差备注 |
| | | // null, // 出行人、同行人[非空] |
| | | // null, // 同行人ID |
| | | // null, // 自驾私家车车牌号[非空] |
| | | // null, // 自驾私家车行程明细及公里数[非空] |
| | | // null, // 创建人 |
| | | // null, // 所属部门 |
| | | // null, // hostId |
| | | // null, // 创建时间 |
| | | // null, // 更新时间 |
| | | // null, // 更新人员ID |
| | | // null, // |
| | | // null, // 进度 |
| | | // null, // 流程进度 |
| | | // null, // 状态 |
| | | // null // 类型 |
| | | // ); |
| | | |
| | | public String getBusinessStartTime$(){ |
| | | if (Cools.isEmpty(this.businessStartTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.businessStartTime); |
| | | } |
| | | |
| | | public String getBusinessEndTime$(){ |
| | | if (Cools.isEmpty(this.businessEndTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.businessEndTime); |
| | | } |
| | | |
| | | public String getCreateTime$(){ |
| | | if (Cools.isEmpty(this.createTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime); |
| | | } |
| | | |
| | | public String getUpdateTime$(){ |
| | | if (Cools.isEmpty(this.updateTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime); |
| | | } |
| | | |
| | | public String getStatus$(){ |
| | | if (null == this.status){ return null; } |
| | | switch (this.status){ |
| | | case 1: |
| | | return "已完成"; |
| | | case 0: |
| | | return "未完成"; |
| | | default: |
| | | return String.valueOf(this.status); |
| | | } |
| | | } |
| | | |
| | | public String getBusinessTransportation$(){ |
| | | if (null == this.businessTransportation){ return null; } |
| | | switch (this.businessTransportation){ |
| | | case 1: |
| | | return "飞机"; |
| | | case 2: |
| | | return "高铁"; |
| | | case 3: |
| | | return "火车"; |
| | | case 4: |
| | | return "汽车"; |
| | | case 5: |
| | | return "摩托"; |
| | | case 6: |
| | | return "电车"; |
| | | default: |
| | | // return String.valueOf(this.status); |
| | | return "其它"; |
| | | } |
| | | } |
| | | |
| | | public String getBusinessReturn$(){ |
| | | if (null == this.businessTransportation){ return null; } |
| | | switch (this.businessTransportation){ |
| | | case 1: |
| | | return "单程"; |
| | | case 2: |
| | | return "往返"; |
| | | default: |
| | | // return String.valueOf(this.status); |
| | | return "其它"; |
| | | } |
| | | } |
| | | |
| | | public String getBusinessStartTimeDay$(){ |
| | | if (null == this.businessStartTimeDay){ return null; } |
| | | switch (this.businessStartTimeDay){ |
| | | case 1: |
| | | return TimeCalculatorUtils.getYestMonthDay(this.businessStartTime)+ "上午"; |
| | | case 2: |
| | | return TimeCalculatorUtils.getYestMonthDay(this.businessStartTime)+ "下午"; |
| | | default: |
| | | // return String.valueOf(this.status); |
| | | return "未知"; |
| | | } |
| | | } |
| | | |
| | | public String getBusinessEndTimeDay$(){ |
| | | if (null == this.businessEndTimeDay){ return null; } |
| | | switch (this.businessTransportation){ |
| | | case 1: |
| | | return TimeCalculatorUtils.getYestMonthDay(this.businessEndTime)+ "上午"; |
| | | case 2: |
| | | return TimeCalculatorUtils.getYestMonthDay(this.businessEndTime)+ "下午"; |
| | | default: |
| | | // return String.valueOf(this.status); |
| | | return "未知"; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | public String getPcdStart() { |
| | | StringBuilder sb = new StringBuilder(); |
| | | if (!Cools.isEmpty(businessStartProvince)) { |
| | | sb.append(businessStartProvince).append(","); |
| | | } |
| | | if (!Cools.isEmpty(businessStartCity)) { |
| | | sb.append(businessStartCity).append(","); |
| | | } |
| | | if (!Cools.isEmpty(businessStartDistrict)) { |
| | | sb.append(businessStartDistrict).append(","); |
| | | } |
| | | String s = sb.toString(); |
| | | if (s.endsWith(",")) { |
| | | s = s.substring(0, s.length() - 1); |
| | | } |
| | | return s; |
| | | } |
| | | |
| | | public String getPcdStart$() { |
| | | StringBuilder sb = new StringBuilder(); |
| | | DicService service = SpringUtils.getBean(DicService.class); |
| | | if (!Cools.isEmpty(businessStartProvince)) { |
| | | Dic provinceDic = service.selectById(businessStartProvince); |
| | | if (!Cools.isEmpty(provinceDic)) { |
| | | sb.append(provinceDic.getName()).append(","); |
| | | } |
| | | } |
| | | if (!Cools.isEmpty(businessStartCity)) { |
| | | Dic cityDic = service.selectById(businessStartCity); |
| | | if (!Cools.isEmpty(cityDic)) { |
| | | sb.append(cityDic.getName()).append(","); |
| | | } |
| | | } |
| | | if (!Cools.isEmpty(businessStartDistrict)) { |
| | | Dic districtDic = service.selectById(businessStartDistrict); |
| | | if (!Cools.isEmpty(districtDic)) { |
| | | sb.append(districtDic.getName()).append(","); |
| | | } |
| | | } |
| | | String s = sb.toString(); |
| | | if (s.endsWith(",")) { |
| | | s = s.substring(0, s.length() - 1); |
| | | } |
| | | return s; |
| | | } |
| | | |
| | | public void setPcdStart(String pcdStart) { |
| | | this.pcdStart = pcdStart; |
| | | if (!Cools.isEmpty(pcdStart)) { |
| | | String[] split = this.pcdStart.split(","); |
| | | for (int i = 0;i< split.length; i++) { |
| | | switch (i) { |
| | | case 0: |
| | | this.businessStartProvince = split[0]; |
| | | break; |
| | | case 1: |
| | | this.businessStartCity = split[1]; |
| | | break; |
| | | case 2: |
| | | this.businessStartDistrict = split[2]; |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | } else { |
| | | this.businessStartProvince = ""; |
| | | this.businessStartCity = ""; |
| | | this.businessStartDistrict = ""; |
| | | } |
| | | } |
| | | |
| | | public String getPcdEnd() { |
| | | StringBuilder sb = new StringBuilder(); |
| | | if (!Cools.isEmpty(businessEndProvince)) { |
| | | sb.append(businessEndProvince).append(","); |
| | | } |
| | | if (!Cools.isEmpty(businessEndCity)) { |
| | | sb.append(businessEndCity).append(","); |
| | | } |
| | | if (!Cools.isEmpty(businessEndDistrict)) { |
| | | sb.append(businessEndDistrict).append(","); |
| | | } |
| | | String s = sb.toString(); |
| | | if (s.endsWith(",")) { |
| | | s = s.substring(0, s.length() - 1); |
| | | } |
| | | return s; |
| | | } |
| | | |
| | | public String getPcdEnd$() { |
| | | StringBuilder sb = new StringBuilder(); |
| | | DicService service = SpringUtils.getBean(DicService.class); |
| | | if (!Cools.isEmpty(businessEndProvince)) { |
| | | Dic provinceDic = service.selectById(businessEndProvince); |
| | | if (!Cools.isEmpty(provinceDic)) { |
| | | sb.append(provinceDic.getName()).append(","); |
| | | } |
| | | } |
| | | if (!Cools.isEmpty(businessEndCity)) { |
| | | Dic cityDic = service.selectById(businessEndCity); |
| | | if (!Cools.isEmpty(cityDic)) { |
| | | sb.append(cityDic.getName()).append(","); |
| | | } |
| | | } |
| | | if (!Cools.isEmpty(businessEndDistrict)) { |
| | | Dic districtDic = service.selectById(businessEndDistrict); |
| | | if (!Cools.isEmpty(districtDic)) { |
| | | sb.append(districtDic.getName()).append(","); |
| | | } |
| | | } |
| | | String s = sb.toString(); |
| | | if (s.endsWith(",")) { |
| | | s = s.substring(0, s.length() - 1); |
| | | } |
| | | return s; |
| | | } |
| | | |
| | | public void setPcdEnd(String pcdEnd) { |
| | | this.pcdEnd = pcdEnd; |
| | | if (!Cools.isEmpty(pcdEnd)) { |
| | | String[] split = this.pcdEnd.split(","); |
| | | for (int i = 0;i< split.length; i++) { |
| | | switch (i) { |
| | | case 0: |
| | | this.businessEndProvince = split[0]; |
| | | break; |
| | | case 1: |
| | | this.businessEndCity = split[1]; |
| | | break; |
| | | case 2: |
| | | this.businessEndDistrict = split[2]; |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | } else { |
| | | this.businessEndProvince = ""; |
| | | this.businessEndCity = ""; |
| | | this.businessEndDistrict = ""; |
| | | } |
| | | } |
| | | |
| | | public String getBusinessStartAddr$(){ |
| | | if (!Cools.isEmpty(businessStartAddr)){ |
| | | return getPcdStart$()+"--"+businessStartAddr; |
| | | } |
| | | return getPcdStart$(); |
| | | } |
| | | |
| | | public String getBusinessEndAddr$(){ |
| | | if (!Cools.isEmpty(businessEndAddr)){ |
| | | return getPcdEnd$()+"--"+businessEndAddr; |
| | | } |
| | | return getPcdStart$(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.crm.manager.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.zy.crm.manager.entity.BusinessTrip; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface BusinessTripMapper extends BaseMapper<BusinessTrip> { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.crm.manager.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.zy.crm.manager.entity.BusinessTrip; |
| | | |
| | | public interface BusinessTripService extends IService<BusinessTrip> { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.crm.manager.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.zy.crm.manager.entity.BusinessTrip; |
| | | import com.zy.crm.manager.mapper.BusinessTripMapper; |
| | | import com.zy.crm.manager.service.BusinessTripService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("businessTripService") |
| | | public class BusinessTripServiceImpl extends ServiceImpl<BusinessTripMapper, BusinessTrip> implements BusinessTripService { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.crm.manager.utils; |
| | | |
| | | import java.util.regex.Pattern; |
| | | |
| | | public class CarNumberUtils { |
| | | private static final Pattern LICENSE_PLATE_PATTERN = Pattern.compile("^[\u4e00-\u9fa5]{1}[A-Z]{1}[A-Z_0-9]{5}$"); |
| | | |
| | | public static boolean isValidLicensePlate(String licensePlate) { |
| | | return LICENSE_PLATE_PATTERN.matcher(licensePlate).matches(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zy.crm.manager.utils; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.TimeZone; |
| | | |
| | | public class TimeCalculatorUtils { |
| | | |
| | | public static int getTimeHour(){ |
| | | //如何获取当前时间的小时数(24小时制): |
| | | // 获取当前时间戳 |
| | | long timestamp = System.currentTimeMillis(); |
| | | |
| | | // 创建Date对象,并设置时间戳 |
| | | Date date = new Date(timestamp); |
| | | |
| | | // 创建TimeZone对象,设置为中国北京时间 |
| | | TimeZone timeZone = TimeZone.getTimeZone("Asia/Shanghai"); |
| | | |
| | | // 创建Calendar对象,并设置时区 |
| | | // 注意:Calendar类中的月份是从0开始的,所以需要减去1 |
| | | java.util.Calendar calendar = java.util.Calendar.getInstance(timeZone); |
| | | calendar.setTime(date); |
| | | |
| | | // 获取当前小时数(24小时制) |
| | | return calendar.get(java.util.Calendar.HOUR_OF_DAY); |
| | | } |
| | | |
| | | public static int getTimeHour(Date date){ |
| | | // 创建TimeZone对象,设置为中国北京时间 |
| | | TimeZone timeZone = TimeZone.getTimeZone("Asia/Shanghai"); |
| | | |
| | | // 创建Calendar对象,并设置时区 |
| | | // 注意:Calendar类中的月份是从0开始的,所以需要减去1 |
| | | java.util.Calendar calendar = java.util.Calendar.getInstance(timeZone); |
| | | calendar.setTime(date); |
| | | |
| | | // 获取当前小时数(24小时制) |
| | | return calendar.get(java.util.Calendar.HOUR_OF_DAY); |
| | | } |
| | | |
| | | public static Date getYesterday(Date date){ |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(date); |
| | | calendar.add(Calendar.DAY_OF_MONTH, -1); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | public static String getYestMonthDay(Date date){ |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(date); |
| | | |
| | | int year = calendar.get(Calendar.YEAR); |
| | | int month = calendar.get(Calendar.MONTH) + 1; // 月份从0开始,需要加1 |
| | | int day = calendar.get(Calendar.DAY_OF_MONTH); |
| | | return year+"年"+month+"月"+day+"日"; |
| | | } |
| | | |
| | | public static int getDifferenceDayInt(Date startDay,Date endDay){ |
| | | return getDifferenceDayLong(startDay,endDay).intValue(); |
| | | } |
| | | |
| | | public static Long getDifferenceDayLong(Date startDay,Date endDay){ |
| | | LocalDate localDateA = dateToLocalDate(startDay); |
| | | LocalDate localDateB = dateToLocalDate(endDay); |
| | | |
| | | return getDifferenceDays(localDateA, localDateB); |
| | | } |
| | | |
| | | public static Long getDifferenceDayDouble(String startDay,String endDay){ |
| | | // 定义日期字符串的格式 |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy年M月d日ahh:mm"); |
| | | |
| | | // 将日期字符串解析为LocalDate对象 |
| | | LocalDate dateA = LocalDate.parse(startDay, formatter); |
| | | LocalDate dateB = LocalDate.parse(endDay, formatter); |
| | | |
| | | // 计算日期对象之间的相隔天数 |
| | | return ChronoUnit.DAYS.between(dateA, dateB); |
| | | |
| | | } |
| | | |
| | | private static String getDatePart(String dateTime) { |
| | | int index = dateTime.indexOf(" "); |
| | | if (index != -1) { |
| | | return dateTime.substring(0, index); |
| | | } |
| | | return dateTime; |
| | | } |
| | | |
| | | private static String getTimePart(String dateTime) { |
| | | int index = dateTime.indexOf(" "); |
| | | if (index != -1) { |
| | | return dateTime.substring(index + 1); |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | private static LocalDate dateToLocalDate(Date date) { |
| | | return date.toInstant().atZone(java.time.ZoneId.systemDefault()).toLocalDate(); |
| | | } |
| | | |
| | | private static long getDifferenceDays(LocalDate dateA, LocalDate dateB) { |
| | | return ChronoUnit.DAYS.between(dateA, dateB); |
| | | } |
| | | } |
New file |
| | |
| | | <?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.zy.crm.manager.mapper.BusinessTripMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.zy.crm.manager.entity.BusinessTrip"> |
| | | <id column="id" property="id" /> |
| | | <result column="business_trip_reasons" property="businessTripReasons" /> |
| | | <result column="business_transportation" property="businessTransportation" /> |
| | | <result column="business_return" property="businessReturn" /> |
| | | <result column="business_start_province" property="businessStartProvince" /> |
| | | <result column="business_start_city" property="businessStartCity" /> |
| | | <result column="business_start_district" property="businessStartDistrict" /> |
| | | <result column="business_start_town" property="businessStartTown" /> |
| | | <result column="business_start_addr" property="businessStartAddr" /> |
| | | <result column="business_end_province" property="businessEndProvince" /> |
| | | <result column="business_end_city" property="businessEndCity" /> |
| | | <result column="business_end_district" property="businessEndDistrict" /> |
| | | <result column="business_end_town" property="businessEndTown" /> |
| | | <result column="business_end_addr" property="businessEndAddr" /> |
| | | <result column="business_start_time" property="businessStartTime" /> |
| | | <result column="business_end_time" property="businessEndTime" /> |
| | | <result column="business_duration" property="businessDuration" /> |
| | | <result column="business_trip_days" property="businessTripDays" /> |
| | | <result column="business_notes" property="businessNotes" /> |
| | | <result column="business_peers" property="businessPeers" /> |
| | | <result column="business_peers_id" property="businessPeersId" /> |
| | | <result column="car_number" property="carNumber" /> |
| | | <result column="kilometers" property="kilometers" /> |
| | | <result column="user_id" property="userId" /> |
| | | <result column="dept_id" property="deptId" /> |
| | | <result column="host_id" property="hostId" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="update_id" property="updateId" /> |
| | | <result column="form" property="form" /> |
| | | <result column="settle" property="settle" /> |
| | | <result column="settle_msg" property="settleMsg" /> |
| | | <result column="status" property="status" /> |
| | | <result column="business_trip_type" property="businessTripType" /> |
| | | <result column="business_start_time_day" property="businessStartTimeDay" /> |
| | | <result column="business_end_time_day" property="businessEndTimeDay" /> |
| | | |
| | | </resultMap> |
| | | |
| | | </mapper> |
New file |
| | |
| | | var pageCurr; |
| | | layui.config({ |
| | | base: baseUrl + "/static/layui/lay/modules/" |
| | | }).extend({ |
| | | cascader: 'cascader/cascader', |
| | | }).use(['table','laydate', 'form', 'admin', 'cascader'], function(){ |
| | | var table = layui.table; |
| | | var $ = layui.jquery; |
| | | var layer = layui.layer; |
| | | var layDate = layui.laydate; |
| | | var form = layui.form; |
| | | var admin = layui.admin; |
| | | var cascader = layui.cascader; |
| | | |
| | | // 数据渲染 |
| | | tableIns = table.render({ |
| | | elem: '#businessTrip', |
| | | headers: {token: localStorage.getItem('token')}, |
| | | url: baseUrl+'/businessTrip/list/auth', |
| | | page: true, |
| | | limit: 15, |
| | | limits: [15, 30, 50, 100, 200, 500], |
| | | toolbar: '#toolbar', |
| | | cellMinWidth: 50, |
| | | height: 'full-120', |
| | | cols: [[ |
| | | // {type: 'checkbox'}, |
| | | {field: 'id', align: 'center',title: 'ID',hide: true} |
| | | ,{field: 'businessTripReasons', align: 'center',title: '出差事由',hide: false} |
| | | ,{field: 'businessTransportation', align: 'center',title: '交通工具',hide: false} |
| | | ,{field: 'businessReturn', align: 'center',title: '单程往返',hide: false} |
| | | ,{field: 'businessStartProvince', align: 'center',title: '出发省',hide: true} |
| | | ,{field: 'businessStartCity', align: 'center',title: '出发市',hide: true} |
| | | ,{field: 'businessStartDistrict', align: 'center',title: '出发县',hide: true} |
| | | ,{field: 'businessStartTown', align: 'center',title: '出发镇',hide: true} |
| | | ,{field: 'businessStartAddr', align: 'center',title: '出发地', templet:function(d){return emptyShow(d.businessStartAddr)},hide: true} |
| | | ,{field: 'businessStartAddr$', align: 'center',title: '出发地',hide: false} |
| | | ,{field: 'businessEndProvince', align: 'center',title: '目的省',hide: true} |
| | | ,{field: 'businessEndCity', align: 'center',title: '目的市',hide: true} |
| | | ,{field: 'businessEndDistrict', align: 'center',title: '目的县',hide: true} |
| | | ,{field: 'businessEndTown', align: 'center',title: '目的镇',hide: true} |
| | | ,{field: 'businessEndAddr', align: 'center',title: '目的地', templet:function(d){return emptyShow(d.businessEndAddr)},hide: true} |
| | | ,{field: 'businessEndAddrr$', align: 'center',title: '目的地',hide: false} |
| | | ,{field: 'businessStartTimeDay$', align: 'center',title: '出发日期',hide: false} |
| | | ,{field: 'businessEndTimeDay$', align: 'center',title: '结束日期',hide: false} |
| | | ,{field: 'businessDuration', align: 'center',title: '出差时长',hide: false} |
| | | ,{field: 'businessTripDays', align: 'center',title: '出差天数',hide: false} |
| | | ,{field: 'businessNotes', align: 'center',title: '出差备注',hide: false} |
| | | ,{field: 'businessPeers', align: 'center',title: '出行人',hide: false} |
| | | ,{field: 'businessPeersId', align: 'center',title: '同行人ID',hide: true} |
| | | ,{field: 'carNumber', align: 'center',title: '自驾私家车车牌号',hide: false} |
| | | ,{field: 'kilometers', align: 'center',title: '自驾私家车行程明细及公里数',hide: false} |
| | | ,{field: 'userId', align: 'center',title: '创建人',hide: false} |
| | | ,{field: 'deptId', align: 'center',title: '所属部门',hide: false} |
| | | ,{field: 'hostId', align: 'center',title: 'hostId',hide: true} |
| | | ,{field: 'createTime$', align: 'center',title: '创建时间',hide: false} |
| | | ,{field: 'updateTime$', align: 'center',title: '更新时间',hide: false} |
| | | ,{field: 'updateId', align: 'center',title: '更新人员ID',hide: true} |
| | | ,{field: 'settle', align: 'center',title: '进度',hide: false} |
| | | ,{field: 'status$', align: 'center',title: '状态',hide: false} |
| | | ,{field: 'businessTripType', align: 'center',title: '类型',hide: true} |
| | | |
| | | ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:120} |
| | | ]], |
| | | request: { |
| | | pageName: 'curr', |
| | | pageSize: 'limit' |
| | | }, |
| | | parseData: function (res) { |
| | | return { |
| | | 'code': res.code, |
| | | 'msg': res.msg, |
| | | 'count': res.data.total, |
| | | 'data': res.data.records |
| | | } |
| | | }, |
| | | response: { |
| | | statusCode: 200 |
| | | }, |
| | | done: function(res, curr, count) { |
| | | if (res.code === 403) { |
| | | top.location.href = baseUrl+"/"; |
| | | } |
| | | pageCurr=curr; |
| | | limit(); |
| | | } |
| | | }); |
| | | |
| | | // 监听排序事件 |
| | | table.on('sort(businessTrip)', function (obj) { |
| | | var searchData = {}; |
| | | $.each($('#search-box [name]').serializeArray(), function() { |
| | | searchData[this.name] = this.value; |
| | | }); |
| | | searchData['orderByField'] = obj.field; |
| | | searchData['orderByType'] = obj.type; |
| | | tableIns.reload({ |
| | | where: searchData, |
| | | page: {curr: 1} |
| | | }); |
| | | }); |
| | | |
| | | // 监听头工具栏事件 |
| | | table.on('toolbar(businessTrip)', function (obj) { |
| | | var checkStatus = table.checkStatus(obj.config.id).data; |
| | | switch(obj.event) { |
| | | case 'addData': |
| | | showEditModel(); |
| | | break; |
| | | case 'deleteData': |
| | | if (checkStatus.length === 0) { |
| | | layer.msg('请选择要删除的数据', {icon: 2}); |
| | | return; |
| | | } |
| | | del(checkStatus.map(function (d) { |
| | | return d.id; |
| | | })); |
| | | break; |
| | | case 'exportData': |
| | | admin.confirm('确定导出Excel吗', {shadeClose: true}, function(){ |
| | | var titles=[]; |
| | | var fields=[]; |
| | | obj.config.cols[0].map(function (col) { |
| | | if (col.type === 'normal' && col.hide === false && col.toolbar == null) { |
| | | titles.push(col.title); |
| | | fields.push(col.field); |
| | | } |
| | | }); |
| | | var exportData = {}; |
| | | $.each($('#search-box [name]').serializeArray(), function() { |
| | | exportData[this.name] = this.value; |
| | | }); |
| | | var param = { |
| | | 'businessTrip': exportData, |
| | | 'fields': fields |
| | | }; |
| | | $.ajax({ |
| | | url: baseUrl+"/businessTrip/export/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: JSON.stringify(param), |
| | | dataType:'json', |
| | | contentType:'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.closeAll(); |
| | | if (res.code === 200) { |
| | | table.exportFile(titles,res.data,'xls'); |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}) |
| | | } |
| | | } |
| | | }); |
| | | }); |
| | | break; |
| | | } |
| | | }); |
| | | |
| | | // 监听行工具事件 |
| | | table.on('tool(businessTrip)', function(obj){ |
| | | var data = obj.data; |
| | | switch (obj.event) { |
| | | case 'edit': |
| | | showEditModel(data); |
| | | break; |
| | | case "del": |
| | | del([data.id]); |
| | | break; |
| | | } |
| | | }); |
| | | |
| | | /* 弹窗 - 新增、修改 */ |
| | | function showEditModel(mData) { |
| | | admin.open({ |
| | | type: 1, |
| | | area: ["95%", "90%"], |
| | | title: (mData ? '修改' : '添加') + '订单状态', |
| | | content: $('#editDialog').html(), |
| | | success: function (layero, dIndex) { |
| | | if (mData) { |
| | | $('#cascaderValStart').val(mData.pcdStart); |
| | | } |
| | | if (mData) { |
| | | $('#cascaderValEnd').val(mData.pcdEnd); |
| | | } |
| | | layDateRender(mData); |
| | | cascaderRenderStart(); |
| | | cascaderRenderEnd(); |
| | | form.val('detail', mData); |
| | | form.on('submit(editSubmit)', function (data) { |
| | | var loadIndex = layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl+"/businessTrip/"+(mData?'update':'add')+"/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: data.field, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.close(loadIndex); |
| | | if (res.code === 200){ |
| | | layer.close(dIndex); |
| | | layer.msg(res.msg, {icon: 1}); |
| | | tableReload(); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | }else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | | $(layero).children('.layui-layer-content').css('overflow', 'visible'); |
| | | layui.form.render('select'); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /* 删除 */ |
| | | function del(ids) { |
| | | layer.confirm('确定要删除选中数据吗?', { |
| | | skin: 'layui-layer-admin', |
| | | shade: .1 |
| | | }, function (i) { |
| | | layer.close(i); |
| | | var loadIndex = layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl+"/businessTrip/delete/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: {ids: ids}, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.close(loadIndex); |
| | | if (res.code === 200){ |
| | | layer.msg(res.msg, {icon: 1}); |
| | | tableReload(); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }) |
| | | }); |
| | | } |
| | | |
| | | // 搜索 |
| | | form.on('submit(search)', function (data) { |
| | | pageCurr = 1; |
| | | tableReload(false); |
| | | }); |
| | | |
| | | // 重置 |
| | | form.on('submit(reset)', function (data) { |
| | | pageCurr = 1; |
| | | clearFormVal($('#search-box')); |
| | | tableReload(false); |
| | | }); |
| | | |
| | | // 时间选择器 |
| | | function layDateRender(data) { |
| | | setTimeout(function () { |
| | | layDate.render({ |
| | | elem: '#businessStartTime\\$', |
| | | type: 'datetime', |
| | | value: data!==undefined?data['businessStartTime\\$']:null |
| | | }); |
| | | layDate.render({ |
| | | elem: '#businessEndTime\\$', |
| | | type: 'datetime', |
| | | value: data!==undefined?data['businessEndTime\\$']:null |
| | | }); |
| | | layDate.render({ |
| | | elem: '#createTime\\$', |
| | | type: 'datetime', |
| | | value: data!==undefined?data['createTime\\$']:null |
| | | }); |
| | | layDate.render({ |
| | | elem: '#updateTime\\$', |
| | | type: 'datetime', |
| | | value: data!==undefined?data['updateTime\\$']:null |
| | | }); |
| | | |
| | | }, 300); |
| | | } |
| | | layDateRender(); |
| | | |
| | | // 省市区选择 |
| | | function cascaderRenderStart() { |
| | | cascader.render({ |
| | | elem: '#cascaderValStart', |
| | | data: citysData, |
| | | itemHeight: '250px', |
| | | filterable: true, |
| | | onChange: function (values, data) { |
| | | // console.log(values);console.log(data); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // 省市区选择 |
| | | function cascaderRenderEnd() { |
| | | cascader.render({ |
| | | elem: '#cascaderValEnd', |
| | | data: citysData, |
| | | itemHeight: '250px', |
| | | filterable: true, |
| | | onChange: function (values, data) { |
| | | // console.log(values);console.log(data); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | }); |
| | | |
| | | // 关闭动作 |
| | | $(document).on('click','#data-detail-close', function () { |
| | | parent.layer.closeAll(); |
| | | }); |
| | | |
| | | function tableReload(child) { |
| | | var searchData = {}; |
| | | $.each($('#search-box [name]').serializeArray(), function() { |
| | | searchData[this.name] = this.value; |
| | | }); |
| | | tableIns.reload({ |
| | | where: searchData, |
| | | page: {curr: pageCurr} |
| | | }); |
| | | } |
New file |
| | |
| | | <!DOCTYPE html> |
| | | <html lang="en"> |
| | | <head> |
| | | <meta charset="utf-8"> |
| | | <title></title> |
| | | <meta name="renderer" content="webkit"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| | | <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
| | | <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all"> |
| | | <link rel="stylesheet" href="../../static/css/admin.css?v=318" media="all"> |
| | | <link rel="stylesheet" href="../../static/css/cool.css" media="all"> |
| | | <link rel="stylesheet" href="../../static/css/tree.css" media="all"> |
| | | <link rel="stylesheet" href="../../static/layui/lay/modules/formDesigner/coolForm.css" /> |
| | | <style> |
| | | .nav-box { |
| | | position: absolute; |
| | | top: 1px; |
| | | left: 5px; |
| | | } |
| | | .nav-box-item { |
| | | display: inline-block; |
| | | vertical-align: middle; |
| | | margin-right: 5px; |
| | | } |
| | | |
| | | .layui-dropdown.layui-border-box.layui-panel.layui-anim.layui-anim-downbit,.layui-dropdown.layui-border-box.layui-panel.layui-anim.layui-anim-downbit * { |
| | | box-sizing:inherit; |
| | | } |
| | | |
| | | .layui-menu li { |
| | | width: inherit; |
| | | } |
| | | .layui-tree-icon { |
| | | height: 16px; |
| | | line-height: 15px; |
| | | width: 15px; |
| | | text-align: center; |
| | | border: 1px solid #c0c4cc; |
| | | } |
| | | |
| | | .site-dropdown-demo, |
| | | .site-dropdown-demo .layui-menu{background: #32363F;border-color: #484e58;} |
| | | .site-dropdown-demo .layui-menu li{color: #a1a8b8;} |
| | | .site-dropdown-demo .layui-menu li:hover{background-color: #32363F;} |
| | | .layui-menu-body-title>.layui-icon { |
| | | position: relative; |
| | | margin-right: 5px; |
| | | } |
| | | |
| | | .layui-form-radio { |
| | | display: block; |
| | | } |
| | | .layui-unselect.layui-form-radio { |
| | | display: inline-block; |
| | | } |
| | | .layui-form-radio:hover *, .layui-form-radioed, .layui-form-radioed>i { |
| | | color: #2d8cf0; |
| | | } |
| | | </style> |
| | | </head> |
| | | <body> |
| | | |
| | | <div class="layui-fluid"> |
| | | <div class="layui-card"> |
| | | <div class="layui-card-body"> |
| | | <div class="layui-form toolbar" id="search-box"> |
| | | <div class="layui-form-item"> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label">编号:</label> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input" type="text" name="id" placeholder="编号" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline">  |
| | | <button class="layui-btn icon-btn" lay-filter="search" lay-submit> |
| | | <i class="layui-icon"></i>搜索 |
| | | </button> |
| | | <button class="layui-btn icon-btn" lay-filter="reset" lay-submit> |
| | | <i class="layui-icon"></i>重置 |
| | | </button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <table class="layui-hide" id="businessTrip" lay-filter="businessTrip"></table> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <script type="text/html" id="toolbar"> |
| | | <div class="layui-btn-container"> |
| | | <button class="layui-btn layui-btn-sm" id="btn-add" lay-event="addData">新增</button> |
| | | <button class="layui-btn layui-btn-sm layui-btn-danger" id="btn-delete" lay-event="deleteData">删除</button> |
| | | <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData" style="float: right">导出</button> |
| | | </div> |
| | | </script> |
| | | |
| | | <script type="text/html" id="operate"> |
| | | <a class="layui-btn layui-btn-primary layui-btn-xs btn-edit" lay-event="edit">修改</a> |
| | | <a class="layui-btn layui-btn-danger layui-btn-xs btn-edit" lay-event="del">删除</a> |
| | | </script> |
| | | |
| | | <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script> |
| | | <script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.js"></script> |
| | | <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/layui/lay/modules/cascader/citys-data.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/js/businessTrip/businessTrip.js" charset="utf-8"></script> |
| | | </body> |
| | | <!-- 表单弹窗 --> |
| | | <script type="text/html" id="editDialog"> |
| | | <form id="detail" lay-filter="detail" class="layui-form admin-form" style="height: 100%;overflow-y: hidden;"> |
| | | <div class="model-form" style="height: 87%;overflow-x: hidden;overflow-y: scroll"> |
| | | <input name="id" type="hidden"> |
| | | <!--基本信息--> |
| | | <blockquote class="layui-elem-quote" style="margin-left: 30px;padding: 8px 15px;">基本信息</blockquote> |
| | | <div class="layui layui-row"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label layui-form-required">出差事由: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="businessTripReasons" placeholder="请输入出差事由" lay-vertype="tips" lay-verify="required"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <!--行程--> |
| | | <blockquote class="layui-elem-quote" style="margin-left: 30px;padding: 8px 15px;">行程信息</blockquote> |
| | | <div class="layui layui-row"> |
| | | <div class="layui-col-md6"> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label layui-form-required">交通工具: </label> |
| | | <div class="layui-input-block"> |
| | | <select name="businessTransportation" lay-vertype="tips" lay-verify="required"> |
| | | <option value="">请选择区分</option> |
| | | <option value="1">飞机</option> |
| | | <option value="2">高铁</option> |
| | | <option value="3">火车</option> |
| | | <option value="4">汽车</option> |
| | | <option value="5">摩托</option> |
| | | <option value="6">电车</option> |
| | | <option value="7">其它</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label layui-form-required">单程往返: </label> |
| | | <div class="layui-input-block"> |
| | | <select name="businessReturn" lay-vertype="tips" lay-verify="required"> |
| | | <option value="">请选择区分</option> |
| | | <option value="1">单程</option> |
| | | <option value="2">往返</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label layui-form-required">车牌号: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="carNumber" placeholder="请输入自驾私家车车牌号(若不用则填写‘无’)" lay-vertype="tips" lay-verify="required"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label layui-form-required">行程明细及公里数: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="kilometers" placeholder="请输入自驾私家车行程明细及公里数(若不用则填写‘无’)" lay-vertype="tips" lay-verify="required"> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | <div class="layui-col-md6"> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label layui-form-required">出发地: </label> |
| | | <div class="layui-input-block"> |
| | | <input id="cascaderValStart" class="layui-input" name="pcdStart" placeholder="请选择出发地" lay-verify="required"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label layui-form-required">出发地详细地址: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="businessStartAddr" placeholder="请输入出发地详细地址" autocomplete="off" lay-verify="required"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label layui-form-required">目的地: </label> |
| | | <div class="layui-input-block"> |
| | | <input id="cascaderValEnd" class="layui-input" name="pcdEnd" placeholder="请选择出发地" lay-verify="required"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label layui-form-required">目的地详细地址: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="businessEndAddr" placeholder="请输入目的地详细地址" autocomplete="off" lay-verify="required"> |
| | | </div> |
| | | </div> |
| | | <!-- <div class="layui-form-item">--> |
| | | <!-- <label class="layui-form-label">出差时长: </label>--> |
| | | <!-- <div class="layui-input-block">--> |
| | | <!-- <input class="layui-input" name="businessDuration" placeholder="请输入出差时长">--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | <!-- <div class="layui-form-item">--> |
| | | <!-- <label class="layui-form-label">出差天数: </label>--> |
| | | <!-- <div class="layui-input-block">--> |
| | | <!-- <input class="layui-input" name="businessTripDays" placeholder="请输入出差天数">--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | </div> |
| | | </div> |
| | | <!--自驾--> |
| | | <blockquote class="layui-elem-quote" style="margin-left: 30px;padding: 8px 15px;">自驾信息</blockquote> |
| | | <div class="layui layui-row"> |
| | | <div class="layui-col-md6"> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label layui-form-required">出发日期: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="businessStartTime" id="businessStartTime$" placeholder="请输入出发日期" lay-vertype="tips" lay-verify="required"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label layui-form-required">出发时辰: </label> |
| | | <div class="layui-input-block"> |
| | | <select name="businessStartTimeDay" lay-vertype="tips" lay-verify="required"> |
| | | <option value="">请选择区分</option> |
| | | <option value="1">上午</option> |
| | | <option value="2">下午</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-md6"> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label layui-form-required">结束日期: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="businessEndTime" id="businessEndTime$" placeholder="请输入结束日期" lay-vertype="tips" lay-verify="required"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label layui-form-required">结束时辰: </label> |
| | | <div class="layui-input-block"> |
| | | <select name="businessEndTimeDay" lay-vertype="tips" lay-verify="required"> |
| | | <option value="">请选择区分</option> |
| | | <option value="1">上午</option> |
| | | <option value="2">下午</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <!--其它--> |
| | | <blockquote class="layui-elem-quote" style="margin-left: 30px;padding: 8px 15px;">行程信息</blockquote> |
| | | <div class="layui layui-row"> |
| | | <div class="layui-col-md6"> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label layui-form-required">同行人: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="businessPeers" placeholder="请输入同行人" lay-vertype="tips" lay-verify="required"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-md6"> |
| | | </div> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">出差备注: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="businessNotes" placeholder="请输入出差备注"> |
| | | </div> |
| | | </div> |
| | | <!-- <div class="layui-form-item">--> |
| | | <!-- <label class="layui-form-label">类型: </label>--> |
| | | <!-- <div class="layui-input-block">--> |
| | | <!-- <input class="layui-input" name="businessTripType" placeholder="请输入类型">--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | |
| | | </div> |
| | | </div> |
| | | <hr class="layui-bg-gray"> |
| | | </div> |
| | | <div class="layui-form-item text-right"> |
| | | <button class="layui-btn" lay-filter="editSubmit" lay-submit="">保存</button> |
| | | <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button> |
| | | </div> |
| | | </form> |
| | | </script> |
| | | </html> |
| | | |