|
@@ -15,6 +15,9 @@ import { MatButtonModule } from '@angular/material/button';
|
|
|
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
|
|
import { UtilnowPipe } from '../../../pipes/utilnow.pipe';
|
|
|
import { NzTableModule } from 'ng-zorro-antd/table';
|
|
|
+import { openObjectEditDialog } from '../../../schemas/func-parse';
|
|
|
+import { MatIconModule } from '@angular/material/icon';
|
|
|
+import { NzIconModule } from 'ng-zorro-antd/icon';
|
|
|
|
|
|
interface SchemaFiled{
|
|
|
key:string,
|
|
@@ -31,8 +34,8 @@ interface SchemaFiled{
|
|
|
imports:[CommonModule,
|
|
|
UtilnowPipe,
|
|
|
// TranslateModule,
|
|
|
- NzPaginationModule,NzEmptyModule,NzTableModule,NzResultModule,
|
|
|
- MatButtonModule,MatCheckboxModule,MatSlideToggleModule,
|
|
|
+ NzPaginationModule,NzEmptyModule,NzTableModule,NzResultModule,NzIconModule,
|
|
|
+ MatButtonModule,MatCheckboxModule,MatSlideToggleModule,MatIconModule,
|
|
|
],
|
|
|
providers:[]
|
|
|
})
|
|
@@ -70,6 +73,12 @@ export class CompTableListComponent {
|
|
|
this.refresh();
|
|
|
}
|
|
|
|
|
|
+ createObject(){
|
|
|
+ openObjectEditDialog(this.dialog,this.schema,undefined,()=>{
|
|
|
+ this.refresh();
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
batchHandle(button:any){
|
|
|
// console.log(this.currentLang,'888888888888888888')
|
|
|
button?.handle({
|
|
@@ -155,4 +164,42 @@ export class CompTableListComponent {
|
|
|
object.set(key,!object.get(key))
|
|
|
object.save();
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 行选择处理逻辑
|
|
|
+ */
|
|
|
+ checked = false;
|
|
|
+ indeterminate = false;
|
|
|
+ setOfCheckedId = new Set<string>();
|
|
|
+
|
|
|
+ updateCheckedSet(id: string, checked: boolean): void {
|
|
|
+ if (checked) {
|
|
|
+ this.setOfCheckedId.add(id);
|
|
|
+ } else {
|
|
|
+ this.setOfCheckedId.delete(id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ onCurrentPageDataChange(event:any): void {
|
|
|
+ this.refreshCheckedStatus();
|
|
|
+ }
|
|
|
+
|
|
|
+ refreshCheckedStatus(): void {
|
|
|
+ const listOfEnabledData = this.list // .filter(({ disabled }) => !disabled);
|
|
|
+ this.checked = listOfEnabledData.every(({ id }) => this.setOfCheckedId.has(id));
|
|
|
+ this.indeterminate = listOfEnabledData.some(({ id }) => this.setOfCheckedId.has(id)) && !this.checked;
|
|
|
+ }
|
|
|
+
|
|
|
+ onItemChecked(id: string, checked: boolean): void {
|
|
|
+ this.updateCheckedSet(id, checked);
|
|
|
+ this.refreshCheckedStatus();
|
|
|
+ }
|
|
|
+
|
|
|
+ onAllChecked(checked: boolean): void {
|
|
|
+ this.list
|
|
|
+ // .filter(({ disabled }) => !disabled)
|
|
|
+ .forEach(({ id }) => this.updateCheckedSet(id, checked));
|
|
|
+ this.refreshCheckedStatus();
|
|
|
+ }
|
|
|
}
|