采购类型配置
parent
8947505fac
commit
f8f5172302
|
@ -0,0 +1,137 @@
|
|||
package cn.palmte.work.controller.backend;
|
||||
|
||||
import cn.palmte.work.bean.ResponseMsg;
|
||||
import cn.palmte.work.model.ProcurementType;
|
||||
import cn.palmte.work.service.ProcurementTypeService;
|
||||
import cn.palmte.work.utils.Utils;
|
||||
import cn.palmte.work.utils.excel.ExportUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/procurement/type")
|
||||
public class ProcurementTypeController extends BaseController{
|
||||
|
||||
@Autowired
|
||||
private ProcurementTypeService procurementTypeService;
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
* @param keywords
|
||||
* @param pageNumber
|
||||
* @param pageSize
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
public String list(@RequestParam(value = "keywords",required = false) String keywords,
|
||||
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
||||
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
||||
Map<String, Object> model) {
|
||||
model.put("keywords",keywords);
|
||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
|
||||
model.put("pager",procurementTypeService.list(searchInfo,pageNumber,pageSize));
|
||||
return "/admin/procurement_type_list";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转新增页面
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/add")
|
||||
public String add( Map<String, Object> model){
|
||||
ProcurementType procurementType = new ProcurementType();
|
||||
model.put("procurementTypeId",-1);
|
||||
model.put("procurementType",procurementType);
|
||||
return "/admin/procurement_type_input";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到编辑页面
|
||||
*/
|
||||
@RequestMapping("/edit")
|
||||
public String edit(@RequestParam("id") int id, Map<String, Object> model) {
|
||||
ProcurementType procurementType = procurementTypeService.findOne(id);
|
||||
model.put("procurementTypeId",id);
|
||||
model.put("procurementType", procurementType);
|
||||
return "/admin/procurement_type_input";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
* @param procurementTypeId
|
||||
* @param procurementType
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/save")
|
||||
public String save(@RequestParam("procurementTypeId") int procurementTypeId,
|
||||
ProcurementType procurementType, Map<String, Object> model){
|
||||
|
||||
procurementTypeService.saveOtUpdate(procurementTypeId,procurementType);
|
||||
return "redirect:/procurement/type/list";
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/delete")
|
||||
@ResponseBody
|
||||
public ResponseMsg delete(@RequestParam("ids") String ids){
|
||||
String[] deleteIds=ids.split("#%#");
|
||||
boolean deleted = procurementTypeService.deleteByIDs(deleteIds);
|
||||
|
||||
ResponseMsg responseMsge=new ResponseMsg();
|
||||
if(deleted){
|
||||
responseMsge.setStatus(0);
|
||||
responseMsge.setMsg("删除成功");
|
||||
} else{
|
||||
responseMsge.setStatus(1);
|
||||
responseMsge.setMsg("删除失败");
|
||||
}
|
||||
return responseMsge;
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用 禁用
|
||||
*/
|
||||
@RequestMapping("/enableOrDisable")
|
||||
@ResponseBody
|
||||
public ResponseMsg enableOrDisable(@RequestParam("id") int id,
|
||||
@RequestParam("status") int status, RedirectAttributes attr) {
|
||||
boolean isSuccess = false;
|
||||
try {
|
||||
isSuccess = procurementTypeService.enableOrDisable(status, id);
|
||||
} catch (Exception e) {
|
||||
e.getMessage();
|
||||
}
|
||||
if (isSuccess) {
|
||||
return ResponseMsg.buildSuccessMsg("操作成功");
|
||||
} else {
|
||||
return ResponseMsg.buildSuccessMsg("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出
|
||||
*/
|
||||
@RequestMapping("/export")
|
||||
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","category","createdBy","createdTime"};
|
||||
ExportUtils.exportToExcel(headers, exportColumns, 1, 10000,
|
||||
httpServletResponse.getOutputStream(), (pN, pS) -> procurementTypeService.list(searchInfo, pN, pS).getList());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
package cn.palmte.work.model;
|
||||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 采购类型配置
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "procurement_type")
|
||||
public class ProcurementType {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@GenericGenerator(name = "persistenceGenerator", strategy = "increment")
|
||||
private Integer id;
|
||||
|
||||
private String name;
|
||||
|
||||
private int category;
|
||||
|
||||
private int enabled;
|
||||
|
||||
@Column(name = "created_by")
|
||||
private String createdBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column(name = "created_time")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date createdTime;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public void setCategory(int category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
public int getEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(int enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public String getCreatedBy() {
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
public void setCreatedBy(String createdBy) {
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
|
||||
public Date getCreatedTime() {
|
||||
return createdTime;
|
||||
}
|
||||
|
||||
public void setCreatedTime(Date createdTime) {
|
||||
this.createdTime = createdTime;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package cn.palmte.work.model;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface ProcurementTypeRepository extends JpaRepository<ProcurementType,Integer> {
|
||||
|
||||
|
||||
}
|
|
@ -27,7 +27,7 @@ public class SysConfig {
|
|||
private String value;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
* 更新时间
|
||||
*/
|
||||
@Column(name = "update_time")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
package cn.palmte.work.service;
|
||||
|
||||
import cn.palmte.work.model.ProcurementType;
|
||||
import cn.palmte.work.model.ProcurementTypeRepository;
|
||||
import cn.palmte.work.utils.InterfaceUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import top.jfunc.common.db.QueryHelper;
|
||||
import top.jfunc.common.db.bean.Page;
|
||||
import top.jfunc.common.db.utils.Pagination;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class ProcurementTypeService {
|
||||
|
||||
@Autowired
|
||||
private ProcurementTypeRepository procurementTypeRepository;
|
||||
|
||||
@Autowired
|
||||
private Pagination pagination;
|
||||
|
||||
public Page<ProcurementType> list(Map<String, String> searchInfo, int pageNumber, int pageSize){
|
||||
QueryHelper queryHelper = new QueryHelper("SELECT *","procurement_type");
|
||||
queryHelper.addCondition(searchInfo.containsKey("name"), "name like ?", "%" +
|
||||
searchInfo.get("name") + "%");
|
||||
queryHelper.addCondition(searchInfo.containsKey("category") && !"-1".equals(searchInfo.get("category")),
|
||||
"category=" + searchInfo.get("category"));
|
||||
queryHelper.addCondition(searchInfo.containsKey("enabled") && !"-1".equals(searchInfo.get("enabled")),
|
||||
"enabled=" + searchInfo.get("enabled"));
|
||||
queryHelper.addCondition(searchInfo.containsKey("startTime"), "created_time >= ?", searchInfo.get("startTime") + " 00:00:00");
|
||||
queryHelper.addCondition(searchInfo.containsKey("endTime"), "created_time <= ?", searchInfo.get("endTime") + " 23:59:59");
|
||||
queryHelper.addOrderProperty("created_time", false);
|
||||
return pagination.paginate(queryHelper.getSql(), ProcurementType.class,pageNumber,pageSize);
|
||||
}
|
||||
|
||||
public ProcurementType findOne(int id) {
|
||||
return procurementTypeRepository.findOne(id);
|
||||
}
|
||||
|
||||
public void saveOtUpdate(int procurementTypeId, ProcurementType procurementType) {
|
||||
ProcurementType obj = procurementTypeRepository.findOne(procurementTypeId);
|
||||
if(null == obj){
|
||||
obj = new ProcurementType();
|
||||
obj.setName(procurementType.getName());
|
||||
obj.setCategory(procurementType.getCategory());
|
||||
obj.setEnabled(procurementType.getEnabled());
|
||||
obj.setCreatedBy(InterfaceUtil.getAdmin().getRealName());
|
||||
obj.setCreatedTime(new Date());
|
||||
}else {
|
||||
obj.setName(procurementType.getName());
|
||||
obj.setCategory(procurementType.getCategory());
|
||||
obj.setEnabled(procurementType.getEnabled());
|
||||
}
|
||||
procurementTypeRepository.saveAndFlush(obj);
|
||||
}
|
||||
|
||||
public boolean deleteByIDs(String[] deleteIds) {
|
||||
boolean deleted = true;
|
||||
try {
|
||||
for (String id : deleteIds) {
|
||||
procurementTypeRepository.delete(Integer.parseInt(id));
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
deleted = false;
|
||||
}
|
||||
|
||||
return deleted;
|
||||
}
|
||||
|
||||
public boolean enableOrDisable(int status, int id) {
|
||||
ProcurementType one = procurementTypeRepository.findOne(id);
|
||||
one.setEnabled(status);
|
||||
ProcurementType procurementType = procurementTypeRepository.saveAndFlush(one);
|
||||
|
||||
if(null != procurementType){
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -6,6 +6,8 @@ import cn.palmte.work.pojo.SysConfigRequest;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Service
|
||||
public class SysConfigService {
|
||||
|
||||
|
@ -16,10 +18,12 @@ public class SysConfigService {
|
|||
public void saveOrUpdate(SysConfigRequest sysConfigRequest) {
|
||||
SysConfig underwrittenTaxRate = sysConfigRepository.findByCodeEquals("underwrittenTaxRate");
|
||||
underwrittenTaxRate.setValue(sysConfigRequest.getUnderwrittenTaxRate());
|
||||
underwrittenTaxRate.setUpdateTime(new Date());
|
||||
sysConfigRepository.saveAndFlush(underwrittenTaxRate);
|
||||
|
||||
SysConfig projectContributionProfitRateThreshold = sysConfigRepository.findByCodeEquals("projectContributionProfitRateThreshold");
|
||||
projectContributionProfitRateThreshold.setValue(sysConfigRequest.getProjectContributionProfitRateThreshold());
|
||||
projectContributionProfitRateThreshold.setUpdateTime(new Date());
|
||||
sysConfigRepository.saveAndFlush(projectContributionProfitRateThreshold);
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,104 @@
|
|||
<#assign base=request.contextPath />
|
||||
<#import "../common/defaultLayout.ftl" as defaultLayout>
|
||||
<@defaultLayout.layout>
|
||||
<link rel="stylesheet" href="${base}/assets/css/amazeui.switch.css"/>
|
||||
<script type="text/javascript">
|
||||
var base = '${base}';
|
||||
</script>
|
||||
<div class="admin-content">
|
||||
<div class="admin-content-body">
|
||||
<div class="am-cf am-padding">
|
||||
<div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">配置管理</strong> /
|
||||
<small>采购类型配置</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form method="post" class="am-form" id="tmpForm"
|
||||
action="${base}/procurement/type/save">
|
||||
<input name="procurementTypeId" id="procurementTypeId" type="hidden" value="${procurementTypeId!}"/>
|
||||
<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>
|
||||
</ul>
|
||||
<div class="am-tabs-bd">
|
||||
<div class="am-tab-panel am-fade am-in am-active" id="tab1">
|
||||
<div class="am-g am-form-group am-margin-top" style="display: flex;">
|
||||
<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="20"
|
||||
value="${procurementType.name!}" type="text" required/>
|
||||
</div>
|
||||
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
|
||||
</div>
|
||||
|
||||
<div class="am-g am-form-group am-margin-top" style="display: flex;">
|
||||
<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">
|
||||
<select data-am-selected="{btnWidth: '40%', btnSize: 'sm'" id="category" name="category">
|
||||
<option value="-1" >请选择所属大类</option>
|
||||
<option value="1" <#if procurementType.category! ==1>selected</#if> >设备</option>
|
||||
<option value="2" <#if procurementType.category! ==2>selected</#if> >服务</option>
|
||||
<option value="3" <#if procurementType.category! ==3>selected</#if> >施工</option>
|
||||
<option value="4" <#if procurementType.category! ==4>selected</#if> >其他</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
|
||||
</div>
|
||||
|
||||
<div class="am-g am-form-group am-margin-top">
|
||||
<div class="am-u-sm-4 am-u-md-2 am-text-right">启用/禁用</div>
|
||||
|
||||
<div class="am-u-sm-12 am-u-md-4 switch-button" style="height: 25px;">
|
||||
<input id="switch" name="switch" type="checkbox" data-size='xs'
|
||||
data-am-switch data-off-text="禁用" data-on-text="启用"
|
||||
<#if procurementType.enabled==1 >checked</#if>
|
||||
/>
|
||||
<input type="hidden" class="am-input-sm" name="enabled" id="enabled"
|
||||
value="${procurementType.enabled!1}"/>
|
||||
</div>
|
||||
|
||||
<div class="am-hide-sm-only am-u-md-1" style="color: red;"></div>
|
||||
<div class="am-u-sm-2 am-u-md-5 input-msg"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--选项卡(tabs)end-->
|
||||
<div class="am-margin">
|
||||
<button type="submit" id="submitBtn" 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>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</@defaultLayout.layout>
|
||||
<script src="${base}/common/jQuery-File-Upload/js/vendor/jquery.ui.widget.js"></script>
|
||||
<script type="text/javascript" src="${base}/common/jQuery-File-Upload/js/jquery.iframe-transport.js"></script>
|
||||
<script type="text/javascript" src="${base}/common/jQuery-File-Upload/js/jquery.fileupload.js"></script>
|
||||
<script src="${base}/common/jQuery-File-Upload/js/jquery.fileupload-process.js"></script>
|
||||
<script src="${base}/common/jQuery-File-Upload/js/jquery.fileupload-validate.js"></script>
|
||||
<script src="${base}/assets/js/amazeui.switch.js"></script>
|
||||
|
||||
<script>
|
||||
var $mycheckbox = $('.switch-button');
|
||||
$mycheckbox.each(function () {
|
||||
$("#switch").on({
|
||||
'switchChange.bootstrapSwitch': function (event, state) {
|
||||
if (state.toString() == "true") {
|
||||
$("#enabled").val("1");
|
||||
} else {
|
||||
$("#enabled").val("0");
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
|
@ -0,0 +1,314 @@
|
|||
<#assign base=request.contextPath />
|
||||
<#import "../common/defaultLayout.ftl" as defaultLayout>
|
||||
<@defaultLayout.layout>
|
||||
<link rel="stylesheet" href="${base}/assets/css/amazeui.switch.css"/>
|
||||
<div class="admin-content">
|
||||
<div class="am-cf am-padding" style="padding:1rem 1.6rem 1.6rem 1rem;margin:0px;">
|
||||
<!-- padding:1px 2px 3px 4px;上、右、下,和左 -->
|
||||
<div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">配置管理</strong> /
|
||||
<small>采购类型配置</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-g">
|
||||
<div class="am-u-sm-12">
|
||||
<form class="am-form" id="listForm" action="${base}/procurement/type/list" method="POST">
|
||||
<input type="hidden" id="keywords" name="keywords" value='${keywords!""}'/>
|
||||
<table class="am-table am-table-bordered am-table-radius table-main" style="padding:0;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th class="am-text-middle">类型名称</th>
|
||||
<td>
|
||||
<div class="am-u-sm-10">
|
||||
<input type="text" id="name" class="am-form-field am-input-sm"
|
||||
value="${name!}"/>
|
||||
</div>
|
||||
</td>
|
||||
<th class="am-text-middle">所属大类</th>
|
||||
<td>
|
||||
<div class="am-u-sm-10">
|
||||
<select data-am-selected="{btnWidth: '40%', btnSize: 'sm'" id="category">
|
||||
<option value="-1">全部</option>
|
||||
<option value="1" <#if category! == "1">selected</#if> >设备</option>
|
||||
<option value="2" <#if category! == "2">selected</#if> >服务</option>
|
||||
<option value="3" <#if category! == "3">selected</#if> >施工</option>
|
||||
<option value="4" <#if category! == "4">selected</#if> >其他</option>
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="am-text-middle">创建时间</th>
|
||||
<td>
|
||||
<div class="am-u-sm-10">
|
||||
<div class="am-form am-form-inline">
|
||||
<div class="am-form-group am-form-icon">
|
||||
<i class="am-icon-calendar"></i>
|
||||
<input type="text" class="am-form-field am-input-sm" id="startTime"
|
||||
value="${startTime!}" placeholder="开始日期" data-am-datepicker>
|
||||
</div>
|
||||
<div class="am-form-group">至</div>
|
||||
<div class="am-form-group am-form-icon">
|
||||
<i class="am-icon-calendar"></i>
|
||||
<input type="text" class="am-form-field am-input-sm" id="endTime"
|
||||
value="${endTime!}"
|
||||
placeholder="结束日期" data-am-datepicker>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<th class="am-text-middle">启用状态</th>
|
||||
<td>
|
||||
<div class="am-u-sm-10">
|
||||
<select data-am-selected="{btnWidth: '40%', btnSize: 'sm'" id="enabled">
|
||||
<option value="-1">全部</option>
|
||||
<option value="1" <#if enabled! == "1">selected</#if> >启用</option>
|
||||
<option value="0" <#if enabled! == "0">selected</#if> >禁用</option>
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div align='right'>
|
||||
<button type="button" class="am-btn am-btn-default am-btn-sm am-text-secondary"
|
||||
id="submit-btn" onclick="sub_function('query')">搜索
|
||||
</button>
|
||||
<@shiro.hasPermission name="PROCTYPEEXPORT">
|
||||
<button type="button" class="am-btn am-btn-default am-btn-sm am-text-secondary"
|
||||
id="submit-btn-export" onclick="sub_function('export')">导出
|
||||
</button>
|
||||
</@shiro.hasPermission>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<div class="am-btn-toolbar" style="padding-left:.5rem;">
|
||||
<div class="am-btn-group am-btn-group-xs">
|
||||
<@shiro.hasPermission name="PROCTYPEADD">
|
||||
<button type="button" class="am-btn am-btn-default"
|
||||
onclick="location.href='${base}/procurement/type/add'">
|
||||
<span class="am-icon-plus"></span> 新增
|
||||
</button>
|
||||
</@shiro.hasPermission>
|
||||
<@shiro.hasPermission name="PROCTYPEDEL">
|
||||
<button type="button" id="deleteButton" disabled="disabled" class="am-btn am-btn-default"
|
||||
onclick="deleteAll('${base}/procurement/type/delete')"><span
|
||||
class="am-icon-trash-o"></span> 删除
|
||||
</button>
|
||||
</@shiro.hasPermission>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-g">
|
||||
<div class="am-u-sm-12">
|
||||
<div class="am-scrollable-horizontal">
|
||||
<table class="am-table am-table-striped am-table-hover table-main">
|
||||
<thead>
|
||||
<tr class="am-text-nowrap">
|
||||
<th class="table-check"><input type="checkbox" id="allCheck"></th>
|
||||
<th class="table-title">采购类型名称</th>
|
||||
<th class="table-title">所属大类</th>
|
||||
<th class="table-title">创建人</th>
|
||||
<th class="table-title">创建时间</th>
|
||||
<th class="table-title">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<#if (pager.list)?exists && (pager.list?size>0)>
|
||||
<#list pager.list as list>
|
||||
<tr>
|
||||
<td><input type="checkbox" name="ids" value="${list.id}"/></td>
|
||||
<td>${list.name!}</td>
|
||||
<td>${list.category!}</td>
|
||||
<td>${list.createdBy!}</td>
|
||||
<td><#if list.createdTime??>${list.createdTime?datetime}</#if></td>
|
||||
<td>
|
||||
<div id="edit-div" class="am-btn-toolbar switch-button">
|
||||
<div class="am-btn-group am-btn-group-xs">
|
||||
<@shiro.hasPermission name="PROCTYPEEDIT">
|
||||
<button type="button"
|
||||
class="am-btn am-btn-default am-btn-xs am-text-secondary"
|
||||
onclick="location.href='${base}/procurement/type/edit?id=${list.id?c}'">
|
||||
<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>
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</#list>
|
||||
</#if>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="am-cf">
|
||||
<!-- 分页 -->
|
||||
<#if (pager.list)?exists && (pager.list?size>0) >
|
||||
<div class="am-fr">
|
||||
<#include "../common/order_list_pager.ftl">
|
||||
</div>
|
||||
<#else>
|
||||
<div class="am-kai" align="center">
|
||||
<h3>没有找到任何记录!</h3>
|
||||
</div>
|
||||
</#if>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</@defaultLayout.layout>
|
||||
|
||||
<script src="${base}/assets/js/amazeui.switch.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var sub_function = function (type) {
|
||||
initSearch();
|
||||
if (type == 'export') {
|
||||
$("#listForm").attr("action", "${base}/procurement/type/export");
|
||||
} else {
|
||||
$("#listForm").attr("action", "${base}/procurement/type/list");
|
||||
}
|
||||
$("#listForm").submit();
|
||||
};
|
||||
|
||||
function initSearch() {
|
||||
var keywordsObj = {};
|
||||
if ($("#name").val())
|
||||
keywordsObj.name = $("#name").val();
|
||||
if ($("#category").val())
|
||||
keywordsObj.category = $("#category").val();
|
||||
if ($("#enabled").val())
|
||||
keywordsObj.enabled = $("#enabled").val();
|
||||
if ($("#startTime").val())
|
||||
keywordsObj.startTime = $("#startTime").val();
|
||||
if ($("#endTime").val())
|
||||
keywordsObj.endTime = $("#endTime").val();
|
||||
var keywords = "";
|
||||
if (!$.isEmptyObject(keywordsObj)) {
|
||||
keywords = JSON.stringify(keywordsObj);
|
||||
}
|
||||
console.log("keywords = " + keywords);
|
||||
$("#keywords").val(keywords);
|
||||
}
|
||||
|
||||
$(function () {
|
||||
//为每个启用或禁用按钮增加事件
|
||||
var $mycheckbox = $('.switch-button').find("input[type='checkbox']");
|
||||
$mycheckbox.each(function () {
|
||||
var myid = $(this).attr("id");
|
||||
var prop = $(this).attr("prop");
|
||||
$(this).on({
|
||||
'switchChange.bootstrapSwitch': function (event, state) {
|
||||
toggle(myid, state ? 1 : 0);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
//启用或者禁用
|
||||
var toggle = function (id, status) {
|
||||
$.ajax({
|
||||
url: "${base}/procurement/type/enableOrDisable",
|
||||
data: {id: id, status: status},
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function (data) {
|
||||
parent.layer.msg(data.msg);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$(function () {
|
||||
$("body").on('click', '.list-item', function () {
|
||||
$(".list-item").removeClass("tr-selected");
|
||||
$(this).addClass('tr-selected');
|
||||
});
|
||||
$("#allCheck").click(function () {
|
||||
$('input[name="ids"]').prop("checked", this.checked);
|
||||
$("#deleteButton").prop("disabled", $("input[name='ids']:checked").length == 0 ? true : false);
|
||||
});
|
||||
var $citySubBox = $("input[name='ids']");
|
||||
$citySubBox.click(function () {
|
||||
$("#allCheckCity").prop("checked", $citySubBox.length == $("input[name='ids']:checked").length ? true : false);
|
||||
$("#deleteButton").prop("disabled", $("input[name='ids']:checked").length == 0 ? true : false);
|
||||
});
|
||||
|
||||
var keywordsObj = {};
|
||||
$("#submit-btn").on("click", function () {
|
||||
if ($("#name").val())
|
||||
keywordsObj.name = $("#name").val();
|
||||
if ($("#category").val())
|
||||
keywordsObj.category = $("#category").val();
|
||||
if ($("#enabled").val())
|
||||
keywordsObj.enabled = $("#enabled").val();
|
||||
if ($("#startTime").val())
|
||||
keywordsObj.startTime = $("#startTime").val();
|
||||
if ($("#endTime").val())
|
||||
keywordsObj.endTime = $("#endTime").val();
|
||||
var keywords = "";
|
||||
if (!$.isEmptyObject(keywordsObj)) {
|
||||
keywords = JSON.stringify(keywordsObj);
|
||||
}
|
||||
$("#keywords").val(keywords);
|
||||
$("#listForm").submit();
|
||||
});
|
||||
});
|
||||
|
||||
// 删除
|
||||
var deleteAll = function (url) {
|
||||
var $deleteButton = $("#deleteButton");// 删除按钮
|
||||
var ids = "";
|
||||
$("input[name='ids']:checked").each(function () {
|
||||
ids += $(this).val() + "#%#";
|
||||
});
|
||||
var params = {ids: ids};
|
||||
if (window.confirm('确定要删除吗?')) {
|
||||
$.ajax({
|
||||
url: url,
|
||||
data: params,
|
||||
dataType: "json",
|
||||
async: false,
|
||||
beforeSend: function (data) {
|
||||
$deleteButton.prop("disabled", true)
|
||||
},
|
||||
success: function (data) {
|
||||
$deleteButton.prop("disabled", false)
|
||||
if (data.status == 0) {
|
||||
alert("删除成功");
|
||||
window.location.href = window.location.href;
|
||||
} else if (data.status == 1) {
|
||||
alert("删除失败");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -7,7 +7,8 @@
|
|||
<div class="admin-content">
|
||||
<div class="admin-content-body">
|
||||
<div class="am-cf am-padding">
|
||||
<div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">配置管理</strong> /项目利润率配置</div>
|
||||
<div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">配置管理</strong> /
|
||||
<small>项目利润率配置</small></div>
|
||||
</div>
|
||||
<form method="post" class="am-form" id="tmpForm" action="${base}/sys/config/save">
|
||||
<!--选项卡(tabs)begin-->
|
||||
|
|
Loading…
Reference in New Issue