sasp-flow-render 1.0.1 → 1.0.2

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/README.md ADDED
@@ -0,0 +1,37 @@
1
+
2
+ ## 模块安装
3
+ ```shell
4
+ npm install sasp-flow-render -S // 这里版本号视具体情况定,一般情况都采用最高版本。
5
+ ```
6
+
7
+ ## 主项目main.js配置
8
+ ``` javascript
9
+ import SaspFlowRender from 'sasp-flow-render';
10
+
11
+ Vue.use(SaspFlowRender, {
12
+ SERVICE_URL: JAVA_URL || ""
13
+ });
14
+ JAVA_URL是指请求后端请求的地址,例如:http://localhost:10003,注意最后不要加/
15
+
16
+ 插件安装完成后,表单组件自动注册了全局组件flow-inst-view(流程实例页面)
17
+ 在智慧流程后台完成页面配置后,可以复制流程ID,使用该流程ID调用flow-inst-view组件即可渲染页面。
18
+ ```
19
+
20
+ ## flow-inst-view组件使用说明示例
21
+ ```
22
+ [comment]: <> (#### 组件入参数说明)
23
+
24
+ [comment]: <> (参数名称 | 参数说明 | 参数标准)
25
+
26
+ [comment]: <> (loginUser | 登录用户 | 用于鉴定数据归属,Object,示例:{id:"1",userName:"张三"},必须传入id:用户标识,userName:用户名称)
27
+
28
+ [comment]: <> (flowId | 流程ID(必须传入) | 流程后台配置的资源ID,String)
29
+
30
+ [comment]: <> (initFormInfo | 初始化表单的方法 | 可根据响应参数进行表单的渲染配置
31
+
32
+ [comment]: <> (saveFormInfo | 保存表单的方法 | 需要在保存完成后返回flowDataId(表单ID, 以便于进行表单于流程的数据绑定)
33
+
34
+ [comment]: <> (slot="formInfo" | 自定义插槽 | 将表单的渲染页面嵌入至流程中 | 例: 插入 table-form-render 组件, 渲染时需要传入以下参数:
35
+ tableviewId: 表单ID, dataId: 数据ID, formOperate: 当前状态, flowFieldStatus: 流程使用时表单各字段显示、隐藏、修改、查看状态
36
+
37
+ ```
package/index.js CHANGED
@@ -13,6 +13,7 @@ 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 flowInstView from './src/views/flowInstView';
16
17
  import {isAxiosFormData, SaspModuleUtil} from "sasp-base";
