This commit is contained in:
wangshiming
2021-12-13 09:31:22 +08:00
parent 7d7f32aa8d
commit 7da8395f88
9 changed files with 148 additions and 87 deletions

View File

@ -1,11 +1,4 @@
/*
* @Author: your name
* @Date: 2021-12-03 11:10:14
* @LastEditTime: 2021-12-07 19:50:40
* @LastEditors: your name
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: \tms-obc-web\src\app\routes\supply-management\components\update-price\update-price.component.ts
*/
import { Params } from '@angular/router';
import { Component, OnInit, ViewChild } from '@angular/core';
import { STColumn } from '@delon/abc/st';
import { SFComponent, SFSchema, SFUISchema } from '@delon/form';
@ -21,60 +14,71 @@ import { SupplyManagementService } from '../../services/supply-management.servic
export class SupplyManagementUpdatePriceComponent implements OnInit {
record: any = {};
i: any;
ii: 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
) { }
ngOnInit(): void {
this.initSF();
this.initSt();
if (this.record.id > 0)
this.service.request(`/user/${this.record.id}`).subscribe(res => (this.i = res));
console.log(this.i)
const Params = {
id: this.i.id
}
this.service.request(this.service.$api_get_listModifyPrice, Params).subscribe((res) =>{
console.log(res)
this.ii = res[0];
})
}
initSF() {
this.schema = {
properties: {
no1: {
resourceCode: {
type: 'string',
title: '货源编号',
ui: {
widget: 'text'
},
default: 0
},
description3: {
freightPrice: {
type: 'string',
title: '运费单价',
ui: {
widget: 'custom'
}
},
description1: {
rule: {
type: 'string',
title: '取整规则',
enum: [
{ label: '保留小数', value: 0 },
{ label: '抹除小数', value: 1 },
{ label: '抹除个位', value: 2 },
{ label: '保留小数', value: '1' },
{ label: '抹除小数', value: '2' },
{ label: '抹除个位', value: '3' },
],
default: 0,
ui: {
widget: 'select',
optionalHelp: {
text: '例如:付司机运费 = 重量*单价 = 999.99; 保留小数:即 999.99; 抹除小数:即 999.00; 抹除个位,即 990.00',
text: '例如:付司机运费= 重量*单价 = 999.99;\n 保留小数:即 999.99; \n 抹除小数:即 999.00;\n 抹除个位,即 990.00',
}
}
},
},
required: ['owner', 'callNo', 'description1', 'description3'],
required: ['freightPrice', 'rule',],
};
this.ui = {
'*': {
@ -95,9 +99,13 @@ export class SupplyManagementUpdatePriceComponent implements OnInit {
];
}
save(value: any): void {
this.service.request(`/user/${this.record.id}`, value).subscribe(res => {
this.msgSrv.success('保存成功');
this.modal.close(true);
console.log(value)
const { id, freightType, freightPrice, resourceCode, rule, resourceId } = 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);
}
});
}