sasp-flow-render 1.1.1 → 1.1.3

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 CHANGED
@@ -13,6 +13,8 @@ import CustomRenderer from './src/views/popup/js/controls/CustomRenderer';
13
13
  import translations from './src/views/popup/js/translations/translations';
14
14
  import apiFlow from './src/assets/js/api/apiFlow';
15
15
  import flowGlobal from './src/assets/js/global/flowGlobal';
16
+ import axios from 'axios';
17
+ import qs from "qs";
16
18
  import flowInstView from './src/views/flowInstView';
17
19
  import {isAxiosFormData, SaspModuleUtil} from "sasp-base";
18
20
  /**
@@ -43,32 +45,22 @@ let components = [
43
45
  ];
44
46
 
45
47
  let createAxiosIfNotExists = (Vue,props) => {
46
- let newAxios = (props || {}).axios;
47
- if (!newAxios) {
48
- if(Vue.prototype.shareAxios){
49
- (props || {}).axios = Vue.prototype.shareAxios;
50
- return;
48
+ let newAxios = axios.create({
49
+ baseURL:window.FLOW_RENDER_URL,
50
+ headers: {
51
+ 'Content-Type': 'application/x-www-form-urlencoded',
52
+ },
53
+ })
54
+ newAxios.defaults.transformRequest = [];
55
+ newAxios.defaults.transformRequest.push(
56
+ function (data) {
57
+ return data;
51
58
  }
52
- newAxios = axios.create({
53
- baseURL:(props || {}).SERVICE_URL,
54
- headers: {
55
- 'Content-Type': 'application/x-www-form-urlencoded',
56
- common: {
57
- Authorization: (localStorage["Authorization" + (window.projectSuffix || "")] || "")
58
- }
59
- },
60
- transformRequest: [
61
- function (data) {
62
- return data;
63
- }
64
- ],
65
- })
66
- newAxios.all = axios.all;
67
- newAxios.spread = axios.spread;
68
- Vue.prototype.axios = newAxios;
69
- Vue.prototype.shareAxios = newAxios;
70
- (props || {}).axios = newAxios;
71
- }
59
+ )
60
+ newAxios.all = axios.all;
61
+ newAxios.spread = axios.spread;
62
+ Vue.prototype.saspFlowAxios = newAxios;
63
+ (props || {}).saspFlowAxios = newAxios;
72
64
  }
73
65
 
74
66
  /**
@@ -77,17 +69,14 @@ let createAxiosIfNotExists = (Vue,props) => {
77
69
  * @param props
78
70
  */
