forked from TencentBlueKing/blueking-dbm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(frontend): 单据管理迭代_5 TencentBlueKing#7190
# Reviewed, transaction id: 25085
- Loading branch information
Showing
26 changed files
with
208 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
dbm-ui/frontend/src/views/ticket-center/common/TicketRevoke.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<template> | ||
<DbPopconfirm | ||
v-if="isCan" | ||
:confirm-handler="handleRevoke" | ||
:content="t('撤销后,单据将作废处理')" | ||
:title="t('确定撤销单据')"> | ||
<BkButton theme="danger"> | ||
{{ t('撤销单据') }} | ||
</BkButton> | ||
</DbPopconfirm> | ||
</template> | ||
<script setup lang="ts"> | ||
import { computed } from 'vue'; | ||
import { useI18n } from 'vue-i18n'; | ||
import TicketModel from '@services/model/ticket/ticket'; | ||
import { revokeTicket } from '@services/source/ticketFlow'; | ||
import { useEventBus } from '@hooks'; | ||
import { useUserProfile } from '@stores'; | ||
interface Props { | ||
data: TicketModel<unknown>; | ||
} | ||
const props = defineProps<Props>(); | ||
const { username } = useUserProfile(); | ||
const { t } = useI18n(); | ||
const eventBus = useEventBus(); | ||
const isCan = computed( | ||
() => props.data.status === TicketModel.STATUS_APPROVE && props.data.todo_operators.includes(username), | ||
); | ||
const handleRevoke = () => | ||
revokeTicket({ | ||
ticket_ids: [props.data.id], | ||
}).then(() => { | ||
eventBus.emit('refreshTicketStatus'); | ||
}); | ||
</script> |
78 changes: 78 additions & 0 deletions
78
dbm-ui/frontend/src/views/ticket-center/common/action-confirm/ProcessResourceReplenish.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<template> | ||
<DbPopconfirm | ||
:confirm-handler="handleApproval" | ||
placement="bottom" | ||
:title="t('单据重试确认')" | ||
trigger="click" | ||
:width="350"> | ||
<slot /> | ||
<template #content> | ||
<div> | ||
{{ t('操作:') }} | ||
<BkTag | ||
class="mr-4" | ||
theme="success" | ||
type="stroke"> | ||
{{ t('确认执行') }} | ||
</BkTag> | ||
<span>{{ t('重试后,单据将再次尝试申请资源') }}</span> | ||
</div> | ||
</template> | ||
</DbPopconfirm> | ||
</template> | ||
<script setup lang="ts"> | ||
import { ref } from 'vue'; | ||
import { useI18n } from 'vue-i18n'; | ||
import FlowMode from '@services/model/ticket/flow'; | ||
import TicketModel from '@services/model/ticket/ticket'; | ||
import { batchProcessTicket, batchProcessTodo } from '@services/source/ticketFlow'; | ||
import { useEventBus } from '@hooks'; | ||
import { messageSuccess } from '@utils'; | ||
interface Props { | ||
data?: TicketModel; | ||
todoData?: FlowMode['todos'][number]; | ||
} | ||
const props = defineProps<Props>(); | ||
const { t } = useI18n(); | ||
const eventBus = useEventBus(); | ||
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], | ||
}); | ||
} | ||
if (props.todoData) { | ||
return batchProcessTodo({ | ||
action: 'APPROVE', | ||
operations: [ | ||
{ | ||
todo_id: props.todoData.id, | ||
}, | ||
], | ||
}); | ||
} | ||
return Promise.reject(); | ||
}) | ||
.then(() => { | ||
messageSuccess(t('操作成功')); | ||
eventBus.emit('refreshTicketStatus'); | ||
}) | ||
.finally(() => { | ||
isSubmitting.value = false; | ||
}); | ||
}; | ||
</script> |
Oops, something went wrong.