From 30332e7ecfa65f8c419271aeb79641d432c872d7 Mon Sep 17 00:00:00 2001 From: pang.jiabao <pang_jiabao@163.com> Date: 星期三, 18 十二月 2024 14:39:45 +0800 Subject: [PATCH] 库区规则表 --- src/main/webapp/views/locRule/locRule.html | 188 +++++++++++ src/main/java/com/zy/asrs/service/impl/LocRuleServiceImpl.java | 50 ++ src/main/webapp/static/js/locRule/locRule.js | 275 ++++++++++++++++ src/main/java/com/zy/asrs/controller/LocRuleController.java | 152 ++++++++ src/main/java/com/zy/asrs/mapper/LocRuleMapper.java | 12 src/main/java/com/zy/asrs/service/LocRuleService.java | 10 src/main/java/com/zy/asrs/entity/LocRule.java | 252 ++++++++++++++ src/main/resources/mapper/LocRuleMapper.xml | 30 + 8 files changed, 969 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/LocRuleController.java b/src/main/java/com/zy/asrs/controller/LocRuleController.java new file mode 100644 index 0000000..a8eabe5 --- /dev/null +++ b/src/main/java/com/zy/asrs/controller/LocRuleController.java @@ -0,0 +1,152 @@ +package com.zy.asrs.controller; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.plugins.Page; +import com.core.annotations.ManagerAuth; +import com.core.common.BaseRes; +import com.core.common.Cools; +import com.core.common.DateUtils; +import com.core.common.R; +import com.zy.asrs.entity.LocRule; +import com.zy.asrs.service.LocRuleService; +import com.zy.common.web.BaseController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.*; + +@RestController +public class LocRuleController extends BaseController { + + @Autowired + private LocRuleService locRuleService; + + @RequestMapping(value = "/locRule/{id}/auth") + @ManagerAuth + public R get(@PathVariable("id") String id) { + return R.ok(locRuleService.selectById(String.valueOf(id))); + } + + @RequestMapping(value = "/locRule/list/auth") + @ManagerAuth + public R list(@RequestParam(defaultValue = "1") Integer curr, + @RequestParam(defaultValue = "10") Integer limit, + @RequestParam(required = false) String orderByField, + @RequestParam(required = false) String orderByType, + @RequestParam(required = false) String condition, + @RequestParam Map<String, Object> param) { + EntityWrapper<LocRule> wrapper = new EntityWrapper<>(); + excludeTrash(param); + convert(param, wrapper); + allLike(LocRule.class, param.keySet(), wrapper, condition); + if (!Cools.isEmpty(orderByField)) { + wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); + } + return R.ok(locRuleService.selectPage(new Page<>(curr, limit), wrapper)); + } + + private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { + for (Map.Entry<String, Object> entry : map.entrySet()) { + String val = String.valueOf(entry.getValue()); + if (val.contains(RANGE_TIME_LINK)) { + String[] dates = val.split(RANGE_TIME_LINK); + wrapper.ge(entry.getKey(), DateUtils.convert(dates[0])); + wrapper.le(entry.getKey(), DateUtils.convert(dates[1])); + } else { + wrapper.like(entry.getKey(), val); + } + } + } + + @RequestMapping(value = "/locRule/add/auth") + @ManagerAuth + public R add(LocRule locRule) { + if ((locRule.getRowEnd() < locRule.getRowBeg()) || locRule.getRowBeg() <= 0 || locRule.getRowEnd() <= 0) { + return R.error("鎺掑尯闂撮敊璇�"); + } + if ((locRule.getBayEnd() < locRule.getBayBeg()) || locRule.getBayBeg() <= 0 || locRule.getBayEnd() <= 0) { + return R.error("鍒楀尯闂撮敊璇�"); + } + if ((locRule.getLevEnd() < locRule.getLevBeg()) || locRule.getLevBeg() <= 0 || locRule.getLevEnd() <= 0) { + return R.error("灞傚尯闂撮敊璇�"); + } + Date now = new Date(); + locRule.setStatus(1); + locRule.setCreateBy(getUserId()); + locRule.setCreateTime(now); + locRule.setUpdateBy(getUserId()); + locRule.setUpdateTime(now); + locRuleService.insert(locRule); + return R.ok(); + } + + @RequestMapping(value = "/locRule/update/auth") + @ManagerAuth + public R update(LocRule locRule) { + if (Cools.isEmpty(locRule) || null == locRule.getId()) { + return R.error(); + } + if ((locRule.getRowEnd() < locRule.getRowBeg()) || locRule.getRowBeg() <= 0 || locRule.getRowEnd() <= 0) { + return R.error("鎺掑尯闂撮敊璇�"); + } + if ((locRule.getBayEnd() < locRule.getBayBeg()) || locRule.getBayBeg() <= 0 || locRule.getBayEnd() <= 0) { + return R.error("鍒楀尯闂撮敊璇�"); + } + if ((locRule.getLevEnd() < locRule.getLevBeg()) || locRule.getLevBeg() <= 0 || locRule.getLevEnd() <= 0) { + return R.error("灞傚尯闂撮敊璇�"); + } + locRule.setUpdateBy(getUserId()); + locRule.setUpdateTime(new Date()); + locRuleService.updateById(locRule); + return R.ok(); + } + + @RequestMapping(value = "/locRule/delete/auth") + @ManagerAuth + public R delete(@RequestParam(value = "ids[]") Long[] ids) { + for (Long id : ids) { + locRuleService.deleteById(id); + } + return R.ok(); + } + + @RequestMapping(value = "/locRule/export/auth") + @ManagerAuth + public R export(@RequestBody JSONObject param) { + EntityWrapper<LocRule> wrapper = new EntityWrapper<>(); + List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); + Map<String, Object> map = excludeTrash(param.getJSONObject("locRule")); + convert(map, wrapper); + List<LocRule> list = locRuleService.selectList(wrapper); + return R.ok(exportSupport(list, fields)); + } + + @RequestMapping(value = "/locRuleQuery/auth") + @ManagerAuth + public R query(String condition) { + EntityWrapper<LocRule> wrapper = new EntityWrapper<>(); + wrapper.like("id", condition); + Page<LocRule> page = locRuleService.selectPage(new Page<>(0, 10), wrapper); + List<Map<String, Object>> result = new ArrayList<>(); + for (LocRule locRule : page.getRecords()) { + Map<String, Object> map = new HashMap<>(); + map.put("id", locRule.getId()); + map.put("value", locRule.getId()); + result.add(map); + } + return R.ok(result); + } + + @RequestMapping(value = "/locRule/check/column/auth") + @ManagerAuth + public R query(@RequestBody JSONObject param) { + Wrapper<LocRule> wrapper = new EntityWrapper<LocRule>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); + if (null != locRuleService.selectOne(wrapper)) { + return R.parse(BaseRes.REPEAT).add(getComment(LocRule.class, String.valueOf(param.get("key")))); + } + return R.ok(); + } + +} diff --git a/src/main/java/com/zy/asrs/entity/LocRule.java b/src/main/java/com/zy/asrs/entity/LocRule.java new file mode 100644 index 0000000..1d26fe3 --- /dev/null +++ b/src/main/java/com/zy/asrs/entity/LocRule.java @@ -0,0 +1,252 @@ +package com.zy.asrs.entity; + +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; +import com.core.common.Cools; +import com.core.common.SpringUtils; +import com.zy.system.entity.User; +import com.zy.system.service.UserService; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.text.SimpleDateFormat; +import java.util.Date; + +@Data +@TableName("asr_loc_rule") +public class LocRule implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 鍟嗗搧缂栧彿 + */ + @ApiModelProperty(value = "鍟嗗搧缂栧彿") + private String matnr; + + /** + * 瑙勬牸 + */ + @ApiModelProperty(value = "瑙勬牸") + private String specs; + + /** + * 鍨嬪彿 + */ + @ApiModelProperty(value = "鍨嬪彿") + private String model; + + /** + * 瀹㈡埛 + */ + @ApiModelProperty(value = "瀹㈡埛") + private String cstmr; + + /** + * 鎵瑰彿 + */ + @ApiModelProperty(value = "鎵瑰彿") + private String batch; + + /** + * 鍏朵粬 + */ + @ApiModelProperty(value = "鍏朵粬") + private String other; + + /** + * 寮�濮嬫帓 + */ + @ApiModelProperty(value = "寮�濮嬫帓") + @TableField("row_beg") + private Integer rowBeg; + + /** + * 缁撴潫鎺� + */ + @ApiModelProperty(value = "缁撴潫鎺�") + @TableField("row_end") + private Integer rowEnd; + + /** + * 寮�濮嬪垪 + */ + @ApiModelProperty(value = "寮�濮嬪垪") + @TableField("bay_beg") + private Integer bayBeg; + + /** + * 缁撴潫鍒� + */ + @ApiModelProperty(value = "缁撴潫鍒�") + @TableField("bay_end") + private Integer bayEnd; + + /** + * 寮�濮嬪眰 + */ + @ApiModelProperty(value = "寮�濮嬪眰") + @TableField("lev_beg") + private Integer levBeg; + + /** + * 缁撴潫灞� + */ + @ApiModelProperty(value = "缁撴潫灞�") + @TableField("lev_end") + private Integer levEnd; + + /** + * 涓婇檺 + */ + @ApiModelProperty(value = "涓婇檺") + private Integer limit; + + /** + * 鐘舵�� 1: 姝e父 0: 绂佺敤 + */ + @ApiModelProperty(value = "鐘舵�� 1: 姝e父 0: 绂佺敤 ") + private Integer status; + + /** + * 娣诲姞浜哄憳 + */ + @ApiModelProperty(value = "娣诲姞浜哄憳") + @TableField("create_by") + private Long createBy; + + /** + * 娣诲姞鏃堕棿 + */ + @ApiModelProperty(value = "娣诲姞鏃堕棿") + @TableField("create_time") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + + /** + * 淇敼浜哄憳 + */ + @ApiModelProperty(value = "淇敼浜哄憳") + @TableField("update_by") + private Long updateBy; + + /** + * 淇敼鏃堕棿 + */ + @ApiModelProperty(value = "淇敼鏃堕棿") + @TableField("update_time") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date updateTime; + + /** + * 澶囨敞 + */ + @ApiModelProperty(value = "澶囨敞") + private String memo; + + public LocRule() { + } + + public LocRule(String matnr, String specs, String model, String cstmr, String batch, String other, Integer rowBeg, Integer rowEnd, Integer bayBeg, Integer bayEnd, Integer levBeg, Integer levEnd, Integer limit, Integer status, Long createBy, Date createTime, Long updateBy, Date updateTime, String memo) { + this.matnr = matnr; + this.specs = specs; + this.model = model; + this.cstmr = cstmr; + this.batch = batch; + this.other = other; + this.rowBeg = rowBeg; + this.rowEnd = rowEnd; + this.bayBeg = bayBeg; + this.bayEnd = bayEnd; + this.levBeg = levBeg; + this.levEnd = levEnd; + this.limit = limit; + this.status = status; + this.createBy = createBy; + this.createTime = createTime; + this.updateBy = updateBy; + this.updateTime = updateTime; + this.memo = memo; + } + +// LocRule locRule = new LocRule( +// null, // 鍟嗗搧缂栧彿 +// null, // 瑙勬牸 +// null, // 鍨嬪彿 +// null, // 瀹㈡埛 +// null, // 鎵瑰彿 +// null, // 鍏朵粬 +// null, // 寮�濮嬫帓 +// null, // 缁撴潫鎺� +// null, // 寮�濮嬪垪 +// null, // 缁撴潫鍒� +// null, // 寮�濮嬪眰 +// null, // 缁撴潫灞� +// null, // 涓婇檺 +// null, // 鐘舵�� +// null, // 娣诲姞浜哄憳 +// null, // 娣诲姞鏃堕棿 +// null, // 淇敼浜哄憳 +// null, // 淇敼鏃堕棿 +// null // 澶囨敞 +// ); + + public String getStatus$() { + if (null == this.status) { + return null; + } + switch (this.status) { + case 1: + return "姝e父"; + case 0: + return "绂佺敤"; + default: + return String.valueOf(this.status); + } + } + + public String getCreateBy$() { + UserService service = SpringUtils.getBean(UserService.class); + User user = service.selectById(this.createBy); + if (!Cools.isEmpty(user)) { + return String.valueOf(user.getNickname()); + } + return null; + } + + public String getCreateTime$() { + if (Cools.isEmpty(this.createTime)) { + return ""; + } + return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime); + } + + public String getUpdateBy$() { + UserService service = SpringUtils.getBean(UserService.class); + User user = service.selectById(this.updateBy); + if (!Cools.isEmpty(user)) { + return String.valueOf(user.getNickname()); + } + return null; + } + + public String getUpdateTime$() { + if (Cools.isEmpty(this.updateTime)) { + return ""; + } + return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime); + } + + +} diff --git a/src/main/java/com/zy/asrs/mapper/LocRuleMapper.java b/src/main/java/com/zy/asrs/mapper/LocRuleMapper.java new file mode 100644 index 0000000..3584f30 --- /dev/null +++ b/src/main/java/com/zy/asrs/mapper/LocRuleMapper.java @@ -0,0 +1,12 @@ +package com.zy.asrs.mapper; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.zy.asrs.entity.LocRule; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +@Mapper +@Repository +public interface LocRuleMapper extends BaseMapper<LocRule> { + +} diff --git a/src/main/java/com/zy/asrs/service/LocRuleService.java b/src/main/java/com/zy/asrs/service/LocRuleService.java new file mode 100644 index 0000000..8e5cb02 --- /dev/null +++ b/src/main/java/com/zy/asrs/service/LocRuleService.java @@ -0,0 +1,10 @@ +package com.zy.asrs.service; + +import com.baomidou.mybatisplus.service.IService; +import com.zy.asrs.entity.LocRule; + +public interface LocRuleService extends IService<LocRule> { + + LocRule find(String matnr, String batch, int startRow, int endRow); + +} diff --git a/src/main/java/com/zy/asrs/service/impl/LocRuleServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/LocRuleServiceImpl.java new file mode 100644 index 0000000..6596585 --- /dev/null +++ b/src/main/java/com/zy/asrs/service/impl/LocRuleServiceImpl.java @@ -0,0 +1,50 @@ +package com.zy.asrs.service.impl; + +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.core.common.Cools; +import com.zy.asrs.entity.LocRule; +import com.zy.asrs.entity.Mat; +import com.zy.asrs.mapper.LocRuleMapper; +import com.zy.asrs.service.LocRuleService; +import com.zy.asrs.service.MatService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service("locRuleService") +public class LocRuleServiceImpl extends ServiceImpl<LocRuleMapper, LocRule> implements LocRuleService { + + @Autowired + private MatService matService; + + @Override + public LocRule find(String matnr, String batch, int startRow, int endRow) { + if (Cools.isEmpty(matnr)) { + return null; + } + Mat mat = matService.selectByMatnr(matnr); + if (Cools.isEmpty(mat)) { + return null; + } + LocRule locRule = null; + do { + locRule = this.selectOne(new EntityWrapper<LocRule>().eq("matnr", matnr).ge("row_beg", startRow).le("row_end", endRow).eq("status", 1)); + if (null != locRule) { + break; + } + locRule = this.selectOne(new EntityWrapper<LocRule>().eq("specs", mat.getSpecs()).ge("row_beg", startRow).le("row_end", endRow).eq("status", 1)); + if (null != locRule) { + break; + } + locRule = this.selectOne(new EntityWrapper<LocRule>().eq("model", mat.getModel()).ge("row_beg", startRow).le("row_end", endRow).eq("status", 1)); + if (null != locRule) { + break; + } + locRule = this.selectOne(new EntityWrapper<LocRule>().eq("batch", batch).ge("row_beg", startRow).le("row_end", endRow).eq("status", 1)); + if (null != locRule) { + break; + } + } while (false); + return locRule; + } +} diff --git a/src/main/resources/mapper/LocRuleMapper.xml b/src/main/resources/mapper/LocRuleMapper.xml new file mode 100644 index 0000000..b1bbf69 --- /dev/null +++ b/src/main/resources/mapper/LocRuleMapper.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.zy.asrs.mapper.LocRuleMapper"> + + <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 --> + <resultMap id="BaseResultMap" type="com.zy.asrs.entity.LocRule"> + <id column="id" property="id"/> + <result column="matnr" property="matnr"/> + <result column="specs" property="specs"/> + <result column="model" property="model"/> + <result column="cstmr" property="cstmr"/> + <result column="batch" property="batch"/> + <result column="other" property="other"/> + <result column="row_beg" property="rowBeg"/> + <result column="row_end" property="rowEnd"/> + <result column="bay_beg" property="bayBeg"/> + <result column="bay_end" property="bayEnd"/> + <result column="lev_beg" property="levBeg"/> + <result column="lev_end" property="levEnd"/> + <result column="limit" property="limit"/> + <result column="status" property="status"/> + <result column="create_by" property="createBy"/> + <result column="create_time" property="createTime"/> + <result column="update_by" property="updateBy"/> + <result column="update_time" property="updateTime"/> + <result column="memo" property="memo"/> + + </resultMap> + +</mapper> diff --git a/src/main/webapp/static/js/locRule/locRule.js b/src/main/webapp/static/js/locRule/locRule.js new file mode 100644 index 0000000..37b0dfc --- /dev/null +++ b/src/main/webapp/static/js/locRule/locRule.js @@ -0,0 +1,275 @@ +var pageCurr; +layui.config({ + base: baseUrl + "/static/layui/lay/modules/" +}).use(['table', 'laydate', 'form', 'admin'], function () { + var table = layui.table; + var $ = layui.jquery; + var layer = layui.layer; + var layDate = layui.laydate; + var form = layui.form; + var admin = layui.admin; + + // 鏁版嵁娓叉煋 + tableIns = table.render({ + elem: '#locRule', + headers: {token: localStorage.getItem('token')}, + url: baseUrl + '/locRule/list/auth', + page: true, + limit: 15, + limits: [15, 30, 50, 100, 200, 500], + toolbar: '#toolbar', + cellMinWidth: 50, + height: 'full-120', + cols: [[ + {type: 'checkbox'} + // ,{field: 'id', align: 'center',title: 'ID'} + , {field: 'matnr', align: 'center', title: '鍟嗗搧缂栧彿'} + , {field: 'specs', align: 'center', title: '瑙勬牸'} + , {field: 'model', align: 'center', title: '鍨嬪彿'} + , {field: 'cstmr', align: 'center', title: '瀹㈡埛'} + , {field: 'batch', align: 'center', title: '鎵瑰彿'} + , {field: 'other', align: 'center', title: '鍏朵粬', hide: true} + , {field: 'rowBeg', align: 'center', title: '寮�濮嬫帓'} + , {field: 'rowEnd', align: 'center', title: '缁撴潫鎺�'} + , {field: 'bayBeg', align: 'center', title: '寮�濮嬪垪'} + , {field: 'bayEnd', align: 'center', title: '缁撴潫鍒�'} + , {field: 'levBeg', align: 'center', title: '寮�濮嬪眰'} + , {field: 'levEnd', align: 'center', title: '缁撴潫灞�'} + , {field: 'limit', align: 'center', title: '涓婇檺'} + , {field: 'status$', align: 'center', title: '鐘舵��', hide: true} + , {field: 'createBy$', align: 'center', title: '娣诲姞浜哄憳', hide: true} + , {field: 'createTime$', align: 'center', title: '娣诲姞鏃堕棿', hide: true} + , {field: 'updateBy$', align: 'center', title: '淇敼浜哄憳', hide: true} + , {field: 'updateTime$', align: 'center', title: '淇敼鏃堕棿', hide: true} + , {field: 'memo', align: 'center', title: '澶囨敞', hide: true} + + , {fixed: 'right', title: '鎿嶄綔', align: 'center', toolbar: '#operate', width: 120} + ]], + request: { + pageName: 'curr', + pageSize: 'limit' + }, + parseData: function (res) { + return { + 'code': res.code, + 'msg': res.msg, + 'count': res.data.total, + 'data': res.data.records + } + }, + response: { + statusCode: 200 + }, + done: function (res, curr, count) { + if (res.code === 403) { + top.location.href = baseUrl + "/"; + } + pageCurr = curr; + limit(); + } + }); + + // 鐩戝惉鎺掑簭浜嬩欢 + table.on('sort(locRule)', function (obj) { + var searchData = {}; + $.each($('#search-box [name]').serializeArray(), function () { + searchData[this.name] = this.value; + }); + searchData['orderByField'] = obj.field; + searchData['orderByType'] = obj.type; + tableIns.reload({ + where: searchData, + page: {curr: 1} + }); + }); + + // 鐩戝惉澶村伐鍏锋爮浜嬩欢 + table.on('toolbar(locRule)', function (obj) { + var checkStatus = table.checkStatus(obj.config.id).data; + switch (obj.event) { + case 'addData': + showEditModel(); + break; + case 'deleteData': + if (checkStatus.length === 0) { + layer.msg('璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁', {icon: 2}); + return; + } + del(checkStatus.map(function (d) { + return d.id; + })); + break; + case 'exportData': + admin.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function () { + var titles = []; + var fields = []; + obj.config.cols[0].map(function (col) { + if (col.type === 'normal' && col.hide === false && col.toolbar == null) { + titles.push(col.title); + fields.push(col.field); + } + }); + var exportData = {}; + $.each($('#search-box [name]').serializeArray(), function () { + exportData[this.name] = this.value; + }); + var param = { + 'locRule': exportData, + 'fields': fields + }; + $.ajax({ + url: baseUrl + "/locRule/export/auth", + headers: {'token': localStorage.getItem('token')}, + data: JSON.stringify(param), + dataType: 'json', + contentType: 'application/json;charset=UTF-8', + method: 'POST', + success: function (res) { + layer.closeAll(); + if (res.code === 200) { + table.exportFile(titles, res.data, 'xls'); + } else if (res.code === 403) { + top.location.href = baseUrl + "/"; + } else { + layer.msg(res.msg, {icon: 2}) + } + } + }); + }); + break; + } + }); + + // 鐩戝惉琛屽伐鍏蜂簨浠� + table.on('tool(locRule)', function (obj) { + var data = obj.data; + switch (obj.event) { + case 'edit': + showEditModel(data); + break; + case "del": + del([data.id]); + break; + } + }); + + /* 寮圭獥 - 鏂板銆佷慨鏀� */ + function showEditModel(mData) { + admin.open({ + type: 1, + area: '1000px', + title: (mData ? '淇敼' : '娣诲姞') + '搴撳尯瑙勫垯', + content: $('#editDialog').html(), + success: function (layero, dIndex) { + layDateRender(mData); + form.val('detail', mData); + form.on('submit(editSubmit)', function (data) { + var loadIndex = layer.load(2); + $.ajax({ + url: baseUrl + "/locRule/" + (mData ? 'update' : 'add') + "/auth", + headers: {'token': localStorage.getItem('token')}, + data: data.field, + method: 'POST', + success: function (res) { + layer.close(loadIndex); + if (res.code === 200) { + layer.close(dIndex); + layer.msg(res.msg, {icon: 1}); + tableReload(); + } else if (res.code === 403) { + top.location.href = baseUrl + "/"; + } else { + layer.msg(res.msg, {icon: 2}); + } + } + }) + return false; + }); + $(layero).children('.layui-layer-content').css('overflow', 'visible'); + layui.form.render('select'); + } + }); + } + + /* 鍒犻櫎 */ + function del(ids) { + layer.confirm('纭畾瑕佸垹闄ら�変腑鏁版嵁鍚楋紵', { + skin: 'layui-layer-admin', + shade: .1 + }, function (i) { + layer.close(i); + var loadIndex = layer.load(2); + $.ajax({ + url: baseUrl + "/locRule/delete/auth", + headers: {'token': localStorage.getItem('token')}, + data: {ids: ids}, + method: 'POST', + success: function (res) { + layer.close(loadIndex); + if (res.code === 200) { + layer.msg(res.msg, {icon: 1}); + tableReload(); + } else if (res.code === 403) { + top.location.href = baseUrl + "/"; + } else { + layer.msg(res.msg, {icon: 2}); + } + } + }) + }); + } + + // 鎼滅储 + form.on('submit(search)', function (data) { + pageCurr = 1; + tableReload(false); + }); + + // 閲嶇疆 + form.on('submit(reset)', function (data) { + pageCurr = 1; + clearFormVal($('#search-box')); + tableReload(false); + }); + + // 鏃堕棿閫夋嫨鍣� + function layDateRender(data) { + setTimeout(function () { + layDate.render({ + elem: '.layui-laydate-range' + , type: 'datetime' + , range: true + }); + layDate.render({ + elem: '#createTime\\$', + type: 'datetime', + value: data !== undefined ? data['createTime\\$'] : null + }); + layDate.render({ + elem: '#updateTime\\$', + type: 'datetime', + value: data !== undefined ? data['updateTime\\$'] : null + }); + + }, 300); + } + + layDateRender(); + +}); + +// 鍏抽棴鍔ㄤ綔 +$(document).on('click', '#data-detail-close', function () { + parent.layer.closeAll(); +}); + +function tableReload(child) { + var searchData = {}; + $.each($('#search-box [name]').serializeArray(), function () { + searchData[this.name] = this.value; + }); + tableIns.reload({ + where: searchData, + page: {curr: pageCurr} + }); +} diff --git a/src/main/webapp/views/locRule/locRule.html b/src/main/webapp/views/locRule/locRule.html new file mode 100644 index 0000000..9703079 --- /dev/null +++ b/src/main/webapp/views/locRule/locRule.html @@ -0,0 +1,188 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <title></title> + <meta content="webkit" name="renderer"> + <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible"> + <meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport"> + <link href="../../static/layui/css/layui.css" media="all" rel="stylesheet"> + <link href="../../static/css/admin.css?v=318" media="all" rel="stylesheet"> + <link href="../../static/css/cool.css" media="all" rel="stylesheet"> +</head> +<body> + +<div class="layui-fluid"> + <div class="layui-card"> + <div class="layui-card-body"> + <div class="layui-form toolbar" id="search-box"> + <div class="layui-form-item"> + <div class="layui-inline"> + <div class="layui-input-inline"> + <input autocomplete="off" class="layui-input" name="matnr" placeholder="鍟嗗搧缂栧彿" type="text"> + </div> + </div> + <!-- <div class="layui-inline" style="width: 300px">--> + <!-- <div class="layui-input-inline">--> + <!-- <input class="layui-input layui-laydate-range" name="create_time" type="text" placeholder="璧峰鏃堕棿 - 缁堟鏃堕棿" autocomplete="off" style="width: 300px">--> + <!-- </div>--> + <!-- </div>--> + <div class="layui-inline"> + <div class="layui-input-inline"> + <input autocomplete="off" class="layui-input" name="condition" placeholder="璇疯緭鍏�" + type="text"> + </div> + </div> + <div class="layui-inline">  + <button class="layui-btn icon-btn" lay-filter="search" lay-submit> + <i class="layui-icon"></i>鎼滅储 + </button> + <button class="layui-btn icon-btn" lay-filter="reset" lay-submit> + <i class="layui-icon"></i>閲嶇疆 + </button> + </div> + </div> + </div> + <table class="layui-hide" id="locRule" lay-filter="locRule"></table> + </div> + </div> +</div> + +<script id="toolbar" type="text/html"> + <div class="layui-btn-container"> + <button class="layui-btn layui-btn-sm" id="btn-add" lay-event="addData">鏂板</button> + <button class="layui-btn layui-btn-sm layui-btn-danger" id="btn-delete" lay-event="deleteData">鍒犻櫎</button> + <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData" + style="float: right">瀵煎嚭 + </button> + </div> +</script> + +<script id="operate" type="text/html"> + <a class="layui-btn layui-btn-primary layui-btn-xs btn-edit" lay-event="edit">淇敼</a> + <a class="layui-btn layui-btn-danger layui-btn-xs btn-edit" lay-event="del">鍒犻櫎</a> +</script> + +<script src="../../static/js/jquery/jquery-3.3.1.min.js" type="text/javascript"></script> +<script charset="utf-8" src="../../static/layui/layui.js" type="text/javascript"></script> +<script charset="utf-8" src="../../static/js/common.js" type="text/javascript"></script> +<script charset="utf-8" src="../../static/js/cool.js" type="text/javascript"></script> +<script charset="utf-8" src="../../static/js/locRule/locRule.js" type="text/javascript"></script> +</body> +<!-- 琛ㄥ崟寮圭獥 --> +<script id="editDialog" type="text/html"> + <form id="detail" lay-filter="detail" class="layui-form admin-form model-form"> + <input name="id" type="hidden"> + <div class="layui-row"> + <div class="layui-col-md6"> + <div class="layui-form-item"> + <label class="layui-form-label">鍟嗗搧缂栧彿: </label> + <div class="layui-input-block"> + <input class="layui-input" name="matnr" placeholder="璇疯緭鍏ュ晢鍝佺紪鍙�"> + </div> + </div> + <div class="layui-form-item"> + <label class="layui-form-label">瑙勬牸: </label> + <div class="layui-input-block"> + <input class="layui-input" name="specs" placeholder="璇疯緭鍏ヨ鏍�"> + </div> + </div> + <div class="layui-form-item"> + <label class="layui-form-label">鍨嬪彿: </label> + <div class="layui-input-block"> + <input class="layui-input" name="model" placeholder="璇疯緭鍏ュ瀷鍙�"> + </div> + </div> + <div class="layui-form-item"> + <label class="layui-form-label">瀹㈡埛: </label> + <div class="layui-input-block"> + <input class="layui-input" name="cstmr" placeholder="璇疯緭鍏ュ鎴�"> + </div> + </div> + <div class="layui-form-item"> + <label class="layui-form-label">鎵瑰彿: </label> + <div class="layui-input-block"> + <input class="layui-input" name="batch" placeholder="璇疯緭鍏ユ壒鍙�"> + </div> + </div> + <!-- <div class="layui-form-item">--> + <!-- <label class="layui-form-label">鍏朵粬: </label>--> + <!-- <div class="layui-input-block">--> + <!-- <input class="layui-input" name="other" placeholder="璇疯緭鍏ュ叾浠�">--> + <!-- </div>--> + <!-- </div>--> + <div class="layui-form-item"> + <label class="layui-form-label">涓婇檺: </label> + <div class="layui-input-block"> + <input class="layui-input" name="limit" placeholder="璇疯緭鍏ヤ笂闄�"> + </div> + </div> + + </div> + + <div class="layui-col-md6"> + <!-- <div class="layui-inline">--> + <!-- <label class="layui-form-label">鎺掕寖鍥�</label>--> + <!-- <div class="layui-input-inline" style="width: 100px;">--> + <!-- <input type="text" name="price_min" placeholder="锟�" autocomplete="off" class="layui-input">--> + <!-- </div>--> + <!-- <div class="layui-form-mid">-</div>--> + <!-- <div class="layui-input-inline" style="width: 100px;">--> + <!-- <input type="text" name="price_max" placeholder="锟�" autocomplete="off" class="layui-input">--> + <!-- </div>--> + <!-- </div>--> + + <div class="layui-form-item"> + <label class="layui-form-label layui-form-required">寮�濮嬫帓: </label> + <div class="layui-input-block"> + <input type="number" min="1" class="layui-input" name="rowBeg" placeholder="璇疯緭鍏ュ紑濮嬫帓" + lay-vertype="tips" lay-verify="required" required=""> + </div> + </div> + <div class="layui-form-item"> + <label class="layui-form-label layui-form-required">缁撴潫鎺�: </label> + <div class="layui-input-block"> + <input type="number" min="1" class="layui-input" name="rowEnd" placeholder="璇疯緭鍏ョ粨鏉熸帓" + lay-vertype="tips" lay-verify="required" required=""> + </div> + </div> + <div class="layui-form-item"> + <label class="layui-form-label layui-form-required">寮�濮嬪垪: </label> + <div class="layui-input-block"> + <input type="number" min="1" class="layui-input" name="bayBeg" placeholder="璇疯緭鍏ュ紑濮嬪垪" + lay-vertype="tips" lay-verify="required" required=""> + </div> + </div> + <div class="layui-form-item"> + <label class="layui-form-label layui-form-required">缁撴潫鍒�: </label> + <div class="layui-input-block"> + <input type="number" min="1" class="layui-input" name="bayEnd" placeholder="璇疯緭鍏ョ粨鏉熷垪" + lay-vertype="tips" lay-verify="required" required=""> + </div> + </div> + <div class="layui-form-item"> + <label class="layui-form-label layui-form-required">寮�濮嬪眰: </label> + <div class="layui-input-block"> + <input type="number" min="1" class="layui-input" name="levBeg" placeholder="璇疯緭鍏ュ紑濮嬪眰" + lay-vertype="tips" lay-verify="required" required=""> + </div> + </div> + <div class="layui-form-item"> + <label class="layui-form-label layui-form-required">缁撴潫灞�: </label> + <div class="layui-input-block"> + <input type="number" min="1" class="layui-input" name="levEnd" placeholder="璇疯緭鍏ョ粨鏉熷眰" + lay-vertype="tips" lay-verify="required" required=""> + </div> + </div> + + </div> + </div> + <hr class="layui-bg-gray"> + <div class="layui-form-item text-right"> + <button class="layui-btn" lay-filter="editSubmit" lay-submit="">淇濆瓨</button> + <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">鍙栨秷</button> + </div> + </form> +</script> +</html> + -- Gitblit v1.9.1