pull/1/head
parent
11699c0bcb
commit
be5e129e4e
@ -0,0 +1 @@ |
||||
<p>brand works!</p> |
@ -0,0 +1,25 @@ |
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; |
||||
|
||||
import { BrandComponent } from './brand.component'; |
||||
|
||||
describe('BrandComponent', () => { |
||||
let component: BrandComponent; |
||||
let fixture: ComponentFixture<BrandComponent>; |
||||
|
||||
beforeEach(async(() => { |
||||
TestBed.configureTestingModule({ |
||||
declarations: [ BrandComponent ] |
||||
}) |
||||
.compileComponents(); |
||||
})); |
||||
|
||||
beforeEach(() => { |
||||
fixture = TestBed.createComponent(BrandComponent); |
||||
component = fixture.componentInstance; |
||||
fixture.detectChanges(); |
||||
}); |
||||
|
||||
it('should create', () => { |
||||
expect(component).toBeTruthy(); |
||||
}); |
||||
}); |
@ -0,0 +1,15 @@ |
||||
import { Component, OnInit } from '@angular/core'; |
||||
|
||||
@Component({ |
||||
selector: 'app-brand', |
||||
templateUrl: './brand.component.html', |
||||
styleUrls: ['./brand.component.scss'] |
||||
}) |
||||
export class BrandComponent implements OnInit { |
||||
|
||||
constructor() { } |
||||
|
||||
ngOnInit(): void { |
||||
} |
||||
|
||||
} |
@ -0,0 +1,16 @@ |
||||
import { NgModule } from '@angular/core'; |
||||
import { Routes, RouterModule } from '@angular/router'; |
||||
import {GoodsTypeComponent} from './goods-type/goods-type.component'; |
||||
import {BrandComponent} from './brand/brand.component'; |
||||
|
||||
|
||||
const routes: Routes = [ |
||||
{ path: 'goods-type', component: GoodsTypeComponent }, |
||||
{ path: 'brand', component: BrandComponent }, |
||||
]; |
||||
|
||||
@NgModule({ |
||||
imports: [RouterModule.forChild(routes)], |
||||
exports: [RouterModule] |
||||
}) |
||||
export class ConfigManageRoutingModule { } |
@ -0,0 +1,27 @@ |
||||
import { NgModule } from '@angular/core'; |
||||
import { CommonModule } from '@angular/common'; |
||||
|
||||
import { ConfigManageRoutingModule } from './config-manage-routing.module'; |
||||
import { GoodsTypeComponent } from './goods-type/goods-type.component'; |
||||
import { BrandComponent } from './brand/brand.component'; |
||||
import {NgZorroAntdModule} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; |
||||
import {SeparateModule} from '../../common/separate/separate.module'; |
||||
import {FormsModule, ReactiveFormsModule} from '_@angular_forms@9.0.7@@angular/forms'; |
||||
import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module'; |
||||
import {RegionSelectorModule} from '../../common/region-selector/region-selector.module'; |
||||
|
||||
|
||||
@NgModule({ |
||||
declarations: [GoodsTypeComponent, BrandComponent], |
||||
imports: [ |
||||
CommonModule, |
||||
ConfigManageRoutingModule, |
||||
NgZorroAntdModule, |
||||
SeparateModule, |
||||
ReactiveFormsModule, |
||||
FormsModule, |
||||
BreadcrumbModule, |
||||
RegionSelectorModule |
||||
] |
||||
}) |
||||
export class ConfigManageModule { } |
@ -0,0 +1,89 @@ |
||||
<!-- start 面包屑 --> |
||||
<app-breadcrumb></app-breadcrumb> |
||||
<!-- end 面包屑 --> |
||||
|
||||
<!--条件搜索--> |
||||
<div class="inner-content"> |
||||
<form nz-form [formGroup]="searchForm" (ngSubmit)="getRequest(true , searchForm.value)"> |
||||
<div nz-row> |
||||
<div nz-col nzSpan="6"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzSpan]="6">标题</nz-form-label> |
||||
<nz-form-control [nzSpan]="16"> |
||||
<input nz-input formControlName="title"/> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
</div> |
||||
|
||||
<div nz-row> |
||||
<div nz-col nzSpan="24" class="search-button"> |
||||
<button nz-button nzType="primary"><i nz-icon nzType="search" nzTheme="outline"></i>搜索</button> |
||||
<button nz-button nzType="default" (click)="resetForm()"><i nz-icon nzType="reload" nzTheme="outline"></i>重置</button> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
</div> |
||||
|
||||
|
||||
<div class="inner-content"> |
||||
<span>共计 {{total}} 条数据</span> |
||||
<div class="operating-button"> |
||||
<button nz-button nzType="primary" class="right-btn" (click)="getEdit()" ><i nz-icon nzType="plus" nzTheme="outline"></i>添加</button> |
||||
</div> |
||||
<nz-table |
||||
class="table" |
||||
#ajaxTable |
||||
nzShowSizeChanger |
||||
[nzFrontPagination]="false" |
||||
[nzData]="requestData" |
||||
[nzLoading]="loading" |
||||
[nzTotal]="total" |
||||
[(nzPageIndex)]="pageNum" |
||||
[(nzPageSize)]="pageSize" |
||||
[nzScroll]="{ x: '1200px' }" |
||||
(nzPageIndexChange)="getRequest(false , searchForm.value)" |
||||
(nzPageSizeChange)="getRequest(false , searchForm.value)"> |
||||
<thead nzSingleSort> |
||||
<tr> |
||||
<th nzWidth="50px">编号</th> |
||||
<th nzWidth="80px">标题</th> |
||||
<th nzWidth="80px">图片</th> |
||||
<th nzWidth="100px">创建时间</th> |
||||
<th nzWidth="100px">更新时间</th> |
||||
<th nzWidth="80px" nzRight="0px">操作</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of ajaxTable.data; let i = index"> |
||||
<td>{{i+1}}</td> |
||||
<td>{{data.titile}}</td> |
||||
<td> |
||||
<img class="head_img" src="{{WEB_SERVE_URL + data.img}}" onerror="this.src='../../../../assets/admin/navigation/icon.png'" alt=""> |
||||
</td> |
||||
<td>{{data.createdTime | date: 'yyyy-MM-dd HH:mm'}}</td> |
||||
<td>{{data.updatedTime | date: 'yyyy-MM-dd HH:mm'}}</td> |
||||
<td nzRight="0px" class="table-td-operation"> |
||||
<a (click)="getEdit(data.id)">编辑</a> |
||||
<nz-divider nzType="vertical"></nz-divider> |
||||
</td> |
||||
</tbody> |
||||
</nz-table> |
||||
</div> |
||||
|
||||
<nz-modal [(nzVisible)]="isVisible" nzTitle="编辑" (nzOnCancel)="handleCancel()" (nzOnOk)="handleOk()"> |
||||
<form nz-form [formGroup]="validateForm"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzSpan]="4" nzRequired>标题</nz-form-label> |
||||
<nz-form-control [nzSpan]="20" nzErrorTip="请输入标题!"> |
||||
<input nz-input placeholder="请输入标题..." [formControlName]="'title'" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
<nz-form-item> |
||||
<nz-form-label [nzSpan]="4" nzRequired>图片</nz-form-label> |
||||
<nz-form-control [nzSpan]="20" nzErrorTip="请输入标题!"> |
||||
<input nz-input placeholder="请输入标题..." [formControlName]="'title'" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</form> |
||||
</nz-modal> |
@ -0,0 +1,4 @@ |
||||
.head_img { |
||||
height: 60px; |
||||
width: 60px; |
||||
} |
@ -0,0 +1,102 @@ |
||||
import { Component, OnInit } from '@angular/core'; |
||||
import {environment} from '../../../../environments/environment'; |
||||
import {FormBuilder, FormGroup, Validators} from '_@angular_forms@9.0.7@@angular/forms'; |
||||
import {IconService} from '../../../services/icon.service'; |
||||
import {NzMessageService} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; |
||||
import {Router} from '_@angular_router@9.0.7@@angular/router'; |
||||
import {ConfigService} from '../../../services/config.service'; |
||||
|
||||
@Component({ |
||||
selector: 'app-goods-type', |
||||
templateUrl: './goods-type.component.html', |
||||
styleUrls: ['./goods-type.component.scss'] |
||||
}) |
||||
export class GoodsTypeComponent implements OnInit { |
||||
|
||||
WEB_SERVE_URL = environment.imageUrl; |
||||
searchForm: FormGroup; // 搜索框
|
||||
requestData = []; // 列表数据
|
||||
total: number; // 页码
|
||||
pageNum = 1; // 页码
|
||||
pageSize = 10; // 条码
|
||||
loading = true; |
||||
isVisible = false; |
||||
id; |
||||
validateForm!: FormGroup; |
||||
|
||||
constructor( |
||||
private form: FormBuilder, |
||||
private config: ConfigService, |
||||
private iconService: IconService, |
||||
private message: NzMessageService, |
||||
private router: Router, |
||||
private fb: FormBuilder, |
||||
) { |
||||
} |
||||
|
||||
ngOnInit(): void { |
||||
this.init(); |
||||
} |
||||
|
||||
public init(): void { |
||||
this.searchForm = this.form.group({ |
||||
title: [null], |
||||
}); |
||||
this.validateForm = this.fb.group({ |
||||
title: [null, [Validators.required]], |
||||
img: [null, [Validators.required]], |
||||
}); |
||||
this.getRequest(true, this.searchForm.value); |
||||
} |
||||
|
||||
// 查询列表
|
||||
public getRequest(reset: boolean = false, whereObject: object) { |
||||
|
||||
this.loading = false; |
||||
if (reset) { |
||||
this.pageNum = 1; |
||||
} |
||||
whereObject['pageNum'] = this.pageNum; |
||||
whereObject['pageSize'] = this.pageSize; |
||||
this.config.getListGoodsType(whereObject, data => { |
||||
if (data['return_code'] === '000000') { |
||||
this.requestData = data['return_data'].list; |
||||
this.total = data['return_data'].total; |
||||
} else { |
||||
this.message.error(data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
// 重置
|
||||
public resetForm(): void { |
||||
this.searchForm.reset(); |
||||
} |
||||
|
||||
|
||||
|
||||
// 修改
|
||||
public getEdit(id?: number): void { |
||||
this.id = id; |
||||
this.isVisible = true; |
||||
} |
||||
|
||||
// 查看详情
|
||||
public getDetail(id: number): void { |
||||
this.router.navigate(['/admin/company/company-detail'], { |
||||
queryParams: { |
||||
companyId: id |
||||
} |
||||
}).then(r => console.log(r)); |
||||
} |
||||
|
||||
handleOk(): void { |
||||
this.isVisible = false; |
||||
} |
||||
|
||||
handleCancel(): void { |
||||
this.isVisible = false; |
||||
} |
||||
|
||||
} |
||||
|
@ -0,0 +1,79 @@ |
||||
import { Injectable } from '@angular/core'; |
||||
import {HttpClient} from '_@angular_common@9.0.7@@angular/common/http'; |
||||
import {CommonsService} from './commons.service'; |
||||
import {environment} from '../../environments/environment'; |
||||
|
||||
@Injectable({ |
||||
providedIn: 'root' |
||||
}) |
||||
export class ConfigService { |
||||
constructor( |
||||
private http: HttpClient, |
||||
private common: CommonsService |
||||
) { } |
||||
|
||||
/** |
||||
* 查询公司列表 |
||||
* |
||||
* @param paramsObject 对象 |
||||
* @param callBack 回调 |
||||
*/ |
||||
public getListGoodsType(paramsObject: object, callBack) { |
||||
this.http.get(environment.baseUrl + 'highGoodsType/getListGoodsType?' + this.common.getWhereCondition(paramsObject)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 新增 |
||||
* |
||||
* @param params 上传对象 |
||||
* @param callBack 回调 |
||||
* @return data 返回结果 |
||||
*/ |
||||
public addCompanyAndUser(params: object, callBack) { |
||||
this.http.post(environment.baseUrl + 'bsCompany/addCompanyAndUser', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 修改卡券 |
||||
* |
||||
* @param params 上传对象 |
||||
* @param callBack 回调 |
||||
* @return data 返回结果 |
||||
*/ |
||||
public updateCompany(params: object, callBack) { |
||||
this.http.post(environment.baseUrl + 'bsCompany/updateCompany', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 根据id查询详情 |
||||
* |
||||
* @param companyId 公司id |
||||
* @param callBack 回调 |
||||
*/ |
||||
public companyView(companyId: number, callBack) { |
||||
this.http.get(environment.baseUrl + 'bsCompany/companyView?companyId=' + companyId).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 修改公司状态 |
||||
* |
||||
* @param id 用户id |
||||
* @param status status |
||||
* @param callBack 返回参数 |
||||
*/ |
||||
public editStatus(id: number, status: number , callBack) { |
||||
this.http.get(environment.baseUrl + 'bsCompany/editStatus?companyId=' + id + '&status=' + status).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue