sasp-admin 0.2.57
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 +227 -0
- package/package.json +19 -0
- package/router.js +83 -0
- package/src/assets/font/iconfont.css +1346 -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/loading-bar.gif +0 -0
- package/src/assets/js/adminInstall.js +36 -0
- package/src/assets/js/api/apiAdmin.js +613 -0
- package/src/assets/js/global/dataGlobal.js +260 -0
- package/src/assets/js/global/logGlobal.js +22 -0
- package/src/assets/js/global/paramGlobal.js +67 -0
- package/src/assets/js/global/resGlobal.js +91 -0
- package/src/assets/js/global/userGlobal.js +283 -0
- package/src/components/complexViewRendering.vue +601 -0
- package/src/components/ifmLink.vue +71 -0
- package/src/components/public/data/plDataCascader.vue +85 -0
- package/src/components/public/data/plDataRadio.vue +73 -0
- package/src/components/public/data/plDataRadioGroup.vue +70 -0
- package/src/components/public/data/plDataSelect.vue +856 -0
- package/src/components/public/data/plDatePicker.vue +159 -0
- package/src/components/public/org/bg.png +0 -0
- package/src/components/public/org/sysOrgPosUserSelect.vue +1237 -0
- package/src/components/public/org/sysOrgPosUserSelectDark.vue +1402 -0
- package/src/components/public/org/sysOrgPosUserSelectNew.vue +1527 -0
- package/src/components/public/upload/images/compress.png +0 -0
- package/src/components/public/upload/images/emipty.png +0 -0
- package/src/components/public/upload/images/excel.png +0 -0
- package/src/components/public/upload/images/file.png +0 -0
- package/src/components/public/upload/images/pdf.png +0 -0
- package/src/components/public/upload/images/powerpoint.png +0 -0
- package/src/components/public/upload/images/project.png +0 -0
- package/src/components/public/upload/images/sound.png +0 -0
- package/src/components/public/upload/images/txt.png +0 -0
- package/src/components/public/upload/images/video.png +0 -0
- package/src/components/public/upload/images/visio.png +0 -0
- package/src/components/public/upload/images/word.png +0 -0
- package/src/components/public/upload/plImage.vue +287 -0
- package/src/components/public/upload/plImgUpload.vue +137 -0
- package/src/components/public/upload/plUpload.vue +1124 -0
- package/src/components/public/upload/uploadImg.js +8 -0
- package/src/main.js +0 -0
- package/src/views/VueMenuView.vue +143 -0
- package/src/views/cloudMenuView.vue +125 -0
- package/src/views/complex/config/complex.vue +501 -0
- package/src/views/complex/config/complexSetting.vue +1250 -0
- package/src/views/complex/rendering/complexShow.vue +16 -0
- package/src/views/data/dataManage.vue +560 -0
- package/src/views/data/sysData.vue +292 -0
- package/src/views/event/eventManager/vueEventDiy.vue +1184 -0
- package/src/views/event/eventManager/vueEventMain.vue +108 -0
- package/src/views/event/eventManager/vueEventSys.vue +296 -0
- package/src/views/event/js/apiEvent.js +22 -0
- package/src/views/fileLog/fileDownloadLog.vue +437 -0
- package/src/views/initData/initData.vue +4316 -0
- package/src/views/log/dblog/logdbDevelop.vue +306 -0
- package/src/views/log/dblog/logdbEnt.vue +331 -0
- package/src/views/log/dblog/logdbGov.vue +395 -0
- package/src/views/log/error/logError.vue +553 -0
- package/src/views/log/loginlog/logManageDevOrSup.vue +357 -0
- package/src/views/log/loginlog/logManageEnt.vue +343 -0
- package/src/views/log/loginlog/logManageGov.vue +328 -0
- package/src/views/log/sms/logSms.vue +308 -0
- package/src/views/menu/component/menuManageComponent.vue +2402 -0
- package/src/views/menu/component/menuModule.vue +449 -0
- package/src/views/menu/menuLocal.vue +223 -0
- package/src/views/menu/menuManage.vue +1135 -0
- package/src/views/menu/tenantMenuManage.vue +1132 -0
- package/src/views/menuRouter/cview/cviewShow.vue +18 -0
- package/src/views/menuRouter/cviewMenuRouter.vue +183 -0
- package/src/views/menuRouter/menuView.vue +132 -0
- package/src/views/menuRouter/urlMenuRouter.vue +160 -0
- package/src/views/org/entOrgTree.vue +1050 -0
- package/src/views/org/ownerMenu/ownerMenuTree.vue +269 -0
- package/src/views/org/safeValidate/safeValidate.vue +469 -0
- package/src/views/org/sysEntOrgUserDetail.vue +3390 -0
- package/src/views/org/sysOrgDimension.vue +832 -0
- package/src/views/org/sysOrgPosUserDetail.vue +1648 -0
- package/src/views/org/sysOrgPosUserTree.vue +1101 -0
- package/src/views/org/sysOrgTree.vue +864 -0
- package/src/views/param/sysParam.vue +987 -0
- package/src/views/preview/pdfViewer.vue +82 -0
- package/src/views/resources/js/resourcesCommon.js +137 -0
- package/src/views/resources/resRouter/resView.vue +161 -0
- package/src/views/resources/resourcesTabs.vue +82 -0
- package/src/views/resources/tabs/comp/pageResPreview.vue +309 -0
- package/src/views/resources/tabs/comp/pageResRegister.vue +1120 -0
- package/src/views/resources/tabs/dataResources.vue +843 -0
- package/src/views/resources/tabs/pageResources.vue +970 -0
- package/src/views/role/allowMenu.vue +148 -0
- package/src/views/role/authRole/authRole.vue +427 -0
- package/src/views/role/authRole/component/allocateSetting.vue +1056 -0
- package/src/views/role/authRole/component/authSetting.vue +1196 -0
- package/src/views/role/commonRole/commonRole.vue +677 -0
- package/src/views/role/commonRole/compoment/allocateRoleMenuSetting.vue +335 -0
- package/src/views/role/commonRole/compoment/authLinkMenuTree.vue +55 -0
- package/src/views/role/commonRole/compoment/authSettingNew.vue +190 -0
- package/src/views/role/commonRole/compoment/commonSetting.vue +1576 -0
- package/src/views/role/commonRole/compoment/commonSettingAdjust.vue +584 -0
- package/src/views/role/commonRole/compoment/commonSettingNew.vue +572 -0
- package/src/views/role/commonRole/compoment/roleMenuPower.vue +226 -0
- package/src/views/role/commonRole/compoment/roleMenuPowerSetting.vue +69 -0
- package/src/views/role/commonRole/compoment/roleMenuSetting.vue +365 -0
- package/src/views/role/commonRole/compoment/roleSourceSetting.vue +229 -0
- package/src/views/role/commonRole/tenantCommonRole.vue +768 -0
- package/src/views/role/role.vue +135 -0
- package/src/views/role/roleMenuOption.vue +898 -0
- package/src/views/role/roleSynchroRemind.vue +399 -0
- package/src/views/role/sysRole.vue +1525 -0
- package/src/views/role/viewMenuOptDetail.vue +182 -0
- package/src/views/sms/sendSms.vue +164 -0
- package/src/views/station/orgStation.vue +561 -0
- package/src/views/tenant/appContentManager.vue +938 -0
- package/src/views/tenant/appManager.vue +642 -0
- package/src/views/tenant/tenantRoleManager.vue +670 -0
- package/src/views/tenant/tenantUserManager.vue +615 -0
- package/src/views/threeinone/compoment/safeCascadeSelect.vue +327 -0
- package/src/views/threeinone/init/safeInitRegion.vue +203 -0
- package/src/views/threeinone/safeManager.vue +927 -0
- package/src/views/threeinone/safeMenuManage.vue +565 -0
- package/src/views/threeinone/safeOrgSpv.vue +364 -0
- package/src/views/threeinone/safeSpv/safeSpvLeftTree.vue +109 -0
- package/src/views/threeinone/safeSpv/safeSpvMain.vue +335 -0
- package/src/views/threeinone/safeSpvEconView.vue +569 -0
- package/src/views/threeinone/safeValidateRegion.vue +328 -0
- package/src/views/urlResource/urlResource.vue +856 -0
- package/src/views/user/empowerUser/empowerEntUserManage.vue +415 -0
- package/src/views/user/empowerUser/empowerOrgTree.vue +167 -0
- package/src/views/user/empowerUser/empowerUserList.vue +633 -0
- package/src/views/user/empowerUser/empowerUserListMenuDeatil.vue +656 -0
- package/src/views/user/empowerUser/empowerUserListViewMenuTree.vue +257 -0
- package/src/views/user/empowerUser/empowerUserManage.vue +99 -0
- package/src/views/user/stationUserManage.vue +934 -0
- package/src/views/user/userManage.vue +737 -0
- package/src/views/user/userMangement.vue +938 -0
- package/src/views/user/viewMenu/viewMenu.vue +113 -0
- package/src/views/versionupdatetool/versionUpdateTool.vue +225 -0
- package/src/views/versionupdatetool/versioninfomation/verisonInfomationManagement.vue +68 -0
|
@@ -0,0 +1,1184 @@
|
|
|
1
|
+
<!--事件管理 - 自定义 -->
|
|
2
|
+
<template>
|
|
3
|
+
<el-container class="top_contain">
|
|
4
|
+
<!--查询条件 -->
|
|
5
|
+
<el-header style="height: auto;">
|
|
6
|
+
<div class="search-form-parent el-card">
|
|
7
|
+
<el-form :inline="true" :model="crud.searchForm" class="demo-form-inline" @keyup.enter.native="crud.doSearch()" size="small">
|
|
8
|
+
<el-form-item label="事件名称" prop="eventName">
|
|
9
|
+
<el-input v-model="crud.searchForm.eventName"></el-input>
|
|
10
|
+
</el-form-item>
|
|
11
|
+
|
|
12
|
+
<el-form-item label="规则类型" prop="eventType">
|
|
13
|
+
<el-select v-model="crud.searchForm.eventType" placeholder="请选择">
|
|
14
|
+
<el-option v-for="(value,key) in eventTypeObj" :key="key"
|
|
15
|
+
:label="value"
|
|
16
|
+
:value="key">
|
|
17
|
+
</el-option>
|
|
18
|
+
</el-select>
|
|
19
|
+
</el-form-item>
|
|
20
|
+
|
|
21
|
+
<el-form-item>
|
|
22
|
+
<el-button type="primary" icon="el-icon-search" @click="crud.doSearch(searchFunc,null)" size="small">查询
|
|
23
|
+
</el-button>
|
|
24
|
+
<el-button icon="el-icon-close" @click="crud.resetSearch(searchFunc)" size="small">清空</el-button>
|
|
25
|
+
</el-form-item>
|
|
26
|
+
</el-form>
|
|
27
|
+
</div>
|
|
28
|
+
</el-header>
|
|
29
|
+
|
|
30
|
+
<!--查询体 列表展示-->
|
|
31
|
+
<el-main id="tableMain" style="height: 100%;">
|
|
32
|
+
<el-container style="height: 100%;" class="table-list-container">
|
|
33
|
+
<el-header style="height: auto;" size="small">
|
|
34
|
+
<!--新增-->
|
|
35
|
+
<el-button type="primary" size="small" round icon="el-icon-circle-plus" @click="addEvent()" >新增</el-button>
|
|
36
|
+
<!--删除-->
|
|
37
|
+
<el-button type="danger" size="small" round icon="el-icon-delete" @click="removeEvent()" >删除</el-button>
|
|
38
|
+
<!--导入-->
|
|
39
|
+
<!--<el-popover style="margin-left: 10px;margin-right: 10px;" v-model="importVisible"-->
|
|
40
|
+
<!--placement="bottom" width="200" trigger="click">-->
|
|
41
|
+
<!--<el-upload-->
|
|
42
|
+
<!--class="upload-demo"-->
|
|
43
|
+
<!--ref="impFileRef"-->
|
|
44
|
+
<!--:auto-upload="false"-->
|
|
45
|
+
<!--:file-list="fileList"-->
|
|
46
|
+
<!--:action="api.plFlowDefine.impFlowData"-->
|
|
47
|
+
<!--:limit="1"-->
|
|
48
|
+
<!--accept=".rldmp"-->
|
|
49
|
+
<!--:on-exceed="limitFile"-->
|
|
50
|
+
<!--:on-change="changeFile"-->
|
|
51
|
+
<!--:before-upload="beforeUpload"-->
|
|
52
|
+
<!--:http-request="uploadFileMethod">-->
|
|
53
|
+
<!--<el-button slot="trigger" size="small" type="primary">选取导入文件</el-button>-->
|
|
54
|
+
<!--<el-button style="margin-left: 10px;" size="small" type="success" @click="beginImp">-->
|
|
55
|
+
<!--导入-->
|
|
56
|
+
<!--</el-button>-->
|
|
57
|
+
<!--</el-upload>-->
|
|
58
|
+
<!--<el-button type="warning" size="small" round slot="reference" icon="el-icon-bottom-left">导入-->
|
|
59
|
+
<!--</el-button>-->
|
|
60
|
+
<!--</el-popover>-->
|
|
61
|
+
|
|
62
|
+
<!--<!–导出–>-->
|
|
63
|
+
<!--<el-button type="warning" size="small" round @click="exportEvent()">导出</el-button>-->
|
|
64
|
+
<!--模版下载-->
|
|
65
|
+
<el-button type="success" size="small" round @click="templateDownload()">模版下载</el-button>
|
|
66
|
+
<!--<a href="/static/eventTemplate/muban.rar" download="事件模板.rar">文件下载</a>-->
|
|
67
|
+
</el-header>
|
|
68
|
+
<!--列表-->
|
|
69
|
+
<el-main style="height: 100%;" ref="tableMain">
|
|
70
|
+
<el-table :data="crud.dataStore.records" :ref="crud.tableRef" stripe border height="100%" style="width: 100%;">
|
|
71
|
+
<el-table-column type="selection" width="40" align="center"></el-table-column>
|
|
72
|
+
<el-table-column type="index" label="序号" align="center" width="60"></el-table-column>
|
|
73
|
+
<el-table-column label="事件名称" prop="eventName" align="center"></el-table-column>
|
|
74
|
+
<el-table-column label="规则类型" prop="eventType" align="center" width="200">
|
|
75
|
+
<template slot-scope="scope">
|
|
76
|
+
{{eventTypeObj[scope.row.eventType]}}
|
|
77
|
+
</template>
|
|
78
|
+
</el-table-column>
|
|
79
|
+
<el-table-column label="规则来源" prop="dataSource" align="center" width="200">
|
|
80
|
+
<template slot-scope="scope">
|
|
81
|
+
{{dataSourceObj[scope.row.dataSource]}}
|
|
82
|
+
</template>
|
|
83
|
+
</el-table-column>
|
|
84
|
+
<el-table-column label="排序" prop="eventOrder" align="center" width="160">
|
|
85
|
+
</el-table-column>
|
|
86
|
+
<el-table-column label="版本号" prop="version" align="center" width="160">
|
|
87
|
+
</el-table-column>
|
|
88
|
+
<el-table-column label="是否启用" prop="eventUse" align="center" width="180">
|
|
89
|
+
<template slot-scope="scope">
|
|
90
|
+
<el-switch
|
|
91
|
+
v-model="scope.row.eventUse"
|
|
92
|
+
active-color="#00A854"
|
|
93
|
+
active-value="1"
|
|
94
|
+
inactive-color="#CCCCCC"
|
|
95
|
+
inactive-value="0"
|
|
96
|
+
@change="switchChange(scope.row)">
|
|
97
|
+
</el-switch>
|
|
98
|
+
</template>
|
|
99
|
+
</el-table-column>
|
|
100
|
+
<el-table-column label="操作" align="center" width="180">
|
|
101
|
+
<template slot-scope="scope">
|
|
102
|
+
<el-button size="small" icon="el-icon-zoom-in" type="primary" @click="editEvent(scope.row)">
|
|
103
|
+
编辑
|
|
104
|
+
</el-button>
|
|
105
|
+
</template>
|
|
106
|
+
</el-table-column>
|
|
107
|
+
</el-table>
|
|
108
|
+
</el-main>
|
|
109
|
+
</el-container>
|
|
110
|
+
</el-main>
|
|
111
|
+
|
|
112
|
+
<!--底部分页-->
|
|
113
|
+
<el-footer>
|
|
114
|
+
<el-pagination
|
|
115
|
+
:ref="crud.pageRef"
|
|
116
|
+
:page-sizes="crud.pageSizes"
|
|
117
|
+
:page-size="crud.pageSize"
|
|
118
|
+
:current-page="crud.page"
|
|
119
|
+
:total="crud.dataStore.total"
|
|
120
|
+
@size-change="crud.sizeChange(searchFunc)"
|
|
121
|
+
@current-change="crud.currentPage(searchFunc)"
|
|
122
|
+
layout="total, sizes, prev, pager, next, jumper">
|
|
123
|
+
</el-pagination>
|
|
124
|
+
</el-footer>
|
|
125
|
+
|
|
126
|
+
<!--规则编辑-->
|
|
127
|
+
<el-dialog :close-on-click-modal=false :title="eventTitle" top="10vh" height="80%" width="80%" lock-scroll
|
|
128
|
+
:visible.sync="editEventDialog">
|
|
129
|
+
<el-form :model="eventObj" label-width="120px" style="width: 100%;" ref="eventFormRef">
|
|
130
|
+
<div v-if="eventObj.id && eventObj.dataSource == '2'">
|
|
131
|
+
<el-form-item label="事件名称" prop="eventName" :rules="plValidate('required')">
|
|
132
|
+
<el-input v-model="eventObj.eventName"></el-input>
|
|
133
|
+
</el-form-item>
|
|
134
|
+
</div>
|
|
135
|
+
<div v-else>
|
|
136
|
+
<el-form-item label="事件名称" prop="eventKey" :rules="eventKeyValidate">
|
|
137
|
+
<el-select v-model="eventObj.eventKey" placeholder="请选择" style="width: 100%" @change="changeRuleSet()">
|
|
138
|
+
<el-option-group
|
|
139
|
+
v-for="group in options"
|
|
140
|
+
:key="group.name"
|
|
141
|
+
:label="group.name">
|
|
142
|
+
<el-option
|
|
143
|
+
v-for="item in group.options"
|
|
144
|
+
:key="item.id"
|
|
145
|
+
:label="item.name"
|
|
146
|
+
:value="item.id">
|
|
147
|
+
</el-option>
|
|
148
|
+
</el-option-group>
|
|
149
|
+
</el-select>
|
|
150
|
+
</el-form-item>
|
|
151
|
+
</div>
|
|
152
|
+
<el-row>
|
|
153
|
+
<el-col :span="8">
|
|
154
|
+
<el-form-item label="唯一标识" prop="eventOrder" >
|
|
155
|
+
<el-input v-model="eventObj.eventKey" disabled></el-input>
|
|
156
|
+
</el-form-item>
|
|
157
|
+
</el-col>
|
|
158
|
+
<el-col :span="8">
|
|
159
|
+
<el-form-item label="规则类型" prop="eventType" >
|
|
160
|
+
<el-select v-model="eventObj.eventType" placeholder="请选择" style="width: 100%" disabled>
|
|
161
|
+
<el-option v-for="(value,key) in eventTypeObj"
|
|
162
|
+
:key="key"
|
|
163
|
+
:label="value"
|
|
164
|
+
:value="key">
|
|
165
|
+
</el-option>
|
|
166
|
+
</el-select>
|
|
167
|
+
</el-form-item>
|
|
168
|
+
</el-col>
|
|
169
|
+
<el-col :span="8">
|
|
170
|
+
<el-form-item label="事件顺序" prop="eventOrder" :rules="plValidate('numberInt')">
|
|
171
|
+
<el-input v-model="eventObj.eventOrder"></el-input>
|
|
172
|
+
</el-form-item>
|
|
173
|
+
</el-col>
|
|
174
|
+
</el-row>
|
|
175
|
+
<div style="text-align: center">
|
|
176
|
+
<!--<el-button type="primary" @click="preViewEvent()">预览</el-button>-->
|
|
177
|
+
</div>
|
|
178
|
+
<div v-if="editEventDialog && previewConfigObj.config">
|
|
179
|
+
<div class="event-rule-config-class">
|
|
180
|
+
<div style="font-weight: bold;margin-bottom: 5px">配置效果预览</div>
|
|
181
|
+
<el-card class="box-card">
|
|
182
|
+
<el-form ref="eventRuleConfigForm"
|
|
183
|
+
:model="configObj" label-width="80px"
|
|
184
|
+
:validate-on-rule-change="false" size="small"
|
|
185
|
+
style="width: 100%;height: 270px;padding:5px;box-sizing: border-box;overflow-y: auto">
|
|
186
|
+
<div>
|
|
187
|
+
<component
|
|
188
|
+
v-if="editEventDialog && previewConfigObj.config"
|
|
189
|
+
:is="previewConfigObj.config"
|
|
190
|
+
:config-data="configObj"
|
|
191
|
+
:data-type-arr="dataTypeArr"
|
|
192
|
+
:data-tree-obj="dataTreeObj"
|
|
193
|
+
ref="configCompRef">
|
|
194
|
+
</component>
|
|
195
|
+
</div>
|
|
196
|
+
</el-form>
|
|
197
|
+
<!--列格式化-->
|
|
198
|
+
</el-card>
|
|
199
|
+
</div>
|
|
200
|
+
<!--加载 配置效果 end -->
|
|
201
|
+
<!--加载渲染效果 start-->
|
|
202
|
+
<div class="event-rule-render-class" v-if="eventObj.eventType == 'list' && previewConfigObj.render">
|
|
203
|
+
<div style="font-weight: bold;margin-bottom: 5px">渲染效果预览</div>
|
|
204
|
+
<el-card>
|
|
205
|
+
<!--列表视图-->
|
|
206
|
+
<component
|
|
207
|
+
:is="previewConfigObj.render"
|
|
208
|
+
:data-type-arr="dataTypeArr"
|
|
209
|
+
:data-tree-obj="dataTreeObj"
|
|
210
|
+
:data-tree-arr="dataTreeArr"
|
|
211
|
+
ref="configRenderCompRef">
|
|
212
|
+
</component>
|
|
213
|
+
</el-card>
|
|
214
|
+
</div>
|
|
215
|
+
</div>
|
|
216
|
+
</el-form>
|
|
217
|
+
<div slot="footer" class="dialog-footer" align="center" >
|
|
218
|
+
<el-button type="primary" @click="saveEvent()" size="small" icon="el-icon-success">确 定</el-button>
|
|
219
|
+
<el-button @click="editEventDialog = false" size="small" icon="el-icon-error">取 消</el-button>
|
|
220
|
+
</div>
|
|
221
|
+
</el-dialog>
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
</el-container>
|
|
225
|
+
</template>
|
|
226
|
+
|
|
227
|
+
<script>
|
|
228
|
+
import {AesCrypto} from 'sasp-base'
|
|
229
|
+
import {saveAs} from "file-saver";
|
|
230
|
+
|
|
231
|
+
export default {
|
|
232
|
+
name: "vue-event-diy",
|
|
233
|
+
props:{
|
|
234
|
+
eventTypeObj:{type:Object,default: () => {return {};}},//当前表达已配置的控件信息
|
|
235
|
+
eventTypeControlObj:{type:Object,default:() =>{return {};}},
|
|
236
|
+
dataTreeObj:{type:Object,default:() =>{return {};}}, //数据字典树组件
|
|
237
|
+
dataTypeArr:{type:Array,default:() =>{return [];}}, //数据字典arr
|
|
238
|
+
dataTreeArr:{type:Array,default:() =>{return [];}}, //数据字典arr
|
|
239
|
+
},
|
|
240
|
+
data(){
|
|
241
|
+
//事件唯一标志验证
|
|
242
|
+
let eventKeyValidate =(rule,value,callback) => {
|
|
243
|
+
if(!value){
|
|
244
|
+
callback();
|
|
245
|
+
}
|
|
246
|
+
this.axios.post(this.api.eventRule.find,{dataSource:"1",eventKey:value}).then(res =>{
|
|
247
|
+
if((res.data ||[]).length == 0 || (this.operate == 'update' && this.oldEventKey == value)){
|
|
248
|
+
callback();
|
|
249
|
+
}else{
|
|
250
|
+
return callback(new Error('该自定义事件规则已经存在!'));
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
};
|
|
254
|
+
return{
|
|
255
|
+
crud: new this.CrudUtil({
|
|
256
|
+
vue: this,
|
|
257
|
+
url:this.api.eventRule.url,
|
|
258
|
+
entityName: "notice",
|
|
259
|
+
searchUrl:this.api.eventRule.findByVersion,
|
|
260
|
+
searchForm: {eventSource:"2"}, //查询自定义事件规则
|
|
261
|
+
noClearSearchColumns: ["eventSource"],
|
|
262
|
+
initNoSearch:true,
|
|
263
|
+
}),
|
|
264
|
+
operate: 'add', //默认添加操作
|
|
265
|
+
oldEventKey: '', //原事件唯一标识
|
|
266
|
+
oldEventType: '', //原事件类型
|
|
267
|
+
//表单视图唯一性
|
|
268
|
+
eventKeyValidate:[
|
|
269
|
+
{required: true, message: '该输入项为必输项'},{validator:eventKeyValidate,trigger:'change'}
|
|
270
|
+
],
|
|
271
|
+
|
|
272
|
+
eventTitle:'新增事件规则',//事件规则标题
|
|
273
|
+
editEventDialog:false,//
|
|
274
|
+
dataSourceObj:{
|
|
275
|
+
"1":"内部",
|
|
276
|
+
"2":"导入"
|
|
277
|
+
},
|
|
278
|
+
eventObj:{
|
|
279
|
+
|
|
280
|
+
}, //事件规则对象
|
|
281
|
+
typeObj:{
|
|
282
|
+
"tableView": "表单规则",
|
|
283
|
+
"list": "列表规则",
|
|
284
|
+
"flow":"流程规则"
|
|
285
|
+
},
|
|
286
|
+
options:[], //
|
|
287
|
+
prviewShow:true, //预览开关
|
|
288
|
+
|
|
289
|
+
configObj:{}, //表单or 流程预览用到的对象
|
|
290
|
+
importVisible:false, //导入 popor
|
|
291
|
+
|
|
292
|
+
previewConfigObj:{
|
|
293
|
+
config: null,
|
|
294
|
+
render:null,
|
|
295
|
+
}, //组件预览对象
|
|
296
|
+
|
|
297
|
+
fileList:[],//文件列表
|
|
298
|
+
loading:false, //导入
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
mounted(){
|
|
302
|
+
this.initEventOptions();
|
|
303
|
+
},
|
|
304
|
+
created(){
|
|
305
|
+
this.init();
|
|
306
|
+
},
|
|
307
|
+
methods:{
|
|
308
|
+
init(){
|
|
309
|
+
this.crud.search(this.searchFunc);
|
|
310
|
+
},
|
|
311
|
+
searchFunc(){
|
|
312
|
+
(this.crud.dataStore.records || []).forEach(item =>{
|
|
313
|
+
if(item.dataSource == '1'){ //内部
|
|
314
|
+
if(this.EVENT_PLUGIN["preActiveEvenObj"]["inner-"+item.eventKey]){ //内部
|
|
315
|
+
this.$set(item,'version',this.EVENT_PLUGIN["preActiveEvenObj"]["inner-"+item.eventKey]['config']['version'] || "1.0");
|
|
316
|
+
this.$set(item,'eventName',this.EVENT_PLUGIN["preActiveEvenObj"]["inner-"+item.eventKey]['config']['eventName']);
|
|
317
|
+
this.$set(item,'eventType',this.EVENT_PLUGIN["preActiveEvenObj"]["inner-"+item.eventKey]['eventType']);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
},
|
|
322
|
+
/**
|
|
323
|
+
* 初始化事件规则下拉框
|
|
324
|
+
*/
|
|
325
|
+
initEventOptions(){
|
|
326
|
+
this.options = [];
|
|
327
|
+
let optionTypeObj = {};
|
|
328
|
+
Object.keys(this.eventTypeControlObj).forEach(type =>{
|
|
329
|
+
Object.keys(this.EVENT_PLUGIN.preActiveEvenObj).forEach(key =>{ //加载预注册中的事件
|
|
330
|
+
if(this.EVENT_PLUGIN["preActiveEvenObj"][key]){
|
|
331
|
+
let eventType = this.EVENT_PLUGIN["preActiveEvenObj"][key]["config"]["eventType"];
|
|
332
|
+
if(eventType == type){
|
|
333
|
+
if(!optionTypeObj[eventType]){
|
|
334
|
+
this.$set(optionTypeObj,eventType,[]); //初始化数组
|
|
335
|
+
}
|
|
336
|
+
//判断是否存在
|
|
337
|
+
let arr = optionTypeObj[eventType].filter(item =>{
|
|
338
|
+
return 'inner-' + item.id == key;
|
|
339
|
+
});
|
|
340
|
+
if(arr.length == 0){
|
|
341
|
+
optionTypeObj[eventType].push(this.EVENT_PLUGIN["preActiveEvenObj"][key]);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
Object.keys(optionTypeObj).forEach(eventType =>{
|
|
350
|
+
let param = {
|
|
351
|
+
name : this.typeObj[eventType],
|
|
352
|
+
options:optionTypeObj[eventType]
|
|
353
|
+
}
|
|
354
|
+
this.options.push(param);
|
|
355
|
+
});
|
|
356
|
+
//读取系统已经导入的自定义事件规则
|
|
357
|
+
},
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* 新增事件规则
|
|
361
|
+
*/
|
|
362
|
+
addEvent(){
|
|
363
|
+
this.operate = "add";
|
|
364
|
+
this.eventTitle = "新增事件规则";
|
|
365
|
+
this.eventObj = {};
|
|
366
|
+
//获取当前最大排序
|
|
367
|
+
//获取maxOrder
|
|
368
|
+
this.axios.post(this.api.eventRule.getMaxOrder).then(res =>{
|
|
369
|
+
let order = res.data? (res.data + 1):1;
|
|
370
|
+
this.$set(this.eventObj,'eventOrder',order);
|
|
371
|
+
});
|
|
372
|
+
this.previewConfigObj = {
|
|
373
|
+
config:null,
|
|
374
|
+
render:null
|
|
375
|
+
}
|
|
376
|
+
this.editEventDialog = true;
|
|
377
|
+
this.$nextTick(() => {
|
|
378
|
+
this.$refs.eventFormRef.clearValidate();
|
|
379
|
+
});
|
|
380
|
+
},
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* 删除事件规则
|
|
384
|
+
*/
|
|
385
|
+
removeEvent(){
|
|
386
|
+
let selection = this.$refs[this.crud.tableRef].selection;
|
|
387
|
+
if((selection || []).length == 0){
|
|
388
|
+
this.$message({
|
|
389
|
+
type: 'warning',
|
|
390
|
+
message: "请选择需要删除的事件!"
|
|
391
|
+
});
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
let eventIdArr = [];
|
|
395
|
+
let importEventIdArr = []; //通过导入的id
|
|
396
|
+
let removeEventKeyArr = []; //已经注册的eventKey
|
|
397
|
+
selection.forEach(item =>{
|
|
398
|
+
eventIdArr.push(item.id);
|
|
399
|
+
if(item.dataSource){
|
|
400
|
+
importEventIdArr.push(item.id);
|
|
401
|
+
removeEventKeyArr.push(item);
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
this.$confirm('事件删除后已经引用的事件将失效且被引用的规则配置将会同步删除,确定继续?', '提示', {
|
|
405
|
+
confirmButtonText: '确定',
|
|
406
|
+
cancelButtonText: '取消',
|
|
407
|
+
type: 'warning'
|
|
408
|
+
}).then(() => {
|
|
409
|
+
this.axios.post(this.api.eventRule.delete,{'ids':eventIdArr.join(",")}).then(res =>{
|
|
410
|
+
if(res.data && res.data.operateSuccess){
|
|
411
|
+
this.$message.success("删除成功!");
|
|
412
|
+
//如果是 内部引入删除 install 如果是 外部导入 删除 预注册 和 导入
|
|
413
|
+
removeEventKeyArr.forEach(delItem =>{
|
|
414
|
+
if (delItem.dataSource == '1'){ //内部
|
|
415
|
+
this.EVENT_PLUGIN.uninstallEventRule("inner-"+delItem.eventKey);
|
|
416
|
+
this.EVENT_PLUGIN.uninstallAllEventRule("inner-"+delItem.eventKey);
|
|
417
|
+
}else if(delItem.dataSource == '2'){ //外部导入
|
|
418
|
+
this.EVENT_PLUGIN.unPreActiveEventRule("outside-"+delItem.eventKey); //卸载
|
|
419
|
+
this.EVENT_PLUGIN.uninstallEventRule("outside-"+delItem.eventKey);
|
|
420
|
+
this.EVENT_PLUGIN.uninstallAllEventRule("outside-"+delItem.eventKey);
|
|
421
|
+
}
|
|
422
|
+
});
|
|
423
|
+
//重新加载事件规则下拉
|
|
424
|
+
this.initEventOptions();
|
|
425
|
+
this.crud.search(this.searchFunc);
|
|
426
|
+
}
|
|
427
|
+
});
|
|
428
|
+
});
|
|
429
|
+
},
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* 执行事件规则导入
|
|
433
|
+
*/
|
|
434
|
+
beginImp(){
|
|
435
|
+
if (this.fileList.length == 0) {
|
|
436
|
+
this.$message.error("请选择需要导入的规则文件!");
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
this.$confirm('是否确定导入规则?', '确认信息', {
|
|
440
|
+
distinguishCancelAndClose: true,
|
|
441
|
+
confirmButtonText: '确定',
|
|
442
|
+
cancelButtonText: '取消'
|
|
443
|
+
}).then(() => {
|
|
444
|
+
this.$refs.impFileRef.submit();
|
|
445
|
+
this.importVisible = false;
|
|
446
|
+
});
|
|
447
|
+
|
|
448
|
+
},
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* 规则导出
|
|
452
|
+
*/
|
|
453
|
+
async exportEvent(){
|
|
454
|
+
let selection = this.$refs[this.crud.tableRef].selection;
|
|
455
|
+
if((selection || []).length == 0){
|
|
456
|
+
this.$message({
|
|
457
|
+
type: 'warning',
|
|
458
|
+
message: "请选择需要导出的规则!"
|
|
459
|
+
});
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
462
|
+
let innerEventKeyArr = []; //内部来源eventKeyl
|
|
463
|
+
|
|
464
|
+
let exportArr = []; //导出文件arr
|
|
465
|
+
selection.forEach(item =>{
|
|
466
|
+
//判断是否为内部引入还是外部
|
|
467
|
+
//如果时外部则需要先查询相关的配置
|
|
468
|
+
if(item.dataSource == '1'){//自定义类型
|
|
469
|
+
innerEventKeyArr.push(item.eventKey);
|
|
470
|
+
}else if(item.dataSource == '2'){ //外部导入直接读取
|
|
471
|
+
exportArr.push({
|
|
472
|
+
version:item.version, //版本号
|
|
473
|
+
eventKey:item.eventKey, //唯一标志
|
|
474
|
+
eventType:item.eventType, //事件类型
|
|
475
|
+
eventName:item.eventName,
|
|
476
|
+
config: item.eventConfigurationStr,
|
|
477
|
+
render: item.eventRenderStr,
|
|
478
|
+
})
|
|
479
|
+
}
|
|
480
|
+
});
|
|
481
|
+
if(innerEventKeyArr.length > 0){
|
|
482
|
+
//获取配置模板配置
|
|
483
|
+
//获取渲染模板配置
|
|
484
|
+
innerEventKeyArr.forEach(eventKey =>{
|
|
485
|
+
let eventPre = "inner-";
|
|
486
|
+
if(this.EVENT_PLUGIN.preActiveEvenObj[eventPre+eventKey]){
|
|
487
|
+
let config = this.EVENT_PLUGIN.preActiveEvenObj[eventPre+eventKey]['config'];
|
|
488
|
+
let version = ""; //默认版本号
|
|
489
|
+
let render = this.EVENT_PLUGIN.preActiveEvenObj[eventPre+eventKey]['render'];
|
|
490
|
+
let eventName = config.eventName;
|
|
491
|
+
let eventType = config.eventType;
|
|
492
|
+
let configCompStr = "";
|
|
493
|
+
let renderCompStr = "";
|
|
494
|
+
if(config){
|
|
495
|
+
version = config["version"] || "1.0";
|
|
496
|
+
delete config["_Ctor"];
|
|
497
|
+
configCompStr = this.conversionToStr(config);
|
|
498
|
+
}
|
|
499
|
+
if(render){
|
|
500
|
+
delete render["_Ctor"];
|
|
501
|
+
renderCompStr = this.conversionToStr(render);
|
|
502
|
+
}
|
|
503
|
+
exportArr.push({
|
|
504
|
+
version:version, //版本号
|
|
505
|
+
eventKey:eventKey, //唯一标志
|
|
506
|
+
eventType:eventType, //事件类型
|
|
507
|
+
eventName:eventName,
|
|
508
|
+
config: configCompStr,
|
|
509
|
+
render: renderCompStr
|
|
510
|
+
})
|
|
511
|
+
}
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
//前台数据加密
|
|
515
|
+
let ecCrypyStr = AesCrypto.Encrypt(JSON.stringify(exportArr));
|
|
516
|
+
let str = new Blob([ecCrypyStr],{type: 'text/plain;charset=utf-8'});
|
|
517
|
+
let fileName = "事件规则" + this.DATE_UTIL.getCurrentDateTime();
|
|
518
|
+
saveAs(str,fileName+`.rldmp`);
|
|
519
|
+
},
|
|
520
|
+
|
|
521
|
+
/**
|
|
522
|
+
* 模版下载
|
|
523
|
+
*/
|
|
524
|
+
templateDownload(){
|
|
525
|
+
let link = document.createElement('a');
|
|
526
|
+
link.setAttribute('href', this.api.eventRule.downloadTemplate);
|
|
527
|
+
link.click();
|
|
528
|
+
link = null;
|
|
529
|
+
},
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* 切换事件启用状态
|
|
533
|
+
*/
|
|
534
|
+
switchChange(row){
|
|
535
|
+
row.eventUse = row.eventUse && row.eventUse == '1' ? '0' : '1';
|
|
536
|
+
//弹出提示框
|
|
537
|
+
let title = "";
|
|
538
|
+
if(row.eventUse == '1'){
|
|
539
|
+
title = "事件关闭时已经使用的事件将失效,是否继续?";
|
|
540
|
+
}else {
|
|
541
|
+
title = "确定开启事件规则?";
|
|
542
|
+
}
|
|
543
|
+
this.$confirm(title, '提示', {
|
|
544
|
+
confirmButtonText: '确定',
|
|
545
|
+
cancelButtonText: '取消',
|
|
546
|
+
type: 'warning'
|
|
547
|
+
}).then(() => {
|
|
548
|
+
//执行修改操作
|
|
549
|
+
let eventUse = row.eventUse == '1' ? '0' : '1';
|
|
550
|
+
this.axios.post(this.api.eventRule.update,{'id':row.id,'eventUse':eventUse}).then(res =>{
|
|
551
|
+
if(res.data && res.data.operateSuccess){
|
|
552
|
+
//重置请求方法
|
|
553
|
+
this.$message.success("修改成功!");
|
|
554
|
+
}else{
|
|
555
|
+
this.$message.error("修改失败!");
|
|
556
|
+
}
|
|
557
|
+
let compObj = {};
|
|
558
|
+
let eventKeyPre = row.dataSource == '1'? 'inner-':'outside-'; //内部和外部导入
|
|
559
|
+
let sysComp = this.EVENT_PLUGIN.allEventObj[eventKeyPre+row.eventKey];
|
|
560
|
+
//执行注册or卸载组件
|
|
561
|
+
if(sysComp){
|
|
562
|
+
if(eventUse == '1'){ //启用
|
|
563
|
+
compObj = {
|
|
564
|
+
id : row['eventKey'],
|
|
565
|
+
name : row['eventName'],
|
|
566
|
+
eventType: row["eventType"],
|
|
567
|
+
eventSource:'2',
|
|
568
|
+
dataSource:row.dataSource,
|
|
569
|
+
config: sysComp['config'],
|
|
570
|
+
render:sysComp['render']?sysComp['render'] : null, // 渲染组件
|
|
571
|
+
}
|
|
572
|
+
this.EVENT_PLUGIN.installEventRule(compObj);//注册
|
|
573
|
+
}else { //卸载
|
|
574
|
+
if (row.dataSource == '1'){ //内部
|
|
575
|
+
this.EVENT_PLUGIN.uninstallEventRule("inner-"+row.eventKey);
|
|
576
|
+
}else if(row.dataSource == '2'){ //外部导入
|
|
577
|
+
this.EVENT_PLUGIN.uninstallEventRule("outside-"+row.eventKey);
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
this.crud.search(this.searchFunc);
|
|
582
|
+
});
|
|
583
|
+
}).catch(() => {
|
|
584
|
+
|
|
585
|
+
});
|
|
586
|
+
|
|
587
|
+
},
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* 编辑事件
|
|
591
|
+
* @param row
|
|
592
|
+
*/
|
|
593
|
+
editEvent(row){
|
|
594
|
+
this.operate = "update";
|
|
595
|
+
this.oldEventKey = row.eventKey;
|
|
596
|
+
let eventPre= "";
|
|
597
|
+
if(row.dataSource == '1'){ //内部
|
|
598
|
+
eventPre = "inner-";
|
|
599
|
+
}else if(row.dataSource == '2'){ //外部引用
|
|
600
|
+
eventPre = "outside-";
|
|
601
|
+
}
|
|
602
|
+
this.oldEventType = row.eventType;
|
|
603
|
+
this.eventTitle = "'" +row.eventName+"'" + "编辑";
|
|
604
|
+
this.eventObj = JSON.parse(JSON.stringify(row));
|
|
605
|
+
|
|
606
|
+
this.previewConfigObj = {
|
|
607
|
+
config:null,
|
|
608
|
+
render:null
|
|
609
|
+
}
|
|
610
|
+
if(this.eventObj.eventKey){
|
|
611
|
+
if(this.eventObj.dataSource == '1'){
|
|
612
|
+
this.$set(this.eventObj,'eventType',this.EVENT_PLUGIN["allEventObj"][eventPre+this.eventObj.eventKey]["config"]["eventType"]);
|
|
613
|
+
this.$set(this.eventObj,'eventName',this.EVENT_PLUGIN["allEventObj"][eventPre+this.eventObj.eventKey]["eventName"]);
|
|
614
|
+
}
|
|
615
|
+
this.previewConfigObj.config = this.EVENT_PLUGIN["allEventObj"][eventPre + this.eventObj.eventKey]['config'];
|
|
616
|
+
this.previewConfigObj.render = this.EVENT_PLUGIN["allEventObj"][eventPre + this.eventObj.eventKey]['render'];
|
|
617
|
+
}
|
|
618
|
+
this.configObj = {};
|
|
619
|
+
this.$nextTick(()=>{
|
|
620
|
+
if(this.$refs['configRenderCompRef']){
|
|
621
|
+
this.$refs['configRenderCompRef'].preview();
|
|
622
|
+
this.$refs['configRenderCompRef'].initData();
|
|
623
|
+
this.$refs['configRenderCompRef'].$forceUpdate();
|
|
624
|
+
}
|
|
625
|
+
this.$refs.eventFormRef.clearValidate();
|
|
626
|
+
});
|
|
627
|
+
this.editEventDialog = true;
|
|
628
|
+
},
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* 保存事件规则
|
|
632
|
+
*/
|
|
633
|
+
saveEvent(){
|
|
634
|
+
//执行事件规则保存,查询当前事件是否已经存在
|
|
635
|
+
this.$refs.eventFormRef.validate(valid =>{
|
|
636
|
+
//执行自定义事件规则保存
|
|
637
|
+
if(!valid){
|
|
638
|
+
return;
|
|
639
|
+
}
|
|
640
|
+
let params = {};
|
|
641
|
+
Object.keys(this.eventObj).forEach(key =>{
|
|
642
|
+
params[key] = this.eventObj[key];
|
|
643
|
+
});
|
|
644
|
+
if(!params["version"]){
|
|
645
|
+
params["version"] = "1.0";
|
|
646
|
+
}
|
|
647
|
+
if(!params["dataSource"]){ //如果不存在则为内部
|
|
648
|
+
params["dataSource"] = "1";
|
|
649
|
+
}
|
|
650
|
+
if(!params["eventUse"]){
|
|
651
|
+
params["eventUse"] = "1";
|
|
652
|
+
}
|
|
653
|
+
params["eventSource"] = "2";
|
|
654
|
+
let url = this.api.eventRule.add;
|
|
655
|
+
if(this.operate == 'update'){
|
|
656
|
+
url = this.api.eventRule.update;
|
|
657
|
+
}
|
|
658
|
+
this.axios.post(url,params).then(res =>{
|
|
659
|
+
let type = "error";
|
|
660
|
+
if(res.data.operateSuccess){
|
|
661
|
+
type = "success";
|
|
662
|
+
this.editEventDialog = false;
|
|
663
|
+
this.crud.search(this.searchFunc);
|
|
664
|
+
}
|
|
665
|
+
this.$message({
|
|
666
|
+
type: type,
|
|
667
|
+
message: res.data.operateMessage
|
|
668
|
+
});
|
|
669
|
+
//将组件注册到 EVENT_PLUGUN
|
|
670
|
+
let comp = {
|
|
671
|
+
id : params['eventKey'],
|
|
672
|
+
name : params.eventKey['eventName'],
|
|
673
|
+
eventType: params['eventType'],
|
|
674
|
+
eventSource:params['eventSource'],
|
|
675
|
+
dataSource:params['dataSource'],
|
|
676
|
+
config: this.previewConfigObj.config,
|
|
677
|
+
render: this.previewConfigObj.render || null, // 渲染组件
|
|
678
|
+
};
|
|
679
|
+
this.EVENT_PLUGIN.installEventRule(comp); //注册到全局
|
|
680
|
+
this.initEventOptions();
|
|
681
|
+
});
|
|
682
|
+
});
|
|
683
|
+
},
|
|
684
|
+
|
|
685
|
+
/**
|
|
686
|
+
* 切换事件规则下拉框
|
|
687
|
+
*/
|
|
688
|
+
changeRuleSet(){
|
|
689
|
+
this.previewConfigObj = {
|
|
690
|
+
config:null,
|
|
691
|
+
render:null
|
|
692
|
+
}
|
|
693
|
+
if(this.eventObj.eventKey){
|
|
694
|
+
let eventPre = "inner-";
|
|
695
|
+
this.$set(this.eventObj,'eventType',this.EVENT_PLUGIN["preActiveEvenObj"][eventPre+this.eventObj.eventKey]["eventType"]);
|
|
696
|
+
this.$set(this.eventObj,'eventName',this.EVENT_PLUGIN["preActiveEvenObj"][eventPre+this.eventObj.eventKey]["name"]);
|
|
697
|
+
this.$set(this.eventObj,'version',this.EVENT_PLUGIN["preActiveEvenObj"][eventPre+this.eventObj.eventKey]['config']['version'] || '1.0');
|
|
698
|
+
this.previewConfigObj.config = this.EVENT_PLUGIN["preActiveEvenObj"][eventPre+this.eventObj.eventKey]['config'];
|
|
699
|
+
this.previewConfigObj.render = this.EVENT_PLUGIN["preActiveEvenObj"][eventPre+this.eventObj.eventKey]['render'];
|
|
700
|
+
}
|
|
701
|
+
this.$nextTick(()=>{
|
|
702
|
+
if(this.$refs['configRenderCompRef']){
|
|
703
|
+
this.$refs['configRenderCompRef'].preview();
|
|
704
|
+
this.$refs['configRenderCompRef'].initData();
|
|
705
|
+
this.$refs['configRenderCompRef'].$forceUpdate();
|
|
706
|
+
}
|
|
707
|
+
});
|
|
708
|
+
},
|
|
709
|
+
/**
|
|
710
|
+
* 预览事件规则
|
|
711
|
+
*/
|
|
712
|
+
preViewEvent(){
|
|
713
|
+
this.prviewShow = true;
|
|
714
|
+
},
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* 将组件转换为string字符串
|
|
718
|
+
* @param comp 传入组件对象
|
|
719
|
+
*/
|
|
720
|
+
conversionToStr(componentTemp) {
|
|
721
|
+
let obj = {};
|
|
722
|
+
dealComponent(componentTemp, obj);
|
|
723
|
+
let result = {};
|
|
724
|
+
result["comp"] = componentTemp;
|
|
725
|
+
result["method"] = obj;
|
|
726
|
+
return JSON.stringify(result);
|
|
727
|
+
|
|
728
|
+
function dealComponent(methodComponent,result){
|
|
729
|
+
Object.keys(methodComponent).forEach(key => {
|
|
730
|
+
if(Array.isArray(methodComponent[key])){
|
|
731
|
+
result[key] = methodComponent[key].slice(0);
|
|
732
|
+
result[key].forEach((item,index) => {
|
|
733
|
+
if(typeof item === "function"){
|
|
734
|
+
result[key][index] = item.toString();
|
|
735
|
+
}
|
|
736
|
+
})
|
|
737
|
+
}
|
|
738
|
+
if(typeof methodComponent[key] === "function"){
|
|
739
|
+
result[key] = methodComponent[key].toString();
|
|
740
|
+
}
|
|
741
|
+
if(typeof methodComponent[key] === "object" && !Array.isArray(methodComponent[key])){
|
|
742
|
+
if(methodComponent[key]["beforeCreate"] && methodComponent[key]["beforeDestroy"]){ // 继承的组件
|
|
743
|
+
result[key] = {};
|
|
744
|
+
dealComponent(methodComponent[key],result[key]);
|
|
745
|
+
}else{
|
|
746
|
+
Object.keys(methodComponent[key]).forEach(temKey => {
|
|
747
|
+
if(typeof methodComponent[key][temKey] === "function"){
|
|
748
|
+
if(!result[key]){
|
|
749
|
+
result[key] = {};
|
|
750
|
+
}
|
|
751
|
+
result[key][temKey] = methodComponent[key][temKey].toString();
|
|
752
|
+
}
|
|
753
|
+
})
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
})
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
},
|
|
760
|
+
|
|
761
|
+
|
|
762
|
+
|
|
763
|
+
|
|
764
|
+
/**
|
|
765
|
+
* 限制文件仅可上传一个并且多次上传覆盖的方法
|
|
766
|
+
*/
|
|
767
|
+
limitFile(files) {
|
|
768
|
+
let file = files[0];
|
|
769
|
+
let fileSuffix = file.name.substring(file.name.lastIndexOf("."), file.name.length);
|
|
770
|
+
if (fileSuffix != '.rldmp') {
|
|
771
|
+
this.$message.error('不支持' + fileSuffix + '文件类型!');
|
|
772
|
+
this.$refs.impFileRef.clearFiles();
|
|
773
|
+
} else {
|
|
774
|
+
let fileData = {
|
|
775
|
+
name: file.name,
|
|
776
|
+
percentage: 0,
|
|
777
|
+
raw: file,
|
|
778
|
+
size: file.size,
|
|
779
|
+
status: 'ready',
|
|
780
|
+
uid: file.uid
|
|
781
|
+
};
|
|
782
|
+
this.fileList = [fileData];
|
|
783
|
+
}
|
|
784
|
+
},
|
|
785
|
+
|
|
786
|
+
/**
|
|
787
|
+
* 导入选择文件类型过滤
|
|
788
|
+
* @param file
|
|
789
|
+
* @param fileList
|
|
790
|
+
*/
|
|
791
|
+
changeFile(file, fileList) {
|
|
792
|
+
let fileSuffix = file.name.substring(file.name.lastIndexOf("."), file.name.length);
|
|
793
|
+
if (fileSuffix != '.rldmp') {
|
|
794
|
+
this.$message.error('不支持' + fileSuffix + '文件类型!');
|
|
795
|
+
this.$refs.impFileRef.clearFiles();
|
|
796
|
+
} else {
|
|
797
|
+
this.fileList = fileList;
|
|
798
|
+
}
|
|
799
|
+
},
|
|
800
|
+
|
|
801
|
+
beforeUpload(file) {
|
|
802
|
+
let fileSuffix = file.name.substring(file.name.lastIndexOf("."), file.name.length);
|
|
803
|
+
if (fileSuffix != '.rldmp') {
|
|
804
|
+
this.$message.error('不支持' + fileSuffix + '文件类型!');
|
|
805
|
+
return false;
|
|
806
|
+
}
|
|
807
|
+
return true;
|
|
808
|
+
},
|
|
809
|
+
/**
|
|
810
|
+
* 上传方法
|
|
811
|
+
*/
|
|
812
|
+
uploadFileMethod(item) {
|
|
813
|
+
let vm = this;
|
|
814
|
+
let formData = new FormData();
|
|
815
|
+
//解析file文件
|
|
816
|
+
formData.append("file", item.file);
|
|
817
|
+
//创建axios实例
|
|
818
|
+
vm.axios.defaults.headers = null;
|
|
819
|
+
const axiosInstance = vm.axios.create({
|
|
820
|
+
baseURL: vm.uploadUrl,
|
|
821
|
+
headers: {
|
|
822
|
+
'Content-Type': 'multipart/form-data',
|
|
823
|
+
Authorization: (localStorage["Authorization" + (window.projectSuffix || "")] || ""),
|
|
824
|
+
},
|
|
825
|
+
transformRequest: [
|
|
826
|
+
function (data) {
|
|
827
|
+
return data;
|
|
828
|
+
}
|
|
829
|
+
],
|
|
830
|
+
});
|
|
831
|
+
|
|
832
|
+
vm.loading = true;
|
|
833
|
+
//上传文件
|
|
834
|
+
axiosInstance.post(this.api.eventRule.importEventData, formData).then(res => {
|
|
835
|
+
vm.axios.defaults.headers = {
|
|
836
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
837
|
+
common: {
|
|
838
|
+
Authorization: (localStorage["Authorization" + (window.projectSuffix || "")] || "")
|
|
839
|
+
}
|
|
840
|
+
};
|
|
841
|
+
if (res.data.operateSuccess) {
|
|
842
|
+
this.$message({
|
|
843
|
+
showClose: true,
|
|
844
|
+
duration:0,
|
|
845
|
+
type:'success',
|
|
846
|
+
message: res.data.operateObj.impMessage||''
|
|
847
|
+
});
|
|
848
|
+
//根据 返回导出数据进行注册
|
|
849
|
+
(res.data.operateObj.reultComp || []).forEach(item =>{
|
|
850
|
+
//根据 oldDataSource 删除 事件规则注册信息
|
|
851
|
+
let configStr = item.eventConfigurationStr; //配置文件字符串
|
|
852
|
+
let renderStr = item.eventRenderStr; //渲染文件字符串
|
|
853
|
+
let eventComp = {"id":item.eventKey,
|
|
854
|
+
"name":item.eventName,
|
|
855
|
+
"eventSource": item.eventSource,
|
|
856
|
+
"eventType":item.eventType,
|
|
857
|
+
"dataSource":item.dataSource,
|
|
858
|
+
"config":null,
|
|
859
|
+
"render":null};
|
|
860
|
+
if(configStr){
|
|
861
|
+
let configObj = JSON.parse(configStr);
|
|
862
|
+
let tempComp = configObj["comp"];
|
|
863
|
+
let method = configObj["method"];
|
|
864
|
+
// 转化
|
|
865
|
+
try {
|
|
866
|
+
this.recoverComponent(method);
|
|
867
|
+
}catch (e) {
|
|
868
|
+
console.log(e);
|
|
869
|
+
}
|
|
870
|
+
this.assignLevel(tempComp,method);
|
|
871
|
+
Object.assign(eventComp,{"config":tempComp});
|
|
872
|
+
}
|
|
873
|
+
if(renderStr){
|
|
874
|
+
let renderObj = JSON.parse(renderStr);
|
|
875
|
+
let tempComp = renderObj["comp"];
|
|
876
|
+
let obj = renderObj["method"];
|
|
877
|
+
this.recoverComponent(obj);
|
|
878
|
+
this.assignLevel(tempComp,obj);
|
|
879
|
+
Object.assign(eventComp,{"render":tempComp});
|
|
880
|
+
}
|
|
881
|
+
if(item.oldDataSource == '1'){ //内部
|
|
882
|
+
this.EVENT_PLUGIN.unPreActiveEventRule("inner-"+item.eventKey); //卸载预加载
|
|
883
|
+
this.EVENT_PLUGIN.uninstallEventRule("inner-"+item.eventKey);
|
|
884
|
+
}else if (item.oldDataSource == '2'){ //外部引入
|
|
885
|
+
this.EVENT_PLUGIN.unPreActiveEventRule("outside-"+item.eventKey); //卸载
|
|
886
|
+
this.EVENT_PLUGIN.uninstallEventRule("outside-"+item.eventKey);
|
|
887
|
+
}
|
|
888
|
+
this.EVENT_PLUGIN.preActiveEventRule(eventComp);//预注册
|
|
889
|
+
this.EVENT_PLUGIN.installEventRule(eventComp); //执行注册
|
|
890
|
+
});
|
|
891
|
+
//重新加载事件规则下拉
|
|
892
|
+
this.initEventOptions();
|
|
893
|
+
this.crud.search(this.searchFunc);
|
|
894
|
+
} else {
|
|
895
|
+
this.$message.error(res.data.operateMessage);
|
|
896
|
+
}
|
|
897
|
+
vm.loading = false;
|
|
898
|
+
}).catch(() => {
|
|
899
|
+
vm.axios.defaults.headers = {
|
|
900
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
901
|
+
common: {
|
|
902
|
+
Authorization: (localStorage["Authorization" + (window.projectSuffix || "")] || "")
|
|
903
|
+
}
|
|
904
|
+
};
|
|
905
|
+
});
|
|
906
|
+
},
|
|
907
|
+
|
|
908
|
+
|
|
909
|
+
/**
|
|
910
|
+
* 字符串和对象转换
|
|
911
|
+
* @param result
|
|
912
|
+
*/
|
|
913
|
+
recoverComponent(result){
|
|
914
|
+
Object.keys(result).forEach(key => {
|
|
915
|
+
if(Array.isArray(result[key])){
|
|
916
|
+
if(key == "beforeCreate" || key == "beforeDestroy"){
|
|
917
|
+
result[key] = [];
|
|
918
|
+
}else{
|
|
919
|
+
result[key].forEach((item,index) => {
|
|
920
|
+
let name = item.name || "a";
|
|
921
|
+
result[key][index] = new Function("let " + name + " = "+ item +";return " + name + ";")();
|
|
922
|
+
})
|
|
923
|
+
}
|
|
924
|
+
}else if (typeof result[key] === "object"){
|
|
925
|
+
if(result[key]["beforeCreate"] && result[key]["beforeDestroy"]){
|
|
926
|
+
this.recoverComponent(result[key]);
|
|
927
|
+
}else{
|
|
928
|
+
Object.keys(result[key]).forEach(temKey => {
|
|
929
|
+
let name = result[key][temKey].name || temKey;
|
|
930
|
+
if(Number(name) || Number(name) === 0){
|
|
931
|
+
name = "a";
|
|
932
|
+
}
|
|
933
|
+
result[key][temKey] = new Function("let " + name + " = " + result[key][temKey] +";return " + name + ";")();
|
|
934
|
+
})
|
|
935
|
+
}
|
|
936
|
+
}else{
|
|
937
|
+
let name = result[key].name || key;
|
|
938
|
+
result[key] = new Function("let " + name + " = " + result[key] +";return " + name + ";")();
|
|
939
|
+
}
|
|
940
|
+
})
|
|
941
|
+
},
|
|
942
|
+
|
|
943
|
+
/**
|
|
944
|
+
* 多级对象复制方法
|
|
945
|
+
* @param target
|
|
946
|
+
* @param source
|
|
947
|
+
*/
|
|
948
|
+
assignLevel(target,source){
|
|
949
|
+
let value = {};
|
|
950
|
+
Object.keys(target).forEach(key => {
|
|
951
|
+
if(typeof target[key] === "object" && target[key]["beforeCreate"] && target[key]["beforeDestroy"]){
|
|
952
|
+
value[key] = target[key];
|
|
953
|
+
this.assignLevel(value[key],source[key]);
|
|
954
|
+
delete target[key];
|
|
955
|
+
}
|
|
956
|
+
})
|
|
957
|
+
Object.assign(target,source,value);
|
|
958
|
+
},
|
|
959
|
+
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
</script>
|
|
963
|
+
|
|
964
|
+
<style scoped lang="scss">
|
|
965
|
+
// 滚动条的宽度
|
|
966
|
+
/deep/ .el-table__body-wrapper::-webkit-scrollbar {
|
|
967
|
+
width: 6px; // 横向滚动条
|
|
968
|
+
height: 6px; // 纵向滚动条 必写
|
|
969
|
+
}
|
|
970
|
+
// 滚动条的滑块
|
|
971
|
+
/deep/ .el-table__body-wrapper::-webkit-scrollbar-thumb {
|
|
972
|
+
background-color: #a9a9a9;
|
|
973
|
+
border-radius: 3px;
|
|
974
|
+
}
|
|
975
|
+
/* 滚动槽 */
|
|
976
|
+
/deep/ .el-table__body-wrapper::-webkit-scrollbar-track {
|
|
977
|
+
background: #eee;
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
legend{
|
|
981
|
+
font-size: 14px;
|
|
982
|
+
}
|
|
983
|
+
.button_header{
|
|
984
|
+
position: absolute;
|
|
985
|
+
height: 60px!important;
|
|
986
|
+
text-align: center;
|
|
987
|
+
line-height: 60px;
|
|
988
|
+
bottom: 0;
|
|
989
|
+
border-top: 1px solid #f2f2f2;
|
|
990
|
+
background-color: white;
|
|
991
|
+
margin: auto;
|
|
992
|
+
width: 100%;
|
|
993
|
+
right: 0;
|
|
994
|
+
z-index: 99;
|
|
995
|
+
}
|
|
996
|
+
.control_box{
|
|
997
|
+
padding-right: 100px;
|
|
998
|
+
position: relative;
|
|
999
|
+
}
|
|
1000
|
+
.control_box_zero{
|
|
1001
|
+
padding-right: 0;
|
|
1002
|
+
position: relative;
|
|
1003
|
+
}
|
|
1004
|
+
.operate_div{
|
|
1005
|
+
position: absolute;
|
|
1006
|
+
right: 0;
|
|
1007
|
+
top: 0;
|
|
1008
|
+
bottom: 0;
|
|
1009
|
+
margin: auto;
|
|
1010
|
+
width: 100px;
|
|
1011
|
+
}
|
|
1012
|
+
.operate_div i{
|
|
1013
|
+
/*margin-right: 20px;*/
|
|
1014
|
+
cursor: pointer;
|
|
1015
|
+
width: 30px;
|
|
1016
|
+
height: 30px;
|
|
1017
|
+
padding-top: 15px;
|
|
1018
|
+
padding-left: 15px;
|
|
1019
|
+
float: left;
|
|
1020
|
+
}
|
|
1021
|
+
.top_contain{
|
|
1022
|
+
height: 100%;
|
|
1023
|
+
/*border-radius:8px;*/
|
|
1024
|
+
overflow-y: hidden;
|
|
1025
|
+
}
|
|
1026
|
+
.top_contain::-webkit-scrollbar{
|
|
1027
|
+
width: 0;
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
.notice-info-dialog{
|
|
1031
|
+
/deep/ {
|
|
1032
|
+
//滚动条
|
|
1033
|
+
::-webkit-scrollbar {
|
|
1034
|
+
width: 4px;
|
|
1035
|
+
}
|
|
1036
|
+
/* 滚动槽 */
|
|
1037
|
+
::-webkit-scrollbar-track {
|
|
1038
|
+
background: #eee;
|
|
1039
|
+
}
|
|
1040
|
+
/* 滚动条滑块 */
|
|
1041
|
+
::-webkit-scrollbar-thumb {
|
|
1042
|
+
background: #a9a9a9;
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
.event-rule-config-class{
|
|
1047
|
+
margin-top: 10px;
|
|
1048
|
+
}
|
|
1049
|
+
.event-rule-render-class{
|
|
1050
|
+
margin-top: 10px;
|
|
1051
|
+
}
|
|
1052
|
+
</style>
|
|
1053
|
+
<style scoped>
|
|
1054
|
+
.black .el-form-item__label{
|
|
1055
|
+
color: black;
|
|
1056
|
+
}
|
|
1057
|
+
.green .el-form-item__label{
|
|
1058
|
+
color: #27B5C3;
|
|
1059
|
+
}
|
|
1060
|
+
.settingClass{
|
|
1061
|
+
width: 100%;
|
|
1062
|
+
height: 40px;
|
|
1063
|
+
position: relative;
|
|
1064
|
+
}
|
|
1065
|
+
.settingClass span{
|
|
1066
|
+
position: absolute;
|
|
1067
|
+
top:0;left:0;
|
|
1068
|
+
right: 0;bottom: 0;
|
|
1069
|
+
margin: auto;line-height: 40px;
|
|
1070
|
+
}
|
|
1071
|
+
.receiveObjNameLeft{
|
|
1072
|
+
float: left;
|
|
1073
|
+
width: 90%;
|
|
1074
|
+
}
|
|
1075
|
+
.receiveObjNameRight{
|
|
1076
|
+
position: absolute;
|
|
1077
|
+
float: right;
|
|
1078
|
+
top: 16px !important;
|
|
1079
|
+
width: auto !important;
|
|
1080
|
+
margin-left: 6px;
|
|
1081
|
+
}
|
|
1082
|
+
.formTable{
|
|
1083
|
+
margin: 20px auto;
|
|
1084
|
+
width: 96%;
|
|
1085
|
+
border-left: 1px solid #ddd;
|
|
1086
|
+
border-top: 1px solid #ddd;
|
|
1087
|
+
}
|
|
1088
|
+
.formTable .td-title{
|
|
1089
|
+
width: 20%;
|
|
1090
|
+
font-size: 13px;
|
|
1091
|
+
font-weight: bold;
|
|
1092
|
+
text-align: right;
|
|
1093
|
+
font-family: "微软雅黑", serif;
|
|
1094
|
+
border-color: #d8d7d7;
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
.formTable tr {
|
|
1098
|
+
padding: 10px;
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
.formTable .td-con{
|
|
1102
|
+
padding: 5px;
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
.formTable td{
|
|
1106
|
+
border-right: 1px solid #ddd;
|
|
1107
|
+
border-bottom: 1px solid #ddd;
|
|
1108
|
+
text-align: left;
|
|
1109
|
+
vertical-align: middle;
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
/**自定义样式**/
|
|
1113
|
+
.el-dialog-table-label .el-form-item__label{
|
|
1114
|
+
width: 20%;
|
|
1115
|
+
font-size: 13px;
|
|
1116
|
+
font-weight: bold;
|
|
1117
|
+
text-align: right;
|
|
1118
|
+
font-family: "微软雅黑", serif;
|
|
1119
|
+
border-color: #d8d7d7;
|
|
1120
|
+
background-color: #EEE;
|
|
1121
|
+
border-right: 1px solid #ddd;
|
|
1122
|
+
border-bottom: 1px solid #ddd;
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
.el-dialog-table-form {
|
|
1126
|
+
border-top: 1px solid #cccccc;
|
|
1127
|
+
border-left: 1px solid #cccccc;
|
|
1128
|
+
border-right: 1px solid #cccccc;
|
|
1129
|
+
}
|
|
1130
|
+
.el-dialog-table-label{
|
|
1131
|
+
margin-bottom: 0px;
|
|
1132
|
+
/*border-right: 1px solid #ddd;*/
|
|
1133
|
+
border-bottom: 1px solid #ddd;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
.el-dialog-table-label .el-input__inner{
|
|
1137
|
+
height: 30px;
|
|
1138
|
+
line-height: 30px;
|
|
1139
|
+
|
|
1140
|
+
}
|
|
1141
|
+
/deep/.el-dialog-table-label .el-form-item__content{
|
|
1142
|
+
/*padding: 0 10px 0 10px;*/
|
|
1143
|
+
padding: 10px;
|
|
1144
|
+
background-color: white;
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
.el-form-item__error {
|
|
1148
|
+
left: auto;
|
|
1149
|
+
right: 10px;
|
|
1150
|
+
top: 14px;
|
|
1151
|
+
}
|
|
1152
|
+
.receiveObjName .el-form-item__error{
|
|
1153
|
+
left: auto;
|
|
1154
|
+
right: 92px;
|
|
1155
|
+
top: 14px;
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
.el-form-item__error {
|
|
1159
|
+
padding: 1px 5px;
|
|
1160
|
+
margin-left: -10px;
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
.dialog-tr-td{
|
|
1164
|
+
width: 20%;
|
|
1165
|
+
font-size: 13px;
|
|
1166
|
+
font-weight: bold;
|
|
1167
|
+
text-align: right;
|
|
1168
|
+
font-family: "微软雅黑", serif;
|
|
1169
|
+
border-right: 1px solid #ddd;
|
|
1170
|
+
border-bottom: 1px solid #ddd;
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
|
|
1174
|
+
/deep/.el-form-item__error {
|
|
1175
|
+
left: auto;
|
|
1176
|
+
right: 16px;
|
|
1177
|
+
top: 19px;
|
|
1178
|
+
}
|
|
1179
|
+
/deep/.receiveObjName .el-form-item__error {
|
|
1180
|
+
left: auto;
|
|
1181
|
+
right: 96px;
|
|
1182
|
+
top: 21px;
|
|
1183
|
+
}
|
|
1184
|
+
</style>
|