diff --git a/doc/ingredient.md b/doc/ingredient.md new file mode 100644 index 0000000..65250fc --- /dev/null +++ b/doc/ingredient.md @@ -0,0 +1,172 @@ + +# 食材部分 + +# 1. 查询食材 + +> GET /api/ingredient + +### 输入: +``` +pageSize=20 // 默认20, 全部非必填 +pageNo=0 // 默认0, 从0开始 +type=谷薯类 // 食材类型 +mark=常用 // 食材标记. 业务端用标记,管理端没用 +keyword=01 // 查询关键字 +``` + +### 输出: +``` +{ + "body": { + "content": [ + { + "key": "011101", + "mark": "常用", + "name": "小麦", + "nutrient": { + "fat": 10, + "energy": 10, + "calcium": 12, + "protein": 15, + "vitamin-a": 23 + }, + "time": 1693759354000, + "type": "谷薯类" + } + ], + "number": 0, + "size": 20, + "totalElements": 1, + "totalPages": 1 + }, + "code": 200, + "desc": "成功", + "success": true +} +``` + +# 2. 添加食材(管理端接口) + +> PUT /api/ingredient + +### 输入: +``` +Content-Type:application/x-www-form-urlencoded +key=010101 // 必填 +name=测试食材 // 必填 +type=粗粮 // 必填 全部必填 取值范围见(/api/basic/enum) category +nutrient={"fat": 10, "energy": 10, "calcium": 12, "protein": 15, "vitamin-a": 23} +// 必填 取值范围见(/api/basic/enum) nutrient +``` + +### 输出: +``` +{ + "code": 200, + "desc": "成功", + "success": true +} +``` + +# 3. 修改食材(管理端接口) + +> POST /api/ingredient + +### 输入: +``` +Content-Type:application/x-www-form-urlencoded +key=010101 // 必填 +name=测试食材 +type=粗粮 +nutrient={"fat": 10, "energy": 10, "calcium": 12, "protein": 15, "vitamin-a": 23} + +``` + +### 输出: +``` +{ + "code": 200, + "desc": "成功", + "success": true +} +``` +# 4. 删除食材(管理端接口) + +> DELETE /api/ingredient + +### 输入: +``` +Content-Type:application/x-www-form-urlencoded +nutrients=010101,020202,030303 // 必填 + +``` + +### 输出: +``` +{ + "code": 200, + "desc": "成功", + "success": true +} +``` + +# 5. 食材打标(业务端接口) + +> PUT /api/ingredient/mark + +### 输入: +``` +Content-Type:application/x-www-form-urlencoded +nutrient=010101 +mark=常用 // 必填, 取值: 常用/忌用 + +``` + +### 输出: +``` +{ + "code": 200, + "desc": "成功", + "success": true +} +``` + +# 6. 取消打标(业务端接口) + +> DELETE /api/ingredient/mark + +### 输入: +``` +Content-Type:application/x-www-form-urlencoded +nutrient=010101 + +``` + +### 输出: +``` +{ + "code": 200, + "desc": "成功", + "success": true +} +``` + +# 7. 批量导入(管理端接口) + +> PUT /api/ingredient/mark + +### 输入: +``` +Content-Type: multipart/form-data +files // 必传 + +``` + +### 输出: +``` +{ + "code": 200, + "desc": "成功", + "success": true +} +``` \ No newline at end of file diff --git a/projects/admin/src/app/pages/organization/organization-form/organization-form.component.ts b/projects/admin/src/app/pages/organization/organization-form/organization-form.component.ts index e20c2a9..512a6ed 100644 --- a/projects/admin/src/app/pages/organization/organization-form/organization-form.component.ts +++ b/projects/admin/src/app/pages/organization/organization-form/organization-form.component.ts @@ -49,7 +49,7 @@ export class OrganizationFormComponent { account: this.fb.control("", [FormValidators.required("账号不能为空")]), password: this.fb.control("", [FormValidators.required("密码不能为空")]), name: this.fb.control("", [FormValidators.required("单位名称不能为空")]), - expire: this.fb.control("", [FormValidators.required("账号到期事件不能为空")]), + expire: this.fb.control("", [FormValidators.required("账号到期时间不能为空")]), icon: this.fb.control("", []), address: this.fb.control("", []), contacts: this.fb.control("", []), diff --git a/projects/cdk/src/dtos/user.dto.ts b/projects/cdk/src/dtos/user.dto.ts index ad2b699..8c87369 100644 --- a/projects/cdk/src/dtos/user.dto.ts +++ b/projects/cdk/src/dtos/user.dto.ts @@ -21,3 +21,34 @@ export type UserDTO = { uid: string; time: string; }; + +export type OrgConfigDTO = { + breakfast: number; + dinner: number; + lunch: number; +}; + +export type ClientAccountDTO = { + name: string; + roleId: number; + roleItems: PermItemDTO[]; + roleName: string; + roleType: string; + time: number; + uid: string; + vender: AccountVenderDTO; +}; + +export type AccountVenderDTO = { + id: number; + name: string; + account: string; + status: true; + + address?: string; + contacts?: string; + email?: string; + expire?: number; + icon?: string; + phone?: string; +}; diff --git a/projects/client/src/app/app-routing.module.ts b/projects/client/src/app/app-routing.module.ts index 54a9177..75b11be 100644 --- a/projects/client/src/app/app-routing.module.ts +++ b/projects/client/src/app/app-routing.module.ts @@ -10,12 +10,14 @@ import { OrgInfoComponent, } from "./pages"; import { AppLayoutComponent } from "./components"; +import { authGuard } from "./services/auth.guard"; const routes: Routes = [ { path: "login", component: LoginComponent }, { path: "", component: AppLayoutComponent, + canActivate: [authGuard], children: [ { path: "", diff --git a/projects/client/src/app/app.module.ts b/projects/client/src/app/app.module.ts index 4d1de7f..b621148 100644 --- a/projects/client/src/app/app.module.ts +++ b/projects/client/src/app/app.module.ts @@ -11,9 +11,9 @@ import { BrowserAnimationsModule } from "@angular/platform-browser/animations"; import { AppRoutingModule } from "./app-routing.module"; import { AppComponent } from "./app.component"; -import { AppLayoutComponent } from "./components"; import { IconsProviderModule, TableListModule } from "@cdk/public-api"; import { SharedModule } from "@cdk/shared/shared.module"; +import { AppLayoutComponent, OrgFormComponent } from "./components"; import { DashboardComponent, LoginComponent, @@ -31,6 +31,8 @@ registerLocaleData(zh); declarations: [ AppComponent, AppLayoutComponent, + OrgFormComponent, + DashboardComponent, LoginComponent, MealSettingComponent, diff --git a/projects/client/src/app/components/index.ts b/projects/client/src/app/components/index.ts index 2e8054e..c9116bf 100644 --- a/projects/client/src/app/components/index.ts +++ b/projects/client/src/app/components/index.ts @@ -1 +1,2 @@ export * from "./app-layout/app-layout.component"; +export * from "./org-form/org-form.component"; diff --git a/projects/client/src/app/components/org-form/org-form.component.html b/projects/client/src/app/components/org-form/org-form.component.html new file mode 100644 index 0000000..7dda7fb --- /dev/null +++ b/projects/client/src/app/components/org-form/org-form.component.html @@ -0,0 +1,69 @@ +
+ + +