| | |
| | | // generator.password="xltys1995"; |
| | | // generator.table="sys_host"; |
| | | // sqlserver |
| | | generator.url="localhost:1433;databasename=htwms"; |
| | | generator.url="localhost:1433;databasename=htasrs"; |
| | | generator.username="sa"; |
| | | generator.password="sa@123"; |
| | | generator.table="erp_doc_log"; |
| | |
| | | private PakoutService pakoutService; |
| | | @Autowired |
| | | private NodeService nodeService; |
| | | @Autowired |
| | | private DocLogService docLogService; |
| | | |
| | | /** |
| | | * 商品下载 |
| | |
| | | // @PostConstruct |
| | | public void finishOrdersExecute(){ |
| | | try { |
| | | Date now = new Date(); |
| | | List<Order> orders = orderService.selectList(new EntityWrapper<Order>().eq("settle", 4).isNotNull("number")); |
| | | if (!Cools.isEmpty(orders)) { |
| | | List<String> orderNos = orders.stream().map(Order::getOrderNo).distinct().collect(Collectors.toList()); |
| | |
| | | List<GetOrderResultDetl0> list = new ArrayList<>(); |
| | | getOrderResult0.setDetail(list); |
| | | |
| | | // 日志 |
| | | List<DocLog> docLogs = new ArrayList<>(); |
| | | |
| | | // 头 |
| | | getOrderResult0.setNumber(order.getOrderNo()); |
| | |
| | | detl0.setUnit(orderDetl.getUnit()); |
| | | detl0.setRowNo(Integer.parseInt(orderDetl.getName())); |
| | | list.add(detl0); |
| | | |
| | | // 日志 |
| | | docLogs.add(new DocLog( |
| | | order.getOrderNo(), // 单据编号 |
| | | 11L, // 单据类型 |
| | | "销售订单", // 单据名称 |
| | | orderDetl.getMatnr(), // 商品编号 |
| | | orderDetl.getCount(), // 上报数量 |
| | | 1, // 结果 |
| | | now, // 上报时间 |
| | | null // 备注 |
| | | )); |
| | | } |
| | | |
| | | log.warn(JSON.toJSONString(getOrderResult0)); |
| | |
| | | .setJson(JSON.toJSONString(getOrderResult0)) |
| | | .build() |
| | | .doPost(); |
| | | |
| | | try { |
| | | docLogService.insertBatch(docLogs); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage()); |
| | | } |
| | | |
| | | if (!Cools.isEmpty(response)) { |
| | | log.warn(response); |
| | | Result result = JSON.parseObject(response, Result.class); |
| | |
| | | // @PostConstruct |
| | | public void finishOrders0Execute(){ |
| | | try { |
| | | Date now = new Date(); |
| | | List<Order> orders = orderService.selectList(new EntityWrapper<Order>().eq("settle", 4).eq("doc_type", 6)); |
| | | if (!Cools.isEmpty(orders)) { |
| | | List<String> orderNos = orders.stream().map(Order::getOrderNo).distinct().collect(Collectors.toList()); |
| | |
| | | List<GetOrderResultDetl0> list = new ArrayList<>(); |
| | | getOrderResult0.setDetail(list); |
| | | |
| | | // 日志 |
| | | List<DocLog> docLogs = new ArrayList<>(); |
| | | |
| | | // 头 |
| | | getOrderResult0.setNumber(order.getOrderNo()); |
| | |
| | | detl0.setUnit(orderDetl.getUnit()); |
| | | detl0.setComment(orderDetl.getMemo()); |
| | | list.add(detl0); |
| | | |
| | | // 日志 |
| | | docLogs.add(new DocLog( |
| | | order.getOrderNo(), // 单据编号 |
| | | 6L, // 单据类型 |
| | | "采购退货订单", // 单据名称 |
| | | orderDetl.getMatnr(), // 商品编号 |
| | | orderDetl.getCount(), // 上报数量 |
| | | 1, // 结果 |
| | | now, // 上报时间 |
| | | null // 备注 |
| | | )); |
| | | } |
| | | |
| | | System.out.println(JSON.toJSONString(getOrderResult0)); |
| | | |
| | | |
| | | String response = new HttpHandler.Builder() |
| | | .setUri(URI) |
| | |
| | | .setJson(JSON.toJSONString(getOrderResult0)) |
| | | .build() |
| | | .doPost(); |
| | | |
| | | try { |
| | | docLogService.insertBatch(docLogs); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage()); |
| | | } |
| | | |
| | | if (!Cools.isEmpty(response)) { |
| | | log.warn(response); |
| | | Result result = JSON.parseObject(response, Result.class); |
| | |
| | | import zy.cloud.wms.common.model.BillDto; |
| | | import zy.cloud.wms.common.service.erp.entity.UploadBill; |
| | | import zy.cloud.wms.common.service.erp.entity.UploadBillDetail; |
| | | import zy.cloud.wms.manager.entity.DocLog; |
| | | import zy.cloud.wms.manager.entity.DocType; |
| | | import zy.cloud.wms.manager.entity.Mat; |
| | | import zy.cloud.wms.manager.entity.RequestLog; |
| | | import zy.cloud.wms.manager.service.DocLogService; |
| | | import zy.cloud.wms.manager.service.DocTypeService; |
| | | import zy.cloud.wms.manager.service.MatService; |
| | | import zy.cloud.wms.manager.service.RequestLogService; |
| | |
| | | private MatService matService; |
| | | @Autowired |
| | | private RequestLogService requestLogService; |
| | | @Autowired |
| | | private DocLogService docLogService; |
| | | |
| | | /** |
| | | * 单据上报 |
| | | */ |
| | | public ErpR uploadBill(List<BillDto> dtos, Integer docId, String docNumber){ |
| | | try { |
| | | Date now = new Date(); |
| | | if (Cools.isEmpty(dtos)) { |
| | | return new ErpR(false, null); |
| | | } |
| | |
| | | if (Cools.isEmpty(docType)) { |
| | | return new ErpR(false, null); |
| | | } |
| | | |
| | | // 日志 |
| | | List<DocLog> docLogs = new ArrayList<>(); |
| | | |
| | | UploadBill uploadBill = new UploadBill(); |
| | | uploadBill.setNumber(docNumber); |
| | |
| | | detl.setPrice(0); |
| | | detl.setUnit(mat==null?"暂无":mat.getUnit()); |
| | | detail.add(detl); |
| | | |
| | | // 日志 |
| | | docLogs.add(new DocLog( |
| | | docNumber, // 单据编号 |
| | | docId.longValue(), // 单据类型 |
| | | null, // 单据名称 |
| | | dto.getMatnr(), // 商品编号 |
| | | dto.getQty(), // 上报数量 |
| | | 1, // 结果 |
| | | now, // 上报时间 |
| | | null // 备注 |
| | | )); |
| | | } |
| | | log.warn(JSON.toJSONString(uploadBill)); |
| | | String response = new HttpHandler.Builder() |
| | |
| | | .doPost(); |
| | | |
| | | try { |
| | | docLogService.insertBatch(docLogs); |
| | | |
| | | // 日志记录 |
| | | RequestLog logInfo = new RequestLog(); |
| | | logInfo.setName("单据上传,单据类型" + docId); |
New file |
| | |
| | | package zy.cloud.wms.manager.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 zy.cloud.wms.manager.entity.DocLog; |
| | | import zy.cloud.wms.manager.service.DocLogService; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import zy.cloud.wms.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | | public class DocLogController extends BaseController { |
| | | |
| | | @Autowired |
| | | private DocLogService docLogService; |
| | | |
| | | @RequestMapping(value = "/docLog/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") String id) { |
| | | return R.ok(docLogService.selectById(String.valueOf(id))); |
| | | } |
| | | |
| | | @RequestMapping(value = "/docLog/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<DocLog> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | return R.ok(docLogService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private void convert(Map<String, Object> map, EntityWrapper 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 = "/docLog/add/auth") |
| | | @ManagerAuth |
| | | public R add(DocLog docLog) { |
| | | docLogService.insert(docLog); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/docLog/update/auth") |
| | | @ManagerAuth |
| | | public R update(DocLog docLog){ |
| | | if (Cools.isEmpty(docLog) || null==docLog.getId()){ |
| | | return R.error(); |
| | | } |
| | | docLogService.updateById(docLog); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/docLog/delete/auth") |
| | | @ManagerAuth |
| | | public R delete(@RequestParam(value="ids[]") Long[] ids){ |
| | | for (Long id : ids){ |
| | | docLogService.deleteById(id); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/docLog/export/auth") |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | EntityWrapper<DocLog> wrapper = new EntityWrapper<>(); |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("docLog")); |
| | | convert(map, wrapper); |
| | | List<DocLog> list = docLogService.selectList(wrapper); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/docLogQuery/auth") |
| | | @ManagerAuth |
| | | public R query(String condition) { |
| | | EntityWrapper<DocLog> wrapper = new EntityWrapper<>(); |
| | | wrapper.like("id", condition); |
| | | Page<DocLog> page = docLogService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (DocLog docLog : page.getRecords()){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", docLog.getId()); |
| | | map.put("value", docLog.getId()); |
| | | result.add(map); |
| | | } |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @RequestMapping(value = "/docLog/check/column/auth") |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<DocLog> wrapper = new EntityWrapper<DocLog>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != docLogService.selectOne(wrapper)){ |
| | | return R.parse(BaseRes.REPEAT).add(getComment(DocLog.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package zy.cloud.wms.manager.entity; |
| | | |
| | | import com.core.common.Cools;import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import java.io.Serializable; |
| | | |
| | | @TableName("erp_doc_log") |
| | | public class DocLog implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ID |
| | | */ |
| | | @ApiModelProperty(value= "ID") |
| | | private Long id; |
| | | |
| | | /** |
| | | * 单据编号 |
| | | */ |
| | | @ApiModelProperty(value= "单据编号") |
| | | @TableField("doc_num") |
| | | private String docNum; |
| | | |
| | | /** |
| | | * 单据类型 |
| | | */ |
| | | @ApiModelProperty(value= "单据类型") |
| | | @TableField("doc_id") |
| | | private Long docId; |
| | | |
| | | /** |
| | | * 单据名称 |
| | | */ |
| | | @ApiModelProperty(value= "单据名称") |
| | | @TableField("doc_name") |
| | | private String docName; |
| | | |
| | | /** |
| | | * 商品编号 |
| | | */ |
| | | @ApiModelProperty(value= "商品编号") |
| | | private String matnr; |
| | | |
| | | /** |
| | | * 上报数量 |
| | | */ |
| | | @ApiModelProperty(value= "上报数量") |
| | | private Double qua; |
| | | |
| | | /** |
| | | * 结果 1: 成功 0: 失败 |
| | | */ |
| | | @ApiModelProperty(value= "结果 1: 成功 0: 失败 ") |
| | | private Integer success; |
| | | |
| | | /** |
| | | * 上报时间 |
| | | */ |
| | | @ApiModelProperty(value= "上报时间") |
| | | @TableField("send_time") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date sendTime; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @ApiModelProperty(value= "备注") |
| | | private String memo; |
| | | |
| | | public DocLog() {} |
| | | |
| | | public DocLog(String docNum,Long docId,String docName,String matnr,Double qua,Integer success,Date sendTime,String memo) { |
| | | this.docNum = docNum; |
| | | this.docId = docId; |
| | | this.docName = docName; |
| | | this.matnr = matnr; |
| | | this.qua = qua; |
| | | this.success = success; |
| | | this.sendTime = sendTime; |
| | | this.memo = memo; |
| | | } |
| | | |
| | | // DocLog docLog = new DocLog( |
| | | // null, // 单据编号 |
| | | // null, // 单据类型 |
| | | // null, // 单据名称 |
| | | // null, // 商品编号 |
| | | // null, // 上报数量 |
| | | // null, // 结果 |
| | | // null, // 上报时间 |
| | | // null // 备注 |
| | | // ); |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getDocNum() { |
| | | return docNum; |
| | | } |
| | | |
| | | public void setDocNum(String docNum) { |
| | | this.docNum = docNum; |
| | | } |
| | | |
| | | public Long getDocId() { |
| | | return docId; |
| | | } |
| | | |
| | | public void setDocId(Long docId) { |
| | | this.docId = docId; |
| | | } |
| | | |
| | | public String getDocName() { |
| | | return docName; |
| | | } |
| | | |
| | | public void setDocName(String docName) { |
| | | this.docName = docName; |
| | | } |
| | | |
| | | public String getMatnr() { |
| | | return matnr; |
| | | } |
| | | |
| | | public void setMatnr(String matnr) { |
| | | this.matnr = matnr; |
| | | } |
| | | |
| | | public Double getQua() { |
| | | return qua; |
| | | } |
| | | |
| | | public void setQua(Double qua) { |
| | | this.qua = qua; |
| | | } |
| | | |
| | | public Integer getSuccess() { |
| | | return success; |
| | | } |
| | | |
| | | public String getSuccess$(){ |
| | | if (null == this.success){ return null; } |
| | | switch (this.success){ |
| | | case 1: |
| | | return "成功"; |
| | | case 0: |
| | | return "失败"; |
| | | default: |
| | | return String.valueOf(this.success); |
| | | } |
| | | } |
| | | |
| | | public void setSuccess(Integer success) { |
| | | this.success = success; |
| | | } |
| | | |
| | | public Date getSendTime() { |
| | | return sendTime; |
| | | } |
| | | |
| | | public String getSendTime$(){ |
| | | if (Cools.isEmpty(this.sendTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.sendTime); |
| | | } |
| | | |
| | | public void setSendTime(Date sendTime) { |
| | | this.sendTime = sendTime; |
| | | } |
| | | |
| | | public String getMemo() { |
| | | return memo; |
| | | } |
| | | |
| | | public void setMemo(String memo) { |
| | | this.memo = memo; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package zy.cloud.wms.manager.mapper; |
| | | |
| | | import zy.cloud.wms.manager.entity.DocLog; |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface DocLogMapper extends BaseMapper<DocLog> { |
| | | |
| | | } |
New file |
| | |
| | | package zy.cloud.wms.manager.service; |
| | | |
| | | import zy.cloud.wms.manager.entity.DocLog; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | public interface DocLogService extends IService<DocLog> { |
| | | |
| | | } |
New file |
| | |
| | | package zy.cloud.wms.manager.service.impl; |
| | | |
| | | import zy.cloud.wms.manager.mapper.DocLogMapper; |
| | | import zy.cloud.wms.manager.entity.DocLog; |
| | | import zy.cloud.wms.manager.service.DocLogService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("docLogService") |
| | | public class DocLogServiceImpl extends ServiceImpl<DocLogMapper, DocLog> implements DocLogService { |
| | | |
| | | } |
| | |
| | | # password: xltys1995 |
| | | # sql-server |
| | | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| | | url: jdbc:sqlserver://192.168.1.56:1433;databasename=htasrs |
| | | url: jdbc:sqlserver://localhost:1433;databasename=htasrs |
| | | username: sa |
| | | password: sa@123 |
| | | mvc: |
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="zy.cloud.wms.manager.mapper.DocLogMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="zy.cloud.wms.manager.entity.DocLog"> |
| | | <id column="id" property="id" /> |
| | | <result column="doc_num" property="docNum" /> |
| | | <result column="doc_id" property="docId" /> |
| | | <result column="doc_name" property="docName" /> |
| | | <result column="matnr" property="matnr" /> |
| | | <result column="qua" property="qua" /> |
| | | <result column="success" property="success" /> |
| | | <result column="send_time" property="sendTime" /> |
| | | <result column="memo" property="memo" /> |
| | | |
| | | </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: '#docLog', |
| | | headers: {token: localStorage.getItem('token')}, |
| | | url: baseUrl+'/docLog/list/auth', |
| | | page: true, |
| | | limit: 16, |
| | | limits: [16, 30, 50, 100, 200, 500], |
| | | toolbar: '#toolbar', |
| | | cellMinWidth: 50, |
| | | cols: [[ |
| | | {type: 'checkbox'} |
| | | ,{field: 'id', align: 'center',title: 'ID', hide: true} |
| | | ,{field: 'docNum', align: 'center',title: '单据编号'} |
| | | ,{field: 'docId', align: 'center',title: '单据类型'} |
| | | ,{field: 'docName', align: 'center',title: '单据名称'} |
| | | ,{field: 'matnr', align: 'center',title: '商品编号'} |
| | | ,{field: 'qua', align: 'center',title: '上报数量'} |
| | | ,{field: 'success$', align: 'center',title: '结果', hide: true} |
| | | ,{field: 'sendTime$', align: 'center',title: '上报时间'} |
| | | ,{field: 'memo', align: 'center',title: '备注', hide: true} |
| | | |
| | | ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:150} |
| | | ]], |
| | | 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(docLog)', 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(docLog)', 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; |
| | | } |
| | | var ids = checkStatus.map(function (d) { |
| | | return d.id; |
| | | }); |
| | | del(ids); |
| | | break; |
| | | case 'exportData': |
| | | layer.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 = { |
| | | 'docLog': exportData, |
| | | 'fields': fields |
| | | }; |
| | | $.ajax({ |
| | | url: baseUrl+"/docLog/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(docLog)', function(obj){ |
| | | var data = obj.data; |
| | | switch (obj.event) { |
| | | case 'edit': |
| | | showEditModel(data); |
| | | break; |
| | | case "del": |
| | | var ids = [data.id]; |
| | | del(ids); |
| | | break; |
| | | } |
| | | }); |
| | | |
| | | /* 弹窗 - 新增、修改 */ |
| | | function showEditModel(mData) { |
| | | admin.open({ |
| | | type: 1, |
| | | area: '600px', |
| | | title: (mData ? '修改' : '添加') + '订单状态', |
| | | content: $('#editDialog').html(), |
| | | success: function (layero, dIndex) { |
| | | layDateRender(); |
| | | form.val('detail', mData); |
| | | form.on('submit(editSubmit)', function (data) { |
| | | var loadIndex = layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl+"/docLog/"+(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+"/docLog/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() { |
| | | layDate.render({ |
| | | elem: '#sendTime\\$', |
| | | type: 'datetime' |
| | | }); |
| | | |
| | | } |
| | | 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"> |
| | | <link rel="stylesheet" href="../../static/css/common.css" media="all"> |
| | | </head> |
| | | <body> |
| | | |
| | | <!-- 搜索栏 --> |
| | | <div id="search-box" class="layui-form layui-card-header"> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input" type="text" name="id" placeholder="编号" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | <!-- 待添加 --> |
| | | <div id="data-search-btn" class="layui-btn-container layui-form-item"> |
| | | <button id="search" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="search">搜索</button> |
| | | <button id="reset" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="reset">重置</button> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- 表格 --> |
| | | <div class="layui-form"> |
| | | <table class="layui-hide" id="docLog" lay-filter="docLog"></table> |
| | | </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" id="btn-delete" lay-event="deleteData">删除</button> |
| | | <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData">导出</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/docLog/docLog.js" charset="utf-8"></script> |
| | | </body> |
| | | <!-- 表单弹窗 --> |
| | | <script type="text/html" id="editDialog"> |
| | | <form id="detail" lay-filter="detail" class="layui-form admin-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="docNum" placeholder="请输入单据编号"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">单据类型: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="docId" placeholder="请输入单据类型"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">单据名称: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="docName" placeholder="请输入单据名称"> |
| | | </div> |
| | | </div> |
| | | <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="qua" placeholder="请输入上报数量"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">结果: </label> |
| | | <div class="layui-input-block"> |
| | | <select name="success"> |
| | | <option value="">请选择结果</option> |
| | | <option value="1">成功</option> |
| | | <option value="0">失败</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="sendTime" id="sendTime$" placeholder="请输入上报时间"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">备注: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="memo" 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> |
| | | |