adtec-core-package 2.6.8 → 2.7.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adtec-core-package",
3
- "version": "2.6.8",
3
+ "version": "2.7.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -18,7 +18,12 @@
18
18
  import { AiEditor } from 'aieditor'
19
19
  import 'aieditor/dist/style.css'
20
20
  import { onMounted, onUnmounted, ref, watch, nextTick } from 'vue'
21
+ import type { WatchStopHandle } from 'vue'
21
22
  import { ElMessage } from 'element-plus'
23
+ enum WatchType {
24
+ initWatch = 'initWatch',
25
+ }
26
+ const watchHandlers = ref<Partial<Record<WatchType, WatchStopHandle>>>({});
22
27
 
23
28
  const divRef = ref()
24
29
  let aiEditor: AiEditor | null
@@ -322,29 +327,18 @@ function customStringReplacement(
322
327
  return result
323
328
  }
324
329
 
325
- watch(
326
- () => props.isEdit,
327
- (val) => {
328
- if (aiEditor) {
329
- aiEditor.setEditable(val)
330
- //头尾显隐
331
- const footer = divRef.value?.querySelector('aie-footer') as HTMLElement
332
- if (footer) {
333
- footer.style.display = val ? '' : 'none'
334
- }
335
- const header = divRef.value?.querySelector('aie-header') as HTMLElement
336
- if (header) {
337
- header.style.display = val ? '' : 'none'
338
- }
339
- }
340
- },
341
- { immediate: true },
342
- )
330
+
343
331
  function initHtml(html: string) {
344
332
  html = customStringReplacement(html, '<img', '>', 'height="[0-9]+"', 'height="auto"')
345
333
  return convertPtToPx(html)
346
334
  }
