1.增加产品消费详情列表功能
2.增加产品消费统计功能列表
3.修改合同管理显示字段
7 files modified
1 files deleted
4 files added
New file |
| | |
| | | package com.kidgrow.oprationcenter.vo; |
| | | |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | /** |
| | | * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br> |
| | | * |
| | | * @Description: <br> |
| | | * @Project: <br> |
| | | * @CreateDate: Created in 2020/04/13 10:28 <br> |
| | | * @Author: <a href="411269194@kidgrow.com">liuke</a> |
| | | */ |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class GroupProductDetail extends Model<GroupProductDetail> { |
| | | //实体序列化 必要 |
| | | private static final long serialVersionUID = 1L; |
| | | /** |
| | | * 产品数量 |
| | | */ |
| | | private Long proCount; |
| | | /** |
| | | * 产品/明细名称 |
| | | */ |
| | | private String proName; |
| | | } |
New file |
| | |
| | | package com.kidgrow.oprationcenter.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br> |
| | | * |
| | | * @Description: <br> |
| | | * @Project: <br> |
| | | * @CreateDate: Created in 2020/04/10 18:38 <br> |
| | | * @Author: <a href="411269194@kidgrow.com">liuke</a> |
| | | */ |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class ProductOrderJoinDetail extends Model<ProductOrderJoinDetail> { |
| | | //实体序列化 必要 |
| | | private static final long serialVersionUID = 1L; |
| | | /** |
| | | * 对应product_order_detail表中的id |
| | | */ |
| | | private Long id; |
| | | /** |
| | | * 对应product_order表中的id |
| | | */ |
| | | private Long orderId; |
| | | /** |
| | | * 产品/明细ID |
| | | */ |
| | | private Long proId; |
| | | /** |
| | | * 产品/明细名称 |
| | | */ |
| | | private String proName; |
| | | /** |
| | | * 医院名称 |
| | | */ |
| | | private String hospitalName; |
| | | /** |
| | | * 科室名称 |
| | | */ |
| | | private String departmentName; |
| | | /** |
| | | * 是否共享 0否 1是 |
| | | */ |
| | | private Boolean isShare; |
| | | /** |
| | | * 读片量 |
| | | */ |
| | | private Integer ailightCount; |
| | | /** |
| | | * 报告量 |
| | | */ |
| | | private Integer recordCount; |
| | | /** |
| | | * 有效的开始时间 |
| | | */ |
| | | private Date proBegintime; |
| | | /** |
| | | * 有效的结束时间 |
| | | */ |
| | | private Date proEndtime; |
| | | /** |
| | | *创建时间 |
| | | */ |
| | | private Date createTime; |
| | | /** |
| | | * 是否删除,1删除,0未删除 |
| | | */ |
| | | @TableLogic |
| | | private Boolean isDel; |
| | | /** |
| | | * 状态,1启用,0停用 |
| | | */ |
| | | private Boolean enabled; |
| | | } |
| | |
| | | package com.kidgrow.oprationcenter.mapper; |
| | | |
| | | import com.kidgrow.oprationcenter.model.ProductOrderDetail; |
| | | import com.kidgrow.db.mapper.SuperMapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.kidgrow.db.mapper.SuperMapper; |
| | | import com.kidgrow.oprationcenter.model.ProductOrderDetail; |
| | | import com.kidgrow.oprationcenter.vo.GroupProductDetail; |
| | | import com.kidgrow.oprationcenter.vo.ProductOrderJoinDetail; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | |
| | | * @return |
| | | */ |
| | | List<ProductOrderDetail> findList(Page<ProductOrderDetail> page, @Param("p") Map<String, Object> params); |
| | | |
| | | /** |
| | | * 分页查询产品/明显的充值记录列表 |
| | | * @param page |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<ProductOrderJoinDetail> findAllList(Page<ProductOrderJoinDetail> page, @Param("p") Map<String, Object> params); |
| | | /** |
| | | * 根据ProductOrderDetail对象当做查询条件进行查询 |
| | | * @param |
| | | * @return ProductOrderDetail对象 |
| | | */ |
| | | ProductOrderDetail findByObject(@Param("p") ProductOrderDetail productOrderDetail); |
| | | ProductOrderDetail findByObject(@Param("p") ProductOrderDetail productOrderDetail);/** |
| | | * 统计产品使用量 |
| | | * @param |
| | | * @return ProductOrderDetail对象 |
| | | */ |
| | | List<GroupProductDetail> groupProductDetail(Page<GroupProductDetail> page, @Param("p") Map<String, Object> params); |
| | | } |
| | |
| | | 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.service.ISuperService; |
| | | import com.kidgrow.oprationcenter.vo.GroupProductDetail; |
| | | import com.kidgrow.oprationcenter.vo.ProductOrderJoinDetail; |
| | | |
| | | import java.util.Map; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | PageResult<ProductOrderDetail> findList(Map<String, Object> params); |
| | | |
| | | /** |
| | | * 列表 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | PageResult<ProductOrderJoinDetail> findAllList(Map<String, Object> params); |
| | | /** |
| | | * 统计产品使用量列表 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | PageResult<GroupProductDetail> groupList(Map<String, Object> params); |
| | | |
| | | /** |
| | | * 根据ProductOrderDetail对象当做查询条件进行查询 |
| | |
| | | * @return ProductOrderDetail对象 |
| | | */ |
| | | ProductOrderDetail findByObject(ProductOrderDetail productOrderDetail); |
| | | /** |
| | | * 状态变更 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | ResultBody updateEnabled(Map<String, Object> params); |
| | | |
| | | } |
| | | |
| | |
| | | package com.kidgrow.oprationcenter.service.impl; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | import com.kidgrow.common.model.PageResult; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.kidgrow.common.model.PageResult; |
| | | import com.kidgrow.common.model.ResultBody; |
| | | import com.kidgrow.common.service.impl.SuperServiceImpl; |
| | | import com.kidgrow.oprationcenter.mapper.ProductOrderDetailMapper; |
| | | import com.kidgrow.oprationcenter.model.ProductOrderDetail; |
| | | import com.kidgrow.oprationcenter.service.IProductOrderDetailService; |
| | | import com.kidgrow.oprationcenter.vo.GroupProductDetail; |
| | | import com.kidgrow.oprationcenter.vo.ProductOrderJoinDetail; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.MapUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import org.apache.commons.collections4.MapUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import com.kidgrow.oprationcenter.model.ProductOrderDetail; |
| | | import com.kidgrow.oprationcenter.mapper.ProductOrderDetailMapper; |
| | | import com.kidgrow.oprationcenter.service.IProductOrderDetailService; |
| | | |
| | | /** |
| | | * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br> |
| | |
| | | List<ProductOrderDetail> list = baseMapper.findList(page, params); |
| | | return PageResult.<ProductOrderDetail>builder().data(list).code(0).count(page.getTotal()).build(); |
| | | } |
| | | /** |
| | | * 列表 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | @Override |
| | | public PageResult<ProductOrderJoinDetail> findAllList(Map<String, Object> params) { |
| | | Page<ProductOrderJoinDetail> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit")); |
| | | List<ProductOrderJoinDetail> list = baseMapper.findAllList(page,params); |
| | | return PageResult.<ProductOrderJoinDetail>builder().data(list).code(0).count(page.getTotal()).build(); |
| | | } |
| | | |
| | | /** |
| | | * 获取统计数据 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | @Override |
| | | public PageResult<GroupProductDetail> groupList(Map<String, Object> params) { |
| | | Page<GroupProductDetail> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit")); |
| | | List<GroupProductDetail> list = baseMapper.groupProductDetail(page,params); |
| | | return PageResult.<GroupProductDetail>builder().data(list).code(0).count(page.getTotal()).build(); |
| | | } |
| | | |
| | | /** |
| | | * 根据ProductOrderDetail对象当做查询条件进行查询 |
| | |
| | | public ProductOrderDetail findByObject(ProductOrderDetail productOrderDetail){ |
| | | return baseMapper.findByObject(productOrderDetail); |
| | | } |
| | | /** |
| | | * 修改数据状态 启用 禁用 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | @Override |
| | | public ResultBody updateEnabled(Map<String, Object> params) { |
| | | Long id = MapUtils.getLong(params, "id"); |
| | | Boolean enabled = MapUtils.getBoolean(params, "enabled"); |
| | | |
| | | ProductOrderDetail productOrder = baseMapper.selectById(id); |
| | | if (productOrder == null) { |
| | | return ResultBody.failed("该数据不存在!"); |
| | | } |
| | | productOrder.setEnabled(enabled); |
| | | productOrder.setUpdateTime(new Date()); |
| | | int i = baseMapper.updateById(productOrder); |
| | | return i > 0 ? ResultBody.ok().data(productOrder).msg("更新成功") : ResultBody.failed("更新失败"); |
| | | } |
| | | } |
| | |
| | | <include refid="where"/> |
| | | order by id desc |
| | | </select> |
| | | <!--sql查询片段--> |
| | | <sql id="wherelimit"> |
| | | <where> |
| | | <!--查询条件自行添加--> |
| | | DE.is_del=0 |
| | | <if test="p.id != null and p.id !=''"> |
| | | and id = #{p.id} |
| | | </if> |
| | | <if test="p.hospitalName != null and p.hospitalName !=''"> |
| | | and PRO.hospital_name like concat ('%',#{p.hospitalName},'%') |
| | | </if> |
| | | <if test="p.proName != null and p.proName !=''"> |
| | | and DE.pro_name like concat ('%',#{p.proName},'%') |
| | | </if> |
| | | <if test="p.createTime != null and p.createTime !='' and p.updateTime != null and p.updateTime !=''"> |
| | | and (DE.create_time between #{p.createTime} and #{p.updateTime}) |
| | | </if> |
| | | </where> |
| | | </sql> |
| | | <!--查询产品的消费记录--> |
| | | <select id="findAllList" resultType="com.kidgrow.oprationcenter.vo.ProductOrderJoinDetail"> |
| | | SELECT |
| | | DE.id, |
| | | DE.ailight_count, |
| | | DE.order_id, |
| | | DE.pro_name, |
| | | DE.record_count, |
| | | DE.is_share, |
| | | DE.pro_begintime, |
| | | DE.pro_endtime, |
| | | DE.pro_id, |
| | | DE.create_time, |
| | | DE.is_del, |
| | | DE.enabled, |
| | | PRO.hospital_name, |
| | | PRO.department_name |
| | | FROM |
| | | product_order_detail DE |
| | | LEFT JOIN product_order PRO ON DE.order_id = PRO.id |
| | | <include refid="wherelimit"/> |
| | | order by DE.id desc |
| | | </select> |
| | | <select id="groupProductDetail" resultType="com.kidgrow.oprationcenter.vo.GroupProductDetail"> |
| | | select |
| | | COUNT(DE.pro_id) pro_count, |
| | | max(DE.pro_name) pro_name |
| | | from product_order_detail AS DE |
| | | <include refid="wherelimit"/> |
| | | GROUP BY DE.pro_id |
| | | order by pro_count desc |
| | | </select> |
| | | </mapper> |
| | |
| | | boolean v = productOrderService.removeById(id); |
| | | if (v) { |
| | | if (!businessRecordsService.recordBusinessData("删除合同:"+id,id.toString())) { |
| | | log.error(String.format("删除合同编号为:{0}的数据后,写入业务日志失败!",id)); |
| | | //log.error(String.format("删除合同编号为:{0}的数据后,写入业务日志失败!",id)); |
| | | |
| | | } |
| | | return ResultBody.ok().msg("删除成功"); |
| | |
| | | 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"))); |
| | | //log.error(String.format("修改合同状态为:{0},写入业务日志失败!合同管理id为:{1}",enablad,MapUtils.getString(params,"id"))); |
| | | } |
| | | } |
| | | return resultBody; |
| | |
| | | import com.kidgrow.common.model.PageResult; |
| | | import com.kidgrow.common.model.ResultBody; |
| | | import com.kidgrow.oprationcenter.model.ProductOrderDetail; |
| | | import com.kidgrow.oprationcenter.service.IBusinessRecordsService; |
| | | import com.kidgrow.oprationcenter.service.IProductOrderDetailService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections.MapUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.validation.ObjectError; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.validation.Valid; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | |
| | | public class ProductOrderDetailController extends BaseController{ |
| | | @Autowired |
| | | private IProductOrderDetailService productOrderDetailService; |
| | | @Autowired |
| | | private IBusinessRecordsService businessRecordsService; |
| | | |
| | | /** |
| | | * 列表 |
| | |
| | | params.put("limit",10); |
| | | } |
| | | return productOrderDetailService.findList(params); |
| | | } |
| | | |
| | | /** |
| | | * 列表 |
| | | */ |
| | | @ApiOperation(value = "查询列表") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "page", value = "分页起始位置", required = true, dataType = "Integer"), |
| | | @ApiImplicitParam(name = "limit", value = "分页结束位置", required = true, dataType = "Integer") |
| | | }) |
| | | @GetMapping("/all") |
| | | public PageResult findAllList(@RequestParam Map<String, Object> params) { |
| | | if(params.size()==0){ |
| | | params.put("page",1); |
| | | params.put("limit",10); |
| | | } |
| | | return productOrderDetailService.findAllList(params); |
| | | } |
| | | |
| | | /** |
| | | * 列表 |
| | | */ |
| | | @ApiOperation(value = "查询列表") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "page", value = "分页起始位置", required = true, dataType = "Integer"), |
| | | @ApiImplicitParam(name = "limit", value = "分页结束位置", required = true, dataType = "Integer") |
| | | }) |
| | | @GetMapping("/group") |
| | | public PageResult groupList(@RequestParam Map<String, Object> params) { |
| | | if(params.size()==0){ |
| | | params.put("page",1); |
| | | params.put("limit",10); |
| | | } |
| | | return productOrderDetailService.groupList(params); |
| | | } |
| | | |
| | | /** |
| | |
| | | public ResultBody delete(@PathVariable Long id) { |
| | | 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 { |
| | | return ResultBody.failed().msg("删除失败"); |
| | | } |
| | | } |
| | | /** |
| | | * 修改状态 |
| | | * |
| | | * @param params |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "修改数据状态") |
| | | @GetMapping("/updateEnabled") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Integer"), |
| | | @ApiImplicitParam(name = "enabled", value = "是否启用", required = true, dataType = "Boolean") |
| | | }) |
| | | public ResultBody updateEnabled(@RequestParam Map<String, Object> params, HttpServletRequest request) { |
| | | if (params.size() == 0) { |
| | | return ResultBody.failed().msg("参数异常!"); |
| | | } |
| | | ResultBody resultBody=productOrderDetailService.updateEnabled(params); |
| | | //记录业务日志 |
| | | 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"))); |
| | | } |
| | | } |
| | | return resultBody; |
| | | } |
| | | } |
| | |
| | | { field: 'proEndtime', width: 180, title: '结束时间',templet:function(d){ |
| | | return new Date(d.proEndtime).dateFormat("yyyy/MM/dd hh:mm:ss"); |
| | | } }, |
| | | { field: 'createTime', width: 160, sort: true, title: '创建时间' }, |
| | | { field: 'createTime', width: 160, sort: true, title: '创建时间' } |
| | | ]] |
| | | }); |
| | | } |
New file |
| | |
| | | <div class="layui-card"> |
| | | <div class="layui-card-header"> |
| | | <h2 class="header-title">产品消费统计</h2> |
| | | <span class="layui-breadcrumb pull-right"> |
| | | <a href="#!console">首页</a> |
| | | <a><cite>产品消费统计</cite></a> |
| | | </span> |
| | | </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" |
| | | class="layui-input search-input"> |
| | | 至 |
| | | <input type="text" name="date" id="dateend" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" |
| | | class="layui-input search-input">   |
| | | <button id="product-btn-search" class="layui-btn icon-btn"><i class="layui-icon"></i>搜索</button> |
| | | </div> |
| | | <table class="layui-table" id="product-table" lay-filter="product-table"></table> |
| | | </div> |
| | | </div> |
| | | <!-- 表格操作列 --> |
| | | <script type="text/html" id="product-table-bar"> |
| | | <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a> |
| | | </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="未处理|已处理" |
| | | {{d.enabled==true?'checked':''}}/> |
| | | </script> |
| | | |
| | | <script> |
| | | layui.use(['table', 'config','laydate'], function () { |
| | | let table = layui.table; |
| | | let laydate = layui.laydate; |
| | | let config = layui.config; |
| | | //日期 |
| | | laydate.render({ |
| | | elem: '#datebegin' |
| | | }); |
| | | laydate.render({ |
| | | elem: '#dateend' |
| | | }); |
| | | // 渲染表格 |
| | | var renderTable = function () { |
| | | table.render({ |
| | | elem: '#product-table', |
| | | url: config.base_server + 'api-opration/productorderdetail/group', |
| | | method: 'GET', |
| | | headers: { 'Authorization': 'Bearer ' + config.getToken().access_token }, |
| | | page: true, |
| | | cols: [[ |
| | | { field: 'proName', width: 500, sort: true,title: '产品名称' }, |
| | | { field: 'proCount', width: 300, sort: true,title: '消费数量' } |
| | | ]] |
| | | }); |
| | | } |
| | | renderTable(); |
| | | |
| | | // 搜索按钮点击事件 |
| | | $('#product-btn-search').click(function () { |
| | | var createTime = $('#datebegin').val(); |
| | | var updateTime = $('#dateend').val(); |
| | | if (strUtil.isEmpty(datebegin) && !strUtil.isEmpty(updateTime)) { |
| | | createTime = dateUtil.getNowDate(); |
| | | $('#datebegin').val(createTime); |
| | | } |
| | | if (!strUtil.isEmpty(createTime) && strUtil.isEmpty(updateTime)) { |
| | | updateTime = dateUtil.getNowDate(); |
| | | $('#dateend').val(updateTime); |
| | | } |
| | | table.reload('product-table', { where: { createTime: createTime,updateTime: updateTime } }); |
| | | }); |
| | | }); |
| | | </script> |
New file |
| | |
| | | <div class="layui-card"> |
| | | <div class="layui-card-header"> |
| | | <h2 class="header-title">产品消费记录</h2> |
| | | <span class="layui-breadcrumb pull-right"> |
| | | <a href="#!console">首页</a> |
| | | <a><cite>产品消费记录</cite></a> |
| | | </span> |
| | | </div> |
| | | <div class="layui-card-body"> |
| | | <div class="layui-form toolbar">  |
| | | <input id="product-search-value" class="layui-input search-input" type="text" placeholder="按产品名" />  |
| | | <input id="hospital-search-value" class="layui-input search-input" type="text" placeholder="按医院名" />  |
| | | <button id="product-btn-search" class="layui-btn icon-btn"><i class="layui-icon"></i>搜索</button> |
| | | </div> |
| | | <table class="layui-table" id="product-table" lay-filter="product-table"></table> |
| | | </div> |
| | | </div> |
| | | <!-- 表格操作列 --> |
| | | <script type="text/html" id="product-table-bar"> |
| | | <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a> |
| | | </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="未处理|已处理" |
| | | {{d.enabled==true?'checked':''}}/> |
| | | </script> |
| | | |
| | | <script> |
| | | layui.use(['table', 'util', 'admin', 'config', 'form'], function () { |
| | | let table = layui.table; |
| | | let util = layui.util; |
| | | let admin = layui.admin; |
| | | let form = layui.form; |
| | | let config = layui.config; |
| | | |
| | | // 渲染表格 |
| | | var renderTable = function () { |
| | | table.render({ |
| | | elem: '#product-table', |
| | | url: config.base_server + 'api-opration/productorderdetail/all', |
| | | method: 'GET', |
| | | headers: { 'Authorization': 'Bearer ' + config.getToken().access_token }, |
| | | page: true, |
| | | cols: [[ |
| | | { field: 'hospitalName', width: 300, title: '医院名称' }, |
| | | { field: 'departmentName', width: 100, title: '科室名称' }, |
| | | { field: 'proName', width: 200, title: '产品名称' }, |
| | | { field: 'ailightCount', width: 150, title: '读片量' }, |
| | | { field: 'recordCount', width: 100, title: '报告量' }, |
| | | { field: 'isShare', width: 150, title: '是否共享',templet:function(d) |
| | | { |
| | | if(d.isShare) |
| | | return '共享' |
| | | else |
| | | return '私有' |
| | | } |
| | | }, |
| | | { field: 'proBegintime', width: 120, title: '开始时间',templet:function(d){ |
| | | return new Date(d.proBegintime).dateFormat("yyyy/MM/dd"); |
| | | } }, |
| | | { field: 'proEndtime', width: 120, title: '结束时间',templet:function(d){ |
| | | return new Date(d.proEndtime).dateFormat("yyyy/MM/dd"); |
| | | } }, |
| | | { 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: '状态' }, |
| | | { align: 'center', width: 100, toolbar: '#product-table-bar', title: '操作' } |
| | | ]] |
| | | }); |
| | | } |
| | | renderTable(); |
| | | |
| | | // 修改状态 |
| | | form.on('switch(product-tpl-state)', function (obj) { |
| | | layer.load(2); |
| | | admin.req('api-opration/productorderdetail/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(product-table)', function (obj) { |
| | | if (obj.event === 'del') { // 删除 |
| | | layer.confirm('确定要删除吗?', function (i) { |
| | | layer.close(i); |
| | | layer.load(2); |
| | | admin.req('api-opration/productorderdetail/' + obj.data.id, {}, function (data) { |
| | | layer.closeAll('loading'); |
| | | layer.msg(data.msg, { icon: 1, time: 500 }, function () { |
| | | |
| | | renderTable(); |
| | | }); |
| | | obj.del(); |
| | | }, 'DELETE'); |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | // 搜索按钮点击事件 |
| | | $('#product-btn-search').click(function () { |
| | | var proName = $('#product-search-value').val(); |
| | | var hospitalName = $('#hospital-search-value').val(); |
| | | table.reload('product-table', { where: { proName: proName,hospitalName: hospitalName } }); |
| | | }); |
| | | }); |
| | | </script> |