14 changed files with 489 additions and 130 deletions
@ -0,0 +1,272 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
|||
<head> |
|||
<meta charset="utf-8"> |
|||
<title>layui</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/lib/layui-v2.6.3/css/layui.css" media="all"> |
|||
<link rel="stylesheet" href="/static/css/public.css" media="all"> |
|||
<link rel="stylesheet" href="/static/lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all"> |
|||
|
|||
</head> |
|||
<body> |
|||
<div class="layuimini-container"> |
|||
<div class="layui-row"> |
|||
<div class="layui-col-md8"> |
|||
<div class="layui-tab" lay-filter="roleSet"> |
|||
<ul class="layui-tab-title"> |
|||
<li class="layui-this" tabType="person">人员</li> |
|||
<li tabType="post">岗位</li> |
|||
</ul> |
|||
<div class="layui-tab-content"> |
|||
<div class="layui-tab-item layui-show"> |
|||
<form class="layui-form layui-form-pane" action=""> |
|||
<div class="layui-form-item"> |
|||
<div class="layui-inline"> |
|||
<label class="layui-form-label">人员姓名</label> |
|||
<div class="layui-input-inline"> |
|||
<input type="text" name="name" autocomplete="off" class="layui-input"> |
|||
</div> |
|||
</div> |
|||
<div class="layui-inline"> |
|||
<label class="layui-form-label">人员工号</label> |
|||
<div class="layui-input-inline"> |
|||
<input type="text" name="number" autocomplete="off" class="layui-input"> |
|||
</div> |
|||
</div> |
|||
<div class="layui-inline"> |
|||
<button type="submit" class="layui-btn layui-btn-primary" lay-submit |
|||
lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索 |
|||
</button> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
<table class="layui-hide" id="currentTableForUser" |
|||
lay-filter="currentTableFilterForUser"></table> |
|||
</div> |
|||
<div class="layui-tab-item"> |
|||
<div id="postTree" class="demo-tree"></div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="layui-col-md4"> |
|||
<div id="depositoryTree" class="demo-tree"></div> |
|||
<button type="button" class="layui-btn layui-btn-primary layui-border-blue" onclick="Impower()">授权</button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script> |
|||
|
|||
<script> |
|||
|
|||
|
|||
function Impower() { |
|||
|
|||
} |
|||
|
|||
// 用于标志是否为第一次提交 |
|||
let flagForForm = false; |
|||
layui.use(['form', 'layer', 'tree', 'element', 'table'], function () { |
|||
var $ = layui.jquery, |
|||
form = layui.form, |
|||
tree = layui.tree, |
|||
element = layui.element, |
|||
table = layui.table, |
|||
layer = layui.layer; |
|||
|
|||
|
|||
let tabType = "person"; |
|||
|
|||
let depositoryTree; |
|||
let postTree; |
|||
element.on('tab(roleSet)', function (data) { |
|||
tabType = $(this).attr("tabType"); |
|||
if (tabType === "post") { |
|||
$.ajax({ |
|||
url: "/company/getOrgAndPostThree", |
|||
type: 'get', |
|||
dataType: 'json', |
|||
contentType: "application/json;charset=utf-8", |
|||
beforeSend: function () { |
|||
}, |
|||
success: function (d) { |
|||
var data2 = d.data; |
|||
postTree.reload({ |
|||
data: data2 |
|||
}); |
|||
}, |
|||
|
|||
}); |
|||
} else { |
|||
table.reload('currentTableForUser', { |
|||
url: '/sys/findUsers', |
|||
page: { |
|||
curr: 1 |
|||
}, |
|||
}, 'data'); |
|||
} |
|||
|
|||
}); |
|||
|
|||
table.render({ |
|||
elem: '#currentTableForUser', |
|||
url: '/sys/findUsers', |
|||
method: "POST", |
|||
parseData: function (res) { //res 即为原始返回的数据 |
|||
return { |
|||
"status": res.status, //解析接口状态 |
|||
"message": res.statusInfo.message, //解析提示文本 |
|||
"count": res.count, //解析数据长度 |
|||
"data": res.data //解析数据列表 |
|||
}; |
|||
}, |
|||
height: 'full-255',//固定高度-即固定表头固定第一行首行 |
|||
request: { |
|||
pageName: 'page', //页码的参数名称,默认:page |
|||
limitName: 'size' //每页数据量的参数名,默认:limit |
|||
}, |
|||
response: { |
|||
statusName: 'status' //规定数据状态的字段名称,默认:code |
|||
, statusCode: 200 //规定成功的状态码,默认:0 |
|||
, msgName: 'message' //规定状态信息的字段名称,默认:msg |
|||
, countName: 'count' //规定数据总数的字段名称,默认:count |
|||
, dataName: 'data' //规定数据列表的字段名称,默认:data |
|||
}, |
|||
cols: [ |
|||
[ |
|||
{type: "checkbox", width: 50}, |
|||
{field: 'number', width: 100, title: '工号', sort: true}, |
|||
{field: 'name', width: 100, title: '姓名'}, |
|||
{ |
|||
field: 'gender', width: 80, title: '性别', templet: function (d) { |
|||
if (d.gender === 1) { |
|||
return "男性"; |
|||
} else if (d.gender === 2) { |
|||
return "女性"; |
|||
} else if (d.gender === 3) { |
|||
return "中性"; |
|||
} else { |
|||
return ""; |
|||
} |
|||
} |
|||
}, |
|||
{field: 'companyname', width: 200, title: '公司名称'}, |
|||
{field: 'maindeparmentname', width: 200, title: '主部门'}, |
|||
{field: 'sunmaindeparmentname', width: 200, title: '岗位'}, |
|||
{field: 'workpostname', width: 200, title: '工段'}, |
|||
{field: 'positionname', width: 200, title: '职位'} |
|||
] |
|||
], |
|||
limits: [10, 15, 20, 25, 50, 100], |
|||
limit: 10, |
|||
page: true, |
|||
skin: 'line', |
|||
}); |
|||
|
|||
form.on('submit(data-search-btn)', function (data) { |
|||
data = data.field; |
|||
let req = {}; |
|||
if (data.name !== '') { |
|||
req.name = data.name; |
|||
} |
|||
if (data.number !== '') { |
|||
req.number = data.number; |
|||
} |
|||
//执行搜索重载 |
|||
table.reload('currentTableForUser', { |
|||
url: '/sys/findUsers', |
|||
page: { |
|||
curr: 1 |
|||
}, |
|||
where: req |
|||
}, 'data'); |
|||
return false; |
|||
}); |
|||
|
|||
|
|||
depositoryTree = tree.render({ |
|||
elem: '#depositoryTree' |
|||
, id: "depositoryTree" |
|||
, showCheckbox: true //是否显示复选框 |
|||
, data: [] |
|||
}); |
|||
$.ajax({ |
|||
url: "/repository/treeMenusOnlyDepository", |
|||
type: 'get', |
|||
dataType: 'json', |
|||
contentType: "application/json;charset=utf-8", |
|||
beforeSend: function () { |
|||
}, |
|||
success: function (d) { |
|||
var data2 = d.data; |
|||
depositoryTree.reload({ |
|||
data: data2 |
|||
}); |
|||
}, |
|||
|
|||
}); |
|||
|
|||
postTree = tree.render({ |
|||
elem: '#postTree' |
|||
, id: "postTree" |
|||
, showCheckbox: true //是否显示复选框 |
|||
, data: [] |
|||
}); |
|||
|
|||
|
|||
Impower = function () { |
|||
let treeData = tree.getChecked('depositoryTree'); |
|||
// 获取选中的Id |
|||
let userIds = []; |
|||
if (tabType === "person") { |
|||
let checkUserData = table.checkStatus('currentTableForUser').data; |
|||
for (let i = 0, len = checkUserData.length; i < len; i++) { |
|||
userIds.push(checkUserData[i].id); |
|||
} |
|||
} else { |
|||
userIds = getAllTreeId(tree.getChecked('postTree')); |
|||
} |
|||
// 获取选中的仓库树id |
|||
let allTreeId = getAllTreeId(treeData); |
|||
|
|||
console.log(userIds) |
|||
console.log(allTreeId) |
|||
|
|||
}; |
|||
|
|||
|
|||
/** |
|||
* 用于获取选中树的id |
|||
* @param data |
|||
*/ |
|||
function getAllTreeId(data) { |
|||
// 用于存储id |
|||
let idList = []; |
|||
for (let i = 0; i < data.length; i++) { |
|||
let temp = data[i]; |
|||
if (temp.orgid !== undefined) { |
|||
if (temp.orgid === "-1") { |
|||
idList.push(temp.id); |
|||
} |
|||
} else { |
|||
idList.push(temp.id); |
|||
} |
|||
if (temp.children !== null && temp.children !== undefined && temp.children.length > 0) { |
|||
// 如果存在子树 |
|||
idList.push(...getAllTreeId(temp.children)); |
|||
} |
|||
} |
|||
return idList; |
|||
} |
|||
|
|||
}); |
|||
|
|||
|
|||
</script> |
|||
|
|||
</body> |
|||
</html> |
|||
@ -1,78 +1,37 @@ |
|||
package com.dreamchaser.depository_manage; |
|||
|
|||
import com.dreamchaser.depository_manage.entity.StockTaking; |
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.dreamchaser.depository_manage.entity.Depository; |
|||
import com.dreamchaser.depository_manage.entity.UserByPort; |
|||
import com.dreamchaser.depository_manage.pojo.*; |
|||
import com.dreamchaser.depository_manage.service.DepositoryRecordService; |
|||
import com.dreamchaser.depository_manage.service.StockTakingService; |
|||
import com.dreamchaser.depository_manage.mapper.DepositoryMapper; |
|||
import com.dreamchaser.depository_manage.utils.LinkInterfaceUtil; |
|||
import org.junit.Test; |
|||
import org.junit.runner.RunWith; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.boot.test.context.SpringBootTest; |
|||
import org.springframework.data.redis.core.RedisTemplate; |
|||
import org.springframework.test.context.junit4.SpringRunner; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.*; |
|||
import java.util.concurrent.*; |
|||
|
|||
@RunWith(SpringRunner.class) |
|||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) |
|||
public class OtherTest { |
|||
|
|||
@Autowired |
|||
DepositoryRecordService depositoryRecordService; |
|||
|
|||
@Autowired |
|||
StockTakingService stockTakingService; |
|||
@Autowired |
|||
RedisTemplate<String,String> redisTemplateForHash; |
|||
DepositoryMapper depositoryMapper; |
|||
|
|||
@Test |
|||
public void Test(){ |
|||
UserByPort userByPort = LinkInterfaceUtil.FindUserById(78, null); |
|||
List<SimpleTaskP> userSimpleTaskP = getUserSimpleApplyP(userByPort); |
|||
System.out.println(userSimpleTaskP); |
|||
} |
|||
|
|||
JSONArray orgAndPostThree = LinkInterfaceUtil.getOrgAndPostThree(userByPort); |
|||
System.out.println(JSONObject.toJSONString(orgAndPostThree).replace("name","title").replace("child","children")); |
|||
} |
|||
|
|||
/** |
|||
* 用于获取当前用户的任务列表 |
|||
* @param userToken 当前用户 |
|||
* @return |
|||
*/ |
|||
public List<SimpleTaskP> getUserSimpleApplyP(UserByPort userToken){ |
|||
Map<String, Object> paramForApply = new HashMap<>(); |
|||
paramForApply.put("applicantId", userToken.getId()); |
|||
paramForApply.put("size", 4); |
|||
paramForApply.put("page", 1); |
|||
|
|||
// 定义任务列表
|
|||
List<SimpleTaskP> list = new ArrayList<>(); |
|||
|
|||
// 查询入库申请
|
|||
List<ApplicationInRecordP> applicationInRecordPByCondition = depositoryRecordService.findApplicationInRecordPByCondition(paramForApply, userToken); |
|||
for (ApplicationInRecordP applicationInRecordP : applicationInRecordPByCondition) { |
|||
SimpleTaskP simpleTask = new SimpleTaskP(applicationInRecordP); |
|||
list.add(simpleTask); |
|||
} |
|||
|
|||
|
|||
List<ApplicationOutRecordP> applicationOutRecordPlist = depositoryRecordService.findApplicationOutRecordPByCondition(paramForApply, userToken); |
|||
for (ApplicationOutRecordP applicationOutRecordP : applicationOutRecordPlist) { |
|||
SimpleTaskP simpleTask = new SimpleTaskP(applicationOutRecordP); |
|||
list.add(simpleTask); |
|||
} |
|||
|
|||
paramForApply.put("originator",userToken.getId()); |
|||
List<StockTaking> stockTakingByCondition = stockTakingService.findStockTakingByCondition(paramForApply); |
|||
for (StockTaking stockTaking : stockTakingByCondition) { |
|||
SimpleTaskP simpleTask = new SimpleTaskP(new SimpleStockTakingP(stockTaking)); |
|||
list.add(simpleTask); |
|||
} |
|||
return list; |
|||
} |
|||
|
|||
} |
|||
|
|||
Loading…
Reference in new issue