文章目录
MIS开发
1.创建子系统
后台管理–数据管理平台–子系统管理–创建子系统
2.新增程序项目
后台管理–数据管理平台–程序项目
3.创建代码项
后台管理–数据管理平台–代码管理
代码项配置:
分级设置:
配置完一定要选中转移到子系统中
4.创建数据表
后台管理–数据管理平台–数据表管理
1.添加数据表
填写中英文名字
数据源不写默认是本地
2.创建字段
点击表结构
按照要求填写
比较重要的选项
这个很重要
多行文本不在列表展示,在页面展示
不要出错,不然会改很多代码
5.转移到子系统
6.代码生成
取消勾选
生成完后刷新工程
ctrl+shift+o批量导包
7.配置模块展示页面
后台管理–统一界面–模块管理
创建模块
配置路径
模块授权
8.分离工程
alt+shfit+v移动工程到相应的目录下
9.service引入依赖
拷贝框架高级服务api包到service的pom里面
<!-- 框架高级服务API包 -->
<dependency>
<groupId>com.epoint.frame</groupId>
<artifactId>epoint-workflow-common</artifactId>
</dependency>
<dependency>
<groupId>com.epoint.frame</groupId>
<artifactId>epoint-workflow-organ-api</artifactId>
</dependency>
<dependency>
<groupId>com.epoint.frame</groupId>
<artifactId>epoint-workflow-mgmt-api</artifactId>
</dependency>
<dependency>
<groupId>com.epoint.frame</groupId>
<artifactId>epoint-workflow-api</artifactId>
</dependency>
<dependency>
<groupId>com.epoint.frame</groupId>
<artifactId>epoint-workflow-tccmain-api</artifactId>
</dependency>
<dependency>
<groupId>com.epoint.frame</groupId>
<artifactId>epoint-stireport-api</artifactId>
</dependency>
<dependency>
<groupId>com.epoint.frame</groupId>
<artifactId>epoint-sform-api</artifactId>
</dependency>
<dependency>
<groupId>com.epoint.frame</groupId>
<artifactId>epoint-helpcenter-api</artifactId>
</dependency>
<dependency>
<groupId>com.epoint.frame</groupId>
<artifactId>epoint-mobile-api</artifactId>
</dependency>
功能点
新增页
下拉列表+数据联动
描述:项目类别变化修改资金金额
前台:
onValueChanged="onProjectTypeChanged"
<div role="control" label="项目类别" starred="true">
<input class="mini-combobox" action="projecttypeModel" id="projecttype"
bind="dataBean.projecttype" textField="text" valueField="id" emptyText="请选择..."
required="true" requiredErrorText="项目类别不能为空!" onValueChanged="onProjectTypeChanged" />
</div>
//项目类别与资金金额的联动
function onProjectTypeChanged(e) {
var val = e.value;
var projectmoney = mini.get("projectmoney");
switch (val) {
case "1":
projectmoney.setValue(1000000);
break;
case "2":
projectmoney.setValue(500000);
break;
case "3":
projectmoney.setValue(300000);
break;
case "4":
projectmoney.setValue(150000);
break;
default:
break;
}
}
禁止手动输入or只读
allowInput="false"
readOnly="false"
不显示请选择选项
第四个参数表示是否展示<请选择>选项
public List<SelectItem> getProjecttypeModel() {
if (projecttypeModel == null) {
projecttypeModel = DataUtil.convertMap2ComboBox(
//第四个参数表示是否展示<请选择>选项
(List<Map<String, String>>) CodeModalFactory.factory("下拉列表", "项目类别", null, false));
}
return this.projecttypeModel;
}
所有组件名称
组件管理
如果上面的建立错误了,可以按照下面的改前后台
人员单选+多选页面
人员单选页面(项目经理):framemanager/orga/orga/ou/selectouuser
人员多选页面(项目人员):framemanager/orga/orga/user/selectuser
人员选择按钮
mini-buttonedit
<div role="control" label="项目经理" starred="true">
<input id="projectmanager" class="mini-buttonedit" bind="dataBean.projectmanager"
required="true" requiredErrorText="项目经理不能为空!" onbuttonclick="onProjectManagerButtonClick"
allowInput="false" />
</div>
<div role="control" label="项目人员" starred="true">
<input id="projectuser" class="mini-buttonedit" bind="dataBean.projectuser" required="true"
requiredErrorText="项目人员不能为空!" onbuttonclick="onProjectProjectUserButtonClick"
allowInput="false" />
</div>
//打开人员单选页面
function onProjectManagerButtonClick() {
epoint.openDialog('请选择项目经理', 'framemanager/orga/orga/ou/selectouuser', projectManagerCallBack, {
width: 800,
height: 300,
param: {
name: 'sheldon'
}
});
}
//人员单选页面的回调
function projectManagerCallBack(rtnValue) {
if (rtnValue && rtnValue != "close") {
var val = rtnValue.split(";");
//展示text,存储value
mini.get("projectmanager").setValue(val[1]);
mini.get("projectmanager").setText(val[0]);
}
}
//打开人员多选页面
function onProjectProjectUserButtonClick() {
var guid = mini.get("projectuser").getValue();
epoint.openDialog('请选择项目人员', 'framemanager/orga/orga/user/selectuser', projectUserCallBack, {
width: 800,
height: 300,
param: {
name: 'sheldon',
userGuid: guid
}
});
}
//人员多选页面的回调
function projectUserCallBack(rtnValue) {
// console.log(rtnValue);
if (rtnValue && rtnValue != "close") {
var val = rtnValue.split("_SPLIT_");
//展示text,存储value
mini.get("projectuser").setValue(val[0]);
mini.get("projectuser").setText(val[1]);
}
}
下拉树控件
创建的时候先创建下拉列表,代码项要配置
使用下拉树控件,实现省市区三级树,并只能选择“区”一级。
class="mini-treeselect"
后台代码:action="belongzoneModel"
事件–控制只能选根节点:onBeforeNodeSelect="onBeforeTreeNodeSelect"
<div role="control" label="所属地区" starred="true">
<input class="mini-treeselect" action="belongzoneModel" id="belongzone"
bind="dataBean.belongzone" textField="text" valueField="id" emptyText="请选择..."
required="true" requiredErrorText="所属地区不能为空!" onBeforeNodeSelect="onBeforeTreeNodeSelect" />
</div>
//树节点选择事件
function onBeforeTreeNodeSelect(e) {
// console.log(e.node.id);
var id = e.node.id;
if (id.length != 6 || id == "f9root") {
//表示此节点不能被选择
e.cancel = "true";
}
}
private LazyTreeModal9 lazyTreeModal9;
//
public LazyTreeModal9 getBelongzoneModel() {
if (lazyTreeModal9 == null) {
//代码项
lazyTreeModal9 = new LazyTreeModal9(new CodeTreeHandler("所属地区",false));
//根节点名称
lazyTreeModal9.setRootName("所有地区");
}
return this.lazyTreeModal9;
}
重名验证(新增)
保存时候查询数据库,当前项目是否在数据库存在,如果存在就返回提示
action:
private Projectinfo dataBean = null;
/
public void add() {
dataBean.setRowguid(UUID.randomUUID().toString());
dataBean.setOperatedate(new Date());
dataBean.setOperateusername(userSession.getDisplayName());
//项目名称的重名判断
int count = service.checkName(dataBean.getProjectname());
if (count>0) {
addCallbackParam("msg", "项目名称重复!");
addCallbackParam("sameName", true);
}else {
service.insert(dataBean);
addCallbackParam("msg", "保存成功!");
dataBean = null;
}
}
service:
public int checkName(String projectname) {
// TODO Auto-generated method stub
String sql = "select count(*) from projectinfo where projectname = ?";
return baseDao.queryInt(sql, projectname);
}
重名时候不关闭页面
action:
addCallbackParam("sameName", true);
前端:
<a class="mini-button" id="addClose" onclick="saveAndClose">保存并关闭</a>
function saveAndClose() {
if (epoint.validate()) {
epoint.execute('add', 'fui-form', closeCallback);
}
}
// 关闭操作的回调
function closeCallback(data) {
if (data.sameName) {
epoint.alert(data.msg);
} else if (data.msg) {
epoint.alertAndClose(data.msg, '', null, null, 'info');
}
}
修改页
将guid渲染成文本
在action中pageLoad方法中处理好带回前台
@Autowired
private IUserService iUserService;
@Autowired
private ICodeItemsService ioCodeItemsService;
action:
public void pageLoad() {
String guid = getRequestParameter("guid");
dataBean = service.find(guid);
// 将项目经理guid转换成文本
String projectManagerName = iUserService.getUserNameByUserGuid(dataBean.getProjectmanager());
addCallbackParam("projectManagerName", projectManagerName);
// 将项目人员guid转化成相应的文本
String projectUserName = service.getAllUserName(dataBean.getProjectuser());
addCallbackParam("projectUserName", projectUserName);
// 将项目人员guid转化成相应的文本 方法2
// String allUserGuid = dataBean.getProjectuser();
// String[] allUser = allUserGuid.split(";");
// List<String> nameList = new ArrayList<>();
// for (String str : allUser) {
// String name = iUserService.getUserNameByUserGuid(str);
// nameList.add(name);
// }
// String projectUserName = StringUtil.join(nameList, ";");
// addCallbackParam("projectUserName", projectUserName);
// 根据所属地区value转换成文本
//ioCodeItemsService将代码项值转为文本
String belongZoneText = ioCodeItemsService.getItemTextByCodeName("所属地区", dataBean.getBelongzone());
addCallbackParam("belongZoneText", belongZoneText);
if (dataBean == null) {
dataBean = new Projectinfo();
}
}
service:
public String getAllUserName(String projectuser) {
// String allUserGuid = dataBean.getProjectuser();
// String[] allUser = allUserGuid.split(";");
// List<String> nameList = new ArrayList<>();
// for (String str : allUser) {
// String name = iUserService.getUserNameByUserGuid(str);
// nameList.add(name);
// }
// String projectUserName = StringUtil.join(nameList, ";");
String[] allUser = projectuser.split(";");
List<String> nameList = new ArrayList<>();
//建议用这种方法调用IUserService
IUserService iUserService = ContainerFactory.getContainInfo().getComponent(IUserService.class);
for (String str : allUser) {
String name = iUserService.getUserNameByUserGuid(str);
nameList.add(name);
}
String projectUserName = StringUtil.join(nameList, ";");
return projectUserName;
}
前台:
// 初始化页面
epoint.initPage('projectinfoeditaction', null, function (data) {
if (data.projectManagerName) {
mini.get("projectmanager").setText(data.projectManagerName);
}
if (data.projectUserName) {
mini.get("projectuser").setText(data.projectUserName);
}
if (data.belongZoneText) {
mini.get("belongzone").setText(data.belongZoneText);
}
console.log(mini.get("projectmanager"));
});
修改页实现和新增页一样的效果
将内容区域的代码拷贝到edit,把方法粘过去
重复代码可以直接调用:
action="projectinfoaddaction.belongzoneModel"
<div role="control" label="所属地区" starred="true">
<input class="mini-treeselect" action="projectinfoaddaction.belongzoneModel" id="belongzone"
bind="dataBean.belongzone" textField="text" valueField="id" emptyText="请选择..."
required="true" requiredErrorText="所属地区不能为空!" onBeforeNodeSelect="onBeforeTreeNodeSelect" />
</div>
后台处理:见将guid渲染成文本
String belongZoneText = ioCodeItemsService.getItemTextByCodeName("所属地区", dataBean.getBelongzone());
addCallbackParam("belongZoneText", belongZoneText);
public void pageLoad() {
String guid = getRequestParameter("guid");
dataBean = service.find(guid);
// 将项目经理guid转换成文本
String projectManagerName = iUserService.getUserNameByUserGuid(dataBean.getProjectmanager());
addCallbackParam("projectManagerName", projectManagerName);
// 将项目人员guid转化成相应的文本
String projectUserName = service.getAllUserName(dataBean.getProjectuser());
addCallbackParam("projectUserName", projectUserName);
// 将项目人员guid转化成相应的文本 方法2
// String allUserGuid = dataBean.getProjectuser();
// String[] allUser = allUserGuid.split(";");
// List<String> nameList = new ArrayList<>();
// for (String str : allUser) {
// String name = iUserService.getUserNameByUserGuid(str);
// nameList.add(name);
// }
// String projectUserName = StringUtil.join(nameList, ";");
// addCallbackParam("projectUserName", projectUserName);
// 根据所属地区value转换成文本
//ioCodeItemsService将代码项值转为文本
String belongZoneText = ioCodeItemsService.getItemTextByCodeName("所属地区", dataBean.getBelongzone());
addCallbackParam("belongZoneText", belongZoneText);
if (dataBean == null) {
dataBean = new Projectinfo();
}
}
前台:
// 初始化页面
epoint.initPage('projectinfoeditaction', null, function (data) {
if (data.projectManagerName) {
mini.get("projectmanager").setText(data.projectManagerName);
}
if (data.projectUserName) {
mini.get("projectuser").setText(data.projectUserName);
}
if (data.belongZoneText) {
mini.get("belongzone").setText(data.belongZoneText);
}
console.log(mini.get("projectmanager"));
});
重名验证(修改)
action:
public void save() {
dataBean.setOperatedate(new Date());
// 修改页的重名验证
String projectNameOld = service.find(dataBean.getRowguid()).getProjectname();
String projectNameNew = dataBean.getProjectname();
int count = service.checkName(projectNameOld, projectNameNew);
if (count > 0) {
addCallbackParam("msg", "项目名称重复!");
addCallbackParam("sameName", true);
}
else {
service.update(dataBean);
addCallbackParam("msg", "修改成功!");
}
}
service:
public int checkName(String projectNameOld, String projectNameNew) {
// TODO Auto-generated method stub
String sql = "select count(*) from projectinfo where projectname != ? and projectname=?";
return baseDao.