fix bug
This commit is contained in:
@ -0,0 +1,24 @@
|
||||
<!-- 页头 -->
|
||||
<page-header-wrapper [title]="''" [logo]="logo">
|
||||
<ng-template #logo>
|
||||
<button nz-button nz-tooltip nzTooltipTitle="返回上一页" (click)="goBack()">
|
||||
<i nz-icon nzType="left" nzTheme="outline"></i>
|
||||
</button>
|
||||
</ng-template>
|
||||
</page-header-wrapper>
|
||||
<nz-card>
|
||||
<div class="modal-header">
|
||||
<div class="modal-title" *ngIf="queryParams.type === 'add'">新增banner</div>
|
||||
<div class="modal-title" *ngIf="queryParams.type === 'edit'">编辑banner</div>
|
||||
<div class="modal-title" *ngIf="queryParams.type === 'view'">查看banner</div>
|
||||
</div>
|
||||
<sf #sf [schema]="schema" [ui]="ui" [button]="'none'" [formData]="detailData">
|
||||
</sf>
|
||||
<div class="modal-footer" *ngIf="queryParams.type !== 'view'">
|
||||
<button nz-button type="button" (click)="checkSort()" nzType="primary" [disabled]="validFalg">保存</button>
|
||||
<button nz-button type="button" (click)="goBack()">取消</button>
|
||||
</div>
|
||||
</nz-card>
|
||||
<!-- <nz-modal [(nzVisible)]="isVisible" nzTitle="The first Modal" (nzOnCancel)="handleCancel()" (nzOnOk)="handleOk()">
|
||||
<baidu-map [inputAddress]="detailData.companyAddress" [inputPoint]="inputPoint" (outputPointAddress)="outputPointAddress($event)"></baidu-map>
|
||||
</nz-modal> -->
|
||||
@ -0,0 +1,24 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { BannerComponentsAddComponent } from './add.component';
|
||||
|
||||
describe('BannerComponentsAddComponent', () => {
|
||||
let component: BannerComponentsAddComponent;
|
||||
let fixture: ComponentFixture<BannerComponentsAddComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ BannerComponentsAddComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(BannerComponentsAddComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -1,6 +1,6 @@
|
||||
import { ChangeDetectorRef, Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { SFComponent, SFSchema, SFSelectWidgetSchema, SFUISchema } from '@delon/form';
|
||||
import { SFComponent, SFRadioWidgetSchema, SFSchema, SFSelectWidgetSchema, SFUISchema } from '@delon/form';
|
||||
import { ModalHelper, _HttpClient } from '@delon/theme';
|
||||
import { EAEnvironmentService } from '@shared';
|
||||
import differenceInCalendarDays from 'date-fns/differenceInCalendarDays';
|
||||
@ -9,7 +9,7 @@ import { NzMessageService } from 'ng-zorro-antd/message';
|
||||
import { NzModalService } from 'ng-zorro-antd/modal';
|
||||
import { NzUploadFile } from 'ng-zorro-antd/upload';
|
||||
import { Observable, Observer, of } from 'rxjs';
|
||||
import { ScrollImgService } from '../../services/scrollimg.service';
|
||||
import { BannerService } from '../../services/banner.service';
|
||||
import { apiConf } from '@conf/api.conf';
|
||||
|
||||
@Component({
|
||||
@ -17,7 +17,7 @@ import { apiConf } from '@conf/api.conf';
|
||||
templateUrl: './add.component.html',
|
||||
styleUrls: ['./add.less']
|
||||
})
|
||||
export class ScrollimgComponentsAddComponent implements OnInit {
|
||||
export class BannerComponentsAddComponent implements OnInit {
|
||||
@ViewChild('sf', { static: false }) sf!: SFComponent;
|
||||
record: any = {};
|
||||
i: any;
|
||||
@ -51,11 +51,9 @@ export class ScrollimgComponentsAddComponent implements OnInit {
|
||||
constructor(
|
||||
public msgSrv: NzMessageService,
|
||||
public http: _HttpClient,
|
||||
public service: ScrollImgService,
|
||||
public service: BannerService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private modal: ModalHelper,
|
||||
private modalSrv: NzModalService,
|
||||
private cdr: ChangeDetectorRef,
|
||||
private envSrv: EAEnvironmentService,
|
||||
) { }
|
||||
@ -76,25 +74,16 @@ export class ScrollimgComponentsAddComponent implements OnInit {
|
||||
properties: {
|
||||
name: {
|
||||
type: 'string',
|
||||
title: '轮播图名称',
|
||||
title: 'banner名称',
|
||||
maxLength: 10,
|
||||
ui: {
|
||||
showRequired: true,
|
||||
placeholder: '请不要超过10个字',
|
||||
}
|
||||
},
|
||||
style: {
|
||||
type: 'string',
|
||||
title: '轮播图',
|
||||
ui: {
|
||||
showRequired: true,
|
||||
widget: 'custom',
|
||||
placeholder: '请选择轮播图',
|
||||
}
|
||||
},
|
||||
licensePhotoWatermark: {
|
||||
type: 'string',
|
||||
title: '轮播图',
|
||||
title: 'banner图',
|
||||
ui: {
|
||||
action: apiConf.fileUpload,
|
||||
accept: 'image/png,image/jpeg,image/jpg,image/gif',
|
||||
@ -103,7 +92,7 @@ export class ScrollimgComponentsAddComponent implements OnInit {
|
||||
resReName: 'data.fullFileWatermarkPath',
|
||||
urlReName: 'data.fullFileWatermarkPath',
|
||||
widget: 'upload',
|
||||
descriptionI18n: '图片支持jpg、jpeg、png、gif格式,大小不超过4M',
|
||||
descriptionI18n: '支持JPG、PNG格式,文件小于2M(建议尺寸 700px * 286px)。',
|
||||
data: {
|
||||
appId: this.envSrv.env.appId,
|
||||
},
|
||||
@ -117,9 +106,9 @@ export class ScrollimgComponentsAddComponent implements OnInit {
|
||||
},
|
||||
beforeUpload: (file: any, _fileList: any) => {
|
||||
return new Observable((observer: Observer<boolean>) => {
|
||||
const isLt4M = file.size / 1024 / 1024 < 4;
|
||||
const isLt4M = file.size / 1024 / 1024 < 2;
|
||||
if (!isLt4M) {
|
||||
this.service.msgSrv.warning('图片大小超过4M!');
|
||||
this.service.msgSrv.warning('图片大小超过2M!');
|
||||
observer.complete();
|
||||
return;
|
||||
}
|
||||
@ -130,96 +119,43 @@ export class ScrollimgComponentsAddComponent implements OnInit {
|
||||
previewFile: (file: NzUploadFile) => of(file.url),
|
||||
},
|
||||
},
|
||||
takeEffectType: {
|
||||
type: 'string',
|
||||
title: '生效类型',
|
||||
ui: {
|
||||
showRequired: true,
|
||||
widget: 'custom',
|
||||
},
|
||||
default: 1
|
||||
},
|
||||
mainTitle: {
|
||||
type: 'string',
|
||||
title: '主标题',
|
||||
maxLength: 20,
|
||||
ui: {
|
||||
visibleIf: { style: [1, 2, 3, 4, 5] },
|
||||
placeholder: '请输入主标题,不超过20个字',
|
||||
change: (id: any) => {
|
||||
this.validFalg = !this.sf?.valid;
|
||||
}
|
||||
}
|
||||
},
|
||||
withTitle: {
|
||||
type: 'string',
|
||||
title: '副标题',
|
||||
maxLength: 20,
|
||||
ui: {
|
||||
visibleIf: { style: [1, 2, 3, 4, 5] },
|
||||
placeholder: '请输入主标题,不超过20个字',
|
||||
}
|
||||
},
|
||||
sortId: {
|
||||
type: 'string',
|
||||
title: '显示顺序',
|
||||
title: '顺序',
|
||||
ui: {
|
||||
showRequired: true,
|
||||
widget: 'select',
|
||||
widget: '=',
|
||||
placeholder: '请输入0~99,数字越大,排序越靠前',
|
||||
serverSearch: true,
|
||||
} as SFSelectWidgetSchema,
|
||||
},
|
||||
linkType: {
|
||||
type: 'string',
|
||||
title: '跳转路径',
|
||||
ui: {
|
||||
widget: 'radio',
|
||||
showRequired: true,
|
||||
} as SFRadioWidgetSchema,
|
||||
enum: [
|
||||
{ label: 1, value: '1' },
|
||||
{ label: 2, value: '2' },
|
||||
{ label: 3, value: '3' },
|
||||
{ label: 4, value: '4' },
|
||||
{ label: 5, value: '5' },
|
||||
{ label: 6, value: '6' },
|
||||
{ label: 7, value: '7' },
|
||||
{ label: 8, value: '8' },
|
||||
{ label: 9, value: '9' },
|
||||
{ label: 10, value: '10' },
|
||||
]
|
||||
{ label: '文章ID', value: 1 },
|
||||
{ label: '分类ID', value: 2 },
|
||||
{ label: '自编辑', value: 3 },
|
||||
],
|
||||
},
|
||||
cooperationHotline: {
|
||||
content: {
|
||||
type: 'string',
|
||||
title: '合作热线',
|
||||
maxLength: 13,
|
||||
title: '内容',
|
||||
ui: {
|
||||
showRequired: true,
|
||||
placeholder: '请输入电话号码',
|
||||
visibleIf: { style: [6] },
|
||||
validator: val => {
|
||||
const reg = /((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)/g;
|
||||
let isValid: any;
|
||||
isValid = reg.test(val);
|
||||
if (!isValid) {
|
||||
return [{ keyword: 'required', message: '格式不正确' }];
|
||||
}
|
||||
return [];
|
||||
widget: 'tinymce',
|
||||
loadingTip: 'loading...',
|
||||
config: {
|
||||
height: 450
|
||||
},
|
||||
visibleIf: { name5: (value: string) => value === '1' }
|
||||
},
|
||||
},
|
||||
},
|
||||
companyAddress: {
|
||||
type: 'string',
|
||||
title: '公司选址',
|
||||
ui: {
|
||||
widget: 'custom',
|
||||
showRequired: true,
|
||||
visibleIf: { style: [6] },
|
||||
},
|
||||
},
|
||||
advertisementContentDTOList: {
|
||||
type: 'string',
|
||||
title: '内容设置',
|
||||
ui: {
|
||||
widget: 'custom',
|
||||
showRequired: true,
|
||||
visibleIf: { style: [1, 2, 3, 4, 5] },
|
||||
},
|
||||
}
|
||||
},
|
||||
required: ['name', 'navigationId', 'style', 'takeEffectType', 'cooperationHotline', 'companyAddress', 'advertisementContentDTOList'],
|
||||
required: [],
|
||||
};
|
||||
if (this.queryParams.type === 'add'){
|
||||
setTimeout(() => {
|
||||
@ -302,8 +238,4 @@ export class ScrollimgComponentsAddComponent implements OnInit {
|
||||
handleCancel(): void {
|
||||
this.isVisible = false;
|
||||
}
|
||||
outputPointAddress(data: any){
|
||||
this.sf.setValue('/companyAddress', data.address);
|
||||
this.inputPoint = data.inputPoint;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
<!-- 页头 -->
|
||||
<page-header-wrapper [title]="''"></page-header-wrapper>
|
||||
<nz-card>
|
||||
<!-- 搜索表单 -->
|
||||
<div nz-row [nzGutter]="16">
|
||||
<!-- 查询字段小于或等于3个时,不显示伸缩按钮 -->
|
||||
<div nz-col nzSpan="24" *ngIf="queryFieldCount <= 4">
|
||||
<sf #sf [schema]="schema" [ui]="ui" [mode]="'search'" [disabled]="!sf?.valid" [loading]="false"></sf>
|
||||
</div>
|
||||
|
||||
<!-- 查询字段大于3个时,根据展开状态调整布局 -->
|
||||
<ng-container *ngIf="queryFieldCount > 4">
|
||||
<div nz-col [nzSpan]="_$expand ? 24 : 18">
|
||||
<sf #sf [schema]="schema" [ui]="ui" [button]="'none'"></sf>
|
||||
</div>
|
||||
<div nz-col [nzSpan]="_$expand ? 24 : 6" [class.text-right]="_$expand">
|
||||
<button nz-button nzType="primary" [disabled]="!sf.valid" [nzLoading]="false" (click)="st.load()">查询</button>
|
||||
<button nz-button (click)="resetSF()">重置</button>
|
||||
<button nz-button nzType="link" (click)="expandToggle()">
|
||||
{{ !_$expand ? '展开' : '收起' }}
|
||||
<i nz-icon [nzType]="!_$expand ? 'down' : 'up'"></i>
|
||||
</button>
|
||||
</div>
|
||||
</ng-container>
|
||||
</div>
|
||||
|
||||
<!-- 工具栏 -->
|
||||
<div nz-row>
|
||||
<div nz-col nzSpan="24">
|
||||
<button nz-button nzType="primary" (click)="add()">新增banner</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 提示栏 -->
|
||||
<div nz-row>
|
||||
<div nz-col nzSpan="24">
|
||||
<nz-alert
|
||||
nzType="info"
|
||||
[nzMessage]="'当前共' + (st?.total || 0) + '行记录,选中' + selectedRows.length + '行'"
|
||||
nzShowIcon
|
||||
[ngStyle]="{ margin: '1rem 0' }"
|
||||
>
|
||||
</nz-alert>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 数据列表 -->
|
||||
<st
|
||||
#st
|
||||
multiSort
|
||||
size="small"
|
||||
[bordered]="true"
|
||||
[scroll]="{ x: '2000px' }"
|
||||
[data]="service.$api_get_page"
|
||||
[columns]="columns"
|
||||
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
|
||||
[res]="{ reName: { list: 'data.records', total: 'data.total' } }"
|
||||
[page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
|
||||
[loadingDelay]="500"
|
||||
[loading]="service.http.loading"
|
||||
></st>
|
||||
</nz-card>
|
||||
@ -0,0 +1,24 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { BannerComponentsListComponent } from './list.component';
|
||||
|
||||
describe('BannerComponentsListComponent', () => {
|
||||
let component: BannerComponentsListComponent;
|
||||
let fixture: ComponentFixture<BannerComponentsListComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ BannerComponentsListComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(BannerComponentsListComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,237 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { STColumn, STComponent, STData } from '@delon/abc/st';
|
||||
import { SFComponent, SFSchema, SFSelectWidgetSchema, SFUISchema } from '@delon/form';
|
||||
import { ModalHelper } from '@delon/theme';
|
||||
import { NzMessageService } from 'ng-zorro-antd/message';
|
||||
import { NzModalService } from 'ng-zorro-antd/modal';
|
||||
import { BannerService } from '../../services/banner.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-banner-components-list',
|
||||
templateUrl: './list.component.html',
|
||||
styleUrls: ['./list.component.less']
|
||||
})
|
||||
|
||||
export class BannerComponentsListComponent implements OnInit {
|
||||
schema: SFSchema = {};
|
||||
columns: STColumn[] = [];
|
||||
ui: SFUISchema = {};
|
||||
appList: any[] = [];
|
||||
_$expand = false;
|
||||
selectApp = {
|
||||
appName: '',
|
||||
appId: ''
|
||||
};
|
||||
|
||||
@ViewChild('st', { static: false }) st!: STComponent;
|
||||
@ViewChild('sf', { static: false }) sf!: SFComponent;
|
||||
constructor(public service: BannerService, private modal: ModalHelper, private msg: NzMessageService, private router: Router, private modalSrv: NzModalService, private ar: ActivatedRoute) { }
|
||||
|
||||
/**
|
||||
* 查询字段个数
|
||||
*/
|
||||
get queryFieldCount(): number {
|
||||
return Object.keys(this.schema?.properties || {}).length;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询参数
|
||||
*/
|
||||
get reqParams() {
|
||||
const params = Object.assign({}, this.sf?.value || {});
|
||||
delete params._$expand;
|
||||
if (params.status === '') {
|
||||
delete params.status;
|
||||
}
|
||||
if (params.style === '') {
|
||||
delete params.style;
|
||||
}
|
||||
if (params.navigationId === '') {
|
||||
delete params.navigationId;
|
||||
}
|
||||
return { ...params};
|
||||
}
|
||||
|
||||
/**
|
||||
* 选中行
|
||||
*/
|
||||
get selectedRows() {
|
||||
return this.st?.list.filter((item) => item.checked) || [];
|
||||
}
|
||||
ngOnInit() {
|
||||
this.initSF();
|
||||
this.initST();
|
||||
}
|
||||
selectAppFun(item: any) {
|
||||
this.selectApp = item;
|
||||
this.st.load(1);
|
||||
}
|
||||
dataProcess(data: STData[]): STData[] {
|
||||
return data.map((i, index) => {
|
||||
i.showSortFlag = false;
|
||||
return i;
|
||||
});
|
||||
}
|
||||
initSF() {
|
||||
this.schema = {
|
||||
properties: {
|
||||
_$expand: {
|
||||
type: 'boolean',
|
||||
ui: {
|
||||
hidden: true,
|
||||
},
|
||||
},
|
||||
name: {
|
||||
type: 'string',
|
||||
title: 'banner名称',
|
||||
maxLength: 10,
|
||||
ui: {
|
||||
widget: '',
|
||||
placeholder: '请输入',
|
||||
}
|
||||
},
|
||||
status: {
|
||||
type: 'string',
|
||||
title: '状态',
|
||||
ui: {
|
||||
widget: 'select',
|
||||
placeholder: '请选择',
|
||||
allowClear: true,
|
||||
} as SFSelectWidgetSchema,
|
||||
enum: [
|
||||
{ label: '全部', value: 1 },
|
||||
{ label: '正常', value: 2 },
|
||||
{ label: '禁用', value: 3 }
|
||||
]
|
||||
},
|
||||
},
|
||||
};
|
||||
this.ui = {
|
||||
'*': {
|
||||
spanLabelFixed: 110,
|
||||
grid: { span: 8 },
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
initST() {
|
||||
this.columns = [
|
||||
{
|
||||
title: 'banner名称', // 位:px
|
||||
index: 'name',
|
||||
className: 'text-center'
|
||||
},
|
||||
{
|
||||
title: 'banner',
|
||||
index: 'navigationName',
|
||||
className: 'text-center'
|
||||
},
|
||||
{
|
||||
title: '排序', // 位 px
|
||||
index: 'sortId',
|
||||
className: 'text-center'
|
||||
},
|
||||
{
|
||||
title: '状态', // 位 px
|
||||
index: 'style',
|
||||
className: 'text-center',
|
||||
type: 'enum',
|
||||
enum: {
|
||||
1: '正常',
|
||||
2: '禁用',
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '最后修改时间', // 位 px
|
||||
index: 'createTime',
|
||||
className: 'text-center'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
fixed: 'right',
|
||||
className: 'text-center',
|
||||
width: 280,
|
||||
buttons: [
|
||||
{
|
||||
text: '修改',
|
||||
click: (item) => {
|
||||
this.router.navigate(['../detail'], { queryParams: { id: item.id, type: 'edit' }, relativeTo: this.ar });
|
||||
}
|
||||
},
|
||||
{
|
||||
text: '禁用',
|
||||
pop: {
|
||||
title: `确定禁用此banner图吗??`,
|
||||
okType: 'danger',
|
||||
icon: 'alert',
|
||||
},
|
||||
click: (item) => {
|
||||
this.changeStatus(item.id);
|
||||
},
|
||||
iif: (item) => item.status === 1
|
||||
},
|
||||
{
|
||||
text: '启用',
|
||||
pop: {
|
||||
title: `确定启用此banner图吗?`,
|
||||
okType: 'danger',
|
||||
icon: 'success',
|
||||
},
|
||||
click: (item) => {
|
||||
this.changeStatus(item);
|
||||
},
|
||||
iif: (item) => item.status === 2
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
}
|
||||
changeStatus(item: any) {
|
||||
const params = {
|
||||
status,
|
||||
idList: [item.id]
|
||||
};
|
||||
// this.service.request(this.service.$api_openOrClose, params).subscribe(res => {
|
||||
// if (res) {
|
||||
// this.st.reload();
|
||||
// }
|
||||
// });
|
||||
}
|
||||
/**
|
||||
* 伸缩查询条件
|
||||
*/
|
||||
expandToggle() {
|
||||
this._$expand = !this._$expand;
|
||||
this.sf?.setValue('/_$expand', this._$expand);
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置表单
|
||||
*/
|
||||
resetSF() {
|
||||
this.sf.reset();
|
||||
this._$expand = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增单个实例
|
||||
*/
|
||||
add() {
|
||||
this.router.navigate(['../banner/detail'], { queryParams: { id: 0, type: 'add' }, relativeTo: this.ar });
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除单个实例
|
||||
*/
|
||||
del(item: any) {
|
||||
const ids = [];
|
||||
ids.push(item.id);
|
||||
this.service.request(this.service.$api_del_many, ids).subscribe(res => {
|
||||
if (res) {
|
||||
this.service.msgSrv.success('删除成功');
|
||||
this.st.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
import { Injectable, Injector } from '@angular/core';
|
||||
import { BaseService } from '@shared';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class BannerService extends BaseService {
|
||||
|
||||
constructor(public injector: Injector) {
|
||||
super(injector);
|
||||
}
|
||||
}
|
||||
@ -38,10 +38,13 @@ import { AddPersonalPartnerComponent } from './partner-list/components/add-perso
|
||||
import { PartnerDetailComponent } from './partner-list/components/partner-detail/partner-detail.component';
|
||||
import { PartnerListComponent } from './partner-list/components/index/partner-list.component';
|
||||
import { ParterRebateManageMentAddComponent } from './rebate-management/components/rebate-setting/add/add.component';
|
||||
import { ScrollImgComponentsListComponent } from './ad/components/list/list.component';
|
||||
import { PartnerKnowledgeClassificationListComponent } from './knowledge/classification/components/list/list.component';
|
||||
import { ParterArticleManagementListComponent } from './article-management/components/list/list.component';
|
||||
import { ParterArticleManagementEditComponent } from './article-management/components/edit/edit.component';
|
||||
import { ScrollImgComponentsListComponent } from './scrollimg/components/list/list.component';
|
||||
import { BannerComponentsListComponent } from './knowledge/banner/components/list/list.component';
|
||||
import { ScrollimgComponentsAddComponent } from './scrollimg/components/add/add.component';
|
||||
import { BannerComponentsAddComponent } from './knowledge/banner/components/add/add.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
@ -122,6 +125,14 @@ const routes: Routes = [
|
||||
{ path: 'partner-detail', component: ParterClaimAuditListPartnerDetailComponent }
|
||||
]
|
||||
},
|
||||
{
|
||||
path: 'scroll-img',
|
||||
children: [
|
||||
{ path: '', component: ScrollImgComponentsListComponent },
|
||||
{ path: 'list', component: ScrollImgComponentsListComponent },
|
||||
{ path: 'detail', component: ScrollimgComponentsAddComponent },
|
||||
]
|
||||
},
|
||||
{
|
||||
path: 'recorded',
|
||||
children: [
|
||||
@ -133,9 +144,11 @@ const routes: Routes = [
|
||||
path: 'knowledge',
|
||||
children: [
|
||||
{ path: 'classification', component: PartnerKnowledgeClassificationListComponent },
|
||||
{ path: 'article-management-list', component: ParterArticleManagementListComponent},
|
||||
{ path: 'article-management-add', component: ParterArticleManagementEditComponent},
|
||||
{ path: 'article-management-edit', component: ParterArticleManagementEditComponent},
|
||||
{ path: 'article-management-list', component: ParterArticleManagementListComponent },
|
||||
{ path: 'article-management-add', component: ParterArticleManagementEditComponent },
|
||||
{ path: 'article-management-edit', component: ParterArticleManagementEditComponent },
|
||||
{ path: 'banner', component: BannerComponentsListComponent},
|
||||
{ path: 'banner/detail', component: BannerComponentsAddComponent },
|
||||
]
|
||||
},
|
||||
];
|
||||
|
||||
@ -50,12 +50,14 @@ import { ParterRebateManageMenAbnormalFeedbackComponent } from './rebate-managem
|
||||
import { PartnerRecordedDetailComponent } from './recorded/components/detail/detail.component';
|
||||
import { PartnerRecordedRecordComponent } from './recorded/components/record/record.component';
|
||||
import { ParterRebateManageMentAddComponent } from './rebate-management/components/rebate-setting/add/add.component';
|
||||
import { ScrollImgComponentsListComponent } from './ad/components/list/list.component';
|
||||
import { ScrollimgComponentsAddComponent } from './ad/components/add/add.component';
|
||||
import { ParterArticleManagementEditComponent } from './article-management/components/edit/edit.component';
|
||||
import { ParterArticleManagementListComponent } from './article-management/components/list/list.component';
|
||||
import { PartnerKnowledgeClassificationListComponent } from './knowledge/classification/components/list/list.component';
|
||||
import { PartnerEditComponent } from './knowledge/classification/components/edit/edit.component';
|
||||
import { ScrollimgComponentsAddComponent } from './scrollimg/components/add/add.component';
|
||||
import { ScrollImgComponentsListComponent } from './scrollimg/components/list/list.component';
|
||||
import { BannerComponentsListComponent } from './knowledge/banner/components/list/list.component';
|
||||
import { BannerComponentsAddComponent } from './knowledge/banner/components/add/add.component';
|
||||
|
||||
const COMPONENTS: any[] = [
|
||||
PartnerBusinessStatisticsIndexComponent,
|
||||
@ -101,7 +103,9 @@ const COMPONENTS: any[] = [
|
||||
ParterArticleManagementEditComponent,
|
||||
ParterArticleManagementListComponent,
|
||||
PartnerKnowledgeClassificationListComponent,
|
||||
PartnerEditComponent
|
||||
PartnerEditComponent,
|
||||
BannerComponentsListComponent,
|
||||
BannerComponentsAddComponent
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
|
||||
243
src/app/routes/partner/scrollimg/components/add/add.component.ts
Normal file
243
src/app/routes/partner/scrollimg/components/add/add.component.ts
Normal file
@ -0,0 +1,243 @@
|
||||
import { ChangeDetectorRef, Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { SFComponent, SFRadioWidgetSchema, SFSchema, SFSelectWidgetSchema, SFUISchema } from '@delon/form';
|
||||
import { _HttpClient } from '@delon/theme';
|
||||
import { EAEnvironmentService } from '@shared';
|
||||
import differenceInCalendarDays from 'date-fns/differenceInCalendarDays';
|
||||
import format from 'date-fns/format';
|
||||
import { NzMessageService } from 'ng-zorro-antd/message';
|
||||
import { NzUploadFile } from 'ng-zorro-antd/upload';
|
||||
import { Observable, Observer, of } from 'rxjs';
|
||||
import { apiConf } from '@conf/api.conf';
|
||||
import { ScrollImgService } from '../../services/scrollimg.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-ad-components-add',
|
||||
templateUrl: './add.component.html',
|
||||
styleUrls: ['./add.less']
|
||||
})
|
||||
export class ScrollimgComponentsAddComponent implements OnInit {
|
||||
@ViewChild('sf', { static: false }) sf!: SFComponent;
|
||||
record: any = {};
|
||||
i: any;
|
||||
schema: SFSchema = {};
|
||||
contentListData = [];
|
||||
queryParams: any = {};
|
||||
oldTakeEffectTime = '';
|
||||
maxSort = 0;
|
||||
isVisible = false;
|
||||
validFalg = true;
|
||||
detailData: any = {
|
||||
advertisementContentDTOList: []
|
||||
};
|
||||
changeTimeFlag = false;
|
||||
currentIndex = 0;
|
||||
addFlag = true;
|
||||
addId = 1;
|
||||
inputPoint: any = {
|
||||
lng: 0,
|
||||
lat: 0
|
||||
};
|
||||
today = new Date();
|
||||
navData: any = [];
|
||||
navigationName = '';
|
||||
ui: SFUISchema = {
|
||||
'*': {
|
||||
spanLabelFixed: 200,
|
||||
grid: { span: 24 },
|
||||
},
|
||||
};
|
||||
constructor(
|
||||
public msgSrv: NzMessageService,
|
||||
public http: _HttpClient,
|
||||
public service: ScrollImgService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private envSrv: EAEnvironmentService,
|
||||
) { }
|
||||
|
||||
|
||||
ngOnInit(): void {
|
||||
this.queryParams = this.route.snapshot.queryParams;
|
||||
if (this.queryParams.type !== 'add') {
|
||||
this.initDetailData();
|
||||
}
|
||||
this.initSF();
|
||||
}
|
||||
initDetailData() {
|
||||
|
||||
}
|
||||
initSF() {
|
||||
this.schema = {
|
||||
properties: {
|
||||
name: {
|
||||
type: 'string',
|
||||
title: '轮播图名称',
|
||||
maxLength: 10,
|
||||
ui: {
|
||||
showRequired: true,
|
||||
placeholder: '请不要超过10个字',
|
||||
}
|
||||
},
|
||||
licensePhotoWatermark: {
|
||||
type: 'string',
|
||||
title: '轮播图',
|
||||
ui: {
|
||||
action: apiConf.fileUpload,
|
||||
accept: 'image/png,image/jpeg,image/jpg,image/gif',
|
||||
limit: 1,
|
||||
limitFileCount: 1,
|
||||
resReName: 'data.fullFileWatermarkPath',
|
||||
urlReName: 'data.fullFileWatermarkPath',
|
||||
widget: 'upload',
|
||||
descriptionI18n: '图片支持JPG、PNG格式,文件小于2M(建议尺寸 702px * 280px)',
|
||||
data: {
|
||||
appId: this.envSrv.env.appId,
|
||||
},
|
||||
name: 'multipartFile',
|
||||
multiple: false,
|
||||
listType: 'picture-card',
|
||||
change: (args: any) => {
|
||||
if (args.type === 'success') {
|
||||
this.detailData.enterpriseBaseDTO.licensePhoto = args.file.response.data.fullFilePath
|
||||
}
|
||||
},
|
||||
beforeUpload: (file: any, _fileList: any) => {
|
||||
return new Observable((observer: Observer<boolean>) => {
|
||||
const isLt4M = file.size / 1024 / 1024 < 2;
|
||||
if (!isLt4M) {
|
||||
this.service.msgSrv.warning('图片大小超过2M!');
|
||||
observer.complete();
|
||||
return;
|
||||
}
|
||||
observer.next(isLt4M);
|
||||
observer.complete();
|
||||
});
|
||||
},
|
||||
previewFile: (file: NzUploadFile) => of(file.url),
|
||||
},
|
||||
},
|
||||
linkType: {
|
||||
type: 'string',
|
||||
title: '可见范围',
|
||||
ui: {
|
||||
widget: 'radio',
|
||||
showRequired: true,
|
||||
} as SFRadioWidgetSchema,
|
||||
enum: [
|
||||
{ label: '全部可见', value: 1 },
|
||||
{ label: '合伙人可见', value: 2 },
|
||||
{ label: '销售渠道可见', value: 3 },
|
||||
],
|
||||
},
|
||||
sortId: {
|
||||
type: 'string',
|
||||
title: '顺序',
|
||||
ui: {
|
||||
showRequired: true,
|
||||
widget: '=',
|
||||
placeholder: '请输入0~99,数字越大,排序越靠前',
|
||||
serverSearch: true,
|
||||
} as SFSelectWidgetSchema,
|
||||
},
|
||||
content: {
|
||||
type: 'string',
|
||||
title: '内容',
|
||||
ui: {
|
||||
widget: 'tinymce',
|
||||
loadingTip: 'loading...',
|
||||
config: {
|
||||
height: 450
|
||||
},
|
||||
visibleIf: { name5: (value: string) => value === '1' }
|
||||
},
|
||||
},
|
||||
},
|
||||
required: [],
|
||||
};
|
||||
if (this.queryParams.type === 'add') {
|
||||
setTimeout(() => {
|
||||
this.sf.setValue('/takeEffectType', 1);
|
||||
this.sf.setValue('/style', 1);
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
get reqParams() {
|
||||
return {};
|
||||
}
|
||||
disabledDate = (current: Date): boolean => {
|
||||
// Can not select days before today and today
|
||||
return differenceInCalendarDays(current, this.today) < 0;
|
||||
}
|
||||
changeTime() {
|
||||
this.changeTimeFlag = true;
|
||||
}
|
||||
|
||||
|
||||
checkSort() {
|
||||
const params: any = {
|
||||
navigationId: this.sf?.value.navigationId,
|
||||
sortId: this.sf?.value.sortId,
|
||||
takeEffectType: this.sf?.value.takeEffectType,
|
||||
};
|
||||
if (this.queryParams.id !== '0') {
|
||||
params.advertisementId = this.queryParams.id;
|
||||
}
|
||||
if (this.sf.value.takeEffectType === 2) {
|
||||
if (this.changeTimeFlag) {
|
||||
params.takeEffectTime = format(this.detailData.takeEffectTime, 'yyyy-MM-dd HH:mm');
|
||||
} else {
|
||||
params.takeEffectTime = this.detailData.takeEffectTime;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
save() {
|
||||
const params: any = {
|
||||
...this.sf?.value,
|
||||
latitude: this.inputPoint.lat,
|
||||
longitude: this.inputPoint.lng,
|
||||
id: this.queryParams.id
|
||||
};
|
||||
this.detailData.advertisementContentDTOList.forEach((item: any) => {
|
||||
delete item.addId;
|
||||
});
|
||||
if (this.queryParams.type === 'add') {
|
||||
delete params.id;
|
||||
}
|
||||
if (this.sf.value.takeEffectType === 2) {
|
||||
if (this.changeTimeFlag) {
|
||||
params.takeEffectTime = format(this.detailData.takeEffectTime, 'yyyy-MM-dd HH:mm');
|
||||
} else {
|
||||
params.takeEffectTime = this.detailData.takeEffectTime;
|
||||
}
|
||||
} else {
|
||||
delete params.takeEffectTime;
|
||||
}
|
||||
this.service.request(this.service.$api_add_one, params).subscribe(res => {
|
||||
if (res) {
|
||||
this.service.msgSrv.success('保存成功');
|
||||
this.router.navigate(['../list'], { relativeTo: this.route });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
goBack() {
|
||||
window.history.go(-1);
|
||||
}
|
||||
gotoMap() {
|
||||
this.isVisible = true;
|
||||
}
|
||||
|
||||
handleOk(): void {
|
||||
this.isVisible = false;
|
||||
}
|
||||
|
||||
handleCancel(): void {
|
||||
this.isVisible = false;
|
||||
}
|
||||
outputPointAddress(data: any) {
|
||||
this.sf.setValue('/companyAddress', data.address);
|
||||
this.inputPoint = data.inputPoint;
|
||||
}
|
||||
}
|
||||
119
src/app/routes/partner/scrollimg/components/add/add.less
Normal file
119
src/app/routes/partner/scrollimg/components/add/add.less
Normal file
@ -0,0 +1,119 @@
|
||||
:host {
|
||||
.styleBox {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
margin: 10px 0 0 0;
|
||||
}
|
||||
.imgBox {
|
||||
position: relative;
|
||||
width: 200px;
|
||||
padding: 6px 0;
|
||||
text-align: center;
|
||||
border: solid 1px #eee;
|
||||
.leftBox,
|
||||
.rightBox {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translate(0, -50%);
|
||||
}
|
||||
img {
|
||||
width: 170px;
|
||||
height: 40px;
|
||||
}
|
||||
.leftBox {
|
||||
left: 3px;
|
||||
}
|
||||
.rightBox {
|
||||
right: 3px;
|
||||
}
|
||||
}
|
||||
.imgBox_two {
|
||||
width: 200px;
|
||||
padding: 6px;
|
||||
text-align: center;
|
||||
border: solid 1px #eee;
|
||||
img {
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
}
|
||||
}
|
||||
.imgBox_three {
|
||||
width: 200px;
|
||||
padding: 6px 0;
|
||||
text-align: center;
|
||||
border: solid 1px #eee;
|
||||
img {
|
||||
width: 25%;
|
||||
height: 40px;
|
||||
margin: 0 6% 0 0;
|
||||
&:first-child {
|
||||
margin: 0 6%;
|
||||
}
|
||||
}
|
||||
}
|
||||
.imgBox_four {
|
||||
width: 200px;
|
||||
padding: 6px 0;
|
||||
text-align: center;
|
||||
border: solid 1px #eee;
|
||||
img {
|
||||
width: 22%;
|
||||
height: 40px;
|
||||
margin: 0 2% 0 0;
|
||||
&:first-child {
|
||||
margin: 0 2%;
|
||||
}
|
||||
}
|
||||
}
|
||||
.imgBox_one {
|
||||
width: 60px;
|
||||
padding: 6px;
|
||||
text-align: center;
|
||||
border: solid 1px #eee;
|
||||
img {
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
}
|
||||
}
|
||||
.imgBox_info {
|
||||
width: 200px;
|
||||
padding: 6px;
|
||||
overflow: hidden;
|
||||
border: solid 1px #eee;
|
||||
.title {
|
||||
width: 100%;
|
||||
line-height: 30px;
|
||||
text-align: center;
|
||||
}
|
||||
.infoBox {
|
||||
.name {
|
||||
line-height: 28px;
|
||||
}
|
||||
.map {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
img {
|
||||
width: 90%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.hint {
|
||||
margin: 0 0 0 10px;
|
||||
color: #f00;
|
||||
}
|
||||
.addBtn {
|
||||
margin: 0 0 10px 0;
|
||||
}
|
||||
}
|
||||
.overflowText {
|
||||
display: -webkit-box;
|
||||
max-width: 200px;
|
||||
overflow: hidden;
|
||||
text-align: left;
|
||||
text-overflow: -o-ellipsis-lastline;
|
||||
text-overflow: ellipsis;
|
||||
-webkit-line-clamp: 1;
|
||||
line-clamp: 1;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
@ -5,7 +5,7 @@
|
||||
<div nz-row [nzGutter]="16">
|
||||
<!-- 查询字段小于或等于3个时,不显示伸缩按钮 -->
|
||||
<div nz-col nzSpan="24" *ngIf="queryFieldCount <= 4">
|
||||
<sf #sf [schema]="schema" [ui]="ui" [mode]="'search'" [disabled]="!sf?.valid" [loading]="service.http.loading"></sf>
|
||||
<sf #sf [schema]="schema" [ui]="ui" [mode]="'search'" [disabled]="!sf?.valid" [loading]="false"></sf>
|
||||
</div>
|
||||
|
||||
<!-- 查询字段大于3个时,根据展开状态调整布局 -->
|
||||
@ -14,7 +14,7 @@
|
||||
<sf #sf [schema]="schema" [ui]="ui" [button]="'none'"></sf>
|
||||
</div>
|
||||
<div nz-col [nzSpan]="_$expand ? 24 : 6" [class.text-right]="_$expand">
|
||||
<button nz-button nzType="primary" [disabled]="!sf.valid" [nzLoading]="service.http.loading" (click)="st.load()">查询</button>
|
||||
<button nz-button nzType="primary" [disabled]="!sf.valid" [nzLoading]="false" (click)="st.load()">查询</button>
|
||||
<button nz-button (click)="resetSF()">重置</button>
|
||||
<button nz-button nzType="link" (click)="expandToggle()">
|
||||
{{ !_$expand ? '展开' : '收起' }}
|
||||
@ -0,0 +1 @@
|
||||
@import '~@delon/theme/index';
|
||||
@ -0,0 +1,9 @@
|
||||
.selectApp {
|
||||
display: flex;
|
||||
.appTitle {
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
.redfont{
|
||||
color: #f00;
|
||||
}
|
||||
@ -90,7 +90,54 @@ export class FreightComponentsListComponent implements OnInit {
|
||||
nzFooter: null
|
||||
});
|
||||
}
|
||||
|
||||
showService(record: any) {
|
||||
const modalRef = this.modal.create({
|
||||
nzTitle: '分配客服人员',
|
||||
//nzContent: PartnerEditComponent,
|
||||
nzWidth: 600,
|
||||
nzComponentParams: {
|
||||
i: record
|
||||
},
|
||||
nzFooter: null
|
||||
});
|
||||
modalRef.afterClose.subscribe((res: any) => {
|
||||
if (res) {
|
||||
this.st.load(1);
|
||||
}
|
||||
});
|
||||
}
|
||||
editPartner(record: any) {
|
||||
const modalRef = this.modal.create({
|
||||
nzTitle: '修改合伙人',
|
||||
//nzContent: PartnerEditComponent,
|
||||
nzWidth: 600,
|
||||
nzComponentParams: {
|
||||
i: record
|
||||
},
|
||||
nzFooter: null
|
||||
});
|
||||
modalRef.afterClose.subscribe((res: any) => {
|
||||
if (res) {
|
||||
this.st.load(1);
|
||||
}
|
||||
});
|
||||
}
|
||||
editSale(record: any) {
|
||||
const modalRef = this.modal.create({
|
||||
nzTitle: '修改渠道销售',
|
||||
//nzContent: PartnerEditComponent,
|
||||
nzWidth: 600,
|
||||
nzComponentParams: {
|
||||
i: record
|
||||
},
|
||||
nzFooter: null
|
||||
});
|
||||
modalRef.afterClose.subscribe((res: any) => {
|
||||
if (res) {
|
||||
this.st.load(1);
|
||||
}
|
||||
});
|
||||
}
|
||||
initSF() {
|
||||
this.schema = {
|
||||
properties: {
|
||||
@ -350,7 +397,7 @@ export class FreightComponentsListComponent implements OnInit {
|
||||
className: 'text-center',
|
||||
buttons: [
|
||||
{
|
||||
text: '查看<br/>',
|
||||
text: '查看',
|
||||
acl: { ability: ['USERCENTER-FREIGHT-LIST-view'] },
|
||||
click: item => {
|
||||
this.router.navigate(['./detail', item.id], { relativeTo: this.ar });
|
||||
@ -366,6 +413,21 @@ export class FreightComponentsListComponent implements OnInit {
|
||||
acl: { ability: ['USERCENTER-FREIGHT-LIST-balance'] },
|
||||
text: '资金账户',
|
||||
click: item => this.showAccountDetail(item)
|
||||
},
|
||||
{
|
||||
acl: { ability: ['USERCENTER-FREIGHT-LIST-balance'] },
|
||||
text: '分配客服人员',
|
||||
click: item => this.showService(item)
|
||||
},
|
||||
{
|
||||
acl: { ability: ['USERCENTER-FREIGHT-LIST-balance'] },
|
||||
text: '修改合伙人',
|
||||
click: item => this.editPartner(item)
|
||||
},
|
||||
{
|
||||
acl: { ability: ['USERCENTER-FREIGHT-LIST-balance'] },
|
||||
text: '修改渠道销售',
|
||||
click: item => this.editSale(item)
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -602,7 +602,11 @@
|
||||
"group": true,
|
||||
"children": [{
|
||||
"text": "banner管理",
|
||||
"link": "/knowledge/banner"
|
||||
"link": "/partner/knowledge/banner",
|
||||
"children": [{
|
||||
"text": "新增banner",
|
||||
"link": "/partner/knowledge/banner/detail"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"text": "文章管理",
|
||||
|
||||
Reference in New Issue
Block a user