Files
bbq/src/app/routes/supply-management/components/update-price/update-price.component.ts
wangshiming db95de90fb 货源修改
2021-12-03 15:22:55 +08:00

100 lines
2.7 KiB
TypeScript

import { Component, OnInit, ViewChild } from '@angular/core';
import { STColumn } from '@delon/abc/st';
import { SFComponent, SFSchema, SFUISchema } from '@delon/form';
import { _HttpClient } from '@delon/theme';
import { NzMessageService } from 'ng-zorro-antd/message';
import { NzModalRef } from 'ng-zorro-antd/modal';
import { SupplyManagementService } from '../../services/supply-management.service';
@Component({
selector: 'app-supply-management-update-price',
templateUrl: './update-price.component.html',
})
export class SupplyManagementUpdatePriceComponent implements OnInit {
record: any = {};
i: any;
schema: SFSchema = {};
ui: SFUISchema = {};
columns: STColumn[] = [];
@ViewChild('sf', { static: false }) sf!: SFComponent;
constructor(
private modal: NzModalRef,
private msgSrv: NzMessageService,
public service: SupplyManagementService
) { }
ngOnInit(): void {
this.initSF();
this.initSt();
if (this.record.id > 0)
this.service.request(`/user/${this.record.id}`).subscribe(res => (this.i = res));
}
initSF() {
this.schema = {
properties: {
no1: {
type: 'string',
title: '货源编号',
ui: {
widget: 'text'
},
default: 0
},
description3: {
type: 'string',
title: '运费单价',
ui: {
widget: 'custom'
}
},
description1: {
type: 'string',
title: '取整规则',
enum: [
{ label: '保留小数', value: 0 },
{ label: '抹除小数', value: 1 },
{ label: '抹除个位', value: 2 },
],
default: 0,
ui: {
widget: 'select',
optionalHelp: {
text: '例如:付司机运费 = 重量*单价 = 999.99; 保留小数:即 999.99; 抹除小数:即 999.00; 抹除个位,即 990.00',
}
}
},
},
required: ['owner', 'callNo', 'description1', 'description3'],
};
this.ui = {
'*': {
spanLabelFixed: 100,
grid: { span: 16 },
},
};
}
/**
* 初始化数据列表
*/
initSt() {
this.columns = [
{ title: '日志内容', width: 120, index: 'owner', className: 'text-center' },
{ title: '更新时间', index: 'goodsQuantity', width: 100, className: 'text-center' },
{ title: '操作人', width: 100, render: 'operator', className: 'text-center' },
];
}
save(value: any): void {
this.service.request(`/user/${this.record.id}`, value).subscribe(res => {
this.msgSrv.success('保存成功');
this.modal.close(true);
});
}
close(): void {
this.modal.destroy();
}
}