From ba98fb31a550e5ef00ee69cebdaabc35508ff292 Mon Sep 17 00:00:00 2001 From: hLinx <327159425@qq.com> Date: Wed, 27 Nov 2024 18:38:48 +0800 Subject: [PATCH] =?UTF-8?q?feat(frontend):=20=E5=8D=95=E6=8D=AE=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E8=BF=AD=E4=BB=A3=5F5=20#7190=20#=20Reviewed,=20trans?= =?UTF-8?q?action=20id:=2025085?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dbm-ui/frontend/src/hooks/useTicketCount.ts | 18 ++--- .../layout/components/PersonalWorkbench.vue | 2 +- dbm-ui/frontend/src/locales/zh-cn.json | 5 ++ .../src/services/source/ticketFlow.ts | 10 +-- .../components/list/components/TableMode.vue | 4 +- .../ticket-center/common/CardModeList.vue | 13 ++-- .../ticket-center/common/TableModeTable.vue | 9 ++- .../ticket-center/common/TicketClone.vue | 4 +- .../ticket-center/common/TicketDetailLink.vue | 2 +- .../ticket-center/common/TicketRevoke.vue | 44 +++++++++++ .../ProcessResourceReplenish.vue | 78 +++++++++++++++++++ .../common/action-confirm/ProcessRetry.vue | 44 +++-------- .../common/hooks/use-fetch-data.ts | 5 +- .../common/ticket-detail/Index.vue | 11 ++- .../flow-type-common/StatusFailed.vue | 6 +- .../flow-type-inner-flow/StatusFailed.vue | 6 +- .../components/todo-list/type-itsm/Index.vue | 2 - .../type-resource-replenish/StatusTodo.vue | 6 +- .../views/ticket-center/self-apply/Index.vue | 2 +- .../components/list/components/CardMode.vue | 2 +- .../components/list/components/TableMode.vue | 6 +- .../self-apply/hooks/use-url-redirect.ts | 47 ----------- .../views/ticket-center/self-todo/Index.vue | 8 +- .../components/list/components/TableMode.vue | 14 +--- .../row-action/StatusResourceReplenish.vue | 6 +- .../list/components/hooks/useStatusList.ts | 6 +- 26 files changed, 208 insertions(+), 152 deletions(-) create mode 100644 dbm-ui/frontend/src/views/ticket-center/common/TicketRevoke.vue create mode 100644 dbm-ui/frontend/src/views/ticket-center/common/action-confirm/ProcessResourceReplenish.vue delete mode 100644 dbm-ui/frontend/src/views/ticket-center/self-apply/hooks/use-url-redirect.ts diff --git a/dbm-ui/frontend/src/hooks/useTicketCount.ts b/dbm-ui/frontend/src/hooks/useTicketCount.ts index a9b712feac..acf9be0912 100644 --- a/dbm-ui/frontend/src/hooks/useTicketCount.ts +++ b/dbm-ui/frontend/src/hooks/useTicketCount.ts @@ -6,22 +6,22 @@ import { getTicketCount } from '@services/source/ticketFlow'; import { useEventBus } from '@hooks'; const run = () => { + const isLoading = ref(true); const data = ref>({ - MY_APPROVE: 0, APPROVE: 0, - TODO: 0, - RUNNING: 0, - RESOURCE_REPLENISH: 0, - FAILED: 0, DONE: 0, + FAILED: 0, + INNER_TODO: 0, + MY_APPROVE: 0, + RESOURCE_REPLENISH: 0, SELF_MANAGE: 0, + TODO: 0, }); - const { loading, run } = useRequest(getTicketCount, { - cacheKey: 'ticketCount', - cacheTime: 10000, + const { run } = useRequest(getTicketCount, { onSuccess(result) { data.value = result; + isLoading.value = false; }, }); @@ -34,7 +34,7 @@ const run = () => { }); return { - loading, + loading: isLoading, data, }; }; diff --git a/dbm-ui/frontend/src/layout/components/PersonalWorkbench.vue b/dbm-ui/frontend/src/layout/components/PersonalWorkbench.vue index c0c0fd6f7e..1d9996b67e 100644 --- a/dbm-ui/frontend/src/layout/components/PersonalWorkbench.vue +++ b/dbm-ui/frontend/src/layout/components/PersonalWorkbench.vue @@ -92,7 +92,7 @@ ticketCount.value.APPROVE + ticketCount.value.FAILED + ticketCount.value.RESOURCE_REPLENISH + - ticketCount.value.RUNNING + + ticketCount.value.INNER_TODO + ticketCount.value.TODO ); }); diff --git a/dbm-ui/frontend/src/locales/zh-cn.json b/dbm-ui/frontend/src/locales/zh-cn.json index e71a95a22a..868b6deeb7 100644 --- a/dbm-ui/frontend/src/locales/zh-cn.json +++ b/dbm-ui/frontend/src/locales/zh-cn.json @@ -3746,5 +3746,10 @@ "强制实例下架:": "强制实例下架:", "Excel文件:": "Excel文件:", "单据t不在n单据中": "单据 {t} 不在“{n}”单据中", + "单据重试确认": "单据重试确认", + "重试后,单据将再次尝试继续执行": "重试后,单据将再次尝试继续执行", + "批量处理": "批量处理", + "新窗口打开": "新窗口打开", + "重试后,单据将再次尝试申请资源": "重试后,单据将再次尝试申请资源", "这行勿动!新增翻译请在上一行添加!": "" } diff --git a/dbm-ui/frontend/src/services/source/ticketFlow.ts b/dbm-ui/frontend/src/services/source/ticketFlow.ts index 006904d889..ccb00fe953 100644 --- a/dbm-ui/frontend/src/services/source/ticketFlow.ts +++ b/dbm-ui/frontend/src/services/source/ticketFlow.ts @@ -51,14 +51,14 @@ export function processTodo(params: { id: number; todo_id: number; action: strin // 获取单据数量 export function getTicketCount() { return http.get<{ - MY_APPROVE: number; APPROVE: number; - TODO: number; - RUNNING: number; - RESOURCE_REPLENISH: number; - FAILED: number; DONE: number; + FAILED: number; + INNER_TODO: number; + MY_APPROVE: number; + RESOURCE_REPLENISH: number; SELF_MANAGE: number; + TODO: number; }>(`${path}/get_tickets_count/`); } diff --git a/dbm-ui/frontend/src/views/ticket-center/business/components/list/components/TableMode.vue b/dbm-ui/frontend/src/views/ticket-center/business/components/list/components/TableMode.vue index 0fb786160c..b581575930 100644 --- a/dbm-ui/frontend/src/views/ticket-center/business/components/list/components/TableMode.vue +++ b/dbm-ui/frontend/src/views/ticket-center/business/components/list/components/TableMode.vue @@ -43,10 +43,10 @@ :label="t('操作')" width="160"> diff --git a/dbm-ui/frontend/src/views/ticket-center/common/action-confirm/ProcessResourceReplenish.vue b/dbm-ui/frontend/src/views/ticket-center/common/action-confirm/ProcessResourceReplenish.vue new file mode 100644 index 0000000000..866857fcfc --- /dev/null +++ b/dbm-ui/frontend/src/views/ticket-center/common/action-confirm/ProcessResourceReplenish.vue @@ -0,0 +1,78 @@ + + diff --git a/dbm-ui/frontend/src/views/ticket-center/common/action-confirm/ProcessRetry.vue b/dbm-ui/frontend/src/views/ticket-center/common/action-confirm/ProcessRetry.vue index 3da72ea292..b90616bb72 100644 --- a/dbm-ui/frontend/src/views/ticket-center/common/action-confirm/ProcessRetry.vue +++ b/dbm-ui/frontend/src/views/ticket-center/common/action-confirm/ProcessRetry.vue @@ -3,7 +3,8 @@ :confirm-handler="handleApproval" placement="bottom" :title="t('单据重试确认')" - trigger="click"> + trigger="click" + :width="350"> @@ -25,15 +26,15 @@ import FlowMode from '@services/model/ticket/flow'; import TicketModel from '@services/model/ticket/ticket'; - import { batchProcessTicket, batchProcessTodo } from '@services/source/ticketFlow'; + import { retryFlow } from '@services/source/ticketFlow'; import { useEventBus } from '@hooks'; import { messageSuccess } from '@utils'; interface Props { - data?: TicketModel; - todoData?: FlowMode['todos'][number]; + data: TicketModel; + flowData: FlowMode; } const props = defineProps(); @@ -41,38 +42,17 @@ const { t } = useI18n(); const eventBus = useEventBus(); - const approveFormMode = reactive({ - remark: '', - }); - const isSubmitting = ref(false); const handleApproval = () => { isSubmitting.value = true; return Promise.resolve() - .then(() => { - if (props.data) { - return batchProcessTicket({ - action: 'APPROVE', - ticket_ids: [props.data.id], - params: approveFormMode, - }); - } - if (props.todoData) { - return batchProcessTodo({ - action: 'APPROVE', - operations: [ - { - todo_id: props.todoData.id, - params: { - remark: t('确认提交'), - }, - }, - ], - }); - } - return Promise.reject(); - }) + .then(() => + retryFlow({ + id: props.data.id, + flow_id: props.flowData.id, + }), + ) .then(() => { messageSuccess(t('操作成功')); eventBus.emit('refreshTicketStatus'); diff --git a/dbm-ui/frontend/src/views/ticket-center/common/hooks/use-fetch-data.ts b/dbm-ui/frontend/src/views/ticket-center/common/hooks/use-fetch-data.ts index b1451a2345..87672aa85a 100644 --- a/dbm-ui/frontend/src/views/ticket-center/common/hooks/use-fetch-data.ts +++ b/dbm-ui/frontend/src/views/ticket-center/common/hooks/use-fetch-data.ts @@ -42,7 +42,6 @@ const create = (dataSource: typeof getTickets, options?: { onSuccess?: (data: Ti }, { manual: true, - debounceInterval: 100, onSuccess(data) { dataList.value.forEach((ticketData) => { if (data[ticketData.id]) { @@ -58,7 +57,7 @@ const create = (dataSource: typeof getTickets, options?: { onSuccess?: (data: Ti const { start: loopFetchTicketStatus } = useTimeoutFn(() => { fetchTicketStatus(); - }, 1000000); + }, 10000); const fetchTicketList = (params: ServiceParameters) => { isLoading.value = true; @@ -90,7 +89,7 @@ const create = (dataSource: typeof getTickets, options?: { onSuccess?: (data: Ti eventBus.on('refreshTicketStatus', fetchTicketStatus); - onBeforeUnmount(() => { + onBeforeRouteLeave(() => { eventBus.off('refreshTicketStatus', fetchTicketStatus); }); diff --git a/dbm-ui/frontend/src/views/ticket-center/common/ticket-detail/Index.vue b/dbm-ui/frontend/src/views/ticket-center/common/ticket-detail/Index.vue index e4673f2341..928218a9b2 100644 --- a/dbm-ui/frontend/src/views/ticket-center/common/ticket-detail/Index.vue +++ b/dbm-ui/frontend/src/views/ticket-center/common/ticket-detail/Index.vue @@ -36,18 +36,17 @@ mode="collapse" :title="t('实施进度')"> - @@ -66,6 +65,7 @@ import PermissionCatch from '@components/apply-permission/Catch.vue'; import TicketClone from '@views/ticket-center/common/TicketClone.vue'; + import TicketRevoke from '@views/ticket-center/common/TicketRevoke.vue'; import { useTimeoutFn } from '@vueuse/core'; @@ -85,7 +85,7 @@ const getOffsetTarget = () => document.body.querySelector('.ticket-details-page .db-card'); const isLoading = ref(true); - const ticketData = shallowRef>(); + const ticketData = shallowRef(); const { runAsync: fetchTicketDetails } = useRequest( (params: ServiceParameters) => @@ -104,13 +104,12 @@ ); const refreshTicketData = () => { - console.log('refreshTicketDatarefreshTicketDatarefreshTicketData'); fetchTicketDetails({ id: props.ticketId, }); }; - const { start: loopFetchTicketDetails } = useTimeoutFn(refreshTicketData, 1000000); + const { start: loopFetchTicketDetails } = useTimeoutFn(refreshTicketData, 10000); watch( () => props.ticketId, diff --git a/dbm-ui/frontend/src/views/ticket-center/common/ticket-detail/components/flow-info/components/flow-type-common/StatusFailed.vue b/dbm-ui/frontend/src/views/ticket-center/common/ticket-detail/components/flow-info/components/flow-type-common/StatusFailed.vue index b6f691c2c9..1e824a1ba8 100644 --- a/dbm-ui/frontend/src/views/ticket-center/common/ticket-detail/components/flow-info/components/flow-type-common/StatusFailed.vue +++ b/dbm-ui/frontend/src/views/ticket-center/common/ticket-detail/components/flow-info/components/flow-type-common/StatusFailed.vue @@ -29,11 +29,13 @@
- + - {{ t('重试') }} + {{ t('失败重试') }}
diff --git a/dbm-ui/frontend/src/views/ticket-center/common/ticket-detail/components/flow-info/components/flow-type-inner-flow/StatusFailed.vue b/dbm-ui/frontend/src/views/ticket-center/common/ticket-detail/components/flow-info/components/flow-type-inner-flow/StatusFailed.vue index 73d3eb1c9a..c9a34056ee 100644 --- a/dbm-ui/frontend/src/views/ticket-center/common/ticket-detail/components/flow-info/components/flow-type-inner-flow/StatusFailed.vue +++ b/dbm-ui/frontend/src/views/ticket-center/common/ticket-detail/components/flow-info/components/flow-type-inner-flow/StatusFailed.vue @@ -22,11 +22,13 @@
- + - {{ t('重试') }} + {{ t('失败重试') }} diff --git a/dbm-ui/frontend/src/views/ticket-center/common/ticket-detail/components/flow-info/components/todo-list/type-itsm/Index.vue b/dbm-ui/frontend/src/views/ticket-center/common/ticket-detail/components/flow-info/components/todo-list/type-itsm/Index.vue index d470f4b012..f27748756e 100644 --- a/dbm-ui/frontend/src/views/ticket-center/common/ticket-detail/components/flow-info/components/todo-list/type-itsm/Index.vue +++ b/dbm-ui/frontend/src/views/ticket-center/common/ticket-detail/components/flow-info/components/todo-list/type-itsm/Index.vue @@ -25,6 +25,4 @@ [FlowMode.TODO_STATUS_TODO]: StatusTodo, [FlowMode.TODO_STATUS_DONE_FAILED]: StatusDoneFailed, })[props.data.status]; - - console.log('from type itesm = ', props.data); diff --git a/dbm-ui/frontend/src/views/ticket-center/common/ticket-detail/components/flow-info/components/todo-list/type-resource-replenish/StatusTodo.vue b/dbm-ui/frontend/src/views/ticket-center/common/ticket-detail/components/flow-info/components/todo-list/type-resource-replenish/StatusTodo.vue index 6687e281db..0b32f691af 100644 --- a/dbm-ui/frontend/src/views/ticket-center/common/ticket-detail/components/flow-info/components/todo-list/type-resource-replenish/StatusTodo.vue +++ b/dbm-ui/frontend/src/views/ticket-center/common/ticket-detail/components/flow-info/components/todo-list/type-resource-replenish/StatusTodo.vue @@ -9,13 +9,13 @@
{{ utcDisplayTime(data.done_at) }}