解决冲突
This commit is contained in:
329
src/app/routes/sys-setting/components/config/config.component.ts
Normal file
329
src/app/routes/sys-setting/components/config/config.component.ts
Normal file
@ -0,0 +1,329 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { SFComponent, SFSchema, SFUploadWidgetSchema } from '@delon/form';
|
||||
import { NzUploadFile } from 'ng-zorro-antd/upload';
|
||||
import { Observable, Observer, of } from 'rxjs';
|
||||
import { apiConf } from '@conf/api.conf';
|
||||
import { SystemService } from '../../services/system.service';
|
||||
const IMAGECONFIG = {
|
||||
previewFile: (file: NzUploadFile) => of(file.url),
|
||||
action: apiConf.waterFileUpload,
|
||||
fileType: 'image/png,image/jpeg,image/jpg,image/gif',
|
||||
fileSize: 5120,
|
||||
limit: 1,
|
||||
limitFileCount: 1,
|
||||
resReName: 'data.fullFileWatermarkPath',
|
||||
urlReName: 'data.fullFileWatermarkPath',
|
||||
widget: 'upload',
|
||||
name: 'multipartFile',
|
||||
multiple: false,
|
||||
listType: 'picture-card'
|
||||
} as SFUploadWidgetSchema;
|
||||
@Component({
|
||||
selector: 'app-parterl-config',
|
||||
templateUrl: './config.component.html',
|
||||
styleUrls: ['./config.component.less']
|
||||
})
|
||||
export class PartnerSystemConfigComponent implements OnInit {
|
||||
@ViewChild('sf', { static: false }) sf!: SFComponent;
|
||||
@ViewChild('sf2', { static: false }) sf2!: SFComponent;
|
||||
formDate: any = {
|
||||
isAudit: false,
|
||||
isEveryDay: false,
|
||||
isEveryWeek: false
|
||||
};
|
||||
personValue!: number;
|
||||
enterpriseValue!: number;
|
||||
auditValue!: number;
|
||||
auditTime!: any;
|
||||
auditTimeStatus: boolean = false
|
||||
everyDay: boolean = false
|
||||
MonthDay: boolean = false
|
||||
time: Date | null = null;
|
||||
defaultOpenValue = new Date(0, 0, 0, 0, 0, 0);
|
||||
tabs = [
|
||||
{
|
||||
name: '基础配置'
|
||||
},
|
||||
{
|
||||
name: '分享配置'
|
||||
}
|
||||
];
|
||||
selectedTab = 0;
|
||||
TimeStatus: boolean = true
|
||||
everyDayData: Array<any> =[];
|
||||
MonthDayData: any = [
|
||||
{month: [
|
||||
{ label: '周一', value: '周一', },
|
||||
{ label: '周二', value: '周二' },
|
||||
{ label: '周三', value: '周三' },
|
||||
{ label: '周四', value: '周四' },
|
||||
{ label: '周五', value: '周五' },
|
||||
{ label: '周六', value: '周六' },
|
||||
{ label: '周日', value: '周日' }
|
||||
], Times:[ {
|
||||
startTime: [],
|
||||
endTime: [],
|
||||
}]}
|
||||
]
|
||||
|
||||
checkOptionsOne = [
|
||||
{ label: '周一', value: '周一', checked: true },
|
||||
{ label: '周二', value: '周二' },
|
||||
{ label: '周三', value: '周三' },
|
||||
{ label: '周四', value: '周四' },
|
||||
{ label: '周五', value: '周五' },
|
||||
{ label: '周六', value: '周六' },
|
||||
{ label: '周日', value: '周日' }
|
||||
];
|
||||
|
||||
i: any;
|
||||
schema!: SFSchema;
|
||||
schema2!: SFSchema;
|
||||
|
||||
// IMAGECONFIG = {
|
||||
// widget: 'upload',
|
||||
// action: `/scm/cms/cms/upload/multipartFile/fileModel`,
|
||||
// limit: 1,
|
||||
// limitFileCount: 1,
|
||||
// resReName: 'url',
|
||||
// urlReName: 'url',
|
||||
// data: {
|
||||
// appId: this.service.envSrv.getEnvironment().appId
|
||||
// },
|
||||
// multiple: false,
|
||||
// listType: 'picture-card',
|
||||
// showRequired: true
|
||||
// };
|
||||
|
||||
constructor(private service: SystemService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.initSF();
|
||||
this.everyDayData = [
|
||||
{
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
}
|
||||
]
|
||||
}
|
||||
addEvery() {
|
||||
this.everyDayData.push(
|
||||
{
|
||||
startTime: [],
|
||||
endTime: [],
|
||||
}
|
||||
)
|
||||
}
|
||||
delEvery(index: number) {
|
||||
this.everyDayData.splice(index, 1)
|
||||
|
||||
}
|
||||
addMonthEvery(value: any) {
|
||||
this.MonthDayData[value].Times.push(
|
||||
{
|
||||
startTime: '',
|
||||
endTime: ''
|
||||
}
|
||||
)
|
||||
}
|
||||
addMonth() {
|
||||
this.MonthDayData.push(
|
||||
{month: [
|
||||
{ label: '周一', value: '周一', },
|
||||
{ label: '周二', value: '周二' },
|
||||
{ label: '周三', value: '周三' },
|
||||
{ label: '周四', value: '周四' },
|
||||
{ label: '周五', value: '周五' },
|
||||
{ label: '周六', value: '周六' },
|
||||
{ label: '周日', value: '周日' }
|
||||
], Times:[{
|
||||
startTime: '',
|
||||
endTime: ''
|
||||
}]}
|
||||
)
|
||||
|
||||
}
|
||||
delMonth(value: number,index: number) {
|
||||
this.MonthDayData[value].Times.splice(index, 1)
|
||||
}
|
||||
changeType(type: number): void {
|
||||
this.selectedTab = type;
|
||||
}
|
||||
changeMonth(type: any): void {
|
||||
console.log(type);
|
||||
console.log( this.MonthDayData);
|
||||
}
|
||||
everyDayChange(type: any): void {
|
||||
console.log(type);
|
||||
if(type) {
|
||||
this.MonthDay = false
|
||||
this.TimeStatus = true
|
||||
}
|
||||
}
|
||||
MonthDayChange(type: any): void {
|
||||
console.log(type);
|
||||
if(type) {
|
||||
this.everyDay = false
|
||||
this.TimeStatus = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
initSF() {
|
||||
|
||||
this.schema = {
|
||||
properties: {
|
||||
roadTransportPhoto: { title: '', type: 'string', ui: { hidden: true } },
|
||||
roadTransportPhotoWatermark: {
|
||||
type: 'string',
|
||||
title: '分享海报',
|
||||
ui: {
|
||||
...IMAGECONFIG,
|
||||
descriptionI18n: '支持JPG、PNG格式,文件小于2M(建议尺寸 750px* 1624 px)。',
|
||||
change: args => {
|
||||
if (args.type === 'success') {
|
||||
this.sf.setValue('/roadTransportPhoto', args.fileList[0].response.data.fullFilePath);
|
||||
}
|
||||
},
|
||||
} as SFUploadWidgetSchema
|
||||
},
|
||||
share: { title: '', type: 'string', ui: { hidden: true } },
|
||||
shareWatermark: {
|
||||
type: 'string',
|
||||
title: '分享图',
|
||||
ui: {
|
||||
...IMAGECONFIG,
|
||||
descriptionI18n: '支持JPG、PNG格式,文件小于2M( 建议尺寸 856px * 688px)。',
|
||||
change: args => {
|
||||
if (args.type === 'success') {
|
||||
this.sf.setValue('/share', args.fileList[0].response.data.fullFilePath);
|
||||
}
|
||||
},
|
||||
} as SFUploadWidgetSchema
|
||||
},
|
||||
take: { title: '', type: 'string', ui: { hidden: true } },
|
||||
takeWatermark: {
|
||||
type: 'string',
|
||||
title: '受邀海报',
|
||||
ui: {
|
||||
...IMAGECONFIG,
|
||||
descriptionI18n: '支持JPG、PNG格式,文件小于2M(建议尺寸 750px* 1624 px)。',
|
||||
change: args => {
|
||||
if (args.type === 'success') {
|
||||
this.sf.setValue('/take', args.fileList[0].response.data.fullFilePath);
|
||||
}
|
||||
},
|
||||
} as SFUploadWidgetSchema
|
||||
},
|
||||
complianceRemark: {
|
||||
title: '分享文案',
|
||||
type: 'string',
|
||||
maxLength: 50,
|
||||
ui: {
|
||||
placeholder: '请不要超过50个字',
|
||||
widget: 'textarea',
|
||||
autosize: { minRows: 3, maxRows: 6 }
|
||||
}
|
||||
}
|
||||
},
|
||||
required: ['roadTransportPhotoWatermark', 'shareWatermark', 'takeWatermark', 'complianceRemark']
|
||||
};
|
||||
this.schema2 = {
|
||||
properties: {
|
||||
roadTransportPhoto: { title: '', type: 'string', ui: { hidden: true } },
|
||||
roadTransportPhotoWatermark: {
|
||||
type: 'string',
|
||||
title: '分享海报',
|
||||
ui: {
|
||||
...IMAGECONFIG,
|
||||
descriptionI18n: '支持JPG、PNG格式,文件小于2M(建议尺寸750px* 1624 px)。',
|
||||
change: args => {
|
||||
if (args.type === 'success') {
|
||||
this.sf2.setValue('/roadTransportPhoto', args.fileList[0].response.data.fullFilePath);
|
||||
}
|
||||
},
|
||||
} as SFUploadWidgetSchema
|
||||
},
|
||||
share: { title: '', type: 'string', ui: { hidden: true } },
|
||||
shareWatermark: {
|
||||
type: 'string',
|
||||
title: '分享图',
|
||||
ui: {
|
||||
...IMAGECONFIG,
|
||||
descriptionI18n: '支持JPG、PNG格式,文件小于2M(建议尺寸 856px * 688px)。',
|
||||
change: args => {
|
||||
if (args.type === 'success') {
|
||||
this.sf2.setValue('/share', args.fileList[0].response.data.fullFilePath);
|
||||
}
|
||||
},
|
||||
} as SFUploadWidgetSchema
|
||||
},
|
||||
take: { title: '', type: 'string', ui: { hidden: true } },
|
||||
takeWatermark: {
|
||||
type: 'string',
|
||||
title: '受邀海报',
|
||||
ui: {
|
||||
...IMAGECONFIG,
|
||||
descriptionI18n: '支持JPG、PNG格式,文件小于2M(建议尺寸750px* 1624 px)。',
|
||||
change: args => {
|
||||
if (args.type === 'success') {
|
||||
this.sf2.setValue('/take', args.fileList[0].response.data.fullFilePath);
|
||||
}
|
||||
},
|
||||
} as SFUploadWidgetSchema
|
||||
},
|
||||
complianceRemark: {
|
||||
title: '分享文案',
|
||||
type: 'string',
|
||||
maxLength: 50,
|
||||
ui: {
|
||||
placeholder: '请不要超过50个字',
|
||||
widget: 'textarea',
|
||||
autosize: { minRows: 3, maxRows: 6 }
|
||||
}
|
||||
}
|
||||
},
|
||||
required: ['roadTransportPhotoWatermark', 'shareWatermark', 'takeWatermark', 'complianceRemark']
|
||||
};
|
||||
}
|
||||
private uploadBefore = (file: any, fileList: any) => {
|
||||
return new Observable((observer: Observer<boolean>) => {
|
||||
const isLt1M = file.size / 1024 / 1024 < 2;
|
||||
const fileType = 'image/png,image/jpeg';
|
||||
if (fileType.indexOf(file.type) === -1) {
|
||||
this.service.msgSrv.warning('图片格式不正确!');
|
||||
observer.complete();
|
||||
return;
|
||||
}
|
||||
if (!isLt1M) {
|
||||
// this.service.msgSrv.warning('图片需小于1M');
|
||||
this.service.msgSrv.warning('图片大小超过2M!');
|
||||
observer.complete();
|
||||
return;
|
||||
}
|
||||
observer.next(isLt1M);
|
||||
observer.complete();
|
||||
});
|
||||
};
|
||||
changeAuto(value: any) {
|
||||
console.log(value);
|
||||
if(value == '2') {
|
||||
this.auditTimeStatus = true
|
||||
} else {
|
||||
this.auditTimeStatus = false
|
||||
}
|
||||
}
|
||||
private getImageModel(args: any, key: any) {
|
||||
return [
|
||||
{
|
||||
uid: key,
|
||||
name: 'LOGO',
|
||||
status: 'done',
|
||||
url: args.fileList[0].response.url,
|
||||
response: {
|
||||
url: args.fileList[0].response.url
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user