解决冲突

This commit is contained in:
wangshiming
2022-02-24 14:35:53 +08:00
parent cbecaeaa15
commit 5fc5dd07a7
13 changed files with 899 additions and 56 deletions

View File

@ -0,0 +1,82 @@
<!--
* @Description :
* @Version : 1.0
* @Author : Shiming
* @Date : 2022-01-12 10:52:50
* @LastEditors : Shiming
* @LastEditTime : 2022-02-24 10:31:05
* @FilePath : \\tms-obc-web\\src\\app\\routes\\contract-management\\components\\contract-template\\contract-template.component.html
* Copyright (C) 2022 huzhenhong. All rights reserved.
-->
<!-- 搜索表单 -->
<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>
<div nz-col [nzSpan]="_$expand ? 24 : 18">
<sf #sf [schema]="schema" [ui]="ui" [compact]="true" [button]="'none'">
<ng-template sf-template="signTime" let-me let-ui="ui" let-schema="schema">
<nz-range-picker [nzShowTime]="true" [(ngModel)]="sf.value.signTime"></nz-range-picker>
</ng-template>
<ng-template sf-template="effectiveEndTime" let-me let-ui="ui" let-schema="schema">
<nz-range-picker [nzShowTime]="true" [(ngModel)]="sf.value.effectiveEndTime"></nz-range-picker>
</ng-template>
</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)"
acl
[acl-ability]="['CONTRACT-INDEX-listFrame']"
>查询</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>
<div class="NewBtn">
<button nz-button nzType="primary" (click)="creatTemplate()" acl [acl-ability]="['CONTRACT-TEMPLATE-new']"> 新建 </button>
</div>
<div style="margin-top: 15px">
<st
#st
[bordered]="true"
[data]="service.$api_get_contractTemplate_page"
[columns]="columns"
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
[res]="{ reName: { list: 'data.records', total: 'data.total' } }"
[page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
[loading]="service.http.loading"
>
<ng-template st-row="templateName" let-item let-index="index">
<a (click)="view(item)">{{ item.templateName }}</a>
</ng-template>
</st>
</div>
</nz-card>

View File

@ -0,0 +1,4 @@
.NewBtn{
float: right;
margin-bottom: 15px;
}

View File

@ -0,0 +1,35 @@
/*
* @Description :
* @Version : 1.0
* @Author : Shiming
* @Date : 2022-01-05 09:45:47
* @LastEditors : Shiming
* @LastEditTime : 2022-02-24 14:09:28
* @FilePath : \\tms-obc-web\\src\\app\\routes\\contract-management\\components\\contract-template-partner\\contract-template-partner.component.spec.ts
* Copyright (C) 2022 huzhenhong. All rights reserved.
*/
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ContractManagementTemplatePartnerComponent } from './contract-template-partner.component';
describe('ContractManagementTemplatePartnerComponent', () => {
let component: ContractManagementTemplatePartnerComponent;
let fixture: ComponentFixture<ContractManagementTemplatePartnerComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ ContractManagementTemplatePartnerComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ContractManagementTemplatePartnerComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,250 @@
import { Router } from '@angular/router';
import { Component, OnInit, ViewChild } from '@angular/core';
import { STColumn, STComponent } from '@delon/abc/st';
import { SFComponent, SFDateWidgetSchema, 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 { ContractManagementService } from '../../services/contract-management.service';
@Component({
selector: 'app-contract-management-template-partner-complaint',
templateUrl: './contract-template-partner.component.html',
styleUrls: ['./contract-template-partner.component.less']
})
export class ContractManagementTemplatePartnerComponent implements OnInit {
ui: SFUISchema = {};
uiView: SFUISchema = {};
schema: SFSchema = {};
schemaView: SFSchema = {};
auditMany = false;
_$expand = false;
channelId: any;
@ViewChild('st') private readonly st!: STComponent;
@ViewChild('sf', { static: false }) sf!: SFComponent;
columns: STColumn[] = [];
datass: any = [
{
one: '1',
two: '1',
three: '1',
id: 1
},
{
one: '2',
two: '2',
three: '2',
id: 2
},
];
constructor(
public service: ContractManagementService,
private modal: NzModalService,
private router: Router
) { }
/**
* 查询参数
*/
get reqParams() {
return {
templateType: 'MX',
...this.sf?.value,
};
}
get selectedRows() {
return this.st?.list.filter((item) => item.checked) || [];
}
ngOnInit(): void {
this.initSF();
this.initST();
this.initSTAudit();
}
/**
* 初始化查询表单
*/
initSF() {
this.schema = {
properties: {
_$expand: { type: 'boolean', ui: { hidden: true } },
templateName: {
type: 'string',
title: '模板名称',
},
signingObject: {
type: 'string',
title: '签约对象',
enum: [
{ label: '全部', value: '' },
{ label: '货主', value: 1 },
{ label: '司机', value: 2 }
],
ui: {
widget: 'select',
placeholder: '请选择'
}
},
contractType: {
title: '合同类型',
type: 'string',
default: '',
ui: {
widget: 'dict-select',
containsAllLable: true,
params: { dictKey: 'contract:type' },
containAllLable: true,
} as SFSelectWidgetSchema
},
resourceType: {
title: '货源类型',
type: 'string',
default: '',
ui: {
widget: 'dict-select',
params: { dictKey: 'contract:template:type' },
containsAllLable: true,
visibleIf: {
_$expand: (value: boolean) => value
},
} as SFSelectWidgetSchema,
},
},
};
this.ui = { '*': { spanLabelFixed: 110, grid: { span: 8, gutter: 4 } } };
}
/**
* 初始化数据列表
*/
initST() {
this.columns = [
{
title: '合同模板名称',
className: 'text-center',
render: 'templateName'
},
{
title: '签约对象',
width: '100px',
className: 'text-center',
index: 'signingObject'
},
{
title: '合同类型',
width: '100px',
className: 'text-center',
index: 'contractType'
},
{
title: '货源类型',
width: '100px',
className: 'text-center',
index: 'resourceType'
},
{ title: '创建人', index: 'createUserId', width: '120px', className: 'text-center' },
{
title: '创建时间',
className: 'text-center',
index: 'createTime'
},
{
title: '操作',
fixed: 'right',
className: 'text-left',
buttons: [
{
text: '编辑',
click: (_record) => this.edit(_record),
acl: { ability: ['CONTRACT-TEMPLATE-edit'] },
},
{
text: '删除',
click: (_record) => this.delete(_record),
acl: { ability: ['CONTRACT-TEMPLATE-delete'] },
},
],
},
];
}
initSTAudit() {
this.schemaView = {
properties: {
handleResult: {
title: '处理结果',
type: 'string',
maxLength: 50,
ui: {
placeholder: '最多不超过50字',
widget: 'textarea',
autosize: { minRows: 3, maxRows: 6 }
},
},
},
required: ['handleResult']
};
this.uiView = { '*': { spanLabelFixed: 110, grid: { span: 24 } } };
}
/**
* 查询字段个数
*/
get queryFieldCount(): number {
return Object.keys(this.schema?.properties || {}).length;
}
/**
* 伸缩查询条件
*/
expandToggle(): void {
this._$expand = !this._$expand;
this.sf?.setValue('/_$expand', this._$expand);
}
tabChange(item: any) {
}
/**
* 重置表单
*/
resetSF(): void {
this.sf.reset();
this._$expand = false;
}
edit(value: any) {
this.router.navigate(['/contract-management/template/text/' + value.id],{
queryParams: {
status: 2
}
})
}
creatTemplate() {
this.router.navigate(['/contract-management/template/text/' + 0], {
queryParams: {
status: 1
}
})
}
goBack() {
window.history.go(-1)
}
view(value: any) {
this.router.navigate(['/contract-management/template/text/' + value.id],{
queryParams: {
status: 3
}
})
}
delete(value: any) {
this.modal.confirm({
nzTitle: '<i>删除确认</i>',
nzOnOk: () =>
this.service.request(this.service.$api_deletebatch_contractTemplate, [value.id]).subscribe(res => {
if (res) {
this.service.msgSrv.success('删除成功!');
this.st.reload(1)
}
})
});
}
}