货源修改

This commit is contained in:
wangshiming
2021-12-03 15:22:55 +08:00
parent a9ef21e333
commit db95de90fb
42 changed files with 2466 additions and 7 deletions

View File

@ -0,0 +1,111 @@
<!--
* @Author: your name
* @Date: 2021-12-03 11:10:14
* @LastEditTime: 2021-12-03 14:52:01
* @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: \tms-obc-web\src\app\routes\supply-management\components\bulk\bulk.component.html
-->
<nz-card>
<!-- 搜索表单 -->
<div nz-row nzGutter="8">
<!-- 查询字段小于或等于3个时不显示伸缩按钮 -->
<div nz-col nzSpan="24" *ngIf="queryFieldCount <= 4">
<sf #sf [schema]="schema" [ui]="ui" [mode]="'search'" [disabled]="!sf?.valid" [loading]="service.http.loading"
(formSubmit)="st?.load(1)" (formReset)="resetSF()"></sf>
</div>
<!-- 查询字段大于3个时根据展开状态调整布局 -->
<ng-container *ngIf="queryFieldCount > 4">
<div nz-col [nzSpan]="_$expand ? 24 : 18">
<sf #sf [schema]="schema" [ui]="ui" [compact]="true" [button]="'none'"></sf>
</div>
<div nz-col [nzSpan]="_$expand ? 24 : 6" [class.text-right]="_$expand">
<button nz-button nzType="primary" [disabled]="!sf.valid" [nzLoading]="service.http.loading"
(click)="st?.load(1)">查询</button>
<button nz-button nzType="primary"
>导入</button>
<button nz-button (click)="resetSF()">重置</button>
<button nz-button nzType="link" (click)="expandToggle()">
{{ !_$expand ? '展开' : '收起' }}
<i nz-icon [nzType]="!_$expand ? 'down' : 'up'"></i>
</button>
</div>
</ng-container>
</div>
</nz-card>
<nz-card>
<nz-tabset (nzSelectedIndexChange)="selectChange($event)" [nzTabBarExtraContent]="extraTemplate">
<nz-tab *ngFor="let tab of tabs; let i = index" [nzTitle]="tab.name + ' (' + tab.count + ') '" (nzClick)="tabChange(i)">
</nz-tab>
</nz-tabset>
<div style="position: relative">
<nz-alert
nzType="info"
[nzMessage]="'当前共' + st?.total + '行记录已选择' + selectedRows.length + ''"
nzShowIcon
[ngStyle]="{ margin: '0 0 1rem 0' }"
>
</nz-alert>
</div>
<div style="margin-top: 15px;">
<st #st [data]="url" [columns]="columns">
<ng-template st-row="goodsId" let-item let-index="index">
<a [routerLink]="'/supply-management/bulk-detail/'+item.id">{{item.no}}</a>
</ng-template>
<ng-template st-row="orderSn" let-item let-index="index">
<div>待发车 (<span [ngStyle]="{ color:index>0?'#1890FF':''}">0</span>)</div>
<div>运输中 (<span [ngStyle]="{ color:index>0?'#1890FF':''}">0</span>)</div>
<div>待签收 (<span [ngStyle]="{ color:index>0?'#1890FF':''}">0</span>)</div>
<div>已完成 (<span [ngStyle]="{ color:index>0?'#1890FF':''}">0</span>)</div>
<div>已取消 (<span [ngStyle]="{ color:index>0?'#1890FF':''}">0</span>)</div>
</ng-template>
<ng-template st-row="goodsInfo" let-item let-index="index">
<div>{{item.owner}}</div>
<div>货源:{{item.progress}} 顿 / {{item.progress}} 方</div>
<div class="error">剩余: {{item.progress}} 顿 / {{item.progress}} 方</div>
</ng-template>
<ng-template st-row="demand" let-item let-index="index">
<div>车型: {{item.progress}}</div>
<div class="error">车长: {{item.progress}} 米</div>
</ng-template>
<ng-template st-row="price" let-item let-index="index">
<div>{{item.progress}} 元/顿</div>
</ng-template>
<ng-template st-row="cMember" let-item let-index="index">
<div>{{item.owner}}</div>
<div>{{item.mobile}}</div>
</ng-template>
<ng-template st-row="dispatcher" let-item let-index="index">
<div>{{item.owner}}</div>
<div>{{item.mobile}}</div>
</ng-template>
</st>
</div>
</nz-card>
<nz-modal [(nzVisible)]="isVisible" [nzFooter]="nzModalFooter" nzTitle="货源审核" (nzOnOk)="handleOK()" (nzOnCancel)="handleCancel('suppliersType')">
<ng-container *nzModalContent>
<div style="position: relative" *ngIf="auditMany">
<nz-alert
nzType="info"
[nzMessage]="'已选择' + 6 + ''"
nzShowIcon
[ngStyle]="{ margin: '0 0 1rem 0' }"
>
</nz-alert>
</div>
<sf #sfFre [schema]="freightSchema" [ui]="ui2" [compact]="false" [button]="'none'">
</sf>
</ng-container>
<ng-template #nzModalFooter>
<button nz-button nzType="primary" (click)="handleOK()" [disabled]="">通过</button>
<button nz-button nzType="default" (click)="handleCancel('suppliersType')">不通过</button>
</ng-template>
</nz-modal>
<ng-template #extraTemplate>
<div>
<button (click)="audit('',2)" nz-button nzType="primary">批量审核</button>
<button (click)="audit('')" nz-button nzType="primary">发布货源</button>
</div>
</ng-template>

