nbb-component-ui 1.2.2 → 1.2.4
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.es.js +216 -34
- package/dist/index.umd.js +1 -1
- package/dist/src/ProcessFlow/src/CmcFlowList.vue.d.ts +6 -0
- package/dist/src/api/task.d.ts +3 -0
- package/dist/style.css +1 -0
- package/package.json +2 -1
- package/src/ProcessFlow/src/CmcFlowList.vue +168 -0
- package/src/ProcessFlow/src/CmcProcessFlow.vue +91 -15
- package/src/api/task.ts +12 -0
- package/vite.config.js +4 -1
package/dist/index.es.js
CHANGED
|
@@ -1,56 +1,238 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ElMessage as
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { defineComponent as N, ref as f, resolveComponent as m, openBlock as r, createElementBlock as i, createElementVNode as l, toDisplayString as s, unref as c, createCommentVNode as u, createVNode as y, withCtx as v, Fragment as H, renderList as z, createBlock as A, createTextVNode as I, watch as E } from "vue";
|
|
2
|
+
import { ElMessage as V } from "element-plus";
|
|
3
|
+
import { formatDate as T, formatPast2 as B } from "@/utils/formatTime";
|
|
4
|
+
const j = (t) => ({
|
|
5
|
+
getApprovalDetail: async (n) => await t.get({
|
|
5
6
|
url: "/system/bpm/process-instance/get-approval-detail",
|
|
6
7
|
params: {
|
|
7
|
-
processInstanceId:
|
|
8
|
+
processInstanceId: n
|
|
8
9
|
}
|
|
9
10
|
})
|
|
10
|
-
}),
|
|
11
|
+
}), R = (t) => ({
|
|
12
|
+
getTaskListByProcessInstanceId: async (n) => await t.get({
|
|
13
|
+
url: "/system/bpm/task/list-by-process-instance-id",
|
|
14
|
+
params: {
|
|
15
|
+
processInstanceId: n
|
|
16
|
+
}
|
|
17
|
+
})
|
|
18
|
+
}), S = { class: "scroll-area" }, O = { class: "flow-header flex justify-between" }, $ = { class: "text-18px font-bold" }, G = {
|
|
19
|
+
class: "text-14px font-bold",
|
|
20
|
+
style: { color: "#005aae" }
|
|
21
|
+
}, J = { class: "flex items-center" }, K = { class: "flow-start" }, Q = { key: 0 }, W = { class: "mt-30px block" }, X = ["src"], Y = { style: { "font-weight": "700" } }, Z = {
|
|
22
|
+
key: 0,
|
|
23
|
+
style: { "margin-right": "30px", "font-weight": "normal" }
|
|
24
|
+
}, ee = {
|
|
25
|
+
key: 1,
|
|
26
|
+
style: { "margin-right": "30px", "font-weight": "normal" }
|
|
27
|
+
}, se = {
|
|
28
|
+
key: 0,
|
|
29
|
+
style: { "font-weight": "normal" }
|
|
30
|
+
}, te = {
|
|
31
|
+
key: 1,
|
|
32
|
+
style: { "font-weight": "normal", color: "#8a909c" }
|
|
33
|
+
}, ne = {
|
|
34
|
+
key: 2,
|
|
35
|
+
style: { "font-weight": "normal" }
|
|
36
|
+
}, oe = {
|
|
37
|
+
key: 3,
|
|
38
|
+
style: { "font-weight": "normal", color: "#8a909c" }
|
|
39
|
+
}, ae = {
|
|
40
|
+
key: 4,
|
|
41
|
+
style: { "margin-left": "30px", "font-weight": "normal" }
|
|
42
|
+
}, ce = {
|
|
43
|
+
key: 5,
|
|
44
|
+
style: { "font-weight": "normal", color: "#8a909c" }
|
|
45
|
+
}, re = { key: 2 }, le = /* @__PURE__ */ N({
|
|
46
|
+
name: "BpmProcessInstanceTaskList",
|
|
47
|
+
__name: "CmcFlowList",
|
|
48
|
+
props: {
|
|
49
|
+
processInstance: {},
|
|
50
|
+
tasks: {}
|
|
51
|
+
},
|
|
52
|
+
setup(t) {
|
|
53
|
+
const { t: n } = useI18n(), d = {
|
|
54
|
+
1: "svg-icon:approvalPending",
|
|
55
|
+
// 审批中
|
|
56
|
+
2: "svg-icon:approvalPass",
|
|
57
|
+
// 通过
|
|
58
|
+
3: "svg-icon:approvalRejected",
|
|
59
|
+
// 拒绝
|
|
60
|
+
4: "svg-icon:approvalCanceled"
|
|
61
|
+
// 取消
|
|
62
|
+
}, k = (p) => [0, 1, 6, 7].includes(p.status) ? "primary" : p.status === 2 ? "success" : p.status === 3 ? "danger" : p.status === 4 ? "info" : p.status === 5 ? "warning" : "";
|
|
63
|
+
return f(!1), (p, M) => {
|
|
64
|
+
var b;
|
|
65
|
+
const x = m("Icon"), h = m("dict-tag"), g = m("el-tag"), F = m("el-card"), P = m("el-timeline-item"), C = m("el-timeline");
|
|
66
|
+
return r(), i("div", S, [
|
|
67
|
+
l("div", O, [
|
|
68
|
+
l("div", $, [
|
|
69
|
+
l("span", null, s(c(n)("processFlow.flow")), 1),
|
|
70
|
+
l("span", null, s(t.processInstance.id), 1)
|
|
71
|
+
]),
|
|
72
|
+
l("div", G, [
|
|
73
|
+
l("span", null, s(t.processInstance.name), 1)
|
|
74
|
+
])
|
|
75
|
+
]),
|
|
76
|
+
l("div", J, [
|
|
77
|
+
l("div", K, [
|
|
78
|
+
l("p", null, s(c(n)("processFlow.startTime")) + s(c(T)(t.processInstance.startTime)), 1),
|
|
79
|
+
l("p", null, s(c(n)("processFlow.endTime")) + s(c(T)(t.processInstance.endTime)), 1),
|
|
80
|
+
t.processInstance.durationInMillis ? (r(), i("p", Q, s(c(n)("processFlow.duration")) + s(c(B)((b = t.processInstance) == null ? void 0 : b.durationInMillis)), 1)) : u("", !0)
|
|
81
|
+
]),
|
|
82
|
+
y(x, {
|
|
83
|
+
size: 100,
|
|
84
|
+
icon: d[t.processInstance.status] || "svg-icon:approvalPending"
|
|
85
|
+
}, null, 8, ["icon"])
|
|
86
|
+
]),
|
|
87
|
+
l("div", W, [
|
|
88
|
+
y(C, null, {
|
|
89
|
+
default: v(() => [
|
|
90
|
+
(r(!0), i(H, null, z(t.tasks, (e, w) => (r(), A(P, {
|
|
91
|
+
key: w,
|
|
92
|
+
type: k(e) || "info"
|
|
93
|
+
}, {
|
|
94
|
+
dot: v(() => {
|
|
95
|
+
var a;
|
|
96
|
+
return [
|
|
97
|
+
l("img", {
|
|
98
|
+
src: ((a = e == null ? void 0 : e.assigneeUser) == null ? void 0 : a.avatar) || "https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png",
|
|
99
|
+
class: "avatar-wrap"
|
|
100
|
+
}, null, 8, X)
|
|
101
|
+
];
|
|
102
|
+
}),
|
|
103
|
+
default: v(() => [
|
|
104
|
+
l("p", Y, [
|
|
105
|
+
I(s(e.name) + " ", 1),
|
|
106
|
+
e.status ? (r(), A(h, {
|
|
107
|
+
key: 0,
|
|
108
|
+
type: "bpm_task_status",
|
|
109
|
+
value: e.status || ""
|
|
110
|
+
}, null, 8, ["value"])) : u("", !0)
|
|
111
|
+
]),
|
|
112
|
+
y(F, { "body-style": { padding: "10px" } }, {
|
|
113
|
+
default: v(() => {
|
|
114
|
+
var a, _, o, D;
|
|
115
|
+
return [
|
|
116
|
+
w === 0 ? (r(), i("label", Z, [
|
|
117
|
+
I(s(((a = e.assigneeUser) == null ? void 0 : a.nickname) || ((_ = e.ownerUser) == null ? void 0 : _.nickname)) + " ", 1),
|
|
118
|
+
y(g, {
|
|
119
|
+
size: "small",
|
|
120
|
+
type: "info",
|
|
121
|
+
style: { "vertical-align": "1px" }
|
|
122
|
+
}, {
|
|
123
|
+
default: v(() => {
|
|
124
|
+
var L, U;
|
|
125
|
+
return [
|
|
126
|
+
I(s((U = (L = t.processInstance) == null ? void 0 : L.startUser) == null ? void 0 : U.deptName), 1)
|
|
127
|
+
];
|
|
128
|
+
}),
|
|
129
|
+
_: 1
|
|
130
|
+
})
|
|
131
|
+
])) : u("", !0),
|
|
132
|
+
e.assigneeUser ? (r(), i("label", ee, [
|
|
133
|
+
I(s(c(n)("processFlow.approver")) + s(((o = e.assigneeUser) == null ? void 0 : o.nickname) || ((D = e.ownerUser) == null ? void 0 : D.nickname)) + " ", 1),
|
|
134
|
+
y(g, {
|
|
135
|
+
size: "small",
|
|
136
|
+
type: "info",
|
|
137
|
+
style: { "vertical-align": "1px" }
|
|
138
|
+
}, {
|
|
139
|
+
default: v(() => [
|
|
140
|
+
I(s(e.assigneeUser.deptName), 1)
|
|
141
|
+
]),
|
|
142
|
+
_: 2
|
|
143
|
+
}, 1024)
|
|
144
|
+
])) : u("", !0),
|
|
145
|
+
l("div", null, [
|
|
146
|
+
e.createTime && !e.endTime ? (r(), i("label", se, s(c(n)("processFlow.createTime")), 1)) : u("", !0),
|
|
147
|
+
e.createTime && !e.endTime ? (r(), i("label", te, s(c(T)(e == null ? void 0 : e.createTime, "MM-DD HH:mm")), 1)) : u("", !0),
|
|
148
|
+
e.endTime ? (r(), i("label", ne, s(c(n)("processFlow.approvalTime")), 1)) : u("", !0),
|
|
149
|
+
e.endTime ? (r(), i("label", oe, s(c(T)(e == null ? void 0 : e.endTime, "MM-DD HH:mm")), 1)) : u("", !0),
|
|
150
|
+
e.durationInMillis ? (r(), i("label", ae, s(c(n)("processFlow.duration")), 1)) : u("", !0),
|
|
151
|
+
e.durationInMillis ? (r(), i("label", ce, s(c(B)(e == null ? void 0 : e.durationInMillis)), 1)) : u("", !0)
|
|
152
|
+
]),
|
|
153
|
+
e.reason ? (r(), i("div", re, s(c(n)("processFlow.approvalSuggestion")) + s(e.reason), 1)) : u("", !0)
|
|
154
|
+
];
|
|
155
|
+
}),
|
|
156
|
+
_: 2
|
|
157
|
+
}, 1024)
|
|
158
|
+
]),
|
|
159
|
+
_: 2
|
|
160
|
+
}, 1032, ["type"]))), 128))
|
|
161
|
+
]),
|
|
162
|
+
_: 1
|
|
163
|
+
})
|
|
164
|
+
])
|
|
165
|
+
]);
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
const q = (t, n) => {
|
|
170
|
+
const d = t.__vccOpts || t;
|
|
171
|
+
for (const [k, p] of n)
|
|
172
|
+
d[k] = p;
|
|
173
|
+
return d;
|
|
174
|
+
}, ie = /* @__PURE__ */ q(le, [["__scopeId", "data-v-6f63ddea"]]), pe = /* @__PURE__ */ N({
|
|
11
175
|
__name: "CmcProcessFlow",
|
|
12
176
|
props: {
|
|
13
177
|
processInstanceId: {},
|
|
14
178
|
request: {}
|
|
15
179
|
},
|
|
16
180
|
setup(t) {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
181
|
+
const n = useMessage(), d = t, k = f(!1), p = f({}), M = f({}), x = f(""), h = f([]), g = f(""), F = j(d.request), P = R(d.request), C = () => {
|
|
182
|
+
V.success("aaa!");
|
|
183
|
+
}, b = (a) => {
|
|
184
|
+
g.value = a, e(), w();
|
|
185
|
+
}, e = async () => {
|
|
186
|
+
var a, _;
|
|
187
|
+
try {
|
|
188
|
+
k.value = !0;
|
|
189
|
+
const o = await F.getApprovalDetail(g.value);
|
|
190
|
+
if (!o) {
|
|
191
|
+
n.error("查询不到审批详情信息!");
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
if (!o.processDefinition || !o.processInstance) {
|
|
195
|
+
n.error("查询不到流程信息!");
|
|
196
|
+
return;
|
|
24
197
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
198
|
+
p.value = o == null ? void 0 : o.processInstance, x.value = (_ = (a = o == null ? void 0 : o.processInstance) == null ? void 0 : a.formVariables) == null ? void 0 : _.applicationPrefix, M.value = o == null ? void 0 : o.todoTask;
|
|
199
|
+
} finally {
|
|
200
|
+
k.value = !1;
|
|
201
|
+
}
|
|
202
|
+
}, w = async () => {
|
|
203
|
+
h.value = await P.getTaskListByProcessInstanceId(g.value);
|
|
30
204
|
};
|
|
31
|
-
return
|
|
32
|
-
() =>
|
|
33
|
-
(
|
|
205
|
+
return E(
|
|
206
|
+
() => d.processInstanceId,
|
|
207
|
+
(a) => {
|
|
34
208
|
debugger;
|
|
35
|
-
|
|
209
|
+
a && a !== g.value && b(a);
|
|
36
210
|
},
|
|
37
211
|
{ immediate: !0, deep: !0 }
|
|
38
|
-
), (
|
|
39
|
-
const
|
|
40
|
-
return
|
|
41
|
-
|
|
42
|
-
v(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
212
|
+
), (a, _) => {
|
|
213
|
+
const o = m("el-button");
|
|
214
|
+
return r(), i(H, null, [
|
|
215
|
+
y(o, { onClick: C }, {
|
|
216
|
+
default: v(() => [..._[0] || (_[0] = [
|
|
217
|
+
I("测试按钮", -1)
|
|
218
|
+
])]),
|
|
219
|
+
_: 1
|
|
220
|
+
}),
|
|
221
|
+
y(ie, {
|
|
222
|
+
"process-instance": p.value,
|
|
223
|
+
tasks: h.value,
|
|
224
|
+
onRefresh: w
|
|
225
|
+
}, null, 8, ["process-instance", "tasks"])
|
|
226
|
+
], 64);
|
|
46
227
|
};
|
|
47
228
|
}
|
|
48
|
-
})
|
|
229
|
+
});
|
|
230
|
+
const ue = /* @__PURE__ */ q(pe, [["__scopeId", "data-v-618a45b7"]]), fe = {
|
|
49
231
|
install(t) {
|
|
50
|
-
t.component("CmcProcessFlow",
|
|
232
|
+
t.component("CmcProcessFlow", ue);
|
|
51
233
|
}
|
|
52
234
|
};
|
|
53
235
|
export {
|
|
54
|
-
|
|
55
|
-
|
|
236
|
+
ue as CmcProcessFlow,
|
|
237
|
+
fe as default
|
|
56
238
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(c,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("element-plus"),require("@/utils/formatTime")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus","@/utils/formatTime"],e):(c=typeof globalThis<"u"?globalThis:c||self,e(c.NbbComponentUi={},c.Vue,c.ElementPlus,c.formatTime))})(this,function(c,e,B,d){"use strict";const T=n=>({getApprovalDetail:async s=>await n.get({url:"/system/bpm/process-instance/get-approval-detail",params:{processInstanceId:s}})}),E=n=>({getTaskListByProcessInstanceId:async s=>await n.get({url:"/system/bpm/task/list-by-process-instance-id",params:{processInstanceId:s}})}),b={class:"scroll-area"},S={class:"flow-header flex justify-between"},P={class:"text-18px font-bold"},F={class:"text-14px font-bold",style:{color:"#005aae"}},M={class:"flex items-center"},u={class:"flow-start"},L={key:0},U={class:"mt-30px block"},A=["src"],q={style:{"font-weight":"700"}},j={key:0,style:{"margin-right":"30px","font-weight":"normal"}},H={key:1,style:{"margin-right":"30px","font-weight":"normal"}},z={key:0,style:{"font-weight":"normal"}},O={key:1,style:{"font-weight":"normal",color:"#8a909c"}},R={key:2,style:{"font-weight":"normal"}},$={key:3,style:{"font-weight":"normal",color:"#8a909c"}},G={key:4,style:{"margin-left":"30px","font-weight":"normal"}},J={key:5,style:{"font-weight":"normal",color:"#8a909c"}},K={key:2},Q=e.defineComponent({name:"BpmProcessInstanceTaskList",__name:"CmcFlowList",props:{processInstance:{},tasks:{}},setup(n){const{t:s}=useI18n(),l={1:"svg-icon:approvalPending",2:"svg-icon:approvalPass",3:"svg-icon:approvalRejected",4:"svg-icon:approvalCanceled"},m=r=>[0,1,6,7].includes(r.status)?"primary":r.status===2?"success":r.status===3?"danger":r.status===4?"info":r.status===5?"warning":"";return e.ref(!1),(r,V)=>{var g;const y=e.resolveComponent("Icon"),_=e.resolveComponent("dict-tag"),p=e.resolveComponent("el-tag"),k=e.resolveComponent("el-card"),h=e.resolveComponent("el-timeline-item"),w=e.resolveComponent("el-timeline");return e.openBlock(),e.createElementBlock("div",b,[e.createElementVNode("div",S,[e.createElementVNode("div",P,[e.createElementVNode("span",null,e.toDisplayString(e.unref(s)("processFlow.flow")),1),e.createElementVNode("span",null,e.toDisplayString(n.processInstance.id),1)]),e.createElementVNode("div",F,[e.createElementVNode("span",null,e.toDisplayString(n.processInstance.name),1)])]),e.createElementVNode("div",M,[e.createElementVNode("div",u,[e.createElementVNode("p",null,e.toDisplayString(e.unref(s)("processFlow.startTime"))+e.toDisplayString(e.unref(d.formatDate)(n.processInstance.startTime)),1),e.createElementVNode("p",null,e.toDisplayString(e.unref(s)("processFlow.endTime"))+e.toDisplayString(e.unref(d.formatDate)(n.processInstance.endTime)),1),n.processInstance.durationInMillis?(e.openBlock(),e.createElementBlock("p",L,e.toDisplayString(e.unref(s)("processFlow.duration"))+e.toDisplayString(e.unref(d.formatPast2)((g=n.processInstance)==null?void 0:g.durationInMillis)),1)):e.createCommentVNode("",!0)]),e.createVNode(y,{size:100,icon:l[n.processInstance.status]||"svg-icon:approvalPending"},null,8,["icon"])]),e.createElementVNode("div",U,[e.createVNode(w,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.tasks,(t,f)=>(e.openBlock(),e.createBlock(h,{key:f,type:m(t)||"info"},{dot:e.withCtx(()=>{var a;return[e.createElementVNode("img",{src:((a=t==null?void 0:t.assigneeUser)==null?void 0:a.avatar)||"https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png",class:"avatar-wrap"},null,8,A)]}),default:e.withCtx(()=>[e.createElementVNode("p",q,[e.createTextVNode(e.toDisplayString(t.name)+" ",1),t.status?(e.openBlock(),e.createBlock(_,{key:0,type:"bpm_task_status",value:t.status||""},null,8,["value"])):e.createCommentVNode("",!0)]),e.createVNode(k,{"body-style":{padding:"10px"}},{default:e.withCtx(()=>{var a,i,o,C;return[f===0?(e.openBlock(),e.createElementBlock("label",j,[e.createTextVNode(e.toDisplayString(((a=t.assigneeUser)==null?void 0:a.nickname)||((i=t.ownerUser)==null?void 0:i.nickname))+" ",1),e.createVNode(p,{size:"small",type:"info",style:{"vertical-align":"1px"}},{default:e.withCtx(()=>{var D,x;return[e.createTextVNode(e.toDisplayString((x=(D=n.processInstance)==null?void 0:D.startUser)==null?void 0:x.deptName),1)]}),_:1})])):e.createCommentVNode("",!0),t.assigneeUser?(e.openBlock(),e.createElementBlock("label",H,[e.createTextVNode(e.toDisplayString(e.unref(s)("processFlow.approver"))+e.toDisplayString(((o=t.assigneeUser)==null?void 0:o.nickname)||((C=t.ownerUser)==null?void 0:C.nickname))+" ",1),e.createVNode(p,{size:"small",type:"info",style:{"vertical-align":"1px"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.assigneeUser.deptName),1)]),_:2},1024)])):e.createCommentVNode("",!0),e.createElementVNode("div",null,[t.createTime&&!t.endTime?(e.openBlock(),e.createElementBlock("label",z,e.toDisplayString(e.unref(s)("processFlow.createTime")),1)):e.createCommentVNode("",!0),t.createTime&&!t.endTime?(e.openBlock(),e.createElementBlock("label",O,e.toDisplayString(e.unref(d.formatDate)(t==null?void 0:t.createTime,"MM-DD HH:mm")),1)):e.createCommentVNode("",!0),t.endTime?(e.openBlock(),e.createElementBlock("label",R,e.toDisplayString(e.unref(s)("processFlow.approvalTime")),1)):e.createCommentVNode("",!0),t.endTime?(e.openBlock(),e.createElementBlock("label",$,e.toDisplayString(e.unref(d.formatDate)(t==null?void 0:t.endTime,"MM-DD HH:mm")),1)):e.createCommentVNode("",!0),t.durationInMillis?(e.openBlock(),e.createElementBlock("label",G,e.toDisplayString(e.unref(s)("processFlow.duration")),1)):e.createCommentVNode("",!0),t.durationInMillis?(e.openBlock(),e.createElementBlock("label",J,e.toDisplayString(e.unref(d.formatPast2)(t==null?void 0:t.durationInMillis)),1)):e.createCommentVNode("",!0)]),t.reason?(e.openBlock(),e.createElementBlock("div",K,e.toDisplayString(e.unref(s)("processFlow.approvalSuggestion"))+e.toDisplayString(t.reason),1)):e.createCommentVNode("",!0)]}),_:2},1024)]),_:2},1032,["type"]))),128))]),_:1})])])}}}),Z="",N=(n,s)=>{const l=n.__vccOpts||n;for(const[m,r]of s)l[m]=r;return l},W=N(Q,[["__scopeId","data-v-6f63ddea"]]),X=e.defineComponent({__name:"CmcProcessFlow",props:{processInstanceId:{},request:{}},setup(n){const s=useMessage(),l=n,m=e.ref(!1),r=e.ref({}),V=e.ref({}),y=e.ref(""),_=e.ref([]),p=e.ref(""),k=T(l.request),h=E(l.request),w=()=>{B.ElMessage.success("aaa!")},g=a=>{p.value=a,t(),f()},t=async()=>{var a,i;try{m.value=!0;const o=await k.getApprovalDetail(p.value);if(!o){s.error("查询不到审批详情信息!");return}if(!o.processDefinition||!o.processInstance){s.error("查询不到流程信息!");return}r.value=o==null?void 0:o.processInstance,y.value=(i=(a=o==null?void 0:o.processInstance)==null?void 0:a.formVariables)==null?void 0:i.applicationPrefix,V.value=o==null?void 0:o.todoTask}finally{m.value=!1}},f=async()=>{_.value=await h.getTaskListByProcessInstanceId(p.value)};return e.watch(()=>l.processInstanceId,a=>{debugger;a&&a!==p.value&&g(a)},{immediate:!0,deep:!0}),(a,i)=>{const o=e.resolveComponent("el-button");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(o,{onClick:w},{default:e.withCtx(()=>[...i[0]||(i[0]=[e.createTextVNode("测试按钮",-1)])]),_:1}),e.createVNode(W,{"process-instance":r.value,tasks:_.value,onRefresh:f},null,8,["process-instance","tasks"])],64)}}}),v="",I=N(X,[["__scopeId","data-v-618a45b7"]]),Y={install(n){n.component("CmcProcessFlow",I)}};c.CmcProcessFlow=I,c.default=Y,Object.defineProperties(c,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
processInstance: any;
|
|
3
|
+
tasks: any[];
|
|
4
|
+
};
|
|
5
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
6
|
+
export default _default;
|
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@charset "UTF-8";.avatar-wrap[data-v-6f63ddea]{width:40px;height:40px}.flow-start[data-v-6f63ddea]{width:70%;margin:10px auto;padding:0 10px 10px;background:rgb(245,247,253)}.flow-start p[data-v-6f63ddea]{margin:0;padding-top:10px;font-size:14px}[data-v-6f63ddea] .el-timeline-item__dot{left:-15px;top:-15px}.scroll-area[data-v-6f63ddea]{flex:1;min-height:0;overflow-y:auto}.process-container[data-v-618a45b7]{height:100%;box-sizing:border-box}.process-container[data-v-618a45b7]>.el-card__body{height:100%;padding-bottom:0}.process-container[data-v-618a45b7]>.el-card__body>div{height:100%;display:flex;flex-direction:column}.approval-actions[data-v-618a45b7]{margin:20px 0}.approval-actions .action-buttons[data-v-618a45b7]{display:flex;flex-direction:column;gap:12px}.approval-actions .action-buttons .basic-actions[data-v-618a45b7]{display:flex;gap:12px}.approval-actions .action-buttons .extended-actions[data-v-618a45b7]{display:flex;gap:12px;flex-wrap:wrap}.approval-dialogs[data-v-618a45b7]{display:contents}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nbb-component-ui",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"main": "./dist/index.umd.js",
|
|
5
5
|
"module": "./dist/index.es.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"@vitejs/plugin-vue": "^4.0.0",
|
|
15
15
|
"element-plus": "^2.0.0",
|
|
16
|
+
"sass": "^1.99.0",
|
|
16
17
|
"typescript": "^5.0.0",
|
|
17
18
|
"vite": "^4.0.0",
|
|
18
19
|
"vite-plugin-dts": "^4.5.4",
|
|
@@ -0,0 +1,168 @@
|
|
|
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="'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
|
+
// @ts-expect-error 运行时由宿主应用提供
|
|
96
|
+
import { formatDate, formatPast2 } from '@/utils/formatTime'
|
|
97
|
+
import {ref} from "vue";
|
|
98
|
+
|
|
99
|
+
defineOptions({ name: 'BpmProcessInstanceTaskList' })
|
|
100
|
+
// @ts-expect-error 运行时由宿主应用提供
|
|
101
|
+
const { t } = useI18n()
|
|
102
|
+
const statusIconMapping = {
|
|
103
|
+
1: 'svg-icon:approvalPending', // 审批中
|
|
104
|
+
2: 'svg-icon:approvalPass', // 通过
|
|
105
|
+
3: 'svg-icon:approvalRejected', // 拒绝
|
|
106
|
+
4: 'svg-icon:approvalCanceled' // 取消
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const props = defineProps<{
|
|
110
|
+
processInstance: any
|
|
111
|
+
tasks: any[]
|
|
112
|
+
}>()
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
/** 获得任务对应的颜色 */
|
|
117
|
+
const getTaskTimelineItemType = (item: any) => {
|
|
118
|
+
if ([0, 1, 6, 7].includes(item.status)) {
|
|
119
|
+
return 'primary'
|
|
120
|
+
}
|
|
121
|
+
if (item.status === 2) {
|
|
122
|
+
return 'success'
|
|
123
|
+
}
|
|
124
|
+
if (item.status === 3) {
|
|
125
|
+
return 'danger'
|
|
126
|
+
}
|
|
127
|
+
if (item.status === 4) {
|
|
128
|
+
return 'info'
|
|
129
|
+
}
|
|
130
|
+
if (item.status === 5) {
|
|
131
|
+
return 'warning'
|
|
132
|
+
}
|
|
133
|
+
return ''
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const taskFormVisible = ref(false)
|
|
137
|
+
</script>
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
<style scoped lang="scss">
|
|
142
|
+
.avatar-wrap {
|
|
143
|
+
width: 40px;
|
|
144
|
+
height: 40px;
|
|
145
|
+
}
|
|
146
|
+
.flow-start {
|
|
147
|
+
width: 70%;
|
|
148
|
+
margin: 10px auto;
|
|
149
|
+
padding: 10px;
|
|
150
|
+
padding-top: 0;
|
|
151
|
+
background: rgba(245, 247, 253, 1);
|
|
152
|
+
|
|
153
|
+
p {
|
|
154
|
+
margin: 0px;
|
|
155
|
+
padding-top: 10px;
|
|
156
|
+
font-size: 14px;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
:deep(.el-timeline-item__dot) {
|
|
160
|
+
left: -15px;
|
|
161
|
+
top: -15px;
|
|
162
|
+
}
|
|
163
|
+
.scroll-area {
|
|
164
|
+
flex: 1;
|
|
165
|
+
min-height: 0;
|
|
166
|
+
overflow-y: auto;
|
|
167
|
+
}
|
|
168
|
+
</style>
|
|
@@ -1,41 +1,75 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<el-button @click="open"
|
|
2
|
+
<el-button @click="open">测试按钮</el-button>
|
|
3
|
+
<!-- 审批记录列表 -->
|
|
4
|
+
<ProcessInstanceTaskList
|
|
5
|
+
:process-instance="processInstance"
|
|
6
|
+
:tasks="tasks"
|
|
7
|
+
@refresh="getTaskList"
|
|
8
|
+
/>
|
|
3
9
|
</template>
|
|
4
10
|
|
|
5
11
|
<script setup lang="ts">
|
|
6
12
|
import { ElMessage } from 'element-plus'
|
|
7
13
|
import {ref, watch} from "vue";
|
|
8
14
|
import {createProcessInstanceApi} from "@/api/processInstance";
|
|
15
|
+
import {createTaskApi} from "@/api/task";
|
|
16
|
+
|
|
17
|
+
import ProcessInstanceTaskList from './CmcFlowList.vue'
|
|
18
|
+
|
|
19
|
+
// @ts-expect-error 运行时由宿主应用提供
|
|
20
|
+
const message = useMessage() // 消息弹窗
|
|
9
21
|
|
|
10
22
|
const props = defineProps<{
|
|
11
23
|
processInstanceId: string
|
|
12
24
|
request: any
|
|
13
25
|
}>()
|
|
14
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
|
+
|
|
15
34
|
const id = ref<string>('')
|
|
16
35
|
const processInstanceApi = createProcessInstanceApi(props.request)
|
|
17
|
-
|
|
18
|
-
console.log('processInstanceApi', processInstanceApi)
|
|
36
|
+
const taskApi = createTaskApi(props.request)
|
|
19
37
|
|
|
20
38
|
|
|
21
39
|
const open = () => {
|
|
22
40
|
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
41
|
}
|
|
31
42
|
|
|
32
43
|
const init = (processInstanceId: string) => {
|
|
33
44
|
id.value = processInstanceId
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
})
|
|
45
|
+
getApprovalDetail()
|
|
46
|
+
getTaskList()
|
|
47
|
+
}
|
|
38
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)
|
|
39
73
|
}
|
|
40
74
|
|
|
41
75
|
watch(
|
|
@@ -50,6 +84,48 @@ watch(
|
|
|
50
84
|
)
|
|
51
85
|
</script>
|
|
52
86
|
|
|
53
|
-
<style>
|
|
87
|
+
<style scoped lang="scss">
|
|
88
|
+
.process-container {
|
|
89
|
+
height: 100%;
|
|
90
|
+
box-sizing: border-box;
|
|
91
|
+
|
|
92
|
+
& > :deep(.el-card__body) {
|
|
93
|
+
height: 100%;
|
|
94
|
+
padding-bottom: 0;
|
|
54
95
|
|
|
96
|
+
& > div {
|
|
97
|
+
height: 100%;
|
|
98
|
+
display: flex;
|
|
99
|
+
flex-direction: column;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// 审批操作区域样式
|
|
105
|
+
.approval-actions {
|
|
106
|
+
margin: 20px 0;
|
|
107
|
+
|
|
108
|
+
.action-buttons {
|
|
109
|
+
display: flex;
|
|
110
|
+
flex-direction: column;
|
|
111
|
+
gap: 12px;
|
|
112
|
+
|
|
113
|
+
.basic-actions {
|
|
114
|
+
display: flex;
|
|
115
|
+
gap: 12px;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.extended-actions {
|
|
119
|
+
display: flex;
|
|
120
|
+
gap: 12px;
|
|
121
|
+
flex-wrap: wrap;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// 审批弹窗区域样式
|
|
127
|
+
.approval-dialogs {
|
|
128
|
+
/* 弹窗组件样式由各自组件管理 */
|
|
129
|
+
display: contents;
|
|
130
|
+
}
|
|
55
131
|
</style>
|
package/src/api/task.ts
ADDED
|
@@ -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
|
+
|
package/vite.config.js
CHANGED