79
71
  let initAxios = (Vue, props) => {
80
- let axios = (props || {}).axios;
81
- if (!axios) {
82
- return;
83
- }
84
-
72
+ let axios = (props || {}).saspFlowAxios;
85
73
  // 添加请求拦截器
86
74
  axios.interceptors.request.use(function (config) {
87
- if ((config.headers["Content-Type"] != 'multipart/form-data') && isAxiosFormData((config.url))) {
75
+ // if ((config.headers["Content-Type"] != 'multipart/form-data') && isAxiosFormData((config.url))) {
76
+ if (config.headers["Content-Type"] != 'multipart/form-data') {
88
77
  config = Object.assign({}, config);
89
78
  config.headers = Object.assign({}, config.headers || {}, {
90
- "Is-Sasp-Qs": true,
79
+ // "Is-Sasp-Qs": true,
91
80
  "Content-Type": "application/x-www-form-urlencoded"
92
81
  });
93
82
  }
@@ -103,12 +92,25 @@ let initAxios = (Vue, props) => {
103
92
  }
104
93
  return config;
105
94
  });
95
+ axios.defaults.transformRequest = axios.defaults.transformRequest || [];
96
+ axios.defaults.transformRequest.push(
97
+ function (data) {
98
+ if (data && typeof data === "string") { // 本项目的所有请求都通过qs转换实现
99
+ try {
100
+ data = JSON.parse(data);
101
+ } catch (e) {
102
+ console.error(e);
103
+ }
104
+ }
105
+ return qs.stringify(data);
106
+ }
107
+ );
106
108
  };
107
109
 
108
110
  const install = function (Vue, opts = {}) {
109
111
  SaspModuleUtil.registerModuleName(Vue, "flow");
110
-
111
- // createAxiosIfNotExists(Vue,opts);
112
+ window.FLOW_RENDER_URL = opts.SERVICE_URL || window.JAVA_URL;
113
+ createAxiosIfNotExists(Vue,opts);
112
114
 
113
115
  Vue.prototype.USE_SASP_FLOW = true; // 说明安装了流程插件,我们使用此参数作为表单对接的依据
114
116
  Vue.use(flowInstall, opts);
@@ -120,7 +122,7 @@ const install = function (Vue, opts = {}) {
120
122
  components.forEach(component => {
121
123
  Vue.component(component.name, component);
122
124
  });
123
- loadFlowEventPlugin.installAll(Vue);
125
+ loadFlowEventPlugin.installAll(Vue, opts);
124
126
  };
125
127
 
126
128
  export default {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sasp-flow-render",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "业务应用支撑平台-智慧流程渲染组件",
5
5
  "scripts": {
6
6
  "build": "vue-cli-service build"
@@ -12,6 +12,7 @@
12
12
  "camunda-bpmn-moddle": "^4.4.0",
13
13
  "diagram-js": "^6.6.1",
14
14
  "diagram-js-minimap": "^2.0.3",
15
+ "qs": "^6.5.2",
15
16
  "sasp-base": "2.5.4"
16
17
  },
17
18
  "browserslist": [
package/router.js CHANGED
@@ -1,7 +1,6 @@
1
1
  export default {
2
2
  menus: [
3
3
  {path: 'flowInstTab', component: () => import("./src/components/flowInst/flowInstTab.vue")},
4
- {path: 'messageMould', component: () => import("./src/components/messageMould/messageMould.vue")},
5
4
  {path: 'flowInstTab', component: () => import("./src/components/flowInst/flowInstTab.vue")},
6
5
  {path: 'flowMenuRouter/:resourceId', component: () => import("./src/views/menuRouter/flowMenuRouter.vue")},
7
6
  ],
@@ -145,6 +145,8 @@ let objResult = {
145
145
 
146
146
  changeDealer:"/plFlowInstController/changeDealer", // 切换当前任务处理人
147
147
  forceEnd:"/plFlowInstController/forceEnd", // 强制办结
148
+ recoverExceptionFlow:"/plFlowInstController/recoverExceptionFlow", // 恢复异常流程
149
+ reStartFlow:"/plFlowInstController/reStartFlow" //重启办结状态下的流程
148
150
  },
149
151
 
150
152
  plFlowSetting:{
@@ -187,6 +189,7 @@ let objResult = {
187
189
  add:"/plFlowDomainController/add",
188
190
  update:"/plFlowDomainController/update",
189
191
  delete:"/plFlowDomainController/delete",
192
+ findRealUrl:"/plFlowDomainController/findRealUrl",
190
193
  },
191
194
  plFlowInterface:{
192
195
  url:"/plFlowInterfaceController",
@@ -216,6 +219,14 @@ let objResult = {
216
219
  delete:"/plFlowCss/delete",
217
220
  getById:"/plFlowCss/getById",
218
221
  },
222
+ operationLog: {
223
+ url:"/operationLogController",
224
+ find:"/operationLogController/find",
225
+ getById:"/operationLogController/getById"
226
+ },
227
+ flowEngine: {
228
+ saveDataFlowDrafts: "/flowEngine/saveDataFlowDrafts",
229
+ }
219
230
  };
220
231
 
221
232
  import {SaspModuleUtil} from "sasp-base";
@@ -15,7 +15,7 @@ export default {
15
15
  LOCK_USER_INFO:[], //锁定用户信息
16
16
  ARR_ALL_POS_USER_INFO:[], //所有组织岗位用户信息(包含已锁定)
17
17
  install(Vue,opts){
18
- axios = opts.axios;
18
+ axios = opts.saspFlowAxios;
19
19
  },
20
20
 
21
21
  clearCache(){
@@ -40,10 +40,14 @@ export default {
40
40
  setLocalJSON('LOGINUSER', user);
41
41
  },
42
42
  setLoginToken(token) {
43
- setLocalJSON('USERTOKEN', "pl_token_" + token);
44
-
45
- localStorage["Authorization" + (window.projectSuffix || "")] = "pl_token_" + token;
46
- axios.defaults.headers.common["Authorization"] = "pl_token_" + token;
43
+ let customToken = window.customToken;
44
+ if(!customToken) {
45
+ customToken = "pl_token_";
46
+ }
47
+ setLocalJSON('USERTOKEN', customToken + token);
48
+
49
+ localStorage["Authorization" + (window.projectSuffix || "")] = customToken + token;
50
+ axios.defaults.headers.common["Authorization"] = customToken + token;
47
51
  },
48
52
 
49
53
  clearLoginToken(token) { // 登陆前清空登录认证token
@@ -10,7 +10,7 @@ export default {
10
10
  OBJ_FLOW_NODES: {}, // 流程节点信息
11
11
 
12
12
  install(Vue,opts){
13
- axios = opts.axios;
13
+ axios = opts.saspFlowAxios;
14
14
  },
15
15
 
16
16
  /**
@@ -5,7 +5,7 @@ export default {
5
5
  name: "FLOW_USER_GLOBAL",
6
6
 
7
7
  install(Vue,opts){
8
- axios = opts.axios;
8
+ axios = opts.saspFlowAxios;
9
9
  },
10
10
  clearLoginToken(){
11
11
  setLocalJSON('USERTOKEN', "");
@@ -13,9 +13,13 @@ export default {
13
13
  axios.defaults.headers.common["Authorization"] = "";
14
14
  },
15
15
  setLoginToken(token){
16
- setLocalJSON('USERTOKEN', "pl_token_" + token);
17
- localStorage["Authorization" + (window.projectSuffix || "")] = "pl_token_" + token;
18
- axios.defaults.headers.common["Authorization"] = "pl_token_" + token;
16
+ let customToken = window.customToken;
17
+ if(!customToken) {
18
+ customToken = "pl_token_";
19
+ }
20
+ setLocalJSON('USERTOKEN', customToken + token);
21
+ localStorage["Authorization" + (window.projectSuffix || "")] = customToken + token;
22
+ axios.defaults.headers.common["Authorization"] = customToken + token;
19
23
  },
20
24
 
21
25
  getLoginUser() {
@@ -32,4 +36,4 @@ export default {
32
36
  localStorage["Authorization" + (window.projectSuffix || "")] = "";
33
37
  axios.defaults.headers.common["Authorization"] = "";
34
38
  },
35
- }
39
+ }
@@ -128,7 +128,7 @@
128
128
  this.setNodeColor();
129
129
  })
130
130
  };
131
- this.axios.post(this.api.plFlowDefine.getFlowDraw,{flowId: this.flowId,linkProcId:this.linkProcId,isRelease:this.isRelease}).then(res => {
131
+ this.saspFlowAxios.post(this.api.plFlowDefine.getFlowDraw,{flowId: this.flowId,linkProcId:this.linkProcId,isRelease:this.isRelease}).then(res => {
132
132
  if(res && res.data){
133
133
  if(res.data.operateObj){
134
134
  loadBpmn(res.data.operateObj || '');
@@ -153,16 +153,16 @@
153
153
  return;
154
154
  }
155
155
  if(this.nodeId){
156
- this.axios.post(this.api.plFlowNode.getById,{"id":this.nodeId}).then(resNode => {
156
+ this.saspFlowAxios.post(this.api.plFlowNode.getById,{"id":this.nodeId}).then(resNode => {
157
157
  let result = resNode.data.nodeLinkId;
158
158
  let canvas = this.viewer.get('canvas');
159
159
  canvas.addMarker(result,"current-node-class");
160
160
  this.setAnnotation(result);
161
161
  })
162
162
  }else{
163
- this.axios.post(this.api.plFlowInst.getById,{"id":this.instId}).then(res => {
163
+ this.saspFlowAxios.post(this.api.plFlowInst.getById,{"id":this.instId}).then(res => {
164
164
  let currentNode = res.data.currentNode;
165
- this.axios.post(this.api.plFlowNode.getById,{"id":currentNode}).then(resNode => {
165
+ this.saspFlowAxios.post(this.api.plFlowNode.getById,{"id":currentNode}).then(resNode => {
166
166
  let result = resNode.data.nodeLinkId;
167
167
  let canvas = this.viewer.get('canvas');
168
168
  canvas.addMarker(result,"current-node-class");
@@ -52,10 +52,32 @@
52
52
  <el-button type="primary" icon="el-icon-circle-plus-outline" size="small" round
53
53
  @click="openAddFlowForm()">新增
54
54
  </el-button>
55
- <el-button type="danger" icon="el-icon-circle-close" size="small" round @click="deleteFlow()">
56
- 删除
57
- </el-button>
58
- <!-- <el-button type="warning" icon="saspiconfont liuchengtu1" size="small" round>流程图</el-button>-->
55
+ <el-button type="danger" icon="el-icon-circle-close" size="small" round @click="deleteFlow()">删除</el-button>
56
+ <div style="display: inline-block" v-if='flowImpParamObj.downloadModel'>
57
+ <el-popover style="margin-left: 10px;margin-right: 10px;"
58
+ placement="bottom" width="200" trigger="click" >
59
+ <el-upload
60
+ class=""
61
+ ref="flowInstUploadFileRef"
62
+ :auto-upload="false"
63
+ :file-list="flowAboutFileList"
64
+ :action="flowImpParamObj.impUrl"
65
+ :limit="1"
66
+ accept=".xlsx,.xls"
67
+ :on-exceed="limitFile"
68
+ :on-change="onChangeFile"
69
+ :before-upload="beforeUploadFile"
70
+ :http-request="uploadFileMethod">
71
+ <el-button type="primary" size="small" slot="trigger">选取导入文件</el-button>
72
+ <el-button type="success" size="small" style="margin-left: 12px" @click="beginImp">导入</el-button>
73
+ </el-upload>
74
+ <el-button type="warning" size="small" round icon="el-icon-bottom-left" slot="reference">导入</el-button>
75
+ </el-popover>
76
+ <el-button round size="small" :type="flowImpParamObj.downloadModelObj.buttonColor" :icon="flowImpParamObj.downloadModelObj.icon"
77
+ :circle="flowImpParamObj.downloadModelObj.isCircle" :plain="flowImpParamObj.downloadModelObj.isPlain"
78
+ @click="downloadTemplate">{{flowImpParamObj.downloadModelObj.showName || '模版下载'}}
79
+ </el-button>
80
+ </div>
59
81
  </div>
60
82
  <el-button type="primary" icon="el-icon-document-copy" size="small" round v-if="isShow('pending')"
61
83
  @click="openFlowBatchPendingDialog">批量处理
@@ -363,8 +385,10 @@
363
385
  },
364
386
  userMap:{type: Object,default:()=>{return {};}},
365
387
 
366
- instQueryPower:{type:String,default:""}
367
-
388
+ instQueryPower:{type:String,default:""},
389
+ formImpMethod: {type: Function, default(){}},
390
+ flowImpParamObj: {type: Object, default: () => ({})},
391
+ downloadTemplate: {type: Function, default: null},
368
392
  },
369
393
  data() {
370
394
 
@@ -473,8 +497,9 @@
473
497
  flowFormId: "",
474
498
  formDefineKey: "",
475
499
  title: "",
476
- formSettingVisible:false,
477
- flowSortOrder:""
500
+ formSettingVisible: false,
501
+ flowSortOrder: "",
502
+ flowAboutFileList: [],
478
503
  }
479
504
  },
480
505
  created() {
@@ -502,7 +527,7 @@
502
527
  * 打开相关的智能建表
503
528
  */
504
529
  showFormSetting(){
505
- this.axios.post(this.api.plPageInfo.find,{ flowId: this.flowDefine.id }).then(res => {
530
+ this.saspFlowAxios.post(this.api.plPageInfo.find,{ flowId: this.flowDefine.id }).then(res => {
506
531
  let pageInfo = (res.data || [])[0] || {};
507
532
  this.pageName = pageInfo.pageName || "";
508
533
  this.flowFormId = pageInfo.formId;
@@ -533,7 +558,11 @@
533
558
 
534
559
  init() {
535
560
  this.crud.searchForm["flowId"] = this.flowDefine.id;
561
+ this.$set(this.crud.searchForm,"currentNode","");
536
562
  let flowStatus = this.flowStatusObj[this.tabType];
563
+ if(!flowStatus && flowStatus != 0){
564
+ flowStatus = "";
565
+ }
537
566
  this.crud.searchForm["nodeType"] = this.tabType;
538
567
  if (this.tabType == "draft") {
539
568
  this.crud.searchForm["created"] = this.loginUser.id;
@@ -782,7 +811,7 @@
782
811
  flowInstIds += "," + row.id;
783
812
  dataIds += "," + row.dataId;
784
813
  });
785
- this.axios.post(this.api.plFlowInst.deleteFlowInst, {
814
+ this.saspFlowAxios.post(this.api.plFlowInst.deleteFlowInst, {
786
815
  flowInstIds: flowInstIds.substring(1),
787
816
  flowId: this.flowDefine.id,
788
817
  dataIds: dataIds.substring(1)
@@ -882,7 +911,7 @@
882
911
  cancelButtonText: '取消',
883
912
  type: 'warning'
884
913
  }).then(() => {
885
- this.axios.post(this.api.plFlowInst.delete, {
914
+ this.saspFlowAxios.post(this.api.plFlowInst.delete, {
886
915
  ids: row.id
887
916
  }).then(res => {
888
917
  if (res && res.data && res.data.operateSuccess) {
@@ -894,7 +923,88 @@
894
923
  }
895
924
  })
896
925
  })
897
- }
926
+ },
927
+
928
+ // 导入bug单相关的流程数据
929
+ beginImp() {
930
+ if (this.flowAboutFileList.length === 0) {
931
+ this.$message.error("请选择需要导入的文件!");
932
+ return;
933
+ }
934
+ this.$confirm('是否确定导入模板数据?', '确认信息', {
935
+ distinguishCancelAndClose: true,
936
+ confirmButtonText: '确定',
937
+ cancelButtonText: '取消'
938
+ }).then(() => {
939
+ this.$refs.flowInstUploadFileRef.submit();
940
+ })
941
+ },
942
+
943
+ limitFile(files) {
944
+ let file = files[0];
945
+ let fileSuffix = file.name.substring(file.name.lastIndexOf("."), file.name.length);
946
+ if (fileSuffix !== '.xls' && fileSuffix !== '.xlsx') {
947
+ this.$message.error('不支持' + fileSuffix + '文件类型!');
948
+ this.$refs.flowInstUploadFileRef.clearFiles();
949
+ } else {
950
+ let fileData = {
951
+ name: file.name,
952
+ percentage: 0,
953
+ raw: file,
954
+ size: file.size,
955
+ status: 'ready',
956
+ uid: file.uid
957
+ };
958
+ this.flowAboutFileList = [fileData];
959
+ }
960
+ },
961
+
962
+ onChangeFile(file, fileList) {
963
+ let fileSuffix = file.name.substring(file.name.lastIndexOf("."), file.name.length);
964
+ if (fileSuffix !== '.xls' && fileSuffix !== '.xlsx') {
965
+ this.$message.error('不支持' + fileSuffix + '文件类型!');
966
+ this.$refs.flowInstUploadFileRef.clearFiles();
967
+ } else {
968
+ this.flowAboutFileList = fileList;
969
+ }
970
+ },
971
+
972
+ beforeUploadFile(file) {
973
+ let fileSuffix = file.name.substring(file.name.lastIndexOf("."), file.name.length);
974
+ if (fileSuffix !== '.xls' && fileSuffix !== '.xlsx') {
975
+ this.$message.error('不支持' + fileSuffix + '文件类型!');
976
+ return false;
977
+ }
978
+ return true;
979
+ },
980
+
981
+ uploadFileMethod(val) {
982
+ if (!this.loginUser.id) {
983
+ return this.$message({type: "warning", message: "缺失userId参数,请在地址栏用?拼接userId参数"});
984
+ }
985
+ this.formImpMethod(val).then(res => {
986
+ if (res && res.data && res.data.operateSuccess) {
987
+ let resData = res.data.operateObj;
988
+ // console.log('resData',resData);
989
+ this.saspFlowAxios.post(this.api.flowEngine.saveDataFlowDrafts, {
990
+ flowId: this.flowDefine.id,
991
+ userCode: this.loginUser.id || "",
992
+ dataIds: resData.join(",")
993
+ }).then(res => {
994
+ // console.log('流程草稿启用',res);
995
+ if (res && res.data && res.data.requestStatus === "1") {
996
+ this.$message({type: "success", message: "导入成功!"});
997
+ this.crud.search();
998
+ this.$emit("initTabNum");
999
+ }else {
1000
+ this.$message({type: "warning", message: res.data.errorInfo});
1001
+ }
1002
+ });
1003
+ } else {
1004
+ this.$message({type: "error", message: "导入失败!"});
1005
+ }
1006
+ });
1007
+ },
898
1008
  }
899
1009
  }
900
1010
  </script>