347
-
335
+ const stopWatchByType = (type: WatchType) => {
336
+ const stopHandle = watchHandlers.value[type]
337
+ if (stopHandle) {
338
+ stopHandle()
339
+ delete watchHandlers.value[type]
340
+ }
341
+ }
348
342
  onMounted(() => {
349
343
  const config = {
350
344
  element: divRef.value as Element,
@@ -363,7 +357,27 @@ onMounted(() => {
363
357
  { name: 'Times New Roman', value: 'Times New Roman' },
364
358
  ],
365
359
  },
366
- onCreated: (editor: AiEditor) => {},
360
+ onCreated: (editor: AiEditor) => {
361
+ stopWatchByType(WatchType.initWatch)
362
+ watchHandlers.value[WatchType.initWatch] =watch(
363
+ () => props.isEdit,
364
+ (val) => {
365
+ if (aiEditor) {
366
+ aiEditor.setEditable(val)
367
+ //头尾显隐
368
+ const footer = divRef.value?.querySelector('aie-footer') as HTMLElement
369
+ if (footer) {
370
+ footer.style.display = val ? '' : 'none'
371
+ }
372
+ const header = divRef.value?.querySelector('aie-header') as HTMLElement
373
+ if (header) {
374
+ header.style.display = val ? '' : 'none'
375
+ }
376
+ }
377
+ },
378
+ { immediate: true },
379
+ )
380
+ },
367
381
  }
368
382
  // 隐藏工具栏
369
383
  if (!props.showToolbar) {
@@ -10,8 +10,21 @@
10
10
  :loading="butLoading || taskLoading"
11
11
  v-if="params?.cancelBtnText !== ''"
12
12
  @click="params?.cancelFunction"
13
- >{{ params?.cancelBtnText ?? '取消' }}
13
+ >{{ params?.cancelBtnText ?? '取消' }}
14
14
  </el-button>
15
+ <template v-if="!isAssignee && task?.taskId && showCurWorkBth && !showOperationsBtn">
16
+ <el-button
17
+ :loading="butLoading || taskLoading"
18
+ type="warning"
19
+ :disabled="
20
+ task?.taskId &&
21
+ (!task?.operations ||
22
+ userInfo.getUserInfo.id !== task?.assigneeId)
23
+ "
24
+ @click="handle"
25
+ >{{ task.taskName }}
26
+ </el-button>
27
+ </template>
15
28
  <el-button
16
29
  v-if="showProcessBtn && task?.procInsId"
17
30
  type="info"
@@ -25,7 +38,7 @@
25
38
  type="primary"
26
39
  :loading="butLoading || taskLoading"
27
40
  @click="openDialog('assignee')"
28
- >指定执行人
41
+ >指定执行人
29
42
  </el-button>
30
43
  </template>
31
44
  <template v-if="!isAssignee && task?.taskId && task?.operations && showOperationsBtn">
@@ -34,49 +47,49 @@
34
47
  v-if="params?.saveBtnText"
35
48
  type="primary"
36
49
  @click="params?.saveFunction"
37
- >{{ params?.saveBtnText }}
50
+ >{{ params?.saveBtnText }}
38
51
  </el-button>
39
52
  <el-button
40
53
  v-if="task?.operations.indexOf('addMulti') > -1"
41
54
  type="warning"
42
55
  :loading="butLoading || taskLoading"
43
56
  @click="openDialog('addMulti')"
44
- >加签
57
+ >加签
45
58
  </el-button>
46
59
  <el-button
47
60
  v-if="task?.operations.indexOf('minusMulti') > -1"
48
61
  type="danger"
49
62
  :loading="butLoading || taskLoading"
50
63
  @click="openDialog('minusMulti')"
51
- >减签
64
+ >减签
52
65
  </el-button>
53
66
  <el-button
54
67
  :loading="butLoading || taskLoading"
55
68
  v-if="task?.operations.indexOf('refuse') > -1 && params?.refuseBtnText !== ''"
56
69
  type="danger"
57
70
  @click="openDialog('refuse')"
58
- >{{ params?.refuseBtnText ?? '终止' }}
71
+ >{{ params?.refuseBtnText ?? '终止' }}
59
72
  </el-button>
60
73
  <el-button
61
74
  :loading="butLoading || taskLoading"
62
75
  v-if="task?.operations.indexOf('transfer') > -1 && params?.transferBtnText !== ''"
63
76
  type="warning"
64
77
  @click="openDialog('transfer')"
65
- >{{ params?.transferBtnText ?? '转办' }}
78
+ >{{ params?.transferBtnText ?? '转办' }}
66
79
  </el-button>
67
80
  <el-button
68
81
  :loading="butLoading || taskLoading"
69
82
  v-if="task?.operations.indexOf('back') > -1 && params?.backBtnText !== ''"
70
83
  type="danger"
71
84
  @click="openDialog('back')"
72
- >{{ params?.backBtnText ?? '退回' }}
85
+ >{{ params?.backBtnText ?? '退回' }}
73
86
  </el-button>
74
87
  <el-button
75
88
  :loading="butLoading || taskLoading"
76
89
  v-if="task?.operations.indexOf('complete') > -1 && params?.completeBtnText !== ''"
77
90
  type="primary"
78
91
  @click="openDialog('complete')"
79
- >{{ params?.completeBtnText ?? '同意' }}
92
+ >{{ params?.completeBtnText ?? '同意' }}
80
93
  </el-button>
81
94
  </template>
82
95
  <slot name="right"></slot>
@@ -111,7 +124,8 @@ import type { ITaskOperate } from '../../hooks/userWorkflowHooks'
111
124
  import frameworkUtils from '../../utils/FrameworkUtils.ts'
112
125
  import { userInfoStore } from '../../stores/userInfoStore.ts'
113
126
  import WujieVue from 'wujie-vue3'
114
-
127
+ import { showTodoDialog } from '../../hooks/workflowTodo2'
128
+ const userInfo = userInfoStore()
115
129
  const processShow = ref(false)
116
130
  const taskFlexRef = ref<HTMLElement | null>(null)
117
131
  const $props = defineProps({
@@ -122,6 +136,7 @@ const $props = defineProps({
122
136
  params: { type: Object as PropType<ITaskOperate>, required: false },
123
137
  taskInfo: { type: Object as PropType<IWfTaskVo>, required: false },
124
138
  showOperationsBtn: { type: Boolean, required: false, default: true },
139
+ showCurWorkBth: { type: Boolean, required: false, default: true },
125
140
  })
126
141
 
127
142
  const emit = defineEmits(['success'])
@@ -135,6 +150,11 @@ const isAssignee = computed(() => {
135
150
  return task.value?.operations === 'assignee' ? true : false
136
151
  })
137
152
  const dialogType = ref('')
153
+ const compParam = ref([{ source: 'edit' }])
154
+ const handle = async () => {
155
+ debugger
156
+ await showTodoDialog(ref(task.value as IWfTaskVo), compParam)
157
+ }
138
158
  const openDialog = async (type: string) => {
139
159
  if (type) dialogType.value = type
140
160
  if (!task.value) return
@@ -86,6 +86,8 @@ export interface ITaskOperate {
86
86
  * @param args
87
87
  */
88
88
  backFunction?: (vo: IWfTaskAskVo) => Promise<any>
89
+
90
+ handleCurWorkFunction?: (vo: IWfTaskAskVo) => Promise<any>
89
91
  /**
90
92
  * 流程“转办”按钮文本
91
93
  */