This commit is contained in:
Taric Xin
2022-04-24 15:28:35 +08:00
parent d8e297a648
commit 77744a68b5
3 changed files with 46 additions and 5 deletions

View File

@ -172,9 +172,15 @@ export class InvoiceDetailComponent implements OnInit {
title: '所属项目',
ui: {
widget: 'select',
placeholder: '请选择',
serverSearch: true,
searchDebounceTime: 300,
searchLoadingText: '搜索中...',
allowClear: true,
asyncData: () => this.service.getEnterpriseProject({ id: this.ltdId })
onSearch: (q: any) => this.service.getProjectList({ projectName: q, enterpriseId: this.headerInfo?.shipperId })
// widget: 'select',
// placeholder: '请选择',
// allowClear: true,
// asyncData: () => this.service.getEnterpriseProject({ id: this.ltdId })
},
default: ''
}

View File

@ -284,10 +284,14 @@ export class InvoiceRequestedDetailComponent implements OnInit {
default: '',
ui: {
widget: 'select',
serverSearch: true,
searchDebounceTime: 300,
searchLoadingText: '搜索中...',
allowClear: true,
onSearch: (q: any) => this.service.getProjectList({ projectName: q, enterpriseId: this.headerInfo?.shipperId }),
visibleIf: {
expand: (value: boolean) => value
},
asyncData: () => this.service.getEnterpriseProject()
}
}
}
}

View File

@ -26,6 +26,8 @@ export class ShipperBaseService extends BaseService {
// 获取货主企业列表
public $api_enterpriceList = '/api/mdc/cuc/enterpriseInfo/operate/enterpriceList';
// 批量获取项目信息
public $api_get_project_list = '/api/mdc/cuc/enterpriseProject/getProjectList';
constructor(public injector: Injector) {
super(injector);
}
@ -247,6 +249,35 @@ export class ShipperBaseService extends BaseService {
}
}
/**
* 批量获取项目信息
* @returns
*/
getProjectList(params = { projectName: '', enterpriseId: '' }, containerAll = false) {
let str = params.projectName.replace(/^\s+|\s+$/g, '');
if (str) {
return this.request(this.$api_get_project_list, params)
.pipe(
map((res: any) => {
if (!res) {
return [];
}
const list = res.map((item: any) => {
return { label: item.projectName, value: item.id };
});
const obj = [];
if (containerAll) {
obj.push({ label: '全部', value: '' });
}
return [...obj, ...list];
})
)
.toPromise();
} else {
return of([]);
}
}
/**
* 获取结算客户
* @returns