del: clean template
This commit is contained in:
@@ -1,95 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import Table from "../table/Table.vue";
|
||||
import { onMounted, reactive } from "vue";
|
||||
import { getDefaultValues } from "../utils/structs/defaults.util";
|
||||
import Service from "./customer.service";
|
||||
import type { Scheme } from "../types/scheme.type";
|
||||
import { Customer } from "../../bindings/app/internal/services";
|
||||
import { ref } from "vue";
|
||||
import type { Validate } from "../types/validate.type";
|
||||
import { getDefaultSortOptions } from "../utils/structs/default-sort-options.util";
|
||||
|
||||
import OrderService from "../order/order.service";
|
||||
const orderService = new OrderService();
|
||||
|
||||
const service = new Service();
|
||||
|
||||
const items = ref<Customer[]>([]);
|
||||
|
||||
const load = async () => {
|
||||
(scheme as any).Orders.type!.nested!.values = await orderService.readAll();
|
||||
|
||||
items.value = await service.sort(sortOptions.value);
|
||||
return items.value;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
load();
|
||||
});
|
||||
|
||||
const scheme: Scheme<Customer> = reactive({
|
||||
entityId: "CustomerId",
|
||||
|
||||
Id: {
|
||||
russian: "ID",
|
||||
readonly: true,
|
||||
type: {
|
||||
primitive: "number",
|
||||
},
|
||||
},
|
||||
|
||||
Title: {
|
||||
russian: "Название",
|
||||
type: {
|
||||
primitive: "string",
|
||||
},
|
||||
},
|
||||
|
||||
Contact: {
|
||||
russian: "Контакт",
|
||||
type: {
|
||||
primitive: "string",
|
||||
},
|
||||
},
|
||||
|
||||
Orders: {
|
||||
hidden: true,
|
||||
many: true,
|
||||
type: {
|
||||
nested: {
|
||||
values: [],
|
||||
field: [""],
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const getDefaults = () => getDefaultValues(scheme);
|
||||
|
||||
const validate: Validate<Customer> = (entity) => {
|
||||
return {
|
||||
status: "success",
|
||||
};
|
||||
};
|
||||
|
||||
const search = async (input: string) => {
|
||||
items.value = await service.search(input);
|
||||
};
|
||||
|
||||
const sortOptions = ref(getDefaultSortOptions(scheme));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<main class="w-screen h-screen">
|
||||
<Table
|
||||
:scheme
|
||||
:service
|
||||
:get-defaults
|
||||
:load
|
||||
:items
|
||||
:validate
|
||||
@on-search="search"
|
||||
v-model:sort-options="sortOptions"
|
||||
></Table>
|
||||
</main>
|
||||
</template>
|
||||
@@ -1,52 +0,0 @@
|
||||
import {
|
||||
GetAll,
|
||||
Create,
|
||||
Delete,
|
||||
GetById,
|
||||
Update,
|
||||
Count,
|
||||
SortedByOrder,
|
||||
SearchByAllTextFields,
|
||||
} from "../../bindings/app/internal/services/customerservice";
|
||||
import type { Customer } from "../../bindings/app/internal/services";
|
||||
import type { IService } from "../types/service.type";
|
||||
import type { SortOptions } from "../types/sort-options.type";
|
||||
|
||||
export default class CustomerService implements IService<Customer> {
|
||||
async read(id: number) {
|
||||
return (await GetById(id)) as Customer;
|
||||
}
|
||||
|
||||
async readAll() {
|
||||
return (await GetAll()) as Customer[];
|
||||
}
|
||||
|
||||
async create(item: Customer) {
|
||||
await Create(item);
|
||||
}
|
||||
|
||||
async delete(id: number) {
|
||||
return await Delete(id);
|
||||
}
|
||||
|
||||
async update(item: Customer) {
|
||||
await Update(item);
|
||||
}
|
||||
|
||||
async count() {
|
||||
return await Count();
|
||||
}
|
||||
|
||||
async search(input: string) {
|
||||
return (await SearchByAllTextFields(input)) as Customer[];
|
||||
}
|
||||
|
||||
async sort(options: SortOptions<Customer>) {
|
||||
return (await SortedByOrder(
|
||||
Object.entries(options).map((item) => ({
|
||||
Name: item[0],
|
||||
Order: item[1],
|
||||
})),
|
||||
)) as Customer[];
|
||||
}
|
||||
}
|
||||
@@ -1,165 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import Table from "../table/Table.vue";
|
||||
import { onMounted, reactive } from "vue";
|
||||
import { getDefaultValues } from "../utils/structs/defaults.util";
|
||||
import Service from "./order.service";
|
||||
import type { Scheme } from "../types/scheme.type";
|
||||
import { Order } from "../../bindings/app/internal/services";
|
||||
import { ref } from "vue";
|
||||
import type { Validate } from "../types/validate.type";
|
||||
import { getDefaultSortOptions } from "../utils/structs/default-sort-options.util";
|
||||
|
||||
import ProducttypeService from "../producttype/producttype.service";
|
||||
const producttypeService = new ProducttypeService();
|
||||
|
||||
import CustomerService from "../customer/customer.service";
|
||||
const customerService = new CustomerService();
|
||||
|
||||
import TaskService from "../task/task.service";
|
||||
const taskService = new TaskService();
|
||||
|
||||
const service = new Service();
|
||||
|
||||
const items = ref<Order[]>([]);
|
||||
|
||||
const load = async () => {
|
||||
(scheme as any).ProductType.type!.nested!.values =
|
||||
await producttypeService.readAll();
|
||||
|
||||
(scheme as any).Customer.type!.nested!.values =
|
||||
await customerService.readAll();
|
||||
|
||||
(scheme as any).Tasks.type!.nested!.values = await taskService.readAll();
|
||||
|
||||
items.value = await service.sort(sortOptions.value);
|
||||
return items.value;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
load();
|
||||
});
|
||||
|
||||
const scheme: Scheme<Order> = reactive({
|
||||
entityId: "OrderId",
|
||||
|
||||
Id: {
|
||||
russian: "ID",
|
||||
readonly: true,
|
||||
type: {
|
||||
primitive: "number",
|
||||
},
|
||||
},
|
||||
|
||||
Status: {
|
||||
russian: "Статус",
|
||||
type: {
|
||||
primitive: "string",
|
||||
},
|
||||
},
|
||||
|
||||
Description: {
|
||||
russian: "Описание",
|
||||
type: {
|
||||
primitive: "string",
|
||||
},
|
||||
},
|
||||
|
||||
ProductTypeId: {
|
||||
hidden: true,
|
||||
type: {
|
||||
primitive: "number",
|
||||
},
|
||||
},
|
||||
|
||||
ProductType: {
|
||||
russian: "Тип",
|
||||
type: {
|
||||
nested: {
|
||||
values: [],
|
||||
field: ["Name"],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
ProductAmount: {
|
||||
russian: "Количество продукции",
|
||||
type: {
|
||||
primitive: "number",
|
||||
},
|
||||
},
|
||||
|
||||
CustomerId: {
|
||||
hidden: true,
|
||||
type: {
|
||||
primitive: "number",
|
||||
},
|
||||
},
|
||||
|
||||
Customer: {
|
||||
russian: "Клиент",
|
||||
type: {
|
||||
nested: {
|
||||
values: [],
|
||||
field: ["Title"],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Tasks: {
|
||||
hidden: true,
|
||||
many: true,
|
||||
type: {
|
||||
nested: {
|
||||
values: [],
|
||||
field: [""],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
CreatedAt: {
|
||||
russian: "Дата создания",
|
||||
readonly: true,
|
||||
date: true,
|
||||
type: {
|
||||
primitive: "date",
|
||||
},
|
||||
},
|
||||
|
||||
DeadlineDate: {
|
||||
russian: "Крайний срок",
|
||||
date: true,
|
||||
type: {
|
||||
primitive: "date",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const getDefaults = () => getDefaultValues(scheme);
|
||||
|
||||
const validate: Validate<Order> = (entity) => {
|
||||
return {
|
||||
status: "success",
|
||||
};
|
||||
};
|
||||
|
||||
const search = async (input: string) => {
|
||||
items.value = await service.search(input);
|
||||
};
|
||||
|
||||
const sortOptions = ref(getDefaultSortOptions(scheme));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<main class="w-screen h-screen">
|
||||
<Table
|
||||
:scheme
|
||||
:service
|
||||
:get-defaults
|
||||
:load
|
||||
:items
|
||||
:validate
|
||||
@on-search="search"
|
||||
v-model:sort-options="sortOptions"
|
||||
></Table>
|
||||
</main>
|
||||
</template>
|
||||
@@ -1,52 +0,0 @@
|
||||
import {
|
||||
GetAll,
|
||||
Create,
|
||||
Delete,
|
||||
GetById,
|
||||
Update,
|
||||
Count,
|
||||
SortedByOrder,
|
||||
SearchByAllTextFields,
|
||||
} from "../../bindings/app/internal/services/orderservice";
|
||||
import type { Order } from "../../bindings/app/internal/services";
|
||||
import type { IService } from "../types/service.type";
|
||||
import type { SortOptions } from "../types/sort-options.type";
|
||||
|
||||
export default class OrderService implements IService<Order> {
|
||||
async read(id: number) {
|
||||
return (await GetById(id)) as Order;
|
||||
}
|
||||
|
||||
async readAll() {
|
||||
return (await GetAll()) as Order[];
|
||||
}
|
||||
|
||||
async create(item: Order) {
|
||||
await Create(item);
|
||||
}
|
||||
|
||||
async delete(id: number) {
|
||||
return await Delete(id);
|
||||
}
|
||||
|
||||
async update(item: Order) {
|
||||
await Update(item);
|
||||
}
|
||||
|
||||
async count() {
|
||||
return await Count();
|
||||
}
|
||||
|
||||
async search(input: string) {
|
||||
return (await SearchByAllTextFields(input)) as Order[];
|
||||
}
|
||||
|
||||
async sort(options: SortOptions<Order>) {
|
||||
return (await SortedByOrder(
|
||||
Object.entries(options).map((item) => ({
|
||||
Name: item[0],
|
||||
Order: item[1],
|
||||
})),
|
||||
)) as Order[];
|
||||
}
|
||||
}
|
||||
@@ -35,9 +35,6 @@
|
||||
<!--</template>-->
|
||||
|
||||
<template>
|
||||
<TaskScheme></TaskScheme>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import ProducttypeScheme from "../producttype/ProducttypeScheme.vue";
|
||||
import TaskScheme from "../task/TaskScheme.vue";
|
||||
</script>
|
||||
@@ -1,141 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import Table from "../table/Table.vue";
|
||||
import { onMounted, reactive } from "vue";
|
||||
import { getDefaultValues } from "../utils/structs/defaults.util";
|
||||
import Service from "./preptask.service";
|
||||
import type { Scheme } from "../types/scheme.type";
|
||||
import { PrepTask } from "../../bindings/app/internal/services";
|
||||
import { ref } from "vue";
|
||||
import type { Validate } from "../types/validate.type";
|
||||
import { getDefaultSortOptions } from "../utils/structs/default-sort-options.util";
|
||||
|
||||
import TaskService from "../task/task.service";
|
||||
const taskService = new TaskService();
|
||||
|
||||
import WorkareaService from "../workarea/workarea.service";
|
||||
const workareaService = new WorkareaService();
|
||||
|
||||
const service = new Service();
|
||||
|
||||
const items = ref<PrepTask[]>([]);
|
||||
|
||||
const load = async () => {
|
||||
(scheme as any).Task.type!.nested!.values = await taskService.readAll();
|
||||
|
||||
(scheme as any).WorkArea.type!.nested!.values =
|
||||
await workareaService.readAll();
|
||||
|
||||
items.value = await service.sort(sortOptions.value);
|
||||
return items.value;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
load();
|
||||
});
|
||||
|
||||
const scheme: Scheme<PrepTask> = reactive({
|
||||
entityId: "PrepTaskId",
|
||||
|
||||
Id: {
|
||||
russian: "ID",
|
||||
readonly: true,
|
||||
type: {
|
||||
primitive: "number",
|
||||
},
|
||||
},
|
||||
|
||||
Status: {
|
||||
russian: "Статус",
|
||||
type: {
|
||||
primitive: "string",
|
||||
},
|
||||
},
|
||||
|
||||
Description: {
|
||||
russian: "Описание",
|
||||
type: {
|
||||
primitive: "string",
|
||||
},
|
||||
},
|
||||
|
||||
TaskId: {
|
||||
hidden: true,
|
||||
type: {
|
||||
primitive: "number",
|
||||
},
|
||||
},
|
||||
|
||||
Task: {
|
||||
russian: "Задача",
|
||||
type: {
|
||||
nested: {
|
||||
values: [],
|
||||
field: ["Description"],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
WorkAreaId: {
|
||||
hidden: true,
|
||||
type: {
|
||||
primitive: "number",
|
||||
},
|
||||
},
|
||||
|
||||
WorkArea: {
|
||||
russian: "Рабочая зона",
|
||||
type: {
|
||||
nested: {
|
||||
values: [],
|
||||
field: ["Name"],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
CreatedAt: {
|
||||
russian: "Дата создания",
|
||||
readonly: true,
|
||||
date: true,
|
||||
type: {
|
||||
primitive: "date",
|
||||
},
|
||||
},
|
||||
|
||||
Deadline: {
|
||||
russian: "Крайний срок",
|
||||
date: true,
|
||||
type: {
|
||||
primitive: "date",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const getDefaults = () => getDefaultValues(scheme);
|
||||
|
||||
const validate: Validate<PrepTask> = (entity) => {
|
||||
return {
|
||||
status: "success",
|
||||
};
|
||||
};
|
||||
|
||||
const search = async (input: string) => {
|
||||
items.value = await service.search(input);
|
||||
};
|
||||
|
||||
const sortOptions = ref(getDefaultSortOptions(scheme));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<main class="w-screen h-screen">
|
||||
<Table
|
||||
:scheme
|
||||
:service
|
||||
:get-defaults
|
||||
:load
|
||||
:items
|
||||
:validate
|
||||
@on-search="search"
|
||||
v-model:sort-options="sortOptions"
|
||||
></Table>
|
||||
</main>
|
||||
</template>
|
||||
@@ -1,52 +0,0 @@
|
||||
import {
|
||||
GetAll,
|
||||
Create,
|
||||
Delete,
|
||||
GetById,
|
||||
Update,
|
||||
Count,
|
||||
SortedByOrder,
|
||||
SearchByAllTextFields,
|
||||
} from "../../bindings/app/internal/services/preptaskservice";
|
||||
import type { PrepTask } from "../../bindings/app/internal/services";
|
||||
import type { IService } from "../types/service.type";
|
||||
import type { SortOptions } from "../types/sort-options.type";
|
||||
|
||||
export default class PrepTaskService implements IService<PrepTask> {
|
||||
async read(id: number) {
|
||||
return (await GetById(id)) as PrepTask;
|
||||
}
|
||||
|
||||
async readAll() {
|
||||
return (await GetAll()) as PrepTask[];
|
||||
}
|
||||
|
||||
async create(item: PrepTask) {
|
||||
await Create(item);
|
||||
}
|
||||
|
||||
async delete(id: number) {
|
||||
return await Delete(id);
|
||||
}
|
||||
|
||||
async update(item: PrepTask) {
|
||||
await Update(item);
|
||||
}
|
||||
|
||||
async count() {
|
||||
return await Count();
|
||||
}
|
||||
|
||||
async search(input: string) {
|
||||
return (await SearchByAllTextFields(input)) as PrepTask[];
|
||||
}
|
||||
|
||||
async sort(options: SortOptions<PrepTask>) {
|
||||
return (await SortedByOrder(
|
||||
Object.entries(options).map((item) => ({
|
||||
Name: item[0],
|
||||
Order: item[1],
|
||||
})),
|
||||
)) as PrepTask[];
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import Table from "../table/Table.vue";
|
||||
import { onMounted, reactive } from "vue";
|
||||
import { getDefaultValues } from "../utils/structs/defaults.util";
|
||||
import Service from "./producttype.service";
|
||||
import type { Scheme } from "../types/scheme.type";
|
||||
import { ProductType } from "../../bindings/app/internal/services";
|
||||
import { ref } from "vue";
|
||||
import type { Validate } from "../types/validate.type";
|
||||
import { getDefaultSortOptions } from "../utils/structs/default-sort-options.util";
|
||||
|
||||
const service = new Service();
|
||||
|
||||
const items = ref<ProductType[]>([]);
|
||||
|
||||
const load = async () => {
|
||||
items.value = await service.sort(sortOptions.value);
|
||||
return items.value;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
load();
|
||||
});
|
||||
|
||||
const scheme: Scheme<ProductType> = reactive({
|
||||
entityId: "ProductTypeId",
|
||||
|
||||
Id: {
|
||||
russian: "ID",
|
||||
readonly: true,
|
||||
type: {
|
||||
primitive: "number",
|
||||
},
|
||||
},
|
||||
|
||||
Name: {
|
||||
russian: "Название",
|
||||
type: {
|
||||
primitive: "string",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const getDefaults = () => getDefaultValues(scheme);
|
||||
|
||||
const validate: Validate<ProductType> = (entity) => {
|
||||
return {
|
||||
status: "success",
|
||||
};
|
||||
};
|
||||
|
||||
const search = async (input: string) => {
|
||||
items.value = await service.search(input);
|
||||
};
|
||||
|
||||
const sortOptions = ref(getDefaultSortOptions(scheme));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<main class="w-screen h-screen">
|
||||
<Table
|
||||
:scheme
|
||||
:service
|
||||
:get-defaults
|
||||
:load
|
||||
:items
|
||||
:validate
|
||||
@on-search="search"
|
||||
v-model:sort-options="sortOptions"
|
||||
></Table>
|
||||
</main>
|
||||
</template>
|
||||
@@ -1,52 +0,0 @@
|
||||
import {
|
||||
GetAll,
|
||||
Create,
|
||||
Delete,
|
||||
GetById,
|
||||
Update,
|
||||
Count,
|
||||
SortedByOrder,
|
||||
SearchByAllTextFields,
|
||||
} from "../../bindings/app/internal/services/producttypeservice";
|
||||
import type { ProductType } from "../../bindings/app/internal/services";
|
||||
import type { IService } from "../types/service.type";
|
||||
import type { SortOptions } from "../types/sort-options.type";
|
||||
|
||||
export default class ProductTypeService implements IService<ProductType> {
|
||||
async read(id: number) {
|
||||
return (await GetById(id)) as ProductType;
|
||||
}
|
||||
|
||||
async readAll() {
|
||||
return (await GetAll()) as ProductType[];
|
||||
}
|
||||
|
||||
async create(item: ProductType) {
|
||||
await Create(item);
|
||||
}
|
||||
|
||||
async delete(id: number) {
|
||||
return await Delete(id);
|
||||
}
|
||||
|
||||
async update(item: ProductType) {
|
||||
await Update(item);
|
||||
}
|
||||
|
||||
async count() {
|
||||
return await Count();
|
||||
}
|
||||
|
||||
async search(input: string) {
|
||||
return (await SearchByAllTextFields(input)) as ProductType[];
|
||||
}
|
||||
|
||||
async sort(options: SortOptions<ProductType>) {
|
||||
return (await SortedByOrder(
|
||||
Object.entries(options).map((item) => ({
|
||||
Name: item[0],
|
||||
Order: item[1],
|
||||
})),
|
||||
)) as ProductType[];
|
||||
}
|
||||
}
|
||||
@@ -1,140 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import Table from "../table/Table.vue";
|
||||
import { onMounted, reactive } from "vue";
|
||||
import { getDefaultValues } from "../utils/structs/defaults.util";
|
||||
import Service from "./shift.service";
|
||||
import type { Scheme } from "../types/scheme.type";
|
||||
import { Shift } from "../../bindings/app/internal/services";
|
||||
import { ref } from "vue";
|
||||
import type { Validate } from "../types/validate.type";
|
||||
import { getDefaultSortOptions } from "../utils/structs/default-sort-options.util";
|
||||
|
||||
import ProducttypeService from "../producttype/producttype.service";
|
||||
const producttypeService = new ProducttypeService();
|
||||
|
||||
import WorkareaService from "../workarea/workarea.service";
|
||||
const workareaService = new WorkareaService();
|
||||
|
||||
const service = new Service();
|
||||
|
||||
const items = ref<Shift[]>([]);
|
||||
|
||||
const load = async () => {
|
||||
(scheme as any).ProductType.type!.nested!.values =
|
||||
await producttypeService.readAll();
|
||||
|
||||
(scheme as any).WorkArea.type!.nested!.values =
|
||||
await workareaService.readAll();
|
||||
|
||||
items.value = await service.sort(sortOptions.value);
|
||||
return items.value;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
load();
|
||||
});
|
||||
|
||||
const scheme: Scheme<Shift> = reactive({
|
||||
entityId: "ShiftId",
|
||||
|
||||
Id: {
|
||||
russian: "ID",
|
||||
readonly: true,
|
||||
type: {
|
||||
primitive: "number",
|
||||
},
|
||||
},
|
||||
|
||||
Description: {
|
||||
russian: "Описание",
|
||||
type: {
|
||||
primitive: "string",
|
||||
},
|
||||
},
|
||||
|
||||
ProductTypeId: {
|
||||
hidden: true,
|
||||
type: {
|
||||
primitive: "number",
|
||||
},
|
||||
},
|
||||
|
||||
ProductType: {
|
||||
type: {
|
||||
nested: {
|
||||
values: [],
|
||||
field: ["Name"],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
ProductAmount: {
|
||||
russian: "Количество продукции",
|
||||
type: {
|
||||
primitive: "number",
|
||||
},
|
||||
},
|
||||
|
||||
ShiftDate: {
|
||||
russian: "Дата смены",
|
||||
date: true,
|
||||
type: {
|
||||
primitive: "date",
|
||||
},
|
||||
},
|
||||
|
||||
WorkAreaId: {
|
||||
hidden: true,
|
||||
type: {
|
||||
primitive: "number",
|
||||
},
|
||||
},
|
||||
|
||||
WorkArea: {
|
||||
type: {
|
||||
nested: {
|
||||
values: [],
|
||||
field: ["Name"],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
CreatedAt: {
|
||||
russian: "Дата создания",
|
||||
readonly: true,
|
||||
date: true,
|
||||
type: {
|
||||
primitive: "date",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const getDefaults = () => getDefaultValues(scheme);
|
||||
|
||||
const validate: Validate<Shift> = (entity) => {
|
||||
return {
|
||||
status: "success",
|
||||
};
|
||||
};
|
||||
|
||||
const search = async (input: string) => {
|
||||
items.value = await service.search(input);
|
||||
};
|
||||
|
||||
const sortOptions = ref(getDefaultSortOptions(scheme));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<main class="w-screen h-screen">
|
||||
<Table
|
||||
:scheme
|
||||
:service
|
||||
:get-defaults
|
||||
:load
|
||||
:items
|
||||
:validate
|
||||
@on-search="search"
|
||||
v-model:sort-options="sortOptions"
|
||||
></Table>
|
||||
</main>
|
||||
</template>
|
||||
@@ -1,52 +0,0 @@
|
||||
import {
|
||||
GetAll,
|
||||
Create,
|
||||
Delete,
|
||||
GetById,
|
||||
Update,
|
||||
Count,
|
||||
SortedByOrder,
|
||||
SearchByAllTextFields,
|
||||
} from "../../bindings/app/internal/services/shiftservice";
|
||||
import type { Shift } from "../../bindings/app/internal/services";
|
||||
import type { IService } from "../types/service.type";
|
||||
import type { SortOptions } from "../types/sort-options.type";
|
||||
|
||||
export default class ShiftService implements IService<Shift> {
|
||||
async read(id: number) {
|
||||
return (await GetById(id)) as Shift;
|
||||
}
|
||||
|
||||
async readAll() {
|
||||
return (await GetAll()) as Shift[];
|
||||
}
|
||||
|
||||
async create(item: Shift) {
|
||||
await Create(item);
|
||||
}
|
||||
|
||||
async delete(id: number) {
|
||||
return await Delete(id);
|
||||
}
|
||||
|
||||
async update(item: Shift) {
|
||||
await Update(item);
|
||||
}
|
||||
|
||||
async count() {
|
||||
return await Count();
|
||||
}
|
||||
|
||||
async search(input: string) {
|
||||
return (await SearchByAllTextFields(input)) as Shift[];
|
||||
}
|
||||
|
||||
async sort(options: SortOptions<Shift>) {
|
||||
return (await SortedByOrder(
|
||||
Object.entries(options).map((item) => ({
|
||||
Name: item[0],
|
||||
Order: item[1],
|
||||
})),
|
||||
)) as Shift[];
|
||||
}
|
||||
}
|
||||
@@ -1,175 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import Table from "../table/Table.vue";
|
||||
import { onMounted, reactive } from "vue";
|
||||
import { getDefaultValues } from "../utils/structs/defaults.util";
|
||||
import Service from "./task.service";
|
||||
import type { Scheme } from "../types/scheme.type";
|
||||
import { Task } from "../../bindings/app/internal/services";
|
||||
import { ref } from "vue";
|
||||
import type { Validate } from "../types/validate.type";
|
||||
import { getDefaultSortOptions } from "../utils/structs/default-sort-options.util";
|
||||
|
||||
import ProducttypeService from "../producttype/producttype.service";
|
||||
const producttypeService = new ProducttypeService();
|
||||
|
||||
import WorkshopService from "../workshop/workshop.service";
|
||||
const workshopService = new WorkshopService();
|
||||
|
||||
import OrderService from "../order/order.service";
|
||||
const orderService = new OrderService();
|
||||
|
||||
import PreptaskService from "../preptask/preptask.service";
|
||||
const preptaskService = new PreptaskService();
|
||||
|
||||
const service = new Service();
|
||||
|
||||
const items = ref<Task[]>([]);
|
||||
|
||||
const load = async () => {
|
||||
(scheme as any).ProductType.type!.nested!.values =
|
||||
await producttypeService.readAll();
|
||||
|
||||
(scheme as any).Workshops.type!.nested!.values =
|
||||
await workshopService.readAll();
|
||||
|
||||
(scheme as any).Order.type!.nested!.values = await orderService.readAll();
|
||||
|
||||
(scheme as any).PrepTasks.type!.nested!.values =
|
||||
await preptaskService.readAll();
|
||||
|
||||
items.value = await service.sort(sortOptions.value);
|
||||
return items.value;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
load();
|
||||
});
|
||||
|
||||
const scheme: Scheme<Task> = reactive({
|
||||
entityId: "TaskId",
|
||||
|
||||
Id: {
|
||||
russian: "ID",
|
||||
readonly: true,
|
||||
type: {
|
||||
primitive: "number",
|
||||
},
|
||||
},
|
||||
|
||||
Description: {
|
||||
russian: "Описание",
|
||||
type: {
|
||||
primitive: "string",
|
||||
},
|
||||
},
|
||||
|
||||
ProductTypeId: {
|
||||
hidden: true,
|
||||
type: {
|
||||
primitive: "number",
|
||||
},
|
||||
},
|
||||
|
||||
ProductType: {
|
||||
russian: "Тип",
|
||||
type: {
|
||||
nested: {
|
||||
values: [],
|
||||
field: ["Name"],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Workshops: {
|
||||
hidden: true,
|
||||
many: true,
|
||||
type: {
|
||||
nested: {
|
||||
values: [],
|
||||
field: [""],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
OrderId: {
|
||||
hidden: true,
|
||||
type: {
|
||||
primitive: "number",
|
||||
},
|
||||
},
|
||||
|
||||
Order: {
|
||||
russian: "Заказ",
|
||||
type: {
|
||||
nested: {
|
||||
values: [],
|
||||
field: ["Description"],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
PrepTasks: {
|
||||
hidden: true,
|
||||
many: true,
|
||||
type: {
|
||||
nested: {
|
||||
values: [],
|
||||
field: [""],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
ProductionStart: {
|
||||
russian: "Дата начала производства",
|
||||
date: true,
|
||||
type: {
|
||||
primitive: "date",
|
||||
},
|
||||
},
|
||||
|
||||
CreatedAt: {
|
||||
russian: "Дата создания",
|
||||
readonly: true,
|
||||
date: true,
|
||||
type: {
|
||||
primitive: "date",
|
||||
},
|
||||
},
|
||||
|
||||
Amount: {
|
||||
russian: "Количество",
|
||||
type: {
|
||||
primitive: "number",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const getDefaults = () => getDefaultValues(scheme);
|
||||
|
||||
const validate: Validate<Task> = (entity) => {
|
||||
return {
|
||||
status: "success",
|
||||
};
|
||||
};
|
||||
|
||||
const search = async (input: string) => {
|
||||
items.value = await service.search(input);
|
||||
};
|
||||
|
||||
const sortOptions = ref(getDefaultSortOptions(scheme));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<main class="w-screen h-screen">
|
||||
<Table
|
||||
:scheme
|
||||
:service
|
||||
:get-defaults
|
||||
:load
|
||||
:items
|
||||
:validate
|
||||
@on-search="search"
|
||||
v-model:sort-options="sortOptions"
|
||||
></Table>
|
||||
</main>
|
||||
</template>
|
||||
@@ -1,56 +0,0 @@
|
||||
import {
|
||||
GetAll,
|
||||
Create,
|
||||
Delete,
|
||||
GetById,
|
||||
Update,
|
||||
Count,
|
||||
SortedByOrder,
|
||||
SearchByAllTextFields,
|
||||
} from "../../bindings/app/internal/services/taskservice";
|
||||
import type { Task } from "../../bindings/app/internal/services";
|
||||
import type { IService } from "../types/service.type";
|
||||
import type { SortOptions } from "../types/sort-options.type";
|
||||
|
||||
export default class TaskService implements IService<Task> {
|
||||
async read(id: number) {
|
||||
return (await GetById(id)) as Task;
|
||||
}
|
||||
|
||||
async readAll() {
|
||||
return (await GetAll()) as Task[];
|
||||
}
|
||||
|
||||
async create(item: Task) {
|
||||
await Create(item);
|
||||
}
|
||||
|
||||
async delete(id: number) {
|
||||
return await Delete(id);
|
||||
}
|
||||
|
||||
async update(item: Task) {
|
||||
await Update(item);
|
||||
}
|
||||
|
||||
async count() {
|
||||
return await Count();
|
||||
}
|
||||
|
||||
async search(input: string) {
|
||||
return (await SearchByAllTextFields(input)) as Task[];
|
||||
}
|
||||
|
||||
async sort(options: SortOptions<Task>) {
|
||||
return (await SortedByOrder(
|
||||
Object.entries(options).map((item) => {
|
||||
if (item[1] !== 'NONE') {
|
||||
return ({
|
||||
Name: item[0],
|
||||
Order: item[1],
|
||||
})
|
||||
}
|
||||
}).filter(item => !!item)
|
||||
)) as Task[];
|
||||
}
|
||||
}
|
||||
@@ -1,157 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import Table from "../table/Table.vue";
|
||||
import { onMounted, reactive } from "vue";
|
||||
import { getDefaultValues } from "../utils/structs/defaults.util";
|
||||
import Service from "./teamtask.service";
|
||||
import type { Scheme } from "../types/scheme.type";
|
||||
import { TeamTask } from "../../bindings/app/internal/services";
|
||||
import { ref } from "vue";
|
||||
import type { Validate } from "../types/validate.type";
|
||||
import { getDefaultSortOptions } from "../utils/structs/default-sort-options.util";
|
||||
|
||||
import TeamtypeService from "../teamtype/teamtype.service";
|
||||
const teamtypeService = new TeamtypeService();
|
||||
|
||||
import WorkerService from "../worker/worker.service";
|
||||
const workerService = new WorkerService();
|
||||
|
||||
import WorkareaService from "../workarea/workarea.service";
|
||||
const workareaService = new WorkareaService();
|
||||
|
||||
const service = new Service();
|
||||
|
||||
const items = ref<TeamTask[]>([]);
|
||||
|
||||
const load = async () => {
|
||||
(scheme as any).TeamType.type!.nested!.values =
|
||||
await teamtypeService.readAll();
|
||||
|
||||
(scheme as any).TeamLeader.type!.nested!.values =
|
||||
await workerService.readAll();
|
||||
|
||||
(scheme as any).WorkArea.type!.nested!.values =
|
||||
await workareaService.readAll();
|
||||
|
||||
items.value = await service.sort(sortOptions.value);
|
||||
return items.value;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
load();
|
||||
});
|
||||
|
||||
const scheme: Scheme<TeamTask> = reactive({
|
||||
entityId: "TeamTaskId",
|
||||
|
||||
Id: {
|
||||
russian: "ID",
|
||||
readonly: true,
|
||||
type: {
|
||||
primitive: "number",
|
||||
},
|
||||
},
|
||||
|
||||
TeamTypeId: {
|
||||
hidden: true,
|
||||
type: {
|
||||
primitive: "number",
|
||||
},
|
||||
},
|
||||
|
||||
TeamType: {
|
||||
type: {
|
||||
nested: {
|
||||
values: [],
|
||||
field: ["Name"],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
TeamLeaderId: {
|
||||
hidden: true,
|
||||
type: {
|
||||
primitive: "number",
|
||||
},
|
||||
},
|
||||
|
||||
TeamLeader: {
|
||||
type: {
|
||||
nested: {
|
||||
values: [],
|
||||
field: ["Name"],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
TeamMembers: {
|
||||
hidden: true,
|
||||
many: true,
|
||||
type: {
|
||||
nested: {
|
||||
values: [],
|
||||
field: [""],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
WorkStartDate: {
|
||||
russian: "Дата начала работ",
|
||||
date: true,
|
||||
type: {
|
||||
primitive: "date",
|
||||
},
|
||||
},
|
||||
|
||||
WorkAreaId: {
|
||||
hidden: true,
|
||||
type: {
|
||||
primitive: "number",
|
||||
},
|
||||
},
|
||||
|
||||
WorkArea: {
|
||||
type: {
|
||||
nested: {
|
||||
values: [],
|
||||
field: ["Name"],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
ShiftDuties: {
|
||||
russian: "Обязанности смены",
|
||||
type: {
|
||||
primitive: "string",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const getDefaults = () => getDefaultValues(scheme);
|
||||
|
||||
const validate: Validate<TeamTask> = (entity) => {
|
||||
return {
|
||||
status: "success",
|
||||
};
|
||||
};
|
||||
|
||||
const search = async (input: string) => {
|
||||
items.value = await service.search(input);
|
||||
};
|
||||
|
||||
const sortOptions = ref(getDefaultSortOptions(scheme));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<main class="w-screen h-screen">
|
||||
<Table
|
||||
:scheme
|
||||
:service
|
||||
:get-defaults
|
||||
:load
|
||||
:items
|
||||
:validate
|
||||
@on-search="search"
|
||||
v-model:sort-options="sortOptions"
|
||||
></Table>
|
||||
</main>
|
||||
</template>
|
||||
@@ -1,52 +0,0 @@
|
||||
import {
|
||||
GetAll,
|
||||
Create,
|
||||
Delete,
|
||||
GetById,
|
||||
Update,
|
||||
Count,
|
||||
SortedByOrder,
|
||||
SearchByAllTextFields,
|
||||
} from "../../bindings/app/internal/services/teamtaskservice";
|
||||
import type { TeamTask } from "../../bindings/app/internal/services";
|
||||
import type { IService } from "../types/service.type";
|
||||
import type { SortOptions } from "../types/sort-options.type";
|
||||
|
||||
export default class TeamTaskService implements IService<TeamTask> {
|
||||
async read(id: number) {
|
||||
return (await GetById(id)) as TeamTask;
|
||||
}
|
||||
|
||||
async readAll() {
|
||||
return (await GetAll()) as TeamTask[];
|
||||
}
|
||||
|
||||
async create(item: TeamTask) {
|
||||
await Create(item);
|
||||
}
|
||||
|
||||
async delete(id: number) {
|
||||
return await Delete(id);
|
||||
}
|
||||
|
||||
async update(item: TeamTask) {
|
||||
await Update(item);
|
||||
}
|
||||
|
||||
async count() {
|
||||
return await Count();
|
||||
}
|
||||
|
||||
async search(input: string) {
|
||||
return (await SearchByAllTextFields(input)) as TeamTask[];
|
||||
}
|
||||
|
||||
async sort(options: SortOptions<TeamTask>) {
|
||||
return (await SortedByOrder(
|
||||
Object.entries(options).map((item) => ({
|
||||
Name: item[0],
|
||||
Order: item[1],
|
||||
})),
|
||||
)) as TeamTask[];
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import Table from "../table/Table.vue";
|
||||
import { onMounted, reactive } from "vue";
|
||||
import { getDefaultValues } from "../utils/structs/defaults.util";
|
||||
import Service from "./teamtype.service";
|
||||
import type { Scheme } from "../types/scheme.type";
|
||||
import { TeamType } from "../../bindings/app/internal/services";
|
||||
import { ref } from "vue";
|
||||
import type { Validate } from "../types/validate.type";
|
||||
import { getDefaultSortOptions } from "../utils/structs/default-sort-options.util";
|
||||
|
||||
const service = new Service();
|
||||
|
||||
const items = ref<TeamType[]>([]);
|
||||
|
||||
const load = async () => {
|
||||
items.value = await service.sort(sortOptions.value);
|
||||
return items.value;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
load();
|
||||
});
|
||||
|
||||
const scheme: Scheme<TeamType> = reactive({
|
||||
entityId: "TeamTypeId",
|
||||
|
||||
Id: {
|
||||
russian: "ID",
|
||||
readonly: true,
|
||||
type: {
|
||||
primitive: "number",
|
||||
},
|
||||
},
|
||||
|
||||
Name: {
|
||||
russian: "Название",
|
||||
type: {
|
||||
primitive: "string",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const getDefaults = () => getDefaultValues(scheme);
|
||||
|
||||
const validate: Validate<TeamType> = (entity) => {
|
||||
return {
|
||||
status: "success",
|
||||
};
|
||||
};
|
||||
|
||||
const search = async (input: string) => {
|
||||
items.value = await service.search(input);
|
||||
};
|
||||
|
||||
const sortOptions = ref(getDefaultSortOptions(scheme));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<main class="w-screen h-screen">
|
||||
<Table
|
||||
:scheme
|
||||
:service
|
||||
:get-defaults
|
||||
:load
|
||||
:items
|
||||
:validate
|
||||
@on-search="search"
|
||||
v-model:sort-options="sortOptions"
|
||||
></Table>
|
||||
</main>
|
||||
</template>
|
||||
@@ -1,52 +0,0 @@
|
||||
import {
|
||||
GetAll,
|
||||
Create,
|
||||
Delete,
|
||||
GetById,
|
||||
Update,
|
||||
Count,
|
||||
SortedByOrder,
|
||||
SearchByAllTextFields,
|
||||
} from "../../bindings/app/internal/services/teamtypeservice";
|
||||
import type { TeamType } from "../../bindings/app/internal/services";
|
||||
import type { IService } from "../types/service.type";
|
||||
import type { SortOptions } from "../types/sort-options.type";
|
||||
|
||||
export default class TeamTypeService implements IService<TeamType> {
|
||||
async read(id: number) {
|
||||
return (await GetById(id)) as TeamType;
|
||||
}
|
||||
|
||||
async readAll() {
|
||||
return (await GetAll()) as TeamType[];
|
||||
}
|
||||
|
||||
async create(item: TeamType) {
|
||||
await Create(item);
|
||||
}
|
||||
|
||||
async delete(id: number) {
|
||||
return await Delete(id);
|
||||
}
|
||||
|
||||
async update(item: TeamType) {
|
||||
await Update(item);
|
||||
}
|
||||
|
||||
async count() {
|
||||
return await Count();
|
||||
}
|
||||
|
||||
async search(input: string) {
|
||||
return (await SearchByAllTextFields(input)) as TeamType[];
|
||||
}
|
||||
|
||||
async sort(options: SortOptions<TeamType>) {
|
||||
return (await SortedByOrder(
|
||||
Object.entries(options).map((item) => ({
|
||||
Name: item[0],
|
||||
Order: item[1],
|
||||
})),
|
||||
)) as TeamType[];
|
||||
}
|
||||
}
|
||||
@@ -1,159 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import Table from "../table/Table.vue";
|
||||
import { onMounted, reactive } from "vue";
|
||||
import { getDefaultValues } from "../utils/structs/defaults.util";
|
||||
import Service from "./workarea.service";
|
||||
import type { Scheme } from "../types/scheme.type";
|
||||
import { WorkArea } from "../../bindings/app/internal/services";
|
||||
import { ref } from "vue";
|
||||
import type { Validate } from "../types/validate.type";
|
||||
import { getDefaultSortOptions } from "../utils/structs/default-sort-options.util";
|
||||
|
||||
import WorkshopService from "../workshop/workshop.service";
|
||||
const workshopService = new WorkshopService();
|
||||
|
||||
import PreptaskService from "../preptask/preptask.service";
|
||||
const preptaskService = new PreptaskService();
|
||||
|
||||
import ShiftService from "../shift/shift.service";
|
||||
const shiftService = new ShiftService();
|
||||
|
||||
import TeamtaskService from "../teamtask/teamtask.service";
|
||||
const teamtaskService = new TeamtaskService();
|
||||
|
||||
const service = new Service();
|
||||
|
||||
const items = ref<WorkArea[]>([]);
|
||||
|
||||
const load = async () => {
|
||||
(scheme as any).Workshop.type!.nested!.values =
|
||||
await workshopService.readAll();
|
||||
|
||||
(scheme as any).PrepTasks.type!.nested!.values =
|
||||
await preptaskService.readAll();
|
||||
|
||||
(scheme as any).Shifts.type!.nested!.values = await shiftService.readAll();
|
||||
|
||||
(scheme as any).TeamTasks.type!.nested!.values =
|
||||
await teamtaskService.readAll();
|
||||
|
||||
items.value = await service.sort(sortOptions.value);
|
||||
return items.value;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
load();
|
||||
});
|
||||
|
||||
const scheme: Scheme<WorkArea> = reactive({
|
||||
entityId: "WorkAreaId",
|
||||
|
||||
Id: {
|
||||
russian: "ID",
|
||||
readonly: true,
|
||||
type: {
|
||||
primitive: "number",
|
||||
},
|
||||
},
|
||||
|
||||
Name: {
|
||||
russian: "Наименование",
|
||||
type: {
|
||||
primitive: "string",
|
||||
},
|
||||
},
|
||||
|
||||
Description: {
|
||||
russian: "Описание",
|
||||
type: {
|
||||
primitive: "string",
|
||||
},
|
||||
},
|
||||
|
||||
Performance: {
|
||||
russian: "Производительность",
|
||||
type: {
|
||||
primitive: "number",
|
||||
},
|
||||
},
|
||||
|
||||
WorkshopId: {
|
||||
hidden: true,
|
||||
type: {
|
||||
primitive: "number",
|
||||
},
|
||||
},
|
||||
|
||||
Workshop: {
|
||||
russian: "Цех",
|
||||
type: {
|
||||
nested: {
|
||||
values: [],
|
||||
field: ["Name"],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
PrepTasks: {
|
||||
hidden: true,
|
||||
many: true,
|
||||
type: {
|
||||
nested: {
|
||||
values: [],
|
||||
field: [""],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Shifts: {
|
||||
hidden: true,
|
||||
many: true,
|
||||
type: {
|
||||
nested: {
|
||||
values: [],
|
||||
field: [""],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
TeamTasks: {
|
||||
hidden: true,
|
||||
many: true,
|
||||
type: {
|
||||
nested: {
|
||||
values: [],
|
||||
field: [""],
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const getDefaults = () => getDefaultValues(scheme);
|
||||
|
||||
const validate: Validate<WorkArea> = (entity) => {
|
||||
return {
|
||||
status: "success",
|
||||
};
|
||||
};
|
||||
|
||||
const search = async (input: string) => {
|
||||
items.value = await service.search(input);
|
||||
};
|
||||
|
||||
const sortOptions = ref(getDefaultSortOptions(scheme));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<main class="w-screen h-screen">
|
||||
<Table
|
||||
:scheme
|
||||
:service
|
||||
:get-defaults
|
||||
:load
|
||||
:items
|
||||
:validate
|
||||
@on-search="search"
|
||||
v-model:sort-options="sortOptions"
|
||||
></Table>
|
||||
</main>
|
||||
</template>
|
||||
@@ -1,52 +0,0 @@
|
||||
import {
|
||||
GetAll,
|
||||
Create,
|
||||
Delete,
|
||||
GetById,
|
||||
Update,
|
||||
Count,
|
||||
SortedByOrder,
|
||||
SearchByAllTextFields,
|
||||
} from "../../bindings/app/internal/services/workareaservice";
|
||||
import type { WorkArea } from "../../bindings/app/internal/services";
|
||||
import type { IService } from "../types/service.type";
|
||||
import type { SortOptions } from "../types/sort-options.type";
|
||||
|
||||
export default class WorkAreaService implements IService<WorkArea> {
|
||||
async read(id: number) {
|
||||
return (await GetById(id)) as WorkArea;
|
||||
}
|
||||
|
||||
async readAll() {
|
||||
return (await GetAll()) as WorkArea[];
|
||||
}
|
||||
|
||||
async create(item: WorkArea) {
|
||||
await Create(item);
|
||||
}
|
||||
|
||||
async delete(id: number) {
|
||||
return await Delete(id);
|
||||
}
|
||||
|
||||
async update(item: WorkArea) {
|
||||
await Update(item);
|
||||
}
|
||||
|
||||
async count() {
|
||||
return await Count();
|
||||
}
|
||||
|
||||
async search(input: string) {
|
||||
return (await SearchByAllTextFields(input)) as WorkArea[];
|
||||
}
|
||||
|
||||
async sort(options: SortOptions<WorkArea>) {
|
||||
return (await SortedByOrder(
|
||||
Object.entries(options).map((item) => ({
|
||||
Name: item[0],
|
||||
Order: item[1],
|
||||
})),
|
||||
)) as WorkArea[];
|
||||
}
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import Table from "../table/Table.vue";
|
||||
import { onMounted, reactive } from "vue";
|
||||
import { getDefaultValues } from "../utils/structs/defaults.util";
|
||||
import Service from "./worker.service";
|
||||
import type { Scheme } from "../types/scheme.type";
|
||||
import { Worker } from "../../bindings/app/internal/services";
|
||||
import { ref } from "vue";
|
||||
import type { Validate } from "../types/validate.type";
|
||||
import { getDefaultSortOptions } from "../utils/structs/default-sort-options.util";
|
||||
|
||||
import TeamtaskService from "../teamtask/teamtask.service";
|
||||
const teamtaskService = new TeamtaskService();
|
||||
|
||||
import WorkshopService from "../workshop/workshop.service";
|
||||
const workshopService = new WorkshopService();
|
||||
|
||||
const service = new Service();
|
||||
|
||||
const items = ref<Worker[]>([]);
|
||||
|
||||
const load = async () => {
|
||||
(scheme as any).TeamTasks.type!.nested!.values =
|
||||
await teamtaskService.readAll();
|
||||
|
||||
(scheme as any).Workshop.type!.nested!.values =
|
||||
await workshopService.readAll();
|
||||
|
||||
items.value = await service.sort(sortOptions.value);
|
||||
return items.value;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
load();
|
||||
});
|
||||
|
||||
const scheme: Scheme<Worker> = reactive({
|
||||
entityId: "WorkerId",
|
||||
|
||||
Id: {
|
||||
russian: "ID",
|
||||
readonly: true,
|
||||
type: {
|
||||
primitive: "number",
|
||||
},
|
||||
},
|
||||
|
||||
Name: {
|
||||
russian: "Имя",
|
||||
type: {
|
||||
primitive: "string",
|
||||
},
|
||||
},
|
||||
|
||||
TeamTasks: {
|
||||
hidden: true,
|
||||
many: true,
|
||||
type: {
|
||||
nested: {
|
||||
values: [],
|
||||
field: [""],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Workshop: {
|
||||
type: {
|
||||
nested: {
|
||||
values: [],
|
||||
field: ["Name"],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
WorkshopId: {
|
||||
hidden: true,
|
||||
type: {
|
||||
primitive: "number",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const getDefaults = () => getDefaultValues(scheme);
|
||||
|
||||
const validate: Validate<Worker> = (entity) => {
|
||||
return {
|
||||
status: "success",
|
||||
};
|
||||
};
|
||||
|
||||
const search = async (input: string) => {
|
||||
items.value = await service.search(input);
|
||||
};
|
||||
|
||||
const sortOptions = ref(getDefaultSortOptions(scheme));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<main class="w-screen h-screen">
|
||||
<Table
|
||||
:scheme
|
||||
:service
|
||||
:get-defaults
|
||||
:load
|
||||
:items
|
||||
:validate
|
||||
@on-search="search"
|
||||
v-model:sort-options="sortOptions"
|
||||
></Table>
|
||||
</main>
|
||||
</template>
|
||||
@@ -1,52 +0,0 @@
|
||||
import {
|
||||
GetAll,
|
||||
Create,
|
||||
Delete,
|
||||
GetById,
|
||||
Update,
|
||||
Count,
|
||||
SortedByOrder,
|
||||
SearchByAllTextFields,
|
||||
} from "../../bindings/app/internal/services/workerservice";
|
||||
import type { Worker } from "../../bindings/app/internal/services";
|
||||
import type { IService } from "../types/service.type";
|
||||
import type { SortOptions } from "../types/sort-options.type";
|
||||
|
||||
export default class WorkerService implements IService<Worker> {
|
||||
async read(id: number) {
|
||||
return (await GetById(id)) as Worker;
|
||||
}
|
||||
|
||||
async readAll() {
|
||||
return (await GetAll()) as Worker[];
|
||||
}
|
||||
|
||||
async create(item: Worker) {
|
||||
await Create(item);
|
||||
}
|
||||
|
||||
async delete(id: number) {
|
||||
return await Delete(id);
|
||||
}
|
||||
|
||||
async update(item: Worker) {
|
||||
await Update(item);
|
||||
}
|
||||
|
||||
async count() {
|
||||
return await Count();
|
||||
}
|
||||
|
||||
async search(input: string) {
|
||||
return (await SearchByAllTextFields(input)) as Worker[];
|
||||
}
|
||||
|
||||
async sort(options: SortOptions<Worker>) {
|
||||
return (await SortedByOrder(
|
||||
Object.entries(options).map((item) => ({
|
||||
Name: item[0],
|
||||
Order: item[1],
|
||||
})),
|
||||
)) as Worker[];
|
||||
}
|
||||
}
|
||||
@@ -1,121 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import Table from "../table/Table.vue";
|
||||
import { onMounted, reactive } from "vue";
|
||||
import { getDefaultValues } from "../utils/structs/defaults.util";
|
||||
import Service from "./workshop.service";
|
||||
import type { Scheme } from "../types/scheme.type";
|
||||
import { Workshop } from "../../bindings/app/internal/services";
|
||||
import { ref } from "vue";
|
||||
import type { Validate } from "../types/validate.type";
|
||||
import { getDefaultSortOptions } from "../utils/structs/default-sort-options.util";
|
||||
|
||||
import WorkareaService from "../workarea/workarea.service";
|
||||
const workareaService = new WorkareaService();
|
||||
|
||||
import TaskService from "../task/task.service";
|
||||
const taskService = new TaskService();
|
||||
|
||||
import WorkerService from "../worker/worker.service";
|
||||
const workerService = new WorkerService();
|
||||
|
||||
const service = new Service();
|
||||
|
||||
const items = ref<Workshop[]>([]);
|
||||
|
||||
const load = async () => {
|
||||
(scheme as any).WorkAreas.type!.nested!.values =
|
||||
await workareaService.readAll();
|
||||
|
||||
(scheme as any).Tasks.type!.nested!.values = await taskService.readAll();
|
||||
|
||||
(scheme as any).Workers.type!.nested!.values = await workerService.readAll();
|
||||
|
||||
items.value = await service.sort(sortOptions.value);
|
||||
return items.value;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
load();
|
||||
});
|
||||
|
||||
const scheme: Scheme<Workshop> = reactive({
|
||||
entityId: "WorkshopId",
|
||||
|
||||
Id: {
|
||||
russian: "ID",
|
||||
readonly: true,
|
||||
type: {
|
||||
primitive: "number",
|
||||
},
|
||||
},
|
||||
|
||||
Name: {
|
||||
russian: "Наименование",
|
||||
type: {
|
||||
primitive: "string",
|
||||
},
|
||||
},
|
||||
|
||||
WorkAreas: {
|
||||
hidden: true,
|
||||
many: true,
|
||||
type: {
|
||||
nested: {
|
||||
values: [],
|
||||
field: [""],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Tasks: {
|
||||
hidden: true,
|
||||
many: true,
|
||||
type: {
|
||||
nested: {
|
||||
values: [],
|
||||
field: [""],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Workers: {
|
||||
hidden: true,
|
||||
many: true,
|
||||
type: {
|
||||
nested: {
|
||||
values: [],
|
||||
field: [""],
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const getDefaults = () => getDefaultValues(scheme);
|
||||
|
||||
const validate: Validate<Workshop> = (entity) => {
|
||||
return {
|
||||
status: "success",
|
||||
};
|
||||
};
|
||||
|
||||
const search = async (input: string) => {
|
||||
items.value = await service.search(input);
|
||||
};
|
||||
|
||||
const sortOptions = ref(getDefaultSortOptions(scheme));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<main class="w-screen h-screen">
|
||||
<Table
|
||||
:scheme
|
||||
:service
|
||||
:get-defaults
|
||||
:load
|
||||
:items
|
||||
:validate
|
||||
@on-search="search"
|
||||
v-model:sort-options="sortOptions"
|
||||
></Table>
|
||||
</main>
|
||||
</template>
|
||||
@@ -1,52 +0,0 @@
|
||||
import {
|
||||
GetAll,
|
||||
Create,
|
||||
Delete,
|
||||
GetById,
|
||||
Update,
|
||||
Count,
|
||||
SortedByOrder,
|
||||
SearchByAllTextFields,
|
||||
} from "../../bindings/app/internal/services/workshopservice";
|
||||
import type { Workshop } from "../../bindings/app/internal/services";
|
||||
import type { IService } from "../types/service.type";
|
||||
import type { SortOptions } from "../types/sort-options.type";
|
||||
|
||||
export default class WorkshopService implements IService<Workshop> {
|
||||
async read(id: number) {
|
||||
return (await GetById(id)) as Workshop;
|
||||
}
|
||||
|
||||
async readAll() {
|
||||
return (await GetAll()) as Workshop[];
|
||||
}
|
||||
|
||||
async create(item: Workshop) {
|
||||
await Create(item);
|
||||
}
|
||||
|
||||
async delete(id: number) {
|
||||
return await Delete(id);
|
||||
}
|
||||
|
||||
async update(item: Workshop) {
|
||||
await Update(item);
|
||||
}
|
||||
|
||||
async count() {
|
||||
return await Count();
|
||||
}
|
||||
|
||||
async search(input: string) {
|
||||
return (await SearchByAllTextFields(input)) as Workshop[];
|
||||
}
|
||||
|
||||
async sort(options: SortOptions<Workshop>) {
|
||||
return (await SortedByOrder(
|
||||
Object.entries(options).map((item) => ({
|
||||
Name: item[0],
|
||||
Order: item[1],
|
||||
})),
|
||||
)) as Workshop[];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user