sasp-flow-render 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +108 -0
- package/package.json +21 -0
- package/router.js +13 -0
- package/src/assets/font/iconfont.css +1158 -0
- package/src/assets/font/iconfont.eot +0 -0
- package/src/assets/font/iconfont.js +1 -0
- package/src/assets/font/iconfont.svg +827 -0
- package/src/assets/font/iconfont.ttf +0 -0
- package/src/assets/font/iconfont.woff +0 -0
- package/src/assets/images/card_zwsj.png +0 -0
- package/src/assets/images/dataStore.png +0 -0
- package/src/assets/images/dataStore_icon.png +0 -0
- package/src/assets/images/draft.png +0 -0
- package/src/assets/images/edit_icon.png +0 -0
- package/src/assets/images/end.png +0 -0
- package/src/assets/images/end_icon.png +0 -0
- package/src/assets/images/gateway.png +0 -0
- package/src/assets/images/gateway_icon.png +0 -0
- package/src/assets/images/globalConnect_icon.png +0 -0
- package/src/assets/images/group_icon.png +0 -0
- package/src/assets/images/hander_icon.png +0 -0
- package/src/assets/images/icon_ quality.png +0 -0
- package/src/assets/images/lasso_icon.png +0 -0
- package/src/assets/images/mobile_preview.png +0 -0
- package/src/assets/images/participant_icon.png +0 -0
- package/src/assets/images/publicProcess_icon.png +0 -0
- package/src/assets/images/remind_example.png +0 -0
- package/src/assets/images/space_icon.png +0 -0
- package/src/assets/images/start.png +0 -0
- package/src/assets/images/start_icon.png +0 -0
- package/src/assets/images/subprocess_icon.png +0 -0
- package/src/assets/images/tab_set_example.png +0 -0
- package/src/assets/images/timer.png +0 -0
- package/src/assets/images/timer_icon.png +0 -0
- package/src/assets/images/userTask_icon.png +0 -0
- package/src/assets/images/user_task.png +0 -0
- package/src/assets/js/api/apiFlow.js +219 -0
- package/src/assets/js/flowInstall.js +25 -0
- package/src/assets/js/global/cacheGlobal.js +110 -0
- package/src/assets/js/global/flowGlobal.js +61 -0
- package/src/assets/js/global/flowUserGlobal.js +35 -0
- package/src/assets/js/global/interfaceCache.js +31 -0
- package/src/assets/js/storageIO.js +106 -0
- package/src/components/flowChart.vue +463 -0
- package/src/components/flowInst/css/flowInstList.scss +193 -0
- package/src/components/flowInst/flowInstList.vue +818 -0
- package/src/components/flowInst/flowInstTab.vue +2858 -0
- package/src/components/flowInst/popup/flowInstForm.vue +54 -0
- package/src/components/flowRoamRecords.vue +768 -0
- package/src/components/messageMould/messageMould.vue +547 -0
- package/src/components/roamRecord.vue +567 -0
- package/src/components/userSelect.vue +537 -0
- package/src/views/flowInstView.vue +178 -0
- package/src/views/menuRouter/flowMenuRouter.vue +260 -0
- package/src/views/menuRouter/flowResRouter.vue +223 -0
- package/src/views/popup/css/flowMain.scss +156 -0
- package/src/views/popup/event/compoment/diy/info.txt +1 -0
- package/src/views/popup/event/compoment/eventParentConfig.vue +45 -0
- package/src/views/popup/event/js/loadFlowEventPlugin.js +279 -0
- package/src/views/popup/js/controls/CustomContextPad.js +310 -0
- package/src/views/popup/js/controls/CustomPalette.js +303 -0
- package/src/views/popup/js/controls/CustomRenderer.js +219 -0
- package/src/views/popup/js/controls/index.js +11 -0
- package/src/views/popup/js/customModeler/CustomModeler.js +22 -0
- package/src/views/popup/js/translations/customTranslate.js +14 -0
- package/src/views/popup/js/translations/translations.js +234 -0
- package/src/views/popup/js/utils/utils.js +53 -0
- package/src/views/test.vue +79 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
|
|
2
|
+
.flow-define-info {
|
|
3
|
+
|
|
4
|
+
.js-canvas {
|
|
5
|
+
height: 100%;
|
|
6
|
+
width: 100%;
|
|
7
|
+
|
|
8
|
+
/* 背景网格 */
|
|
9
|
+
background-color: white;
|
|
10
|
+
background-image: linear-gradient(
|
|
11
|
+
90deg,
|
|
12
|
+
rgba(220, 220, 220, 0.5) 6%,
|
|
13
|
+
transparent 0
|
|
14
|
+
),
|
|
15
|
+
linear-gradient(rgba(192, 192, 192, 0.5) 6%, transparent 0) !important;
|
|
16
|
+
background-size: 20px 20px;
|
|
17
|
+
|
|
18
|
+
/deep/ {
|
|
19
|
+
.djs-palette{
|
|
20
|
+
position: absolute;
|
|
21
|
+
left: -50px;
|
|
22
|
+
top: 0px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.djs-palette.two-column.open{
|
|
26
|
+
width: min-content;
|
|
27
|
+
}
|
|
28
|
+
.bjs-powered-by{
|
|
29
|
+
display: none;
|
|
30
|
+
}
|
|
31
|
+
.bpmn-icon-end-event-none:before {
|
|
32
|
+
color: #3384fe;
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
}
|
|
35
|
+
.bpmn-icon-gateway-none:before{
|
|
36
|
+
color: #3384fe;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.bpmn-icon-connection-multi:before{
|
|
40
|
+
color: #3384fe;
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
}
|
|
43
|
+
.bpmn-icon-hand-tool:before{
|
|
44
|
+
color: #3384fe;
|
|
45
|
+
cursor: pointer;
|
|
46
|
+
}
|
|
47
|
+
.bpmn-icon-lasso-tool:before{
|
|
48
|
+
color: #3384fe;
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
}
|
|
51
|
+
.bpmn-icon-space-tool:before{
|
|
52
|
+
color: #3384fe;
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**重写系统默认图标先执行隐藏 以下隐藏不需要的栏目**/
|
|
57
|
+
.bpmn-icon-intermediate-event-none{ //中间事件
|
|
58
|
+
display: none;
|
|
59
|
+
}
|
|
60
|
+
.bpmn-icon-data-object{ //
|
|
61
|
+
display: none;
|
|
62
|
+
}
|
|
63
|
+
.bpmn-icon-task {
|
|
64
|
+
display: none;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.bpmn-icon-start-event-none{
|
|
68
|
+
display: none;
|
|
69
|
+
}
|
|
70
|
+
.bpmn-icon-end-event-none{
|
|
71
|
+
display: none;
|
|
72
|
+
}
|
|
73
|
+
.bpmn-icon-hand-tool{
|
|
74
|
+
display: none;
|
|
75
|
+
}
|
|
76
|
+
.bpmn-icon-lasso-tool{
|
|
77
|
+
display: none;
|
|
78
|
+
}
|
|
79
|
+
.bpmn-icon-space-tool{
|
|
80
|
+
display: none;
|
|
81
|
+
}
|
|
82
|
+
.bpmn-icon-screw-wrench{
|
|
83
|
+
display: none;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.demo-data-timer{ /* 暂时隐藏 计时器*/
|
|
87
|
+
display: none;
|
|
88
|
+
}
|
|
89
|
+
.demo-data-store{ /* 暂时隐藏 数据操作*/
|
|
90
|
+
display: none;
|
|
91
|
+
}
|
|
92
|
+
.bpmn-icon-text-annotation{ /*隐藏 文本注释*/
|
|
93
|
+
display: none;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.bpmn-icon-trash[data-action="delete"]{ /* 隐藏系统默认删除按钮 */
|
|
97
|
+
display: none;
|
|
98
|
+
}
|
|
99
|
+
.djs-palette-entries .bpmn-icon-connection-multi{
|
|
100
|
+
display: none;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
#bpmnContainer {
|
|
109
|
+
display: flex;
|
|
110
|
+
flex: 1;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
.properties-panel-parent {
|
|
115
|
+
position: relative;
|
|
116
|
+
top: 0;
|
|
117
|
+
bottom: 0;
|
|
118
|
+
right: 0;
|
|
119
|
+
width: 260px;
|
|
120
|
+
height: 100%;
|
|
121
|
+
z-index: 10;
|
|
122
|
+
border-left: 1px solid #ccc;
|
|
123
|
+
overflow: auto;
|
|
124
|
+
|
|
125
|
+
&:empty {
|
|
126
|
+
display: none;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
> .djs-properties-panel {
|
|
130
|
+
padding-bottom: 70px;
|
|
131
|
+
min-height: 100%;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
.right-content{
|
|
135
|
+
position: absolute;right: 0;top: 0;width: 350px;box-sizing: border-box;height: 100%;
|
|
136
|
+
border-left: 1px solid #c2c2c2;background-color: #FFF;
|
|
137
|
+
}
|
|
138
|
+
.right-content /deep/ .el-tabs__nav-scroll{
|
|
139
|
+
padding: 0 10px;
|
|
140
|
+
}
|
|
141
|
+
.right-content /deep/ .el-tabs__header{
|
|
142
|
+
margin: 0;
|
|
143
|
+
}
|
|
144
|
+
.right-content /deep/ .el-tabs__nav-wrap::after{
|
|
145
|
+
height: 1px;
|
|
146
|
+
background-color: #c2c2c2;
|
|
147
|
+
}
|
|
148
|
+
.right-content /deep/ .el-tabs__content{
|
|
149
|
+
height: calc(100% - 40px);
|
|
150
|
+
overflow-y: auto;
|
|
151
|
+
}
|
|
152
|
+
.right-content /deep/ .el-tabs__item span{
|
|
153
|
+
font-size: 16px;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
自定义组件
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
export default {
|
|
7
|
+
name: "event-parent-config",
|
|
8
|
+
props:{
|
|
9
|
+
configData:{required:true},
|
|
10
|
+
dataTypeArr:{type:Array,default:() => {return [];}},
|
|
11
|
+
dataTreeObj:{type:Object,default:() => {return {};}},
|
|
12
|
+
dataTreeArr:{type:Array,default:() => {return [];}},
|
|
13
|
+
formBaseObj:{type:Object,default:() => {return {};}},
|
|
14
|
+
nodePowerDataArr:{type:Array,default:() =>{return []}}, //可配置字段
|
|
15
|
+
allSysDataObj:{type:Object,default:() =>{return {};}},//数据字段对象
|
|
16
|
+
},
|
|
17
|
+
data(){
|
|
18
|
+
return{
|
|
19
|
+
eventSource:'',//控件来源
|
|
20
|
+
eventName:'', //控件显示名称
|
|
21
|
+
eventData:this.configData,
|
|
22
|
+
nodeObj:this.configData,
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
created(){
|
|
26
|
+
|
|
27
|
+
},
|
|
28
|
+
methods:{
|
|
29
|
+
getConfigDatas(){
|
|
30
|
+
return this.configData;
|
|
31
|
+
},
|
|
32
|
+
/**
|
|
33
|
+
* 校验方法
|
|
34
|
+
*/
|
|
35
|
+
validateMethod(){
|
|
36
|
+
return true;
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<style scoped>
|
|
44
|
+
|
|
45
|
+
</style>
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import {eventPlugin} from "sasp-base";
|
|
2
|
+
import axios from "axios/index";
|
|
3
|
+
import apiFlow from "../../../../assets/js/api/apiFlow";
|
|
4
|
+
|
|
5
|
+
/*读取自定义表单事件文件*/
|
|
6
|
+
const diyComponents = require.context(
|
|
7
|
+
'../compoment/diy/',
|
|
8
|
+
// 是否查询其子目录
|
|
9
|
+
true,
|
|
10
|
+
// 匹配vue后缀文件名的文件
|
|
11
|
+
/\.vue$/
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
/*读取系统事件目录**/
|
|
15
|
+
const sysComponents = require.context(
|
|
16
|
+
'../compoment/system/',
|
|
17
|
+
// 是否查询其子目录
|
|
18
|
+
true,
|
|
19
|
+
// 匹配vue后缀文件名的文件
|
|
20
|
+
/\.vue$/
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
let eventComponent = {}; // 加载格式化中所有配置与渲染组件
|
|
25
|
+
|
|
26
|
+
let systemEventComponent = {}; //加载系统事件规则配置
|
|
27
|
+
let eventRuleComponent = {}; //
|
|
28
|
+
diyComponents.keys().forEach(fileName => {//自定义
|
|
29
|
+
const component = diyComponents(fileName).default;
|
|
30
|
+
if(component.name){
|
|
31
|
+
eventComponent[component.name]= component;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
sysComponents.keys().forEach(fileName =>{ //系统
|
|
35
|
+
const component = sysComponents(fileName).default;
|
|
36
|
+
if(component.name){
|
|
37
|
+
systemEventComponent[component.name]= component;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
let tableViewEvent = []; //表单事件arr
|
|
43
|
+
let eventObj = {}; //事件对象
|
|
44
|
+
|
|
45
|
+
// Object.keys(eventRuleComponent).forEach(key =>{
|
|
46
|
+
// // 组件转换存储数据库并读取恢复start
|
|
47
|
+
// let componentTemp = eventRuleComponent[key];
|
|
48
|
+
// let obj = {};
|
|
49
|
+
// dealComponent(componentTemp,obj);
|
|
50
|
+
// // JSON.stringify(componentTemp)和JSON.stringify(obj)就是虚拟的存储到数据库的数据
|
|
51
|
+
// let tempComp = JSON.parse(JSON.stringify(componentTemp));
|
|
52
|
+
// obj = JSON.parse(JSON.stringify(obj));
|
|
53
|
+
// recoverComponent(obj);
|
|
54
|
+
// assignLevel(tempComp,obj);
|
|
55
|
+
// if(tempComp.eventType){
|
|
56
|
+
// eventObj[tempComp.name] = {
|
|
57
|
+
// id:tempComp.name,
|
|
58
|
+
// name:tempComp.eventName,
|
|
59
|
+
// config:tempComp, // 配置组件
|
|
60
|
+
// render:tempComp.renderKey? eventComponent[tempComp.renderKey] : null, // 渲染组件
|
|
61
|
+
// // getConfigDatas:"getConfigDatas", // 获取配置组件内容的方法,不写默认getConfigDatas
|
|
62
|
+
// reqBefore:eventComponent["test-before"], // 请求前加载组件
|
|
63
|
+
// reqAfter:eventComponent["test-after"], // 请求后加载组件
|
|
64
|
+
// };
|
|
65
|
+
// }
|
|
66
|
+
// if(tempComp.eventType == 'form'){ //表单
|
|
67
|
+
// tableViewEvent.push({
|
|
68
|
+
// id : tempComp.name,
|
|
69
|
+
// name: tempComp.eventShowName,
|
|
70
|
+
// config:tempComp, // 配置组件
|
|
71
|
+
// render:eventComponent["code-formatter-render"], // 渲染组件
|
|
72
|
+
// // getConfigDatas:"getConfigDatas", // 获取配置组件内容的方法,不写默认getConfigDatas
|
|
73
|
+
// reqBefore:eventComponent["test-before"], // 请求前加载组件
|
|
74
|
+
// reqAfter:eventComponent["test-after"], // 请求后加载组件
|
|
75
|
+
// })
|
|
76
|
+
//
|
|
77
|
+
// }else if(tempComp.eventType == 'list') { //列表
|
|
78
|
+
//
|
|
79
|
+
// }else if(tempComp.eventType == 'flow'){//流程
|
|
80
|
+
//
|
|
81
|
+
// }
|
|
82
|
+
// });
|
|
83
|
+
// 组件转换存储数据库并读取恢复start
|
|
84
|
+
// let componentTemp = eventComponent["code-formatter-config"];
|
|
85
|
+
// let obj = {};
|
|
86
|
+
// // 处理组件函数
|
|
87
|
+
// dealComponent(componentTemp,obj);
|
|
88
|
+
|
|
89
|
+
// function dealComponent(methodComponent,result){
|
|
90
|
+
// Object.keys(methodComponent).forEach(key => {
|
|
91
|
+
// if(Array.isArray(methodComponent[key])){
|
|
92
|
+
// result[key] = methodComponent[key].slice(0);
|
|
93
|
+
// result[key].forEach((item,index) => {
|
|
94
|
+
// if(typeof item === "function"){
|
|
95
|
+
// result[key][index] = item.toString();
|
|
96
|
+
// }
|
|
97
|
+
// })
|
|
98
|
+
// }
|
|
99
|
+
// if(typeof methodComponent[key] === "function"){
|
|
100
|
+
// result[key] = methodComponent[key].toString();
|
|
101
|
+
// }
|
|
102
|
+
// if(typeof methodComponent[key] === "object" && !Array.isArray(methodComponent[key])){
|
|
103
|
+
// if(methodComponent[key]["beforeCreate"] && methodComponent[key]["beforeDestroy"]){ // 继承的组件
|
|
104
|
+
// result[key] = {};
|
|
105
|
+
// dealComponent(methodComponent[key],result[key]);
|
|
106
|
+
// }else{
|
|
107
|
+
// Object.keys(methodComponent[key]).forEach(temKey => {
|
|
108
|
+
// if(typeof methodComponent[key][temKey] === "function"){
|
|
109
|
+
// if(!result[key]){
|
|
110
|
+
// result[key] = {};
|
|
111
|
+
// }
|
|
112
|
+
// result[key][temKey] = methodComponent[key][temKey].toString();
|
|
113
|
+
// }
|
|
114
|
+
// })
|
|
115
|
+
// }
|
|
116
|
+
// }
|
|
117
|
+
// })
|
|
118
|
+
// }
|
|
119
|
+
// // JSON.stringify(componentTemp)和JSON.stringify(obj)就是虚拟的存储到数据库的数据
|
|
120
|
+
// let tempComp = JSON.parse(JSON.stringify(componentTemp));
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
let diyEventObjs = {}; //事件中已经存在
|
|
126
|
+
//遍历自定义组件
|
|
127
|
+
Object.keys(eventComponent).forEach(key =>{
|
|
128
|
+
if(eventComponent[key].eventType){ //组件中存在事件来源
|
|
129
|
+
if(!diyEventObjs[eventComponent[key].eventType]){
|
|
130
|
+
diyEventObjs[eventComponent[key].eventType] = [];
|
|
131
|
+
}
|
|
132
|
+
diyEventObjs[eventComponent[key].eventType].push({
|
|
133
|
+
id : key,
|
|
134
|
+
name : eventComponent[key]['eventName'],
|
|
135
|
+
eventType: eventComponent[key]["eventType"],
|
|
136
|
+
eventSource:'2',
|
|
137
|
+
dataSource:'1',
|
|
138
|
+
config: eventComponent[key],
|
|
139
|
+
render:eventComponent[key]['renderKey'] ?
|
|
140
|
+
eventComponent[eventComponent[key]['renderKey']] : null, // 渲染组件
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
//加载系统事件规则
|
|
147
|
+
let sysEventObjs = {}; //事件中已经存在
|
|
148
|
+
//遍历自定义组件
|
|
149
|
+
Object.keys(systemEventComponent).forEach(key =>{
|
|
150
|
+
if(systemEventComponent[key].eventType){ //组件中存在事件来源
|
|
151
|
+
if(!sysEventObjs[systemEventComponent[key].eventType]){
|
|
152
|
+
sysEventObjs[systemEventComponent[key].eventType] = [];
|
|
153
|
+
}
|
|
154
|
+
sysEventObjs[systemEventComponent[key].eventType].push({
|
|
155
|
+
id : key,
|
|
156
|
+
name : systemEventComponent[key]['eventName'],
|
|
157
|
+
eventType: systemEventComponent[key]["eventType"],
|
|
158
|
+
eventSource:'1',
|
|
159
|
+
dataSource:'1',
|
|
160
|
+
config: systemEventComponent[key],
|
|
161
|
+
render:systemEventComponent[key]['renderKey'] ?
|
|
162
|
+
systemEventComponent[systemEventComponent[key]['renderKey']] : null, // 渲染组件
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
export default {
|
|
169
|
+
name: "loadEventPlugin",
|
|
170
|
+
installAll(){
|
|
171
|
+
axios.post(apiFlow.apis.eventRule.findByVersion,{"eventTypes":"flow"}).then(res =>{ //查询流程相关事件规则
|
|
172
|
+
if(res){
|
|
173
|
+
Object.keys(diyEventObjs).forEach(key =>{
|
|
174
|
+
//加载列格式化
|
|
175
|
+
diyEventObjs[key].forEach(item =>{
|
|
176
|
+
eventPlugin.preActiveEventRule(item);
|
|
177
|
+
})
|
|
178
|
+
});
|
|
179
|
+
//加载系统事件规则
|
|
180
|
+
Object.keys(sysEventObjs).forEach(key =>{
|
|
181
|
+
//加载列格式化
|
|
182
|
+
sysEventObjs[key].forEach(item =>{
|
|
183
|
+
eventPlugin.installEventRule(item);
|
|
184
|
+
})
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
(res.data || []).forEach(item =>{
|
|
188
|
+
if(item.eventUse == '1' && item.dataSource == '2')
|
|
189
|
+
{
|
|
190
|
+
//将后台返回的配置字符串转换为config组件,渲染字符串转化为render组件
|
|
191
|
+
let configStr = item.eventConfigurationStr; //配置文件字符串
|
|
192
|
+
let renderStr = item.eventRenderStr; //渲染文件字符串
|
|
193
|
+
let eventComp = {"id":item.eventKey,
|
|
194
|
+
"name":item.eventName,
|
|
195
|
+
"eventSource": item.eventSource,
|
|
196
|
+
"eventType":item.eventType,
|
|
197
|
+
"dataSource":item.dataSource,
|
|
198
|
+
"config":null,
|
|
199
|
+
"render":null};
|
|
200
|
+
if(configStr){
|
|
201
|
+
let configObj = JSON.parse(configStr);
|
|
202
|
+
let tempComp = configObj["comp"];
|
|
203
|
+
let method = configObj["method"];
|
|
204
|
+
// 转化
|
|
205
|
+
try {
|
|
206
|
+
recoverComponent(method);
|
|
207
|
+
}catch (e) {
|
|
208
|
+
console.log(e);
|
|
209
|
+
}
|
|
210
|
+
assignLevel(tempComp,method);
|
|
211
|
+
Object.assign(eventComp,{"config":tempComp});
|
|
212
|
+
}
|
|
213
|
+
if(renderStr){
|
|
214
|
+
let renderObj = JSON.parse(renderStr);
|
|
215
|
+
let tempComp = renderObj["comp"];
|
|
216
|
+
let obj = renderObj["method"];
|
|
217
|
+
recoverComponent(obj);
|
|
218
|
+
assignLevel(tempComp,obj);
|
|
219
|
+
Object.assign(eventComp,{"render":tempComp});
|
|
220
|
+
}
|
|
221
|
+
eventPlugin.installEventRule(eventComp); //执行注册
|
|
222
|
+
|
|
223
|
+
function recoverComponent(result){
|
|
224
|
+
Object.keys(result).forEach(key => {
|
|
225
|
+
if(Array.isArray(result[key])){
|
|
226
|
+
if(key == "beforeCreate" || key == "beforeDestroy"){
|
|
227
|
+
result[key] = [];
|
|
228
|
+
}else{
|
|
229
|
+
result[key].forEach((item,index) => {
|
|
230
|
+
let name = item.name || "a";
|
|
231
|
+
result[key][index] = new Function("let " + name + " = "+ item +";return " + name + ";")();
|
|
232
|
+
})
|
|
233
|
+
}
|
|
234
|
+
}else if (typeof result[key] === "object"){
|
|
235
|
+
if(result[key]["beforeCreate"] && result[key]["beforeDestroy"]){
|
|
236
|
+
recoverComponent(result[key]);
|
|
237
|
+
}else{
|
|
238
|
+
Object.keys(result[key]).forEach(temKey => {
|
|
239
|
+
let name = result[key][temKey].name || temKey;
|
|
240
|
+
if(Number(name) || Number(name) === 0){
|
|
241
|
+
name = "a";
|
|
242
|
+
}
|
|
243
|
+
result[key][temKey] = new Function("let " + name + " = " + result[key][temKey] +";return " + name + ";")();
|
|
244
|
+
})
|
|
245
|
+
}
|
|
246
|
+
}else{
|
|
247
|
+
let name = result[key].name || key;
|
|
248
|
+
result[key] = new Function("let " + name + " = " + result[key] +";return " + name + ";")();
|
|
249
|
+
}
|
|
250
|
+
})
|
|
251
|
+
}
|
|
252
|
+
// 多级对象复制方法
|
|
253
|
+
function assignLevel(target,source){
|
|
254
|
+
let value = {};
|
|
255
|
+
Object.keys(target).forEach(key => {
|
|
256
|
+
if(typeof target[key] === "object" && target[key]["beforeCreate"] && target[key]["beforeDestroy"]){
|
|
257
|
+
value[key] = target[key];
|
|
258
|
+
assignLevel(value[key],source[key]);
|
|
259
|
+
delete target[key];
|
|
260
|
+
}
|
|
261
|
+
})
|
|
262
|
+
Object.assign(target,source,value);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
else if(item.dataSource == '1') { //数据库已经保存得组件注册
|
|
266
|
+
Object.keys(diyEventObjs).forEach(key => {
|
|
267
|
+
diyEventObjs[key].forEach(comp =>{
|
|
268
|
+
if(comp.id == item.eventKey){
|
|
269
|
+
eventPlugin.installEventRule(comp);//全局注册
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
}
|
|
279
|
+
}
|