|
@@ -1,9 +1,10 @@ |
|
|
package cc.smtweb.system.bpm.test; |
|
|
package cc.smtweb.system.bpm.test; |
|
|
|
|
|
|
|
|
import cc.smtweb.framework.core.util.JsonUtil; |
|
|
|
|
|
|
|
|
import cc.smtweb.framework.core.util.FileUtil; |
|
|
import cc.smtweb.system.bpm.web.design.form.ModelFormHelper; |
|
|
import cc.smtweb.system.bpm.web.design.form.ModelFormHelper; |
|
|
import cc.smtweb.system.bpm.web.design.form.define.PageDatasetDynCond; |
|
|
import cc.smtweb.system.bpm.web.design.form.define.PageDatasetDynCond; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.Collections; |
|
|
import java.util.Collections; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@@ -12,93 +13,7 @@ import java.util.Collections; |
|
|
public class TestMain { |
|
|
public class TestMain { |
|
|
|
|
|
|
|
|
public static void main(String[] args) throws Exception { |
|
|
public static void main(String[] args) throws Exception { |
|
|
String js = "// 注册事件类\n" + |
|
|
|
|
|
"window.$swEvent.setup(\"defaultEvent\", {\n" + |
|
|
|
|
|
" /**\n" + |
|
|
|
|
|
" *\n" + |
|
|
|
|
|
" * @param page 当前页面对象\n" + |
|
|
|
|
|
" * 1)page.$params 参数对象\n" + |
|
|
|
|
|
" * 示例:给参数p1赋值: page.$params.p1 = “xxxx”;\n" + |
|
|
|
|
|
" *\n" + |
|
|
|
|
|
" * 2)page.$refs 控件的ref引用,ref引用指向控件的实例,可访问控件实例的属性和函数\n" + |
|
|
|
|
|
" * 示例:调用页面的<el-form ref=\"form1\" /> 标签的validate方法: page.$refs.form1.validate()\n" + |
|
|
|
|
|
" *\n" + |
|
|
|
|
|
" * 3)page.$model 数据集,内含data(数据对象)和dataset(数据集定义)\n" + |
|
|
|
|
|
" * 示例: 获取数据集ds1的表单数据 page.$model.ds1.data.form\n" + |
|
|
|
|
|
" * 获取数据集ds1的列表数据 page.$model.ds1.data.list\n" + |
|
|
|
|
|
" * 获取数据集ds1表单中a1的值 page.$model.ds1.getFormVal(\"a1\")\n" + |
|
|
|
|
|
" * 给数据集ds1的表中的a1赋值 page.$model.ds1.setFormVal(\"a1\",\"xxxx\");\n" + |
|
|
|
|
|
" *\n" + |
|
|
|
|
|
" * 4)page.$widgets 控件的属性,控制控件的响应属性\n" + |
|
|
|
|
|
" * 示例 : 获取控件名为w1的required属性的值 page.$widgets.w1.required\n" + |
|
|
|
|
|
" *\n" + |
|
|
|
|
|
" * 5)page.$utils 工具包\n" + |
|
|
|
|
|
" * $$message 消息提示\n" + |
|
|
|
|
|
" * $$cookie, cookie\n" + |
|
|
|
|
|
" * $$driver, 用户操作引导引擎\n" + |
|
|
|
|
|
" * $$http, http请求\n" + |
|
|
|
|
|
" * $$validate, 校验\n" + |
|
|
|
|
|
" * $$date, 日期处理工具\n" + |
|
|
|
|
|
" * $$UtilPub, 其他\n" + |
|
|
|
|
|
" * 示例:\n" + |
|
|
|
|
|
" * 弹出成功消息框:page.$utils.$$message.notify.success(\"xxx\")\n" + |
|
|
|
|
|
" * post请求:page.$utils.$$http.post(\"/api/bpm/save\",{id:\"xxx\"})\n" + |
|
|
|
|
|
" *\n" + |
|
|
|
|
|
" * 6)page.$tabRouter 页面路由,控制页面切换\n" + |
|
|
|
|
|
" * 示例:跳转到登录页:page.$tabRouter.push(\"login\");\n" + |
|
|
|
|
|
" * 返回: page.$tabRouter.back();\n" + |
|
|
|
|
|
" *\n" + |
|
|
|
|
|
" * 7) page.$api 页面提供的公用api\n" + |
|
|
|
|
|
" * add: () => void 页面新增初始化(所有可编辑的数据集)\n" + |
|
|
|
|
|
" * addOne: (dataset: string) => void 指定数据集新增初始\n" + |
|
|
|
|
|
" * load: (force?: boolean, params?: any) => void // 页面加载\n" + |
|
|
|
|
|
" * loadOne: (dataset: string, params?: any) => void // 指定数据集加载\n" + |
|
|
|
|
|
" * total: (dataset: string, params?: any) => void // 指定数据集求合计栏信息\n" + |
|
|
|
|
|
" * save: (params?: any) => void // 页面保存 (所有可编辑的数据集)\n" + |
|
|
|
|
|
" * saveOne: (dataset: string, params?: any) => void // 指定数据集保存\n" + |
|
|
|
|
|
" * del: () => void 页面删除\n" + |
|
|
|
|
|
" * delOne: (dataset: string, row?: any) => void // 指定数据集删除\n" + |
|
|
|
|
|
" * closeDialog: (dialogKey?: string) => void // 关闭弹出框\n" + |
|
|
|
|
|
" * 示例:\n" + |
|
|
|
|
|
" * 加载数据集ds1:page.$api.loadOne(\"ds1\");\n" + |
|
|
|
|
|
" *\n" + |
|
|
|
|
|
" * @returns 返回给页面可配置的api方法\n" + |
|
|
|
|
|
" * 如 : return {\n" + |
|
|
|
|
|
" * demoFunc(){\n" + |
|
|
|
|
|
" * XXXX\n" + |
|
|
|
|
|
" * },\n" + |
|
|
|
|
|
" * }\n" + |
|
|
|
|
|
" */\n" + |
|
|
|
|
|
" setup(page){\n" + |
|
|
|
|
|
" const { $params,$refs, $widgets, $model, $utils, $tabRouter, $api } = page;\n" + |
|
|
|
|
|
" const { $$message, $$http } = $utils || {};\n" + |
|
|
|
|
|
" // 示例\n" + |
|
|
|
|
|
" const demoFunc = () => {\n" + |
|
|
|
|
|
" // 1.从参数中获取p1\n" + |
|
|
|
|
|
" const p1 = $params.p1;\n" + |
|
|
|
|
|
" // 2.从控件w1获取color属性\n" + |
|
|
|
|
|
" const color = $widgets.w1.props.color;\n" + |
|
|
|
|
|
" // 3.调用控件w1的calc函数\n" + |
|
|
|
|
|
" const calcVal = $refs.w1.calc(p1,color);\n" + |
|
|
|
|
|
" // 4.数据集ds1加载数据\n" + |
|
|
|
|
|
" $api.loadOne(\"ds1\");\n" + |
|
|
|
|
|
" // 5.给数据集ds1的表单中的f1字段赋值calcVal\n" + |
|
|
|
|
|
" $model.ds1.setFormVal(\"f1\",calcVal);\n" + |
|
|
|
|
|
" // 6.获取数据集ds1的表单数据\n" + |
|
|
|
|
|
" const data = $model.ds1.data.form || {};\n" + |
|
|
|
|
|
" // 7.调用http交互\n" + |
|
|
|
|
|
" $$http.post(\"ap1/demo/doOpt\",data).then((rt) => {\n" + |
|
|
|
|
|
" // 8.弹出成功消息\n" + |
|
|
|
|
|
" $$message.notify.success(\"操作成功\");\n" + |
|
|
|
|
|
" // 9.返回上一个页面\n" + |
|
|
|
|
|
" $tabRouter.back();\n" + |
|
|
|
|
|
" });\n" + |
|
|
|
|
|
" };\n" + |
|
|
|
|
|
" return {\n" + |
|
|
|
|
|
" demoFunc, demoFunc1, demoFunc2,\n" + |
|
|
|
|
|
" }\n" + |
|
|
|
|
|
" }\n" + |
|
|
|
|
|
"});"; |
|
|
|
|
|
|
|
|
String js = FileUtil.readFileStr("e:\\jujia\\git\\6.0\\smtweb2\\smtweb-framework\\bpm\\src\\main\\resources\\static\\event\\defaultEvent.js"); |
|
|
int index = js.lastIndexOf("return "); |
|
|
int index = js.lastIndexOf("return "); |
|
|
if (index < 0) { |
|
|
if (index < 0) { |
|
|
return; |
|
|
return; |
|
|