From 32bb782c3ff2dee184e485f1ebd71c10313571a1 Mon Sep 17 00:00:00 2001
From: 王佳豪 <g675230687@126.com>
Date: 星期六, 10 七月 2021 16:13:53 +0800
Subject: [PATCH] 1.平仓库存管理新增导出功能
---
src/main/java/com/zy/asrs/controller/LocNormalController.java | 13 ++++++
src/main/webapp/static/js/locNormal/locNormal.js | 50 ++++++++++++++++++++-----
src/main/java/com/zy/asrs/entity/LocNormal.java | 30 +++++++++++++++
src/main/webapp/views/locNormal/locNormal.html | 1
4 files changed, 84 insertions(+), 10 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/LocNormalController.java b/src/main/java/com/zy/asrs/controller/LocNormalController.java
index 36261c9..30c9cd1 100644
--- a/src/main/java/com/zy/asrs/controller/LocNormalController.java
+++ b/src/main/java/com/zy/asrs/controller/LocNormalController.java
@@ -174,6 +174,19 @@
return R.ok("鎴愬姛瀵煎叆" + listener.getTotal() + "鏉$墿鏂欎俊鎭�");
}
+ /* 瀵煎嚭 */
+ @RequestMapping(value = "/locNormal/export/auth")
+ @ManagerAuth(memo = "骞充粨绠$悊瀵煎嚭")
+ public R export(@RequestBody JSONObject param){
+ List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class);
+ EntityWrapper<LocNormal> wrapper = new EntityWrapper<LocNormal>();
+ wrapper.ne("state", "3");
+ Map<String, Object> map = excludeTrash(param.getJSONObject("exportData"));
+ convert(map, wrapper);
+ List<LocNormal> list = locNormalService.selectList(wrapper);
+ return R.ok(exportSupport(list, fields));
+ }
+
/* 骞充粨鍏ュ簱 鎴愬搧 */
@RequestMapping(value = "/locNormal/in")
@ManagerAuth(memo = "骞充粨鍏ュ簱")
diff --git a/src/main/java/com/zy/asrs/entity/LocNormal.java b/src/main/java/com/zy/asrs/entity/LocNormal.java
index bbd8357..76a6d42 100644
--- a/src/main/java/com/zy/asrs/entity/LocNormal.java
+++ b/src/main/java/com/zy/asrs/entity/LocNormal.java
@@ -4,9 +4,11 @@
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.zy.asrs.service.LocMastService;
import com.zy.system.entity.User;
import com.zy.system.service.UserService;
+import com.zy.asrs.service.LocAreaService;
import com.core.common.Cools;
import com.core.common.SpringUtils;
import io.swagger.annotations.ApiModelProperty;
@@ -51,6 +53,9 @@
@TableField(exist = false)
private String warehouseName;
+ @TableField(exist = false)
+ private String warehouse$;
+
@ApiModelProperty(value= "鍝佺墝")
private String brand;
@@ -87,6 +92,9 @@
private String state;
@TableField(exist = false)
+ private String getState$;
+
+ @TableField(exist = false)
private BigDecimal anfmeOut;
public String getModiUser$(){
@@ -122,4 +130,26 @@
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.appeTime);
}
+ public String getWarehouse$() {
+ LocAreaService warehouse = SpringUtils.getBean(LocAreaService.class);
+ LocArea warehouseName = warehouse.selectOne(new EntityWrapper<LocArea>().eq("uuid", this.warehouse));
+ if (!Cools.isEmpty(warehouseName)){
+ return String.valueOf(warehouseName.getName());
+ }
+ return null;
+ }
+
+ public String getState$() {
+ String txt = "";
+ switch (this.state) {
+ case "1":
+ txt = "宸插叆搴�";
+ break;
+ case "2":
+ txt = "宸插嚭搴�";
+ break;
+ }
+ return txt;
+ }
+
}
diff --git a/src/main/webapp/static/js/locNormal/locNormal.js b/src/main/webapp/static/js/locNormal/locNormal.js
index 28424f4..4aba517 100644
--- a/src/main/webapp/static/js/locNormal/locNormal.js
+++ b/src/main/webapp/static/js/locNormal/locNormal.js
@@ -10,7 +10,7 @@
cols.push.apply(cols, locNormalCols);
cols.push(
{field: 'warehouse$', align: 'center', title: '搴撳尯'}
- , {field: 'state', align: 'center', title: '鍑哄叆搴撶姸鎬�', templet: '#locNormalState'}
+ , {field: 'state$', align: 'center', title: '鍑哄叆搴撶姸鎬�', templet: '#locNormalState'}
, {field: 'modiUser$', align: 'center', title: '淇敼浜哄憳', hide: true}
, {field: 'modiTime$', align: 'center', title: '淇敼鏃堕棿', hide: true}
, {field: 'appeTime$', align: 'center', title: '鍒涘缓鏃堕棿', hide: true}
@@ -107,6 +107,45 @@
}
});
break;
+ // 瀵煎嚭
+ case 'exportData':
+ layer.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function(){
+ var fields=[];
+ var titles=[];
+ var exportData = {};
+ 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);
+ }
+ });
+ $.each($('#search-box [name]').serializeArray(), function() {
+ exportData[this.name] = this.value;
+ });
+ var param = {
+ 'exportData': exportData,
+ 'fields': fields
+ };
+ $.ajax({
+ url: baseUrl+"/locNormal/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)
+ }
+ }
+ });
+ });
+ break;
}
});
@@ -128,15 +167,6 @@
pageSize: 'limit'
},
parseData: function (res) {
- // 瑙f瀽搴撳尯鍚嶇О
- var records = res.data.records;
- records.map(function (item) {
- locArea.map(function (d) {
- if (d.uuid == item.warehouse) {
- item.warehouse$ = d.name;
- }
- })
- });
return {
'code': res.code,
'msg': res.msg,
diff --git a/src/main/webapp/views/locNormal/locNormal.html b/src/main/webapp/views/locNormal/locNormal.html
index dbc2095..e4ef433 100644
--- a/src/main/webapp/views/locNormal/locNormal.html
+++ b/src/main/webapp/views/locNormal/locNormal.html
@@ -138,6 +138,7 @@
<script type="text/html" id="toolbar">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-sm" id="btn-locNormal-into" lay-event="intoData">瀵煎叆</button>
+ <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData">瀵煎嚭</button>
</div>
</script>
--
Gitblit v1.9.1