88
88
<el-tab-pane label =" 流转评论" name =" comment" > 流转评论 </el-tab-pane >
89
89
</el-tabs >
90
90
91
- <div class =" b-t-solid border-t-1px border-[var(--el-border-color)]" v-if =" activeTab === 'form'" >
91
+ <div
92
+ class =" b-t-solid border-t-1px border-[var(--el-border-color)]"
93
+ v-if =" activeTab === 'form'"
94
+ >
92
95
<!-- 操作栏按钮 -->
93
96
<ProcessInstanceOperationButton
94
97
ref =" operationButtonRef"
@@ -115,15 +118,18 @@ import ProcessInstanceOperationButton from './ProcessInstanceOperationButton.vue
115
118
import ProcessInstanceTimeline from ' ./ProcessInstanceTimeline.vue'
116
119
import { registerComponent } from ' @/utils/routerHelper'
117
120
import * as UserApi from ' @/api/system/user'
121
+ import { FieldPermissionType } from ' @/components/SimpleProcessDesignerV2/src/consts'
118
122
import audit1 from ' @/assets/svgs/bpm/audit1.svg'
119
123
import audit2 from ' @/assets/svgs/bpm/audit2.svg'
120
124
import audit3 from ' @/assets/svgs/bpm/audit3.svg'
121
125
122
126
defineOptions ({ name: ' BpmProcessInstanceDetail' })
123
-
124
- const { query } = useRoute () // 查询参数
127
+ const props = defineProps <{
128
+ id: string // 流程实例的编号
129
+ taskId? : string // 任务编号
130
+ activityId? : string // 流程活动编号,用于抄送查看
131
+ }>()
125
132
const message = useMessage () // 消息弹窗
126
- const id = query .id as unknown as string // 流程实例的编号
127
133
const processInstanceLoading = ref (false ) // 流程实例的加载中
128
134
const processInstance = ref <any >({}) // 流程实例
129
135
const operationButtonRef = ref ()
@@ -157,7 +163,7 @@ const BusinessFormComponent = ref<any>(null) // 异步组件
157
163
const getProcessInstance = async () => {
158
164
try {
159
165
processInstanceLoading .value = true
160
- const data = await ProcessInstanceApi .getProcessInstance (id )
166
+ const data = await ProcessInstanceApi .getProcessInstance (props . id )
161
167
if (! data ) {
162
168
message .error (' 查询不到流程信息!' )
163
169
return
@@ -167,6 +173,15 @@ const getProcessInstance = async () => {
167
173
// 设置表单信息
168
174
const processDefinition = data .processDefinition
169
175
if (processDefinition .formType === 10 ) {
176
+ // 获取表单字段权限
177
+ let fieldsPermission = undefined
178
+ if (props .taskId || props .activityId ) {
179
+ fieldsPermission = await ProcessInstanceApi .getFormFieldsPermission ({
180
+ processInstanceId: props .id ,
181
+ taskId: props .taskId ,
182
+ activityId: props .activityId
183
+ })
184
+ }
170
185
setConfAndFields2 (
171
186
detailForm ,
172
187
processDefinition .formConf ,
@@ -177,6 +192,11 @@ const getProcessInstance = async () => {
177
192
fApi .value ?.btn .show (false )
178
193
fApi .value ?.resetBtn .show (false )
179
194
fApi .value ?.disabled (true )
195
+ if (fieldsPermission ) {
196
+ Object .keys (fieldsPermission ).forEach ((item ) => {
197
+ setFieldPermission (item , fieldsPermission [item ])
198
+ })
199
+ }
180
200
})
181
201
} else {
182
202
// 注意:data.processDefinition.formCustomViewPath 是组件的全路径,例如说:/crm/contract/detail/index.vue
@@ -190,12 +210,27 @@ const getProcessInstance = async () => {
190
210
}
191
211
}
192
212
213
+ /**
214
+ * 设置表单权限
215
+ */
216
+ const setFieldPermission = (field : string , permission : string ) => {
217
+ if (permission === FieldPermissionType .READ ) {
218
+ fApi .value ?.disabled (true , field )
219
+ }
220
+ if (permission === FieldPermissionType .WRITE ) {
221
+ fApi .value ?.disabled (false , field )
222
+ }
223
+ if (permission === FieldPermissionType .NONE ) {
224
+ fApi .value ?.hidden (true , field )
225
+ }
226
+ }
227
+
193
228
/** 加载任务列表 */
194
229
const getTaskList = async () => {
195
230
try {
196
231
// 获得未取消的任务
197
232
tasksLoad .value = true
198
- const data = await TaskApi .getTaskListByProcessInstanceId (id )
233
+ const data = await TaskApi .getTaskListByProcessInstanceId (props . id )
199
234
tasks .value = []
200
235
// 1.1 移除已取消的审批
201
236
data .forEach ((task ) => {
@@ -238,19 +273,29 @@ onMounted(async () => {
238
273
</script >
239
274
240
275
<style lang="scss" scoped>
241
- $wrap-padding-height : 30px ;
276
+ $wrap-padding-height : 30px ;
242
277
$wrap-margin-height : 15px ;
243
278
$button-height : 51px ;
244
279
$process-header-height : 194px ;
245
280
246
281
.processInstance-wrap-main {
247
- height : calc (100vh - var (--top-tool-height ) - var (--tags-view-height ) - var (--app-footer-height ) - 45px );
248
- max-height : calc (100vh - var (--top-tool-height ) - var (--tags-view-height ) - var (--app-footer-height ) - 45px );
282
+ height : calc (
283
+ 100vh - var (--top-tool-height ) - var (--tags-view-height ) - var (--app-footer-height ) - 45px
284
+ );
285
+ max-height : calc (
286
+ 100vh - var (--top-tool-height ) - var (--tags-view-height ) - var (--app-footer-height ) - 45px
287
+ );
249
288
overflow : auto ;
250
289
251
290
.form-scoll-area {
252
- height : calc (100vh - var (--top-tool-height ) - var (--tags-view-height ) - var (--app-footer-height ) - 45px - $process-header-height - 40px );
253
- max-height : calc (100vh - var (--top-tool-height ) - var (--tags-view-height ) - var (--app-footer-height ) - 45px - $process-header-height - 40px );
291
+ height : calc (
292
+ 100vh - var (--top-tool-height ) - var (--tags-view-height ) - var (--app-footer-height ) - 45px -
293
+ $process-header-height - 40px
294
+ );
295
+ max-height : calc (
296
+ 100vh - var (--top-tool-height ) - var (--tags-view-height ) - var (--app-footer-height ) - 45px -
297
+ $process-header-height - 40px
298
+ );
254
299
overflow : auto ;
255
300
}
256
301
}
@@ -260,7 +305,4 @@ $process-header-height: 194px;
260
305
border : none ;
261
306
}
262
307
}
263
-
264
-
265
-
266
308
</style >
0 commit comments