diff --git a/src/app/common/components/blank-layout/blank-layout.component.html b/src/app/common/components/blank-layout/blank-layout.component.html
index 8853718f..f7c3c7eb 100644
--- a/src/app/common/components/blank-layout/blank-layout.component.html
+++ b/src/app/common/components/blank-layout/blank-layout.component.html
@@ -12,8 +12,7 @@
- {{ year }} 研发于
- WEPLANX
+ WEPLANX
diff --git a/src/app/common/components/pictures/form/form.component.ts b/src/app/common/components/pictures/form/form.component.ts
index c67aeed4..cdc12d86 100644
--- a/src/app/common/components/pictures/form/form.component.ts
+++ b/src/app/common/components/pictures/form/form.component.ts
@@ -1,11 +1,10 @@
import { Component, Inject, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
-import { Picture } from '@common/interfaces/picture';
+import { Picture, PictureTag } from '@common/interfaces/picture';
import { PictureTagsService } from '@common/services/picture-tags.service';
import { AnyDto } from '@weplanx/ng';
import { PicturesService } from '@weplanx/ng/media';
-import { WpxQuick } from '@weplanx/ng/quick';
import { NzMessageService } from 'ng-zorro-antd/message';
import { NZ_MODAL_DATA, NzModalRef } from 'ng-zorro-antd/modal';
import { NzNotificationService } from 'ng-zorro-antd/notification';
@@ -27,7 +26,7 @@ export class FormComponent implements OnInit {
}
}
};
- tagItems: Array
> = [];
+ tagItems: Array> = [];
constructor(
@Inject(NZ_MODAL_DATA) public data: InputData,
diff --git a/src/app/common/components/pictures/pictures-input.component.html b/src/app/common/components/pictures/pictures-input.component.html
index f0c8864d..2186299b 100644
--- a/src/app/common/components/pictures/pictures-input.component.html
+++ b/src/app/common/components/pictures/pictures-input.component.html
@@ -19,8 +19,7 @@
-
-
+
diff --git a/src/app/common/components/pictures/pictures.component.html b/src/app/common/components/pictures/pictures.component.html
index c03bcd66..30e171f7 100644
--- a/src/app/common/components/pictures/pictures.component.html
+++ b/src/app/common/components/pictures/pictures.component.html
@@ -6,7 +6,6 @@
>
-
;
@ViewChild('searchRef', { static: true }) searchRef!: TemplateRef;
@ViewChild(WpxMediaComponent, { static: true }) mediaRef!: WpxMediaComponent;
- @ViewChild(WpxQuickComponent, { static: true }) tagsRef!: WpxQuickComponent;
ds!: WpxMediaDataSource;
searchText = '';
- tagItems: Array> = [];
+ tagItems: Array> = [];
tagIds: string[] = [];
- constructor(private pictures: PicturesService, public tags: PictureTagsService, private modal: NzModalService) {}
+ constructor(
+ private pictures: PicturesService,
+ public tags: PictureTagsService,
+ private modal: NzModalService,
+ private drawer: NzDrawerService
+ ) {}
ngOnInit(): void {
this.ds = new WpxMediaDataSource(this.pictures);
@@ -49,8 +50,13 @@ export class PicturesComponent implements OnInit {
this.ds.fetch(refresh);
}
+ clear(): void {
+ this.searchText = '';
+ this.getData(true);
+ }
+
getTags(name?: string): void {
- const filter: Record = {};
+ const filter: Filter = {};
if (name) {
filter['name'] = { $regex: name };
}
@@ -59,9 +65,12 @@ export class PicturesComponent implements OnInit {
});
}
- clear(): void {
- this.searchText = '';
- this.getData(true);
+ openTags(): void {
+ this.drawer.create({
+ nzWidth: 600,
+ nzClosable: false,
+ nzContent: TagsComponent
+ });
}
upload(data: Transport[]): void {
diff --git a/src/app/common/components/pictures/pictures.module.ts b/src/app/common/components/pictures/pictures.module.ts
index d4e17a35..927fcaec 100644
--- a/src/app/common/components/pictures/pictures.module.ts
+++ b/src/app/common/components/pictures/pictures.module.ts
@@ -1,6 +1,8 @@
import { NgModule } from '@angular/core';
import { FormComponent } from '@common/components/pictures/form/form.component';
+import { TagFormComponent } from '@common/components/pictures/tag-form/tag-form.component';
+import { TagsComponent } from '@common/components/pictures/tags/tags.component';
import { ShareModule } from '@common/share.module';
import { PicturesInputComponent } from './pictures-input.component';
@@ -8,7 +10,7 @@ import { PicturesComponent } from './pictures.component';
@NgModule({
imports: [ShareModule],
- declarations: [PicturesComponent, PicturesInputComponent, FormComponent],
- exports: [PicturesComponent, PicturesInputComponent, FormComponent]
+ declarations: [PicturesComponent, PicturesInputComponent, FormComponent, TagsComponent, TagFormComponent],
+ exports: [PicturesComponent, PicturesInputComponent]
})
export class PicturesModule {}
diff --git a/library/quick/form/form.component.html b/src/app/common/components/pictures/tag-form/tag-form.component.html
similarity index 100%
rename from library/quick/form/form.component.html
rename to src/app/common/components/pictures/tag-form/tag-form.component.html
diff --git a/library/quick/form/form.component.ts b/src/app/common/components/pictures/tag-form/tag-form.component.ts
similarity index 58%
rename from library/quick/form/form.component.ts
rename to src/app/common/components/pictures/tag-form/tag-form.component.ts
index ff1a2fbc..43cb0bbf 100644
--- a/library/quick/form/form.component.ts
+++ b/src/app/common/components/pictures/tag-form/tag-form.component.ts
@@ -1,17 +1,22 @@
import { Component, Inject, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
+import { PictureTag } from '@common/interfaces/picture';
+import { PictureTagsService } from '@common/services/picture-tags.service';
+import { AnyDto } from '@weplanx/ng';
import { NzMessageService } from 'ng-zorro-antd/message';
import { NZ_MODAL_DATA, NzModalRef } from 'ng-zorro-antd/modal';
import { NzNotificationService } from 'ng-zorro-antd/notification';
-import { WpxQuickInputData } from '../types';
+export interface TagInputData {
+ doc?: AnyDto;
+}
@Component({
- selector: 'wpx-quick-form',
- templateUrl: './form.component.html'
+ selector: 'app-pictures-tag-form',
+ templateUrl: './tag-form.component.html'
})
-export class FormComponent implements OnInit {
+export class TagFormComponent implements OnInit {
form!: FormGroup;
tips: any = {
name: {
@@ -22,11 +27,12 @@ export class FormComponent implements OnInit {
};
constructor(
- @Inject(NZ_MODAL_DATA) public data: WpxQuickInputData,
+ @Inject(NZ_MODAL_DATA) public data: TagInputData,
private modalRef: NzModalRef,
private message: NzMessageService,
private notification: NzNotificationService,
- private fb: FormBuilder
+ private fb: FormBuilder,
+ private tags: PictureTagsService
) {}
ngOnInit(): void {
@@ -44,15 +50,19 @@ export class FormComponent implements OnInit {
submit(data: any): void {
if (!this.data.doc) {
- this.data.api.create(data).subscribe(() => {
+ this.tags.create(data).subscribe(() => {
this.message.success($localize`数据更新成功`);
this.modalRef.triggerOk();
});
} else {
- this.data.api.updateById(this.data.doc._id, { $set: data }).subscribe(() => {
- this.message.success($localize`数据更新成功`);
- this.modalRef.triggerOk();
- });
+ this.tags
+ .updateById(this.data.doc._id, {
+ $set: data
+ })
+ .subscribe(() => {
+ this.message.success($localize`数据更新成功`);
+ this.modalRef.triggerOk();
+ });
}
}
}
diff --git a/src/app/common/components/pictures/tags/tags.component.html b/src/app/common/components/pictures/tags/tags.component.html
new file mode 100644
index 00000000..bdf68ae7
--- /dev/null
+++ b/src/app/common/components/pictures/tags/tags.component.html
@@ -0,0 +1,123 @@
+
+ 图片标签
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 共计 {{ ds.total }} 条记录
+
+
+
+
+
+
+
+
+
+ |
+ 标签名称 |
+
+
+ |
+
+
+
+
+ |
+
+ {{ data.name }} |
+
+
+
+
+
+
+ |
+
+
+
+
+
+-
+
+
+
+ 已选中 {{ ds.checkedNumber }} 项
+
+
+ 取消选择
+
+ 删除
+
+
diff --git a/src/app/common/components/pictures/tags/tags.component.ts b/src/app/common/components/pictures/tags/tags.component.ts
new file mode 100644
index 00000000..3e45faa9
--- /dev/null
+++ b/src/app/common/components/pictures/tags/tags.component.ts
@@ -0,0 +1,96 @@
+import { Component, OnInit } from '@angular/core';
+
+import { AppService } from '@app';
+import { TagFormComponent, TagInputData } from '@common/components/pictures/tag-form/tag-form.component';
+import { PictureTag } from '@common/interfaces/picture';
+import { PictureTagsService } from '@common/services/picture-tags.service';
+import { AnyDto, WpxData } from '@weplanx/ng';
+import { NzMessageService } from 'ng-zorro-antd/message';
+import { NzModalService } from 'ng-zorro-antd/modal';
+
+@Component({
+ selector: 'app-pictures-tags',
+ templateUrl: './tags.component.html'
+})
+export class TagsComponent implements OnInit {
+ ds: WpxData> = new WpxData>();
+ searchText = '';
+
+ constructor(
+ public app: AppService,
+ private tags: PictureTagsService,
+ private modal: NzModalService,
+ private message: NzMessageService
+ ) {}
+
+ ngOnInit(): void {
+ this.getData(true);
+ }
+
+ getData(refresh = false): void {
+ this.ds.filter = {};
+ if (this.searchText) {
+ this.ds.filter.name = { $regex: this.searchText };
+ }
+ this.tags.pages(this.ds, refresh).subscribe(() => {});
+ }
+
+ clear(): void {
+ this.searchText = '';
+ this.getData(true);
+ }
+
+ form(doc?: AnyDto): void {
+ this.modal.create({
+ nzTitle: !doc ? `创建` : `编辑【${doc.name}】`,
+ nzContent: TagFormComponent,
+ nzData: {
+ doc
+ },
+ nzOnOk: () => {
+ this.getData(true);
+ }
+ });
+ }
+
+ delete(doc: AnyDto): void {
+ this.modal.confirm({
+ nzTitle: $localize`您确定要删除【${doc.name}】?`,
+ nzOkText: $localize`是的`,
+ nzOkType: 'primary',
+ nzOkDanger: true,
+ nzCancelText: $localize`再想想`,
+ nzOnOk: () => {
+ this.tags.delete(doc._id).subscribe(() => {
+ this.message.success($localize`数据删除成功`);
+ this.getData(true);
+ });
+ }
+ });
+ }
+
+ bulkDelete(): void {
+ this.modal.confirm({
+ nzTitle: $localize`您确认要删除这些吗?`,
+ nzOkText: $localize`是的`,
+ nzOkType: 'primary',
+ nzOkDanger: true,
+ nzOnOk: () => {
+ this.tags
+ .bulkDelete(
+ { _id: { $in: [...this.ds.checkedIds.values()] } },
+ {
+ xfilter: { '_id.$in': 'oids' }
+ }
+ )
+ .subscribe(() => {
+ this.message.success($localize`数据删除成功`);
+ this.ds.checkedIds.clear();
+ this.ds.updateCheckedStatus();
+ this.getData(true);
+ });
+ },
+ nzCancelText: $localize`否`
+ });
+ }
+}
diff --git a/src/app/common/components/richtext/richtext.component.html b/src/app/common/components/richtext/richtext.component.html
index f36b0512..f3102cfc 100644
--- a/src/app/common/components/richtext/richtext.component.html
+++ b/src/app/common/components/richtext/richtext.component.html
@@ -15,8 +15,7 @@
-
-
+
diff --git a/src/app/common/components/richtext/richtext.module.ts b/src/app/common/components/richtext/richtext.module.ts
index 22232a4c..40fc27ba 100644
--- a/src/app/common/components/richtext/richtext.module.ts
+++ b/src/app/common/components/richtext/richtext.module.ts
@@ -1,13 +1,12 @@
import { NgModule } from '@angular/core';
import { WpxModule, WpxShareModule } from '@weplanx/ng';
-import { WpxQuickModule } from '@weplanx/ng/quick';
import { WpxRichtextModule } from '@weplanx/ng/richtext';
import { RichtextComponent } from './richtext.component';
@NgModule({
- imports: [WpxModule, WpxShareModule, WpxRichtextModule, WpxQuickModule],
+ imports: [WpxModule, WpxShareModule, WpxRichtextModule],
declarations: [RichtextComponent],
exports: [RichtextComponent]
})
diff --git a/src/app/common/components/videos/tag-form/tag-form.component.ts b/src/app/common/components/videos/tag-form/tag-form.component.ts
index 52776ad0..97669ab5 100644
--- a/src/app/common/components/videos/tag-form/tag-form.component.ts
+++ b/src/app/common/components/videos/tag-form/tag-form.component.ts
@@ -1,13 +1,16 @@
import { Component, Inject, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
-import { WpxQuickInputData } from '@weplanx/ng/quick';
+import { VideoTag } from '@common/interfaces/video';
+import { VideoTagsService } from '@common/services/video-tags.service';
+import { AnyDto } from '@weplanx/ng';
import { NzMessageService } from 'ng-zorro-antd/message';
import { NZ_MODAL_DATA, NzModalRef } from 'ng-zorro-antd/modal';
import { NzNotificationService } from 'ng-zorro-antd/notification';
-export interface TagInputData extends WpxQuickInputData {
- shop_id: string;
+export interface TagInputData {
+ shopId: string;
+ doc?: AnyDto;
}
@Component({
@@ -29,13 +32,14 @@ export class TagFormComponent implements OnInit {
private modalRef: NzModalRef,
private message: NzMessageService,
private notification: NzNotificationService,
- private fb: FormBuilder
+ private fb: FormBuilder,
+ private tags: VideoTagsService
) {}
ngOnInit(): void {
this.form = this.fb.group({
- name: [null, [Validators.required]],
- shop_id: [this.data.shop_id]
+ shop_id: [this.data.shopId],
+ name: [null, [Validators.required]]
});
if (this.data.doc) {
this.form.patchValue(this.data.doc);
@@ -48,7 +52,7 @@ export class TagFormComponent implements OnInit {
submit(data: any): void {
if (!this.data.doc) {
- this.data.api
+ this.tags
.create(data, {
xdata: { shop_id: 'oid' }
})
@@ -57,7 +61,7 @@ export class TagFormComponent implements OnInit {
this.modalRef.triggerOk();
});
} else {
- this.data.api
+ this.tags
.updateById(
this.data.doc._id,
{
diff --git a/src/app/common/components/videos/tags/tags.component.html b/src/app/common/components/videos/tags/tags.component.html
new file mode 100644
index 00000000..14026445
--- /dev/null
+++ b/src/app/common/components/videos/tags/tags.component.html
@@ -0,0 +1,123 @@
+
+ 视频标签
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 共计 {{ ds.total }} 条记录
+
+
+
+
+
+
+
+
+
+ |
+ 标签名称 |
+
+
+ |
+
+
+
+
+ |
+
+ {{ data.name }} |
+
+
+
+
+
+
+ |
+
+
+
+
+
+-
+
+
+
+ 已选中 {{ ds.checkedNumber }} 项
+
+
+ 取消选择
+
+ 删除
+
+
diff --git a/src/app/common/components/videos/tags/tags.component.ts b/src/app/common/components/videos/tags/tags.component.ts
new file mode 100644
index 00000000..97d42c0c
--- /dev/null
+++ b/src/app/common/components/videos/tags/tags.component.ts
@@ -0,0 +1,98 @@
+import { Component, OnInit } from '@angular/core';
+
+import { AppService } from '@app';
+import { TagFormComponent, TagInputData } from '@common/components/videos/tag-form/tag-form.component';
+import { VideoTag } from '@common/interfaces/video';
+import { VideoTagsService } from '@common/services/video-tags.service';
+import { AnyDto, WpxData } from '@weplanx/ng';
+import { NzMessageService } from 'ng-zorro-antd/message';
+import { NzModalService } from 'ng-zorro-antd/modal';
+
+@Component({
+ selector: 'app-videos-tags',
+ templateUrl: './tags.component.html'
+})
+export class TagsComponent implements OnInit {
+ ds: WpxData> = new WpxData>();
+ searchText = '';
+
+ constructor(
+ public app: AppService,
+ private tags: VideoTagsService,
+ private modal: NzModalService,
+ private message: NzMessageService
+ ) {}
+
+ ngOnInit(): void {
+ this.getData(true);
+ }
+
+ getData(refresh = false): void {
+ this.ds.filter = { shop_id: '64256825b16d000cd6bcfb5d' };
+ this.ds.xfilter = { shop_id: 'oid' };
+ if (this.searchText) {
+ this.ds.filter.name = { $regex: this.searchText };
+ }
+ this.tags.pages(this.ds, refresh).subscribe(() => {});
+ }
+
+ clear(): void {
+ this.searchText = '';
+ this.getData(true);
+ }
+
+ form(doc?: AnyDto): void {
+ this.modal.create({
+ nzTitle: !doc ? `创建` : `编辑【${doc.name}】`,
+ nzContent: TagFormComponent,
+ nzData: {
+ shopId: '64256825b16d000cd6bcfb5d',
+ doc
+ },
+ nzOnOk: () => {
+ this.getData(true);
+ }
+ });
+ }
+
+ delete(doc: AnyDto): void {
+ this.modal.confirm({
+ nzTitle: $localize`您确定要删除【${doc.name}】?`,
+ nzOkText: $localize`是的`,
+ nzOkType: 'primary',
+ nzOkDanger: true,
+ nzCancelText: $localize`再想想`,
+ nzOnOk: () => {
+ this.tags.delete(doc._id).subscribe(() => {
+ this.message.success($localize`数据删除成功`);
+ this.getData(true);
+ });
+ }
+ });
+ }
+
+ bulkDelete(): void {
+ this.modal.confirm({
+ nzTitle: $localize`您确认要删除这些吗?`,
+ nzOkText: $localize`是的`,
+ nzOkType: 'primary',
+ nzOkDanger: true,
+ nzOnOk: () => {
+ this.tags
+ .bulkDelete(
+ { _id: { $in: [...this.ds.checkedIds.values()] } },
+ {
+ xfilter: { '_id.$in': 'oids' }
+ }
+ )
+ .subscribe(() => {
+ this.message.success($localize`数据删除成功`);
+ this.ds.checkedIds.clear();
+ this.ds.updateCheckedStatus();
+ this.getData(true);
+ });
+ },
+ nzCancelText: $localize`否`
+ });
+ }
+}
diff --git a/src/app/common/components/videos/videos-input.component.html b/src/app/common/components/videos/videos-input.component.html
index f6e98ebb..32d34619 100644
--- a/src/app/common/components/videos/videos-input.component.html
+++ b/src/app/common/components/videos/videos-input.component.html
@@ -22,8 +22,7 @@
-
-
+
diff --git a/src/app/common/components/videos/videos.component.html b/src/app/common/components/videos/videos.component.html
index 9fe45263..b433c614 100644
--- a/src/app/common/components/videos/videos.component.html
+++ b/src/app/common/components/videos/videos.component.html
@@ -14,18 +14,6 @@
-
- 名称
- SHOP
- {{ data.name }}
- {{ data.shop_id }}
-
;
@ViewChild('searchRef', { static: true }) searchRef!: TemplateRef;
@ViewChild(WpxMediaComponent, { static: true }) mediaRef!: WpxMediaComponent;
- @ViewChild(WpxQuickComponent, { static: true }) tagsRef!: WpxQuickComponent;
ds!: WpxMediaDataSource;
searchText = '';
@@ -33,10 +32,15 @@ export class VideosComponent implements OnInit {
{ _id: '642569d0b16d000cd6bcfb60', name: '店铺 C' }
];
- tagItems: Array> = [];
+ tagItems: Array> = [];
tagIds: string[] = [];
- constructor(private videos: VideosService, public tags: VideoTagsService, private modal: NzModalService) {}
+ constructor(
+ private videos: VideosService,
+ public tags: VideoTagsService,
+ private modal: NzModalService,
+ private drawer: NzDrawerService
+ ) {}
ngOnInit(): void {
this.ds = new WpxMediaDataSource(this.videos);
@@ -56,6 +60,11 @@ export class VideosComponent implements OnInit {
this.ds.fetch(refresh);
}
+ clear(): void {
+ this.searchText = '';
+ this.getData(true);
+ }
+
getTags(name?: string): void {
const filter: Record = { shop_id: this.shop };
const xfilter: Record = { shop_id: 'oid' };
@@ -67,9 +76,12 @@ export class VideosComponent implements OnInit {
});
}
- clear(): void {
- this.searchText = '';
- this.getData(true);
+ openTags(): void {
+ this.drawer.create({
+ nzWidth: 600,
+ nzClosable: false,
+ nzContent: TagsComponent
+ });
}
shopChange(): void {
@@ -92,27 +104,6 @@ export class VideosComponent implements OnInit {
});
}
- tagFilter = (ds: WpxData>): void => {
- ds.xfilter = { shop_id: 'oid' };
- ds.filter.shop_id = this.shop;
- };
-
- tagForm = (doc?: AnyDto): void => {
- this.modal.create({
- nzTitle: !doc ? $localize`新增` : $localize`编辑`,
- nzContent: TagFormComponent,
- nzData: {
- shop_id: this.shop,
- doc: doc,
- api: this.tags
- },
- nzOnOk: () => {
- this.tagsRef.getData(true);
- this.getTags();
- }
- });
- };
-
form = (doc: AnyDto