bug修改
parent
4255a8cd4c
commit
824928d9b3
|
@ -98,7 +98,7 @@ public class AccountController extends BaseController {
|
|||
model.put("userId", -1);
|
||||
model.put("account", new Admin());
|
||||
model.put("roleList", sysRoleService.getAllEnableSysRole());
|
||||
model.put("deptList", deptRepository.findAll());
|
||||
model.put("deptList", deptRepository.findEnable());
|
||||
model.put("positionList", userPositionRepository.findAll());
|
||||
return "/admin/account_input";
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ public class AccountController extends BaseController {
|
|||
model.put("account", admin);
|
||||
model.put("userId", userId);
|
||||
model.put("roleList", sysRoleService.getAllEnableSysRole());
|
||||
model.put("deptList", deptRepository.findAll());
|
||||
model.put("deptList", deptRepository.findEnable());
|
||||
model.put("positionList", userPositionRepository.findAll());
|
||||
return "/admin/account_input";
|
||||
}
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
package cn.palmte.work.controller.backend;
|
||||
|
||||
import cn.palmte.work.bean.ResponseMsg;
|
||||
import cn.palmte.work.model.Dept;
|
||||
import cn.palmte.work.model.ProcurementType;
|
||||
import cn.palmte.work.model.Project;
|
||||
import cn.palmte.work.model.*;
|
||||
import cn.palmte.work.service.DeptService;
|
||||
import cn.palmte.work.service.ProcurementTypeService;
|
||||
import cn.palmte.work.utils.Utils;
|
||||
|
@ -31,6 +29,9 @@ public class DepartmentController extends BaseController{
|
|||
@Autowired
|
||||
private DeptService deptService;
|
||||
|
||||
@Autowired
|
||||
private DeptRepository deptRepository;
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
* @param keywords
|
||||
|
@ -72,6 +73,19 @@ public class DepartmentController extends BaseController{
|
|||
return "/admin/department_input";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转编辑页面
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/edit")
|
||||
public String edit( Map<String, Object> model, @RequestParam("id") int id){
|
||||
Dept dept = deptRepository.findOne(id);
|
||||
model.put("deptId", id);
|
||||
model.put("department", dept);
|
||||
return "/admin/department_input";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
* @param deptId
|
||||
|
@ -107,6 +121,20 @@ public class DepartmentController extends BaseController{
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用 禁用
|
||||
*/
|
||||
@RequestMapping("/checkName")
|
||||
@ResponseBody
|
||||
public ResponseMsg checkName(@RequestParam("id") int id,
|
||||
@RequestParam("name") String name, RedirectAttributes attr) {
|
||||
Dept dept = deptRepository.findByNameEquals(name);
|
||||
if (dept != null && id != dept.getId()) {
|
||||
return ResponseMsg.buildFailedMsg("失败");
|
||||
}
|
||||
return ResponseMsg.buildSuccessMsg("成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出
|
||||
*/
|
||||
|
@ -114,8 +142,8 @@ public class DepartmentController extends BaseController{
|
|||
public void export(@RequestParam(value = "keywords",required = false) String keywords, HttpServletResponse httpServletResponse) throws IOException {
|
||||
Map<String, String> searchInfo = getSearchInfo(keywords);
|
||||
downloadHeader(httpServletResponse , Utils.generateExcelName("部门表"), "application/octet-stream");
|
||||
String[] headers = {"部门名称","创建人","创建时间"};
|
||||
String[] exportColumns = {"name","createdBy","createdTime"};
|
||||
String[] headers = {"部门名称","创建人","创建时间", "状态"};
|
||||
String[] exportColumns = {"name","createdBy","createdTime", "status"};
|
||||
ExportUtils.exportToExcel(headers, exportColumns, 1, 10000,
|
||||
httpServletResponse.getOutputStream(), (pN, pS) -> deptService.list(searchInfo, pN, pS).getList());
|
||||
}
|
||||
|
|
|
@ -110,6 +110,7 @@ public class ProjectController extends BaseController {
|
|||
model.put("adminList", adminList);
|
||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
|
||||
model.putIfAbsent("extend", "1");
|
||||
model.putIfAbsent("orderTypeStr", searchInfo.getOrDefault("orderType", "search"));
|
||||
Page<Project> page = projectService.list(searchInfo, pageNumber, pageSize);
|
||||
List<Project> list = page.getList();
|
||||
if(CollectionUtil.isNotEmpty(list)){
|
||||
|
|
|
@ -38,6 +38,9 @@ public class Dept {
|
|||
@Transient
|
||||
private int tempId;
|
||||
|
||||
@Transient
|
||||
private String status;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
@ -85,4 +88,12 @@ public class Dept {
|
|||
public void setTempId(int tempId) {
|
||||
this.tempId = tempId;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
|
@ -1,8 +1,14 @@
|
|||
package cn.palmte.work.model;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface DeptRepository extends JpaRepository<Dept,Integer> {
|
||||
|
||||
Dept findByNameEquals(String name);
|
||||
|
||||
@Query(value = "select * from dept where enabled = 1", nativeQuery = true)
|
||||
List<Dept> findEnable();
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public class DeptService {
|
|||
}
|
||||
|
||||
public Page<Dept> list(Map<String, String> searchInfo, int pageNumber, int pageSize){
|
||||
QueryHelper queryHelper = new QueryHelper("SELECT *","dept");
|
||||
QueryHelper queryHelper = new QueryHelper("SELECT *, (CASE enabled WHEN 0 THEN '已禁用' WHEN 1 THEN '已启用' END) as status","dept");
|
||||
queryHelper.addCondition(searchInfo.containsKey("name"), "name like ?", "%" +
|
||||
searchInfo.get("name") + "%");
|
||||
queryHelper.addCondition(searchInfo.containsKey("enabled") && !"-1".equals(searchInfo.get("enabled")),
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<input name="deptId" id="deptId" type="hidden" value="${deptId!}"/>
|
||||
<div class="am-tabs am-margin" data-am-tabs>
|
||||
<ul class="am-tabs-nav am-nav am-nav-tabs">
|
||||
<li class="am-active"><a href="#tab1">新增</a></li>
|
||||
<li class="am-active"><a href="#tab1">新增/编辑</a></li>
|
||||
</ul>
|
||||
<div class="am-tabs-bd">
|
||||
<div class="am-tab-panel am-fade am-in am-active" id="tab1">
|
||||
|
@ -26,9 +26,9 @@
|
|||
<div class="am-u-sm-4 am-u-md-2 am-text-right">
|
||||
<span style="color: red;">*</span>部门名称</div>
|
||||
<div class="am-u-sm-6 am-u-md-6">
|
||||
<input class="js-ajax-validate" name="name" data-validation-message="请输入部门名称(20字符以内)"
|
||||
minlength="1" maxlength="10"
|
||||
value="${department.name!}" type="text" required/>
|
||||
<input type="text" class="am-input" data-validate-async data-validation-message="请输入项目名称(1000字符以内)"
|
||||
name="name" placeholder="请输入部门名称(20字符以内)" minlength="1" maxlength="20" id="name"
|
||||
value="${department.name!}" required/>
|
||||
</div>
|
||||
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
|
||||
</div>
|
||||
|
@ -55,7 +55,7 @@
|
|||
|
||||
<!--选项卡(tabs)end-->
|
||||
<div class="am-margin">
|
||||
<button type="submit" id="submitBtn" class="am-btn am-btn-primary am-btn-xs">提交保存</button>
|
||||
<button type="button" id="saveApprove" class="am-btn am-btn-primary am-btn-xs">提交保存</button>
|
||||
<button type="button" class="am-btn am-btn-warning am-btn-xs"
|
||||
onclick="javascript:history.go(-1);">返回上一级
|
||||
</button>
|
||||
|
@ -69,6 +69,8 @@
|
|||
|
||||
<script>
|
||||
var $mycheckbox = $('.switch-button');
|
||||
var result = 0;
|
||||
|
||||
$mycheckbox.each(function () {
|
||||
$("#switch").on({
|
||||
'switchChange.bootstrapSwitch': function (event, state) {
|
||||
|
@ -81,4 +83,38 @@
|
|||
});
|
||||
});
|
||||
|
||||
$(function () {
|
||||
$("#saveApprove").click(function () {
|
||||
|
||||
var name = $("#name").val();
|
||||
if (name.length == 0) {
|
||||
window.confirm('部门名称不能为空');
|
||||
return;
|
||||
}
|
||||
checkName();
|
||||
if (result == 1) {
|
||||
window.confirm('部门名称已存在');
|
||||
return;
|
||||
}
|
||||
$("#tmpForm").attr("action","${base}/department/save");
|
||||
$("#tmpForm").submit();
|
||||
});
|
||||
});
|
||||
|
||||
function checkName () {
|
||||
var name = $("#name").val();
|
||||
var id = $("#deptId").val();
|
||||
$.ajax({
|
||||
url: "${base}/department/checkName",
|
||||
data: {name: name, id: id},
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function (data) {
|
||||
console.log("data: " + data.status);
|
||||
result = data.status;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
|
@ -107,6 +107,13 @@
|
|||
<td>
|
||||
<div id="edit-div" class="am-btn-toolbar switch-button">
|
||||
<div class="am-btn-group am-btn-group-xs">
|
||||
<@shiro.hasPermission name="DEPARTMENT_EDIT">
|
||||
<button type="button"
|
||||
class="am-btn am-btn-default am-btn-xs am-text-secondary"
|
||||
onclick="location.href='${base}/department/edit?id=${list.id}'"><span
|
||||
class="am-icon-pencil-square-o"></span>编辑
|
||||
</button>
|
||||
</@shiro.hasPermission>
|
||||
<input id="${list.id}" type="checkbox" data-size='xs'
|
||||
data-am-switch data-off-text="已禁用" data-on-text="已启用"
|
||||
<#if list.enabled==1 >checked</#if>
|
||||
|
|
|
@ -9,6 +9,11 @@
|
|||
table-layout:fixed;
|
||||
word-break:break-all
|
||||
}
|
||||
.focus{
|
||||
// 表格自动换行
|
||||
table-layout:fixed;
|
||||
word-break:break-all
|
||||
}
|
||||
</style>
|
||||
<div class="admin-content">
|
||||
<div class="am-cf am-padding" style="padding:1rem 1.6rem 1.6rem 1rem;margin:0px;">
|
||||
|
@ -22,6 +27,7 @@
|
|||
<form class="am-form" id="listForm" action="${base}/project/list" method="POST">
|
||||
<input type="hidden" id="keywords" name="keywords" value='${keywords!""}'/>
|
||||
<input type="hidden" id="pageNumber" name="pageNumber" value='${pageNumber!}'/>
|
||||
<input type="hidden" id="orderTypeStr" name="orderTypeStr" value='${orderTypeStr!""}'/>
|
||||
<table class="am-table am-table-bordered am-table-radius table-main" style="padding:0;">
|
||||
<tbody>
|
||||
<tr>
|
||||
|
@ -325,20 +331,20 @@
|
|||
<th class="table-check">
|
||||
<input type="checkbox" id="allCheck"></th>
|
||||
<th class="table-title">序号</th>
|
||||
<th class="table-title">项目编号<i class="am-icon-caret-down" onclick="sub_function('projectNoDown')"></i><i class="am-icon-caret-up" onclick="sub_function('projectNoUp')"></i></th>
|
||||
<th class="table-title">项目名称<i class="am-icon-caret-down" onclick="sub_function('projectNameDown')"></i><i class="am-icon-caret-up" onclick="sub_function('projectNameUp')"></i></th>
|
||||
<th class="table-title">项目类型<i class="am-icon-caret-down" onclick="sub_function('projectTypeDown')"></i><i class="am-icon-caret-up" onclick="sub_function('projectTypeUp')"></i></th>
|
||||
<th class="table-title">垫资模式<i class="am-icon-caret-down" onclick="sub_function('underModeDown')"></i><i class="am-icon-caret-up" onclick="sub_function('underModeUp')"></i></th>
|
||||
<th class="table-title">垫资利息<i class="am-icon-caret-down" onclick="sub_function('underIntDown')"></i><i class="am-icon-caret-up" onclick="sub_function('underIntUp')"></i></th>
|
||||
<th class="table-title">垫资峰值<i class="am-icon-caret-down" onclick="sub_function('underPeakDown')"></i><i class="am-icon-caret-up" onclick="sub_function('underPeakUp')"></i></th>
|
||||
<th class="table-title">项目合同金额<i class="am-icon-caret-down" onclick="sub_function('projectContractDown')"></i><i class="am-icon-caret-up" onclick="sub_function('projectContractUp')"></i></th>
|
||||
<th class="table-title">项目毛利<i class="am-icon-caret-down" onclick="sub_function('grossProfitDown')"></i><i class="am-icon-caret-up" onclick="sub_function('grossProfitUp')"></i></th>
|
||||
<th class="table-title">项目毛利率<i class="am-icon-caret-down" onclick="sub_function('grossProfitMarginDown')"></i><i class="am-icon-caret-up" onclick="sub_function('grossProfitMarginUp')"></i></th>
|
||||
<th class="table-title">项目把握度<i class="am-icon-caret-down" onclick="sub_function('certaintyDown')"></i><i class="am-icon-caret-up" onclick="sub_function('certaintyUp')"></i></th>
|
||||
<th class="table-title">汇智产品金额<i class="am-icon-caret-down" onclick="sub_function('huizhiDown')"></i><i class="am-icon-caret-up" onclick="sub_function('huizhiUp')"></i></th>
|
||||
<th class="table-title">华智产品金额<i class="am-icon-caret-down" onclick="sub_function('huazhiDown')"></i><i class="am-icon-caret-up" onclick="sub_function('huazhiUp')"></i></th>
|
||||
<th class="table-title">华三产品金额<i class="am-icon-caret-down" onclick="sub_function('huasanDown')"></i><i class="am-icon-caret-up" onclick="sub_function('huasanUp')"></i></th>
|
||||
<th class="table-title">其他产品金额<i class="am-icon-caret-down" onclick="sub_function('otherDown')"></i><i class="am-icon-caret-up" onclick="sub_function('otherUp')"></i></th>
|
||||
<th class="table-title">项目编号<i class="am-icon-caret-down" <#if orderTypeStr == "projectNoDown">style="color: red"</#if> onclick="sub_function('projectNoDown')"></i><i class="am-icon-caret-up" <#if orderTypeStr == "projectNoUp">style="color: red"</#if> onclick="sub_function('projectNoUp')"></i></th>
|
||||
<th class="table-title">项目名称<i class="am-icon-caret-down" <#if orderTypeStr == "projectNameDown">style="color: red"</#if> onclick="sub_function('projectNameDown')"></i><i class="am-icon-caret-up" <#if orderTypeStr == "projectNameUp">style="color: red"</#if> onclick="sub_function('projectNameUp')"></i></th>
|
||||
<th class="table-title">项目类型<i class="am-icon-caret-down" <#if orderTypeStr == "projectTypeDown">style="color: red"</#if> onclick="sub_function('projectTypeDown')"></i><i class="am-icon-caret-up" <#if orderTypeStr == "projectTypeUp">style="color: red"</#if> onclick="sub_function('projectTypeUp')"></i></th>
|
||||
<th class="table-title">垫资模式<i class="am-icon-caret-down" <#if orderTypeStr == "underModeDown">style="color: red"</#if> onclick="sub_function('underModeDown')"></i><i class="am-icon-caret-up" <#if orderTypeStr == "underModeUp">style="color: red"</#if> onclick="sub_function('underModeUp')"></i></th>
|
||||
<th class="table-title">垫资利息<i class="am-icon-caret-down" <#if orderTypeStr == "underIntDown">style="color: red"</#if> onclick="sub_function('underIntDown')"></i><i class="am-icon-caret-up" <#if orderTypeStr == "underIntUp">style="color: red"</#if> onclick="sub_function('underIntUp')"></i></th>
|
||||
<th class="table-title">垫资峰值<i class="am-icon-caret-down" <#if orderTypeStr == "underPeakDown">style="color: red"</#if> onclick="sub_function('underPeakDown')"></i><i class="am-icon-caret-up" <#if orderTypeStr == "underPeakUp">style="color: red"</#if> onclick="sub_function('underPeakUp')"></i></th>
|
||||
<th class="table-title">项目合同金额<i class="am-icon-caret-down" <#if orderTypeStr == "projectContractDown">style="color: red"</#if> onclick="sub_function('projectContractDown')"></i><i class="am-icon-caret-up" <#if orderTypeStr == "projectContractUp">style="color: red"</#if> onclick="sub_function('projectContractUp')"></i></th>
|
||||
<th class="table-title">项目毛利<i class="am-icon-caret-down" <#if orderTypeStr == "grossProfitDown">style="color: red"</#if> onclick="sub_function('grossProfitDown')"></i><i class="am-icon-caret-up" <#if orderTypeStr == "grossProfitUp">style="color: red"</#if> onclick="sub_function('grossProfitUp')"></i></th>
|
||||
<th class="table-title">项目毛利率<i class="am-icon-caret-down" <#if orderTypeStr == "grossProfitMarginDown">style="color: red"</#if> onclick="sub_function('grossProfitMarginDown')"></i><i class="am-icon-caret-up" <#if orderTypeStr == "grossProfitMarginUp">style="color: red"</#if> onclick="sub_function('grossProfitMarginUp')"></i></th>
|
||||
<th class="table-title">项目把握度<i class="am-icon-caret-down" <#if orderTypeStr == "certaintyDown">style="color: red"</#if> onclick="sub_function('certaintyDown')"></i><i class="am-icon-caret-up" <#if orderTypeStr == "certaintyUp">style="color: red"</#if> onclick="sub_function('certaintyUp')"></i></th>
|
||||
<th class="table-title">汇智产品金额<i class="am-icon-caret-down" <#if orderTypeStr == "huizhiDown">style="color: red"</#if> onclick="sub_function('huizhiDown')"></i><i class="am-icon-caret-up" <#if orderTypeStr == "huizhiUp">style="color: red"</#if> onclick="sub_function('huizhiUp')"></i></th>
|
||||
<th class="table-title">华智产品金额<i class="am-icon-caret-down" <#if orderTypeStr == "huazhiDown">style="color: red"</#if> onclick="sub_function('huazhiDown')"></i><i class="am-icon-caret-up" <#if orderTypeStr == "huazhiUp">style="color: red"</#if> onclick="sub_function('huazhiUp')"></i></th>
|
||||
<th class="table-title">华三产品金额<i class="am-icon-caret-down" <#if orderTypeStr == "huasanDown">style="color: red"</#if> onclick="sub_function('huasanDown')"></i><i class="am-icon-caret-up" <#if orderTypeStr == "huasanUp">style="color: red"</#if> onclick="sub_function('huasanUp')"></i></th>
|
||||
<th class="table-title">其他产品金额<i class="am-icon-caret-down" <#if orderTypeStr == "otherDown">style="color: red"</#if> onclick="sub_function('otherDown')"></i><i class="am-icon-caret-up" <#if orderTypeStr == "otherUp">style="color: red"</#if> onclick="sub_function('otherUp')"></i></th>
|
||||
<th class="table-title">项目状态</th>
|
||||
<th class="table-title">行业场景应用</th>
|
||||
<th class="table-title">解决方案</th>
|
||||
|
@ -873,6 +879,8 @@
|
|||
var keywordsObj = {};
|
||||
var extend = $("#extend").val();
|
||||
keywordsObj.extend = extend;
|
||||
if ($("#orderTypeStr").val())
|
||||
keywordsObj.orderType = $("#orderTypeStr").val();
|
||||
if ($("#projectNo").val())
|
||||
keywordsObj.projectNo = $("#projectNo").val();
|
||||
if ($("#name").val())
|
||||
|
|
Loading…
Reference in New Issue