View File

@ -0,0 +1,24 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { SupplyManagementBulkComponent } from './bulk.component';
describe('SupplyManagementBulkComponent', () => {
let component: SupplyManagementBulkComponent;
let fixture: ComponentFixture<SupplyManagementBulkComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ SupplyManagementBulkComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(SupplyManagementBulkComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,338 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { STColumn, STComponent } from '@delon/abc/st';
import { SFComponent, SFSchema, SFSelectWidgetSchema, SFUISchema } from '@delon/form';
import { ModalHelper, _HttpClient } from '@delon/theme';
import { NzModalService } from 'ng-zorro-antd/modal';
import { map } from 'rxjs/operators';
import { SupplyManagementService } from '../../services/supply-management.service';
import { SupplyManagementQrcodePageComponent } from '../qrcode-page/qrcode-page.component';
import { SupplyManagementUpdatePriceComponent } from '../update-price/update-price.component';
@Component({
selector: 'app-supply-management-bulk',
templateUrl: './bulk.component.html',
})
export class SupplyManagementBulkComponent implements OnInit {
url = `/user?_allow_anonymous=true`;
ui: SFUISchema = {};
ui2: SFUISchema = {};
schema: SFSchema = {};
auditMany = false;
isVisible = false;
_$expand = false;
columns: STColumn[] = [];
freightSchema: SFSchema = {};
@ViewChild('st') private readonly st!: STComponent;
@ViewChild('sf', { static: false }) sf!: SFComponent;
@ViewChild('sfFre', { static: false }) sfFre!: SFComponent;
tabs = [ {
name: '全部',
type: 5,
count: 0,
},
{
name: '待接单',
type: 5,
count: 0,
},
{
name: '已接单',
type: 5,
count: 0,
},
{
name: '已取消',
type: 5,
count: 0,
},
];
constructor(public service: SupplyManagementService, private modal: NzModalService) { }
ngOnInit(): void {
this.initSF();
this.initST();
this.initSFFre();
}
/**
* 初始化查询表单
*/
initSF() {
this.schema = {
properties: {
_$expand: { type: 'boolean', ui: { hidden: true } },
no: {
type: 'string',
title: '货源编号'
},
no2: {
type: 'string',
title: '装货地'
},
no1: {
type: 'string',
title: '卸货地'
},
sex: {
title: '货物类型',
type: 'string',
default: 0,
enum: [
{ label: '未知', value: 0 },
{ label: '男', value: 1 },
{ label: '女', value: 2 },
{ label: '保密', value: 3 },
],
ui: {
widget: 'select',
visibleIf: {
_$expand: (value: boolean) => value,
},
} as SFSelectWidgetSchema,
},
appId: {
type: 'string',
title: '录单员',
ui: {
widget: 'select',
placeholder: '请选择',
visibleIf: {
_$expand: (value: boolean) => value,
},
allowClear: true,
asyncData: () => this.getCatalogueMember(),
},
},
},
type: 'object',
};
this.ui = { '*': { spanLabelFixed: 80, grid: { span: 8, gutter: 4 } } };
}
initSFFre() {
this.freightSchema = {
properties: {
roleDescription: {
title: '备注',
type: 'string',
maxLength: 50,
ui: {
placeholder: '请输入备注',
widget: 'textarea',
},
},
}
};
this.ui2 = { '*': { spanLabelFixed: 120, grid: { span: 24 } } };
}
/**
* 初始化数据列表
*/
initST() {
this.columns = [
{ title: '', type: 'checkbox', width: '50px', className: 'text-center' },
{
title: '货源编号',
width: '100px',
className: 'text-center',
render: 'goodsId'
},
{ title: '服务类型', index: 'linkUrl', width: '120px', className: 'text-center' },
{ title: '货主', index: 'linkUrl', width: '120px', className: 'text-center' },
{ title: '项目名称', index: 'linkUrl', width: '120px', className: 'text-center' },
{ title: '关联订单', render: 'orderSn', width: '120px', className: 'text-center' },
{ title: '货物信息', render: 'goodsInfo', width: '180px', className: 'text-center' },
{
title: '装货地',
className: 'text-center',
width: '120px',
}, {
title: '卸货地',
className: 'text-center',
width: '120px',
},
{
title: '用车需求',
className: 'text-center',
width: '150px',
render: 'demand'
},
{
title: '运费单价',
className: 'text-center',
width: '150px',
},
{
title: '结算依据',
className: 'text-center',
width: '120px',
},
{
title: '货源状态',
className: 'text-center',
index: 'enStatusStr2',
type: 'badge',
badge: {
: { text: '正常', color: 'success' },
: { text: '冻结', color: 'warning' },
: { text: '废弃', color: 'default' },
},
},
{
title: '截止时间',
width: '170px',
className: 'text-center',
},
{
title: '发布时间',
width: '170px',
className: 'text-center',
},
{
title: '审核状态',
className: 'text-center',
index: 'enStatusStr3',
type: 'badge',
badge: {
: { text: '正常', color: 'success' },
: { text: '冻结', color: 'warning' },
: { text: '废弃', color: 'default' },
},
},
{
title: '操作',
fixed: 'right',
width: '200px',
className: 'text-center',
buttons: [
{
text: '货源审核',
click: (_record) => this.audit(_record, 1),
},
{
text: '二维码',
click: (_record) => this.assignedQrcode(_record),
},
{
text: '修改单价',
click: (_record) => this.updatePrice(_record),
},
{
text: '取消货源',
// click: (_record) => this.delOne(_record),
},
{
text: '再下一单',
// click: (_record) => this.editOne(_record),
},
{
text: '重新指派',
// click: (_record) => this.delOne(_record),
},
],
},
];
}
add(): void {
// this.modal
// .createStatic(FormEditComponent, { i: { id: 0 } })
// .subscribe(() => this.st.reload());
}
/**
* 查询字段个数
*/
get queryFieldCount(): number {
return Object.keys(this.schema?.properties || {}).length;
}
/**
* 伸缩查询条件
*/
expandToggle(): void {
this._$expand = !this._$expand;
this.sf?.setValue('/_$expand', this._$expand);
}
/**
* 重置表单
*/
resetSF(): void {
this.sf.reset();
this._$expand = false;
}
get selectedRows() {
return this.st?.list.filter((item) => item.checked) || [];
}
// 获取录单员
getCatalogueMember() {
const params = {
};
return this.service.request(this.service.$api_get_catalogue_member, params, 'GET').pipe(
map((res) => {
if (res) {
console.log(res)
}
}),
);
}
selectChange(e: number) {
}
/**
* 更新运费
*/
updatePrice(item: any) {
const modalRef = this.modal.create({
nzTitle: '修改单价',
nzWidth: '600px',
nzContent: SupplyManagementUpdatePriceComponent,
nzComponentParams: {
i: item,
},
nzFooter: null,
});
}
/**
* 二维码
*/
assignedQrcode(item: any) {
const modalRef = this.modal.create({
nzTitle: '二维码',
nzWidth: '600px',
nzContent: SupplyManagementQrcodePageComponent,
nzComponentParams: {
i: item,
},
nzFooter: null,
});
}
tabChange(item: any) {
console.log(item)
}
/**
* 审核
*/
audit(value: any, status?: any) {
console.log(value)
console.log(status)
if(status === 2) {
this.auditMany = true;
} else {
this.auditMany = false;
}
this.isVisible = true;
}
/**
* 审核关闭弹窗
*/
handleCancel(type: any) {
this.isVisible = false
}
/**
* 审核通过按钮
*/
handleOK() {
}
}