0.1.0 #2
@ -6,16 +6,21 @@ import Header from './components/main/Header.vue';
|
|||||||
<a-layout class="layout">
|
<a-layout class="layout">
|
||||||
<Header />
|
<Header />
|
||||||
<a-layout-content>
|
<a-layout-content>
|
||||||
<a-flex gap="middle" vertical>
|
<RouterView />
|
||||||
<RouterView />
|
|
||||||
</a-flex>
|
|
||||||
</a-layout-content>
|
</a-layout-content>
|
||||||
</a-layout>
|
</a-layout>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
main {
|
main {
|
||||||
padding: 36px;
|
display: flex;
|
||||||
margin: 14px;
|
justify-content: center;
|
||||||
|
padding: 5vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.base-page {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
min-width: 80dvw;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
@ -42,25 +42,28 @@ const onDelete = (key: string) => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<SpendingGroupManager :refreshData="refreshData" />
|
<div class="base-page">
|
||||||
<a-table :dataSource="state" :columns="columns" v-if="isReady">
|
<h1>Группы расходов</h1>
|
||||||
<template #bodyCell="{ column, record }">
|
<SpendingGroupManager :refreshData="refreshData" />
|
||||||
<template v-if="column.key === 'plans'">
|
<a-table :dataSource="state" :columns="columns" v-if="isReady">
|
||||||
<RouterLink :to="{ name: 'plans', params: { groupId: record.id } }" >Планы</RouterLink>
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="column.key === 'plans'">
|
||||||
|
<RouterLink :to="{ name: 'plans', params: { groupId: record.id } }" >Планы</RouterLink>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="column.dataIndex === 'operation'">
|
||||||
|
<a-popconfirm
|
||||||
|
v-if="state?.length"
|
||||||
|
title="Точно удалить?"
|
||||||
|
@confirm="onDelete(record.id)"
|
||||||
|
>
|
||||||
|
<a><DeleteOutlined /> Удалить</a>
|
||||||
|
</a-popconfirm>
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="column.dataIndex === 'operation'">
|
</a-table>
|
||||||
<a-popconfirm
|
<div v-else>
|
||||||
v-if="state?.length"
|
<a-spin size="large" />
|
||||||
title="Точно удалить?"
|
</div>
|
||||||
@confirm="onDelete(record.id)"
|
|
||||||
>
|
|
||||||
<a><DeleteOutlined /> Удалить</a>
|
|
||||||
</a-popconfirm>
|
|
||||||
</template>
|
|
||||||
</template>
|
|
||||||
</a-table>
|
|
||||||
<div v-else>
|
|
||||||
<a-spin size="large" />
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -47,25 +47,30 @@ const onDelete = (key: string) => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<ChangeRecordMenu :refreshData="refreshData" />
|
<div class="base-page">
|
||||||
<a-table :dataSource="state" :columns="columns" v-if="isReady" >
|
<h1>История изменений баланса</h1>
|
||||||
<template #bodyCell="{ column, record }">
|
<ChangeRecordMenu :refreshData="refreshData" />
|
||||||
<template v-if="column.dataIndex === 'operation'">
|
<a-table :dataSource="state" :columns="columns" v-if="isReady" >
|
||||||
<a-popconfirm
|
<template #bodyCell="{ column, record }">
|
||||||
v-if="state?.length"
|
<template v-if="column.dataIndex === 'operation'">
|
||||||
title="Точно удалить?"
|
<a-popconfirm
|
||||||
@confirm="onDelete(record.id)"
|
v-if="state?.length"
|
||||||
>
|
title="Точно удалить?"
|
||||||
<a><DeleteOutlined /> Удалить</a>
|
@confirm="onDelete(record.id)"
|
||||||
</a-popconfirm>
|
>
|
||||||
|
<a><DeleteOutlined /> Удалить</a>
|
||||||
|
</a-popconfirm>
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</a-table>
|
||||||
</a-table>
|
<div v-else>
|
||||||
<div v-else>
|
<a-spin size="large" />
|
||||||
<a-spin size="large" />
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.layout {
|
||||||
|
|
||||||
|
}
|
||||||
</style>
|
</style>
|
@ -52,23 +52,25 @@ const onDelete = (key: string) => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<h1>Планы группы </h1>
|
<div class="base-page">
|
||||||
<PlanManager :groupId="groupId" :refreshData="refreshData"/>
|
<h1>Планы группы</h1>
|
||||||
<a-table :dataSource="state" :columns="columns" v-if="isReady">
|
<PlanManager :groupId="groupId" :refreshData="refreshData"/>
|
||||||
<template #bodyCell="{ column, record }">
|
<a-table :dataSource="state" :columns="columns" v-if="isReady">
|
||||||
<template v-if="column.dataIndex === 'operation'">
|
<template #bodyCell="{ column, record }">
|
||||||
<a-popconfirm
|
<template v-if="column.dataIndex === 'operation'">
|
||||||
v-if="state?.length"
|
<a-popconfirm
|
||||||
title="Точно удалить?"
|
v-if="state?.length"
|
||||||
@confirm="onDelete(record.id)"
|
title="Точно удалить?"
|
||||||
>
|
@confirm="onDelete(record.id)"
|
||||||
<a><DeleteOutlined /> Удалить</a>
|
>
|
||||||
</a-popconfirm>
|
<a><DeleteOutlined /> Удалить</a>
|
||||||
|
</a-popconfirm>
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</a-table>
|
||||||
</a-table>
|
<div v-else>
|
||||||
<div v-else>
|
<a-spin size="large" />
|
||||||
<a-spin size="large" />
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
label="Группа расходов"
|
label="Группа расходов"
|
||||||
name="spendingGroupId"
|
name="spendingGroupId"
|
||||||
v-if="isReady"
|
v-if="isReady"
|
||||||
|
:rules="[{ required: true, message: 'Пожалуйста, выберите группу расходов' }]"
|
||||||
>
|
>
|
||||||
|
|
||||||
<a-select v-model:value="formState.spendingGroupId" :disabled="disabled">
|
<a-select v-model:value="formState.spendingGroupId" :disabled="disabled">
|
||||||
@ -35,12 +36,13 @@
|
|||||||
<a-form-item
|
<a-form-item
|
||||||
name="changedAt"
|
name="changedAt"
|
||||||
label="Дата"
|
label="Дата"
|
||||||
|
:rules="[{ required: true, message: 'Пожалуйста, выберите дату' }]"
|
||||||
>
|
>
|
||||||
<a-date-picker v-model:value="pickedChangedAt" />
|
<a-date-picker v-model:value="pickedChangedAt" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
<a-form-item>
|
<a-form-item>
|
||||||
<a-button html-type="submit" type="primary">Сохранить</a-button>
|
<a-button html-type="submit" :disabled="disabledForm" type="primary">Сохранить</a-button>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
</a-space>
|
</a-space>
|
||||||
@ -49,7 +51,6 @@
|
|||||||
import { computed, inject, reactive, ref } from 'vue';
|
import { computed, inject, reactive, ref } from 'vue';
|
||||||
import { ChangeRecordDto, SpendingGroupViewModel } from '../../core/api/data-contracts';
|
import { ChangeRecordDto, SpendingGroupViewModel } from '../../core/api/data-contracts';
|
||||||
import { useUserStore } from '../../store';
|
import { useUserStore } from '../../store';
|
||||||
import router from '../../router';
|
|
||||||
import { ChangeRecordService } from '../../core/services/change-record-service';
|
import { ChangeRecordService } from '../../core/services/change-record-service';
|
||||||
import { GroupService } from '../../core/services/group-service';
|
import { GroupService } from '../../core/services/group-service';
|
||||||
import { useAsyncState } from '@vueuse/core';
|
import { useAsyncState } from '@vueuse/core';
|
||||||
@ -70,7 +71,7 @@ const { state: groupList, isReady } = useAsyncState(() => groupService.getList()
|
|||||||
const pickedChangedAt = ref<Dayjs>();
|
const pickedChangedAt = ref<Dayjs>();
|
||||||
const formState = reactive<ChangeRecordDto>({
|
const formState = reactive<ChangeRecordDto>({
|
||||||
userId: store.user.id,
|
userId: store.user.id,
|
||||||
sum: 0,
|
sum: -1,
|
||||||
changedAt: new Date().toISOString(),
|
changedAt: new Date().toISOString(),
|
||||||
spendingGroupId: null
|
spendingGroupId: null
|
||||||
});
|
});
|
||||||
@ -88,5 +89,7 @@ const onFinishFailed = (errorInfo: any) => {
|
|||||||
const disabled = computed(() => {
|
const disabled = computed(() => {
|
||||||
return formState.sum && formState.sum >= 0;
|
return formState.sum && formState.sum >= 0;
|
||||||
});
|
});
|
||||||
|
const disabledForm = computed(() => {
|
||||||
|
return !(formState.sum && formState.changedAt && (formState.spendingGroupId || formState.sum > 0));
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
@ -33,15 +33,14 @@
|
|||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
<a-form-item>
|
<a-form-item>
|
||||||
<a-button html-type="submit" type="primary">Добавить</a-button>
|
<a-button :disabled="disabledForm" html-type="submit" type="primary">Добавить</a-button>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
</a-space>
|
</a-space>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { inject, reactive, ref } from 'vue';
|
import { computed, inject, reactive, ref } from 'vue';
|
||||||
import { SpendingPlanDto } from '../../core/api/data-contracts';
|
import { SpendingPlanDto } from '../../core/api/data-contracts';
|
||||||
import { ChangeRecordService } from '../../core/services/change-record-service';
|
|
||||||
import { Dayjs } from 'dayjs';
|
import { Dayjs } from 'dayjs';
|
||||||
import { PlanService } from '../../core/services/plans-service';
|
import { PlanService } from '../../core/services/plans-service';
|
||||||
|
|
||||||
@ -74,4 +73,8 @@ const onFinish = async (values: any) => {
|
|||||||
const onFinishFailed = (errorInfo: any) => {
|
const onFinishFailed = (errorInfo: any) => {
|
||||||
console.log('Failed:', errorInfo);
|
console.log('Failed:', errorInfo);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const disabledForm = computed(() => {
|
||||||
|
return !(formState.sum && formState.startAt && formState.endAt);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -15,13 +15,13 @@
|
|||||||
<a-input v-model:value="formState.name" />
|
<a-input v-model:value="formState.name" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item>
|
<a-form-item>
|
||||||
<a-button html-type="submit" type="primary">Сохранить</a-button>
|
<a-button :disabled="disabledForm" html-type="submit" type="primary">Сохранить</a-button>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
</a-space>
|
</a-space>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { inject, reactive } from 'vue';
|
import { computed, inject, reactive } from 'vue';
|
||||||
import { useUserStore } from '../../store';
|
import { useUserStore } from '../../store';
|
||||||
import { GroupService } from '../../core/services/group-service';
|
import { GroupService } from '../../core/services/group-service';
|
||||||
import { SpendingGroupDto } from '../../core/api/data-contracts';
|
import { SpendingGroupDto } from '../../core/api/data-contracts';
|
||||||
@ -50,4 +50,8 @@ const onFinish = async (values: any) => {
|
|||||||
const onFinishFailed = (errorInfo: any) => {
|
const onFinishFailed = (errorInfo: any) => {
|
||||||
console.log('Failed:', errorInfo);
|
console.log('Failed:', errorInfo);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const disabledForm = computed(() => {
|
||||||
|
return !formState.name;
|
||||||
|
});
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue
Block a user