New file |
| | |
| | | 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.common.DateUtils; |
| | | import com.zy.asrs.entity.BasMap; |
| | | import com.zy.asrs.service.BasMapService; |
| | | 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 BasMapController extends BaseController { |
| | | |
| | | @Autowired |
| | | private BasMapService basMapService; |
| | | |
| | | @RequestMapping(value = "/basMap/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") String id) { |
| | | return R.ok(basMapService.selectById(String.valueOf(id))); |
| | | } |
| | | |
| | | @RequestMapping(value = "/basMap/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<BasMap> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | allLike(BasMap.class, param.keySet(), wrapper, condition); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | return R.ok(basMapService.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 = "/basMap/add/auth") |
| | | @ManagerAuth |
| | | public R add(BasMap basMap) { |
| | | basMapService.insert(basMap); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/basMap/update/auth") |
| | | @ManagerAuth |
| | | public R update(BasMap basMap){ |
| | | if (Cools.isEmpty(basMap) || null==basMap.getId()){ |
| | | return R.error(); |
| | | } |
| | | basMapService.updateById(basMap); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/basMap/delete/auth") |
| | | @ManagerAuth |
| | | public R delete(@RequestParam(value="ids[]") Long[] ids){ |
| | | for (Long id : ids){ |
| | | basMapService.deleteById(id); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/basMap/export/auth") |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | EntityWrapper<BasMap> wrapper = new EntityWrapper<>(); |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("basMap")); |
| | | convert(map, wrapper); |
| | | List<BasMap> list = basMapService.selectList(wrapper); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/basMapQuery/auth") |
| | | @ManagerAuth |
| | | public R query(String condition) { |
| | | EntityWrapper<BasMap> wrapper = new EntityWrapper<>(); |
| | | wrapper.like("id", condition); |
| | | Page<BasMap> page = basMapService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (BasMap basMap : page.getRecords()){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", basMap.getId()); |
| | | map.put("value", basMap.getId()); |
| | | result.add(map); |
| | | } |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @RequestMapping(value = "/basMap/check/column/auth") |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<BasMap> wrapper = new EntityWrapper<BasMap>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != basMapService.selectOne(wrapper)){ |
| | | return R.parse(BaseRes.REPEAT).add(getComment(BasMap.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取地图楼层数据 |
| | | */ |
| | | @GetMapping("/map/lev/list") |
| | | @ManagerAuth |
| | | public R getMapLevList() { |
| | | List<BasMap> basMaps = basMapService.selectList(new EntityWrapper<BasMap>().orderBy("lev", true)); |
| | | ArrayList<Integer> levList = new ArrayList<>(); |
| | | for (BasMap basMap : basMaps) { |
| | | levList.add(basMap.getLev()); |
| | | } |
| | | return R.ok().add(levList); |
| | | } |
| | | |
| | | /** |
| | | * 获取地图数据 |
| | | */ |
| | | @GetMapping("/map/{lev}/auth") |
| | |
| | | @TableField("lev") |
| | | private Integer lev; |
| | | |
| | | /** |
| | | * 原始地图 |
| | | */ |
| | | @ApiModelProperty(value= "原始地图") |
| | | @TableField("origin_data") |
| | | private String originData; |
| | | |
| | | public BasMap() {} |
| | | |
| | | public BasMap(String data,Date createTime,Date updateTime,String lastData,Integer lev) { |
| | |
| | | */ |
| | | public synchronized void initRealtimeBasMap() { |
| | | try { |
| | | for (int i = 1; i <= 4; i++) {//总共四层楼 |
| | | Object data = redisUtil.get(RedisKeyType.MAP.key + i); |
| | | if (data == null) {//redis地图数据为空 |
| | | BasMap basMap = basMapService.selectLatestMap(i); |
| | | if (basMap == null) { |
| | | basMap = new BasMap(); |
| | | basMap.setCreateTime(new Date()); |
| | | basMap.setUpdateTime(new Date()); |
| | | basMap.setLev(i); |
| | | if (!basMapService.insert(basMap)) { |
| | | log.info("地图数据存储失败"); |
| | | } |
| | | } |
| | | |
| | | List<BasMap> basMaps = basMapService.selectList(new EntityWrapper<BasMap>().orderBy("lev", true)); |
| | | for (BasMap basMap : basMaps) { |
| | | Integer lev = basMap.getLev(); |
| | | Object data = redisUtil.get(RedisKeyType.MAP.key + lev); |
| | | if (data == null) {//redis地图数据为空 |
| | | //载入地图 |
| | | List<List<MapNode>> lists = navigateMapData.getJsonData(i, -1, null, null);//获取完整地图(包括入库出库) |
| | | List<List<MapNode>> lists = navigateMapData.getJsonData(lev, -1, null, null);//获取完整地图(包括入库出库) |
| | | |
| | | //存入数据库 |
| | | basMap.setData(JSON.toJSONString(lists)); |
| | | basMap.setCreateTime(new Date()); |
| | | basMap.setUpdateTime(new Date()); |
| | | basMap.setLev(i); |
| | | |
| | | if (!basMapService.updateById(basMap)) { |
| | | log.info("地图数据存储失败"); |
| | | } |
| | | |
| | | //将数据库地图数据存入redis |
| | | redisUtil.set(RedisKeyType.MAP.key + i, JSON.toJSONString(basMap)); |
| | | redisUtil.set(RedisKeyType.MAP.key + lev, JSON.toJSONString(basMap)); |
| | | } |
| | | |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | generator.url="localhost:3306/shuttle_rcs"; |
| | | generator.username="root"; |
| | | generator.password="root"; |
| | | generator.table="sys_http_request_log"; |
| | | generator.table="asr_bas_map"; |
| | | // sqlserver |
| | | // generator.sqlOsType = SqlOsType.SQL_SERVER; |
| | | // generator.url="127.0.0.1:1433;databasename=tzskasrs"; |
| | |
| | | // generator.table="asr_bas_shuttle"; |
| | | generator.packagePath="com.zy.asrs"; |
| | | |
| | | generator.controller = false; |
| | | generator.html = false; |
| | | generator.js = false; |
| | | generator.htmlDetail = false; |
| | | generator.sql = false; |
| | | generator.controller = true; |
| | | generator.html = true; |
| | | generator.js = true; |
| | | generator.htmlDetail = true; |
| | | generator.sql = true; |
| | | generator.build(); |
| | | } |
| | | |
| | |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.asrs.entity.BasMap; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.service.BasMapService; |
| | | import com.zy.asrs.service.LocMastService; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.model.MapNode; |
| | |
| | | import com.zy.core.properties.SlaveProperties; |
| | | import com.zy.core.thread.ForkLiftThread; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.core.io.ClassPathResource; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.io.*; |
| | |
| | | |
| | | @Autowired |
| | | private SlaveProperties slaveProperties; |
| | | @Autowired |
| | | private BasMapService basMapService; |
| | | |
| | | public int[][] getData(Integer lev, Integer mapType, List<int[]> whitePoints, List<int[]> shuttlePoints) { |
| | | try { |
| | | // RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class); |
| | | // Object object = redisUtil.get(RedisKeyType.BASIC_MAP.key + lev); |
| | | // if (object == null) { |
| | | // return null; |
| | | // } |
| | | // |
| | | // //解析json地图数据 |
| | | // ArrayList arrayList = JSON.parseObject(object.toString(), ArrayList.class); |
| | | // List<List<MapNode>> lists = filterMap(mapType, arrayList, lev, whitePoints, shuttlePoints);//过滤地图数据 |
| | | // int[][] map = new int[lists.size()][]; |
| | | // int j = 0; |
| | | // for (List<MapNode> list : lists) { |
| | | // int[] tmp = new int[list.size()]; |
| | | // int i = 0; |
| | | // for (MapNode mapNode : list) { |
| | | // //将数据添加进二维数组 |
| | | // tmp[i++] = mapNode.getValue(); |
| | | // } |
| | | // //数据添加进一维数组 |
| | | // map[j++] = tmp; |
| | | // } |
| | | // |
| | | // return map; |
| | | BasMap basMap = basMapService.selectLatestMap(lev); |
| | | String originData = basMap.getOriginData(); |
| | | |
| | | String mapFilename = "map_" + lev + ".json"; |
| | | ClassPathResource classPathResource = new ClassPathResource(mapFilename); |
| | | InputStream inputStream = classPathResource.getInputStream(); |
| | | byte[] buffer = new byte[inputStream.available()]; |
| | | inputStream.read(buffer); |
| | | File file = File.createTempFile("prefix", "suffix"); |
| | | try (OutputStream outStream = new FileOutputStream(file)) { |
| | | outStream.write(buffer); |
| | | //解析json地图数据 |
| | | ArrayList arrayList = JSON.parseObject(originData, ArrayList.class); |
| | | List<List<MapNode>> lists = filterMap(mapType, arrayList, lev, whitePoints, shuttlePoints);//过滤地图数据 |
| | | int[][] map = new int[lists.size()][]; |
| | | int j = 0; |
| | | for (List<MapNode> list : lists) { |
| | | int[] tmp = new int[list.size()]; |
| | | int i = 0; |
| | | for (MapNode mapNode : list) { |
| | | //将数据添加进二维数组 |
| | | tmp[i++] = mapNode.getValue(); |
| | | } |
| | | //数据添加进一维数组 |
| | | map[j++] = tmp; |
| | | } |
| | | |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | if (file.isFile() && file.exists()) { |
| | | InputStreamReader isr = new InputStreamReader(new FileInputStream(file), "GBK"); |
| | | BufferedReader br = new BufferedReader(isr); |
| | | String lineTxt = null; |
| | | while ((lineTxt = br.readLine()) != null) { |
| | | stringBuffer.append(lineTxt); |
| | | } |
| | | br.close(); |
| | | |
| | | //解析json地图数据 |
| | | ArrayList arrayList = JSON.parseObject(stringBuffer.toString(), ArrayList.class); |
| | | List<List<MapNode>> lists = filterMap(mapType, arrayList, lev, whitePoints, shuttlePoints);//过滤地图数据 |
| | | int[][] map = new int[lists.size()][]; |
| | | int j = 0; |
| | | for (List<MapNode> list : lists) { |
| | | int[] tmp = new int[list.size()]; |
| | | int i = 0; |
| | | for (MapNode mapNode : list) { |
| | | //将数据添加进二维数组 |
| | | tmp[i++] = mapNode.getValue(); |
| | | } |
| | | //数据添加进一维数组 |
| | | map[j++] = tmp; |
| | | } |
| | | |
| | | if (!file.delete()) { |
| | | System.out.println("临时文件删除失败"); |
| | | } |
| | | return map; |
| | | } else { |
| | | System.out.println("文件不存在!"); |
| | | } |
| | | return map; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | return map; |
| | | } |
| | | |
| | | // //获取JSON格式数据 |
| | | // public List<List<MapNode>> getJsonData(Integer mapType, List<int[]> whitePoints, List<int[]> shuttlePoints) { |
| | | // try { |
| | | //// RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class); |
| | | //// Object object = redisUtil.get(RedisKeyType.BASIC_MAP.key + lev); |
| | | //// if (object == null) { |
| | | //// return null; |
| | | //// } |
| | | //// |
| | | //// //解析json地图数据 |
| | | //// ArrayList arrayList = JSON.parseObject(object.toString(), ArrayList.class); |
| | | //// List<List<MapNode>> lists = filterMap(mapType, arrayList, lev, whitePoints, shuttlePoints);//过滤地图数据 |
| | | //// return lists; |
| | | // |
| | | // |
| | | // String mapFilename = "map_" + lev + ".json"; |
| | | // ClassPathResource classPathResource = new ClassPathResource(mapFilename); |
| | | // InputStream inputStream = classPathResource.getInputStream(); |
| | | // byte[] buffer = new byte[inputStream.available()]; |
| | | // inputStream.read(buffer); |
| | | // File file = File.createTempFile("prefix","suffix"); |
| | | // try (OutputStream outStream = new FileOutputStream(file)) { |
| | | // outStream.write(buffer); |
| | | // } |
| | | // |
| | | // StringBuffer stringBuffer = new StringBuffer(); |
| | | // if (file.isFile() && file.exists()) { |
| | | // InputStreamReader isr = new InputStreamReader(new FileInputStream(file), "GBK"); |
| | | // BufferedReader br = new BufferedReader(isr); |
| | | // String lineTxt = null; |
| | | // while ((lineTxt = br.readLine()) != null) { |
| | | // stringBuffer.append(lineTxt); |
| | | // } |
| | | // br.close(); |
| | | // |
| | | // //解析json地图数据 |
| | | // ArrayList arrayList = JSON.parseObject(stringBuffer.toString(), ArrayList.class); |
| | | // List<List<MapNode>> lists = filterMap(mapType, arrayList, lev, whitePoints, shuttlePoints);//过滤地图数据 |
| | | // |
| | | // if (!file.delete()) { |
| | | // System.out.println("临时文件删除失败"); |
| | | // } |
| | | // |
| | | // return lists; |
| | | // } else { |
| | | // System.out.println("文件不存在!"); |
| | | // } |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // return null; |
| | | // } |
| | | |
| | | //获取JSON格式数据 |
| | | public List<List<MapNode>> getJsonData(Integer lev, Integer mapType, List<int[]> whitePoints, List<int[]> shuttlePoints) { |
| | | try { |
| | | // RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class); |
| | | // Object object = redisUtil.get(RedisKeyType.BASIC_MAP.key + lev); |
| | | // if (object == null) { |
| | | // return null; |
| | | // } |
| | | // |
| | | // //解析json地图数据 |
| | | // ArrayList arrayList = JSON.parseObject(object.toString(), ArrayList.class); |
| | | // List<List<MapNode>> lists = filterMap(mapType, arrayList, lev, whitePoints, shuttlePoints);//过滤地图数据 |
| | | // return lists; |
| | | |
| | | String mapFilename = "map_" + lev + ".json"; |
| | | ClassPathResource classPathResource = new ClassPathResource(mapFilename); |
| | | InputStream inputStream = classPathResource.getInputStream(); |
| | | byte[] buffer = new byte[inputStream.available()]; |
| | | inputStream.read(buffer); |
| | | File file = File.createTempFile("prefix","suffix"); |
| | | try (OutputStream outStream = new FileOutputStream(file)) { |
| | | outStream.write(buffer); |
| | | } |
| | | |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | if (file.isFile() && file.exists()) { |
| | | InputStreamReader isr = new InputStreamReader(new FileInputStream(file), "GBK"); |
| | | BufferedReader br = new BufferedReader(isr); |
| | | String lineTxt = null; |
| | | while ((lineTxt = br.readLine()) != null) { |
| | | stringBuffer.append(lineTxt); |
| | | } |
| | | br.close(); |
| | | |
| | | //解析json地图数据 |
| | | ArrayList arrayList = JSON.parseObject(stringBuffer.toString(), ArrayList.class); |
| | | //重建数据格式 |
| | | List<List<MapNode>> lists = rebuildData(arrayList); |
| | | |
| | | if (!file.delete()) { |
| | | System.out.println("临时文件删除失败"); |
| | | } |
| | | |
| | | return lists; |
| | | } else { |
| | | System.out.println("文件不存在!"); |
| | | } |
| | | BasMap basMap = basMapService.selectLatestMap(lev); |
| | | String originData = basMap.getOriginData(); |
| | | //解析json地图数据 |
| | | ArrayList arrayList = JSON.parseObject(originData, ArrayList.class); |
| | | //重建数据格式 |
| | | List<List<MapNode>> lists = rebuildData(arrayList); |
| | | return lists; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="last_data" property="lastData" /> |
| | | <result column="lev" property="lev" /> |
| | | <result column="origin_data" property="originData" /> |
| | | |
| | | </resultMap> |
| | | |
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: '#basMap', |
| | | headers: {token: localStorage.getItem('token')}, |
| | | url: baseUrl+'/basMap/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: 'data', align: 'center',title: '实时数据'} |
| | | ,{field: 'createTime$', align: 'center',title: '创建时间'} |
| | | ,{field: 'updateTime$', align: 'center',title: '更新时间'} |
| | | ,{field: 'lastData', align: 'center',title: '最近数据'} |
| | | ,{field: 'lev', align: 'center',title: '层数'} |
| | | ,{field: 'originData', 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(basMap)', 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(basMap)', 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 = { |
| | | 'basMap': exportData, |
| | | 'fields': fields |
| | | }; |
| | | $.ajax({ |
| | | url: baseUrl+"/basMap/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(basMap)', 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+"/basMap/"+(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+"/basMap/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} |
| | | }); |
| | | } |
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"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input" type="text" name="id" placeholder="编号" autocomplete="off"> |
| | | </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 class="layui-input" type="text" name="condition" 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="basMap" lay-filter="basMap"></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/basMap/basMap.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">层数: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="lev" placeholder="请输入"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">原始地图: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="originData" 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> |
| | | |
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/cool.css" media="all"> |
| | | <link rel="stylesheet" href="../../../static/css/common.css" media="all"> |
| | | </head> |
| | | <body> |
| | | |
| | | <!-- 详情 --> |
| | | <div id="data-detail" class="layer_self_wrap"> |
| | | <form id="detail" class="layui-form"> |
| | | <!-- |
| | | <div class="layui-inline" style="display: none"> |
| | | <label class="layui-form-label"><span class="not-null">*</span>编 号:</label> |
| | | <div class="layui-input-inline"> |
| | | <input id="id" class="layui-input" type="text" placeholder="编号"> |
| | | </div> |
| | | </div> |
| | | --> |
| | | <div class="layui-inline" style="width:31%;"> |
| | | <label class="layui-form-label"><span class="not-null">*</span>#:</label> |
| | | <div class="layui-input-inline"> |
| | | <input id="id" class="layui-input" type="text" onkeyup="check(this.id, 'basMap')" lay-verify="number" > |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline" style="width:31%;"> |
| | | <label class="layui-form-label">实时数据:</label> |
| | | <div class="layui-input-inline"> |
| | | <input id="data" class="layui-input" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline" style="width:31%;"> |
| | | <label class="layui-form-label">创建时间:</label> |
| | | <div class="layui-input-inline"> |
| | | <input id="createTime$" class="layui-input" type="text" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline" style="width:31%;"> |
| | | <label class="layui-form-label">更新时间:</label> |
| | | <div class="layui-input-inline"> |
| | | <input id="updateTime$" class="layui-input" type="text" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline" style="width:31%;"> |
| | | <label class="layui-form-label">最近数据:</label> |
| | | <div class="layui-input-inline"> |
| | | <input id="lastData" class="layui-input" type="text"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline" style="width:31%;"> |
| | | <label class="layui-form-label">层数:</label> |
| | | <div class="layui-input-inline"> |
| | | <input id="lev" class="layui-input" type="text" lay-verify="number" > |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline" style="width:31%;"> |
| | | <label class="layui-form-label">原始地图:</label> |
| | | <div class="layui-input-inline"> |
| | | <input id="originData" class="layui-input" type="text"> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | <hr class="layui-bg-gray"> |
| | | |
| | | <div id="data-detail-btn" class="layui-btn-container layui-form-item"> |
| | | <div id="data-detail-submit-save" type="button" class="layui-btn layui-btn-normal" lay-submit lay-filter="save">保存</div> |
| | | <div id="data-detail-submit-edit" type="button" class="layui-btn layui-btn-normal" lay-submit lay-filter="edit">修改</div> |
| | | <div id="data-detail-close" type="button" class="layui-btn" lay-submit lay-filter="close">关闭</div> |
| | | </div> |
| | | |
| | | <div id="prompt"> |
| | | 温馨提示:请仔细填写相关信息,<span class="extrude"><span class="not-null">*</span> 为必填选项。</span> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | </body>da |
| | | <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/basMap/basMap.js" charset="utf-8"></script> |
| | | </html> |
| | | |
| | |
| | | map: [],//地图数据 |
| | | currentLev: 1,//地图当前楼层 |
| | | siteWindow: false, //站点弹窗显示默认不显示 |
| | | floorList: [1, 2, 3, 4], //当前项目楼层 |
| | | floorList: [], //当前项目楼层 |
| | | shuttleList: [], //四向穿梭车集合 |
| | | currentLevShuttleList: [],//当前楼层四向穿梭车集合 |
| | | shuttleColorList: [],//四向穿梭车颜色集合 |
| | |
| | | |
| | | this.getMap(this.currentLev) |
| | | this.getSystemRunningStatus() //获取系统运行状态 |
| | | this.initLev()//初始化楼层信息 |
| | | |
| | | this.consoleInterval = setInterval(() => { |
| | | this.getShuttleStateInfo() //获取四向穿梭车信息 |
| | |
| | | } |
| | | }) |
| | | }, |
| | | initLoc() { |
| | | //初始化库位 |
| | | initLev(){ |
| | | let that = this |
| | | $.ajax({ |
| | | url:baseUrl+"/locMast/init", |
| | | headers:{ |
| | | url: baseUrl + "/console/map/lev/list", |
| | | headers: { |
| | | 'token': localStorage.getItem('token') |
| | | }, |
| | | data:{}, |
| | | method:'post', |
| | | success:function (res) { |
| | | that.$message({ |
| | | message: '初始化完成', |
| | | type: 'success' |
| | | }); |
| | | data: {}, |
| | | method: 'get', |
| | | success: function(res) { |
| | | if (res.code === 200) { |
| | | that.floorList = res.data; |
| | | } else if (res.code === 403) { |
| | | parent.location.href = baseUrl + "/login"; |
| | | } else { |
| | | that.$message({ |
| | | message: res.msg, |
| | | type: 'error' |
| | | }); |
| | | } |
| | | } |
| | | }) |
| | | }); |
| | | }, |
| | | getCodeData(){ |
| | | this.sendWs(JSON.stringify({ |