sasp-flow-render 1.1.2 → 1.1.5

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.
@@ -66,7 +66,7 @@
66
66
  let resourceObj = this.resourceObj;
67
67
  this.flowId = resourceObj.rkey || '';
68
68
  if(this.flowId){
69
- /*await this.axios.post(this.api.plFlowDefine.getById, {"id":this.flowId}).then(res=>{
69
+ /*await this.saspFlowAxios.post(this.api.plFlowDefine.getById, {"id":this.flowId}).then(res=>{
70
70
  if(res.data){
71
71
  this.flowObj=res.data;
72
72
  }
@@ -113,7 +113,7 @@
113
113
 
114
114
  this.isShow = true;
115
115
  }else{ //根据 resourceId查询当前用户是否存在 资源权限 resourceId 如果存在获取数据权限和操作权限
116
- this.axios.post(this.api.auth.getOwnMenuOpt,{userId:loginUser.id,userType:loginUser.userType,optType:'source'}).then(res =>{
116
+ this.saspFlowAxios.post(this.api.auth.getOwnMenuOpt,{userId:loginUser.id,userType:loginUser.userType,optType:'source'}).then(res =>{
117
117
  if(res && res.data){
118
118
  let roleOptArr = [];
119
119
  (res.data || []).forEach(item =>{
@@ -190,7 +190,7 @@
190
190
  // * 获取资源池对象
191
191
  // */
192
192
  // async getResources(){
193
- // let res = await this.axios.post(this.api.resources.findResources,{id:this.resourceId,rType:"page"}); //查询自定义表单中资源池数据
193
+ // let res = await this.saspFlowAxios.post(this.api.resources.findResources,{id:this.resourceId,rType:"page"}); //查询自定义表单中资源池数据
194
194
  // if(res.data && res.data.operateObj){
195
195
  // this.resourceObj = res.data.operateObj[0]; //当前资源池
196
196
  // }
@@ -207,7 +207,7 @@
207
207
 
208
208
  },
