框架开发学习

本文详细介绍了MIS开发的过程,包括创建子系统、程序项目、数据表及字段的创建,以及功能点如新增、修改、详情和列表页的实现。涉及到工作流配置、REST接口的编写和授权,以及首页元件配置等关键步骤。此外,还涵盖了数据联动、权限控制、消息通知和接口调用等多个方面。
摘要由CSDN通过智能技术生成

文章目录

MIS开发

1.创建子系统

后台管理–数据管理平台–子系统管理–创建子系统

image-20211215192151047

2.新增程序项目

后台管理–数据管理平台–程序项目

image-20211215192353782

3.创建代码项

后台管理–数据管理平台–代码管理

image-20211215192503771

代码项配置:

image-20211215192600177

分级设置:

image-20211215192627548

image-20211215192800364

image-20211215192647192

配置完一定要选中转移到子系统中

4.创建数据表

后台管理–数据管理平台–数据表管理

1.添加数据表

填写中英文名字

数据源不写默认是本地

2.创建字段

点击表结构

image-20211215193418196

按照要求填写

image-20211215193505805

比较重要的选项

image-20211215193749686

这个很重要

image-20211215193755299

image-20211215193801622

image-20211215193818194

多行文本不在列表展示,在页面展示

不要出错,不然会改很多代码

5.转移到子系统

6.代码生成

image-20211215195246902

image-20211215195210746

取消勾选

image-20211215195824027

生成完后刷新工程

ctrl+shift+o批量导包

7.配置模块展示页面

后台管理–统一界面–模块管理

创建模块

image-20211215195515770

配置路径

image-20211215195632698

模块授权

image-20211215195556684

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>

功能点

新增页

下拉列表+数据联动

描述:项目类别变化修改资金金额

image-20211215200846225

前台:

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;
    }

所有组件名称

组件管理

如果上面的建立错误了,可以按照下面的改前后台

image-20211215201315452

人员单选+多选页面

人员单选页面(项目经理):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,把方法粘过去

image-20211215205543529

重复代码可以直接调用:

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.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

迪杰斯特夫

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值