代码优化

This commit is contained in:
thinkgem
2021-11-26 11:41:04 +08:00
parent f5fa369b97
commit f5d5b16a16
4 changed files with 16 additions and 18 deletions

View File

@@ -6,18 +6,17 @@ package com.jeesite.modules.sys.entity;
import java.util.List;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import org.apache.commons.lang3.StringUtils;
import javax.validation.constraints.Size;
import javax.validation.constraints.NotBlank;
import com.jeesite.common.collect.ListUtils;
import com.jeesite.common.entity.BaseEntity;
import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.entity.Extend;
import com.jeesite.common.entity.TreeEntity;
import com.jeesite.common.mapper.JsonMapper;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
@@ -138,8 +137,8 @@ public class Company extends TreeEntity<Company> {
return companyOfficeList;
}
public void setCompanyOfficeListJson(String jsonString) {
List<String> list = JsonMapper.fromJson(jsonString, List.class);
public void setOfficeCodes(String officeCodes) {
String[] list = StringUtils.split(officeCodes, ",");
if (list != null){
for (String val : list){
if (StringUtils.isNotBlank(val)){

View File

@@ -115,6 +115,8 @@ public class CompanyController extends BaseController {
office.setCompanyCode(company.getCompanyCode());
List<Office> officeList = officeService.findList(office);
model.addAttribute("officeList", officeList);
model.addAttribute("officeCodes", ListUtils.extractToString(officeList, "officeCode", ","));
model.addAttribute("officeNames", ListUtils.extractToString(officeList, "officeName", ","));
}
model.addAttribute("company", company);
model.addAttribute("ctrlPermi", Global.getConfig("user.adminCtrlPermi", "2"));

View File

@@ -85,12 +85,11 @@
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> ${text('包含机构')}<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:treeselect id="companyOfficeList" title="${text('机构选择')}"
value="${@ListUtils.extractToString(officeList!, 'officeCode', ',')}"
labelValue="${@ListUtils.extractToString(officeList!, 'officeName', ',')}"
<#form:treeselect id="office" title="${text('机构选择')}"
name="officeCodes" value="${officeCodes!}"
labelName="officeNames" labelValue="${officeNames!}"
url="${ctx}/sys/office/treeData" checkbox="true"
class="" allowClear="true"/>
<#form:hidden name="companyOfficeListJson"/>
</div>
</div>
</div>
@@ -125,8 +124,6 @@
<script>
$("#inputForm").validate({
submitHandler: function(form){
var companyOfficeData = $('#companyOfficeListCode').val().split(',');
$("#companyOfficeListJson").val(JSON.stringify(companyOfficeData));
js.ajaxSubmitForm($(form), function(data){
js.showMessage(data.message);
if(data.result == Global.TRUE){

View File

@@ -16,18 +16,18 @@
<div class="box-body">
<#form:form id="searchForm" model="${post}" action="${ctx}/sys/post/listData" method="post" class="form-inline hide"
data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
<div class="form-group">
<label class="control-label">${text('岗位编码')}</label>
<div class="control-inline">
<#form:input path="postCode" maxlength="64" class="form-control width-120"/>
</div>
</div>
<div class="form-group">
<label class="control-label">${text('岗位名称')}</label>
<div class="control-inline">
<#form:input path="postName_like" maxlength="100" class="form-control width-120"/>
</div>
</div>
<div class="form-group">
<label class="control-label">${text('岗位代码')}</label>
<div class="control-inline">
<#form:input path="viewCode" maxlength="64" class="form-control width-120"/>
</div>
</div>
<div class="form-group">
<label class="control-label">${text('岗位分类')}</label>
<div class="control-inline width-90">
@@ -59,7 +59,7 @@ $('#dataGrid').dataGrid({
{header:'${text("岗位名称")}', name:'postName', index:'a.post_name', width:200, align:"center", frozen:true, formatter: function(val, obj, row, act){
return '<a href="${ctx}/sys/post/form?postCode='+row.postCode+'" class="btnList" data-title="${text("编辑岗位")}">'+(val||row.id)+'</a>';
}},
{header:'${text("岗位码")}', name:'postCode', index:'a.post_code', width:200, align:"center"},
{header:'${text("岗位码")}', name:'viewCode', index:'a.view_code', width:200, align:"center"},
{header:'${text("排序号")}', name:'postSort', index:'a.post_sort', width:80, align:"center"},
{header:'${text("岗位分类")}', name:'postType', index:'a.post_type', width:100, align:"center", formatter: function(val, obj, row, act){
return js.getDictLabel(${@DictUtils.getDictListJson('sys_post_type')}, val, '未知', true);