140 lines
4.0 KiB
TypeScript
140 lines
4.0 KiB
TypeScript
/*
|
|
* @Author: your name
|
|
* @Date: 2022-01-05 11:01:55
|
|
* @LastEditTime: 2022-01-06 10:29:11
|
|
* @LastEditors: Please set LastEditors
|
|
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
* @FilePath: \tms-obc-web\src\app\routes\contract-management\components\contract-template-detail\contract-template-detail.component.ts
|
|
*/
|
|
import { DatePipe } from '@angular/common';
|
|
import { Component, OnInit, ViewChild } from '@angular/core';
|
|
import { ActivatedRoute } from '@angular/router';
|
|
import { apiConf } from '@conf/api.conf';
|
|
import { STColumn, STComponent } from '@delon/abc/st';
|
|
import { SFComponent, SFDateWidgetSchema, SFSchema, SFSchemaEnum, SFSelectWidgetSchema, SFTagWidgetSchema, SFTextWidgetSchema, SFUISchema } from '@delon/form';
|
|
import { ModalHelper, _HttpClient } from '@delon/theme';
|
|
import { NzMessageService } from 'ng-zorro-antd/message';
|
|
import { NzModalService } from 'ng-zorro-antd/modal';
|
|
import { of } from 'rxjs';
|
|
import { map } from 'rxjs/operators';
|
|
import { ImageViewComponent } from 'src/app/shared/components/imagelist';
|
|
import { ContractManagementService } from '../../services/contract-management.service';
|
|
|
|
@Component({
|
|
selector: 'app-contract-management-template-detail-complaint',
|
|
templateUrl: './contract-template-detail.component.html',
|
|
styleUrls: ['./contract-template-detail.component.less'],
|
|
providers: [DatePipe]
|
|
})
|
|
export class UserCenterComponentsDriverDetailComponent implements OnInit {
|
|
|
|
constructor(
|
|
private nzModalService: NzModalService,
|
|
public service: ContractManagementService,
|
|
public route: ActivatedRoute,
|
|
private datePipe: DatePipe
|
|
) {}
|
|
textStatus = '新建模板'
|
|
@ViewChild('sf', { static: false }) sf!: SFComponent;
|
|
schema: SFSchema = {};
|
|
@ViewChild('sf2', { static: false }) sf2!: SFComponent;
|
|
schema2: SFSchema = {};
|
|
ui!: SFUISchema;
|
|
sfdata: any;
|
|
title: any;
|
|
templateHTML: any;
|
|
isUpdate = false;
|
|
ngOnInit() {
|
|
this.initSF()
|
|
this.initSF2()
|
|
if(this.route.snapshot.queryParams.status == 1) {
|
|
console.log('进来了吗')
|
|
// 新建
|
|
this.isUpdate = true;
|
|
} else if(this.route.snapshot.queryParams.status == 2) {
|
|
// 编辑
|
|
this.textStatus = '编辑模板';
|
|
this.isUpdate =false;
|
|
}else if(this.route.snapshot.queryParams.status == 3) {
|
|
// 编辑
|
|
this.textStatus = '查看模板';
|
|
this.isUpdate =false;
|
|
}
|
|
|
|
console.log(this.route.snapshot.params.id)
|
|
console.log(this.route.snapshot.queryParams.status)
|
|
}
|
|
goBack() {
|
|
window.history.go(-1)
|
|
}
|
|
initSF() {
|
|
this.schema = {
|
|
properties: {
|
|
templateName: {
|
|
type: 'string',
|
|
title: '模版名称',
|
|
},
|
|
templateType: {
|
|
type: 'string',
|
|
title: '模版类型',
|
|
enum: [
|
|
{ label: '需要', value: true },
|
|
{ label: '不需要', value: false }
|
|
],
|
|
ui: {
|
|
widget: 'select',
|
|
errors: { required: '请选择' },
|
|
placeholder: '请选择'
|
|
}
|
|
},
|
|
contractType: {
|
|
type: 'string',
|
|
title: '单据类型',
|
|
ui: {
|
|
widget: 'select',
|
|
placeholder: '请选择',
|
|
visibleIf: {
|
|
templateType: value => value === true
|
|
}
|
|
} as SFSelectWidgetSchema
|
|
},
|
|
}
|
|
};
|
|
this.ui = {
|
|
'*': {
|
|
spanLabelFixed: 120,
|
|
grid: { span: 8 }
|
|
}
|
|
};
|
|
}
|
|
initSF2(data?: any) {
|
|
this.schema2 = {
|
|
properties: {
|
|
templateContent: {
|
|
type: 'string',
|
|
title: '',
|
|
ui: {
|
|
widget: 'tinymce',
|
|
loadingTip: 'loading...',
|
|
config: {
|
|
height: 650
|
|
}
|
|
},
|
|
default: data?.agreementContent || ''
|
|
}
|
|
}
|
|
};
|
|
}
|
|
|
|
cancel() {
|
|
|
|
}
|
|
|
|
save () {
|
|
console.log(this.sf.value);
|
|
console.log(this.sfdata);
|
|
console.log(this.sf2.value);
|
|
console.log(this.title);
|
|
}
|
|
}
|