118 lines
3.3 KiB
TypeScript
118 lines
3.3 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;
|
|
freightType: any = {
|
|
1: '元/吨',
|
|
2: '元/方',
|
|
3: '元/车'
|
|
} // 运单类型
|
|
constructor(
|
|
private modal: NzModalRef,
|
|
private msgSrv: NzMessageService,
|
|
public service: SupplyManagementService
|
|
) { }
|
|
|
|
get reqParams() {
|
|
return {
|
|
operateObject: this.record?.resourceCode,
|
|
operateType: 7,
|
|
};
|
|
}
|
|
ngOnInit(): void {
|
|
this.initSF();
|
|
this.initSt();
|
|
console.log(this.record)
|
|
if (this.record?.id) this.getGoodsResourceShipperDeatail(this.record?.id);
|
|
}
|
|
|
|
initSF() {
|
|
this.schema = {
|
|
properties: {
|
|
resourceCode: {
|
|
type: 'string',
|
|
title: '货源编号',
|
|
ui: {
|
|
widget: 'text'
|
|
},
|
|
},
|
|
freightPrice: {
|
|
type: 'string',
|
|
title: '运费单价',
|
|
ui: {
|
|
widget: 'custom'
|
|
}
|
|
},
|
|
rule: {
|
|
type: 'string',
|
|
title: '取整规则',
|
|
default: '0',
|
|
ui: {
|
|
widget: 'dict-select',
|
|
params: { dictKey: 'goodresource:rounding:rules' },
|
|
optionalHelp: {
|
|
text: '例如:付司机运费= 重量*单价 = 999.99;\n 保留小数:即 999.99; \n 抹除小数:即 999.00;\n 抹除个位,即 990.00',
|
|
}
|
|
}
|
|
},
|
|
|
|
},
|
|
required: ['freightPrice', 'rule',],
|
|
};
|
|
this.ui = {
|
|
'*': {
|
|
spanLabelFixed: 100,
|
|
grid: { span: 16 },
|
|
},
|
|
};
|
|
}
|
|
|
|
getGoodsResourceShipperDeatail(id: any) {
|
|
this.service.request(this.service.$api_get_goods_resource_shipper, { id }).subscribe(res => {
|
|
if (res) {
|
|
this.i = res;
|
|
}
|
|
})
|
|
}
|
|
/**
|
|
* 初始化数据列表
|
|
*/
|
|
initSt() {
|
|
this.columns = [
|
|
{ title: '日志内容', width: 120, index: 'operationContent', className: 'text-center' },
|
|
{ title: '更新时间', index: 'operatorTimestamp', width: 100, className: 'text-center' },
|
|
{ title: '操作人', width: 100, render: 'operator', className: 'text-center' },
|
|
];
|
|
}
|
|
save(value: any): void {
|
|
console.log(value);
|
|
// const { id: resourceId, freightType, freightPrice, resourceCode, rule, goodsID: id } = value;
|
|
const { resourceId, freightType, freightPrice, resourceCode, rule, id } = value;
|
|
this.service.request(this.service.$api_update_price, { id, freightType, freightPrice, resourceCode, rule, resourceId }).subscribe(res => {
|
|
if (res) {
|
|
this.msgSrv.success('保存成功');
|
|
this.modal.close(true);
|
|
}
|
|
});
|
|
}
|
|
|
|
close(): void {
|
|
this.modal.destroy();
|
|
}
|
|
}
|