Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ concurrency:

jobs:
build:
runs-on: ubuntu-latest
runs-on: self-hosted

steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/go-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ concurrency:

jobs:
test:
runs-on: ubuntu-latest
runs-on: self-hosted

steps:
- name: Checkout
Expand Down
14 changes: 14 additions & 0 deletions frontend/src/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,20 @@ body {
margin-top: 2px;
}

.bbs-member-select-item .ant-form-item-label > label {
width: 100%;
}

.bbs-member-select-label {
flex: 1;
width: 100%;
}

.bbs-member-select-label .ant-btn {
padding-inline: 0;
height: auto;
}

.bbs-member-check-group {
display: flex;
flex-direction: column;
Expand Down
32 changes: 31 additions & 1 deletion frontend/src/pages/ItemAddPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,17 @@ export function ItemAddPage() {
}, [watchPartyId]);

const headCount = selectedUsers.length;
const allMemberIds = useMemo(() => members.map((m) => m.id), [members]);
const allSelected = allMemberIds.length > 0 && allMemberIds.every((id) => selectedUsers.includes(id));

const toggleSelectAllUsers = () => {
const next = allSelected ? [] : allMemberIds;
const hadError = form.getFieldError('users').length > 0;
form.setFieldsValue({users: next});
if (next.length > 0 || hadError) {
void form.validateFields(['users']).catch(() => undefined);
}
};
const preview = useMemo(() => {
if (splitMode === 'custom') return null;
const raw = Number(amountInput);
Expand Down Expand Up @@ -285,7 +296,26 @@ export function ItemAddPage() {

<Form.Item
name="users"
label="记入谁名下(可多选)"
className="bbs-member-select-item"
label={
<Flex align="center" justify="space-between" gap={8} className="bbs-member-select-label">
<span>记入谁名下(可多选)</span>
<Button
type="link"
size="small"
htmlType="button"
disabled={members.length === 0}
onMouseDown={(e) => e.preventDefault()}
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
toggleSelectAllUsers();
}}
>
{allSelected ? '取消全选' : '全选'}
</Button>
</Flex>
}
rules={[{required: true, type: 'array', min: 1, message: '请至少选择一名成员'}]}
>
<Checkbox.Group
Expand Down
4 changes: 2 additions & 2 deletions internal/httpapi/items.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,8 @@ type itemRow struct {
Amount string `json:"amount"`
Paid bool `json:"paid"`
CreatedAt time.Time `json:"created_at"`
UserID uint64 `json:"userid"`
Initiator uint64 `json:"initiator"`
UserID uint64 `gorm:"column:userid" json:"userid"`
Initiator uint64 `gorm:"column:initiator" json:"initiator"`
PayerName string `json:"payer_name"`
InitiatorName string `json:"initiator_name"`
}
Expand Down
4 changes: 2 additions & 2 deletions internal/httpapi/party.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,8 @@ func (h *Handler) showParty(c *gin.Context) {
Description string `json:"description"`
Amount string `json:"amount"`
Paid bool `json:"paid"`
UserID uint64 `json:"userid"`
Initiator uint64 `json:"initiator"`
UserID uint64 `gorm:"column:userid" json:"userid"`
Initiator uint64 `gorm:"column:initiator" json:"initiator"`
PayerName string `json:"payer_name"`
InitiatorName string `json:"initiator_name"`
}
Expand Down
Loading