1.医院充值功能完成,业务细节还需整理
2.整理调整了common.js部分公共函数
3.调整合同,充值记录,产品统计功能细节
2 files deleted
1 files added
15 files modified
| | |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br> |
| | |
| | | * 状态,1启用,0停用 |
| | | */ |
| | | private Boolean enabled; |
| | | /** |
| | | * 产品结束时间-供前端使用 |
| | | */ |
| | | private Date endTime; |
| | | /** |
| | | * 产品结束时间-供前端使用 |
| | | */ |
| | | private Date beginTime; |
| | | /** |
| | | * 共享,1是,0不 |
| | | */ |
| | | private Boolean isShare; |
| | | } |
| | |
| | | * @return ProductOrderDetail对象 |
| | | */ |
| | | List<GroupProductDetail> groupProductDetail(Page<GroupProductDetail> page, @Param("p") Map<String, Object> params); |
| | | /**批量添加*/ |
| | | int batchInsert(List<ProductOrderDetail> list); |
| | | } |
| | |
| | | package com.kidgrow.oprationcenter.service; |
| | | |
| | | import com.kidgrow.common.model.ResultBody; |
| | | import com.kidgrow.oprationcenter.model.ProductOrderDetail; |
| | | import com.kidgrow.common.model.PageResult; |
| | | import com.kidgrow.common.model.ResultBody; |
| | | import com.kidgrow.common.service.ISuperService; |
| | | import com.kidgrow.oprationcenter.model.ProductOrderDetail; |
| | | import com.kidgrow.oprationcenter.vo.GroupProductDetail; |
| | | import com.kidgrow.oprationcenter.vo.ProductOrderJoinDetail; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | */ |
| | | ResultBody updateEnabled(Map<String, Object> params); |
| | | |
| | | /** |
| | | * 批量写入数据 |
| | | * @param list |
| | | * @return |
| | | */ |
| | | int batchInsert(List<ProductOrderDetail> list); |
| | | |
| | | } |
| | | |
| | |
| | | int i = baseMapper.updateById(productOrder); |
| | | return i > 0 ? ResultBody.ok().data(productOrder).msg("更新成功") : ResultBody.failed("更新失败"); |
| | | } |
| | | |
| | | /** |
| | | * 批量写入数据 |
| | | * @param list |
| | | * @return |
| | | */ |
| | | @Override |
| | | public int batchInsert(List<ProductOrderDetail> list) { |
| | | |
| | | return baseMapper.batchInsert(list); |
| | | } |
| | | } |
| | |
| | | GROUP BY DE.pro_id |
| | | order by pro_count desc |
| | | </select> |
| | | |
| | | <!-- 定义 批量添加数据 --> |
| | | <insert id="batchInsert" parameterType="java.util.List"> |
| | | insert into product_order_detail |
| | | (order_id, |
| | | pro_id, |
| | | pro_name, |
| | | is_share, |
| | | ailight_count, |
| | | record_count, |
| | | pro_begintime, |
| | | pro_endtime) |
| | | values |
| | | <foreach collection="list" item="item" index="index" separator=","> |
| | | (#{item.orderId} , |
| | | #{item.proId} , |
| | | #{item.proName} , |
| | | #{item.isShare} , |
| | | #{item.ailightCount} , |
| | | #{item.recordCount} , |
| | | #{item.proBegintime} , |
| | | #{item.proEndtime}) |
| | | </foreach> |
| | | </insert> |
| | | </mapper> |
| | |
| | | import com.kidgrow.oprationcenter.model.ProductOrderDetail; |
| | | import com.kidgrow.oprationcenter.service.IBusinessRecordsService; |
| | | import com.kidgrow.oprationcenter.service.IProductOrderDetailService; |
| | | import com.kidgrow.oprationcenter.service.IProductOrderService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections.MapUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.validation.ObjectError; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | |
| | | /** |
| | | * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br> |
| | | * |
| | | * @Description: 产品/明显的充值记录 |
| | | * @Project: 运营中心 |
| | | * @CreateDate: Created in 2020-04-02 18:25:34 <br> |
| | |
| | | @RestController |
| | | @RequestMapping("/productorderdetail") |
| | | @Api(tags = "产品/明显的充值记录") |
| | | public class ProductOrderDetailController extends BaseController{ |
| | | public class ProductOrderDetailController extends BaseController { |
| | | @Autowired |
| | | private IProductOrderDetailService productOrderDetailService; |
| | | @Autowired |
| | | private IBusinessRecordsService businessRecordsService; |
| | | @Autowired |
| | | private IProductOrderService productOrderService; |
| | | |
| | | /** |
| | | * 列表 |
| | |
| | | }) |
| | | @GetMapping |
| | | public PageResult list(@RequestParam Map<String, Object> params) { |
| | | if(params.size()==0){ |
| | | params.put("page",1); |
| | | params.put("limit",10); |
| | | if (params.size() == 0) { |
| | | params.put("page", 1); |
| | | params.put("limit", 10); |
| | | } |
| | | return productOrderDetailService.findList(params); |
| | | } |
| | |
| | | }) |
| | | @GetMapping("/all") |
| | | public PageResult findAllList(@RequestParam Map<String, Object> params) { |
| | | if(params.size()==0){ |
| | | params.put("page",1); |
| | | params.put("limit",10); |
| | | if (params.size() == 0) { |
| | | params.put("page", 1); |
| | | params.put("limit", 10); |
| | | } |
| | | return productOrderDetailService.findAllList(params); |
| | | } |
| | |
| | | }) |
| | | @GetMapping("/group") |
| | | public PageResult groupList(@RequestParam Map<String, Object> params) { |
| | | if(params.size()==0){ |
| | | params.put("page",1); |
| | | params.put("limit",10); |
| | | if (params.size() == 0) { |
| | | params.put("page", 1); |
| | | params.put("limit", 10); |
| | | } |
| | | return productOrderDetailService.groupList(params); |
| | | } |
| | |
| | | @ApiOperation(value = "保存") |
| | | @PostMapping |
| | | public ResultBody save(@Valid @RequestBody ProductOrderDetail productOrderDetail, BindingResult bindingResult) { |
| | | List<String> errMsg= new ArrayList<>(); |
| | | List<String> errMsg = new ArrayList<>(); |
| | | if (bindingResult.hasErrors()) { |
| | | for (ObjectError error : bindingResult.getAllErrors()) { |
| | | errMsg.add(error.getDefaultMessage()); |
| | | } |
| | | return ResultBody.failed().msg(errMsg.toString()); |
| | | } else { |
| | | boolean v= productOrderDetailService.saveOrUpdate(productOrderDetail); |
| | | if(v) { |
| | | } else { |
| | | boolean v = productOrderDetailService.saveOrUpdate(productOrderDetail); |
| | | if (v) { |
| | | return ResultBody.ok().data(productOrderDetail).msg("保存成功"); |
| | | } |
| | | else { |
| | | } else { |
| | | return ResultBody.failed().msg("保存失败"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 新增or更新 |
| | | */ |
| | | @ApiOperation(value = "保存") |
| | | @PostMapping("/saveall") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ResultBody batchInsert(@Valid @RequestBody List<ProductOrderDetail> list, BindingResult bindingResult) { |
| | | List<String> errMsg = new ArrayList<>(); |
| | | if (bindingResult.hasErrors()) { |
| | | for (ObjectError error : bindingResult.getAllErrors()) { |
| | | errMsg.add(error.getDefaultMessage()); |
| | | } |
| | | return ResultBody.failed().msg(errMsg.toString()); |
| | | } else { |
| | | //int v = productOrderDetailService.batchInsert(list); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | if (!productOrderDetailService.saveOrUpdate(list.get(i))) { |
| | | //写入订单明细失败,则删除订单记录数据 |
| | | Boolean e = productOrderService.removeById(list.get(0).getOrderId()); |
| | | // //删除已写入的订单明细 |
| | | // Map<String, Object> idList = new HashMap<String, Object>(); |
| | | // idList.put("orderId", list.get(i).getOrderId()); |
| | | // boolean delDetail = productOrderDetailService.removeByMap(idList); |
| | | if (e) |
| | | return ResultBody.failed().msg("充值数据保存失败,订单已撤回!"); |
| | | else |
| | | return ResultBody.failed().msg("充值数据保存失败,订单撤回失败!"); |
| | | } |
| | | } |
| | | return ResultBody.ok().data(list.size()).msg("产品充值成功"); |
| | | } |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "删除") |
| | | @DeleteMapping("/{id}") |
| | | public ResultBody delete(@PathVariable Long id) { |
| | | boolean v= productOrderDetailService.removeById(id); |
| | | if(v) { |
| | | if (!businessRecordsService.recordBusinessData("删除订单明细:"+id,id.toString())) { |
| | | boolean v = productOrderDetailService.removeById(id); |
| | | if (v) { |
| | | if (!businessRecordsService.recordBusinessData("删除订单明细:" + id, id.toString())) { |
| | | //log.error(String.format("删除订单明细id为:{1}",id)); |
| | | } |
| | | return ResultBody.ok().msg("删除成功"); |
| | | } |
| | | else { |
| | | } else { |
| | | return ResultBody.failed().msg("删除失败"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 修改状态 |
| | | * |
| | |
| | | if (params.size() == 0) { |
| | | return ResultBody.failed().msg("参数异常!"); |
| | | } |
| | | ResultBody resultBody=productOrderDetailService.updateEnabled(params); |
| | | ResultBody resultBody = productOrderDetailService.updateEnabled(params); |
| | | //记录业务日志 |
| | | if (resultBody.getCode()==0) { |
| | | String enablad=(MapUtils.getBoolean(params, "enabled"))?"启用":"禁用"; |
| | | if (!businessRecordsService.recordBusinessData("修改订单明细状态为:"+enablad,enablad)) { |
| | | if (resultBody.getCode() == 0) { |
| | | String enablad = (MapUtils.getBoolean(params, "enabled")) ? "启用" : "禁用"; |
| | | if (!businessRecordsService.recordBusinessData("修改订单明细状态为:" + enablad, enablad)) { |
| | | //log.error(String.format("修改合同状态为:{0},写入业务日志失败!合同管理id为:{1}",enablad,MapUtils.getString(params,"id"))); |
| | | } |
| | | } |
| | |
| | | public ResultBody checkDepName(@RequestParam Map<String, Object> params) { |
| | | params.put("page", 1); |
| | | params.put("limit", 1); |
| | | if (sysDepartmentService.findList(params).getData().size()>0) { |
| | | if (sysDepartmentService.findList(params).getData().size() > 0) { |
| | | return ResultBody.failed().msg(String.format("该医院下已经存在科室 %s", params.get("departmentName"))); |
| | | } |
| | | return ResultBody.ok().msg(""); |
| | |
| | | return ResultBody.failed().msg(errMsg.toString()); |
| | | } else { |
| | | //先检查该医院该科室是否已经存在 |
| | | Map<String, Object> checkDepartment=new HashMap<String,Object>(); |
| | | checkDepartment.put("page", 1); |
| | | checkDepartment.put("limit", 1); |
| | | checkDepartment.put("hospitalId",sysDepartment.getHospitalId()); |
| | | checkDepartment.put("departmentName",sysDepartment.getDepartmentName()); |
| | | if (sysDepartmentService.findList(checkDepartment).getData().size()>0) { |
| | | return ResultBody.failed().msg(String.format("该医院下已经存在科室 %s", sysDepartment.getDepartmentName())); |
| | | if (sysDepartment.getId() == null) { |
| | | Map<String, Object> checkDepartment = new HashMap<String, Object>(); |
| | | checkDepartment.put("page", 1); |
| | | checkDepartment.put("limit", 1); |
| | | checkDepartment.put("hospitalId", sysDepartment.getHospitalId()); |
| | | checkDepartment.put("departmentName", sysDepartment.getDepartmentName()); |
| | | if (sysDepartmentService.findList(checkDepartment).getData().size() > 0) { |
| | | return ResultBody.failed().msg(String.format("该医院下已经存在科室 %s", sysDepartment.getDepartmentName())); |
| | | } |
| | | } |
| | | //先检查是否存在组织信息 |
| | | SysOrganization sysOrganization=new SysOrganization(); |
| | | if(sysDepartment.getOrgId()!=null){ |
| | | sysOrganization.setId(sysDepartment.getOrgId());} |
| | | else{ |
| | | SysOrganization sysOrganization = new SysOrganization(); |
| | | if (sysDepartment.getOrgId() != null) { |
| | | sysOrganization.setId(sysDepartment.getOrgId()); |
| | | } else { |
| | | sysOrganization.setOrgName(sysDepartment.getDepartmentName()); |
| | | //临时暂用其它字段承载数据 |
| | | sysOrganization.setOrgParentId(sysDepartment.getUpdateUserId()); |
| | | } |
| | | sysOrganization=sysOrganizationService.findByObject(sysOrganization); |
| | | if(sysOrganization==null) |
| | | { |
| | | sysOrganization = sysOrganizationService.findByObject(sysOrganization); |
| | | if (sysOrganization == null) { |
| | | //创建一个组织 |
| | | sysOrganization=new SysOrganization(); |
| | | sysOrganization = new SysOrganization(); |
| | | sysOrganization.setOrgName(sysDepartment.getDepartmentName()); |
| | | sysOrganization.setOrgAttr(2); |
| | | sysOrganization.setOrgLevel(2); |
| | | //临时暂用其它字段承载数据 |
| | | sysOrganization.setOrgParentId(sysDepartment.getUpdateUserId()); |
| | | } |
| | | else |
| | | { |
| | | } else { |
| | | sysOrganization.setOrgName(sysDepartment.getDepartmentName()); |
| | | } |
| | | boolean org=sysOrganizationService.saveOrUpdate(sysOrganization); |
| | | boolean org = sysOrganizationService.saveOrUpdate(sysOrganization); |
| | | sysDepartment.setOrgId(sysOrganization.getId()); |
| | | boolean v = sysDepartmentService.saveOrUpdate(sysDepartment); |
| | | if (v) { |
| | |
| | | |
| | | /** |
| | | * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br> |
| | | * |
| | | * @Description: 组织架构表 |
| | | * @Project: 用户中心 |
| | | * @CreateDate: Created in 2020-04-10 15:21:10 <br> |
| | |
| | | @RestController |
| | | @RequestMapping("/sysorganization") |
| | | @Api(tags = "组织架构表") |
| | | public class SysOrganizationController extends BaseController{ |
| | | public class SysOrganizationController extends BaseController { |
| | | @Autowired |
| | | private ISysOrganizationService sysOrganizationService; |
| | | |
| | |
| | | }) |
| | | @GetMapping |
| | | public ResultBody<PageResult> list(@RequestParam Map<String, Object> params) { |
| | | if(params.size()==0){ |
| | | params.put("page",1); |
| | | params.put("limit",10); |
| | | if (params.size() == 0) { |
| | | params.put("page", 1); |
| | | params.put("limit", 10); |
| | | } |
| | | return ResultBody.ok().data(sysOrganizationService.findList(params)); |
| | | } |
| | | |
| | | /** |
| | | * 列表 |
| | | */ |
| | |
| | | }) |
| | | @GetMapping("/listByName") |
| | | public ResultBody listByName(@RequestParam Map<String, Object> params) { |
| | | if(params.size()==0){ |
| | | params.put("page",1); |
| | | params.put("limit",10); |
| | | if (params.size() == 0) { |
| | | params.put("page", 1); |
| | | params.put("limit", 10); |
| | | } |
| | | if (params.get("orgName")!=null) { |
| | | if (params.get("orgName") != null) { |
| | | return ResultBody.ok().data(sysOrganizationService.findList(params).getData()); |
| | | } |
| | | else |
| | | { |
| | | } else { |
| | | return ResultBody.ok().data(null); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "查询列表by MAP") |
| | | @GetMapping("getListByMap") |
| | | public ResultBody getListByMap(@RequestParam Map<String, Object> params) { |
| | |
| | | public ResultBody getTree(@RequestParam Map<String, Object> params) { |
| | | return sysOrganizationService.getTree(params); |
| | | } |
| | | |
| | | @ApiOperation(value = "更新状态") |
| | | @GetMapping("updateEnabled") |
| | | public ResultBody updateEnabled(@RequestParam Map<String, Object> params) { |
| | |
| | | @ApiOperation(value = "保存") |
| | | @PostMapping |
| | | public ResultBody save(@Valid @RequestBody SysOrganization sysOrganization, BindingResult bindingResult) { |
| | | List<String> errMsg= new ArrayList<>(); |
| | | List<String> errMsg = new ArrayList<>(); |
| | | if (bindingResult.hasErrors()) { |
| | | for (ObjectError error : bindingResult.getAllErrors()) { |
| | | errMsg.add(error.getDefaultMessage()); |
| | | } |
| | | return ResultBody.failed().msg(errMsg.toString()); |
| | | } else { |
| | | boolean v= sysOrganizationService.saveOrUpdate(sysOrganization); |
| | | if(v) { |
| | | boolean v = sysOrganizationService.saveOrUpdate(sysOrganization); |
| | | if (v) { |
| | | return ResultBody.ok().data(sysOrganization).msg("保存成功"); |
| | | } |
| | | else { |
| | | } else { |
| | | return ResultBody.failed().msg("保存失败"); |
| | | } |
| | | } |
| | |
| | | @ApiOperation(value = "删除") |
| | | @DeleteMapping("/{id}") |
| | | public ResultBody delete(@PathVariable Long id) { |
| | | boolean v= sysOrganizationService.removeById(id); |
| | | if(v) { |
| | | boolean v = sysOrganizationService.removeById(id); |
| | | if (v) { |
| | | return ResultBody.ok().msg("删除成功"); |
| | | } |
| | | else { |
| | | } else { |
| | | return ResultBody.failed().msg("删除失败"); |
| | | } |
| | | } |
| | |
| | | treetable2: 'treetable2/TreeTable', |
| | | autocomplete: 'complete/autocomplete', |
| | | step: 'step-lay/step' |
| | | }).use(['layer','config', 'index', 'element'], function () { |
| | | }).use(['layer', 'config', 'index', 'element'], function () { |
| | | var $ = layui.jquery; |
| | | var layer = layui.layer; |
| | | let config = layui.config; |
| | |
| | | * @param format {date} 传入要格式化的日期类型 |
| | | * @returns {2015-01-31 16:30:00} |
| | | */ |
| | | Date.prototype.dateFormat = function (format){ |
| | | Date.prototype.dateFormat = function (format) { |
| | | var o = { |
| | | "M+" : this.getMonth()+1, //month |
| | | "d+" : this.getDate(), //day |
| | | "h+" : this.getHours(), //hour |
| | | "m+" : this.getMinutes(), //minute |
| | | "s+" : this.getSeconds(), //second |
| | | "q+" : Math.floor((this.getMonth()+3)/3), //quarter |
| | | "S" : this.getMilliseconds() //millisecond |
| | | "M+": this.getMonth() + 1, //month |
| | | "d+": this.getDate(), //day |
| | | "h+": this.getHours(), //hour |
| | | "m+": this.getMinutes(), //minute |
| | | "s+": this.getSeconds(), //second |
| | | "q+": Math.floor((this.getMonth() + 3) / 3), //quarter |
| | | "S": this.getMilliseconds() //millisecond |
| | | } |
| | | if(/(y+)/.test(format)) { |
| | | format = format.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length)); |
| | | if (/(y+)/.test(format)) { |
| | | format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); |
| | | } |
| | | for(var k in o) { |
| | | if(new RegExp("("+ k +")").test(format)) { |
| | | format = format.replace(RegExp.$1, RegExp.$1.length==1 ? o[k] : ("00"+ o[k]).substr((""+ o[k]).length)); |
| | | for (var k in o) { |
| | | if (new RegExp("(" + k + ")").test(format)) { |
| | | format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length)); |
| | | } |
| | | } |
| | | return format; |
| | |
| | | * @param date{date} 传入日期类型 |
| | | * @returns {星期四,...} |
| | | */ |
| | | nowFewWeeks:function(date){ |
| | | if(date instanceof Date){ |
| | | var dayNames = new Array("星期天","星期一","星期二","星期三","星期四","星期五","星期六"); |
| | | nowFewWeeks: function (date) { |
| | | if (date instanceof Date) { |
| | | var dayNames = new Array("星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"); |
| | | return dayNames[date.getDay()]; |
| | | } else{ |
| | | } else { |
| | | return "Param error,date type!"; |
| | | } |
| | | }, |
| | | /** |
| | | * 比较第一个时间值和第二个时间值的大小 如果第一个大 返回true 否则返回false |
| | | * **/ |
| | | compareDate:function(datebegin,dateend) |
| | | { |
| | | var datebegindate=dateUtil.strTurnDate(datebegin); |
| | | var dateenddate=dateUtil.strTurnDate(dateend); |
| | | compareDate: function (datebegin, dateend) { |
| | | var datebegindate = dateUtil.strTurnDate(datebegin); |
| | | var dateenddate = dateUtil.strTurnDate(dateend); |
| | | if (datebegindate > dateenddate) { |
| | | return false; |
| | | } else { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | }, |
| | | /*** |
| | | * 获取今天的时间字符串 |
| | | */ |
| | | getNowDate:function() |
| | | { |
| | | getNowDate: function () { |
| | | var dayTime = new Date(); |
| | | dayTime.setTime(dayTime.getTime()); |
| | | return dayTime.getFullYear()+"-" + (dayTime.getMonth()+1) + "-" + dayTime.getDate(); |
| | | return dayTime.getFullYear() + "-" + (dayTime.getMonth() + 1) + "-" + dayTime.getDate(); |
| | | }, |
| | | /* |
| | | * 方法作用:【字符串转换成日期】 |
| | |
| | | * @param str {String}字符串格式的日期,传入格式:yyyy-mm-dd(2015-01-31) |
| | | * @return {Date}由字符串转换成的日期 |
| | | */ |
| | | strTurnDate:function(str){ |
| | | var re = /^(\d{4})\S(\d{1,2})\S(\d{1,2})$/; |
| | | var dt; |
| | | if (re.test(str)){ |
| | | dt = new Date(RegExp.$1,RegExp.$2 - 1,RegExp.$3); |
| | | strTurnDate: function (str) { |
| | | var re = /^(\d{4})\S(\d{1,2})\S(\d{1,2})$/; |
| | | var dt; |
| | | if (re.test(str)) { |
| | | dt = new Date(RegExp.$1, RegExp.$2 - 1, RegExp.$3); |
| | | } |
| | | return dt; |
| | | }, |
| | |
| | | * @endDate {Date}结束日期 |
| | | * @return endDate - startDate的天数差 |
| | | */ |
| | | dayMinus:function(startDate, endDate){ |
| | | if(startDate instanceof Date && endDate instanceof Date){ |
| | | var days = Math.floor((endDate-startDate)/(1000 * 60 * 60 * 24)); |
| | | dayMinus: function (startDate, endDate) { |
| | | if (startDate instanceof Date && endDate instanceof Date) { |
| | | var days = Math.floor((endDate - startDate) / (1000 * 60 * 60 * 24)); |
| | | return days; |
| | | }else{ |
| | | } else { |
| | | return "Param error,date type!"; |
| | | } |
| | | }, |
| | | /** |
| | | * 判断一个字符串是否日期 |
| | | * @param {字符串} strDate |
| | | */ |
| | | isDate: function (strDate) { |
| | | if (!strUtil.isEmpty(strDate) && !isNaN(Date.parse(strDate))) { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | }; |
| | | |
| | |
| | | * @param fileurl 文件路径, |
| | | * @param filetype 文件类型,支持传入类型,js、css |
| | | */ |
| | | loadjscssfile:function(fileurl,filetype){ |
| | | if(filetype == "js"){ |
| | | loadjscssfile: function (fileurl, filetype) { |
| | | if (filetype == "js") { |
| | | var fileref = document.createElement('script'); |
| | | fileref.setAttribute("type","text/javascript"); |
| | | fileref.setAttribute("src",fileurl); |
| | | }else if(filetype == "css"){ |
| | | fileref.setAttribute("type", "text/javascript"); |
| | | fileref.setAttribute("src", fileurl); |
| | | } else if (filetype == "css") { |
| | | |
| | | var fileref = document.createElement('link'); |
| | | fileref.setAttribute("rel","stylesheet"); |
| | | fileref.setAttribute("type","text/css"); |
| | | fileref.setAttribute("href",fileurl); |
| | | fileref.setAttribute("rel", "stylesheet"); |
| | | fileref.setAttribute("type", "text/css"); |
| | | fileref.setAttribute("href", fileurl); |
| | | } |
| | | if(typeof fileref != "undefined"){ |
| | | if (typeof fileref != "undefined") { |
| | | document.getElementsByTagName("head")[0].appendChild(fileref); |
| | | }else{ |
| | | } else { |
| | | alert("loadjscssfile method error!"); |
| | | } |
| | | } |
| | |
| | | * @param str 传入的字符串 |
| | | * @returns {} |
| | | */ |
| | | isEmpty:function(str){ |
| | | if(str != '' && str != undefined && str != null){ |
| | | isEmpty: function (str) { |
| | | if (str != '' && str != undefined && str != null) { |
| | | return false; |
| | | }else{ |
| | | } else { |
| | | return true; |
| | | } |
| | | }, |
| | |
| | | * @param str2 |
| | | * @returns {Boolean} |
| | | */ |
| | | isEquals:function(str1,str2){ |
| | | if(str1==str2){ |
| | | isEquals: function (str1, str2) { |
| | | if (str1 == str2) { |
| | | return true; |
| | | }else{ |
| | | } else { |
| | | return false; |
| | | } |
| | | }, |
| | |
| | | * @param str2 |
| | | * @returns {Boolean} |
| | | */ |
| | | isEqualsIgnorecase:function(str1,str2){ |
| | | if(str1.toUpperCase() == str2.toUpperCase()){ |
| | | isEqualsIgnorecase: function (str1, str2) { |
| | | if (str1.toUpperCase() == str2.toUpperCase()) { |
| | | return true; |
| | | }else{ |
| | | } else { |
| | | return false; |
| | | } |
| | | }, |
| | |
| | | * @param value |
| | | * @returns {Boolean} |
| | | */ |
| | | isNum:function (value){ |
| | | if( value != null && value.length>0 && isNaN(value) == false){ |
| | | isNum: function (value) { |
| | | if (value != null && value.length > 0 && isNaN(value) == false) { |
| | | return true; |
| | | }else{ |
| | | } else { |
| | | return false; |
| | | } |
| | | }, |
| | |
| | | * @param str |
| | | * @returns {Boolean} |
| | | */ |
| | | isChine:function(str){ |
| | | isChine: function (str) { |
| | | var reg = /^([u4E00-u9FA5]|[uFE30-uFFA0])*$/; |
| | | if(reg.test(str)){ |
| | | if (reg.test(str)) { |
| | | return false; |
| | | } |
| | | return true; |
| | |
| | | debugger |
| | | var url = location.search; //获取url中"?"符后的字串 |
| | | var theRequest = new Object(); |
| | | if(url.indexOf("?") != -1) { |
| | | if (url.indexOf("?") != -1) { |
| | | var str = url.substr(1); |
| | | strs = str.split("&"); |
| | | for(var i = 0; i < strs.length; i++) { |
| | | for (var i = 0; i < strs.length; i++) { |
| | | theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]); |
| | | } |
| | | } |
| | |
| | | { field: 'hospitalName', width: 300, title: '医院名称' }, |
| | | { field: 'departmentName', width: 100, title: '科室名称' }, |
| | | { field: 'contractNo', width: 150, title: '合同编号' }, |
| | | { field: 'contractTitle', width: 150, title: '合同名' }, |
| | | { field: 'contractTitle', width: 260, title: '合同名' }, |
| | | { field: 'contractBeginTime', width: 150, title: '合同生效时间',templet:function(d) |
| | | { |
| | | return new Date(d.contractBeginTime).dateFormat("yyyy/MM/dd"); |
| | |
| | | return new Date(d.contractEndTime).dateFormat("yyyy/MM/dd"); |
| | | } }, |
| | | { field: 'contractTime', width: 180, title: '合同签订时间',templet:function(d){ |
| | | return new Date(d.contractTime).dateFormat("yyyy/MM/dd hh:mm:ss"); |
| | | return new Date(d.contractTime).dateFormat("yyyy/MM/dd"); |
| | | } }, |
| | | { field: 'enabled', width: 120, templet: '#contract-tpl-state', sort: true, title: '状态' }, |
| | | // { field: 'enabled', width: 120, templet: '#contract-tpl-state', sort: true, title: '状态' }, |
| | | { field: 'createTime', width: 160, sort: true, title: '创建时间' }, |
| | | { align: 'center', width: 150, toolbar: '#contract-table-bar', title: '操作' } |
| | | ]] |
| | | }); |
| | | } |
| | | renderTable(); |
| | | |
| | | // 修改状态 |
| | | form.on('switch(contract-tpl-state)', function (obj) { |
| | | layer.load(2); |
| | | admin.req('api-opration/contract/updateEnabled', { |
| | | id: obj.elem.value, |
| | | enabled: obj.elem.checked ? true : false |
| | | }, function (data) { |
| | | layer.closeAll('loading'); |
| | | if (data.code == 0) { |
| | | layer.msg(data.msg, { icon: 1, time: 500 }); |
| | | } else { |
| | | layer.msg(data.msg, { icon: 2, time: 500 }); |
| | | $(obj.elem).prop('checked', !obj.elem.checked); |
| | | form.render('checkbox'); |
| | | } |
| | | }, 'GET'); |
| | | }); |
| | | |
| | | // 工具条点击事件 |
| | | table.on('tool(contract-table)', function (obj) { |
| | | if (obj.event === 'del') { // 删除 |
| | |
| | | where:{'orderId':orderId}, |
| | | headers: { 'Authorization': 'Bearer ' + config.getToken().access_token }, |
| | | page: true, |
| | | limit:5, |
| | | limit:10, |
| | | limits:[5,10], |
| | | cols: [[ |
| | | { field: 'proName', width: 300, title: '产品名称' }, |
| | |
| | | return new Date(d.proBegintime).dateFormat("yyyy/MM/dd"); |
| | | } }, |
| | | { field: 'proEndtime', width: 180, title: '结束时间',templet:function(d){ |
| | | return new Date(d.proEndtime).dateFormat("yyyy/MM/dd hh:mm:ss"); |
| | | return new Date(d.proEndtime).dateFormat("yyyy/MM/dd"); |
| | | } }, |
| | | { field: 'createTime', width: 160, sort: true, title: '创建时间' } |
| | | ]] |
| | |
| | | </div> |
| | | <div class="layui-card-body"> |
| | | <div class="layui-form toolbar">  |
| | | <input type="text" name="date" id="datebegin" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" |
| | | <input type="text" name="date" id="datebegin" lay-verify="date" autocomplete="off" |
| | | class="layui-input search-input"> |
| | | 至 |
| | | <input type="text" name="date" id="dateend" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" |
| | | <input type="text" name="date" id="dateend" lay-verify="date" autocomplete="off" |
| | | class="layui-input search-input">   |
| | | <button id="product-btn-search" class="layui-btn icon-btn"><i class="layui-icon"></i>搜索</button> |
| | | </div> |
| | |
| | | admin.putTempData("t_hospital", data); |
| | | showEditModel("edit"); |
| | | } |
| | | else if(layEvent==="pay") |
| | | { |
| | | //充值 |
| | | admin.putTempData("t_hospital", data); |
| | | admin.popupCenter({ |
| | | title: '医院充值', |
| | | path: 'pages/opration/recharge.html', |
| | | area: '1200px', |
| | | offset:'10px', |
| | | finish: function () { |
| | | $('#hospita-btn-search').click(); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | // 搜索按钮点击事件 |
| | | $('#hospita-btn-search').click(function () { |
| | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">医院简介</label> |
| | | <div class="layui-input-block"> |
| | | <textarea name="hospital_about" class="layui-textarea" maxlength="500"></textarea> |
| | | <textarea name="hospitalAbout" class="layui-textarea" maxlength="500"></textarea> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item model-form-footer"> |
| | |
| | | form.on("select(hospitalCity)", function (data) { |
| | | area.areaData("#hospitalArea", 3, data.value, ""); |
| | | //区号,金纬度自动赋值 |
| | | let cityData = admin.getTempData("t_city"); |
| | | if (cityData != null) { |
| | | cityData.forEach(function (item) { |
| | | var cityDataFor = admin.getTempData("t_city"); |
| | | if (cityDataFor != null) { |
| | | cityDataFor.forEach(function (item) { |
| | | if (data.value == item.id) { |
| | | $("#areaCode").val(item.areaCitycode); |
| | | $("#longitude").val(item.areaLng); |
| | | $("#latitude").val(item.areaLat); |
| | | break; |
| | | return; |
| | | } |
| | | }) |
| | | } |
| | |
| | | data.field.hospitalArea = $("#hospitalArea option:selected").text() != "选择区县" ? $("#hospitalArea option:selected").text() : ""; |
| | | |
| | | admin.req('api-user/syshospital', JSON.stringify(data.field), function (data) { |
| | | layer.closeAll('loading'); |
| | | if (data.code === 0) { |
| | | //存储科室数据 |
| | | var departmentData = { |
| | |
| | | return false; |
| | | } |
| | | } |
| | | let hosIdForDep = $("#id").val(); |
| | | if (!strUtil.isEmpty($("#departmentName").val()) && !strUtil.isEmpty(hosIdForDep)) { |
| | | admin.req('api-user/sysdepartment/checkName', { hospitalId: hosIdForDep, departmentName: $("#departmentName").val() }, function (data) { |
| | | layer.closeAll('loading'); |
| | | if (0 != data.code) { |
| | | layer.msg(data.msg, { icon: 2, time: 1000 }); |
| | | return false; |
| | | } |
| | | }, 'get'); |
| | | } |
| | | let hosIdForDep = $("#id").val(); |
| | | if (!strUtil.isEmpty($("#departmentName").val()) && !strUtil.isEmpty(hosIdForDep)) { |
| | | admin.req('api-user/sysdepartment/checkName', { hospitalId: hosIdForDep, departmentName: $("#departmentName").val() }, function (data) { |
| | | layer.closeAll('loading'); |
| | | if (0 != data.code) { |
| | | layer.msg(data.msg, { icon: 2, time: 1000 }); |
| | | return false; |
| | | } |
| | | }, 'get'); |
| | | } |
| | | }) |
| | | //按照ID装载数据 |
| | | var loadDatas = function (hosId) { |
| | |
| | | cols: [[ |
| | | { field: 'proName', width: 300, title: '产品名称' }, |
| | | { |
| | | field: 'proType',align: 'center', width: 100, templet: function (d) { |
| | | if (d.proType === 0) |
| | | return "试用" |
| | | else |
| | | return "正式" |
| | | }, title: '类型' |
| | | }, |
| | | { |
| | | field: 'proTime', width: 150, title: '有效时长', templet: function (d) { |
| | | switch (d.proTimeUnit) { |
| | | case 0: |
| | |
| | | </script> |
| | | <!-- 表格状态列 --> |
| | | <script type="text/html" id="product-tpl-state"> |
| | | <input type="checkbox" lay-filter="product-tpl-state" value="{{d.id}}" lay-skin="switch" lay-text="未处理|已处理" |
| | | <input type="checkbox" lay-filter="product-tpl-state" value="{{d.id}}" lay-skin="switch" lay-text="启用|已禁用" |
| | | {{d.enabled==true?'checked':''}}/> |
| | | </script> |
| | | |
| | |
| | | { field: 'createTime', width: 160, sort: true, title: '创建时间',templet:function(d){ |
| | | return new Date(d.createTime).dateFormat("yyyy/MM/dd hh:mm:ss"); |
| | | } }, |
| | | { field: 'enabled', width: 150, templet: '#product-tpl-state', sort: true, title: '状态' }, |
| | | { field: 'enabled', width: 100, templet: '#product-tpl-state', sort: true, title: '状态' }, |
| | | { align: 'center', width: 100, toolbar: '#product-table-bar', title: '操作' } |
| | | ]] |
| | | }); |
New file |
| | |
| | | <form id="recharge-form" lay-filter="recharge-form" class="layui-form"> |
| | | <div class="layui-tab" style="margin-top: 5px;"> |
| | | <ul class="layui-tab-title"> |
| | | <li class="layui-this">合同信息</li> |
| | | </ul> |
| | | <div class="layui-tab-content" style="margin: 0px;"> |
| | | <div class="layui-tab-item layui-show"> |
| | | <div class="layui-form-item" style="padding: 0; margin-bottom: 0px;"> |
| | | <div class="layui-row"> |
| | | <div class="layui-col-sm5"> |
| | | <label class="layui-form-label" style="padding: 0;">医院名称</label> |
| | | <div class="layui-input-block"> |
| | | <input name="hospitalName" id="hospitalName" type="text" class="layui-input" |
| | | style="border: none; margin-top:-10px" readonly /> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-sm3"> |
| | | <label class="layui-form-label" style="padding: 0;">科室名称</label> |
| | | <div class="layui-input-block"> |
| | | <input name="departmentName" id="departmentName" style="border: none; margin-top:-10px" |
| | | readonly class="layui-input" /> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-sm2"> |
| | | <label class="layui-form-label" style="padding: 0;">服务人员</label> |
| | | <div class="layui-input-block"> |
| | | <input name="serverUserName" id="serverUserName" |
| | | style="border: none; margin-top:-10px;width: 120px;" readonly class="layui-input" /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item" style="padding: 0; margin-bottom: 0px;"> |
| | | <div class="layui-row"> |
| | | <div class="layui-col-sm5"> |
| | | <label class="layui-form-label" style="padding: 0 30px 0 0;">地区</label> |
| | | <input name="hospitalAreas" id="hospitalAreas" type="text" |
| | | style="border: none; width: 250px; margin-top:-10px" readonly class="layui-input" /> |
| | | </div> |
| | | <div class="layui-col-sm3"> |
| | | <label class="layui-form-label" style="padding: 0;">联系电话</label> |
| | | <div class="layui-input-block"> |
| | | <input name="hospitalTel" id="hospitalTel" type="text" class="layui-input" |
| | | style="border: none; margin-top:-10px" readonly /> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-sm2"> |
| | | <label class="layui-form-label" style="padding: 0;">联系人</label> |
| | | <div class="layui-input-block"> |
| | | <input name="hospitalLink" type="text" class="layui-input" |
| | | style="border: none; margin-top:-10px;width: 120px;" readonly /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item" style="padding: 0; margin-bottom: 0px;"> |
| | | <div class="layui-row"> |
| | | <div class="layui-col-sm4"> |
| | | <label class="layui-form-label" style="padding: 10px 30px 0 0px;">合同名称</label> |
| | | <div class="layui-input-block"> |
| | | <input name="contractTitle" id="contractTitle" type="text" class="layui-input" |
| | | maxlength="50" lay-verify="required" required autocomplete="off" /> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-sm3"> |
| | | <label class="layui-form-label">合同编号</label> |
| | | <div class="layui-input-block"> |
| | | <input name="contractNo" id="contractNo" type="text" class="layui-input" maxlength="50" |
| | | style="width: 185px;" autocomplete="off"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item" style="margin: 10px 0px 0px 0px;"> |
| | | <div class="layui-row"> |
| | | <div class="layui-col-sm4"> |
| | | <label class="layui-form-label" style="padding: 10px 30px 0 0px;">开始日期</label> |
| | | <input autocomplete="off" name="contractBeginTime" id="contractBeginTime" type="text" class="layui-input" |
| | | style="width: 182px;" maxlength="50" lay-verify="required" required /> |
| | | </div> |
| | | <div class="layui-col-sm4"> |
| | | <label class="layui-form-label">截止日期</label> |
| | | <div class="layui-input-block"> |
| | | <input autocomplete="off" name="contractEndTime" id="contractEndTime" type="text" class="layui-input" |
| | | maxlength="50" lay-verify="required" required /> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-sm4"> |
| | | <label class="layui-form-label">签订日期</label> |
| | | <div class="layui-input-block"> |
| | | <input autocomplete="off" name="contractTime" id="contractTime" type="text" class="layui-input" |
| | | maxlength="50" lay-verify="required" required /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-tab" style="margin: 0px;"> |
| | | <ul class="layui-tab-title"> |
| | | <li class="layui-this">产品信息</li> |
| | | </ul> |
| | | <div class="layui-tab-content" style="margin: 0px;"> |
| | | <div class="layui-tab-item layui-show" style="padding-top: 0px;"> |
| | | <table class="layui-table" id="product-table" lay-filter="product-table" style="margin: 0px;"></table> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-tab" style="margin: 0px;"> |
| | | <ul class="layui-tab-title"> |
| | | <li class="layui-this">待充值产品</li> |
| | | </ul> |
| | | <div class="layui-tab-content"> |
| | | <div class="layui-tab-item layui-show" style="padding-top: 0px;"> |
| | | <table class="layui-table" id="product-table-temp" lay-filter="product-table-temp" style="margin: 0px;"> |
| | | </table> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item model-form-footer" style="margin-right: 20px;"> |
| | | <button class="layui-btn layui-btn-primary" ew-event="closeDialog" type="button">取消</button> |
| | | <button class="layui-btn" lay-filter="recharge-form-submit" lay-submit>确定充值</button> |
| | | </div> |
| | | <input type="hidden" value="" id="departmentId" name="departmentId" /> |
| | | <input type="hidden" value="" id="hospitalId" name="hospitalId" /> |
| | | <input type="hidden" value="" id="orgId" name="orgId" /> |
| | | <input type="hidden" value="" id="serverUserId" name="serverUserId" /> |
| | | </form> |
| | | <!-- 表格操作列 --> |
| | | <script type="text/html" id="product-tpl-bar"> |
| | | <a class="layui-btn layui-btn-xs" lay-event="pay">加入待充值</a> |
| | | </script> |
| | | <!-- 表格操作列 --> |
| | | <script type="text/html" id="product-tpl-bar-temp"> |
| | | <a class="layui-btn layui-btn-danger" lay-event="del">移除</a> |
| | | </script> |
| | | <!-- 表格状态列 --> |
| | | <script type="text/html" id="product-tpl-isShare"> |
| | | <input type="checkbox" lay-filter="product-tpl-isShare" value="{{d.id}}" lay-skin="switch" lay-text="共享|不共享"/> |
| | | </script> |
| | | <script> |
| | | layui.use(['form', 'table', 'util', 'config', 'laydate', 'admin'], function () { |
| | | var form = layui.form; |
| | | var table = layui.table; |
| | | var config = layui.config; |
| | | var layer = layui.layer; |
| | | var util = layui.util; |
| | | var admin = layui.admin; |
| | | var $ = layui.jquery; |
| | | var laydate = layui.laydate; |
| | | |
| | | //执行一个laydate实例 |
| | | laydate.render({ |
| | | elem: '#contractBeginTime'//指定元素 |
| | | }); |
| | | laydate.render({ |
| | | elem: '#contractEndTime' //指定元素 |
| | | }); |
| | | laydate.render({ |
| | | elem: '#contractTime', //指定元素 |
| | | value: new Date().dateFormat("yyyy-MM-dd") |
| | | }); |
| | | //现将临时数据清理 |
| | | admin.putTempData("t_tempProduct", ""); |
| | | //待充值列表 |
| | | var waitRecharge = function () { |
| | | table.render({ |
| | | elem: '#product-table-temp', |
| | | data: admin.getTempData("t_tempProduct"), |
| | | page: false, |
| | | height: '120px', |
| | | cols: [[ |
| | | { field: 'proName', width: 320, title: '产品名称', align: 'center', fixed: 'left' }, |
| | | { |
| | | field: 'proType', align: 'center', width: 100, templet: function (d) { |
| | | if (d.proType === 0) |
| | | return "试用" |
| | | else |
| | | return "正式" |
| | | }, title: '类型' |
| | | }, |
| | | { |
| | | field: 'proTime', width: 100, title: '时长', align: 'center', templet: function (d) { |
| | | switch (d.proTimeUnit) { |
| | | case 0: |
| | | return d.proTime + "天"; |
| | | break; |
| | | case 1: |
| | | return d.proTime + "月"; |
| | | break; |
| | | case 2: |
| | | return d.proTime + "年"; |
| | | break; |
| | | } |
| | | } |
| | | }, |
| | | { field: 'recordCount', width: 110, align: 'center', title: '报告数' }, |
| | | { field: 'ailightCount', width: 100, align: 'center', title: '读片量' }, |
| | | { |
| | | field: 'beginTime', align: 'center', width: 120, title: '开始日期' |
| | | }, |
| | | { |
| | | field: 'endTime', align: 'center', width: 120, title: '结束日期' |
| | | }, |
| | | { |
| | | field: 'isShare', fixed: 'right', align: 'center', width: 100, templet: function (d) { |
| | | if (d.isShare == 0) |
| | | return "不共享" |
| | | else |
| | | return "共享" |
| | | }, title: '共享' |
| | | }, |
| | | { field: 'id', fixed: 'right', align: 'center', width: 80, toolbar: '#product-tpl-bar-temp', title: '操作' } |
| | | ]] |
| | | }); |
| | | } |
| | | |
| | | //回显医院基本数据 |
| | | let hospitalData = admin.getTempData('t_hospital'); |
| | | if (hospitalData != null) { |
| | | form.val('recharge-form', hospitalData); |
| | | $("#hospitalAreas").val(hospitalData.hospitalProvince + " " + hospitalData.hospitalCity + " " + hospitalData.hospitalArea); |
| | | } |
| | | //装载产品数据 |
| | | table.render({ |
| | | elem: '#product-table', |
| | | url: config.base_server + 'api-opration/product', |
| | | method: 'GET', |
| | | headers: { 'Authorization': 'Bearer ' + config.getToken().access_token }, |
| | | page: false, |
| | | height: '300px', |
| | | where: { enabled: 1 }, |
| | | cols: [[ |
| | | { field: 'proName', sort: true, width: 300, title: '产品名称', align: 'center', fixed: 'left' }, |
| | | { |
| | | field: 'proType', sort: true, align: 'center', width: 80, templet: function (d) { |
| | | if (d.proType === 0) |
| | | return "试用" |
| | | else |
| | | return "正式" |
| | | }, title: '类型' |
| | | }, |
| | | { |
| | | field: 'proTime', width: 100, title: '时长', align: 'center', templet: function (d) { |
| | | switch (d.proTimeUnit) { |
| | | case 0: |
| | | return d.proTime + "天"; |
| | | break; |
| | | case 1: |
| | | return d.proTime + "月"; |
| | | break; |
| | | case 2: |
| | | return d.proTime + "年"; |
| | | break; |
| | | } |
| | | } |
| | | }, |
| | | { field: 'recordCount', width: 100, align: 'center', title: '报告数' }, |
| | | { field: 'ailightCount', width: 100, align: 'center', title: '读片量' }, |
| | | { |
| | | field: 'beginTime', align: 'center', width: 130, title: '开始日期', templet: function (d) { |
| | | return getNowDate(); |
| | | }, event: "date", edit: 'text' |
| | | }, |
| | | { |
| | | field: 'endTime', align: 'center', width: 130, title: '结束日期', templet: function (d) { |
| | | return getNowDate(d.proTime, d.proTimeUnit); |
| | | }, event: "date", edit: 'text' |
| | | }, |
| | | { field: 'isShare', fixed: 'right', align: 'center', width: 100, templet: '#product-tpl-isShare', title: '共享' }, |
| | | { field: 'id', fixed: 'right', align: 'center', width: 100, toolbar: '#product-tpl-bar', title: '操作' } |
| | | ]] |
| | | }); |
| | | //待充值列表功能操作 |
| | | table.on('tool(product-table-temp)', function (obj) { |
| | | if (obj.event === "del") { |
| | | if (!strUtil.isEmpty(obj.data.id)) { |
| | | delTempDataById(obj.data.id); |
| | | obj.del(); |
| | | } |
| | | } |
| | | }); |
| | | //单元格点击事件 |
| | | table.on('tool(product-table)', function (obj) { |
| | | var data = obj.data; |
| | | var selectData = {}; |
| | | if (obj.event === "pay") { |
| | | data.beginTime = obj.tr.find("td[data-field='beginTime'] input").val(); |
| | | data.endTime = obj.tr.find("td[data-field='endTime'] input").val(); |
| | | data.beginTime = (!strUtil.isEmpty(data.beginTime)) ? data.beginTime : obj.tr.find("td[data-field='beginTime'] div").text(); |
| | | data.endTime = (!strUtil.isEmpty(data.endTime)) ? data.endTime : obj.tr.find("td[data-field='endTime'] div").text(); |
| | | data.isShare = obj.tr.find("td[data-field='isShare'] em").text(); |
| | | data.isShare = (data.isShare.indexOf("不") == 0) ? 0 : 1 |
| | | ; |
| | | if (!strUtil.isEmpty(data.beginTime) && !strUtil.isEmpty(data.endTime)) { |
| | | if (dateUtil.compareDate(data.endTime, data.beginTime)) { |
| | | tempDataList(data); |
| | | waitRecharge(); |
| | | } |
| | | else { |
| | | layer.msg("结束时间必须大于开始时间!"); |
| | | return false; |
| | | } |
| | | } |
| | | else { |
| | | layer.msg("时间格式有误!"); |
| | | return false; |
| | | } |
| | | } |
| | | }); |
| | | //监听单元格编辑 判断日期格式 |
| | | table.on('edit(product-table)', function (obj) { |
| | | var value = obj.value //得到修改后的值 |
| | | , data = obj.data //得到所在行所有键值 |
| | | , field = obj.field; //得到字段 |
| | | if (dateUtil.isDate(value)) { |
| | | } |
| | | else { |
| | | layer.msg("输入的日期格式无效!"); |
| | | } |
| | | }); |
| | | //自动计算时间 |
| | | var getNowDate = function (proTime, proTimeUnit) { |
| | | var now = new Date(); |
| | | if (strUtil.isEmpty(proTime) && strUtil.isEmpty(proTimeUnit)) { |
| | | return now.dateFormat("yyyy-MM-dd"); |
| | | } |
| | | else { |
| | | proTime = strUtil.isEmpty(proTime) ? 0 : proTime; |
| | | proTimeUnit = strUtil.isEmpty(proTimeUnit) ? 0 : proTimeUnit; |
| | | switch (proTimeUnit) { |
| | | case 0: |
| | | return new Date(now.setDate(now.getDate() + proTime)).dateFormat("yyyy-MM-dd"); |
| | | break; |
| | | case 1: |
| | | return new Date(now.setMonth(now.getMonth() + proTime + 1)).dateFormat("yyyy-MM-dd"); |
| | | break; |
| | | case 2: |
| | | return new Date(now.setFullYear(now.getFullYear() + proTime)).dateFormat("yyyy-MM-dd"); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | // 产品待充值数据 |
| | | var tempDataList = function (data) { |
| | | if (!strUtil.isEmpty(data)) { |
| | | var listData = admin.getTempData("t_tempProduct"); |
| | | if (strUtil.isEmpty(listData)) { |
| | | listData = new Array(); |
| | | } |
| | | $.each(listData, function (index, value) { |
| | | if (value.id === data.id) { |
| | | //移除 |
| | | listData.splice(index, 1); |
| | | return false; |
| | | } |
| | | }) |
| | | listData.push(data); |
| | | admin.putTempData("t_tempProduct", listData); |
| | | } |
| | | else { |
| | | admin.putTempData("t_tempProduct", ""); |
| | | } |
| | | } |
| | | //移除指定数据 |
| | | var delTempDataById = function (id) { |
| | | if (!strUtil.isEmpty(id)) { |
| | | var listData = admin.getTempData("t_tempProduct"); |
| | | $.each(listData, function (index, value) { |
| | | if (value.id === id) { |
| | | //移除 |
| | | listData.splice(index, 1); |
| | | return false; |
| | | } |
| | | }) |
| | | admin.putTempData("t_tempProduct", listData); |
| | | } |
| | | } |
| | | form.on('submit(recharge-form-submit)', function (data) { |
| | | layer.load(2); |
| | | var listData = admin.getTempData("t_tempProduct"); |
| | | if (listData != null) { |
| | | if (data.field != null) { |
| | | admin.req('api-opration/contract', JSON.stringify(data.field), function (data) { |
| | | layer.closeAll('loading'); |
| | | if (data.code === 0) { |
| | | var orderData = data.data; |
| | | //处理订单明细数据 |
| | | var listDetailData = new Array(); |
| | | $.each(listData, function (index, item) { |
| | | var detailData = { |
| | | orderId: orderData.id, |
| | | proId: item.id, |
| | | proType: item.proType, |
| | | proName: item.proName, |
| | | isShare: item.isShare, |
| | | ailightCount: item.ailightCount, |
| | | recordCount: item.recordCount, |
| | | proBegintime: new Date(item.beginTime+' 00:00:00'), |
| | | proEndtime: new Date(item.endTime+' 23:59:59') |
| | | }; |
| | | listDetailData.push(detailData); |
| | | }) |
| | | if (listDetailData.length > 0) { |
| | | //提交订单数据 |
| | | admin.req('api-opration/productorderdetail/saveall', JSON.stringify(listDetailData), function (data) { |
| | | layer.closeAll('loading'); |
| | | if (data.code === 0) { |
| | | //现将临时数据清理 |
| | | admin.putTempData("t_tempProduct", ""); |
| | | layer.msg(data.msg, { icon: 1, time: 1000 }, function () { |
| | | admin.finishPopupCenter(); |
| | | }); |
| | | } |
| | | else { |
| | | layer.msg(data.msg, { icon: 2, time: 1000 }); |
| | | } |
| | | }, 'POST'); |
| | | } |
| | | else { |
| | | layer.msg("充值数据异常为空!", { icon: 2, time: 1000 }); |
| | | } |
| | | } |
| | | else { |
| | | layer.msg(data.msg, { icon: 2, time: 1000 }); |
| | | } |
| | | }, 'POST'); |
| | | } |
| | | else { |
| | | layer.msg("数据异常!", { icon: 2, time: 1000 }); |
| | | } |
| | | } |
| | | else { |
| | | layer.msg("请先将要充值的产品加入待充值!", { icon: 2, time: 2000 }); |
| | | } |
| | | layer.closeAll('loading'); |
| | | return false; |
| | | }); |
| | | }); |
| | | </script> |