mirror of
https://github.com/m1ngsama/FUJI.git
synced 2025-12-25 02:56:38 +00:00
save
This commit is contained in:
parent
c00cdb478c
commit
6a99120e14
2 changed files with 34 additions and 5 deletions
|
|
@ -95,7 +95,7 @@ export const EventActionCommit = (props: EventActionProps) => {
|
||||||
})
|
})
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const description = props.event?.logs.findLast(v => v.action == "commit")?.description
|
const description = props.event?.logs.findLast(v => v.action == "commit" || v.action == "alterCommit")?.description
|
||||||
setFormData({
|
setFormData({
|
||||||
size: props.event.size || "",
|
size: props.event.size || "",
|
||||||
description: description || "",
|
description: description || "",
|
||||||
|
|
@ -127,6 +127,7 @@ export const EventActionCommit = (props: EventActionProps) => {
|
||||||
</EventActionCommitForm>
|
</EventActionCommitForm>
|
||||||
<Button
|
<Button
|
||||||
variant="flat"
|
variant="flat"
|
||||||
|
color="primary"
|
||||||
isLoading={props.isLoading === "commit"}
|
isLoading={props.isLoading === "commit"}
|
||||||
onPress={() => onSubmit()}
|
onPress={() => onSubmit()}
|
||||||
>
|
>
|
||||||
|
|
@ -187,6 +188,8 @@ type JsxHandler = (props: EventActionProps) => JSX.Element
|
||||||
export type EventAction = {
|
export type EventAction = {
|
||||||
action: string
|
action: string
|
||||||
label?: string
|
label?: string
|
||||||
|
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger"
|
||||||
|
variant?: "flat" | "solid" | "bordered" | "light" | "faded" | "shadow" | "ghost"
|
||||||
handler?: CommonHandler
|
handler?: CommonHandler
|
||||||
jsxHandler: JsxHandler
|
jsxHandler: JsxHandler
|
||||||
}
|
}
|
||||||
|
|
@ -210,9 +213,10 @@ export const getAvailableEventActions = (event: PublicEvent, identityContext: Id
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col">
|
<div className="flex flex-col">
|
||||||
<Button
|
<Button
|
||||||
variant="flat"
|
|
||||||
isLoading={props.isLoading === action.action}
|
isLoading={props.isLoading === action.action}
|
||||||
isDisabled={props.isLoading}
|
isDisabled={props.isLoading}
|
||||||
|
color={action.color || "default"}
|
||||||
|
variant={action.variant || "flat"}
|
||||||
onPress={() => onAction(action)}
|
onPress={() => onAction(action)}
|
||||||
>
|
>
|
||||||
{action.label ?? action.action}
|
{action.label ?? action.action}
|
||||||
|
|
@ -228,6 +232,8 @@ export const getAvailableEventActions = (event: PublicEvent, identityContext: Id
|
||||||
jsxHandler: makeCommonJsxHandler({
|
jsxHandler: makeCommonJsxHandler({
|
||||||
action: "accept",
|
action: "accept",
|
||||||
label: "接受",
|
label: "接受",
|
||||||
|
variant: "solid",
|
||||||
|
color: "primary",
|
||||||
handler: async () => {
|
handler: async () => {
|
||||||
return await fetch(`${saturdayApiBaseUrl}/member/events/${event.eventId}/accept`, {
|
return await fetch(`${saturdayApiBaseUrl}/member/events/${event.eventId}/accept`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
|
@ -272,7 +278,8 @@ export const getAvailableEventActions = (event: PublicEvent, identityContext: Id
|
||||||
action: "close",
|
action: "close",
|
||||||
jsxHandler: makeCommonJsxHandler({
|
jsxHandler: makeCommonJsxHandler({
|
||||||
action: "close",
|
action: "close",
|
||||||
label: "关闭",
|
color: "success",
|
||||||
|
label: "完成",
|
||||||
handler: async () => {
|
handler: async () => {
|
||||||
return await fetch(`${saturdayApiBaseUrl}/events/${event.eventId}/close`, {
|
return await fetch(`${saturdayApiBaseUrl}/events/${event.eventId}/close`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
|
@ -287,6 +294,7 @@ export const getAvailableEventActions = (event: PublicEvent, identityContext: Id
|
||||||
action: "reject",
|
action: "reject",
|
||||||
jsxHandler: makeCommonJsxHandler({
|
jsxHandler: makeCommonJsxHandler({
|
||||||
action: "rejectCommit",
|
action: "rejectCommit",
|
||||||
|
color: "danger",
|
||||||
label: "退回",
|
label: "退回",
|
||||||
handler: async () => {
|
handler: async () => {
|
||||||
return await fetch(`${saturdayApiBaseUrl}/events/${event.eventId}/commit`, {
|
return await fetch(`${saturdayApiBaseUrl}/events/${event.eventId}/commit`, {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { forwardRef, useEffect, useImperativeHandle, useState } from "react"
|
import { forwardRef, useEffect, useImperativeHandle, useMemo, useState } from "react"
|
||||||
import type { components } from "../../types/saturday"
|
import type { components } from "../../types/saturday"
|
||||||
import { saturdayClient } from "../../utils/client"
|
import { saturdayClient } from "../../utils/client"
|
||||||
import { Textarea, Input, Chip, Skeleton } from "@heroui/react"
|
import { Textarea, Input, Chip, Skeleton } from "@heroui/react"
|
||||||
|
|
@ -35,7 +35,7 @@ function EventLogItem(props: {
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex gap-2 items-center mt-1 text-gray-600">
|
<div className="flex flex-col gap-2 items-center mt-1 text-gray-600">
|
||||||
{dayjs(props.eventLog.gmtCreate).format("YYYY-MM-DD HH:mm")}
|
{dayjs(props.eventLog.gmtCreate).format("YYYY-MM-DD HH:mm")}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -126,6 +126,10 @@ const EventDetail = forwardRef<EventDetailRef, {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const repairDescription = useMemo(() => {
|
||||||
|
return event?.logs.findLast(v => v.action == "commit" || v.action == "alterCommit")?.description
|
||||||
|
}, [event])
|
||||||
|
|
||||||
// 初次加载
|
// 初次加载
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
refresh()
|
refresh()
|
||||||
|
|
@ -148,6 +152,11 @@ const EventDetail = forwardRef<EventDetailRef, {
|
||||||
#{event.eventId}
|
#{event.eventId}
|
||||||
</span>
|
</span>
|
||||||
<EventStatusChip status={event.status}></EventStatusChip>
|
<EventStatusChip status={event.status}></EventStatusChip>
|
||||||
|
{
|
||||||
|
event.size
|
||||||
|
? <Chip>{"size:" + event.size}</Chip>
|
||||||
|
: <></>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="my-6 flex flex-col gap-4">
|
<div className="my-6 flex flex-col gap-4">
|
||||||
|
|
@ -164,6 +173,18 @@ const EventDetail = forwardRef<EventDetailRef, {
|
||||||
readOnly
|
readOnly
|
||||||
>
|
>
|
||||||
</Input>
|
</Input>
|
||||||
|
{
|
||||||
|
repairDescription
|
||||||
|
? (
|
||||||
|
<Textarea
|
||||||
|
label="维修描述"
|
||||||
|
readOnly
|
||||||
|
name="description"
|
||||||
|
value={repairDescription || ""}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
: <></>
|
||||||
|
}
|
||||||
<div className="bg-gray-100 rounded-xl text-sm px-3 py-2 mt-2 ">
|
<div className="bg-gray-100 rounded-xl text-sm px-3 py-2 mt-2 ">
|
||||||
<div className="text-xs font-semibold text-gray-600 mb-1">
|
<div className="text-xs font-semibold text-gray-600 mb-1">
|
||||||
维修记录
|
维修记录
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue