diff --git a/web-admin-app/README.md b/web-admin-app/README.md index 479743e..e0da971 100644 --- a/web-admin-app/README.md +++ b/web-admin-app/README.md @@ -1,27 +1,31 @@ -# LicenseWebApp -This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 17.0.3. +# Web admin app -## Development server +固资管理 -Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files. +# 接口 +- 资产台账 +- 系统管理 + - 账户 & 人事 +- 故障信息表 +- 资产派发 ? -## Code scaffolding -Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. +# 问题汇总 -## Build +## 05-02 -Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. +- 【用户表】状态 过滤 +- 【用户表】图片上传地址 下载地址 get +- 【用户表】保存报错 系统异常 但能存;更新 提示 新增用户'admin2'失败,登录账号已存在 +- 【用户表】删除 报错 503 -## Running unit tests +- 【存放位置】 新增必须要 positionId +- 【存放位置】 需要树状结构的接口 -Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). +- 【物品分类】 新增必须要 depth -## Running end-to-end tests +- 【盘点任务】列表 负责人、盘点人 等字段 如果要在列表显示 最好在返回名字,而不是id,前端循环请求 效果不好, 需要新增一个接口 支持前端提交 一个 idList,然后返回对应多个人员的详细信息 -Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities. +-【基础数据】【物品档案】的接口是那个? -## Further help - -To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page. diff --git a/web-admin-app/proxy/devserver.js b/web-admin-app/proxy/devserver.js index ee7f023..512dd5f 100644 --- a/web-admin-app/proxy/devserver.js +++ b/web-admin-app/proxy/devserver.js @@ -1,6 +1,6 @@ // const remoteTarget = "http://10.168.1.60:8300"; const remoteTarget = 'http://47.109.27.8:8280/' -const localTarget = 'http://localhost:8300' +const localTarget = 'http://47.109.27.8:8280/' const devProxy = (remote) => { let config = {} diff --git a/web-admin-app/src/app/app.config.ts b/web-admin-app/src/app/app.config.ts index 9230a29..85254a7 100644 --- a/web-admin-app/src/app/app.config.ts +++ b/web-admin-app/src/app/app.config.ts @@ -8,19 +8,14 @@ import { HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http' import { provideAnimations } from '@angular/platform-browser/animations' import { zh_CN, provideNzI18n } from 'ng-zorro-antd/i18n' import { routes } from './app.routes' -import { ServerPaginatedTableService } from './components/server-paginated-table' import { LocalHttpInterceptorService } from './services' import { PermissionModule } from './shared/permission/permission.module' import { TINYMCE_SCRIPT_SRC } from '@tinymce/tinymce-angular' +import { ServerPaginatedTableService } from './shared/components/server-paginated-table' registerLocaleData(zh) -export const APPOINTMENT_FROM = [ - { value: 1, label: '美团' }, - { value: 2, label: '大众点评' }, - { value: 3, label: '小红书' }, - { value: 4, label: '抖音' }, -] +export const MaxPageSize = 10000000 export function initializeApp(configService: ServerPaginatedTableService) { return () => { @@ -28,16 +23,17 @@ export function initializeApp(configService: ServerPaginatedTableService) { configService.setConfig({ formatPaginationData(v) { return { - current: v.pageIndex, + pageNum: v.pageIndex, pageSize: v.pageSize, } }, formatServiceData(v) { - console.log('v', v) + // console.log('【formatServiceData】', v) return { - total: v.data.total, - totalPages: Math.ceil(v.data.records / 5), - data: v.data.records, + total: v.body.total, + // totalPages: Math.ceil(v.body.rows / 5), + totalPages: 0, + data: v.body.rows, } }, }) diff --git a/web-admin-app/src/app/app.routes.ts b/web-admin-app/src/app/app.routes.ts index 7623536..916adfe 100644 --- a/web-admin-app/src/app/app.routes.ts +++ b/web-admin-app/src/app/app.routes.ts @@ -1,6 +1,6 @@ import { Routes } from '@angular/router' +import { LayoutComponent } from './shared/components' import { DashboardComponent } from './pages/dashboard/dashboard.component' -import { LayoutComponent } from './components/layout/layout.component' import { ProfileComponent } from './pages/profile/profile.component' import { ProfileBasicComponent } from './pages/profile-basic/profile-basic.component' import { ProfileAccountComponent } from './pages/profile-account/profile-account.component' @@ -9,7 +9,7 @@ import { authGuard } from './guards' import { permissionGuard } from './shared/permission/permission.guard' import { ForbiddenComponent } from './pages/forbidden/forbidden.component' import { NotfoundComponent } from './pages/notfound/notfound.component' -import { SystemComponent } from './pages/system/system.component' +import { SystemComponent } from './pages/system/index/system.component' import { OrgComponent } from './pages/org/org.component' import { OrgEmployeeComponent } from './pages/org-employee/org-employee.component' import { OrgSettingComponent } from './pages/org-setting/org-setting.component' @@ -31,6 +31,17 @@ import { FixedAssetManageRevertComponent } from './pages/fixed-asset/manage/fixe import { FixedAssetManageAllotComponent } from './pages/fixed-asset/manage/fixed-asset-manage-allot/fixed-asset-manage-allot.component' import { FixedAssetManageTransferComponent } from './pages/fixed-asset/manage/fixed-asset-manage-transfer/fixed-asset-manage-transfer.component' import { FixedAssetManageScrapComponent } from './pages/fixed-asset/manage/fixed-asset-manage-scrap/fixed-asset-manage-scrap.component' +import { SystemUserComponent } from './pages/system/system-user/system-user.component' + +import { SavePositionComponent } from './pages/fixed-asset/basic/save-position/save-position.component' +import { BasicGoodsStockComponent } from './pages/fixed-asset/basic/basic-goods-stock/basic-goods-stock.component' +import { BasicMaintainerComponent } from './pages/fixed-asset/basic/basic-maintainer/basic-maintainer.component' +import { BasicManufacturerComponent } from './pages/fixed-asset/basic/basic-manufacturer/basic-manufacturer.component' +import { BasicWarehouseComponent } from './pages/fixed-asset/basic/basic-warehouse/basic-warehouse.component' +import { BasicSupplierComponent } from './pages/fixed-asset/basic/basic-supplier/basic-supplier.component' +import { BasicCategoryComponent } from './pages/fixed-asset/basic/basic-category/basic-category.component' +import { StockakingJobComponent } from './pages/fixed-asset/stocktaking/stockaking-job/stockaking-job.component' +import { StockakingPlanComponent } from './pages/fixed-asset/stocktaking/stockaking-plan/stockaking-plan.component' export const routes: Routes = [ { @@ -87,7 +98,7 @@ export const routes: Routes = [ }, { path: 'user', - component: SystemComponent, + component: SystemUserComponent, canActivate: [permissionGuard], data: { permission: 'user', @@ -230,10 +241,78 @@ export const routes: Routes = [ }, ], }, + { + path: 'basic', + title: '基础数据', + children: [ + { + path: '', + pathMatch: 'full', + redirectTo: 'goods-stock', + }, + { + path: 'goods-stock', + component: BasicGoodsStockComponent, + title: '物品档案', + }, + { + path: 'category', + component: BasicCategoryComponent, + title: '物品分类', + }, + { + path: 'save-position', + component: SavePositionComponent, + title: '存放位置', + }, + { + path: 'maintainer', + component: BasicMaintainerComponent, + title: '维保商', + }, + { + path: 'manufacturer', + component: BasicManufacturerComponent, + title: '生产商', + }, + { + path: 'supplier', + component: BasicSupplierComponent, + title: '供应商', + }, + { + path: 'warehouse', + component: BasicWarehouseComponent, + title: '存放仓库', + }, + ], + }, + { + path: 'stocktaking', + title: '盘点管理', + children: [ + { + path: '', + pathMatch: 'full', + redirectTo: 'job', + }, + { + path: 'job', + component: StockakingJobComponent, + title: '盘点任务', + }, + { + path: 'plan', + component: StockakingPlanComponent, + title: '盘点计划', + }, + ], + }, ], }, ], }, + { path: 'not-found', component: NotfoundComponent, diff --git a/web-admin-app/src/app/components/component-basic-category-tree/component-basic-category-tree.component.html b/web-admin-app/src/app/components/component-basic-category-tree/component-basic-category-tree.component.html new file mode 100644 index 0000000..b5dddd9 --- /dev/null +++ b/web-admin-app/src/app/components/component-basic-category-tree/component-basic-category-tree.component.html @@ -0,0 +1,64 @@ +
+
+
+ + + + + + +
+ @if (createable) { + + } +
+
+ + +
+
+ @switch (origin.organizationType) { + @case ('0') { + + } + @case ('1') { + + } + @case ('2') { + + } + } + {{ node.title }} +
+ + +
    +
  • 添加同级分类
  • +
  • 添加下级分类
  • +
  • +
  • 删除
  • +
+
+
+
+
+
+
diff --git a/web-admin-app/src/app/components/component-basic-category-tree/component-basic-category-tree.component.less b/web-admin-app/src/app/components/component-basic-category-tree/component-basic-category-tree.component.less new file mode 100644 index 0000000..fcd4a28 --- /dev/null +++ b/web-admin-app/src/app/components/component-basic-category-tree/component-basic-category-tree.component.less @@ -0,0 +1,7 @@ +.tree { + ::ng-deep { + .ant-tree-switcher { + align-self: center; + } + } +} \ No newline at end of file diff --git a/web-admin-app/src/app/components/component-basic-category-tree/component-basic-category-tree.component.ts b/web-admin-app/src/app/components/component-basic-category-tree/component-basic-category-tree.component.ts new file mode 100644 index 0000000..7d233b9 --- /dev/null +++ b/web-admin-app/src/app/components/component-basic-category-tree/component-basic-category-tree.component.ts @@ -0,0 +1,153 @@ +import { Component, EventEmitter, Input, OnInit, Output, TemplateRef } from '@angular/core' +import { FormBuilder, FormGroup } from '@angular/forms' +import { ApiService } from 'app/services' +import { SharedModule } from 'app/shared/shared.module' +import { FormValidators } from 'app/utils' +import { NzSafeAny } from 'ng-zorro-antd/core/types' +import { NzDrawerRef, NzDrawerService } from 'ng-zorro-antd/drawer' +import { NzMessageService } from 'ng-zorro-antd/message' +import { NzModalService } from 'ng-zorro-antd/modal' +import { NzFormatEmitEvent, NzTreeNodeOptions } from 'ng-zorro-antd/tree' + +interface CateGoryInterface { + categoryId: number + categoryName: string + createTime: string + depth: string + lowerLimit: number | null + parentId: number + safetyLimit: number | null + upperLimit: number | null +} +function buildTree(organizations: CateGoryInterface[]): NzTreeNodeOptions[] { + const map: { [parentId: number]: NzTreeNodeOptions[] } = {} + + organizations.forEach((org) => { + if (!map[org.parentId]) { + map[org.parentId] = [] + } + const treeNode: NzTreeNodeOptions = { + ...org, + title: org.categoryName, + key: org.categoryId.toString(), + } + map[org.parentId].push(treeNode) + }) + + const build = (parentId: number): NzTreeNodeOptions[] => { + if (!map[parentId]) { + return [] + } + return map[parentId].map((node) => { + const children = build(parseInt(node.key)) + return { + ...node, + isLeaf: children.length === 0, + children, + } + }) + } + + return build(0) +} + +@Component({ + selector: 'app-component-basic-category-tree', + standalone: true, + imports: [SharedModule], + templateUrl: './component-basic-category-tree.component.html', + styleUrl: './component-basic-category-tree.component.less', +}) +export class ComponentBasicCategoryTreeComponent { + constructor( + private api: ApiService, + private drawer: NzDrawerService, + private fb: FormBuilder, + private msg: NzMessageService, + private modal: NzModalService, + ) {} + + @Input() createable = true + + @Output() onSelectedChange = new EventEmitter() + + drawerRef?: NzDrawerRef + + searchValue = '' + + parentId?: number + + nodes: NzSafeAny[] = [] + + expandedKeys: string[] = [] + + selectedKeys: string[] = [] + + initTree() { + this.api.getBasicCategoryTree().subscribe((res) => { + this.nodes = buildTree(res.body) + this.expandedKeys = [...this.expandedKeys] + console.log('this.selectedKeys', this.selectedKeys) + if (this.selectedKeys.length === 0) { + this.selectedKeys = [this.nodes[0].key] + } else { + this.selectedKeys = [...this.selectedKeys] + } + + const node = res.body.find((node: NzSafeAny) => String(node.categoryId) === this.selectedKeys[0]) + this.onSelectedChange.emit(node) + }) + } + + ngOnInit(): void { + this.initTree() + } + + nzEvent(event: NzFormatEmitEvent): void { + if (event.eventName === 'click') { + const { node } = event + this.selectedKeys = event.keys ?? [] + this.onSelectedChange.emit(node?.origin) + } + } + + onExpandChange(e: NzFormatEmitEvent) { + this.expandedKeys = e.keys ?? [] + } + + onSelectedKeysChange(e: string[]) { + console.log('e', e) + } + + onCreate(parentId: number) { + this.api + .addBasicCategoryTree({ + depth: '', + lowerLimit: 0, + safetyLimit: 0, + upperLimit: 0, + parentId, + categoryName: '新分类', + }) + .subscribe((res) => { + this.initTree() + this.msg.success(res.desc) + }) + } + + onDelete(id: number) { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '是否要删除该分类?', + nzOnOk: () => { + this.api.deleteBasicCategory([id]).subscribe((res) => { + if (this.selectedKeys.includes(String(id))) { + this.selectedKeys = [] + } + this.msg.success(res.desc) + this.initTree() + }) + }, + }) + } +} diff --git a/web-admin-app/src/app/components/component-org-tree/component-org-tree.component.html b/web-admin-app/src/app/components/component-org-tree/component-org-tree.component.html new file mode 100644 index 0000000..8a82e75 --- /dev/null +++ b/web-admin-app/src/app/components/component-org-tree/component-org-tree.component.html @@ -0,0 +1,113 @@ +
+
+
+ + + + + + +
+ @if (createable) { + + +
    +
  • 添加组织
  • +
  • 添加岗位
  • +
+
+ } +
+
+ + +
+
+ @switch (origin.organizationType) { + @case ('0') { + + } + @case ('1') { + + } + @case ('2') { + + } + } + {{ node.title }} +
+ @if (createable) { + + +
    +
  • 添加组织
  • +
  • 添加岗位
  • +
  • + 编辑 +
  • +
  • +
  • 删除
  • +
+
+ } +
+
+
+
+ + +
+ + 名称 + + + + + @if (isOrg) { + + 类型 + + + + + + + + } + + 状态 + + + + +
+
+ + + + + + + + + + + +
diff --git a/web-admin-app/src/app/components/component-org-tree/component-org-tree.component.less b/web-admin-app/src/app/components/component-org-tree/component-org-tree.component.less new file mode 100644 index 0000000..fcd4a28 --- /dev/null +++ b/web-admin-app/src/app/components/component-org-tree/component-org-tree.component.less @@ -0,0 +1,7 @@ +.tree { + ::ng-deep { + .ant-tree-switcher { + align-self: center; + } + } +} \ No newline at end of file diff --git a/web-admin-app/src/app/components/component-org-tree/component-org-tree.component.ts b/web-admin-app/src/app/components/component-org-tree/component-org-tree.component.ts new file mode 100644 index 0000000..fce2f29 --- /dev/null +++ b/web-admin-app/src/app/components/component-org-tree/component-org-tree.component.ts @@ -0,0 +1,186 @@ +import { Component, EventEmitter, Input, OnInit, Output, TemplateRef } from '@angular/core' +import { FormBuilder, FormGroup } from '@angular/forms' +import { ApiService } from 'app/services' +import { SharedModule } from 'app/shared/shared.module' +import { FormValidators } from 'app/utils' +import { NzSafeAny } from 'ng-zorro-antd/core/types' +import { NzDrawerRef, NzDrawerService } from 'ng-zorro-antd/drawer' +import { NzMessageService } from 'ng-zorro-antd/message' +import { NzModalService } from 'ng-zorro-antd/modal' +import { NzFormatEmitEvent, NzTreeNodeOptions } from 'ng-zorro-antd/tree' + +interface Organization { + depth: string + orderNum: number + organizationId: number + organizationName: string + organizationType: string + parentId: number + status: string +} +function buildTree(organizations: Organization[]): NzTreeNodeOptions[] { + const map: { [parentId: number]: NzTreeNodeOptions[] } = {} + + organizations.forEach((org) => { + if (!map[org.parentId]) { + map[org.parentId] = [] + } + const treeNode: NzTreeNodeOptions = { + ...org, + title: org.organizationName, + key: org.organizationId.toString(), + } + map[org.parentId].push(treeNode) + }) + + const build = (parentId: number): NzTreeNodeOptions[] => { + if (!map[parentId]) { + return [] + } + return map[parentId].map((node) => { + const children = build(parseInt(node.key)) + return { + ...node, + isLeaf: children.length === 0, + children, + } + }) + } + + return build(0) +} + +@Component({ + selector: 'app-component-org-tree', + standalone: true, + imports: [SharedModule], + templateUrl: './component-org-tree.component.html', + styleUrl: './component-org-tree.component.less', +}) +export class ComponentOrgTreeComponent implements OnInit { + constructor( + private api: ApiService, + private drawer: NzDrawerService, + private fb: FormBuilder, + private msg: NzMessageService, + private modal: NzModalService, + ) {} + + @Input() createable = true + + @Output() onOrgSelectedChange = new EventEmitter() + + drawerRef?: NzDrawerRef + + isOrg = false + + searchValue = '' + + parentId?: number + + nodes: NzSafeAny[] = [] + + expandedKeys: string[] = [] + + form!: FormGroup + + initForm() { + this.form = this.fb.group({ + organizationId: this.fb.control(null, []), + organizationName: this.fb.control('', [FormValidators.required('请输入组织名称')]), + organizationType: this.fb.control('1', []), + status: this.fb.control(true, []), + }) + } + + initTree() { + this.api.getOrgTree().subscribe((res) => { + this.nodes = buildTree(res.body) + this.expandedKeys = [...this.expandedKeys] + }) + } + + ngOnInit(): void { + this.initTree() + this.initForm() + } + + nzEvent(event: NzFormatEmitEvent): void { + if (event.eventName === 'click') { + const { node } = event + this.onOrgSelectedChange.emit(event.keys?.length === 0 ? null : node?.origin) + } + } + + onExpandChange(e: NzFormatEmitEvent) { + this.expandedKeys = e.keys ?? [] + } + + onSelectedKeysChange(e: string[]) { + console.log('e', e) + } + + onCreate( + isOrg: boolean, + nzContent: TemplateRef, + nzFooter: TemplateRef, + origin?: NzSafeAny, + edit?: boolean, + ) { + this.isOrg = isOrg + + this.form.patchValue({ + organizationType: isOrg ? '1' : '2', + }) + if (edit) { + this.isOrg = origin.organizationType !== '2' + this.form.patchValue(origin) + } else { + this.parentId = origin?.organizationId + } + + this.drawerRef = this.drawer.create({ + nzTitle: '组织管理', + nzContent, + nzWidth: 600, + nzFooter, + }) + } + + onDelete(id: number) { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '是否要删除该组织?', + nzOnOk: () => { + this.api.deleteOrg(id).subscribe((res) => { + this.msg.success(res.desc) + this.initTree() + }) + }, + }) + } + + onConfirm() { + if (FormValidators.validateFormGroup(this.form)) { + const { value } = this.form + this.api + .saveOrg({ + ...value, + status: value.status ? 0 : 1, + parentId: this.parentId, + }) + .subscribe((res) => { + this.initTree() + this.msg.success(res.desc) + this.onCancel() + }) + } + } + + onCancel() { + this.drawerRef?.close() + this.form.reset() + this.isOrg = false + this.parentId = void 0 + } +} diff --git a/web-admin-app/src/app/components/index.ts b/web-admin-app/src/app/components/index.ts index 0d1d6d2..1d2e804 100644 --- a/web-admin-app/src/app/components/index.ts +++ b/web-admin-app/src/app/components/index.ts @@ -1,5 +1,3 @@ -// export * from "./form-error-tips/form-error-tips.component"; -// export * from "./server-paginated-table"; - -export * from './header/header.component' -export * from './layout/layout.component' +export * from './component-org-tree/component-org-tree.component' +export * from './component-basic-category-tree/component-basic-category-tree.component' +export * from './select-user-by-org/select-user-by-org.component' diff --git a/web-admin-app/src/app/components/layout/layout.component.less b/web-admin-app/src/app/components/layout/layout.component.less deleted file mode 100644 index b087501..0000000 --- a/web-admin-app/src/app/components/layout/layout.component.less +++ /dev/null @@ -1,15 +0,0 @@ -:host { - display: block; - height: 100%; -} - -.app-width { - ::ng-deep { - router-outlet+* { - display: block; - width: 100%; - height: 100%; - // overflow: hidden; - } - } -} \ No newline at end of file diff --git a/web-admin-app/src/app/components/layout/layout.component.ts b/web-admin-app/src/app/components/layout/layout.component.ts deleted file mode 100644 index fcfb2e3..0000000 --- a/web-admin-app/src/app/components/layout/layout.component.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Component } from '@angular/core'; -import { HeaderComponent } from "../header/header.component"; -import { SharedModule } from "../../shared/shared.module"; - -@Component({ - standalone: true, - selector: 'app-layout', - templateUrl: './layout.component.html', - styleUrls: ['./layout.component.less'], - imports: [SharedModule, HeaderComponent] -}) -export class LayoutComponent { - -} diff --git a/web-admin-app/src/app/components/select-user-by-org/select-user-by-org.component.html b/web-admin-app/src/app/components/select-user-by-org/select-user-by-org.component.html new file mode 100644 index 0000000..b215a75 --- /dev/null +++ b/web-admin-app/src/app/components/select-user-by-org/select-user-by-org.component.html @@ -0,0 +1,74 @@ +
+ @if (selectedKeys.size > 0) { + + } @else { +
+ + + {{ placeholder }} + +
+ } +
+ + + @for (uid of selectedKeys; track $index) { + + {{ allGetedDataMap.get(uid).userName }} + + } + + + +
+ +
+ +
+ +
+
+ +
+
+
+ + 全选 + +
+
+
    + @for (item of currentUsers; track $index) { +
  • + {{ item.userName }} + +
  • + } +
