refactor(frontend): 重构前端第二版
This commit is contained in:
1 parent
2631f78b00
commit
4b562cfa82
205 files changed
+15399
-12015
No files matched your search
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
* 对话页:子组件 inject 用的 handlers 对象打包(请假表单、出货映射、消息气泡)。
|
||||
*/
|
||||
import type { LeaveMessageHandlers } from '../components/messages/LeaveMessageBlock.vue';
|
||||
import type { ShippingMappingHandlers } from '../components/messages/ShippingInventoryMappingMessage.vue';
|
||||
import type { useChatLeave } from '../composables/useChatLeave';
|
||||
import type { useChatShipping } from '../composables/useChatShipping';
|
||||
import type { Ref } from 'vue';
|
||||
|
||||
type LeaveHandlerSource = Pick<
|
||||
ReturnType<typeof useChatLeave>,
|
||||
| 'getLeaveFormPayload'
|
||||
| 'getLeaveConfirmationPayload'
|
||||
| 'getLeaveResultPayload'
|
||||
| 'getLeaveAgentDisplayValue'
|
||||
| 'getLeaveTypeLabel'
|
||||
| 'formatDurationLabel'
|
||||
| 'formatYesNoLabel'
|
||||
| 'syncLeaveDuration'
|
||||
| 'openLeaveAgentDialog'
|
||||
| 'openOALeaveRequestDirectly'
|
||||
| 'openOARequestDirectly'
|
||||
| 'submitLeaveForm'
|
||||
| 'editLeaveConfirmation'
|
||||
| 'confirmLeaveSubmission'
|
||||
>;
|
||||
|
||||
type ShippingHandlerSource = Pick<
|
||||
ReturnType<typeof useChatShipping>,
|
||||
| 'getShippingInventoryMappingPayload'
|
||||
| 'normalizeShippingHeaderForDisplay'
|
||||
| 'hasShippingInventorySampleRows'
|
||||
| 'getShippingInventorySampleRowText'
|
||||
| 'reuploadShippingInventoryFromMappingForm'
|
||||
| 'applyShippingInventoryMappingForm'
|
||||
>;
|
||||
|
||||
/** 请假消息块 handlers(LeaveMessageBlock) */
|
||||
export function createLeaveMessageHandlers(leave: LeaveHandlerSource): LeaveMessageHandlers {
|
||||
return {
|
||||
getLeaveFormPayload: leave.getLeaveFormPayload,
|
||||
getLeaveConfirmationPayload: leave.getLeaveConfirmationPayload,
|
||||
getLeaveResultPayload: leave.getLeaveResultPayload,
|
||||
getLeaveAgentDisplayValue: leave.getLeaveAgentDisplayValue,
|
||||
getLeaveTypeLabel: leave.getLeaveTypeLabel,
|
||||
formatDurationLabel: leave.formatDurationLabel,
|
||||
formatYesNoLabel: leave.formatYesNoLabel,
|
||||
syncLeaveDuration: leave.syncLeaveDuration,
|
||||
openLeaveAgentDialog: leave.openLeaveAgentDialog,
|
||||
openOALeaveRequestDirectly: leave.openOALeaveRequestDirectly,
|
||||
openOARequestDirectly: leave.openOARequestDirectly,
|
||||
submitLeaveForm: leave.submitLeaveForm,
|
||||
editLeaveConfirmation: leave.editLeaveConfirmation,
|
||||
confirmLeaveSubmission: leave.confirmLeaveSubmission,
|
||||
};
|
||||
}
|
||||
|
||||
/** 出货库存映射块 handlers(ShippingInventoryMappingMessage) */
|
||||
export function createShippingMappingHandlers(shipping: ShippingHandlerSource): ShippingMappingHandlers {
|
||||
return {
|
||||
getPayload: shipping.getShippingInventoryMappingPayload,
|
||||
normalizeHeader: shipping.normalizeShippingHeaderForDisplay,
|
||||
hasSampleRows: shipping.hasShippingInventorySampleRows,
|
||||
getSampleRowText: shipping.getShippingInventorySampleRowText,
|
||||
reupload: shipping.reuploadShippingInventoryFromMappingForm,
|
||||
apply: shipping.applyShippingInventoryMappingForm,
|
||||
};
|
||||
}
|
||||
|
||||
/** 隐藏 file input ref 包裹,避免 template 自动解包 Ref */
|
||||
export function createShippingPickerRefHolder(pickerRef: Ref<HTMLInputElement | null>) {
|
||||
return { pickerRef };
|
||||
}
|
||||
Reference in new issue
Block a user