| New file | 
|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.controller; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONArray; | 
|---|
|  |  |  | 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.common.DateUtils; | 
|---|
|  |  |  | import com.zy.asrs.entity.TestMast; | 
|---|
|  |  |  | import com.zy.asrs.service.TestMastService; | 
|---|
|  |  |  | import com.core.annotations.ManagerAuth; | 
|---|
|  |  |  | import com.core.common.BaseRes; | 
|---|
|  |  |  | import com.core.common.Cools; | 
|---|
|  |  |  | import com.core.common.R; | 
|---|
|  |  |  | 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 TestMastController extends BaseController { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private TestMastService testMastService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/testMast/{id}/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R get(@PathVariable("id") String id) { | 
|---|
|  |  |  | return R.ok(testMastService.selectById(String.valueOf(id))); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/testMast/list/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R list(@RequestParam(defaultValue = "1")Integer curr, | 
|---|
|  |  |  | @RequestParam(defaultValue = "10")Integer limit, | 
|---|
|  |  |  | @RequestParam(required = false)String orderByField, | 
|---|
|  |  |  | @RequestParam(required = false)String orderByType, | 
|---|
|  |  |  | @RequestParam Map<String, Object> param){ | 
|---|
|  |  |  | EntityWrapper<TestMast> wrapper = new EntityWrapper<>(); | 
|---|
|  |  |  | excludeTrash(param); | 
|---|
|  |  |  | convert(param, wrapper); | 
|---|
|  |  |  | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} | 
|---|
|  |  |  | return R.ok(testMastService.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 = "/testMast/add/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R add(TestMast testMast) { | 
|---|
|  |  |  | testMastService.insert(testMast); | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/testMast/update/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R update(TestMast testMast){ | 
|---|
|  |  |  | if (Cools.isEmpty(testMast) || null==testMast.getId()){ | 
|---|
|  |  |  | return R.error(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | testMastService.updateById(testMast); | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/testMast/delete/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R delete(@RequestParam(value="ids[]") Long[] ids){ | 
|---|
|  |  |  | for (Long id : ids){ | 
|---|
|  |  |  | testMastService.deleteById(id); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/testMast/export/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R export(@RequestBody JSONObject param){ | 
|---|
|  |  |  | EntityWrapper<TestMast> wrapper = new EntityWrapper<>(); | 
|---|
|  |  |  | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); | 
|---|
|  |  |  | Map<String, Object> map = excludeTrash(param.getJSONObject("testMast")); | 
|---|
|  |  |  | convert(map, wrapper); | 
|---|
|  |  |  | List<TestMast> list = testMastService.selectList(wrapper); | 
|---|
|  |  |  | return R.ok(exportSupport(list, fields)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/testMastQuery/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R query(String condition) { | 
|---|
|  |  |  | EntityWrapper<TestMast> wrapper = new EntityWrapper<>(); | 
|---|
|  |  |  | wrapper.like("loc_no", condition); | 
|---|
|  |  |  | Page<TestMast> page = testMastService.selectPage(new Page<>(0, 10), wrapper); | 
|---|
|  |  |  | List<Map<String, Object>> result = new ArrayList<>(); | 
|---|
|  |  |  | for (TestMast testMast : page.getRecords()){ | 
|---|
|  |  |  | Map<String, Object> map = new HashMap<>(); | 
|---|
|  |  |  | map.put("id", testMast.getId()); | 
|---|
|  |  |  | map.put("value", testMast.getId()); | 
|---|
|  |  |  | result.add(map); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok(result); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/testMast/check/column/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R query(@RequestBody JSONObject param) { | 
|---|
|  |  |  | Wrapper<TestMast> wrapper = new EntityWrapper<TestMast>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); | 
|---|
|  |  |  | if (null != testMastService.selectOne(wrapper)){ | 
|---|
|  |  |  | return R.parse(BaseRes.REPEAT).add(getComment(TestMast.class, String.valueOf(param.get("key")))); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.entity; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.core.common.Cools;import com.baomidou.mybatisplus.annotations.TableId; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.enums.IdType; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.annotations.TableField; | 
|---|
|  |  |  | import java.text.SimpleDateFormat; | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  | import org.springframework.format.annotation.DateTimeFormat; | 
|---|
|  |  |  | import java.text.SimpleDateFormat; | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import io.swagger.annotations.ApiModelProperty; | 
|---|
|  |  |  | import lombok.Data; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.annotations.TableName; | 
|---|
|  |  |  | import java.io.Serializable; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Data | 
|---|
|  |  |  | @TableName("asr_test_mast") | 
|---|
|  |  |  | public class TestMast implements Serializable { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private static final long serialVersionUID = 1L; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 编号 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "编号") | 
|---|
|  |  |  | @TableId(value = "id", type = IdType.AUTO) | 
|---|
|  |  |  | private Long id; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiModelProperty(value= "") | 
|---|
|  |  |  | private Integer channel; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 库位号 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "库位号") | 
|---|
|  |  |  | @TableField("loc_no") | 
|---|
|  |  |  | private String locNo; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * PACK码 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "PACK码") | 
|---|
|  |  |  | private String barcode; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 用户码 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "用户码") | 
|---|
|  |  |  | private String userId; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 状态 0: 待申请  1: 申请中  2: 已复核;3  4: 完成 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "状态 0: 待申请  1: 申请中  2: 已复核;3  4: 完成  ") | 
|---|
|  |  |  | private Integer status; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 修改时间 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "修改时间") | 
|---|
|  |  |  | @TableField("modi_time") | 
|---|
|  |  |  | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | 
|---|
|  |  |  | private Date modiTime; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 添加时间 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "添加时间") | 
|---|
|  |  |  | @TableField("appe_time") | 
|---|
|  |  |  | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | 
|---|
|  |  |  | private Date appeTime; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public TestMast() {} | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public TestMast(Integer channel,String locNo,String barcode,String userId,Integer status,Date modiTime,Date appeTime) { | 
|---|
|  |  |  | this.channel = channel; | 
|---|
|  |  |  | this.locNo = locNo; | 
|---|
|  |  |  | this.barcode = barcode; | 
|---|
|  |  |  | this.userId = userId; | 
|---|
|  |  |  | this.status = status; | 
|---|
|  |  |  | this.modiTime = modiTime; | 
|---|
|  |  |  | this.appeTime = appeTime; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //    TestMast testMast = new TestMast( | 
|---|
|  |  |  | //            null,    // [非空] | 
|---|
|  |  |  | //            null,    // 库位号[非空] | 
|---|
|  |  |  | //            null,    // PACK码 | 
|---|
|  |  |  | //            null,    // 用户码 | 
|---|
|  |  |  | //            null,    // 状态 | 
|---|
|  |  |  | //            null,    // 修改时间 | 
|---|
|  |  |  | //            null    // 添加时间 | 
|---|
|  |  |  | //    ); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String getStatus$(){ | 
|---|
|  |  |  | if (null == this.status){ return null; } | 
|---|
|  |  |  | switch (this.status){ | 
|---|
|  |  |  | case 0: | 
|---|
|  |  |  | return "待申请"; | 
|---|
|  |  |  | case 1: | 
|---|
|  |  |  | return "申请中"; | 
|---|
|  |  |  | case 2: | 
|---|
|  |  |  | return "已复核;3"; | 
|---|
|  |  |  | case 4: | 
|---|
|  |  |  | return "完成"; | 
|---|
|  |  |  | default: | 
|---|
|  |  |  | return String.valueOf(this.status); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String getModiTime$(){ | 
|---|
|  |  |  | if (Cools.isEmpty(this.modiTime)){ | 
|---|
|  |  |  | return ""; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.modiTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String getAppeTime$(){ | 
|---|
|  |  |  | if (Cools.isEmpty(this.appeTime)){ | 
|---|
|  |  |  | return ""; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.appeTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.mapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.zy.asrs.entity.TestMast; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.mapper.BaseMapper; | 
|---|
|  |  |  | import org.apache.ibatis.annotations.Mapper; | 
|---|
|  |  |  | import org.springframework.stereotype.Repository; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Mapper | 
|---|
|  |  |  | @Repository | 
|---|
|  |  |  | public interface TestMastMapper extends BaseMapper<TestMast> { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.service; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.zy.asrs.entity.TestMast; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.service.IService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public interface TestMastService extends IService<TestMast> { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | if (Cools.isEmpty(locMast)) { | 
|---|
|  |  |  | throw new CoolException(BaseRes.PARAM); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Date date1; | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | date1 = new Date(); | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.service.impl; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.zy.asrs.mapper.TestMastMapper; | 
|---|
|  |  |  | import com.zy.asrs.entity.TestMast; | 
|---|
|  |  |  | import com.zy.asrs.service.TestMastService; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.service.impl.ServiceImpl; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Service("testMastService") | 
|---|
|  |  |  | public class TestMastServiceImpl extends ServiceImpl<TestMastMapper, TestMast> implements TestMastService { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | -- save testMast record | 
|---|
|  |  |  | -- mysql | 
|---|
|  |  |  | insert into `sys_resource` ( `code`, `name`, `resource_id`, `level`, `sort`, `status`) values ( 'testMast/testMast.html', 'testMast管理', null , '2', null , '1'); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | insert into `sys_resource` ( `code`, `name`, `resource_id`, `level`, `sort`, `status`) values ( 'testMast#view', '查询', '', '3', '0', '1'); | 
|---|
|  |  |  | insert into `sys_resource` ( `code`, `name`, `resource_id`, `level`, `sort`, `status`) values ( 'testMast#btn-add', '新增', '', '3', '1', '1'); | 
|---|
|  |  |  | insert into `sys_resource` ( `code`, `name`, `resource_id`, `level`, `sort`, `status`) values ( 'testMast#btn-edit', '编辑', '', '3', '2', '1'); | 
|---|
|  |  |  | insert into `sys_resource` ( `code`, `name`, `resource_id`, `level`, `sort`, `status`) values ( 'testMast#btn-delete', '删除', '', '3', '3', '1'); | 
|---|
|  |  |  | insert into `sys_resource` ( `code`, `name`, `resource_id`, `level`, `sort`, `status`) values ( 'testMast#btn-export', '导出', '', '3', '4', '1'); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | -- sqlserver | 
|---|
|  |  |  | insert [dbo].[sys_resource] ( [code], [name], [resource_id], [level], [sort], [status]) values ( N'testMast/testMast.html', N'testMast管理', null, '2', null, '1'); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | insert [dbo].[sys_resource] ( [code], [name], [resource_id], [level], [sort], [status]) values ( N'testMast#view', N'查询', '', '3', '0', '1'); | 
|---|
|  |  |  | insert [dbo].[sys_resource] ( [code], [name], [resource_id], [level], [sort], [status]) values ( N'testMast#btn-add', N'新增', '', '3', '1', '1'); | 
|---|
|  |  |  | insert [dbo].[sys_resource] ( [code], [name], [resource_id], [level], [sort], [status]) values ( N'testMast#btn-edit', N'编辑', '', '3', '2', '1'); | 
|---|
|  |  |  | insert [dbo].[sys_resource] ( [code], [name], [resource_id], [level], [sort], [status]) values ( N'testMast#btn-delete', N'删除', '', '3', '3', '1'); | 
|---|
|  |  |  | insert [dbo].[sys_resource] ( [code], [name], [resource_id], [level], [sort], [status]) values ( N'testMast#btn-export', N'导出', '', '3', '4', '1'); | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | <?xml version="1.0" encoding="UTF-8"?> | 
|---|
|  |  |  | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 
|---|
|  |  |  | <mapper namespace="com.zy.asrs.mapper.TestMastMapper"> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!-- 通用查询映射结果 --> | 
|---|
|  |  |  | <resultMap id="BaseResultMap" type="com.zy.asrs.entity.TestMast"> | 
|---|
|  |  |  | <id column="id" property="id" /> | 
|---|
|  |  |  | <result column="channel" property="channel" /> | 
|---|
|  |  |  | <result column="loc_no" property="locNo" /> | 
|---|
|  |  |  | <result column="barcode" property="barcode" /> | 
|---|
|  |  |  | <result column="userId" property="userId" /> | 
|---|
|  |  |  | <result column="status" property="status" /> | 
|---|
|  |  |  | <result column="modi_time" property="modiTime" /> | 
|---|
|  |  |  | <result column="appe_time" property="appeTime" /> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </mapper> | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | 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: '#testMast', | 
|---|
|  |  |  | headers: {token: localStorage.getItem('token')}, | 
|---|
|  |  |  | url: baseUrl+'/testMast/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: '编号'} | 
|---|
|  |  |  | ,{field: 'channel', align: 'center',title: ''} | 
|---|
|  |  |  | ,{field: 'locNo', align: 'center',title: '库位号'} | 
|---|
|  |  |  | ,{field: 'barcode', align: 'center',title: 'PACK码'} | 
|---|
|  |  |  | ,{field: 'userId', align: 'center',title: '用户码'} | 
|---|
|  |  |  | ,{field: 'status$', align: 'center',title: '״̬'} | 
|---|
|  |  |  | ,{field: 'modiTime$', align: 'center',title: '修改时间'} | 
|---|
|  |  |  | ,{field: 'appeTime$', align: 'center',title: '添加时间'} | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ,{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(testMast)', 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(testMast)', 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 = { | 
|---|
|  |  |  | 'testMast': exportData, | 
|---|
|  |  |  | 'fields': fields | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl+"/testMast/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(testMast)', 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: '600px', | 
|---|
|  |  |  | 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+"/testMast/"+(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+"/testMast/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: '#modiTime\\$', | 
|---|
|  |  |  | type: 'datetime', | 
|---|
|  |  |  | value: data!==undefined?data['modiTime\\$']:null | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | layDate.render({ | 
|---|
|  |  |  | elem: '#appeTime\\$', | 
|---|
|  |  |  | type: 'datetime', | 
|---|
|  |  |  | value: data!==undefined?data['appeTime\\$']: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} | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | <!DOCTYPE html> | 
|---|
|  |  |  | <html lang="en"> | 
|---|
|  |  |  | <head> | 
|---|
|  |  |  | <meta charset="utf-8"> | 
|---|
|  |  |  | <title></title> | 
|---|
|  |  |  | <meta name="renderer" content="webkit"> | 
|---|
|  |  |  | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | 
|---|
|  |  |  | <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> | 
|---|
|  |  |  | <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all"> | 
|---|
|  |  |  | <link rel="stylesheet" href="../../static/css/admin.css?v=318" media="all"> | 
|---|
|  |  |  | <link rel="stylesheet" href="../../static/css/cool.css" media="all"> | 
|---|
|  |  |  | </head> | 
|---|
|  |  |  | <body> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <div class="layui-fluid"> | 
|---|
|  |  |  | <div class="layui-card"> | 
|---|
|  |  |  | <div class="layui-card-body"> | 
|---|
|  |  |  | <div class="layui-form toolbar" id="search-box"> | 
|---|
|  |  |  | <div class="layui-form-item"> | 
|---|
|  |  |  | <div class="layui-inline"> | 
|---|
|  |  |  | <label class="layui-form-label">编号:</label> | 
|---|
|  |  |  | <div class="layui-input-inline"> | 
|---|
|  |  |  | <input class="layui-input" type="text" name="id" placeholder="编号" autocomplete="off"> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-inline">  | 
|---|
|  |  |  | <button class="layui-btn icon-btn" lay-filter="search" lay-submit> | 
|---|
|  |  |  | <i class="layui-icon"></i>搜索 | 
|---|
|  |  |  | </button> | 
|---|
|  |  |  | <button class="layui-btn icon-btn" lay-filter="reset" lay-submit> | 
|---|
|  |  |  | <i class="layui-icon"></i>重置 | 
|---|
|  |  |  | </button> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <table class="layui-hide" id="testMast" lay-filter="testMast"></table> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <script type="text/html" id="toolbar"> | 
|---|
|  |  |  | <div class="layui-btn-container"> | 
|---|
|  |  |  | <button class="layui-btn layui-btn-sm" id="btn-add" lay-event="addData">新增</button> | 
|---|
|  |  |  | <button class="layui-btn layui-btn-sm layui-btn-danger" id="btn-delete" lay-event="deleteData">删除</button> | 
|---|
|  |  |  | <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData" style="float: right">导出</button> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <script type="text/html" id="operate"> | 
|---|
|  |  |  | <a class="layui-btn layui-btn-primary layui-btn-xs btn-edit" lay-event="edit">修改</a> | 
|---|
|  |  |  | <a class="layui-btn layui-btn-danger layui-btn-xs btn-edit" lay-event="del">删除</a> | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script> | 
|---|
|  |  |  | <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script> | 
|---|
|  |  |  | <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script> | 
|---|
|  |  |  | <script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script> | 
|---|
|  |  |  | <script type="text/javascript" src="../../static/js/testMast/testMast.js" charset="utf-8"></script> | 
|---|
|  |  |  | </body> | 
|---|
|  |  |  | <!-- 表单弹窗 --> | 
|---|
|  |  |  | <script type="text/html" id="editDialog"> | 
|---|
|  |  |  | <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-md12"> | 
|---|
|  |  |  | <div class="layui-form-item"> | 
|---|
|  |  |  | <label class="layui-form-label layui-form-required">: </label> | 
|---|
|  |  |  | <div class="layui-input-block"> | 
|---|
|  |  |  | <input class="layui-input" name="channel" placeholder="请输入" lay-vertype="tips" lay-verify="required"> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-form-item"> | 
|---|
|  |  |  | <label class="layui-form-label layui-form-required">库位号: </label> | 
|---|
|  |  |  | <div class="layui-input-block"> | 
|---|
|  |  |  | <input class="layui-input" name="locNo" placeholder="请输入库位号" lay-vertype="tips" lay-verify="required"> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-form-item"> | 
|---|
|  |  |  | <label class="layui-form-label">PACK码: </label> | 
|---|
|  |  |  | <div class="layui-input-block"> | 
|---|
|  |  |  | <input class="layui-input" name="barcode" placeholder="请输入PACK码"> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-form-item"> | 
|---|
|  |  |  | <label class="layui-form-label">用户码: </label> | 
|---|
|  |  |  | <div class="layui-input-block"> | 
|---|
|  |  |  | <input class="layui-input" name="userId" placeholder="请输入用户码"> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-form-item"> | 
|---|
|  |  |  | <label class="layui-form-label">״̬: </label> | 
|---|
|  |  |  | <div class="layui-input-block"> | 
|---|
|  |  |  | <select name="status"> | 
|---|
|  |  |  | <option value="">请选择状态</option> | 
|---|
|  |  |  | <option value="0">待申请</option> | 
|---|
|  |  |  | <option value="1">申请中</option> | 
|---|
|  |  |  | <option value="2">已复核;3</option> | 
|---|
|  |  |  | <option value="4">完成</option> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-form-item"> | 
|---|
|  |  |  | <label class="layui-form-label">修改时间: </label> | 
|---|
|  |  |  | <div class="layui-input-block"> | 
|---|
|  |  |  | <input class="layui-input" name="modiTime" id="modiTime$" placeholder="请输入修改时间"> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-form-item"> | 
|---|
|  |  |  | <label class="layui-form-label">添加时间: </label> | 
|---|
|  |  |  | <div class="layui-input-block"> | 
|---|
|  |  |  | <input class="layui-input" name="appeTime" id="appeTime$" placeholder="请输入添加时间"> | 
|---|
|  |  |  | </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> | 
|---|
|  |  |  |  | 
|---|