+
+
+
+
+
+
diff --git a/web-admin-app/src/app/components/select-user-by-org/select-user-by-org.component.less b/web-admin-app/src/app/components/select-user-by-org/select-user-by-org.component.less new file mode 100644 index 0000000..0ad5565 --- /dev/null +++ b/web-admin-app/src/app/components/select-user-by-org/select-user-by-org.component.less @@ -0,0 +1,21 @@ +.trigger { + border: 1px dashed #e0e0e0; +} + +.user-select { + .org { + border-right: 1px solid #e0e0e0; + } + + .user-list { + .hd { + border-bottom: 1px solid #e0e0e0; + } + + .item { + &:hover { + background-color: #f0f1f4; + } + } + } +} \ No newline at end of file diff --git a/web-admin-app/src/app/components/select-user-by-org/select-user-by-org.component.ts b/web-admin-app/src/app/components/select-user-by-org/select-user-by-org.component.ts new file mode 100644 index 0000000..12e1680 --- /dev/null +++ b/web-admin-app/src/app/components/select-user-by-org/select-user-by-org.component.ts @@ -0,0 +1,128 @@ +import { CommonModule } from '@angular/common' +import { Component, Input, OnInit, TemplateRef, forwardRef } from '@angular/core' +import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' +import { NzCardModule } from 'ng-zorro-antd/card' +import { NzSafeAny } from 'ng-zorro-antd/core/types' +import { NzIconModule } from 'ng-zorro-antd/icon' +import { NzModalModule, NzModalService } from 'ng-zorro-antd/modal' +import { NzTreeModule } from 'ng-zorro-antd/tree' +import { ComponentOrgTreeComponent } from '../component-org-tree/component-org-tree.component' +import { NzButtonModule } from 'ng-zorro-antd/button' +import { NzCheckboxModule } from 'ng-zorro-antd/checkbox' +import { ApiService } from 'app/services' +import { NzMessageModule, NzMessageService } from 'ng-zorro-antd/message' +import { MaxPageSize } from 'app/app.config' +import { NzTagModule } from 'ng-zorro-antd/tag' + +@Component({ + selector: 'app-select-user-by-org', + standalone: true, + imports: [ + CommonModule, + ComponentOrgTreeComponent, + NzButtonModule, + NzCheckboxModule, + NzTreeModule, + NzModalModule, + NzIconModule, + NzCardModule, + NzMessageModule, + NzTagModule, + ], + templateUrl: './select-user-by-org.component.html', + styleUrl: './select-user-by-org.component.less', + providers: [ + { + provide: NG_VALUE_ACCESSOR, + multi: true, + useExisting: forwardRef(() => SelectUserByOrgComponent), + }, + ], +}) +export class SelectUserByOrgComponent implements ControlValueAccessor, OnInit { + constructor( + private modal: NzModalService, + private api: ApiService, + private msg: NzMessageService, + ) {} + + @Input() placeholder: string = '请选择' + + @Input() modalTitle: string = '选择' + + allGetedDataMap = new Map() + + currentUsers: NzSafeAny[] = [] + + selectedKeys = new Set() + + indeterminate = false + + allChecked = false + + ngOnInit(): void {} + + onTriggerClick(nzContent: TemplateRef) { + this.modal.create({ + nzTitle: this.modalTitle, + nzContent, + nzWidth: '660px', + }) + } + + onOrgSelectedChange(v: NzSafeAny) { + this.api + .getUserPage({ pageSize: MaxPageSize, pageNum: 1, organizationId: v.organizationId }) + .subscribe((res) => { + if (Array.isArray(res.body?.rows) && res.body.rows.length > 0) { + res.body.rows.forEach((element: NzSafeAny) => { + this.currentUsers = res.body.rows + this.allGetedDataMap.set(element.userId, element) + }) + } + }) + } + + onUserCheckedChange(e: boolean, v: number) { + if (e) { + this.selectedKeys.add(v) + } else { + this.selectedKeys.delete(v) + } + this.statusChange() + } + + statusChange() { + this.allChecked = this.selectedKeys.size === this.currentUsers.length + this.indeterminate = this.selectedKeys.size > 0 && this.selectedKeys.size < this.currentUsers.length + } + + onAllCheckedChange(e: boolean) { + if (e) { + this.currentUsers.forEach((element) => { + this.selectedKeys.add(element.userId) + }) + } else { + this.selectedKeys.clear() + } + this.statusChange() + } + + onTouched = () => {} + + onChange(v: string[]) { + console.log('v', v) + } + + writeValue(v: any): void {} + + registerOnChange(fn: any): void { + this.onChange = fn + } + + registerOnTouched(fn: any): void { + this.onTouched = fn + } + + setDisabledState?(isDisabled: boolean): void {} +} diff --git a/web-admin-app/src/app/guards/auth.guard.ts b/web-admin-app/src/app/guards/auth.guard.ts index 1ee38bb..11ea492 100644 --- a/web-admin-app/src/app/guards/auth.guard.ts +++ b/web-admin-app/src/app/guards/auth.guard.ts @@ -4,17 +4,16 @@ import { ApiService, LocalHttpInterceptorService } from 'app/services' import { map } from 'rxjs' export const authGuard: CanActivateFn = (route, state) => { - const local = inject(LocalHttpInterceptorService) - const accessData = local.getAccess() - let token = accessData?.access_token - if (token) { - return true - } - const router = inject(Router) - return router.createUrlTree(['/login']) - // const api = inject(ApiService) - // if (!localStorage.getItem('sc')) { - // return router.createUrlTree(['/login']) + // const local = inject(LocalHttpInterceptorService) + // const accessData = local.getAccess() + // let token = accessData?.access_token + // if (token) { + // return true // } - // return api.getAuthInfo(true).pipe(map((r) => !!r)) + const router = inject(Router) + const api = inject(ApiService) + if (!api.authInfo) { + return router.createUrlTree(['/login']) + } + return true } diff --git a/web-admin-app/src/app/pages/component-org-tree/component-org-tree.component.html b/web-admin-app/src/app/pages/component-org-tree/component-org-tree.component.html deleted file mode 100644 index addfd12..0000000 --- a/web-admin-app/src/app/pages/component-org-tree/component-org-tree.component.html +++ /dev/null @@ -1,23 +0,0 @@ -
-
- - - - - - -
- @if (createable) { - - } -
-
- -
diff --git a/web-admin-app/src/app/pages/component-org-tree/component-org-tree.component.ts b/web-admin-app/src/app/pages/component-org-tree/component-org-tree.component.ts deleted file mode 100644 index 343171d..0000000 --- a/web-admin-app/src/app/pages/component-org-tree/component-org-tree.component.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { Component, Input } from '@angular/core' -import { SharedModule } from 'app/shared/shared.module' -import { NzFormatEmitEvent } from 'ng-zorro-antd/tree' - -@Component({ - selector: 'app-component-org-tree', - standalone: true, - imports: [SharedModule], - templateUrl: './component-org-tree.component.html', - styleUrl: './component-org-tree.component.less', -}) -export class ComponentOrgTreeComponent { - constructor() {} - - @Input() createable = true - - searchValue = '' - - nodes = [ - { - title: '科技部', - key: '0-0', - children: [ - { - title: '岗位1', - key: '0-0-0', - }, - { - title: '岗位12', - key: '0-0-1', - children: [ - { title: '0-0-1-0', key: '0-0-1-0', isLeaf: true }, - { title: '0-0-1-1', key: '0-0-1-1', isLeaf: true }, - { title: '0-0-1-2', key: '0-0-1-2', isLeaf: true }, - ], - }, - { - title: '岗位14', - key: '0-0-2', - isLeaf: true, - }, - ], - }, - { - title: '综合办', - key: '0-1', - }, - { - title: '办公室', - key: '0-2', - isLeaf: true, - }, - ] - - nzEvent(event: NzFormatEmitEvent): void { - console.log(event) - } -} diff --git a/web-admin-app/src/app/pages/dashboard/dashboard.component.ts b/web-admin-app/src/app/pages/dashboard/dashboard.component.ts index 519f25d..71628b3 100644 --- a/web-admin-app/src/app/pages/dashboard/dashboard.component.ts +++ b/web-admin-app/src/app/pages/dashboard/dashboard.component.ts @@ -3,7 +3,6 @@ import { init, EChartsType } from 'echarts' import { SharedModule } from '../../shared/shared.module' import { ApiService } from 'app/services' import { ConsoleClientTopDTO, ConsoleCountDTO, ConsoleExpireDTO } from 'app/services/api.dto' -import { AppPageComponent } from 'app/components/app-page/app-page.component' const antvColor = [ '#5B8FF9', @@ -20,7 +19,7 @@ const antvColor = [ @Component({ standalone: true, - imports: [SharedModule, AppPageComponent], + imports: [SharedModule], selector: 'app-dashboard', templateUrl: './dashboard.component.html', styleUrls: ['./dashboard.component.less'], diff --git a/web-admin-app/src/app/pages/fixed-asset/basic/basic-category/basic-category.component.html b/web-admin-app/src/app/pages/fixed-asset/basic/basic-category/basic-category.component.html new file mode 100644 index 0000000..0ea4079 --- /dev/null +++ b/web-admin-app/src/app/pages/fixed-asset/basic/basic-category/basic-category.component.html @@ -0,0 +1,63 @@ + +
+ + + +
+ +
+ + 名称 + + + + + + 安全库存 + + + + + + 安全库存上限 + + + + + + 安全库存下限 + + + + + + + + + + + +
+
+
+
+
+ + + + diff --git a/web-admin-app/src/app/components/form-error-tips/form-error-tips.component.less b/web-admin-app/src/app/pages/fixed-asset/basic/basic-category/basic-category.component.less similarity index 100% rename from web-admin-app/src/app/components/form-error-tips/form-error-tips.component.less rename to web-admin-app/src/app/pages/fixed-asset/basic/basic-category/basic-category.component.less diff --git a/web-admin-app/src/app/pages/fixed-asset/basic/basic-category/basic-category.component.ts b/web-admin-app/src/app/pages/fixed-asset/basic/basic-category/basic-category.component.ts new file mode 100644 index 0000000..66ad4ba --- /dev/null +++ b/web-admin-app/src/app/pages/fixed-asset/basic/basic-category/basic-category.component.ts @@ -0,0 +1,82 @@ +import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core' +import { SharedModule } from 'app/shared/shared.module' + +import { ApiService } from 'app/services' +import { FormBuilder, FormGroup } from '@angular/forms' +import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' +import { NzSafeAny } from 'ng-zorro-antd/core/types' +import { NzModalService } from 'ng-zorro-antd/modal' +import { NzMessageService } from 'ng-zorro-antd/message' +import { NzDrawerRef, NzDrawerService } from 'ng-zorro-antd/drawer' +import { lastValueFrom } from 'rxjs' +import { FormValidators } from 'app/utils' +import { ComponentBasicCategoryTreeComponent } from 'app/components' + +@Component({ + selector: 'app-basic-category', + standalone: true, + imports: [SharedModule, ComponentBasicCategoryTreeComponent], + templateUrl: './basic-category.component.html', + styleUrl: './basic-category.component.less', +}) +export class BasicCategoryComponent { + constructor( + private modal: NzModalService, + private msg: NzMessageService, + private drawer: NzDrawerService, + private api: ApiService, + private fb: FormBuilder, + ) {} + + @ViewChild('treeEl') treeEl!: ComponentBasicCategoryTreeComponent + + queryForm!: FormGroup + + createForm!: FormGroup + + drawerRef?: NzDrawerRef + + @ViewChild('drawerFooterTpl') drawerFooterTpl!: TemplateRef + + @ViewChild('formContentTpl') formContentTpl!: TemplateRef + + initCreateForm() { + this.createForm = this.fb.group({ + categoryId: [], + categoryName: ['', [FormValidators.required('请输入')]], + safetyLimit: [0, []], + lowerLimit: [0, []], + upperLimit: [0, []], + }) + } + initQueryForm() { + this.queryForm = this.fb.group({ + name: [''], + }) + } + + ngOnInit(): void { + this.initQueryForm() + this.initCreateForm() + } + + onSelectedChange(v: NzSafeAny) { + this.createForm.patchValue(v) + } + + onConfirm() { + if (FormValidators.validateFormGroup(this.createForm)) { + const { value } = this.createForm + + this.api + .updateBasicCategoryTree({ + ...value, + }) + .subscribe((res) => { + this.msg.success(res.desc) + console.log('this.treeEl', this.treeEl) + this.treeEl.initTree() + }) + } + } +} diff --git a/web-admin-app/src/app/pages/fixed-asset/basic/basic-goods-stock/basic-goods-stock.component.html b/web-admin-app/src/app/pages/fixed-asset/basic/basic-goods-stock/basic-goods-stock.component.html new file mode 100644 index 0000000..20897df --- /dev/null +++ b/web-admin-app/src/app/pages/fixed-asset/basic/basic-goods-stock/basic-goods-stock.component.html @@ -0,0 +1 @@ +

basic-goods-stock works!

diff --git a/web-admin-app/src/app/components/range-picker/range-picker.component.less b/web-admin-app/src/app/pages/fixed-asset/basic/basic-goods-stock/basic-goods-stock.component.less similarity index 100% rename from web-admin-app/src/app/components/range-picker/range-picker.component.less rename to web-admin-app/src/app/pages/fixed-asset/basic/basic-goods-stock/basic-goods-stock.component.less diff --git a/web-admin-app/src/app/pages/fixed-asset/basic/basic-goods-stock/basic-goods-stock.component.ts b/web-admin-app/src/app/pages/fixed-asset/basic/basic-goods-stock/basic-goods-stock.component.ts new file mode 100644 index 0000000..ee2fb77 --- /dev/null +++ b/web-admin-app/src/app/pages/fixed-asset/basic/basic-goods-stock/basic-goods-stock.component.ts @@ -0,0 +1,12 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-basic-goods-stock', + standalone: true, + imports: [], + templateUrl: './basic-goods-stock.component.html', + styleUrl: './basic-goods-stock.component.less' +}) +export class BasicGoodsStockComponent { + +} diff --git a/web-admin-app/src/app/pages/fixed-asset/basic/basic-maintainer/basic-maintainer.component.html b/web-admin-app/src/app/pages/fixed-asset/basic/basic-maintainer/basic-maintainer.component.html new file mode 100644 index 0000000..07a59f6 --- /dev/null +++ b/web-admin-app/src/app/pages/fixed-asset/basic/basic-maintainer/basic-maintainer.component.html @@ -0,0 +1,108 @@ + + + + + + +
+ + + @switch (key) { + @case ('status') { + + } + + @default { + {{ data }} + } + } + + + + + + + + + + + + + + +
+
+ + + + + + + + + +
+ + 名称 + + + + + + 编码 + + + + + + 统一社会信用代码 + + + + + + 商务联系人 + + + + + + 商务联系方式 + + + + + + 售后联系人 + + + + + + 售后联系方式 + + + + + + + 地址 + + + + + + 备注 + + + + +
+
+ + + + diff --git a/web-admin-app/src/app/components/user-form/user-form.component.less b/web-admin-app/src/app/pages/fixed-asset/basic/basic-maintainer/basic-maintainer.component.less similarity index 100% rename from web-admin-app/src/app/components/user-form/user-form.component.less rename to web-admin-app/src/app/pages/fixed-asset/basic/basic-maintainer/basic-maintainer.component.less diff --git a/web-admin-app/src/app/pages/fixed-asset/basic/basic-maintainer/basic-maintainer.component.ts b/web-admin-app/src/app/pages/fixed-asset/basic/basic-maintainer/basic-maintainer.component.ts new file mode 100644 index 0000000..0afa0fe --- /dev/null +++ b/web-admin-app/src/app/pages/fixed-asset/basic/basic-maintainer/basic-maintainer.component.ts @@ -0,0 +1,136 @@ +import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core' +import { SharedModule } from 'app/shared/shared.module' +import { ApiService } from 'app/services' +import { FormBuilder, FormGroup } from '@angular/forms' +import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' +import { NzSafeAny } from 'ng-zorro-antd/core/types' +import { NzModalService } from 'ng-zorro-antd/modal' +import { NzMessageService } from 'ng-zorro-antd/message' +import { NzDrawerRef, NzDrawerService } from 'ng-zorro-antd/drawer' +import { lastValueFrom } from 'rxjs' +import { FormValidators } from 'app/utils' + +@Component({ + selector: 'app-basic-maintainer', + standalone: true, + imports: [SharedModule], + templateUrl: './basic-maintainer.component.html', + styleUrl: './basic-maintainer.component.less', +}) +export class BasicMaintainerComponent { + constructor( + private modal: NzModalService, + private msg: NzMessageService, + private drawer: NzDrawerService, + private api: ApiService, + private fb: FormBuilder, + ) {} + + table = new TableOption(this.fetchData.bind(this)) + + queryForm!: FormGroup + + createForm!: FormGroup + + drawerRef?: NzDrawerRef + + @ViewChild('drawerFooterTpl') drawerFooterTpl!: TemplateRef + + @ViewChild('formContentTpl') formContentTpl!: TemplateRef + + initCreateForm() { + this.createForm = this.fb.group({ + maintenanceVendorId: [], + name: ['', [FormValidators.required('请输入')]], + code: ['', []], + uscc: ['', []], + notes: ['', []], + businessContactor: ['', []], + businessContact: ['', []], + afterSalesContactor: ['', []], + afterSalesContact: ['', []], + address: ['', []], + }) + } + initQueryForm() { + this.queryForm = this.fb.group({ + name: [''], + uscc: [''], + code: [''], + }) + } + + ngOnInit(): void { + this.table + + .setColumn([ + { key: 'name', title: '名称' }, + { key: 'code', title: '编码' }, + { key: 'uscc', title: '统一社会信用代码' }, + { key: 'businessContactor', title: '商务联系人' }, + { key: 'businessContact', title: '商务联系方式' }, + { key: 'afterSalesContactor', title: '售后联系人' }, + { key: 'afterSalesContact', title: '售后联系方式' }, + { key: 'address', title: '地址' }, + { key: 'notes', title: '备注' }, + ]) + .setRowOperate([ + { title: '编辑', onClick: this.onCreate.bind(this) }, + { title: '删除', onClick: this.deleteItem.bind(this) }, + ]) + this.initQueryForm() + this.initCreateForm() + } + + fetchData(p: {}, q: AnyObject) { + return this.api.getBasicMaintenanceVendorPage({ ...p, ...q }) + } + + onCreate(data?: NzSafeAny) { + if (data) { + this.createForm.patchValue(data) + } + this.drawerRef = this.drawer.create({ + nzTitle: data ? '编辑维保商' : '新增维保商', + nzContent: this.formContentTpl, + nzFooter: this.drawerFooterTpl, + nzWidth: 600, + nzOnCancel: this.onCancel.bind(this), + }) + } + + onConfirm() { + if (FormValidators.validateFormGroup(this.createForm)) { + const { value } = this.createForm + + this.api + .saveBasicMaintenanceVendor({ + ...value, + + // maintenanceVendorId: value.maintenanceVendorId ?? 0, + }) + .subscribe((res) => { + this.msg.success(res.desc) + this.onCancel() + this.table.ref.reload() + }) + } + } + + async onCancel() { + this.drawerRef?.close() + this.createForm.reset({}) + } + + deleteItem(item: NzSafeAny) { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '是否要删除该维保商?', + nzOnOk: async () => { + const res = await lastValueFrom(this.api.deleteBasicMaintenanceVendor([item.maintenanceVendorId])) + this.msg.success(res.desc) + this.table.ref.reload() + }, + }) + } +} diff --git a/web-admin-app/src/app/pages/fixed-asset/basic/basic-manufacturer/basic-manufacturer.component.html b/web-admin-app/src/app/pages/fixed-asset/basic/basic-manufacturer/basic-manufacturer.component.html new file mode 100644 index 0000000..3d993e6 --- /dev/null +++ b/web-admin-app/src/app/pages/fixed-asset/basic/basic-manufacturer/basic-manufacturer.component.html @@ -0,0 +1,75 @@ + + + + + + +
+ + + @switch (key) { + @case ('status') { + + } + + @default { + {{ data }} + } + } + + + + + + + + + + + +
+
+ + + + + + + + + +
+ + 名称 + + + + + + 编码 + + + + + + + 地址 + + + + + + 备注 + + + + +
+
+ + + + diff --git a/web-admin-app/src/app/pages/component-org-tree/component-org-tree.component.less b/web-admin-app/src/app/pages/fixed-asset/basic/basic-manufacturer/basic-manufacturer.component.less similarity index 100% rename from web-admin-app/src/app/pages/component-org-tree/component-org-tree.component.less rename to web-admin-app/src/app/pages/fixed-asset/basic/basic-manufacturer/basic-manufacturer.component.less diff --git a/web-admin-app/src/app/pages/fixed-asset/basic/basic-manufacturer/basic-manufacturer.component.ts b/web-admin-app/src/app/pages/fixed-asset/basic/basic-manufacturer/basic-manufacturer.component.ts new file mode 100644 index 0000000..f915dff --- /dev/null +++ b/web-admin-app/src/app/pages/fixed-asset/basic/basic-manufacturer/basic-manufacturer.component.ts @@ -0,0 +1,130 @@ +import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core' +import { SharedModule } from 'app/shared/shared.module' + +import { ApiService } from 'app/services' +import { FormBuilder, FormGroup } from '@angular/forms' +import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' +import { NzSafeAny } from 'ng-zorro-antd/core/types' +import { NzModalService } from 'ng-zorro-antd/modal' +import { NzMessageService } from 'ng-zorro-antd/message' +import { NzDrawerRef, NzDrawerService } from 'ng-zorro-antd/drawer' +import { lastValueFrom } from 'rxjs' +import { FormValidators } from 'app/utils' + +@Component({ + selector: 'app-basic-manufacturer', + standalone: true, + imports: [SharedModule], + templateUrl: './basic-manufacturer.component.html', + styleUrl: './basic-manufacturer.component.less', +}) +export class BasicManufacturerComponent { + constructor( + private modal: NzModalService, + private msg: NzMessageService, + private drawer: NzDrawerService, + private api: ApiService, + private fb: FormBuilder, + ) {} + + table = new TableOption(this.fetchData.bind(this)) + + queryForm!: FormGroup + + createForm!: FormGroup + + drawerRef?: NzDrawerRef + + @ViewChild('drawerFooterTpl') drawerFooterTpl!: TemplateRef + + @ViewChild('formContentTpl') formContentTpl!: TemplateRef + + initCreateForm() { + this.createForm = this.fb.group({ + manufacturersVendorId: [], + name: ['', [FormValidators.required('请输入')]], + code: ['', []], + notes: ['', []], + address: ['', []], + }) + } + initQueryForm() { + this.queryForm = this.fb.group({ + name: [''], + + code: [''], + }) + } + + ngOnInit(): void { + this.table + + .setColumn([ + { key: 'manufacturersVendorId', title: '主键', visible: false }, + { key: 'name', title: '名称' }, + { key: 'code', title: '编码' }, + + { key: 'address', title: '地址' }, + { key: 'notes', title: '备注' }, + { key: 'createTime', title: '创建时间' }, + ]) + .setRowOperate([ + { title: '编辑', onClick: this.onCreate.bind(this) }, + { title: '删除', onClick: this.deleteItem.bind(this) }, + ]) + this.initQueryForm() + this.initCreateForm() + } + + fetchData(p: {}, q: AnyObject) { + return this.api.getBasicManufacturersVendorPage({ ...p, ...q }) + } + + onCreate(data?: NzSafeAny) { + if (data) { + this.createForm.patchValue(data) + } + this.drawerRef = this.drawer.create({ + nzTitle: data ? '编辑生产商' : '新增生产商', + nzContent: this.formContentTpl, + nzFooter: this.drawerFooterTpl, + nzWidth: 600, + nzOnCancel: this.onCancel.bind(this), + }) + } + + onConfirm() { + if (FormValidators.validateFormGroup(this.createForm)) { + const { value } = this.createForm + + this.api + .saveBasicManufacturersVendor({ + ...value, + + // manufacturersVendorId: value.manufacturersVendorId ?? 0, + }) + .subscribe((res) => { + this.msg.success(res.desc) + this.onCancel() + this.table.ref.reload() + }) + } + } + + async onCancel() { + this.drawerRef?.close() + this.createForm.reset({}) + } + + deleteItem(item: NzSafeAny) { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '是否要删除该生产商?', + nzOnOk: async () => { + const res = await lastValueFrom(this.api.deleteBasicManufacturersVendor([item.manufacturersVendorId])) + this.msg.success(res.desc) + this.table.ref.reload() + }, + }) + } +} diff --git a/web-admin-app/src/app/pages/fixed-asset/basic/basic-supplier/basic-supplier.component.html b/web-admin-app/src/app/pages/fixed-asset/basic/basic-supplier/basic-supplier.component.html new file mode 100644 index 0000000..07a59f6 --- /dev/null +++ b/web-admin-app/src/app/pages/fixed-asset/basic/basic-supplier/basic-supplier.component.html @@ -0,0 +1,108 @@ + + + + + + +
+ + + @switch (key) { + @case ('status') { + + } + + @default { + {{ data }} + } + } + + + + + + + + + + + + + + +
+
+ + + + + + + + + +
+ + 名称 + + + + + + 编码 + + + + + + 统一社会信用代码 + + + + + + 商务联系人 + + + + + + 商务联系方式 + + + + + + 售后联系人 + + + + + + 售后联系方式 + + + + + + + 地址 + + + + + + 备注 + + + + +
+
+ + + + diff --git a/web-admin-app/src/app/pages/system/system.component.less b/web-admin-app/src/app/pages/fixed-asset/basic/basic-supplier/basic-supplier.component.less similarity index 100% rename from web-admin-app/src/app/pages/system/system.component.less rename to web-admin-app/src/app/pages/fixed-asset/basic/basic-supplier/basic-supplier.component.less diff --git a/web-admin-app/src/app/pages/fixed-asset/basic/basic-supplier/basic-supplier.component.ts b/web-admin-app/src/app/pages/fixed-asset/basic/basic-supplier/basic-supplier.component.ts new file mode 100644 index 0000000..c4fa1af --- /dev/null +++ b/web-admin-app/src/app/pages/fixed-asset/basic/basic-supplier/basic-supplier.component.ts @@ -0,0 +1,135 @@ +import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core' +import { SharedModule } from 'app/shared/shared.module' + +import { ApiService } from 'app/services' +import { FormBuilder, FormGroup } from '@angular/forms' +import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' +import { NzSafeAny } from 'ng-zorro-antd/core/types' +import { NzModalService } from 'ng-zorro-antd/modal' +import { NzMessageService } from 'ng-zorro-antd/message' +import { NzDrawerRef, NzDrawerService } from 'ng-zorro-antd/drawer' +import { lastValueFrom } from 'rxjs' +import { FormValidators } from 'app/utils' + +@Component({ + selector: 'app-basic-supplier', + standalone: true, + imports: [SharedModule], + templateUrl: './basic-supplier.component.html', + styleUrl: './basic-supplier.component.less', +}) +export class BasicSupplierComponent { + constructor( + private modal: NzModalService, + private msg: NzMessageService, + private drawer: NzDrawerService, + private api: ApiService, + private fb: FormBuilder, + ) {} + + table = new TableOption(this.fetchData.bind(this)) + + queryForm!: FormGroup + + createForm!: FormGroup + + drawerRef?: NzDrawerRef + + @ViewChild('drawerFooterTpl') drawerFooterTpl!: TemplateRef + + @ViewChild('formContentTpl') formContentTpl!: TemplateRef + + initCreateForm() { + this.createForm = this.fb.group({ + supplierVendorId: [], + name: ['', [FormValidators.required('请输入')]], + code: ['', []], + uscc: ['', []], + notes: ['', []], + businessContactor: ['', []], + businessContact: ['', []], + afterSalesContactor: ['', []], + afterSalesContact: ['', []], + address: ['', []], + }) + } + initQueryForm() { + this.queryForm = this.fb.group({ + name: [''], + uscc: [''], + code: [''], + }) + } + + ngOnInit(): void { + this.table + + .setColumn([ + { key: 'name', title: '名称' }, + { key: 'code', title: '编码' }, + { key: 'uscc', title: '统一社会信用代码' }, + { key: 'businessContactor', title: '商务联系人' }, + { key: 'businessContact', title: '商务联系方式' }, + { key: 'afterSalesContactor', title: '售后联系人' }, + { key: 'afterSalesContact', title: '售后联系方式' }, + { key: 'address', title: '地址' }, + { key: 'notes', title: '备注' }, + ]) + .setRowOperate([ + { title: '编辑', onClick: this.onCreate.bind(this) }, + { title: '删除', onClick: this.deleteItem.bind(this) }, + ]) + this.initQueryForm() + this.initCreateForm() + } + + fetchData(p: {}, q: AnyObject) { + return this.api.getBasicSupplierVendorPage({ ...p, ...q }) + } + + onCreate(data?: NzSafeAny) { + if (data) { + this.createForm.patchValue(data) + } + this.drawerRef = this.drawer.create({ + nzTitle: data ? '编辑供应商' : '新增供应商', + nzContent: this.formContentTpl, + nzFooter: this.drawerFooterTpl, + nzWidth: 600, + nzOnCancel: this.onCancel.bind(this), + }) + } + + onConfirm() { + if (FormValidators.validateFormGroup(this.createForm)) { + const { value } = this.createForm + + this.api + .saveBasicSupplierVendor({ + ...value, + }) + .subscribe((res) => { + this.msg.success(res.desc) + this.onCancel() + this.table.ref.reload() + }) + } + } + + async onCancel() { + this.drawerRef?.close() + this.createForm.reset({}) + } + + deleteItem(item: NzSafeAny) { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '是否要删除该供应商?', + nzOnOk: async () => { + const res = await lastValueFrom(this.api.deleteBasicSupplierVendor([item.supplierVendorId])) + this.msg.success(res.desc) + this.table.ref.reload() + }, + }) + } +} diff --git a/web-admin-app/src/app/pages/fixed-asset/basic/basic-warehouse/basic-warehouse.component.html b/web-admin-app/src/app/pages/fixed-asset/basic/basic-warehouse/basic-warehouse.component.html new file mode 100644 index 0000000..fa34e2d --- /dev/null +++ b/web-admin-app/src/app/pages/fixed-asset/basic/basic-warehouse/basic-warehouse.component.html @@ -0,0 +1,77 @@ + + + + + + +
+
+ + + @switch (key) { + @case ('status') { + + } + + @default { + {{ data }} + } + } + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + +
+ + 名称 + + + + + + 状态 + + + + + + + +
+
+ + + + diff --git a/web-admin-app/src/app/pages/fixed-asset/basic/basic-warehouse/basic-warehouse.component.less b/web-admin-app/src/app/pages/fixed-asset/basic/basic-warehouse/basic-warehouse.component.less new file mode 100644 index 0000000..e69de29 diff --git a/web-admin-app/src/app/pages/fixed-asset/basic/basic-warehouse/basic-warehouse.component.ts b/web-admin-app/src/app/pages/fixed-asset/basic/basic-warehouse/basic-warehouse.component.ts new file mode 100644 index 0000000..b546817 --- /dev/null +++ b/web-admin-app/src/app/pages/fixed-asset/basic/basic-warehouse/basic-warehouse.component.ts @@ -0,0 +1,125 @@ +import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core' +import { SharedModule } from 'app/shared/shared.module' + +import { ApiService } from 'app/services' +import { FormBuilder, FormGroup } from '@angular/forms' +import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' +import { NzSafeAny } from 'ng-zorro-antd/core/types' +import { NzModalService } from 'ng-zorro-antd/modal' +import { NzMessageService } from 'ng-zorro-antd/message' +import { NzDrawerRef, NzDrawerService } from 'ng-zorro-antd/drawer' +import { lastValueFrom } from 'rxjs' +import { FormValidators } from 'app/utils' + +@Component({ + selector: 'app-basic-warehouse', + standalone: true, + imports: [SharedModule], + templateUrl: './basic-warehouse.component.html', + styleUrl: './basic-warehouse.component.less', +}) +export class BasicWarehouseComponent { + constructor( + private modal: NzModalService, + private msg: NzMessageService, + private drawer: NzDrawerService, + private api: ApiService, + private fb: FormBuilder, + ) {} + + table = new TableOption(this.fetchData.bind(this)) + + queryForm!: FormGroup + + createForm!: FormGroup + + drawerRef?: NzDrawerRef + + @ViewChild('drawerFooterTpl') drawerFooterTpl!: TemplateRef + + @ViewChild('formContentTpl') formContentTpl!: TemplateRef + + initCreateForm() { + this.createForm = this.fb.group({ + warehouseId: [], + name: ['', [FormValidators.required('请输入')]], + status: [0, [FormValidators.required('请选择')]], + notes: ['', []], + }) + } + initQueryForm() { + this.queryForm = this.fb.group({ + name: [''], + status: [], + }) + } + + ngOnInit(): void { + this.table + + .setColumn([ + { key: 'warehouseId', title: '主键', visible: false }, + { key: 'name', title: '名称' }, + { key: 'status', title: '状态' }, + { key: 'createTime', title: '创建时间' }, + ]) + .setRowOperate([ + { title: '编辑', onClick: this.onCreate.bind(this) }, + { title: '删除', onClick: this.deleteItem.bind(this) }, + ]) + this.initQueryForm() + this.initCreateForm() + } + + fetchData(p: {}, q: AnyObject) { + return this.api.getBasicWarehousePage({ ...p, ...q }) + } + + onCreate(data?: NzSafeAny) { + if (data) { + this.createForm.patchValue(data) + } + this.drawerRef = this.drawer.create({ + nzTitle: data ? '编辑存放仓库' : '新增存放仓库', + nzContent: this.formContentTpl, + nzFooter: this.drawerFooterTpl, + nzWidth: 600, + nzOnCancel: this.onCancel.bind(this), + }) + } + + onConfirm() { + if (FormValidators.validateFormGroup(this.createForm)) { + const { value } = this.createForm + + this.api + .saveBasicWarehouse({ + ...value, + + // warehouseId: value.warehouseId ?? 0, + }) + .subscribe((res) => { + this.msg.success(res.desc) + this.onCancel() + this.table.ref.reload() + }) + } + } + + async onCancel() { + this.drawerRef?.close() + this.createForm.reset({ status: 0 }) + } + + deleteItem(item: NzSafeAny) { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '是否要删除该存放仓库?', + nzOnOk: async () => { + const res = await lastValueFrom(this.api.deleteBasicWarehouse([item.warehouseId])) + this.msg.success(res.desc) + this.table.ref.reload() + }, + }) + } +} diff --git a/web-admin-app/src/app/pages/fixed-asset/basic/save-position/save-position.component.html b/web-admin-app/src/app/pages/fixed-asset/basic/save-position/save-position.component.html new file mode 100644 index 0000000..c5facf6 --- /dev/null +++ b/web-admin-app/src/app/pages/fixed-asset/basic/save-position/save-position.component.html @@ -0,0 +1,55 @@ + + + + + + +
+
+ + + @switch (key) { + @case ('status') { + + } + + @default { + {{ data }} + } + } + + + + + + + + +
+
+
+ + + + + + + + + +
+ + 名称 + + + + +
+
+ + + + diff --git a/web-admin-app/src/app/pages/fixed-asset/basic/save-position/save-position.component.less b/web-admin-app/src/app/pages/fixed-asset/basic/save-position/save-position.component.less new file mode 100644 index 0000000..e69de29 diff --git a/web-admin-app/src/app/pages/fixed-asset/basic/save-position/save-position.component.ts b/web-admin-app/src/app/pages/fixed-asset/basic/save-position/save-position.component.ts new file mode 100644 index 0000000..154521f --- /dev/null +++ b/web-admin-app/src/app/pages/fixed-asset/basic/save-position/save-position.component.ts @@ -0,0 +1,122 @@ +import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core' +import { SharedModule } from 'app/shared/shared.module' +import { ComponentOrgTreeComponent } from 'app/components/component-org-tree/component-org-tree.component' + +import { format } from 'date-fns' +import { ApiService } from 'app/services' +import { FormBuilder, FormGroup } from '@angular/forms' +import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' +import { NzSafeAny } from 'ng-zorro-antd/core/types' +import { NzModalService } from 'ng-zorro-antd/modal' +import { NzMessageService } from 'ng-zorro-antd/message' +import { NzDrawerRef, NzDrawerService } from 'ng-zorro-antd/drawer' +import { lastValueFrom } from 'rxjs' +import { FormValidators } from 'app/utils' + +@Component({ + selector: 'app-save-position', + standalone: true, + imports: [SharedModule, ComponentOrgTreeComponent], + templateUrl: './save-position.component.html', + styleUrl: './save-position.component.less', +}) +export class SavePositionComponent implements OnInit { + constructor( + private modal: NzModalService, + private msg: NzMessageService, + private drawer: NzDrawerService, + private api: ApiService, + private fb: FormBuilder, + ) {} + + table = new TableOption(this.fetchData.bind(this)) + + queryForm!: FormGroup + + createForm!: FormGroup + + drawerRef?: NzDrawerRef + + @ViewChild('drawerFooterTpl') drawerFooterTpl!: TemplateRef + + @ViewChild('formContentTpl') formContentTpl!: TemplateRef + + initCreateForm() { + this.createForm = this.fb.group({ + positionId: [], + name: ['', FormValidators.required('请输入')], + }) + } + initQueryForm() { + this.queryForm = this.fb.group({ + name: [''], + }) + } + + ngOnInit(): void { + this.table + + .setColumn([ + { key: 'positionId', title: '编号', width: '100px' }, + { key: 'name', title: '名称' }, + ]) + .setRowOperate([ + { title: '编辑', onClick: this.onCreate.bind(this) }, + { title: '删除', onClick: this.deleteItem.bind(this) }, + ]) + this.initQueryForm() + this.initCreateForm() + } + + fetchData(p: {}, q: AnyObject) { + return this.api.getBasicPositionPage({ ...p, ...q }) + } + + onCreate(data?: NzSafeAny) { + if (data) { + this.createForm.patchValue(data) + } + this.drawerRef = this.drawer.create({ + nzTitle: data ? '编辑存放位置' : '新增存放位置', + nzContent: this.formContentTpl, + nzFooter: this.drawerFooterTpl, + nzWidth: 600, + nzOnCancel: this.onCancel.bind(this), + }) + } + + onConfirm() { + if (FormValidators.validateFormGroup(this.createForm)) { + const { value } = this.createForm + + this.api + .saveBasicPosition({ + ...value, + parentId: 0, + positionId: value.positionId ?? 0, + }) + .subscribe((res) => { + this.msg.success(res.desc) + this.onCancel() + this.table.ref.reload() + }) + } + } + + async onCancel() { + this.drawerRef?.close() + this.createForm.reset({}) + } + + deleteItem(item: NzSafeAny) { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '是否要删除该存放位置?', + nzOnOk: async () => { + const res = await lastValueFrom(this.api.deleteBasicPosition([item.positionId])) + this.msg.success(res.desc) + this.table.ref.reload() + }, + }) + } +} diff --git a/web-admin-app/src/app/pages/fixed-asset/fixed-asset.component.html b/web-admin-app/src/app/pages/fixed-asset/fixed-asset.component.html index a082672..b37b3a0 100644 --- a/web-admin-app/src/app/pages/fixed-asset/fixed-asset.component.html +++ b/web-admin-app/src/app/pages/fixed-asset/fixed-asset.component.html @@ -1,4 +1,6 @@ -
+ - +
+ +
diff --git a/web-admin-app/src/app/pages/fixed-asset/fixed-asset.component.less b/web-admin-app/src/app/pages/fixed-asset/fixed-asset.component.less index 0bf4d7d..9d03848 100644 --- a/web-admin-app/src/app/pages/fixed-asset/fixed-asset.component.less +++ b/web-admin-app/src/app/pages/fixed-asset/fixed-asset.component.less @@ -1,4 +1,6 @@ -:host { - display: flex !important; - width: 100%; -} \ No newline at end of file +// :host { +// display: flex !important; +// width: auto; +// overflow: hidden; + +// } \ No newline at end of file diff --git a/web-admin-app/src/app/pages/fixed-asset/ledger/fixed-asset-belong/fixed-asset-belong.component.ts b/web-admin-app/src/app/pages/fixed-asset/ledger/fixed-asset-belong/fixed-asset-belong.component.ts index 1831785..13e06f3 100644 --- a/web-admin-app/src/app/pages/fixed-asset/ledger/fixed-asset-belong/fixed-asset-belong.component.ts +++ b/web-admin-app/src/app/pages/fixed-asset/ledger/fixed-asset-belong/fixed-asset-belong.component.ts @@ -1,7 +1,7 @@ import { Component } from '@angular/core' import { FormControl, FormGroup } from '@angular/forms' -import { AnyObject, TableOption } from 'app/components/server-paginated-table' -import { ComponentOrgTreeComponent } from 'app/pages/component-org-tree/component-org-tree.component' +import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' +import { ComponentOrgTreeComponent } from 'app/components/component-org-tree/component-org-tree.component' import { ApiService } from 'app/services' import { SharedModule } from 'app/shared/shared.module' import { format } from 'date-fns' diff --git a/web-admin-app/src/app/pages/fixed-asset/ledger/fixed-asset-category/fixed-asset-category.component.ts b/web-admin-app/src/app/pages/fixed-asset/ledger/fixed-asset-category/fixed-asset-category.component.ts index d1177e8..3d5ebbe 100644 --- a/web-admin-app/src/app/pages/fixed-asset/ledger/fixed-asset-category/fixed-asset-category.component.ts +++ b/web-admin-app/src/app/pages/fixed-asset/ledger/fixed-asset-category/fixed-asset-category.component.ts @@ -1,6 +1,6 @@ import { Component } from '@angular/core' import { FormControl, FormGroup } from '@angular/forms' -import { AnyObject, TableOption } from 'app/components/server-paginated-table' +import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' import { ApiService } from 'app/services' import { SharedModule } from 'app/shared/shared.module' import { format } from 'date-fns' diff --git a/web-admin-app/src/app/pages/fixed-asset/ledger/fixed-asset-employee/fixed-asset-employee.component.ts b/web-admin-app/src/app/pages/fixed-asset/ledger/fixed-asset-employee/fixed-asset-employee.component.ts index 585af41..da794c7 100644 --- a/web-admin-app/src/app/pages/fixed-asset/ledger/fixed-asset-employee/fixed-asset-employee.component.ts +++ b/web-admin-app/src/app/pages/fixed-asset/ledger/fixed-asset-employee/fixed-asset-employee.component.ts @@ -1,6 +1,6 @@ import { Component } from '@angular/core' import { FormControl, FormGroup } from '@angular/forms' -import { AnyObject, TableOption } from 'app/components/server-paginated-table' +import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' import { ApiService } from 'app/services' import { SharedModule } from 'app/shared/shared.module' import { format } from 'date-fns' diff --git a/web-admin-app/src/app/pages/fixed-asset/ledger/fixed-asset-ledger/fixed-asset-ledger.component.ts b/web-admin-app/src/app/pages/fixed-asset/ledger/fixed-asset-ledger/fixed-asset-ledger.component.ts index 74d3c42..5348189 100644 --- a/web-admin-app/src/app/pages/fixed-asset/ledger/fixed-asset-ledger/fixed-asset-ledger.component.ts +++ b/web-admin-app/src/app/pages/fixed-asset/ledger/fixed-asset-ledger/fixed-asset-ledger.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core' import { ActivatedRoute, NavigationEnd, Router } from '@angular/router' -import { AppPageComponent } from 'app/components/app-page/app-page.component' + import { SharedModule } from 'app/shared/shared.module' import { Subscription, filter } from 'rxjs' @@ -38,7 +38,7 @@ const tabs = [ @Component({ selector: 'app-fixed-asset-ledger', standalone: true, - imports: [SharedModule, AppPageComponent], + imports: [SharedModule], templateUrl: './fixed-asset-ledger.component.html', styleUrl: './fixed-asset-ledger.component.less', }) diff --git a/web-admin-app/src/app/pages/fixed-asset/ledger/fixed-asset-myown/fixed-asset-myown.component.ts b/web-admin-app/src/app/pages/fixed-asset/ledger/fixed-asset-myown/fixed-asset-myown.component.ts index f78c8ad..69d2a0e 100644 --- a/web-admin-app/src/app/pages/fixed-asset/ledger/fixed-asset-myown/fixed-asset-myown.component.ts +++ b/web-admin-app/src/app/pages/fixed-asset/ledger/fixed-asset-myown/fixed-asset-myown.component.ts @@ -1,6 +1,6 @@ import { Component } from '@angular/core' import { FormControl, FormGroup } from '@angular/forms' -import { AnyObject, TableOption } from 'app/components/server-paginated-table' +import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' import { ApiService } from 'app/services' import { SharedModule } from 'app/shared/shared.module' import { format } from 'date-fns' diff --git a/web-admin-app/src/app/pages/fixed-asset/ledger/fixed-asset-org/fixed-asset-org.component.ts b/web-admin-app/src/app/pages/fixed-asset/ledger/fixed-asset-org/fixed-asset-org.component.ts index c313b7e..939825d 100644 --- a/web-admin-app/src/app/pages/fixed-asset/ledger/fixed-asset-org/fixed-asset-org.component.ts +++ b/web-admin-app/src/app/pages/fixed-asset/ledger/fixed-asset-org/fixed-asset-org.component.ts @@ -1,6 +1,6 @@ import { Component } from '@angular/core' import { FormControl, FormGroup } from '@angular/forms' -import { AnyObject, TableOption } from 'app/components/server-paginated-table' +import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' import { ApiService } from 'app/services' import { SharedModule } from 'app/shared/shared.module' import { format } from 'date-fns' diff --git a/web-admin-app/src/app/pages/fixed-asset/ledger/fixed-asset-position/fixed-asset-position.component.ts b/web-admin-app/src/app/pages/fixed-asset/ledger/fixed-asset-position/fixed-asset-position.component.ts index d26ca9f..5cef505 100644 --- a/web-admin-app/src/app/pages/fixed-asset/ledger/fixed-asset-position/fixed-asset-position.component.ts +++ b/web-admin-app/src/app/pages/fixed-asset/ledger/fixed-asset-position/fixed-asset-position.component.ts @@ -1,6 +1,6 @@ import { Component } from '@angular/core' import { FormControl, FormGroup } from '@angular/forms' -import { AnyObject, TableOption } from 'app/components/server-paginated-table' +import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' import { ApiService } from 'app/services' import { SharedModule } from 'app/shared/shared.module' import { format } from 'date-fns' diff --git a/web-admin-app/src/app/pages/fixed-asset/ledger/fixed-asset-search/fixed-asset-search.component.ts b/web-admin-app/src/app/pages/fixed-asset/ledger/fixed-asset-search/fixed-asset-search.component.ts index 3f802e0..a843f10 100644 --- a/web-admin-app/src/app/pages/fixed-asset/ledger/fixed-asset-search/fixed-asset-search.component.ts +++ b/web-admin-app/src/app/pages/fixed-asset/ledger/fixed-asset-search/fixed-asset-search.component.ts @@ -1,6 +1,6 @@ import { Component } from '@angular/core' import { FormControl, FormGroup } from '@angular/forms' -import { AnyObject, TableOption } from 'app/components/server-paginated-table' +import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' import { ApiService } from 'app/services' import { SharedModule } from 'app/shared/shared.module' import { format } from 'date-fns' diff --git a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-allot/fixed-asset-manage-allot.component.ts b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-allot/fixed-asset-manage-allot.component.ts index a03d665..c056b51 100644 --- a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-allot/fixed-asset-manage-allot.component.ts +++ b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-allot/fixed-asset-manage-allot.component.ts @@ -1,7 +1,7 @@ import { Component } from '@angular/core' import { FormControl, FormGroup } from '@angular/forms' -import { AppPageComponent } from 'app/components/app-page/app-page.component' -import { AnyObject, TableOption } from 'app/components/server-paginated-table' + +import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' import { ApiService } from 'app/services' import { SharedModule } from 'app/shared/shared.module' import { format } from 'date-fns' @@ -10,7 +10,7 @@ import { of } from 'rxjs' @Component({ selector: 'app-fixed-asset-manage-allot', standalone: true, - imports: [SharedModule, AppPageComponent], + imports: [SharedModule], templateUrl: './fixed-asset-manage-allot.component.html', styleUrl: './fixed-asset-manage-allot.component.less', }) diff --git a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-borrow/fixed-asset-manage-borrow.component.ts b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-borrow/fixed-asset-manage-borrow.component.ts index 1bbdc27..f8188e7 100644 --- a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-borrow/fixed-asset-manage-borrow.component.ts +++ b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-borrow/fixed-asset-manage-borrow.component.ts @@ -1,7 +1,7 @@ import { Component } from '@angular/core' import { FormControl, FormGroup } from '@angular/forms' -import { AppPageComponent } from 'app/components/app-page/app-page.component' -import { AnyObject, TableOption } from 'app/components/server-paginated-table' + +import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' import { ApiService } from 'app/services' import { SharedModule } from 'app/shared/shared.module' import { format } from 'date-fns' @@ -9,7 +9,7 @@ import { of } from 'rxjs' @Component({ selector: 'app-fixed-asset-manage-borrow', standalone: true, - imports: [SharedModule, AppPageComponent], + imports: [SharedModule], templateUrl: './fixed-asset-manage-borrow.component.html', styleUrl: './fixed-asset-manage-borrow.component.less', }) diff --git a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-distribution/fixed-asset-manage-distribution.component.ts b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-distribution/fixed-asset-manage-distribution.component.ts index 6b7ec49..42969bd 100644 --- a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-distribution/fixed-asset-manage-distribution.component.ts +++ b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-distribution/fixed-asset-manage-distribution.component.ts @@ -1,7 +1,7 @@ import { Component } from '@angular/core' import { FormControl, FormGroup } from '@angular/forms' -import { AppPageComponent } from 'app/components/app-page/app-page.component' -import { AnyObject, TableOption } from 'app/components/server-paginated-table' + +import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' import { ApiService } from 'app/services' import { SharedModule } from 'app/shared/shared.module' import { format } from 'date-fns' @@ -10,7 +10,7 @@ import { of } from 'rxjs' @Component({ selector: 'app-fixed-asset-manage-distribution', standalone: true, - imports: [SharedModule, AppPageComponent], + imports: [SharedModule], templateUrl: './fixed-asset-manage-distribution.component.html', styleUrl: './fixed-asset-manage-distribution.component.less', }) diff --git a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-entry/fixed-asset-manage-entry.component.ts b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-entry/fixed-asset-manage-entry.component.ts index 00e8b53..26900f9 100644 --- a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-entry/fixed-asset-manage-entry.component.ts +++ b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-entry/fixed-asset-manage-entry.component.ts @@ -1,7 +1,7 @@ import { Component } from '@angular/core' import { FormControl, FormGroup } from '@angular/forms' -import { AppPageComponent } from 'app/components/app-page/app-page.component' -import { AnyObject, TableOption } from 'app/components/server-paginated-table' + +import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' import { ApiService } from 'app/services' import { SharedModule } from 'app/shared/shared.module' import { format } from 'date-fns' @@ -10,7 +10,7 @@ import { of } from 'rxjs' @Component({ selector: 'app-fixed-asset-manage-entry', standalone: true, - imports: [SharedModule, AppPageComponent], + imports: [SharedModule], templateUrl: './fixed-asset-manage-entry.component.html', styleUrl: './fixed-asset-manage-entry.component.less', }) diff --git a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-return/fixed-asset-manage-return.component.ts b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-return/fixed-asset-manage-return.component.ts index 2755cb8..65fe9ec 100644 --- a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-return/fixed-asset-manage-return.component.ts +++ b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-return/fixed-asset-manage-return.component.ts @@ -1,7 +1,7 @@ import { Component } from '@angular/core' import { FormControl, FormGroup } from '@angular/forms' -import { AppPageComponent } from 'app/components/app-page/app-page.component' -import { AnyObject, TableOption } from 'app/components/server-paginated-table' + +import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' import { ApiService } from 'app/services' import { SharedModule } from 'app/shared/shared.module' import { format } from 'date-fns' @@ -10,7 +10,7 @@ import { of } from 'rxjs' @Component({ selector: 'app-fixed-asset-manage-return', standalone: true, - imports: [SharedModule, AppPageComponent], + imports: [SharedModule], templateUrl: './fixed-asset-manage-return.component.html', styleUrl: './fixed-asset-manage-return.component.less', }) diff --git a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-revert/fixed-asset-manage-revert.component.ts b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-revert/fixed-asset-manage-revert.component.ts index 2fc5e15..ec4c127 100644 --- a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-revert/fixed-asset-manage-revert.component.ts +++ b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-revert/fixed-asset-manage-revert.component.ts @@ -1,8 +1,8 @@ import { Component } from '@angular/core' import { FormControl, FormGroup } from '@angular/forms' -import { AppPageComponent } from 'app/components/app-page/app-page.component' -import { AnyObject, TableOption } from 'app/components/server-paginated-table' + import { ApiService } from 'app/services' +import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' import { SharedModule } from 'app/shared/shared.module' import { format } from 'date-fns' import { of } from 'rxjs' @@ -10,7 +10,7 @@ import { of } from 'rxjs' @Component({ selector: 'app-fixed-asset-manage-revert', standalone: true, - imports: [SharedModule, AppPageComponent], + imports: [SharedModule], templateUrl: './fixed-asset-manage-revert.component.html', styleUrl: './fixed-asset-manage-revert.component.less', }) diff --git a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-scrap/fixed-asset-manage-scrap.component.ts b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-scrap/fixed-asset-manage-scrap.component.ts index 33add4b..2733c91 100644 --- a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-scrap/fixed-asset-manage-scrap.component.ts +++ b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-scrap/fixed-asset-manage-scrap.component.ts @@ -1,7 +1,7 @@ import { Component } from '@angular/core' import { FormControl, FormGroup } from '@angular/forms' -import { AppPageComponent } from 'app/components/app-page/app-page.component' -import { AnyObject, TableOption } from 'app/components/server-paginated-table' + +import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' import { ApiService } from 'app/services' import { SharedModule } from 'app/shared/shared.module' import { format } from 'date-fns' @@ -10,7 +10,7 @@ import { of } from 'rxjs' @Component({ selector: 'app-fixed-asset-manage-scrap', standalone: true, - imports: [SharedModule, AppPageComponent], + imports: [SharedModule], templateUrl: './fixed-asset-manage-scrap.component.html', styleUrl: './fixed-asset-manage-scrap.component.less', }) diff --git a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-transfer/fixed-asset-manage-transfer.component.ts b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-transfer/fixed-asset-manage-transfer.component.ts index 2bc5d0d..cd7c6d2 100644 --- a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-transfer/fixed-asset-manage-transfer.component.ts +++ b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-transfer/fixed-asset-manage-transfer.component.ts @@ -1,7 +1,7 @@ import { Component } from '@angular/core' import { FormControl, FormGroup } from '@angular/forms' -import { AppPageComponent } from 'app/components/app-page/app-page.component' -import { AnyObject, TableOption } from 'app/components/server-paginated-table' + +import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' import { ApiService } from 'app/services' import { SharedModule } from 'app/shared/shared.module' import { format } from 'date-fns' @@ -10,7 +10,7 @@ import { of } from 'rxjs' @Component({ selector: 'app-fixed-asset-manage-transfer', standalone: true, - imports: [SharedModule, AppPageComponent], + imports: [SharedModule], templateUrl: './fixed-asset-manage-transfer.component.html', styleUrl: './fixed-asset-manage-transfer.component.less', }) diff --git a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage/fixed-asset-manage.component.ts b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage/fixed-asset-manage.component.ts index 385408e..8ae9f18 100644 --- a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage/fixed-asset-manage.component.ts +++ b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage/fixed-asset-manage.component.ts @@ -1,7 +1,7 @@ import { Component } from '@angular/core' import { FormControl, FormGroup } from '@angular/forms' -import { AppPageComponent } from 'app/components/app-page/app-page.component' -import { AnyObject, TableOption } from 'app/components/server-paginated-table' + +import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' import { ApiService } from 'app/services' import { SharedModule } from 'app/shared/shared.module' import { format } from 'date-fns' @@ -10,7 +10,7 @@ import { of } from 'rxjs' @Component({ selector: 'app-fixed-asset-manage', standalone: true, - imports: [SharedModule, AppPageComponent], + imports: [SharedModule], templateUrl: './fixed-asset-manage.component.html', styleUrl: './fixed-asset-manage.component.less', }) diff --git a/web-admin-app/src/app/pages/fixed-asset/stocktaking/stockaking-job/stockaking-job.component.html b/web-admin-app/src/app/pages/fixed-asset/stocktaking/stockaking-job/stockaking-job.component.html new file mode 100644 index 0000000..8c07129 --- /dev/null +++ b/web-admin-app/src/app/pages/fixed-asset/stocktaking/stockaking-job/stockaking-job.component.html @@ -0,0 +1,179 @@ + +
+ + + @switch (key) { + @case ('fullStocktaking') { + @switch (data) { + @case (0) { + + } + @case (1) { + + } + @default { + - + } + } + } + @case ('status') { + @switch (data) { + @case (0) { + + } + @case (1) { + + } + @case (2) { + + } + @case (3) { + + } + @default { + - + } + } + } + + @default { + {{ data }} + } + } + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + +
+ + 名称 + + + + + + 全员盘点 + + + + + + + + + 负责人 + + + + + + 盘点人 + + + + + 备注 + + + + + +

盘点范围

+ + 购置开始日期 + + + + + + 购置结束日期 + + + + + + 资产分类 + + + + + + 资产状态 + + + + + + 位置 + + + + + + 仓库 + + + + + + 所属公司 + + + + + + 使用公司/部门 + + + + + + 保管人 + + + + +
+
+ + + + diff --git a/web-admin-app/src/app/pages/fixed-asset/stocktaking/stockaking-job/stockaking-job.component.less b/web-admin-app/src/app/pages/fixed-asset/stocktaking/stockaking-job/stockaking-job.component.less new file mode 100644 index 0000000..e69de29 diff --git a/web-admin-app/src/app/pages/fixed-asset/stocktaking/stockaking-job/stockaking-job.component.ts b/web-admin-app/src/app/pages/fixed-asset/stocktaking/stockaking-job/stockaking-job.component.ts new file mode 100644 index 0000000..df8e92d --- /dev/null +++ b/web-admin-app/src/app/pages/fixed-asset/stocktaking/stockaking-job/stockaking-job.component.ts @@ -0,0 +1,162 @@ +import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core' +import { SharedModule } from 'app/shared/shared.module' +import { ApiService } from 'app/services' +import { FormBuilder, FormGroup } from '@angular/forms' +import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' +import { NzSafeAny } from 'ng-zorro-antd/core/types' +import { NzModalService } from 'ng-zorro-antd/modal' +import { NzMessageService } from 'ng-zorro-antd/message' +import { NzDrawerRef, NzDrawerService } from 'ng-zorro-antd/drawer' +import { lastValueFrom } from 'rxjs' +import { FormValidators } from 'app/utils' +import { SelectUserByOrgComponent } from 'app/components' + +@Component({ + selector: 'app-stockaking-job', + standalone: true, + imports: [SharedModule, SelectUserByOrgComponent], + templateUrl: './stockaking-job.component.html', + styleUrl: './stockaking-job.component.less', +}) +export class StockakingJobComponent { + constructor( + private modal: NzModalService, + private msg: NzMessageService, + private drawer: NzDrawerService, + private api: ApiService, + private fb: FormBuilder, + ) {} + + table = new TableOption(this.fetchData.bind(this)) + + queryForm!: FormGroup + + createForm!: FormGroup + + drawerRef?: NzDrawerRef + + @ViewChild('drawerFooterTpl') drawerFooterTpl!: TemplateRef + + @ViewChild('formContentTpl') formContentTpl!: TemplateRef + + initCreateForm() { + this.createForm = this.fb.group({ + stocktakingJobId: [], + name: ['', [FormValidators.required('请输入')]], + notes: ['', []], + fullStocktaking: [1, []], + stocktakingStartDate: [null, []], + stocktakingEndDate: [null, []], + }) + } + initQueryForm() { + this.queryForm = this.fb.group({ + name: [''], + uscc: [''], + code: [''], + }) + } + + ngOnInit(): void { + this.table + .setConfig({ + selectable: true, + rowKey: 'stocktakingJobId', + }) + .setColumn([ + { key: 'name', title: '名称' }, + { key: 'fullStocktaking', title: '全员盘点' }, + { key: 'status', title: '盘点状态' }, + { key: 'head', title: '负责人' }, + { key: 'stocktakingUserId', title: '盘点人' }, + { key: 'stocktakingStartDate', title: '购置开始日期', width: '180px' }, + { key: 'stocktakingEndDate', title: '购置结束日期', width: '180px' }, + { key: 'createTime', title: '创建时间', width: '180px' }, + { key: 'createUser', title: '创建人' }, + { key: 'notes', title: '备注' }, + ]) + .setRowOperate([ + { title: '编辑', onClick: this.onCreate.bind(this) }, + { title: '编辑', onClick: this.onCreate.bind(this) }, + { title: '删除', onClick: this.deleteItem.bind(this) }, + ]) + this.initQueryForm() + this.initCreateForm() + } + + fetchData(p: {}, q: AnyObject) { + return this.api.getStocktakingJobPage({ ...p, ...q }) + } + + onCreate(data?: NzSafeAny) { + if (data) { + this.createForm.patchValue(data) + } + this.drawerRef = this.drawer.create({ + nzTitle: data ? '编辑盘点任务' : '新增盘点任务', + nzContent: this.formContentTpl, + nzFooter: this.drawerFooterTpl, + nzWidth: 600, + nzOnCancel: this.onCancel.bind(this), + }) + } + + onConfirm() { + if (FormValidators.validateFormGroup(this.createForm)) { + const { value } = this.createForm + + this.api + .saveStocktakingJob({ + ...value, + + // stocktakingJobId: value.stocktakingJobId ?? 0, + }) + .subscribe((res) => { + this.msg.success(res.desc) + this.onCancel() + this.table.ref.reload() + }) + } + } + + async onCancel() { + this.drawerRef?.close() + this.createForm.reset({}) + } + + deleteItem(item: NzSafeAny) { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '是否要删除该盘点任务?', + nzOnOk: async () => { + const res = await lastValueFrom(this.api.deleteStocktakingJob([item.stocktakingJobId])) + this.msg.success(res.desc) + this.table.ref.reload() + }, + }) + } + onBegin() { + const ids = Array.from(this.table.ref.selected).map((i) => Number(i)) + this.modal.confirm({ + nzTitle: '警告', + nzContent: '是否要开始该盘点任务?', + nzOnOk: async () => { + const res = await lastValueFrom(this.api.beginStocktakingJob(ids)) + this.msg.success(res.desc) + this.table.ref.reload() + }, + }) + } + onStop() { + const ids = Array.from(this.table.ref.selected).map((i) => Number(i)) + this.modal.confirm({ + nzTitle: '警告', + nzContent: '是否要结束该盘点任务?', + nzOnOk: async () => { + const res = await lastValueFrom(this.api.stopStocktakingJob(ids)) + this.msg.success(res.desc) + this.table.ref.reload() + }, + }) + } +} diff --git a/web-admin-app/src/app/pages/fixed-asset/stocktaking/stockaking-plan/stockaking-plan.component.html b/web-admin-app/src/app/pages/fixed-asset/stocktaking/stockaking-plan/stockaking-plan.component.html new file mode 100644 index 0000000..31ce39d --- /dev/null +++ b/web-admin-app/src/app/pages/fixed-asset/stocktaking/stockaking-plan/stockaking-plan.component.html @@ -0,0 +1 @@ +

stockaking-plan works!

diff --git a/web-admin-app/src/app/pages/fixed-asset/stocktaking/stockaking-plan/stockaking-plan.component.less b/web-admin-app/src/app/pages/fixed-asset/stocktaking/stockaking-plan/stockaking-plan.component.less new file mode 100644 index 0000000..e69de29 diff --git a/web-admin-app/src/app/pages/fixed-asset/stocktaking/stockaking-plan/stockaking-plan.component.ts b/web-admin-app/src/app/pages/fixed-asset/stocktaking/stockaking-plan/stockaking-plan.component.ts new file mode 100644 index 0000000..2a32057 --- /dev/null +++ b/web-admin-app/src/app/pages/fixed-asset/stocktaking/stockaking-plan/stockaking-plan.component.ts @@ -0,0 +1,21 @@ +import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core' +import { SharedModule } from 'app/shared/shared.module' +import { ApiService } from 'app/services' +import { FormBuilder, FormGroup } from '@angular/forms' +import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' +import { NzSafeAny } from 'ng-zorro-antd/core/types' +import { NzModalService } from 'ng-zorro-antd/modal' +import { NzMessageService } from 'ng-zorro-antd/message' +import { NzDrawerRef, NzDrawerService } from 'ng-zorro-antd/drawer' +import { lastValueFrom } from 'rxjs' +import { FormValidators } from 'app/utils' +import { SelectUserByOrgComponent } from 'app/components' + +@Component({ + selector: 'app-stockaking-plan', + standalone: true, + imports: [], + templateUrl: './stockaking-plan.component.html', + styleUrl: './stockaking-plan.component.less', +}) +export class StockakingPlanComponent {} diff --git a/web-admin-app/src/app/pages/login/login.component.less b/web-admin-app/src/app/pages/login/login.component.less index 454d57d..d306dd6 100644 --- a/web-admin-app/src/app/pages/login/login.component.less +++ b/web-admin-app/src/app/pages/login/login.component.less @@ -4,8 +4,11 @@ .bg { background-image: url(/assets/images/login-bg.jpg); background-repeat: no-repeat; - background-size: cover; - filter: blur(1px); + background-position: bottom; + display: flex; + align-items: flex-end; + justify-content: center; + background-color: #3d62f1; } diff --git a/web-admin-app/src/app/pages/login/login.component.ts b/web-admin-app/src/app/pages/login/login.component.ts index d3d5f3d..d5f4f41 100644 --- a/web-admin-app/src/app/pages/login/login.component.ts +++ b/web-admin-app/src/app/pages/login/login.component.ts @@ -18,7 +18,6 @@ export class LoginComponent { constructor( private api: ApiService, private msg: NzMessageService, - private local: LocalHttpInterceptorService, private router: Router, ) {} @@ -39,13 +38,9 @@ export class LoginComponent { this.loading = false }), ) - .subscribe((res) => { + .subscribe(() => { this.msg.success('登录成功') - this.local.setAccess({ - access_token: res.body.authorization, - ...res.body, - }) - localStorage.setItem('add', res.data) + this.router.navigate(['/']) }) } diff --git a/web-admin-app/src/app/pages/org-setting/org-setting.component.html b/web-admin-app/src/app/pages/org-setting/org-setting.component.html index b394883..9436ede 100644 --- a/web-admin-app/src/app/pages/org-setting/org-setting.component.html +++ b/web-admin-app/src/app/pages/org-setting/org-setting.component.html @@ -1,40 +1,84 @@ - +
- +
- + + + @switch (key) { + @case ('avatar') { + @if (data) { + + } @else { + + } + } + @case ('status') { + + } + @case ('sex') { + + @switch (data) { + @case ('0') { + 男 + } + @case ('1') { + 女 + } + @default { + 未知 + } + } + + } + @default { + {{ data }} + } + } + - - + + - + - + - + - - - + + @@ -43,17 +87,103 @@ nzBorderless class="!w-auto" [nzDropdownMatchSelectWidth]="false" + formControlName="sex" + nzAllowClear > - - + + + - -
+ + + + + + + + + +
+ + 姓名 + + + + + + 账号名 + + + + + + 联系电话 + + + + + + 邮箱 + + + + + + + 密码 + + + + + + + 确认密码 + + + + + + 状态 + + + + + + + + + 头像 + + +
+ +
+ +
+
+ + 性别 + + + + + + + + +
+
+ + + + diff --git a/web-admin-app/src/app/pages/org-setting/org-setting.component.ts b/web-admin-app/src/app/pages/org-setting/org-setting.component.ts index c988e75..5fbbd66 100644 --- a/web-admin-app/src/app/pages/org-setting/org-setting.component.ts +++ b/web-admin-app/src/app/pages/org-setting/org-setting.component.ts @@ -1,92 +1,182 @@ -import { Component, OnInit } from '@angular/core' -import { AppPageComponent } from 'app/components/app-page/app-page.component' +import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core' import { SharedModule } from 'app/shared/shared.module' -import { ComponentOrgTreeComponent } from '../component-org-tree/component-org-tree.component' -import { AnyObject, TableOption } from 'app/components/server-paginated-table' +import { ComponentOrgTreeComponent } from 'app/components/component-org-tree/component-org-tree.component' + import { format } from 'date-fns' import { ApiService } from 'app/services' -import { of } from 'rxjs' +import { FormBuilder, FormGroup } from '@angular/forms' +import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' +import { NzSafeAny } from 'ng-zorro-antd/core/types' +import { NzModalService } from 'ng-zorro-antd/modal' +import { NzMessageService } from 'ng-zorro-antd/message' +import { NzDrawerRef, NzDrawerService } from 'ng-zorro-antd/drawer' +import { lastValueFrom } from 'rxjs' +import { FormValidators } from 'app/utils' @Component({ selector: 'app-org-setting', standalone: true, - imports: [SharedModule, AppPageComponent, ComponentOrgTreeComponent], + imports: [SharedModule, ComponentOrgTreeComponent], templateUrl: './org-setting.component.html', styleUrl: './org-setting.component.less', }) export class OrgSettingComponent implements OnInit { - constructor(private api: ApiService) {} + constructor( + private modal: NzModalService, + private msg: NzMessageService, + private drawer: NzDrawerService, + private api: ApiService, + private fb: FormBuilder, + ) {} table = new TableOption(this.fetchData.bind(this)) + queryForm!: FormGroup + + createForm!: FormGroup + + drawerRef?: NzDrawerRef + + organization: null | NzSafeAny = null + + iconPreview = '' + + uploadLoading = false + + @ViewChild('drawerFooterTpl') drawerFooterTpl!: TemplateRef + + @ViewChild('formContentTpl') formContentTpl!: TemplateRef + + initCreateForm() { + this.createForm = this.fb.group({ + userId: [], + userName: ['', FormValidators.required('请输入')], + loginName: ['', FormValidators.required('请输入')], + phone: [ + '', + [FormValidators.required('请输入'), FormValidators.pattern(/^1[3-9]\d{9}$/, '请输入正确的手机号')], + ], + password: [], + repassword: [], + email: [], + status: ['0'], + sex: ['0'], + avatar: [], + roleId: [], + }) + } + initQueryForm() { + this.queryForm = this.fb.group({ + userName: [''], + loginName: [''], + phone: [''], + email: [''], + status: [''], + sex: [''], + }) + } + ngOnInit(): void { this.table - .setConfig({ - selectable: true, - }) + .setColumn([ - { key: '公司ID', title: '公司ID', visible: true }, - { key: '工号', title: '工号' }, - { key: '姓名', title: '姓名' }, - { key: '性别', title: '性别' }, - { key: '手机号', title: '手机号' }, - { key: '部门', title: '部门' }, - { key: '主岗', title: '主岗' }, - { key: 'ID', title: 'ID', visible: false }, - { key: '人员ID', title: '人员ID', visible: false }, - { key: '状态', title: '状态', visible: false }, - { key: '修改人ID', title: '修改人ID', visible: false }, - { key: '类型', title: '类型', visible: false }, - { key: '直属领导', title: '直属领导', visible: false }, - { key: 'extInfo', title: 'extInfo', visible: false }, - { key: '身份证', title: '身份证', visible: false }, - { key: '兼岗', title: '兼岗', visible: false }, - { key: '签约方', title: '签约方', visible: false }, - { key: '成本中心', title: '成本中心', visible: false }, - { key: '客户信息', title: '客户信息', visible: false }, - - { key: 'createTime', title: '创建时间' }, + { key: 'avatar', title: '头像', width: '100px' }, + { key: 'userName', title: '姓名' }, + { key: 'loginName', title: '账号名' }, + { key: 'phone', title: '联系电话' }, + { key: 'email', title: '邮箱' }, + { key: 'status', title: '状态' }, + { key: 'sex', title: '性别' }, ]) - .setRowOperate([{ title: '查看', premissions: [] }, { title: '编辑' }, { title: '删除' }]) + .setRowOperate([ + { title: '编辑', onClick: this.onCreate.bind(this) }, + { title: '删除', onClick: this.deleteItem.bind(this) }, + ]) + this.initQueryForm() + this.initCreateForm() } fetchData(p: {}, q: AnyObject) { - if (Array.isArray(q['createTime'])) { - const createTimeStart = q['createTime']?.[0] - const createTimeEnd = q['createTime']?.[1] + return this.api.getUserPage({ ...p, ...q, organizationId: this.organization?.organizationId }) + } - q['createTimeStart'] = createTimeStart ? format(new Date(createTimeStart), 'yyyy-MM-dd HH:mm:ss') : '' - q['createTimeEnd'] = createTimeEnd ? format(new Date(createTimeEnd), 'yyyy-MM-dd HH:mm:ss') : '' + onOrgSelectedChange(org: NzSafeAny) { + console.log('org', org) + this.organization = org + this.table.ref.search() + } + + onCreate(data?: NzSafeAny) { + if (data) { + this.createForm.patchValue(data) + } + this.drawerRef = this.drawer.create({ + nzTitle: data ? '编辑员工' : '新增员工', + nzContent: this.formContentTpl, + nzFooter: this.drawerFooterTpl, + nzWidth: 600, + nzOnCancel: this.onCancel.bind(this), + }) + } + + onConfirm() { + if (FormValidators.validateFormGroup(this.createForm)) { + const { value } = this.createForm + if (value.password && value.repassword !== value.password) { + this.msg.error('两次密码输入不一致') + return + } + this.api + .saveUser({ + ...value, + organizationId: this.organization?.organizationId, + }) + .subscribe((res) => { + this.msg.success(res.desc) + this.onCancel() + this.table.ref.reload() + }) } - return of({ - data: { - total: 5, - records: [ - { - id: 1, - name: '沙滩', - price: 590, - type: 0, - lifespan: 6, - number: 20, - max: 20, - status: 1, - createTime: '2024-05-01', - }, - - { - id: 2, - name: '清凉一夏~沙滩排球', - price: 100000, - type: 1, - lifespan: 12, - max: 20, - status: 1, - createTime: '2024-05-01', - }, - ], + } + + async onCancel() { + this.drawerRef?.close() + this.createForm.reset({ + sex: '0', + status: '0', + }) + } + + deleteItem(item: NzSafeAny) { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '是否要删除该员工?', + nzOnOk: async () => { + const res = await lastValueFrom(this.api.deleteUser([item.userId])) + this.msg.success(res.desc) + this.table.ref.reload() }, }) - return this.api.getEntityPage(p, q) + } + + onFileChange(e: Event) { + const target = e.target as HTMLInputElement + const file = target.files![0] + target.value = '' + if (file.size / 1024 / 1024 >= 2) { + this.msg.error('图片大小不能超过2M') + return + } + const fileReader = new FileReader() + fileReader.onload = () => { + const base64 = fileReader.result as string + this.iconPreview = base64 + } + fileReader.readAsDataURL(file) + const formdata = new FormData() + formdata.append('file', file) + this.api.upload(formdata).subscribe((res) => { + this.createForm.get('avatar')?.setValue(res.body.fileName) + }) } } diff --git a/web-admin-app/src/app/pages/profile-account/profile-account.component.ts b/web-admin-app/src/app/pages/profile-account/profile-account.component.ts index 599bf3b..ae2fa92 100644 --- a/web-admin-app/src/app/pages/profile-account/profile-account.component.ts +++ b/web-admin-app/src/app/pages/profile-account/profile-account.component.ts @@ -20,27 +20,27 @@ export class ProfileAccountComponent { ) {} formGroup = new FormGroup({ - id: new FormControl(this.api.authInfo.id), - username: new FormControl({ value: this.api.authInfo.username, disabled: true }, [ - FormValidators.required('请输入用户名'), - ]), - password: new FormControl('', [FormValidators.required('请输入密码')]), - confirmPassword: new FormControl('', [FormValidators.required('请再次输入密码')]), + // id: new FormControl(this.api.authInfo.id), + // username: new FormControl({ value: this.api.authInfo.username, disabled: true }, [ + // FormValidators.required('请输入用户名'), + // ]), + // password: new FormControl('', [FormValidators.required('请输入密码')]), + // confirmPassword: new FormControl('', [FormValidators.required('请再次输入密码')]), }) onSubmit() { if (FormValidators.validateFormGroup(this.formGroup)) { - if (this.formGroup.value.confirmPassword !== this.formGroup.value.password) { - this.msg.error('两次输入密码不一致') - return - } - const v = this.formGroup.getRawValue() - this.api.changePassword(v).subscribe(() => { - this.msg.success('修改成功,请重新登录').onClose.subscribe(() => { - this.local.removeAccess() - window.location.href = '/login' - }) - }) + // if (this.formGroup.value.confirmPassword !== this.formGroup.value.password) { + // this.msg.error('两次输入密码不一致') + // return + // } + // const v = this.formGroup.getRawValue() + // this.api.changePassword(v).subscribe(() => { + // this.msg.success('修改成功,请重新登录').onClose.subscribe(() => { + // this.local.removeAccess() + // window.location.href = '/login' + // }) + // }) } } } diff --git a/web-admin-app/src/app/pages/profile-basic/profile-basic.component.ts b/web-admin-app/src/app/pages/profile-basic/profile-basic.component.ts index 216fd1a..8332377 100644 --- a/web-admin-app/src/app/pages/profile-basic/profile-basic.component.ts +++ b/web-admin-app/src/app/pages/profile-basic/profile-basic.component.ts @@ -1,7 +1,6 @@ import { Component, OnDestroy, OnInit } from '@angular/core' import { SharedModule } from '../../shared/shared.module' import { ApiService } from 'app/services' -import { UserFormComponent } from 'app/components/user-form/user-form.component' import { FormBuilder, FormControl, FormGroup } from '@angular/forms' import { FormValidators } from 'app/utils' import { NzMessageService } from 'ng-zorro-antd/message' @@ -9,7 +8,7 @@ import { Subscription } from 'rxjs' @Component({ standalone: true, - imports: [SharedModule, UserFormComponent], + imports: [SharedModule], selector: 'app-profile-basic', templateUrl: './profile-basic.component.html', styleUrls: ['./profile-basic.component.less'], @@ -24,10 +23,10 @@ export class ProfileBasicComponent implements OnInit, OnDestroy { formGroup!: FormGroup ngOnInit(): void { - this.formGroup = this.fb.group({ - name: new FormControl(this.api.authInfo.name, [FormValidators.required('请输入姓名')]), - remark: new FormControl(this.api.authInfo.remark), - }) + // this.formGroup = this.fb.group({ + // name: new FormControl(this.api.authInfo.name, [FormValidators.required('请输入姓名')]), + // remark: new FormControl(this.api.authInfo.remark), + // }) } ngOnDestroy(): void {} @@ -45,7 +44,7 @@ export class ProfileBasicComponent implements OnInit, OnDestroy { if (vals) { this.api.saveUser({ ...this.api.authInfo, ...vals }).subscribe(() => { this.msg.success('保存成功') - this.api.getAuthInfo(true).subscribe(() => {}) + // this.api.getAuthInfo(true).subscribe(() => {}) }) } } diff --git a/web-admin-app/src/app/pages/profile/profile.component.html b/web-admin-app/src/app/pages/profile/profile.component.html index 67fc742..14d4ca4 100644 --- a/web-admin-app/src/app/pages/profile/profile.component.html +++ b/web-admin-app/src/app/pages/profile/profile.component.html @@ -2,18 +2,10 @@ - {{ api.authInfo.username }} + {{ api.authInfo?.loginName }} - {{ api.authInfo.name }} - - - - @if (api.authInfo.enable) { - - } @else { - - } + {{ api.authInfo?.userName }} diff --git a/web-admin-app/src/app/pages/profile/profile.component.ts b/web-admin-app/src/app/pages/profile/profile.component.ts index cd46449..5a8c0c6 100644 --- a/web-admin-app/src/app/pages/profile/profile.component.ts +++ b/web-admin-app/src/app/pages/profile/profile.component.ts @@ -14,9 +14,7 @@ import { Subscription } from 'rxjs' export class ProfileComponent implements OnInit, OnDestroy { constructor(public api: ApiService) {} - ngOnInit(): void { - this.api.getUserInfo(this.api.authInfo.id).subscribe((res) => {}) - } + ngOnInit(): void {} ngOnDestroy(): void {} } diff --git a/web-admin-app/src/app/pages/system/system.component.html b/web-admin-app/src/app/pages/system/index/system.component.html similarity index 56% rename from web-admin-app/src/app/pages/system/system.component.html rename to web-admin-app/src/app/pages/system/index/system.component.html index 67e7bd4..7634b59 100644 --- a/web-admin-app/src/app/pages/system/system.component.html +++ b/web-admin-app/src/app/pages/system/index/system.component.html @@ -1 +1,2 @@ +
ad
diff --git a/web-admin-app/src/app/pages/system/index/system.component.less b/web-admin-app/src/app/pages/system/index/system.component.less new file mode 100644 index 0000000..e69de29 diff --git a/web-admin-app/src/app/pages/system/system.component.ts b/web-admin-app/src/app/pages/system/index/system.component.ts similarity index 100% rename from web-admin-app/src/app/pages/system/system.component.ts rename to web-admin-app/src/app/pages/system/index/system.component.ts diff --git a/web-admin-app/src/app/pages/system/system-user/system-user.component.html b/web-admin-app/src/app/pages/system/system-user/system-user.component.html new file mode 100644 index 0000000..0434380 --- /dev/null +++ b/web-admin-app/src/app/pages/system/system-user/system-user.component.html @@ -0,0 +1 @@ +

system-user works!

diff --git a/web-admin-app/src/app/pages/system/system-user/system-user.component.less b/web-admin-app/src/app/pages/system/system-user/system-user.component.less new file mode 100644 index 0000000..e69de29 diff --git a/web-admin-app/src/app/pages/system/system-user/system-user.component.ts b/web-admin-app/src/app/pages/system/system-user/system-user.component.ts new file mode 100644 index 0000000..3588e8f --- /dev/null +++ b/web-admin-app/src/app/pages/system/system-user/system-user.component.ts @@ -0,0 +1,11 @@ +import { Component } from '@angular/core' +import { SharedModule } from 'app/shared/shared.module' + +@Component({ + selector: 'app-system-user', + standalone: true, + imports: [SharedModule], + templateUrl: './system-user.component.html', + styleUrl: './system-user.component.less', +}) +export class SystemUserComponent {} diff --git a/web-admin-app/src/app/services/api.dto.ts b/web-admin-app/src/app/services/api.dto.ts index 6339870..5615f20 100644 --- a/web-admin-app/src/app/services/api.dto.ts +++ b/web-admin-app/src/app/services/api.dto.ts @@ -1,15 +1,9 @@ export type AuthDTO = { - createTime: string - enable: boolean - groupId: string - id: string - name: string - remark: string - roleId: string - roleName: string - updateTime: string - username: string - authorities: AuthorityDTO[] + authorization: string + loginName: string + permissions: string[] + roles: string[] + userName: string } export type AuthorityDTO = { authority: string } diff --git a/web-admin-app/src/app/services/api.service.ts b/web-admin-app/src/app/services/api.service.ts index 928d504..dee21c5 100644 --- a/web-admin-app/src/app/services/api.service.ts +++ b/web-admin-app/src/app/services/api.service.ts @@ -6,7 +6,6 @@ import { NzTreeNodeOptions } from 'ng-zorro-antd/tree' import { BehaviorSubject, map, of, tap } from 'rxjs' import { AuthDTO, - AuthorityDTO, AuthorizeItemDTO, ConsoleClientTopDTO, ConsoleCountDTO, @@ -20,6 +19,7 @@ import { UserDTO, } from './api.dto' import { PermissionService } from 'app/shared/permission/permission.service' +import { NzSafeAny } from 'ng-zorro-antd/core/types' export interface UserGroupTreeItem { name: string @@ -37,224 +37,178 @@ export class ApiService { private permission: PermissionService, ) {} - authInfo: AuthDTO = { - createTime: '', - enable: false, - groupId: '', - id: '', - name: '', - remark: '', - roleId: '', - roleName: '', - updateTime: '', - username: '', - authorities: [], - } + AUTH_KEY_NAME = 'auth' - getAuthInfo(force?: boolean) { - if (this.authInfo && !force) { - return of(this.authInfo) - } - localStorage.setItem('da', 'af') - return of(this.authInfo) - // return this.http.get>('/api/auth/info').pipe( - // map((res) => res.data), - // tap((res) => { - // this.authInfo = res - // this.permission.loadPermission(res.authorities.map((f) => f.authority)) - // }), - // ) + get authInfo(): AuthDTO | null { + let authInfo: AuthDTO | null = null + try { + const strData = localStorage.getItem(this.AUTH_KEY_NAME) + if (strData) { + authInfo = JSON.parse(strData) + this.permission.loadPermission(authInfo?.permissions ?? []) + } + } catch (error) {} + return authInfo } - login(data: {}) { - return this.http.post('/api/oauth/login', data) + removeAuthData() { + localStorage.removeItem(this.AUTH_KEY_NAME) } - private _parseUserGroupTree(group: UserGroupTreeItem[]): NzTreeNodeOptions[] { - if (group?.length === 0) { - return [] - } - return group.map((i) => { - return { - ...i, - key: i.id, - title: i.name, - children: this._parseUserGroupTree(i.children ?? []), - isLeaf: i.children?.length === 0 || !i.children, - } - }) + upload(data: FormData) { + return this.http.post('/api/common/upload', data) } - changeUserPassword(id: string, password: string) { - return this.http.put('/api/user/reset/password', { - id, - password, - }) + login(data: {}) { + return this.http.post('/api/oauth/login', data).pipe( + tap((res) => { + localStorage.setItem(this.AUTH_KEY_NAME, JSON.stringify(res.body)) + }), + ) } - getDashboardCounter() { - return this.http.get>(`/api/console/count`) + logout() { + return this.http.post('/api/oauth/logout', null) } - getDashboardExpire() { - return this.http.get>(`/api/console/expire`) + getOrgTree() { + return this.http.post('/api/umsOrganization/tree', null) } - getDashboardClientTop() { - return this.http.get>(`/api/console/client/top`) + saveOrg(data: NzSafeAny) { + if (Utils.isEmpty(data.organizationId)) { + return this.http.post('/api/umsOrganization/add', data) + } + return this.http.post('/api/umsOrganization/update', data) } - getUserInfo(id: string) { - return this.http.get>(`/api/user/${id}`).pipe() + deleteOrg(id: number) { + return this.http.post('/api/umsOrganization/delete', [id]) } - changePassword(data: {}) { - return this.http.put('/api/user/password', data) + getUserPage(data: {}) { + return this.http.post('/api/umsUser/list', data) } - getUserPage(p: {}, q: {}) { - const params = Utils.objectToURLSearchParams({ ...p, ...q }) - return this.http.get(`/api/user/pages?${params}`) + deleteUser(ids: number[]) { + return this.http.post(`/api/umsUser/delete`, ids) } - saveUser(user: any) { - if (user.id) { - return this.http.put('/api/user', user) - } else { - return this.http.post('/api/user', user) + saveUser(data: NzSafeAny) { + if (Utils.isEmpty(data.userId)) { + return this.http.post('/api/umsUser/add', data) } + return this.http.post('/api/umsUser/update', data) } - deleteUser(id: string) { - return this.http.delete(`/api/user/${id}`) - } - - getUserGroupTree() { - return this.http.get>('/api/user/group/tree').pipe( - map((res) => { - return this._parseUserGroupTree(res.data) - }), - ) + getBasicPositionPage(data: {}) { + return this.http.post('/api/eamBasicPosition/list', data) } - - saveUserGroup(group: Partial) { - if (group.id) { - return this.http.put('/api/user/group', group) - } else { - return this.http.post('/api/user/group', group) + saveBasicPosition(data: NzSafeAny) { + if (Utils.isEmpty(data.positionId)) { + return this.http.post('/api/eamBasicPosition/add', data) } + return this.http.post('/api/eamBasicPosition/update', data) } - - updateUserStatus(id: string) { - return this.http.put(`/api/user/enable/${id}`, null) + deleteBasicPosition(ids: number[]) { + return this.http.post(`/api/eamBasicPosition/delete`, ids) } - deleteUserGroup(id: string) { - return this.http.delete(`/api/user/group/${id}`) + getBasicMaintenanceVendorPage(data: {}) { + return this.http.post('/api/eamBasicMaintenanceVendor/list', data) } - - getAllRole() { - return this.http.get>(`/api/sysRole/list`) + saveBasicMaintenanceVendor(data: NzSafeAny) { + if (Utils.isEmpty(data.maintenanceVendorId)) { + return this.http.post('/api/eamBasicMaintenanceVendor/add', data) + } + return this.http.post('/api/eamBasicMaintenanceVendor/update', data) } - - getRolePage(p: {}, q: {}) { - const params = Utils.objectToURLSearchParams({ ...p, ...q }) - return this.http.get(`/api/sysRole/pages?${params}`) + deleteBasicMaintenanceVendor(ids: number[]) { + return this.http.post(`/api/eamBasicMaintenanceVendor/delete`, ids) } - getAllPermission() { - return this.http.get>('/api/authority/tree') + getBasicManufacturersVendorPage(data: {}) { + return this.http.post('/api/eamBasicManufacturersVendor/list', data) } - - getRoleById(id: string) { - return this.http.get>(`/api/sysRole/${id}`) + saveBasicManufacturersVendor(data: NzSafeAny) { + if (Utils.isEmpty(data.manufacturersVendorId)) { + return this.http.post('/api/eamBasicManufacturersVendor/add', data) + } + return this.http.post('/api/eamBasicManufacturersVendor/update', data) } - - deleteRole(id: string) { - return this.http.delete(`/api/sysRole/${id}`) + deleteBasicManufacturersVendor(ids: number[]) { + return this.http.post(`/api/eamBasicManufacturersVendor/delete`, ids) } - saveRole(role: NullableProps) { - if (role.id) { - return this.http.put('/api/sysRole', role) - } else { - return this.http.post('/api/sysRole', role) + getBasicSupplierVendorPage(data: {}) { + return this.http.post('/api/eamBasicSupplierVendor/list', data) + } + saveBasicSupplierVendor(data: NzSafeAny) { + if (Utils.isEmpty(data.supplierVendorId)) { + return this.http.post('/api/eamBasicSupplierVendor/add', data) } + return this.http.post('/api/eamBasicSupplierVendor/update', data) } - - authorize(v: {}) { - return this.http.post('/api/client/license', v) + deleteBasicSupplierVendor(ids: number[]) { + return this.http.post(`/api/eamBasicSupplierVendor/delete`, ids) } - getSysLog(p: {}, q: {}) { - const params = Utils.objectToURLSearchParams({ ...p, ...q }) - return this.http.get(`/api/sysLog/pages?${params}`) + getBasicWarehousePage(data: {}) { + return this.http.post('/api/eamBasicWarehouse/list', data) } - - getEntityPage(p: {}, q: {}) { - const params = Utils.objectToURLSearchParams({ ...p, ...q }) - return this.http.get(`/api/client/pages?${params}`) + saveBasicWarehouse(data: NzSafeAny) { + if (Utils.isEmpty(data.warehouseId)) { + return this.http.post('/api/eamBasicWarehouse/add', data) + } + return this.http.post('/api/eamBasicWarehouse/update', data) } - - getEntityAuthorizeList(clientId: string) { - return this.http.get>(`/api/licenseLog/${clientId}/list`) + deleteBasicWarehouse(ids: number[]) { + return this.http.post(`/api/eamBasicWarehouse/delete`, ids) } - getEntityDetail(id: string) { - return this.http.get>(`/api/client/${id}`) + getBasicCategoryTree() { + return this.http.post('/api/eamBasicCategory/tree', null) } - - saveEntity(entity: Partial>) { - if (entity.id) { - return this.http.put('/api/client', entity) - } else { - return this.http.post('/api/client', entity) - } + addBasicCategoryTree(data: {}) { + return this.http.post('/api/eamBasicCategory/add', data) } - - deleteEntity(id: string) { - return this.http.delete(`/api/client/${id}`) + updateBasicCategoryTree(data: {}) { + return this.http.post('/api/eamBasicCategory/update', data) } - - getProductPage(p: {}, q: {}) { - const params = Utils.objectToURLSearchParams({ ...p, ...q }) - return this.http.get(`/api/product/pages?${params}`) + deleteBasicCategory(ids: number[]) { + return this.http.post('/api/eamBasicCategory/delete', ids) } - getAllProduct() { - return this.http.get>(`/api/product/list`) + getStocktakingJobPage(data: {}) { + return this.http.post('/api/eamStocktakingJob/list', data) } - - saveProduct(entity: Partial>) { - if (entity.id) { - return this.http.put('/api/product', entity) - } else { - return this.http.post('/api/product', entity) + saveStocktakingJob(data: NzSafeAny) { + if (Utils.isEmpty(data.stocktakingJobId)) { + return this.http.post('/api/eamStocktakingJob/add', data) } + return this.http.post('/api/eamStocktakingJob/update', data) } - - deleteProduct(id: string) { - return this.http.delete(`/api/product/${id}`) + deleteStocktakingJob(ids: number[]) { + return this.http.post(`/api/eamStocktakingJob/delete`, ids) } - getProductVersionPage(p: {}, q: {}) { - const params = Utils.objectToURLSearchParams({ ...p, ...q }) - return this.http.get(`/api/product/pages?${params}`) + beginStocktakingJob(ids: number[]) { + return this.http.post(`/api/eamStocktakingJob/start`, ids) } - - saveVersion(entity: Partial>) { - if (entity.id) { - return this.http.put('/api/product', entity) - } else { - return this.http.post('/api/product', entity) - } + stopStocktakingJob(ids: number[]) { + return this.http.post(`/api/eamStocktakingJob/complete`, ids) } - deleteVersion(id: string, pid: string) { - return this.http.delete(`/api/product/${id}`) - } + /** + * + * + * ------------------------------- + * + * + */ - getProductDetail(pid: string) { - return this.http.get(`/api/product/${pid}`) + getEntityPage(p: {}, q: {}) { + const params = Utils.objectToURLSearchParams({ ...p, ...q }) + return this.http.get(`/api/client/pages?${params}`) } } diff --git a/web-admin-app/src/app/services/local-http-interceptor.service.ts b/web-admin-app/src/app/services/local-http-interceptor.service.ts index 2a3fc76..9441b00 100644 --- a/web-admin-app/src/app/services/local-http-interceptor.service.ts +++ b/web-admin-app/src/app/services/local-http-interceptor.service.ts @@ -11,6 +11,7 @@ import { Observable, throwError } from 'rxjs' import { catchError, filter, tap } from 'rxjs/operators' import { ActivatedRoute, NavigationEnd, Router } from '@angular/router' import { NzMessageService } from 'ng-zorro-antd/message' +import { ApiService } from './api.service' function uintToString(uintArray: Uint8Array) { const encodedString = String.fromCharCode.apply(null, uintArray as any) @@ -59,30 +60,11 @@ export function getErrorMessage(err: HttpErrorResponse & Record, de export class LocalHttpInterceptorService implements HttpInterceptor { constructor( private msg: NzMessageService, + private api: ApiService, private router: Router, private route: ActivatedRoute, ) {} - tokenName = 'AUTH_TOKEN' - - getAccess() { - try { - let persistData = localStorage.getItem(this.tokenName) - if (persistData) { - return JSON.parse(persistData) - } - } catch (error) {} - return {} - } - - setAccess(accessData: { access_token: string } & Record) { - localStorage.setItem(this.tokenName, JSON.stringify(accessData)) - } - - removeAccess() { - localStorage.removeItem(this.tokenName) - } - intercept(req: HttpRequest, next: HttpHandler): Observable> { let url = req.url let baseHref = '' @@ -92,21 +74,18 @@ export class LocalHttpInterceptorService implements HttpInterceptor { if (baseHref.endsWith('/')) { baseHref = baseHref.slice(0, baseHref.length - 1) } - if (['/api/auth/info'].includes(req.url)) { - baseHref = '/authserver' - } + url = baseHref + req.url } - const accessData = this.getAccess() - let token = accessData?.access_token - let refreshToken = accessData?.refresh_token + const accessData = this.api.authInfo + let token = accessData?.authorization if (this.shouldRemoveAuthorizationToken(req.url)) { token = '' } - const Authorization: Record = token ? { Authorization: `Bearer ${token}` } : {} + const Authorization: Record = token ? { Authorization: token } : {} const newRequest = req.clone({ ...req, @@ -122,14 +101,6 @@ export class LocalHttpInterceptorService implements HttpInterceptor { return next.handle(authReq).pipe( tap((res) => { if (res instanceof HttpResponse) { - const access_token = res.headers.get('Rep-Access-Token') - const refresh_token = res.headers.get('Rep-Refresh-Token') - if (access_token) { - this.setAccess({ - access_token, - refresh_token, - }) - } if (res.body?.success === false && res.body.desc) { throw new HttpErrorResponse({ error: res.body }) } @@ -149,7 +120,7 @@ export class LocalHttpInterceptorService implements HttpInterceptor { switch (res.status) { case 401: if (window.location.pathname !== '/login') { - this.removeAccess() + this.api.removeAuthData() this.msg.error('登录已失效') setTimeout(() => { window.location.href = '/login' @@ -176,23 +147,6 @@ export class LocalHttpInterceptorService implements HttpInterceptor { } private shouldRemoveAuthorizationToken(url: string) { - if (url.includes('/api/auth/info')) { - return false - } - - if (url.includes('/api/login')) { - return true - } - if (url.includes('/api/auth/')) { - return true - } - if (url.includes('/api/reset/')) { - return true - } - if (url.includes('/api/refresh_token')) { - return true - } - return false } } diff --git a/web-admin-app/src/app/components/app-page/app-page.component.html b/web-admin-app/src/app/shared/components/app-page/app-page.component.html similarity index 100% rename from web-admin-app/src/app/components/app-page/app-page.component.html rename to web-admin-app/src/app/shared/components/app-page/app-page.component.html diff --git a/web-admin-app/src/app/components/app-page/app-page.component.less b/web-admin-app/src/app/shared/components/app-page/app-page.component.less similarity index 100% rename from web-admin-app/src/app/components/app-page/app-page.component.less rename to web-admin-app/src/app/shared/components/app-page/app-page.component.less diff --git a/web-admin-app/src/app/components/app-page/app-page.component.ts b/web-admin-app/src/app/shared/components/app-page/app-page.component.ts similarity index 97% rename from web-admin-app/src/app/components/app-page/app-page.component.ts rename to web-admin-app/src/app/shared/components/app-page/app-page.component.ts index cfb0f41..73ea490 100644 --- a/web-admin-app/src/app/components/app-page/app-page.component.ts +++ b/web-admin-app/src/app/shared/components/app-page/app-page.component.ts @@ -6,8 +6,6 @@ import { Subscription, filter } from 'rxjs' @Component({ selector: 'app-page', - standalone: true, - imports: [SharedModule], templateUrl: './app-page.component.html', styleUrl: './app-page.component.less', }) diff --git a/web-admin-app/src/app/components/form-error-tips/form-error-tips.component.html b/web-admin-app/src/app/shared/components/form-error-tips/form-error-tips.component.html similarity index 100% rename from web-admin-app/src/app/components/form-error-tips/form-error-tips.component.html rename to web-admin-app/src/app/shared/components/form-error-tips/form-error-tips.component.html diff --git a/web-admin-app/src/app/shared/components/form-error-tips/form-error-tips.component.less b/web-admin-app/src/app/shared/components/form-error-tips/form-error-tips.component.less new file mode 100644 index 0000000..e69de29 diff --git a/web-admin-app/src/app/components/form-error-tips/form-error-tips.component.ts b/web-admin-app/src/app/shared/components/form-error-tips/form-error-tips.component.ts similarity index 100% rename from web-admin-app/src/app/components/form-error-tips/form-error-tips.component.ts rename to web-admin-app/src/app/shared/components/form-error-tips/form-error-tips.component.ts diff --git a/web-admin-app/src/app/components/header/header.component.html b/web-admin-app/src/app/shared/components/header/header.component.html similarity index 98% rename from web-admin-app/src/app/components/header/header.component.html rename to web-admin-app/src/app/shared/components/header/header.component.html index 16a4e17..0195dff 100644 --- a/web-admin-app/src/app/components/header/header.component.html +++ b/web-admin-app/src/app/shared/components/header/header.component.html @@ -66,7 +66,7 @@ - {{ api.authInfo.name || 'admin' }} + {{ api.authInfo?.userName ?? '-' }} diff --git a/web-admin-app/src/app/components/header/header.component.less b/web-admin-app/src/app/shared/components/header/header.component.less similarity index 100% rename from web-admin-app/src/app/components/header/header.component.less rename to web-admin-app/src/app/shared/components/header/header.component.less diff --git a/web-admin-app/src/app/components/header/header.component.ts b/web-admin-app/src/app/shared/components/header/header.component.ts similarity index 82% rename from web-admin-app/src/app/components/header/header.component.ts rename to web-admin-app/src/app/shared/components/header/header.component.ts index f49e969..00d9161 100644 --- a/web-admin-app/src/app/components/header/header.component.ts +++ b/web-admin-app/src/app/shared/components/header/header.component.ts @@ -1,5 +1,5 @@ +import { lastValueFrom } from 'rxjs' import { Component, OnInit, inject } from '@angular/core' -import { SharedModule } from '../../shared/shared.module' import { ApiService, LocalHttpInterceptorService } from 'app/services' import { Router } from '@angular/router' import { NzMessageService } from 'ng-zorro-antd/message' @@ -7,15 +7,12 @@ import { NzModalService } from 'ng-zorro-antd/modal' import { PermissionService } from 'app/shared/permission/permission.service' @Component({ - standalone: true, selector: 'app-header', templateUrl: './header.component.html', styleUrls: ['./header.component.less'], - imports: [SharedModule], }) export class HeaderComponent implements OnInit { constructor( - private local: LocalHttpInterceptorService, private router: Router, private msg: NzMessageService, private modal: NzModalService, @@ -30,9 +27,10 @@ export class HeaderComponent implements OnInit { this.modal.confirm({ nzTitle: '退出登录', nzContent: '确认要退出当前账户吗?', - nzOnOk: () => { + nzOnOk: async () => { + await lastValueFrom(this.api.logout()) this.permission.reset() - this.local.removeAccess() + this.api.removeAuthData() this.router.navigate(['/login']) this.msg.success('退出成功') }, diff --git a/web-admin-app/src/app/shared/components/index.ts b/web-admin-app/src/app/shared/components/index.ts new file mode 100644 index 0000000..5abf137 --- /dev/null +++ b/web-admin-app/src/app/shared/components/index.ts @@ -0,0 +1,6 @@ +// export * from "./form-error-tips/form-error-tips.component"; +// export * from "./server-paginated-table"; + +export * from './header/header.component' +export * from './layout/layout.component' +export * from './user-form/user-form.component' diff --git a/web-admin-app/src/app/components/layout/layout.component.html b/web-admin-app/src/app/shared/components/layout/layout.component.html similarity index 100% rename from web-admin-app/src/app/components/layout/layout.component.html rename to web-admin-app/src/app/shared/components/layout/layout.component.html diff --git a/web-admin-app/src/app/shared/components/layout/layout.component.less b/web-admin-app/src/app/shared/components/layout/layout.component.less new file mode 100644 index 0000000..ba84b94 --- /dev/null +++ b/web-admin-app/src/app/shared/components/layout/layout.component.less @@ -0,0 +1,15 @@ +:host { + display: block; + height: 100%; +} + +// .app-width { +// ::ng-deep { +// router-outlet+* { +// display: block; +// width: 100%; +// height: 100%; +// overflow: hidden; +// } +// } +// } \ No newline at end of file diff --git a/web-admin-app/src/app/shared/components/layout/layout.component.ts b/web-admin-app/src/app/shared/components/layout/layout.component.ts new file mode 100644 index 0000000..54d675a --- /dev/null +++ b/web-admin-app/src/app/shared/components/layout/layout.component.ts @@ -0,0 +1,8 @@ +import { Component } from '@angular/core' + +@Component({ + selector: 'app-layout', + templateUrl: './layout.component.html', + styleUrls: ['./layout.component.less'], +}) +export class LayoutComponent {} diff --git a/web-admin-app/src/app/components/range-picker/range-picker.component.html b/web-admin-app/src/app/shared/components/range-picker/range-picker.component.html similarity index 100% rename from web-admin-app/src/app/components/range-picker/range-picker.component.html rename to web-admin-app/src/app/shared/components/range-picker/range-picker.component.html diff --git a/web-admin-app/src/app/shared/components/range-picker/range-picker.component.less b/web-admin-app/src/app/shared/components/range-picker/range-picker.component.less new file mode 100644 index 0000000..e69de29 diff --git a/web-admin-app/src/app/components/range-picker/range-picker.component.ts b/web-admin-app/src/app/shared/components/range-picker/range-picker.component.ts similarity index 100% rename from web-admin-app/src/app/components/range-picker/range-picker.component.ts rename to web-admin-app/src/app/shared/components/range-picker/range-picker.component.ts diff --git a/web-admin-app/src/app/components/server-paginated-table/date-query/date-query.component.html b/web-admin-app/src/app/shared/components/server-paginated-table/date-query/date-query.component.html similarity index 100% rename from web-admin-app/src/app/components/server-paginated-table/date-query/date-query.component.html rename to web-admin-app/src/app/shared/components/server-paginated-table/date-query/date-query.component.html diff --git a/web-admin-app/src/app/components/server-paginated-table/date-query/date-query.component.less b/web-admin-app/src/app/shared/components/server-paginated-table/date-query/date-query.component.less similarity index 100% rename from web-admin-app/src/app/components/server-paginated-table/date-query/date-query.component.less rename to web-admin-app/src/app/shared/components/server-paginated-table/date-query/date-query.component.less diff --git a/web-admin-app/src/app/components/server-paginated-table/date-query/date-query.component.ts b/web-admin-app/src/app/shared/components/server-paginated-table/date-query/date-query.component.ts similarity index 100% rename from web-admin-app/src/app/components/server-paginated-table/date-query/date-query.component.ts rename to web-admin-app/src/app/shared/components/server-paginated-table/date-query/date-query.component.ts diff --git a/web-admin-app/src/app/components/server-paginated-table/index.ts b/web-admin-app/src/app/shared/components/server-paginated-table/index.ts similarity index 100% rename from web-admin-app/src/app/components/server-paginated-table/index.ts rename to web-admin-app/src/app/shared/components/server-paginated-table/index.ts diff --git a/web-admin-app/src/app/components/server-paginated-table/query-item/query-item.component.html b/web-admin-app/src/app/shared/components/server-paginated-table/query-item/query-item.component.html similarity index 100% rename from web-admin-app/src/app/components/server-paginated-table/query-item/query-item.component.html rename to web-admin-app/src/app/shared/components/server-paginated-table/query-item/query-item.component.html diff --git a/web-admin-app/src/app/components/server-paginated-table/query-item/query-item.component.less b/web-admin-app/src/app/shared/components/server-paginated-table/query-item/query-item.component.less similarity index 53% rename from web-admin-app/src/app/components/server-paginated-table/query-item/query-item.component.less rename to web-admin-app/src/app/shared/components/server-paginated-table/query-item/query-item.component.less index 0abe4ca..1241bfe 100644 --- a/web-admin-app/src/app/components/server-paginated-table/query-item/query-item.component.less +++ b/web-admin-app/src/app/shared/components/server-paginated-table/query-item/query-item.component.less @@ -1,7 +1,8 @@ .query-control { ::ng-deep { input { - width: 100px; + min-width: 100px; + width: 100%; } } } \ No newline at end of file diff --git a/web-admin-app/src/app/components/server-paginated-table/query-item/query-item.component.ts b/web-admin-app/src/app/shared/components/server-paginated-table/query-item/query-item.component.ts similarity index 100% rename from web-admin-app/src/app/components/server-paginated-table/query-item/query-item.component.ts rename to web-admin-app/src/app/shared/components/server-paginated-table/query-item/query-item.component.ts diff --git a/web-admin-app/src/app/components/server-paginated-table/server-paginated-table.component.html b/web-admin-app/src/app/shared/components/server-paginated-table/server-paginated-table.component.html similarity index 86% rename from web-admin-app/src/app/components/server-paginated-table/server-paginated-table.component.html rename to web-admin-app/src/app/shared/components/server-paginated-table/server-paginated-table.component.html index cc81e0d..4191ba8 100644 --- a/web-admin-app/src/app/components/server-paginated-table/server-paginated-table.component.html +++ b/web-admin-app/src/app/shared/components/server-paginated-table/server-paginated-table.component.html @@ -44,10 +44,17 @@ + @if (tableAction) { +
+ +
+ } + {{ th.title }} + {{ th.title }} } } @if (options.operate.length > 0) { - 操作 + 操作 + } + @if (options.columns.length > 3) { + +
+ +
+ } - -
- -
- @@ -131,7 +140,7 @@ } @if (options.operate.length > 0) { - + @@ -154,7 +163,9 @@ } - + @if (options.columns.length > 3) { + + } } diff --git a/web-admin-app/src/app/components/server-paginated-table/server-paginated-table.component.less b/web-admin-app/src/app/shared/components/server-paginated-table/server-paginated-table.component.less similarity index 100% rename from web-admin-app/src/app/components/server-paginated-table/server-paginated-table.component.less rename to web-admin-app/src/app/shared/components/server-paginated-table/server-paginated-table.component.less diff --git a/web-admin-app/src/app/components/server-paginated-table/server-paginated-table.component.ts b/web-admin-app/src/app/shared/components/server-paginated-table/server-paginated-table.component.ts similarity index 98% rename from web-admin-app/src/app/components/server-paginated-table/server-paginated-table.component.ts rename to web-admin-app/src/app/shared/components/server-paginated-table/server-paginated-table.component.ts index c750db5..d634843 100644 --- a/web-admin-app/src/app/components/server-paginated-table/server-paginated-table.component.ts +++ b/web-admin-app/src/app/shared/components/server-paginated-table/server-paginated-table.component.ts @@ -178,6 +178,10 @@ export class ServerPaginatedTableComponent implements OnInit, OnChanges { * 不使用表格模式,自定义渲染 */ @Input() renderItem?: TemplateRef<{}> + /** + * 不使用表格模式,自定义渲染 + */ + @Input() tableAction?: TemplateRef<{}> @ContentChild(TableFormDirective, { static: true, read: TemplateRef }) formContentChild!: TemplateRef diff --git a/web-admin-app/src/app/components/server-paginated-table/server-paginated-table.module.ts b/web-admin-app/src/app/shared/components/server-paginated-table/server-paginated-table.module.ts similarity index 100% rename from web-admin-app/src/app/components/server-paginated-table/server-paginated-table.module.ts rename to web-admin-app/src/app/shared/components/server-paginated-table/server-paginated-table.module.ts diff --git a/web-admin-app/src/app/components/server-paginated-table/server-paginated-table.service.ts b/web-admin-app/src/app/shared/components/server-paginated-table/server-paginated-table.service.ts similarity index 100% rename from web-admin-app/src/app/components/server-paginated-table/server-paginated-table.service.ts rename to web-admin-app/src/app/shared/components/server-paginated-table/server-paginated-table.service.ts diff --git a/web-admin-app/src/app/components/server-paginated-table/table-action.directive.ts b/web-admin-app/src/app/shared/components/server-paginated-table/table-action.directive.ts similarity index 100% rename from web-admin-app/src/app/components/server-paginated-table/table-action.directive.ts rename to web-admin-app/src/app/shared/components/server-paginated-table/table-action.directive.ts diff --git a/web-admin-app/src/app/components/server-paginated-table/table-form.directive.ts b/web-admin-app/src/app/shared/components/server-paginated-table/table-form.directive.ts similarity index 100% rename from web-admin-app/src/app/components/server-paginated-table/table-form.directive.ts rename to web-admin-app/src/app/shared/components/server-paginated-table/table-form.directive.ts diff --git a/web-admin-app/src/app/components/user-form/user-form.component.html b/web-admin-app/src/app/shared/components/user-form/user-form.component.html similarity index 100% rename from web-admin-app/src/app/components/user-form/user-form.component.html rename to web-admin-app/src/app/shared/components/user-form/user-form.component.html diff --git a/web-admin-app/src/app/shared/components/user-form/user-form.component.less b/web-admin-app/src/app/shared/components/user-form/user-form.component.less new file mode 100644 index 0000000..e69de29 diff --git a/web-admin-app/src/app/components/user-form/user-form.component.ts b/web-admin-app/src/app/shared/components/user-form/user-form.component.ts similarity index 96% rename from web-admin-app/src/app/components/user-form/user-form.component.ts rename to web-admin-app/src/app/shared/components/user-form/user-form.component.ts index 7935c73..6edefec 100644 --- a/web-admin-app/src/app/components/user-form/user-form.component.ts +++ b/web-admin-app/src/app/shared/components/user-form/user-form.component.ts @@ -7,8 +7,7 @@ import { NZ_MODAL_DATA } from 'ng-zorro-antd/modal' @Component({ selector: 'app-user-form', - standalone: true, - imports: [SharedModule], + templateUrl: './user-form.component.html', styleUrl: './user-form.component.less', }) diff --git a/web-admin-app/src/app/shared/shared.module.ts b/web-admin-app/src/app/shared/shared.module.ts index 42a5596..42a97ba 100644 --- a/web-admin-app/src/app/shared/shared.module.ts +++ b/web-admin-app/src/app/shared/shared.module.ts @@ -3,15 +3,27 @@ import { CommonModule } from '@angular/common' import { RouterOutlet, RouterModule } from '@angular/router' import { EditorModule } from '@tinymce/tinymce-angular' import { ngZorroModules } from './ng-zorro' -import { ServerPaginatedTableModule } from '../components/server-paginated-table' -import { FormErrorTipsComponent } from '../components/form-error-tips/form-error-tips.component' +import { ServerPaginatedTableModule } from './components/server-paginated-table' +import { FormErrorTipsComponent } from './components/form-error-tips/form-error-tips.component' import { FormsModule, ReactiveFormsModule } from '@angular/forms' import { PermissionModule } from './permission/permission.module' -import { RangePickerComponent } from './../components/range-picker/range-picker.component' +import { RangePickerComponent } from './components/range-picker/range-picker.component' +import { AppPageComponent } from './components/app-page/app-page.component' +import { LayoutComponent, HeaderComponent, UserFormComponent } from './components' @NgModule({ - declarations: [], - imports: [RouterOutlet, FormErrorTipsComponent, PermissionModule, RangePickerComponent], + declarations: [AppPageComponent, LayoutComponent, HeaderComponent, UserFormComponent], + imports: [ + CommonModule, + FormsModule, + ReactiveFormsModule, + RouterOutlet, + RouterModule, + FormErrorTipsComponent, + PermissionModule, + RangePickerComponent, + ...ngZorroModules, + ], exports: [ CommonModule, RouterOutlet, @@ -23,6 +35,10 @@ import { RangePickerComponent } from './../components/range-picker/range-picker. PermissionModule, RangePickerComponent, EditorModule, + AppPageComponent, + UserFormComponent, + LayoutComponent, + HeaderComponent, ...ngZorroModules, ], }) diff --git a/web-admin-app/src/app/types/http.ts b/web-admin-app/src/app/types/http.ts index 5eaad5f..ca613d8 100644 --- a/web-admin-app/src/app/types/http.ts +++ b/web-admin-app/src/app/types/http.ts @@ -1,6 +1,6 @@ export type JwResponse = { - data: T + // data: T body: T - msg: string + desc: string code: number } diff --git a/web-admin-app/src/assets/images/jiluo_logo.png b/web-admin-app/src/assets/images/jiluo_logo.png new file mode 100644 index 0000000..b635ac2 Binary files /dev/null and b/web-admin-app/src/assets/images/jiluo_logo.png differ diff --git a/web-admin-app/src/assets/images/login-bg.jpg b/web-admin-app/src/assets/images/login-bg.jpg index 848d29e..c7a618a 100644 Binary files a/web-admin-app/src/assets/images/login-bg.jpg and b/web-admin-app/src/assets/images/login-bg.jpg differ diff --git a/web-admin-app/src/assets/images/logo.png b/web-admin-app/src/assets/images/logo.png deleted file mode 100644 index c518c64..0000000 Binary files a/web-admin-app/src/assets/images/logo.png and /dev/null differ diff --git a/web-admin-app/src/styles.less b/web-admin-app/src/styles.less index b3230bc..630a37f 100644 --- a/web-admin-app/src/styles.less +++ b/web-admin-app/src/styles.less @@ -63,6 +63,19 @@ body { background-color: rgba(0, 0, 0, .171) } +.upload-btn { + position: relative; + + input { + display: block; + height: 100%; + position: absolute; + inset: 0; + opacity: 0; + font-size: 0; + cursor: pointer; + } +} ul,