209
209
  async initReousrceObj(){
210
- let res = await vm.axios.post(this.api.resources.findResources,{'rSource':rSource,'rStatus':'1','rKey':this.rKey}); //获取绑定资源数据
210
+ let res = await this.saspFlowAxios.post(this.api.resources.findResources,{'rSource':rSource,'rStatus':'1','rKey':this.rKey}); //获取绑定资源数据
211
211
  if(res.data && res.data.operateObj){
212
212
  res.data.operateObj.forEach(item =>{
213
213
  this.sourcesObj[item.rkey] = item;
@@ -166,8 +166,8 @@ let eventObj = {}; //事件对象
166
166
 
167
167
  export default {
168
168
  name: "loadEventPlugin",
169
- installAll(Vue){
170
- axios.post(apiFlow.apis.eventRule.findByVersion,{"eventTypes":"flow"}).then(res =>{ //查询流程相关事件规则
169
+ installAll(Vue,opts){
170
+ opts.saspFlowAxios.post(apiFlow.apis.eventRule.findByVersion,{"eventTypes":"flow"}).then(res =>{ //查询流程相关事件规则
171
171
  let eventPlugin = Vue.prototype.EVENT_PLUGIN || {};
172
172
  if(res){
173
173
  Object.keys(diyEventObjs).forEach(key =>{
@@ -279,4 +279,4 @@ export default {
279
279
  });
280
280
 
281
281
  }
282
- }
282
+ }
@@ -1,547 +0,0 @@
1
- <template>
2
- <el-container style="height: 100%">
3
- <el-header style="height: auto">
4
- <div class="search-form-parent el-card" style="padding-left:10px;padding-right:10px">
5
- <el-form size="small" :inline="true"
6
- @keyup.enter.native="crud.doSearch()" onSubmit="return false;">
7
- <el-form-item label="模板名称" label-width="80px">
8
- <el-input placeholder="请输入" v-model="crud.searchForm.name"></el-input>
9
- </el-form-item>
10
- <el-form-item label="模板类型" label-width="80px">
11
- <el-select placeholder="请选择" v-model="crud.searchForm.type" clearable>
12
- <el-option
13
- v-for="item in typeArr"
14
- :key="item.value"
15
- :label="item.label"
16
- :value="item.value">
17
- </el-option>
18
- </el-select>
19
- </el-form-item>
20
- <el-form-item label="模板状态" label-width="80px">
21
- <el-select placeholder="请选择" v-model="crud.searchForm.useMould" clearable>
22
- <el-option
23
- v-for="item in useMouldArr"
24
- :key="item.value"
25
- :label="item.label"
26
- :value="item.value">
27
- </el-option>
28
- </el-select>
29
- </el-form-item>
30
- <el-button type="primary" icon="el-icon-search" size="small" style="margin-top: 5px" @click="doSearch()">查询</el-button>
31
- <el-button icon="el-icon-close" size="small" style="margin-top: 5px" @click="resetSearch()">清空</el-button>
32
- </el-form>
33
- </div>
34
- </el-header>
35
- <el-main id="tableMain" style="height: 100%">
36
- <el-container style="height:100%" class="table-list-container">
37
- <el-header style="height: auto;" size="small">
38
- <el-button type="primary" round size="small" icon="el-icon-circle-plus" @click="addRecord()"> 新增</el-button>
39
- <el-button type="danger" round size="small" icon="el-icon-delete" @click="remove()">删除</el-button>
40
- <span style="font-size:16px;color: red;margin-left: 5px">
41
- {{'常用系统字段(点击按钮直接插入到模板中):'}}
42
- </span>
43
- <el-tooltip content="${loginUser*}">
44
- <el-button type="primary" @click="appendContent('${loginUser*}')">登录人名称</el-button>
45
- </el-tooltip>
46
- <el-tooltip content="${flowName*}">
47
- <el-button type="primary" @click="appendContent('${flowName*}')">流程名称</el-button>
48
- </el-tooltip>
49
- <el-tooltip content="${count*}">
50
- <el-button type="primary" @click="appendContent('${count*}')">数据条目</el-button>
51
- </el-tooltip>
52
- </el-header>
53
- <el-main style="height:100%">
54
- <el-table v-if="tableShow" :data="dataList" :ref="crud.tableRef" stripe border height="100%" style="width: 100%;"
55
- header-row-class-name="list-default-row">
56
- <el-table-column type="selection" width="40" align="center"></el-table-column>
57
- <el-table-column type="index" label="序号" align="center" width="60"></el-table-column>
58
- <el-table-column label="模板名称" prop="name" width="150">
59
- <template slot-scope="scope">
60
- <span v-if="isRowNotEdit(scope.row,scope.$index)">{{scope.row.name}}</span>
61
- <el-input v-if="isRowEdit(scope.row,scope.$index)" @blur="changeContent(scope.row,scope.$index)" v-model="scope.row.name"></el-input>
62
- </template>
63
- </el-table-column>
64
- <el-table-column label="模板类型" prop="type" width="100">
65
- <template slot-scope="scope">
66
- <span v-if="isRowNotEdit(scope.row,scope.$index)">{{formartType(scope.row.type)}}</span>
67
- <el-select placeholder="请选择" v-model="scope.row.type" v-if="isRowEdit(scope.row,scope.$index)">
68
- <el-option
69
- v-for="item in typeArr"
70
- :key="item.value"
71
- :label="item.label"
72
- :value="item.value">
73
- </el-option>
74
- </el-select>
75
- </template>
76
- </el-table-column>
77
- <el-table-column label="提醒方式" prop="remindType" width="250">
78
- <template slot-scope="scope">
79
- <span v-if="isRowNotEdit(scope.row,scope.$index)">{{formartRemind(scope.row.remindType)}}</span>
80
- <el-select placeholder="请选择" v-model="scope.row.remindTypeArr" v-if="isRowEdit(scope.row,scope.$index)" multiple>
81
- <el-option
82
- v-for="item in remindTypeArr"
83
- :key="item.value"
84
- :label="item.label"
85
- :value="item.value">
86
- </el-option>
87
- </el-select>
88
- </template>
89
- </el-table-column>
90
- <el-table-column label="模板内容" prop="content">
91
- <template slot-scope="scope">
92
- <span v-if="isRowNotEdit(scope.row,scope.$index)">{{scope.row.content}}</span>
93
- <el-input v-if="isRowEdit(scope.row,scope.$index)" :ref="'content' + scope.$index" @blur="changeContent(scope.row,scope.$index)" v-model="scope.row.content"></el-input>
94
- </template>
95
- </el-table-column>
96
- <el-table-column label="模板示例" prop="example">
97
- <template slot-scope="scope">
98
- <span v-if="isRowNotEdit(scope.row,scope.$index)">{{scope.row.example}}</span>
99
- <el-input v-if="isRowEdit(scope.row,scope.$index)" v-model="scope.row.example"></el-input>
100
- </template>
101
- </el-table-column>
102
- <el-table-column label="默认模板" width="90" prop="defaultMould" align="center">
103
- <template slot-scope="scope">
104
- <el-tag v-if="isRowNotEdit(scope.row,scope.$index)" :type="scope.row.defaultMould=='1'?'success':'info'">{{scope.row.defaultMould=="1"?"是":"否"}}</el-tag>
105
- <el-checkbox v-model="scope.row.defaultMould" true-label="1" false-label="0" v-if="isRowEdit(scope.row,scope.$index)" @change="defaultMouldChange(scope.row,scope.$index)"/>
106
- </template>
107
- </el-table-column>
108
- <el-table-column label="启用模板" prop="useMould" width="90" align="center">
109
- <template slot-scope="scope">
110
- <el-tag v-if="isRowNotEdit(scope.row,scope.$index)" :type="scope.row.useMould=='1'?'success':'info'">{{scope.row.useMould=="1"?"启用":"禁用"}}</el-tag>
111
- <el-checkbox v-model="scope.row.useMould" true-label="1" false-label="0" v-if="isRowEdit(scope.row,scope.$index)" @change="useMouldChange(scope.row,scope.$index)"/>
112
- </template>
113
- </el-table-column>
114
- <el-table-column label="操作" align="center" width="150">
115
- <template slot-scope="scope">
116
- <el-button size="small" type="primary" v-if="isRowNotEdit(scope.row,scope.$index)" @click="clickRowEdit(scope.row,scope.$index)">修改</el-button>
117
- <el-button size="small" type="primary" v-if="isRowEdit(scope.row,scope.$index)" @click="saveUpdate(scope.row,scope.$index)">保存</el-button>
118
- <el-button size="small" v-if="isRowEdit(scope.row,scope.$index)" @click="cancelUpdate(scope.row,scope.$index)" style="margin-left: 10px;">取消</el-button>
119
- </template>
120
- </el-table-column>
121
- </el-table>
122
- </el-main>
123
- </el-container>
124
- </el-main>
125
- <el-footer>
126
- <el-pagination
127
- :ref="crud.pageRef"
128
- :page-sizes="crud.pageSizes"
129
- :page-size="crud.pageSize"
130
- :current-page="crud.page"
131
- :total="crud.dataStore.total"
132
- @size-change="crud.sizeChange()"
133
- @current-change="crud.currentPage()"
134
- layout="total, sizes, prev, pager, next, jumper">
135
- </el-pagination>
136
- </el-footer>
137
- </el-container>
138
- </template>
139
- <script>
140
- export default {
141
- name:'message-mould',
142
- data() {
143
- return {
144
- crud: new this.CrudUtil({
145
- vue: this,
146
- entityName: "messageMould",
147
- url: this.api.messageMould.url,
148
- searchForm: {
149
- order: 'DEFAULT_MOULD DESC, USE_MOULD DESC,UPDATE_TIME DESC',
150
- },
151
- noClearSearchColumns: ["order"],
152
- afterRemoveSuccess:()=>{
153
- this.afterRemoveSuccess()
154
- },
155
- }),
156
- messageTip:"说明:模板内容通过${ *}通配符进行解释,目前支持的通配符名称有:${flowName*}、${count*}、${loginUser*}",
157
- typeArr:[{
158
- value: 'pengding',
159
- label: '待办提醒'
160
- },
161
- {
162
- value: 'cancel',
163
- label: '撤销提醒'
164
- }, {
165
- value: 'stopped',
166
- label: '中止提醒'
167
- }, {
168
- value: 'end',
169
- label: '办结提醒'
170
- },
171
- ],
172
- remindTypeArr:[{
173
- value: 'sys',
174
- label: '系统提醒'
175
- },{
176
- value: 'email',
177
- label: '邮件提醒'
178
- },
179
- {
180
- value: 'message',
181
- label: '短信提醒'
182
- }],
183
- useMouldArr:[{
184
- value: '1',
185
- label: '启用'
186
- }, {
187
- value: '0',
188
- label: '禁用'
189
- }],
190
- dataList:[],
191
- dataObj:"",
192
- lastRowIndex: -1,
193
- dataListBak:"",
194
- tableShow:true,
195
- defaultMouldObj:"",
196
- defaultMouldObj2:"",
197
- initList:[],
198
- initListBak:[],
199
- }
200
- },
201
- watch :{
202
- "crud.dataStore.records"(){
203
- this.dataList=this.crud.dataStore.records;
204
- }
205
- },
206
- created() {
207
-
208
- this.initData();
209
- },
210
- methods:{
211
- /*
212
- 初始化数据
213
- */
214
- initData(){
215
- this.axios.post(this.api.messageMould.find).then(res=>{
216
- this.initList=res.data;
217
- this.initListBak=JSON.parse(JSON.stringify(this.initList));
218
- })
219
- },
220
- doSearch(){
221
- if(this.lastRowIndex!=-1){
222
- this.$message({
223
- message: '请先保存或取消编辑内容再进行操作',
224
- type: 'error'
225
- });
226
- }else{
227
- this.crud.doSearch();
228
- }
229
- },
230
- resetSearch(){
231
- if(this.lastRowIndex!=-1){
232
- this.$message({
233
- message: '请先保存或取消编辑内容再进行操作',
234
- type: 'error'
235
- });
236
- }else{
237
- this.crud.resetSearch();
238
- }
239
- },
240
- /*
241
- 格式化 模板类型
242
- */
243
- formartType(type){
244
- if(type=='pengding'){
245
- return '待办提醒';
246
- }else if(type=='cancel'){
247
- return '撤销提醒';
248
- }else if(type=='stopped'){
249
- return '中止提醒';
250
- }else if(type=='end'){
251
- return '办结提醒';
252
- }else if(type=='email'){
253
- return '邮件提醒';
254
- }else if(type=='message'){
255
- return '短信提醒';
256
- }
257
- },
258
- /*
259
- 格式化 模板类型
260
- */
261
- formartRemind(remind){
262
- let obj = {"email":"邮件提醒","sys":"系统提醒","message":"短信提醒"};
263
- if(!remind){
264
- return "";
265
- }
266
- let arr = [];
267
- remind.split(",").forEach(key => {
268
- arr.push(obj[key]);
269
- })
270
- return arr.join(",");
271
- },
272
- /*
273
- 增加行
274
- */
275
- addRecord(){
276
- this.dataObj={"name":"","content":"","example":"","defaultMould":"0","useMould":"1","defaultData":"0"};
277
- let lastObj=this.dataList[0];
278
- if(this.dataList.length == 0){
279
- this.dataList.push(this.dataObj);
280
- this.lastRowIndex=this.dataList.length-1;
281
- }else{
282
- if(this.lastRowIndex != -1){ //编辑状态下不许新增
283
- this.$message({
284
- message: '请先保存或取消编辑内容再进行添加数据操作',
285
- type: 'error'
286
- });
287
- }else if(lastObj.name==""&&lastObj.content==""&&lastObj.example==""){ //不允许同时新增多条
288
- this.$message({
289
- message: '禁止重复进行添加数据操作',
290
- type: 'error'
291
- });
292
- }else{
293
- this.dataListBak=JSON.parse(JSON.stringify(this.dataList));
294
- this.dataList.unshift(this.dataObj);
295
- this.lastRowIndex=0;
296
- }
297
- }
298
-
299
- },
300
-
301
- isRowEdit(row,index){
302
- let flag = false;
303
- if(index == this.lastRowIndex){
304
- flag = true;
305
- }
306
- return flag;
307
- },
308
- isRowNotEdit(row,index){
309
- let flag = false;
310
- if(index != this.lastRowIndex){
311
- flag = true;
312
- }
313
- return flag;
314
- },
315
- // 可编辑
316
- clickRowEdit(row,index){
317
- let lastObj=this.dataList[0];
318
- if(lastObj.name==""&&lastObj.content==""&&lastObj.example=="" ||this.lastRowIndex != -1 ){ //不允许新增数据 或编辑状态后未保存编辑其他数据
319
- this.$message({
320
- message: '请保存或取消当前编辑的内容!',
321
- type: 'error'
322
- });
323
- }else{
324
- if(!(row.remindTypeArr && row.remindTypeArr.constructor == Array)){
325
- if(row.remindType){
326
- this.$set(row,"remindTypeArr",row.remindType.split(","));
327
- }else{
328
- this.$set(row,"remindTypeArr",[]);
329
- }
330
- }
331
- this.lastRowIndex=index;
332
- this.defaultMouldObj="";
333
- this.defaultMouldObj2="";
334
- this.dataListBak=JSON.parse(JSON.stringify(this.dataList));
335
- }
336
- },
337
-
338
- /*
339
- 通配符 =》模板示例
340
- */
341
- changeContent(row,index){
342
- let content=row.content;
343
- content=content.replace(/\$\{count\*\}/g,"1");
344
- content=content.replace(/\$\{flowName\*\}/g,"意见与建议");
345
- content=content.replace(/\$\{loginUser\*\}/g,"用户");
346
- row.example=content;
347
- },
348
- /*
349
- 默认模板 遍历
350
- 返回改类型的默认模板数据
351
- */
352
- foreachDefaultMould(type){
353
- let arr=[];
354
- this.initList.forEach(data=>{
355
- if(data.type==type && data.defaultMould=="1"){
356
- arr.push(data);
357
- }
358
- });
359
- return arr;
360
- },
361
- /*
362
- 默认数据更改
363
- */
364
- defaultMouldChange(row,num){
365
- if(row.defaultMould=="1"){
366
- this.$set(row,"useMould","1");
367
- }
368
- },
369
-
370
- /*
371
- 保存修改
372
- */
373
- saveUpdate(row,num){
374
- if(row.name==""){
375
- this.$message.error("模板名称不能为空!");
376
- } else if(row.content==""){
377
- this.$message.error("模板内容不能为空!");
378
- }else if(row.type=="" || row.type==undefined){
379
- this.$message.error("模板类型不能为空!");
380
- }else if(!row.remindTypeArr || row.remindTypeArr.length == 0){
381
- this.$message.error("提醒方式不能为空!");
382
- } else{
383
- let arr=this.foreachDefaultMould(row.type);
384
- let obj="";
385
- if(row.id!=undefined){
386
- let index=this.initList.findIndex(data =>{
387
- if(row.id == data.id){
388
- return true;
389
- }
390
- });
391
- if(index >=0){
392
- obj=this.initList[index];
393
- }
394
- }
395
- if(obj !="" && obj.defaultMould =="1" && row.type != obj.type){
396
- this.$message.error("默认模板不允许更换类型!");
397
- }else if(row.useMould=="0" && row.defaultMould=="1"){
398
- this.$message({
399
- type: 'error',
400
- message: '默认模板不许禁用!'
401
- });
402
- this.$set(row,"useMould","1");
403
- }else if(arr.length>0 && row.defaultMould=="1"){
404
- if(row.id==undefined || row.id !=arr[0].id){
405
- this.defaultMouldObj=JSON.parse(JSON.stringify(arr[0]));
406
- this.$set(this.defaultMouldObj,"defaultMould","0");
407
- this.addOrUpdate(this.defaultMouldObj);
408
- }
409
- this.addOrUpdate(row);
410
- }else if(row.defaultMould=="0"){
411
- if(arr.length >0 && row.id !=undefined && row.id==arr[0].id){
412
- this.$message.error("默认模板不允许取消!");
413
- this.$set(row,"defaultMould","1");
414
- this.$set(row,"useMould","1");
415
- }else{
416
- this.addOrUpdate(row);
417
- }
418
- } else{
419
- this.addOrUpdate(row);
420
- }
421
- }
422
- },
423
-
424
- /*
425
- add or update 后台交互
426
- */
427
- addOrUpdate(row){
428
- let operate = "update";
429
- if(row.id==undefined || row.id==""){
430
- operate="add";
431
- }
432
- let obj={};
433
- if(operate=="update"){
434
- obj={"id":row.id,"type":row.type,"name":row.name,"content":row.content,
435
- "example":row.example,"defaultMould":row.defaultMould,"useMould":row.useMould,"defaultData":row.defaultData};
436
- if(row.remindTypeArr && row.remindTypeArr.length > 0){
437
- obj.remindType = row.remindTypeArr.join(",")
438
- }
439
- }else{
440
- obj=JSON.parse(JSON.stringify(row));
441
- obj.remindType = obj.remindTypeArr.join(",");
442
- delete obj["remindTypeArr"];
443
- }
444
- this.axios.post(this.api.messageMould[operate],obj).then(res =>{
445
- this.lastRowIndex=-1;
446
- this.crud.search();
447
- this.initData();
448
- });
449
- },
450
-
451
- /*
452
- 取消修改
453
- */
454
- cancelUpdate(row,index){
455
- this.lastRowIndex=-1;
456
- this.defaultMouldObj="";
457
- this.dataList=JSON.parse(JSON.stringify(this.dataListBak));
458
- //this.initData();
459
- this.initList=JSON.parse(JSON.stringify(this.initListBak));
460
- },
461
-
462
- /*
463
- 删除
464
- */
465
- remove(){
466
- let selection = this.$refs[this.crud.tableRef].selection;
467
- let tag=true;
468
- selection.forEach(data =>{
469
- if(data.defaultMould==1){
470
- this.$message({
471
- type: 'error',
472
- message: '默认模板不允许删除!'
473
- });
474
- tag=false;
475
- }else if(data.defaultData==1){
476
- this.$message({
477
- type: 'error',
478
- message: '系统数据不允许删除!'
479
- });
480
- tag=false;
481
- }
482
- });
483
- if(tag){
484
- if(this.lastRowIndex == -1){
485
- this.crud.remove();
486
- this.initData();
487
- }else{
488
- this.$message({
489
- type: 'error',
490
- message: '请保存或取消当前编辑的内容!'
491
- });
492
- }
493
- }
494
- },
495
- afterRemoveSuccess(){
496
- this.lastRowIndex=-1;
497
- },
498
- useMouldChange(row,index){
499
- if(row.useMould=="0" && row.defaultMould=="1"){
500
- this.$message({
501
- type: 'error',
502
- message: '默认模板不许禁用!'
503
- });
504
- this.$set(row,"useMould","1");
505
- }
506
- },
507
- remindSuccess(){
508
- this.$message.success("复制成功!");
509
- },
510
- appendContent(val){
511
- if(this.lastRowIndex === -1){
512
- this.$message.error("没有正在编辑的数据!");
513
- return;
514
- }
515
- let data = this.dataList[this.lastRowIndex];
516
- let content = data.content;
517
- let index = this.$refs['content' + this.lastRowIndex].$el.children[0].selectionStart;
518
- // 开始判断此处是否允许插入
519
- let subStringData = content.substring(0,index);
520
- let indexBefore = subStringData.lastIndexOf("${");
521
- let indexAfter = subStringData.lastIndexOf("}");
522
- if(indexBefore > indexAfter){
523
- this.$message.error("不能在系统字段中间插入!");
524
- return;
525
- }
526
- // 判断end
527
- let insertValue = val;
528
- if(index == content.length){
529
- content += insertValue;
530
- }else{
531
- if(index === 0){
532
- content = insertValue + content;
533
- }else{
534
- content = content.slice(0,index) + insertValue + content.slice(index);
535
- }
536
- }
537
- this.$set(data, "content", content);
538
- this.summaryVisible = false;
539
- this.$nextTick(() => {
540
- this.$refs['content' + this.lastRowIndex].$el.children[0].selectionStart = index + insertValue.length;
541
- this.$refs['content' + this.lastRowIndex].$el.children[0].selectionEnd = index + insertValue.length;
542
- this.$refs['content' + this.lastRowIndex].focus();
543
- })
544
- },
545
- }
546
- }
547
- </script>