17
18
  /**
18
19
  * 注册复合视图组件
@@ -37,7 +38,8 @@ import flowResRouter from "./src/views/menuRouter/flowResRouter.vue";
37
38
  let components = [
38
39
  flowInstTab,
39
40
  flowMenuRouter,
40
- userSelect
41
+ userSelect,
42
+ flowInstView
41
43
  ];
42
44
 
43
45
  /**
@@ -77,7 +79,9 @@ let initAxios = (Vue, props) => {
77
79
  const install = function (Vue, opts = {}) {
78
80
  SaspModuleUtil.registerModuleName(Vue, "flow");
79
81
 
82
+ Vue.prototype.USE_SASP_FLOW = true; // 说明安装了流程插件,我们使用此参数作为表单对接的依据
80
83
  Vue.use(flowInstall, opts);
84
+ Vue.use(flowGlobal, opts);
81
85
 
82
86
  initAxios(Vue, opts);
83
87
  initViewData(Vue, opts);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sasp-flow-render",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "业务应用支撑平台-智慧流程渲染组件",
5
5
  "scripts": {
6
6
  "build": "vue-cli-service build"
@@ -1,6 +1,7 @@
1
- import axios from 'axios/index';
1
+ // import axios from 'axios/index';
2
2
  import flow from "../api/apiFlow";
3
3
  let apiFlow = flow.apis;
4
+ let axios = null;
4
5
 
5
6
  export default {
6
7
  name: "FLOW_GLOBAL",
@@ -8,6 +9,10 @@ export default {
8
9
  OBJ_FLOW_DEFINE: {}, // 流程定义信息
9
10
  OBJ_FLOW_NODES: {}, // 流程节点信息
10
11
 
12
+ install(Vue,opts){
13
+ axios = opts.axios;
14
+ },
15
+
11
16
  /**
12
17
  * 根据ID获取流程定义信息
13
18
  * @param id
@@ -38,7 +38,7 @@
38
38
  </el-form-item>
39
39
  <el-form-item label="启动时间" v-if="isShow('processed,finished,rescinded,discontinue,flowQuery')">
40
40
  <el-date-picker v-model="crud.searchForm.startTime" type="daterange" value-format="yyyy-MM-dd"
41
- style="width: 240px;"
41
+ style="width: 240px;" align="center"
42
42
  range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间">
43
43
  </el-date-picker>
44
44
  </el-form-item>
@@ -112,24 +112,28 @@
112
112
  </el-table-column>
113
113
  <el-table-column label="操作" align="center" :width="currentOptColumnWidth">
114
114
  <template slot-scope="scope">
115
- <el-button
116
- v-for="buttonObj in nodeListButtonObj[scope.row.currentNode || (flowVersionNodeObj[scope.row.version][startNodeKeyObj[scope.row.version]] || {}).id] || []"
117
- :key="buttonObj.type" size="small" type="primary"
118
- v-if="judgeListButton(tabType,buttonObj.type)"
119
- @click="listButtonOpt(buttonObj.type,scope.row)"
120
- :icon="buttonIcon[buttonObj.type]" :type="buttonType[buttonObj.type]">
121
- {{buttonObj.showName}}
122
- </el-button>
123
- <el-button v-if="scope.row.currentNode == 'end'" size="small"
124
- @click="listButtonOpt('view',scope.row)"
125
- icon="el-icon-view" type="primary">
126
- 查看
127
- </el-button>
128
- <el-button v-if="scope.row.currentNode == 'end'" size="small"
129
- @click="listButtonOpt('flowRecord',scope.row)"
130
- icon="saspiconfont pl-icon-liuchengtu" type="primary">
131
- 流转记录
132
- </el-button>
115
+ <template v-if="(nodeListButtonObj[scope.row.currentNode || (flowVersionNodeObj[scope.row.version][startNodeKeyObj[scope.row.version]] || {}).id] || []).length > 0">
116
+ <el-button
117
+ v-for="buttonObj in nodeListButtonObj[scope.row.currentNode || (flowVersionNodeObj[scope.row.version][startNodeKeyObj[scope.row.version]] || {}).id] || []"
118
+ :key="buttonObj.type" size="small" type="primary"
119
+ v-if="judgeListButton(tabType,buttonObj.type)"
120
+ @click="listButtonOpt(buttonObj.type,scope.row)"
121
+ :icon="buttonIcon[buttonObj.type]" :type="buttonType[buttonObj.type]">
122
+ {{buttonObj.showName}}
123
+ </el-button>
124
+ </template>
125
+ <template v-else>
126
+ <el-button size="small"
127
+ @click="listButtonOpt('view',scope.row)"
128
+ icon="el-icon-view" type="primary">
129
+ 查看
130
+ </el-button>
131
+ <el-button size="small"
132
+ @click="listButtonOpt('flowRecord',scope.row)"
133
+ icon="saspiconfont pl-icon-liuchengtu" type="primary">
134
+ 流转记录
135
+ </el-button>
136
+ </template>
133
137
  </template>
134
138
  </el-table-column>
135
139
  </el-table>
@@ -467,7 +467,7 @@
467
467
  },
468
468
  props: {
469
469
  flowId: {type: String, default: ''},
470
- operateRootArr: {type: Array},
470
+ operateRootArr: {type: Array,default:null},
471
471
  flowobj: {type: Object},
472
472
  defaultTab: {type: String},
473
473
  settingData:{type: Object,default:()=>{return {};}},
@@ -740,6 +740,7 @@
740
740
  showModel: "list",//默认风格 list:列表card:卡片
741
741
  showInfo: "",//展示信息 flow:流程信息 form:表单信息
742
742
  operateType: {},
743
+ resourceTabOpts: ['draft','pending','processed','rescinded','finished','discontinue','flowQuery'],
743
744
  tabTypeObj: {},//标签页对象
744
745
  numberObj: {draft: 0, pending: 0, processed: 0, rescinded: 0, finished: 0, discontinue: 0},//标签内容数量对象
745
746
  flowChartDialogVisible: false,
@@ -888,7 +889,7 @@
888
889
  this.isShowAgentSet = false;
889
890
  this.loginUser = this.CACHE_GLOBAL.getLoginUser();
890
891
  this.userDept = this.CACHE_GLOBAL.getLoginDept();
891
- // this.initResource();
892
+ this.initTabOpts(); // 初始化外部选项卡权限
892
893
 
893
894
  this.getFlowInfo().then(res => {
894
895
  this.initSuccess = true;
@@ -1185,7 +1186,7 @@
1185
1186
  // background: 'rgba(0, 0, 0, 0.7)'
1186
1187
  // })
1187
1188
 
1188
- this.saveDataFunc().then(resData => {
1189
+ this.saveDataFunc('draft').then(resData => {
1189
1190
  this.tabCrudSearch();
1190
1191
 
1191
1192
  this.flowInstDataDialog = false;
@@ -1207,6 +1208,7 @@
1207
1208
  if(result && result.then){
1208
1209
  result.then(res => {
1209
1210
  if(!res){
1211
+ this.isDisabled['nextStep'] = true;
1210
1212
  return;
1211
1213
  }
1212
1214
  if(typeof res !== 'object'){
@@ -1389,7 +1391,7 @@
1389
1391
 
1390
1392
  this.isDisabled['nextStep'] = false;
1391
1393
  this.flowParams = {};
1392
- this.saveDataFunc().then(flowParams => {
1394
+ this.saveDataFunc('nextStep').then(flowParams => {
1393
1395
  this.flowParams = JSON.parse(JSON.stringify(flowParams));
1394
1396
  let instId = flowParams.flowInstId;
1395
1397
  this.$set(this.formInfo,"opt","update");
@@ -1925,6 +1927,9 @@
1925
1927
  let fieldId = summaryNameId[fieldName];
1926
1928
  if (fieldName && dataObj.hasOwnProperty(fieldId)) {
1927
1929
  let replaceVal = dataObj[fieldId];
1930
+ if(dataObj[fieldId + "_SASP_SYS_DATA"]){
1931
+ replaceVal = dataObj[fieldId+ "_SASP_SYS_DATA"];
1932
+ }
1928
1933
  if(dataObj[fieldId + "_sequence"]){ // 自增序列
1929
1934
  replaceVal = dataObj[fieldId + "_sequence"];
1930
1935
  }
@@ -2187,6 +2192,15 @@
2187
2192
  this.operateType[item.type] = true;
2188
2193
  }
2189
2194
  })
2195
+ let activeArr = [];
2196
+ Object.keys(this.operateType).forEach(key => {
2197
+ if(this.operateType[key] && this.resourceTabOpts.indexOf(key) > -1){
2198
+ activeArr.push(key);
2199
+ }
2200
+ })
2201
+ if(activeArr.length > 0 && activeArr.indexOf("pending") == -1){
2202
+ this.tabActive = activeArr[0];
2203
+ }
2190
2204
  this.showModel = flowobj.showModel;
2191
2205
  this.showInfo = flowobj.showInfo;
2192
2206
  let formType = flowobj.formType;
@@ -2663,13 +2677,13 @@
2663
2677
  }
2664
2678
  },
2665
2679
  tabShow(val) {
2666
- return this.operateType[val];
2680
+ return (this.resourceTabOpts.indexOf(val) > -1) && (this.operateType[val]);
2681
+ },
2682
+ initTabOpts() {// 初始化外部选项卡的权限
2683
+ if(this.operateRootArr){
2684
+ this.resourceTabOpts = this.operateRootArr;
2685
+ }
2667
2686
  },
2668
- // async initResource() {//处理资源池信息
2669
- // (this.flowData.operateRootArr || []).forEach(item => {
2670
- // this.$set(this.operateType, item.powerCode, true)
2671
- // });
2672
- // },
2673
2687
 
2674
2688
  initflowObj() {//处理流程定义对象
2675
2689
  let tabSetting = JSON.parse(this.flowDefine.tabSetting);
@@ -360,9 +360,10 @@
360
360
  assignee = assignee.substring(0,assignee.lastIndexOf("stop"));
361
361
  item.taskStatus = "stop";
362
362
  }
363
- let signDataArr = assignee.split("_");
364
- if(signDataArr.length == 3 && assignee.indexOf("_") == 0){ // 加签数据
365
- let mainTaskId = signDataArr[2];
363
+ let taskId = item.taskId;
364
+ if(variables[taskId + '_PassignTask']){ // 加签数据
365
+ let mainTaskId = variables[taskId + '_PassignTask'];
366
+ let signDataArr = assignee.split("_");
366
367
  assignee = signDataArr[1];
367
368
  if(!addSignObj[mainTaskId]){
368
369
  addSignObj[mainTaskId] = [item];
@@ -1,5 +1,6 @@
1
1
  <template>
2
2
  <flow-inst-tab :flow-id="useFlowId" :userArr="userArr" :userMap="userMap"
3
+ :operateRootArr="operateArr" :dataPermis="dataPermis"
3
4
  :initFormInfo="initFormInfo" :saveFormInfo="saveFormInfo" :class='flowViewMainClass'>
4
5
  <template slot="formInfo">
5
6
  <slot name="formInfo"></slot>
@@ -15,6 +16,8 @@
15
16
  props:{
16
17
  loginUser:{type:Object,default:null}, // 登录用户
17
18
  flowId:{type:String},
19
+ dataPermis:{type:String,default:''},
20
+ operateArr:{type:Array,default:null},
18
21
  initFormInfo:{type: Function,default:null}, // 添加修改打开表单时执行的事件
19
22
  saveFormInfo:{type: Function,default:null}, // 保存表单时执行的事件
20
23
  },
@@ -0,0 +1 @@
1
+ 系统组件