diff --git a/package.json b/package.json index fede2f2..a730b61 100644 --- a/package.json +++ b/package.json @@ -15,8 +15,9 @@ "api:gen": "alova gen -f", "typecheck": "vue-tsc --noEmit", "test:line-offline": "esbuild tests/line-offline.test.ts --bundle --platform=node --format=esm --target=node20 --external:node:* --outfile=node_modules/.cache/line-offline.test.mjs && node node_modules/.cache/line-offline.test.mjs", + "test:unit": "esbuild tests/line-offline.test.ts tests/app-url.test.ts tests/flow-error.test.ts tests/assign-preview.test.ts tests/convert-roundtrip.test.ts --bundle --platform=node --format=esm --target=node20 --external:node:* --outbase=tests --outdir=node_modules/.cache/unit && node --test node_modules/.cache/unit", "test:component": "vitest run", - "test": "npm run test:line-offline && npm run test:component" + "test": "npm run test:unit && npm run test:component" }, "dependencies": { "@open-file-viewer/core": "^0.1.43", diff --git a/src/api/module/flow.ts b/src/api/module/flow.ts index bd9fe51..cc700fd 100644 --- a/src/api/module/flow.ts +++ b/src/api/module/flow.ts @@ -13,8 +13,9 @@ function get(url: string, params?: Record): Method { // alova 的请求体是 Method 构造的第 5 个参数(instance.data),不是 config 上的键: // 写进 config 的 body/data 都会被适配器忽略,POST 将发出空 body。 -function post(url: string, body?: any): Method { - return new Method("POST", alovaInstance, url, {}, body); +// 第 4 个参数 config 可带 silentBizToast:调用方自己承担错误提示时,不再叠加全局 toast。 +function post(url: string, body?: any, config?: Record): Method { + return new Method("POST", alovaInstance, url, config || {}, body); } /** 状态枚举(后端 FlwEnums 口径) */ @@ -187,12 +188,12 @@ class FlowApi { * 流程线级停发(T03):整条 flowGuid 停止新发起/预览,在途实例按原版本跑完; * 与版本级 status 正交,返回受影响版本行数。 */ - defOfflineLine(flowGuid: string) { - return post(`${ROOT}/admin/def/offlineLine`, { flowGuid }); + defOfflineLine(flowGuid: string, config?: Record) { + return post(`${ROOT}/admin/def/offlineLine`, { flowGuid }, config); } /** 流程线级恢复(T03):只恢复线可用性,不改写任何版本状态或发布内容;返回受影响版本行数 */ - defEnableLine(flowGuid: string) { - return post(`${ROOT}/admin/def/enableLine`, { flowGuid }); + defEnableLine(flowGuid: string, config?: Record) { + return post(`${ROOT}/admin/def/enableLine`, { flowGuid }, config); } defVersions(flowGuid: string) { return get(`${ROOT}/admin/def/versions`, { flowGuid }); diff --git a/src/components/FlowAssignEmbed.vue b/src/components/FlowAssignEmbed.vue new file mode 100644 index 0000000..8e82f04 --- /dev/null +++ b/src/components/FlowAssignEmbed.vue @@ -0,0 +1,132 @@ + + +