nbb-component-ui 1.3.4 → 1.3.5

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
@@ -2,4 +2,5 @@ import { Plugin } from 'vue';
2
2
  import { CmcProcessFlow } from './src/ProcessFlow';
3
3
  declare const plugin: Plugin<[]>;
4
4
  export { CmcProcessFlow };
5
+ export declare function getRequest(): any;
5
6
  export default plugin;
package/dist/index.es.js CHANGED
@@ -1,88 +1,84 @@
1
- import { defineComponent as k, ref as n, watch as _, resolveComponent as b, openBlock as P, createBlock as x, withCtx as C, createTextVNode as A } from "vue";
2
- import { ElMessage as l } from "element-plus";
3
- const T = (t) => ({
4
- getApprovalDetail: async (o) => await t.get({
5
- url: "/system/bpm/process-instance/get-approval-detail",
6
- params: {
7
- processInstanceId: o
8
- }
9
- })
10
- }), w = (t) => ({
11
- getTaskListByProcessInstanceId: async (o) => await t.get({
12
- url: "/system/bpm/task/list-by-process-instance-id",
13
- params: {
14
- processInstanceId: o
15
- }
16
- })
17
- }), B = /* @__PURE__ */ k({
1
+ import { defineComponent as I, ref as n, watch as w, resolveComponent as k, openBlock as C, createBlock as x, withCtx as q, createTextVNode as P } from "vue";
2
+ import { ElMessage as i } from "element-plus";
3
+ const b = m(), F = async (s) => await b.get({
4
+ url: "/system/bpm/process-instance/get-approval-detail",
5
+ params: {
6
+ processInstanceId: s
7
+ }
8
+ }), T = m(), B = async (s) => await T.get({
9
+ url: "/system/bpm/task/list-by-process-instance-id",
10
+ params: {
11
+ processInstanceId: s
12
+ }
13
+ }), D = /* @__PURE__ */ I({
18
14
  __name: "CmcProcessFlow",
19
15
  props: {
20
16
  processInstanceId: {},
21
17
  request: {}
22
18
  },
23
- setup(t) {
24
- const o = t, c = n(!1), p = n({}), i = n({}), f = n(""), v = n([]), r = n("");
25
- let u, m;
26
- const d = (s) => {
27
- r.value = s, I(), g();
28
- }, I = async () => {
29
- var s, a;
19
+ setup(s) {
20
+ const o = s, r = n(!1), l = n({}), p = n({}), _ = n(""), f = n([]), a = n(""), v = (t) => {
21
+ a.value = t, d(), g();
22
+ }, d = async () => {
23
+ var t, c;
30
24
  try {
31
- c.value = !0;
32
- const e = await u.getApprovalDetail(r.value);
25
+ r.value = !0;
26
+ const e = await F(a.value);
33
27
  if (!e) {
34
- l.error("查询不到审批详情信息!");
28
+ i.error("查询不到审批详情信息!");
35
29
  return;
36
30
  }
37
31
  if (!e.processDefinition || !e.processInstance) {
38
- l.error("查询不到流程信息!");
32
+ i.error("查询不到流程信息!");
39
33
  return;
40
34
  }
41
- p.value = e == null ? void 0 : e.processInstance, f.value = (a = (s = e == null ? void 0 : e.processInstance) == null ? void 0 : s.formVariables) == null ? void 0 : a.applicationPrefix, i.value = e == null ? void 0 : e.todoTask;
35
+ l.value = e == null ? void 0 : e.processInstance, _.value = (c = (t = e == null ? void 0 : e.processInstance) == null ? void 0 : t.formVariables) == null ? void 0 : c.applicationPrefix, p.value = e == null ? void 0 : e.todoTask;
42
36
  } finally {
43
- c.value = !1;
37
+ r.value = !1;
44
38
  }
45
39
  }, g = async () => {
46
- v.value = await m.getTaskListByProcessInstanceId(r.value);
40
+ f.value = await B(a.value);
47
41
  };
48
- _(
42
+ w(
49
43
  () => o.processInstanceId,
50
- (s) => {
51
- s && s !== r.value && d(s);
44
+ (t) => {
45
+ t && t !== a.value && v(t);
52
46
  },
53
47
  { immediate: !0, deep: !0 }
54
- ), _(
55
- () => o.request,
56
- (s) => {
57
- s && (u = T(s), m = w(s));
58
- },
59
- { immediate: !0 }
60
48
  );
61
49
  const y = () => {
62
- l.success("aaa!");
50
+ i.success("aaa!");
63
51
  };
64
- return (s, a) => {
65
- const e = b("el-button");
66
- return P(), x(e, { onClick: y }, {
67
- default: C(() => [...a[0] || (a[0] = [
68
- A("测试按钮3", -1)
52
+ return (t, c) => {
53
+ const e = k("el-button");
54
+ return C(), x(e, { onClick: y }, {
55
+ default: q(() => [...c[0] || (c[0] = [
56
+ P("测试按钮3", -1)
69
57
  ])]),
70
58
  _: 1
71
59
  });
72
60
  };
73
61
  }
74
62
  });
75
- const D = (t, o) => {
76
- const c = t.__vccOpts || t;
77
- for (const [p, i] of o)
78
- c[p] = i;
79
- return c;
80
- }, F = /* @__PURE__ */ D(B, [["__scopeId", "data-v-35e1b83b"]]), E = {
81
- install(t) {
82
- t.component("CmcProcessFlow", F);
63
+ const L = (s, o) => {
64
+ const r = s.__vccOpts || s;
65
+ for (const [l, p] of o)
66
+ r[l] = p;
67
+ return r;
68
+ }, h = /* @__PURE__ */ L(D, [["__scopeId", "data-v-e422ef37"]]);
69
+ let u = null;
70
+ const $ = {
71
+ install(s, o) {
72
+ u = o == null ? void 0 : o.request, s.component("CmcProcessFlow", h);
83
73
  }
84
74
  };
75
+ function m() {
76
+ if (!u)
77
+ throw new Error("请在外部项目 app.use(CmcFlowCore) 传入 request");
78
+ return u;
79
+ }
85
80
  export {
86
- F as CmcProcessFlow,
87
- E as default
81
+ h as CmcProcessFlow,
82
+ $ as default,
83
+ m as getRequest
88
84
  };
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(o,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):(o=typeof globalThis<"u"?globalThis:o||self,e(o.NbbComponentUi={},o.Vue,o.ElementPlus))})(this,function(o,e,p){"use strict";const _=n=>({getApprovalDetail:async c=>await n.get({url:"/system/bpm/process-instance/get-approval-detail",params:{processInstanceId:c}})}),y=n=>({getTaskListByProcessInstanceId:async c=>await n.get({url:"/system/bpm/task/list-by-process-instance-id",params:{processInstanceId:c}})}),g=e.defineComponent({__name:"CmcProcessFlow",props:{processInstanceId:{},request:{}},setup(n){const c=n,r=e.ref(!1),l=e.ref({}),f=e.ref({}),b=e.ref(""),k=e.ref([]),i=e.ref("");let d,m;const v=t=>{i.value=t,C(),P()},C=async()=>{var t,a;try{r.value=!0;const s=await d.getApprovalDetail(i.value);if(!s){p.ElMessage.error("查询不到审批详情信息!");return}if(!s.processDefinition||!s.processInstance){p.ElMessage.error("查询不到流程信息!");return}l.value=s==null?void 0:s.processInstance,b.value=(a=(t=s==null?void 0:s.processInstance)==null?void 0:t.formVariables)==null?void 0:a.applicationPrefix,f.value=s==null?void 0:s.todoTask}finally{r.value=!1}},P=async()=>{k.value=await m.getTaskListByProcessInstanceId(i.value)};e.watch(()=>c.processInstanceId,t=>{t&&t!==i.value&&v(t)},{immediate:!0,deep:!0}),e.watch(()=>c.request,t=>{t&&(d=_(t),m=y(t))},{immediate:!0});const T=()=>{p.ElMessage.success("aaa!")};return(t,a)=>{const s=e.resolveComponent("el-button");return e.openBlock(),e.createBlock(s,{onClick:T},{default:e.withCtx(()=>[...a[0]||(a[0]=[e.createTextVNode("测试按钮3",-1)])]),_:1})}}}),x="",u=((n,c)=>{const r=n.__vccOpts||n;for(const[l,f]of c)r[l]=f;return r})(g,[["__scopeId","data-v-35e1b83b"]]),I={install(n){n.component("CmcProcessFlow",u)}};o.CmcProcessFlow=u,o.default=I,Object.defineProperties(o,{__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,l){"use strict";const m=u(),g=async n=>await m.get({url:"/system/bpm/process-instance/get-approval-detail",params:{processInstanceId:n}}),y=u(),w=async n=>await y.get({url:"/system/bpm/task/list-by-process-instance-id",params:{processInstanceId:n}}),C=e.defineComponent({__name:"CmcProcessFlow",props:{processInstanceId:{},request:{}},setup(n){const r=n,c=e.ref(!1),f=e.ref({}),_=e.ref({}),v=e.ref(""),k=e.ref([]),i=e.ref(""),q=o=>{i.value=o,b(),x()},b=async()=>{var o,a;try{c.value=!0;const s=await g(i.value);if(!s){l.ElMessage.error("查询不到审批详情信息!");return}if(!s.processDefinition||!s.processInstance){l.ElMessage.error("查询不到流程信息!");return}f.value=s==null?void 0:s.processInstance,v.value=(a=(o=s==null?void 0:s.processInstance)==null?void 0:o.formVariables)==null?void 0:a.applicationPrefix,_.value=s==null?void 0:s.todoTask}finally{c.value=!1}},x=async()=>{k.value=await w(i.value)};e.watch(()=>r.processInstanceId,o=>{o&&o!==i.value&&q(o)},{immediate:!0,deep:!0});const P=()=>{l.ElMessage.success("aaa!")};return(o,a)=>{const s=e.resolveComponent("el-button");return e.openBlock(),e.createBlock(s,{onClick:P},{default:e.withCtx(()=>[...a[0]||(a[0]=[e.createTextVNode("测试按钮3",-1)])]),_:1})}}}),T="",d=((n,r)=>{const c=n.__vccOpts||n;for(const[f,_]of r)c[f]=_;return c})(C,[["__scopeId","data-v-e422ef37"]]);let p=null;const I={install(n,r){p=r==null?void 0:r.request,n.component("CmcProcessFlow",d)}};function u(){if(!p)throw new Error("请在外部项目 app.use(CmcFlowCore) 传入 request");return p}t.CmcProcessFlow=d,t.default=I,t.getRequest=u,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -1,3 +1 @@
1
- export declare const createProcessInstanceApi: (request: any) => {
2
- getApprovalDetail: (processInstanceId: any) => Promise<any>;
3
- };
1
+ export declare const getApprovalDetail: (processInstanceId: string) => Promise<any>;
@@ -1,3 +1 @@
1
- export declare const createTaskApi: (request: any) => {
2
- getTaskListByProcessInstanceId: (processInstanceId: string) => Promise<any>;
3
- };
1
+ export declare const getTaskListByProcessInstanceId: (processInstanceId: string) => Promise<any>;
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- @charset "UTF-8";.process-container[data-v-35e1b83b]{height:100%;box-sizing:border-box}.process-container[data-v-35e1b83b]>.el-card__body{height:100%;padding-bottom:0}.process-container[data-v-35e1b83b]>.el-card__body>div{height:100%;display:flex;flex-direction:column}.approval-actions[data-v-35e1b83b]{margin:20px 0}.approval-actions .action-buttons[data-v-35e1b83b]{display:flex;flex-direction:column;gap:12px}.approval-actions .action-buttons .basic-actions[data-v-35e1b83b]{display:flex;gap:12px}.approval-actions .action-buttons .extended-actions[data-v-35e1b83b]{display:flex;gap:12px;flex-wrap:wrap}.approval-dialogs[data-v-35e1b83b]{display:contents}
1
+ @charset "UTF-8";.process-container[data-v-e422ef37]{height:100%;box-sizing:border-box}.process-container[data-v-e422ef37]>.el-card__body{height:100%;padding-bottom:0}.process-container[data-v-e422ef37]>.el-card__body>div{height:100%;display:flex;flex-direction:column}.approval-actions[data-v-e422ef37]{margin:20px 0}.approval-actions .action-buttons[data-v-e422ef37]{display:flex;flex-direction:column;gap:12px}.approval-actions .action-buttons .basic-actions[data-v-e422ef37]{display:flex;gap:12px}.approval-actions .action-buttons .extended-actions[data-v-e422ef37]{display:flex;gap:12px;flex-wrap:wrap}.approval-dialogs[data-v-e422ef37]{display:contents}
package/index.ts CHANGED
@@ -1,14 +1,24 @@
1
1
  import type { App, Plugin } from 'vue'
2
2
  import {CmcProcessFlow} from "./src/ProcessFlow";
3
3
 
4
+ let _request: any = null;
5
+
4
6
  // 定义插件对象,严格标注类型
5
7
  const plugin: Plugin<[]> = {
6
- install(app: App) {
8
+ install(app: App, options?: {request: any}) {
9
+ _request = options?.request
7
10
  app.component('CmcProcessFlow', CmcProcessFlow)
8
11
  }
9
12
  }
10
13
  // 支持按需引入
11
14
  export {CmcProcessFlow }
12
15
 
16
+ export function getRequest() {
17
+ if (!_request) {
18
+ throw new Error('请在外部项目 app.use(CmcFlowCore) 传入 request')
19
+ }
20
+ return _request
21
+ }
22
+
13
23
  // 默认导出插件(必须是Plugin类型)
14
24
  export default plugin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nbb-component-ui",
3
- "version": "1.3.4",
3
+ "version": "1.3.5",
4
4
  "main": "./dist/index.umd.js",
5
5
  "module": "./dist/index.es.js",
6
6
  "types": "./dist/index.d.ts",
@@ -11,8 +11,8 @@
11
11
  <script setup lang="ts">
12
12
  import { ElMessage } from 'element-plus'
13
13
  import {ref, watch} from "vue";
14
- import {createProcessInstanceApi} from "@/api/processInstance";
15
- import {createTaskApi} from "@/api/task";
14
+ import * as processInstanceApi from "@/api/processInstance";
15
+ import * as taskApi from "@/api/task";
16
16
 
17
17
  // import ProcessInstanceTaskList from './CmcFlowList.vue'
18
18
 
@@ -32,8 +32,6 @@ const applicationPrefix = ref('')
32
32
  const tasks = ref<any[]>([])
33
33
 
34
34
  const id = ref<string>('')
35
- let processInstanceApi: any;
36
- let taskApi: any;
37
35
 
38
36
 
39
37
 
@@ -80,17 +78,6 @@ watch(
80
78
  },
81
79
  { immediate: true, deep: true }
82
80
  )
83
- // 监听 props 变化 → 有值了再创建 API
84
- watch(
85
- () => props.request,
86
- (newRequest) => {
87
- if (newRequest) {
88
- processInstanceApi = createProcessInstanceApi(newRequest)
89
- taskApi = createTaskApi(newRequest)
90
- }
91
- },
92
- { immediate: true }
93
- )
94
81
 
95
82
 
96
83
  const open = () => {
@@ -1,12 +1,27 @@
1
- export const createProcessInstanceApi = (request: any) => ({
2
- getApprovalDetail: async (processInstanceId: any) => {
3
- return await request.get({
4
- url: `/system/bpm/process-instance/get-approval-detail`,
5
- params: {
6
- processInstanceId
7
- }
8
- })
9
- }
10
- })
1
+ import {getRequest} from "../../index";
2
+
3
+ const request = getRequest()
4
+
5
+ export const getApprovalDetail = async (processInstanceId: string) => {
6
+ return await request.get({
7
+ url: `/system/bpm/process-instance/get-approval-detail`,
8
+ params: {
9
+ processInstanceId
10
+ }
11
+ })
12
+ }
13
+
14
+
15
+
16
+ // export const createProcessInstanceApi = (request: any) => ({
17
+ // getApprovalDetail: async (processInstanceId: any) => {
18
+ // return await request.get({
19
+ // url: `/system/bpm/process-instance/get-approval-detail`,
20
+ // params: {
21
+ // processInstanceId
22
+ // }
23
+ // })
24
+ // }
25
+ // })
11
26
 
12
27
 
package/src/api/task.ts CHANGED
@@ -1,12 +1,14 @@
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
- })
1
+ import {getRequest} from "../../index";
2
+
3
+ const request = getRequest()
4
+
5
+ export const getTaskListByProcessInstanceId = async (processInstanceId: string) => {
6
+ return await request.get({
7
+ url: `/system/bpm/task/list-by-process-instance-id`,
8
+ params: {
9
+ processInstanceId
10
+ }
11
+ })
12
+ }
11
13
 
12
14