|
|
@ -1,4 +1,4 @@ |
|
|
|
import { Component, OnInit } from '@angular/core'; |
|
|
|
import {Component, OnInit} from '@angular/core'; |
|
|
|
import {environment} from '../../../../environments/environment'; |
|
|
|
import {environment} from '../../../../environments/environment'; |
|
|
|
import {FormBuilder, FormGroup, Validators} from '_@angular_forms@9.0.7@@angular/forms'; |
|
|
|
import {FormBuilder, FormGroup, Validators} from '_@angular_forms@9.0.7@@angular/forms'; |
|
|
|
import {IconService} from '../../../services/icon.service'; |
|
|
|
import {IconService} from '../../../services/icon.service'; |
|
|
@ -21,8 +21,8 @@ function getBase64(file: File): Promise<string | ArrayBuffer | null> { |
|
|
|
styleUrls: ['./brand.component.scss'] |
|
|
|
styleUrls: ['./brand.component.scss'] |
|
|
|
}) |
|
|
|
}) |
|
|
|
export class BrandComponent implements OnInit { |
|
|
|
export class BrandComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
|
|
WEB_SERVE_URL = environment.baseUrl; |
|
|
|
WEB_SERVE_URL = environment.baseUrl; |
|
|
|
|
|
|
|
imageUrl = environment.imageUrl; |
|
|
|
searchForm: FormGroup; // 搜索框
|
|
|
|
searchForm: FormGroup; // 搜索框
|
|
|
|
requestData = []; // 列表数据
|
|
|
|
requestData = []; // 列表数据
|
|
|
|
total: number; // 页码
|
|
|
|
total: number; // 页码
|
|
|
@ -38,6 +38,7 @@ export class BrandComponent implements OnInit { |
|
|
|
previewVisible = false; |
|
|
|
previewVisible = false; |
|
|
|
|
|
|
|
|
|
|
|
goodTypData; |
|
|
|
goodTypData; |
|
|
|
|
|
|
|
|
|
|
|
constructor( |
|
|
|
constructor( |
|
|
|
private form: FormBuilder, |
|
|
|
private form: FormBuilder, |
|
|
|
private config: ConfigService, |
|
|
|
private config: ConfigService, |
|
|
@ -65,9 +66,9 @@ export class BrandComponent implements OnInit { |
|
|
|
this.getRequest(true, this.searchForm.value); |
|
|
|
this.getRequest(true, this.searchForm.value); |
|
|
|
|
|
|
|
|
|
|
|
this.config.getListGoodsType({ |
|
|
|
this.config.getListGoodsType({ |
|
|
|
pageNum: 1 , |
|
|
|
pageNum: 1, |
|
|
|
pageSize: 1000000 , |
|
|
|
pageSize: 1000000, |
|
|
|
} , data => { |
|
|
|
}, data => { |
|
|
|
this.goodTypData = data['return_data']['list']; |
|
|
|
this.goodTypData = data['return_data']['list']; |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
@ -107,7 +108,6 @@ export class BrandComponent implements OnInit { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 修改
|
|
|
|
// 修改
|
|
|
|
public getEdit(id?: number): void { |
|
|
|
public getEdit(id?: number): void { |
|
|
|
this.validateForm.reset(); |
|
|
|
this.validateForm.reset(); |
|
|
@ -116,7 +116,7 @@ export class BrandComponent implements OnInit { |
|
|
|
this.id = id; |
|
|
|
this.id = id; |
|
|
|
if (id != null) { |
|
|
|
if (id != null) { |
|
|
|
this.editFlag = true; |
|
|
|
this.editFlag = true; |
|
|
|
this.config.findById(id , data => { |
|
|
|
this.config.findById(id, data => { |
|
|
|
data['return_data'].goodTypeId = String(data['return_data'].goodTypeId); |
|
|
|
data['return_data'].goodTypeId = String(data['return_data'].goodTypeId); |
|
|
|
if (data['return_data']['img'] != null && data['return_data']['img'] !== '') { |
|
|
|
if (data['return_data']['img'] != null && data['return_data']['img'] !== '') { |
|
|
|
const img = String(data['return_data']['img']); |
|
|
|
const img = String(data['return_data']['img']); |
|
|
@ -167,18 +167,19 @@ export class BrandComponent implements OnInit { |
|
|
|
this.validateForm.value.id = this.id; |
|
|
|
this.validateForm.value.id = this.id; |
|
|
|
this.config.updateBrand(this.validateForm.value, data => { |
|
|
|
this.config.updateBrand(this.validateForm.value, data => { |
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
this.message.success('修改成功'); |
|
|
|
|
|
|
|
this.isVisible = false; |
|
|
|
this.isVisible = false; |
|
|
|
|
|
|
|
this.message.success('修改成功'); |
|
|
|
this.getRequest(true, this.searchForm.value); |
|
|
|
this.getRequest(true, this.searchForm.value); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.message.create('error', data['return_msg']); |
|
|
|
this.message.create('error', data['return_msg']); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
console.log('123'); |
|
|
|
this.config.insertBrand(this.validateForm.value, data => { |
|
|
|
this.config.insertBrand(this.validateForm.value, data => { |
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
this.message.success('添加成功'); |
|
|
|
|
|
|
|
this.isVisible = false; |
|
|
|
this.isVisible = false; |
|
|
|
|
|
|
|
this.message.success('添加成功'); |
|
|
|
this.getRequest(true, this.searchForm.value); |
|
|
|
this.getRequest(true, this.searchForm.value); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.message.create('error', data['return_msg']); |
|
|
|
this.message.create('error', data['return_msg']); |
|
|
|