nbb-component-ui 1.2.1 → 1.2.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/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Plugin } from 'vue';
2
- import { ProcessFlow } from './src/ProcessFlow';
2
+ import { CmcProcessFlow } from './src/ProcessFlow';
3
3
  declare const plugin: Plugin<[]>;
4
- export { ProcessFlow };
4
+ export { CmcProcessFlow };
5
5
  export default plugin;
package/dist/index.es.js CHANGED
@@ -1,29 +1,29 @@
1
1
  import { defineComponent as l, ref as i, watch as u, resolveComponent as m, openBlock as g, createBlock as d, withCtx as f, createTextVNode as v } from "vue";
2
2
  import { ElMessage as _ } from "element-plus";
3
- const I = (t) => ({
3
+ const C = (t) => ({
4
4
  getApprovalDetail: async (e) => await t.get({
5
5
  url: "/system/bpm/process-instance/get-approval-detail",
6
6
  params: {
7
7
  processInstanceId: e
8
8
  }
9
9
  })
10
- }), q = /* @__PURE__ */ l({
11
- __name: "ProcessFlow",
10
+ }), I = /* @__PURE__ */ l({
11
+ __name: "CmcProcessFlow",
12
12
  props: {
13
13
  processInstanceId: {},
14
14
  request: {}
15
15
  },
16
16
  setup(t) {
17
- const e = t, n = i(""), r = I(e.request);
17
+ const e = t, n = i(""), r = C(e.request);
18
18
  console.log("props.request", e.request), console.log("processInstanceApi", r);
19
- const a = () => {
19
+ const c = () => {
20
20
  _.success("aaa!"), console.log(e.request), e.request.get({
21
21
  url: "/system/bpm/process-instance/get-approval-detail",
22
22
  params: {
23
23
  processInstanceId: n.value
24
24
  }
25
25
  });
26
- }, c = (s) => {
26
+ }, a = (s) => {
27
27
  n.value = s, r.getApprovalDetail(s).then((o) => {
28
28
  console.log(o);
29
29
  });
@@ -32,12 +32,12 @@ const I = (t) => ({
32
32
  () => e.processInstanceId,
33
33
  (s) => {
34
34
  debugger;
35
- s && s !== n.value && c(s);
35
+ s && s !== n.value && a(s);
36
36
  },
37
37
  { immediate: !0, deep: !0 }
38
38
  ), (s, o) => {
39
39
  const p = m("el-button");
40
- return g(), d(p, { onClick: a }, {
40
+ return g(), d(p, { onClick: c }, {
41
41
  default: f(() => [...o[0] || (o[0] = [
42
42
  v("aaaa", -1)
43
43
  ])]),
@@ -45,12 +45,12 @@ const I = (t) => ({
45
45
  });
46
46
  };
47
47
  }
48
- }), C = {
48
+ }), A = {
49
49
  install(t) {
50
- t.component("CmcLinkProcessFlow", q);
50
+ t.component("CmcProcessFlow", I);
51
51
  }
52
52
  };
53
53
  export {
54
- q as ProcessFlow,
55
- C as default
54
+ I as CmcProcessFlow,
55
+ A as default
56
56
  };
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(t,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.NbbComponentUi={},t.Vue,t.ElementPlus))})(this,function(t,e,a){"use strict";const i=n=>({getApprovalDetail:async s=>await n.get({url:"/system/bpm/process-instance/get-approval-detail",params:{processInstanceId:s}})}),p=e.defineComponent({__name:"ProcessFlow",props:{processInstanceId:{},request:{}},setup(n){const s=n,c=e.ref(""),l=i(s.request);console.log("props.request",s.request),console.log("processInstanceApi",l);const d=()=>{a.ElMessage.success("aaa!"),console.log(s.request),s.request.get({url:"/system/bpm/process-instance/get-approval-detail",params:{processInstanceId:c.value}})},m=o=>{c.value=o,l.getApprovalDetail(o).then(r=>{console.log(r)})};return e.watch(()=>s.processInstanceId,o=>{debugger;o&&o!==c.value&&m(o)},{immediate:!0,deep:!0}),(o,r)=>{const f=e.resolveComponent("el-button");return e.openBlock(),e.createBlock(f,{onClick:d},{default:e.withCtx(()=>[...r[0]||(r[0]=[e.createTextVNode("aaaa",-1)])]),_:1})}}}),u={install(n){n.component("CmcLinkProcessFlow",p)}};t.ProcessFlow=p,t.default=u,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(t,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.NbbComponentUi={},t.Vue,t.ElementPlus))})(this,function(t,e,a){"use strict";const i=n=>({getApprovalDetail:async s=>await n.get({url:"/system/bpm/process-instance/get-approval-detail",params:{processInstanceId:s}})}),p=e.defineComponent({__name:"CmcProcessFlow",props:{processInstanceId:{},request:{}},setup(n){const s=n,r=e.ref(""),l=i(s.request);console.log("props.request",s.request),console.log("processInstanceApi",l);const d=()=>{a.ElMessage.success("aaa!"),console.log(s.request),s.request.get({url:"/system/bpm/process-instance/get-approval-detail",params:{processInstanceId:r.value}})},m=o=>{r.value=o,l.getApprovalDetail(o).then(c=>{console.log(c)})};return e.watch(()=>s.processInstanceId,o=>{debugger;o&&o!==r.value&&m(o)},{immediate:!0,deep:!0}),(o,c)=>{const f=e.resolveComponent("el-button");return e.openBlock(),e.createBlock(f,{onClick:d},{default:e.withCtx(()=>[...c[0]||(c[0]=[e.createTextVNode("aaaa",-1)])]),_:1})}}}),u={install(n){n.component("CmcProcessFlow",p)}};t.CmcProcessFlow=p,t.default=u,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -1,2 +1,2 @@
1
- import { default as ProcessFlow } from './src/ProcessFlow.vue';
2
- export { ProcessFlow };
1
+ import { default as CmcProcessFlow } from './src/CmcProcessFlow.vue';
2
+ export { CmcProcessFlow };
package/index.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  import type { App, Plugin } from 'vue'
2
- import {ProcessFlow} from "./src/ProcessFlow";
2
+ import {CmcProcessFlow} from "./src/ProcessFlow";
3
3
 
4
4
  // 定义插件对象,严格标注类型
5
5
  const plugin: Plugin<[]> = {
6
6
  install(app: App) {
7
- app.component('CmcLinkProcessFlow', ProcessFlow)
7
+ app.component('CmcProcessFlow', CmcProcessFlow)
8
8
  }
9
9
  }
10
10
  // 支持按需引入
11
- export {ProcessFlow }
11
+ export {CmcProcessFlow }
12
12
 
13
13
  // 默认导出插件(必须是Plugin类型)
14
14
  export default plugin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nbb-component-ui",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "main": "./dist/index.umd.js",
5
5
  "module": "./dist/index.es.js",
6
6
  "types": "./dist/index.d.ts",
@@ -1,3 +1,3 @@
1
- import ProcessFlow from './src/ProcessFlow.vue'
1
+ import CmcProcessFlow from './src/CmcProcessFlow.vue'
2
2
 
3
- export { ProcessFlow }
3
+ export { CmcProcessFlow }
@@ -0,0 +1,187 @@
1
+ <template>
2
+ <div class="scroll-area">
3
+ <div class="flow-header flex justify-between">
4
+ <div class="text-18px font-bold">
5
+ <span>{{ t('processFlow.flow') }}</span>
6
+ <span>{{ processInstance.id }}</span>
7
+ </div>
8
+ <div class="text-14px font-bold" style="color: #005aae">
9
+ <span>{{ processInstance.name }}</span>
10
+ </div>
11
+ </div>
12
+ <div class="flex items-center">
13
+ <div class="flow-start">
14
+ <p>{{ t('processFlow.startTime') }}{{ formatDate(processInstance.startTime) }}</p>
15
+ <p>{{ t('processFlow.endTime') }}{{ formatDate(processInstance.endTime) }}</p>
16
+ <p v-if="processInstance.durationInMillis">
17
+ {{ t('processFlow.duration') }}{{ formatPast2(processInstance?.durationInMillis) }}
18
+ </p>
19
+ </div>
20
+ <Icon
21
+ :size="100"
22
+ :icon="statusIconMapping[processInstance.status] || 'svg-icon:approvalPending'"
23
+ />
24
+ </div>
25
+
26
+ <div class="mt-30px block">
27
+ <el-timeline>
28
+ <el-timeline-item
29
+ v-for="(item, index) in tasks"
30
+ :key="index"
31
+ :type="getTaskTimelineItemType(item) || 'info'"
32
+ >
33
+ <template #dot>
34
+ <img
35
+ :src="
36
+ item?.assigneeUser?.avatar ||
37
+ 'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png'
38
+ "
39
+ class="avatar-wrap"
40
+ />
41
+ </template>
42
+ <p style="font-weight: 700">
43
+ {{ item.name }}
44
+ <dict-tag
45
+ v-if="item.status"
46
+ :type="DICT_TYPE.BPM_TASK_STATUS"
47
+ :value="item.status || ''"
48
+ />
49
+ </p>
50
+
51
+ <el-card :body-style="{ padding: '10px' }">
52
+ <label v-if="index === 0" style="margin-right: 30px; font-weight: normal">
53
+ {{ item.assigneeUser?.nickname || item.ownerUser?.nickname }}
54
+ <el-tag size="small" type="info" style="vertical-align: 1px">{{
55
+ processInstance?.startUser?.deptName
56
+ }}</el-tag>
57
+ </label>
58
+ <label v-if="item.assigneeUser" style="margin-right: 30px; font-weight: normal">
59
+ {{ t('processFlow.approver') }}{{ item.assigneeUser?.nickname || item.ownerUser?.nickname }}
60
+ <el-tag size="small" type="info" style="vertical-align: 1px">{{
61
+ item.assigneeUser.deptName
62
+ }}</el-tag>
63
+ </label>
64
+ <div>
65
+ <label v-if="item.createTime && !item.endTime" style="font-weight: normal"
66
+ >{{ t('processFlow.createTime') }}</label
67
+ >
68
+ <label
69
+ v-if="item.createTime && !item.endTime"
70
+ style="font-weight: normal; color: #8a909c"
71
+ >
72
+ {{ formatDate(item?.createTime, 'MM-DD HH:mm') }}
73
+ </label>
74
+ <label v-if="item.endTime" style="font-weight: normal"> {{ t('processFlow.approvalTime') }} </label>
75
+ <label v-if="item.endTime" style="font-weight: normal; color: #8a909c">
76
+ {{ formatDate(item?.endTime, 'MM-DD HH:mm') }}
77
+ </label>
78
+ <label v-if="item.durationInMillis" style="margin-left: 30px; font-weight: normal">
79
+ {{ t('processFlow.duration') }}
80
+ </label>
81
+ <label v-if="item.durationInMillis" style="font-weight: normal; color: #8a909c">
82
+ {{ formatPast2(item?.durationInMillis) }}
83
+ </label>
84
+ </div>
85
+ <div v-if="item.reason"> {{ t('processFlow.approvalSuggestion') }}{{ item.reason }} </div>
86
+ </el-card>
87
+ </el-timeline-item>
88
+ </el-timeline>
89
+ </div>
90
+ </div>
91
+ </template>
92
+
93
+
94
+ <script lang="ts" setup>
95
+ import { formatDate, formatPast2 } from '@/utils/formatTime'
96
+ import { propTypes } from '@/utils/propTypes'
97
+ import { DICT_TYPE } from '@/utils/dict'
98
+ import { isEmpty } from '@/utils/is'
99
+ import TaskSignList from './dialog/TaskSignList.vue'
100
+ import type { ApiAttrs } from '@form-create/element-ui/types/config'
101
+ import { setConfAndFields2 } from '@/utils/formCreate'
102
+ import * as TaskApi from '@/api/bpm/task'
103
+ import download from '@/utils/download'
104
+ import {ref} from "vue";
105
+
106
+ defineOptions({ name: 'BpmProcessInstanceTaskList' })
107
+
108
+ const { t } = useI18n()
109
+ const statusIconMapping = {
110
+ 1: 'svg-icon:approvalPending', // 审批中
111
+ 2: 'svg-icon:approvalPass', // 通过
112
+ 3: 'svg-icon:approvalRejected', // 拒绝
113
+ 4: 'svg-icon:approvalCanceled' // 取消
114
+ }
115
+ const props = defineProps({
116
+ loading: propTypes.bool, // 是否加载中
117
+ processInstance: propTypes.object, // 流程实例
118
+ tasks: propTypes.arrayOf(propTypes.object) // 流程任务的数组
119
+ })
120
+
121
+ /** 获得任务对应的颜色 */
122
+ const getTaskTimelineItemType = (item: any) => {
123
+ if ([0, 1, 6, 7].includes(item.status)) {
124
+ return 'primary'
125
+ }
126
+ if (item.status === 2) {
127
+ return 'success'
128
+ }
129
+ if (item.status === 3) {
130
+ return 'danger'
131
+ }
132
+ if (item.status === 4) {
133
+ return 'info'
134
+ }
135
+ if (item.status === 5) {
136
+ return 'warning'
137
+ }
138
+ return ''
139
+ }
140
+
141
+ /** 查看表单 */
142
+ const fApi = ref<ApiAttrs>() // form-create 的 API 操作类
143
+ const taskForm = ref({
144
+ rule: [],
145
+ option: {},
146
+ value: {}
147
+ }) // 流程任务的表单详情
148
+ const taskFormVisible = ref(false)
149
+
150
+
151
+ /** 刷新数据 */
152
+ const emit = defineEmits(['refresh']) // 定义 success 事件,用于操作成功后的回调
153
+ const refresh = () => {
154
+ emit('refresh')
155
+ }
156
+ </script>
157
+
158
+
159
+
160
+ <style scoped lang="scss">
161
+ .avatar-wrap {
162
+ width: 40px;
163
+ height: 40px;
164
+ }
165
+ .flow-start {
166
+ width: 70%;
167
+ margin: 10px auto;
168
+ padding: 10px;
169
+ padding-top: 0;
170
+ background: rgba(245, 247, 253, 1);
171
+
172
+ p {
173
+ margin: 0px;
174
+ padding-top: 10px;
175
+ font-size: 14px;
176
+ }
177
+ }
178
+ :deep(.el-timeline-item__dot) {
179
+ left: -15px;
180
+ top: -15px;
181
+ }
182
+ .scroll-area {
183
+ flex: 1;
184
+ min-height: 0;
185
+ overflow-y: auto;
186
+ }
187
+ </style>
@@ -0,0 +1,89 @@
1
+ <template>
2
+ <el-button @click="open">测试按钮</el-button>
3
+ <!-- 审批记录列表 -->
4
+ <ProcessInstanceTaskList
5
+ :process-instance="processInstance"
6
+ :tasks="tasks"
7
+ @refresh="getTaskList"
8
+ />
9
+ </template>
10
+
11
+ <script setup lang="ts">
12
+ import { ElMessage } from 'element-plus'
13
+ import {ref, watch} from "vue";
14
+ import {createProcessInstanceApi} from "@/api/processInstance";
15
+ import {createTaskApi} from "@/api/task";
16
+
17
+ import ProcessInstanceTaskList from './CmcFlowList.vue'
18
+
19
+
20
+ const message = useMessage() // 消息弹窗
21
+
22
+ const props = defineProps<{
23
+ processInstanceId: string
24
+ request: any
25
+ }>()
26
+
27
+
28
+ const processInstanceLoading = ref(false)
29
+ const processInstance = ref<any>({})
30
+ const todoTask = ref<any>({})
31
+ const applicationPrefix = ref('')
32
+ const tasks = ref<any[]>([])
33
+
34
+ const id = ref<string>('')
35
+ const processInstanceApi = createProcessInstanceApi(props.request)
36
+ const taskApi = createTaskApi(props.request)
37
+
38
+
39
+ const open = () => {
40
+ ElMessage.success('aaa!')
41
+ }
42
+
43
+ const init = (processInstanceId: string) => {
44
+ id.value = processInstanceId
45
+ getApprovalDetail()
46
+ getTaskList()
47
+ }
48
+
49
+ // 获取审批详情数据
50
+ const getApprovalDetail = async () => {
51
+ try {
52
+ processInstanceLoading.value = true
53
+ const data = await processInstanceApi.getApprovalDetail(id.value)
54
+ if (!data) {
55
+ message.error('查询不到审批详情信息!')
56
+ return
57
+ }
58
+ if (!data.processDefinition || !data.processInstance) {
59
+ message.error('查询不到流程信息!')
60
+ return
61
+ }
62
+ processInstance.value = data?.processInstance
63
+ applicationPrefix.value = data?.processInstance?.formVariables?.applicationPrefix
64
+ todoTask.value = data?.todoTask
65
+ } finally {
66
+ processInstanceLoading.value = false
67
+ }
68
+ }
69
+
70
+ // 获取任务列表
71
+ const getTaskList = async () => {
72
+ tasks.value = await taskApi.getTaskListByProcessInstanceId(id.value)
73
+ }
74
+
75
+ watch(
76
+ () => props.processInstanceId,
77
+ (newValue) => {
78
+ debugger
79
+ if (newValue && newValue !== id.value) {
80
+ init(newValue)
81
+ }
82
+ },
83
+ { immediate: true, deep: true }
84
+ )
85
+ </script>
86
+
87
+ <style>
88
+
89
+ </style>
@@ -0,0 +1,12 @@
1
+ export const createTaskApi = (request: any) => ({
2
+ getTaskListByProcessInstanceId: async (processInstanceId: string) => {
3
+ return await request.get({
4
+ url: `/system/bpm/task/list-by-process-instance-id`,
5
+ params: {
6
+ processInstanceId
7
+ }
8
+ })
9
+ }
10
+ })
11
+
12
+
@@ -1,55 +0,0 @@
1
- <template>
2
- <el-button @click="open">aaaa</el-button>
3
- </template>
4
-
5
- <script setup lang="ts">
6
- import { ElMessage } from 'element-plus'
7
- import {ref, watch} from "vue";
8
- import {createProcessInstanceApi} from "@/api/processInstance";
9
-
10
- const props = defineProps<{
11
- processInstanceId: string
12
- request: any
13
- }>()
14
-
15
- const id = ref<string>('')
16
- const processInstanceApi = createProcessInstanceApi(props.request)
17
- console.log('props.request', props.request)
18
- console.log('processInstanceApi', processInstanceApi)
19
-
20
-
21
- const open = () => {
22
- ElMessage.success('aaa!')
23
- console.log(props.request)
24
- props.request.get({
25
- url: `/system/bpm/process-instance/get-approval-detail`,
26
- params: {
27
- processInstanceId: id.value
28
- }
29
- })
30
- }
31
-
32
- const init = (processInstanceId: string) => {
33
- id.value = processInstanceId
34
- processInstanceApi.getApprovalDetail(processInstanceId)
35
- .then((res: any) => {
36
- console.log(res)
37
- })
38
-
39
- }
40
-
41
- watch(
42
- () => props.processInstanceId,
43
- (newValue) => {
44
- debugger
45
- if (newValue && newValue !== id.value) {
46
- init(newValue)
47
- }
48
- },
49
- { immediate: true, deep: true }
50
- )
51
- </script>
52
-
53
- <style>
54
-
55
- </style>