mirror of https://gitee.com/stylefeng/guns
更新通用tree选择器
parent
3dd68a7219
commit
cbcbd85a8c
|
@ -0,0 +1,46 @@
|
||||||
|
package cn.stylefeng.guns.modular.common;
|
||||||
|
|
||||||
|
import cn.stylefeng.guns.modular.common.pojo.CommonTreeRequest;
|
||||||
|
import cn.stylefeng.roses.kernel.resource.api.annotation.ApiResource;
|
||||||
|
import cn.stylefeng.roses.kernel.resource.api.annotation.GetResource;
|
||||||
|
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
|
||||||
|
import cn.stylefeng.roses.kernel.rule.exception.enums.defaults.DefaultBusinessExceptionEnum;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.URLDecoder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用界面
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @date 2021/1/6 20:18
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@Slf4j
|
||||||
|
@ApiResource(name = "通用界面")
|
||||||
|
public class CommonViewController {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用的树列表选择器
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @date 2021/1/6 20:19
|
||||||
|
*/
|
||||||
|
@GetResource(name = "通用的树列表选择器", path = "/view/common/tree")
|
||||||
|
public String commonTreeSelect(@Valid CommonTreeRequest commonTreeRequest, Model model) {
|
||||||
|
try {
|
||||||
|
model.addAttribute("formName", URLDecoder.decode(commonTreeRequest.getFormName(), "UTF-8"));
|
||||||
|
model.addAttribute("formId", URLDecoder.decode(commonTreeRequest.getFormId(), "UTF-8"));
|
||||||
|
model.addAttribute("treeUrl", URLDecoder.decode(commonTreeRequest.getTreeUrl(), "UTF-8"));
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
log.error("解析url的参数出错!", e);
|
||||||
|
throw new ServiceException("guns-standalone-beetl", DefaultBusinessExceptionEnum.SYSTEM_RUNTIME_ERROR);
|
||||||
|
}
|
||||||
|
return "/modular/common/tree_dlg.html";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package cn.stylefeng.guns.modular.common.pojo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用树选择器界面的请求参数
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @date 2021/1/6 20:20
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CommonTreeRequest {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 传递给上级页面的哪个字段,例如 parent.MenuInfoDlg.data.pcodeName
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "fromName不能为空")
|
||||||
|
private String formName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 传递给上级页面的哪个id值,例如 parent.MenuInfoDlg.data.pid
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "formId不能为空")
|
||||||
|
private String formId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 渲染出数据的url,例如/menu/selectMenuTreeList
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "tree渲染的url参数不能为空")
|
||||||
|
private String treeUrl;
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue