1.增加产品管理模块功能
2.统一调整了运营管理中的实体部分,给isdel字段增加逻辑删除标记
17 files modified
2 files added
| | |
| | | package com.kidgrow.oprationcenter.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.kidgrow.common.model.SuperModel; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | /** |
| | | * 是否删除,1删除,0未删除 |
| | | */ |
| | | @TableLogic |
| | | private Boolean isDel; |
| | | /** |
| | | * 状态,1启用,0停用 |
| | |
| | | package com.kidgrow.oprationcenter.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.kidgrow.common.model.SuperModel; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | /** |
| | | * 是否删除,1删除,0未删除 |
| | | */ |
| | | @TableLogic |
| | | @NotEmpty(message = "是否删除,1删除,0未删除不能为空") |
| | | private Boolean isDel; |
| | | /** |
| | |
| | | package com.kidgrow.oprationcenter.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.kidgrow.common.model.SuperModel; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | /** |
| | | * 是否删除,1删除(已下载),0未删除(未下载) |
| | | */ |
| | | @TableLogic |
| | | private Boolean isDel; |
| | | /** |
| | | * 文件路径 |
| | |
| | | package com.kidgrow.oprationcenter.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.kidgrow.common.model.SuperModel; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | /** |
| | | * 是否删除,1删除,0未删除 |
| | | */ |
| | | @TableLogic |
| | | @NotEmpty(message = "是否删除,1删除,0未删除不能为空") |
| | | private Boolean isDel; |
| | | /** |
| | |
| | | package com.kidgrow.oprationcenter.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.kidgrow.common.model.SuperModel; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.NoArgsConstructor; |
| | | import org.hibernate.validator.constraints.NotBlank; |
| | | import org.hibernate.validator.constraints.NotEmpty; |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 是否删除,1删除,0未删除 |
| | | */ |
| | | @TableLogic |
| | | @NotEmpty(message = "是否删除,1删除,0未删除不能为空") |
| | | private Boolean isDel; |
| | | /** |
| | |
| | | package com.kidgrow.oprationcenter.model; |
| | | |
| | | import com.kidgrow.common.model.SuperModel; |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import com.kidgrow.common.model.SuperModel; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.NoArgsConstructor; |
| | | import org.hibernate.validator.constraints.*; |
| | | |
| | | import java.util.Date; |
| | | import org.hibernate.validator.constraints.NotEmpty; |
| | | |
| | | /** |
| | | * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br> |
| | |
| | | /** |
| | | * 是否删除,1删除,0未删除 |
| | | */ |
| | | @TableLogic |
| | | @NotEmpty(message = "是否删除,1删除,0未删除不能为空") |
| | | private Boolean isDel; |
| | | /** |
| | |
| | | package com.kidgrow.oprationcenter.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.kidgrow.common.model.SuperModel; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | /** |
| | | * 是否删除,1删除,0未删除 |
| | | */ |
| | | @TableLogic |
| | | @NotEmpty(message = "是否删除,1删除,0未删除不能为空") |
| | | private Boolean isDel; |
| | | /** |
| | |
| | | package com.kidgrow.oprationcenter.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.kidgrow.common.model.SuperModel; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.NoArgsConstructor; |
| | | import org.hibernate.validator.constraints.NotBlank; |
| | | import org.hibernate.validator.constraints.NotEmpty; |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 是否删除,1删除,0未删除 |
| | | */ |
| | | @TableLogic |
| | | @NotEmpty(message = "是否删除,1删除,0未删除不能为空") |
| | | private Boolean isDel; |
| | | /** |
| | |
| | | package com.kidgrow.oprationcenter.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.kidgrow.common.model.SuperModel; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | /** |
| | | * 是否删除,1删除,0未删除 |
| | | */ |
| | | @TableLogic |
| | | @NotEmpty(message = "是否删除,1删除,0未删除不能为空") |
| | | private Boolean isDel; |
| | | /** |
| | |
| | | package com.kidgrow.oprationcenter.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.kidgrow.common.model.SuperModel; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | /** |
| | | * 是否删除,1删除,0未删除 |
| | | */ |
| | | @TableLogic |
| | | @NotEmpty(message = "是否删除,1删除,0未删除不能为空") |
| | | private Boolean isDel; |
| | | /** |
| | |
| | | package com.kidgrow.oprationcenter.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.kidgrow.common.model.SuperModel; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | import lombok.NoArgsConstructor; |
| | | import org.hibernate.validator.constraints.NotEmpty; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 时长(天) |
| | | */ |
| | | @NotEmpty(message = "时长(天)不能为空") |
| | | @NotNull(message = "时长不能为空") |
| | | private Integer proTime; |
| | | /** |
| | | * 时长单位 |
| | | */ |
| | | @NotNull(message = "时长单位不能为空") |
| | | private Integer proTimeUnit; |
| | | /** |
| | | * 产品类型 0试用 1正式 |
| | | */ |
| | | @NotEmpty(message = "产品类型 0试用 1正式不能为空") |
| | | @NotNull(message = "产品类型 0试用 1正式不能为空") |
| | | private Integer proType; |
| | | /** |
| | | * 建议售价 |
| | | */ |
| | | @NotEmpty(message = "建议售价不能为空") |
| | | @NotNull(message = "建议售价不能为空") |
| | | private BigDecimal proPrice; |
| | | /** |
| | | * 报告量 |
| | | */ |
| | | @NotEmpty(message = "报告量不能为空") |
| | | @NotNull(message = "报告量不能为空") |
| | | private Integer recordCount; |
| | | /** |
| | | * 读片量 |
| | | */ |
| | | @NotEmpty(message = "读片量不能为空") |
| | | @NotNull(message = "读片量不能为空") |
| | | private Integer ailightCount; |
| | | /** |
| | | * 是否删除,1删除,0未删除 |
| | | */ |
| | | @TableLogic |
| | | private Boolean isDel; |
| | | /** |
| | | * 状态,1启用,0停用 |
| | |
| | | package com.kidgrow.oprationcenter.service; |
| | | |
| | | import com.kidgrow.common.model.ResultBody; |
| | | import com.kidgrow.oprationcenter.model.SysProduct; |
| | | import com.kidgrow.common.model.PageResult; |
| | | import com.kidgrow.common.service.ISuperService; |
| | |
| | | * @return SysProduct对象 |
| | | */ |
| | | SysProduct findByObject(SysProduct sysProduct); |
| | | /** |
| | | * 状态变更 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | ResultBody updateEnabled(Map<String, Object> params); |
| | | } |
| | | |
| | |
| | | } |
| | | feedback.setEnabled(enabled); |
| | | feedback.setUpdateTime(new Date()); |
| | | // feedback.setUpdateUserId(); |
| | | // feedback.setUpdateUserName(); |
| | | int i = baseMapper.updateById(feedback); |
| | | return i > 0 ? ResultBody.ok().data(feedback).msg("更新成功") : ResultBody.failed("更新失败"); |
| | | } |
| | |
| | | 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.SysProductMapper; |
| | | import com.kidgrow.oprationcenter.model.SysProduct; |
| | | import com.kidgrow.oprationcenter.service.ISysProductService; |
| | | 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.SysProduct; |
| | | import com.kidgrow.oprationcenter.mapper.SysProductMapper; |
| | | import com.kidgrow.oprationcenter.service.ISysProductService; |
| | | |
| | | /** |
| | | * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br> |
| | |
| | | public SysProduct findByObject(SysProduct sysProduct){ |
| | | return baseMapper.findByObject(sysProduct); |
| | | } |
| | | |
| | | /** |
| | | * 根据id和启用禁用值更新数据 |
| | | * @param params |
| | | * @return ResultBody |
| | | */ |
| | | @Override |
| | | public ResultBody updateEnabled(Map<String, Object> params) { |
| | | Long id = MapUtils.getLong(params, "id"); |
| | | Boolean enabled = MapUtils.getBoolean(params, "enabled"); |
| | | |
| | | SysProduct sysProduct = baseMapper.selectById(id); |
| | | if (sysProduct == null) { |
| | | return ResultBody.failed("该数据不存在!"); |
| | | } |
| | | sysProduct.setEnabled(enabled); |
| | | sysProduct.setUpdateTime(new Date()); |
| | | int i = baseMapper.updateById(sysProduct); |
| | | return i > 0 ? ResultBody.ok().data(sysProduct).msg("更新成功") : ResultBody.failed("更新失败"); |
| | | } |
| | | } |
| | |
| | | and id = #{p.id} |
| | | </if> |
| | | <if test="p.proName != null and p.proName !=''"> |
| | | and pro_name = #{p.proName} |
| | | and pro_name like concat('%', #{p.proName}, '%') |
| | | </if> |
| | | <if test="p.proTime != null and p.proTime !=''"> |
| | | and pro_time = #{p.proTime} |
| | |
| | | import com.kidgrow.common.controller.BaseController; |
| | | import com.kidgrow.common.model.PageResult; |
| | | import com.kidgrow.common.model.ResultBody; |
| | | import com.kidgrow.oprationcenter.model.ProductOrderDetail; |
| | | import com.kidgrow.oprationcenter.model.SysProduct; |
| | | import com.kidgrow.oprationcenter.service.IProductOrderDetailService; |
| | | import com.kidgrow.oprationcenter.service.ISysProductService; |
| | | 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.collections4.MapUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.validation.ObjectError; |
| | |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/sysproduct") |
| | | @RequestMapping("/product") |
| | | @Api(tags = "") |
| | | public class SysProductController extends BaseController{ |
| | | @Autowired |
| | | private ISysProductService sysProductService; |
| | | @Autowired |
| | | private IProductOrderDetailService productOrderDetailService; |
| | | |
| | | /** |
| | | * 列表 |
| | |
| | | @ApiImplicitParam(name = "limit", value = "分页结束位置", required = true, dataType = "Integer") |
| | | }) |
| | | @GetMapping |
| | | public ResultBody<PageResult> list(@RequestParam Map<String, Object> params) { |
| | | public PageResult list(@RequestParam Map<String, Object> params) { |
| | | if(params.size()==0){ |
| | | params.put("page",1); |
| | | params.put("limit",10); |
| | | } |
| | | return ResultBody.ok().data(sysProductService.findList(params)); |
| | | return sysProductService.findList(params); |
| | | } |
| | | |
| | | /** |
| | |
| | | @ApiOperation(value = "删除") |
| | | @DeleteMapping("/{id}") |
| | | public ResultBody delete(@PathVariable Long id) { |
| | | if (!ProIsUseed(id)) { |
| | | return ResultBody.failed().msg("该产品已经被使用,无法删除!"); |
| | | } |
| | | else { |
| | | boolean v= sysProductService.removeById(id); |
| | | if(v) { |
| | | return ResultBody.ok().msg("删除成功"); |
| | | } else { |
| | | return ResultBody.failed().msg("删除失败"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 判断该产品id下有没有已经使用的订单明细 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | private boolean ProIsUseed(Long id) |
| | | { |
| | | ProductOrderDetail productOrderDetail=new ProductOrderDetail(); |
| | | productOrderDetail.setProId(id); |
| | | productOrderDetail=productOrderDetailService.findByObject(productOrderDetail); |
| | | return (productOrderDetail==null); |
| | | } |
| | | /** |
| | | * 修改状态 |
| | | * |
| | | * @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) { |
| | | if (params.size()==0) |
| | | { |
| | | return ResultBody.failed().msg("参数异常!"); |
| | | } |
| | | else if (!ProIsUseed(Long.valueOf(MapUtils.getInteger(params, "id")))) { |
| | | return ResultBody.failed().msg("该产品已经被使用,无法删除!"); |
| | | } |
| | | else { |
| | | return ResultBody.failed().msg("删除失败"); |
| | | return sysProductService.updateEnabled(params); |
| | | } |
| | | } |
| | | } |
| | |
| | | <div class="layui-card-body"> |
| | | <div class="layui-form toolbar">  |
| | | <input id="user-search-value" class="layui-input search-input" type="text" placeholder="输入医生姓名"/>  |
| | | <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="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">   |
| | | <input type="text" name="date" id="dateend" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" |
| | | class="layui-input search-input">   |
| | | <button id="user-btn-search" class="layui-btn icon-btn"><i class="layui-icon"></i>搜索</button> |
| | | </div> |
| | | |
| | |
| | | ]] |
| | | }); |
| | | |
| | | // 修改menu状态 |
| | | // 修改状态 |
| | | form.on('switch(feedback-tpl-state)', function (obj) { |
| | | layer.load(2); |
| | | admin.req('api-opration/sysfeedback/updateEnabled', { |
| | |
| | | }, 'DELETE'); |
| | | }); |
| | | } |
| | | else if(obj.event=='detail') |
| | | { |
| | | else if (obj.event == 'detail') { |
| | | $.ajax({ |
| | | type: "GET", |
| | | url: config.base_server +"api-opration/sysfeedback/"+obj.data.id, |
| | | success: function(data) { |
| | | if(data!=null) |
| | | { |
| | | if (data != null) { |
| | | layer.open({ |
| | | type: 1, |
| | | title: '详情', |
| | | area: ['500px','300px'], |
| | | offset: 'auto', |
| | | content: $("#feedback-detail").html(), |
| | | success:function(obj) |
| | | { |
| | | success: function (obj) { |
| | | $("#feedback-detail-note").html(data.data.feedbackNote); |
| | | } |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | else { |
| | | layer.msg('未找到相关数据', {icon: 1, time: 500}); |
| | | } |
| | | }, |
| | |
| | | var doctorName = $('#user-search-value').val(); |
| | | var datebegin=$('#datebegin').val(); |
| | | var dateend=$('#dateend').val(); |
| | | if(strUtil.isEmpty(datebegin)&&!strUtil.isEmpty(dateend)) |
| | | { |
| | | if (strUtil.isEmpty(datebegin) && !strUtil.isEmpty(dateend)) { |
| | | datebegin=dateUtil.getNowDate(); |
| | | $('#datebegin').val(datebegin); |
| | | } |
| | | if(!strUtil.isEmpty(datebegin)&&strUtil.isEmpty(dateend)) |
| | | { |
| | | if (!strUtil.isEmpty(datebegin) && strUtil.isEmpty(dateend)) { |
| | | dateend=dateUtil.getNowDate(); |
| | | $('#dateend').val(dateend); |
| | | } |
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="输入产品名" />  |
| | | <button id="product-btn-search" class="layui-btn icon-btn"><i class="layui-icon"></i>搜索</button> |
| | | <button id="product-btn-add" 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 type="text/html" id="feedback-detail"> |
| | | |
| | | </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 laydate = layui.laydate; |
| | | let config = layui.config; |
| | | |
| | | // 渲染表格 |
| | | var renderTable = function () { |
| | | layer.load(2); |
| | | table.render({ |
| | | elem: '#product-table', |
| | | url: config.base_server + 'api-opration/product', |
| | | method: 'GET', |
| | | headers: { 'Authorization': 'Bearer ' + config.getToken().access_token }, |
| | | page: true, |
| | | cols: [[ |
| | | { field: 'proName', width: 300, title: '产品名称' }, |
| | | { |
| | | field: 'proTime', width: 150, title: '有效时长', 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: 'proPrice', width: 100, title: '价格' }, |
| | | { field: 'recordCount', width: 180, title: '报告数' }, |
| | | { field: 'ailightCount', width: 180, title: '读片量' }, |
| | | { field: 'enabled', width: 150, templet: '#product-tpl-state', sort: true, title: '状态' }, |
| | | { field: 'createTime', width: 200, sort: true, title: '创建时间' }, |
| | | { align: 'center', width: 100, toolbar: '#product-table-bar', title: '操作' } |
| | | ]], |
| | | done: function () { |
| | | layer.closeAll('loading'); |
| | | } |
| | | }); |
| | | } |
| | | renderTable(); |
| | | |
| | | // 修改状态 |
| | | form.on('switch(product-tpl-state)', function (obj) { |
| | | layer.load(2); |
| | | admin.req('api-opration/product/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/product/' + 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(); |
| | | table.reload('product-table', { where: { proName: proName } }); |
| | | }); |
| | | // 添加按钮点击事件 |
| | | $('#product-btn-add').click(function () { |
| | | admin.popupCenter({ |
| | | title: '添加产品', |
| | | path: 'pages/opration/product_form.html', |
| | | finish: function () { |
| | | renderTable(); |
| | | } |
| | | }) |
| | | }); |
| | | }); |
| | | </script> |
New file |
| | |
| | | <form id="product-form" lay-filter="product-form" class="layui-form model-form" method="POST"> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">产品类型</label> |
| | | <div class="layui-input-block"> |
| | | <input type="radio" name="proType" value="1" title="正式" checked /> |
| | | <input type="radio" name="proType" value="0" title="试用" /> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">产品名称</label> |
| | | <div class="layui-input-block"> |
| | | <input name="proName" placeholder="请输入产品名称" type="text" class="layui-input" maxlength="50" |
| | | lay-verify="required" required /> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">有效时长</label> |
| | | <div class="layui-input-block"> |
| | | <input name="proTime" type="text" class="layui-input" maxlength="4" lay-verify="required|number" required /> |
| | | <select name="proTimeUnit" id="proTimeUnit"> |
| | | <option value="0">天</option> |
| | | <option value="1">月</option> |
| | | <option value="2">年</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">价格</label> |
| | | <div class="layui-input-block"> |
| | | <input name="proPrice" type="text" class="layui-input" maxlength="8" lay-verify="required|number" required /> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">报告量</label> |
| | | <div class="layui-input-block"> |
| | | <input name="recordCount" type="text" class="layui-input" maxlength="6" lay-verify="required|number" |
| | | required /> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">读片量</label> |
| | | <div class="layui-input-block"> |
| | | <input name="ailightCount" type="text" class="layui-input" maxlength="6" lay-verify="required|number" |
| | | required /> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item model-form-footer"> |
| | | <button class="layui-btn layui-btn-primary" ew-event="closeDialog" type="button">取消</button> |
| | | <button class="layui-btn" lay-filter="product-form-submit" lay-submit>保存</button> |
| | | </div> |
| | | </form> |
| | | |
| | | <script> |
| | | layui.use(['form', 'table', 'util', 'config', 'admin', 'formSelects'], 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 formSelects = layui.formSelects; |
| | | var clientsAll = null; |
| | | // 获取应用列表 |
| | | layer.load(2); |
| | | admin.req('api-uaa/clients/all', {}, function (data) { |
| | | layer.closeAll('loading'); |
| | | if (0 === data.code) { |
| | | let selected = false; |
| | | clientsAll = data.data; |
| | | $.each(data.data, function (index, item) { |
| | | if (config.clientId === item.clientId) { |
| | | selected = true; |
| | | } else { |
| | | selected = false; |
| | | } |
| | | //往下拉菜单里添加元素 |
| | | $('#tenantId').append(new Option(item.clientName, item.clientId, false, selected)); |
| | | }) |
| | | form.render(); |
| | | } else { |
| | | layer.msg(data.msg, { icon: 2, time: 500 }); |
| | | } |
| | | }, 'GET'); |
| | | // 表单提交事件 |
| | | form.on('submit(product-form-submit)', function (data) { |
| | | layer.load(2); |
| | | admin.req('api-opration/product', JSON.stringify(data.field), function (data) { |
| | | if (data.code === 0) { |
| | | layer.closeAll('loading'); |
| | | layer.msg(data.msg, { icon: 1, time: 500 }); |
| | | admin.finishPopupCenter(); |
| | | } else { |
| | | layer.closeAll('loading'); |
| | | layer.msg(data.msg, { icon: 2, time: 500 }); |
| | | } |
| | | }, $('#product-form').attr('method')); |
| | | return false; |
| | | }); |
| | | |
| | | }); |
| | | </script> |