货主管理

This commit is contained in:
Taric Xin
2021-12-09 16:15:47 +08:00
parent b074f72593
commit 8091d8e274
28 changed files with 971 additions and 1263 deletions

View File

@ -1,82 +1,97 @@
<!--
* @Author: your name
* @Date: 2021-11-30 15:09:49
* @LastEditTime: 2021-11-30 16:28:26
* @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\usercenter\components\freight\user\detail\detail.component.html
-->
<ng-container >
<ng-container>
<!-- 页头 -->
<page-header-wrapper [title]="'用户列表详情'" [logo]="logo" [content]="content">
<page-header-wrapper [title]="'员工详情'" [logo]="logo" [content]="content">
<ng-template #logo>
<button nz-button nz-tooltip nzTooltipTitle="返回上一页" (click)="goBack()">
<i nz-icon nzType="left" nzTheme="outline"></i>
</button>
</ng-template>
<ng-template #content>
<div class="user-info">
<div style="flex: 1">
<div style="display: flex;">
<p style="padding-right: 80px; width: 400px; font-size: 20px;">申请编号:{{ detailData?.shoppFeignVO?.publicity }}</p>
</div>
<div style="display: flex;">
<p style="padding-right: 80px; width: 400px;">申请时间{{ detailData?.shoppFeignVO?.introduction }}</p>
<p >申请人:黄龙真人</p>
</div>
<div>
申请人手机号6846846416541
</div>
<div style="position: relative;top: -65%;
left: 85%;">
<span style="font-size: 12px;">状态</span>
<br />
<span>待审核</span>
</div>
<nz-skeleton [nzLoading]="service.http.loading">
<div class="user-info" nz-row>
<div nz-col nzSpan="24" class="d-flex">
<img [src]="detailData?.enterpriseLogo" />
<div style="flex: 1;">
<div nz-row>
<div nz-col [nzLg]="12" [nzSm]="24" [nzXs]="24">
<p style="margin-bottom: 0;">{{ detailData?.enterpriseName }}
<nz-badge nzStatus="success" nzText="正常" *ngIf="detailData?.stateLocked" class="ml-sm"></nz-badge>
<nz-badge nzStatus="error" nzText="冻结" *ngIf="!detailData?.stateLocked" class="ml-sm"></nz-badge>
</p>
</div>
</div>
<div nz-row>
<div nz-col [nzLg]="8" [nzSm]="24" [nzXs]="24">
<p>手机号:{{ detailData?.phone }}</p>
</div>
<div nz-col [nzLg]="8" [nzSm]="24" [nzXs]="24">
申请时间:{{detailData?.createTime}}
</div>
<div nz-col [nzXl]="8" [nzLg]="8" [nzSm]="24" [nzXs]="24" class="d-flex"
style="justify-content: flex-end;">
<button [nzLoading]="service.http.loading" nz-button nzType="primary" nzGhost (click)="userAction(1)">
启用
</button>
<button [nzLoading]="service.http.loading" nz-button nzDanger (click)="userAction(0)">
冻结
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</nz-skeleton>
</ng-template>
</page-header-wrapper>
<nz-card>
<sv-container col="1">
<sv-title>申请人信息</sv-title>
<nz-card [nzLoading]="service.http.loading">
<sv-container col="2">
<sv-title>个人信息
<div style="float: right;">
<button nz-button nzType="default" nzDanger (click)="auditPass()">审核通过</button>
<button nz-button nzType="default" nzDanger (click)="auditNo()">驳回审核</button>
<button nz-button nzType="default" nzDanger (click)="ratify()">修改</button>
</div>
</sv-title>
<sv label="姓名">
{{ detailData?.contactsName }}
</sv>
<sv label="身份证号码">
{{ detailData?.contactsPhone }}
</sv>
<sv label="企业授权函">
<!-- <app-imagelist [imgList]="detailData?.enterpriseQualificationCertificate"></app-imagelist> -->
<div style="float: right;">
<button nz-button nzType="default" nzDanger (click)="auditPass()">审核通过</button>
<button nz-button nzType="default" nzDanger (click)="auditNo()">驳回审核</button>
<button nz-button nzType="default" nzDanger (click)="ratify()">修改</button>
</div>
<sv label="身份证照">
<app-imagelist
[imgList]="[detailData?.legalPersonIdentityVO?.certificatePhotoFrontWatermark,detailData?.legalPersonIdentityVO?.certificatePhotoBackWatermark]">
</app-imagelist>
</sv>
</sv-container>
<nz-divider></nz-divider>
<sv-container col="3" class="mt16">
<sv-title>关联企业</sv-title>
<st
#st
[bordered]="true"
[columns]="columns"
[data]="detailData.goodsList"
[ngStyle]="{ margin: '1rem 0' }"
multiSort
size="small"
[page]="{ show: false }"
>
</st>
<!-- <st #st [bordered]="true" [columns]="columns" [data]="detailData.goodsList" [ngStyle]="{ margin: '1rem 0' }"
multiSort size="small" [page]="{ show: false }">
</st> -->
</sv-container>
</nz-card>
</ng-container>
<nz-modal [(nzVisible)]="isVisible" nzTitle="类型" (nzOnOk)="handleOK('suppliersType')">
<sf #sf1 [schema]="schema1" [ui]="ui" [compact]="false" [button]="'none'" [formData]="suppliersData"></sf>
<div *nzModalFooter>
<button nz-button nzType="default" (click)="handleCancel('suppliersType')">取消</button>
<button nz-button nzType="primary" (click)="handleOK('suppliersType')" [disabled]="!sf1.valid">确认</button>
<ng-template #redectModal>
<div nz-row nzGutter="8">
<div nz-col nzSpan="24" se-container [labelWidth]="120">
<se [col]="1" label="姓名">
{{ detailData?.enterpriseName }}
</se>
<se [col]="1" label="备注" required>
<textarea nz-input rows="3" style="width: 325px;margin-left: 14px;"
[(ngModel)]="approvalOpinion.remark"></textarea>
</se>
<se [col]="1" label="可选理由">
<nz-tag *ngFor="let tag of reasonTags" nzColor="default" nzMode="checkable"
[nzChecked]="approvalOpinion?.reason===tag" (nzCheckedChange)="approvalOpinion.reason=tag">
{{ tag }}
</nz-tag>
</se>
</div>
</div>
</nz-modal>
</ng-template>

View File

@ -4,279 +4,87 @@ import { STColumn, STComponent } from '@delon/abc/st';
import { SFComponent, SFDateWidgetSchema, SFSchema, SFUISchema } from '@delon/form';
import { ModalHelper, _HttpClient } from '@delon/theme';
import { NzMessageService } from 'ng-zorro-antd/message';
import { NzModalService } from 'ng-zorro-antd/modal';
import { UsermanageService } from '../../../../services/usercenter.service';
@Component({
selector: 'app-supplier-components-list-view',
templateUrl: './detail.component.html',
styleUrls: ['./detail.component.less'],
styleUrls: ['./detail.component.less']
})
export class FreightComponentsUserDetailComponent implements OnInit {
i: any;
url = `/rule?_allow_anonymous=true`;
@ViewChild('st', { static: false }) st!: STComponent;
@ViewChild('redectModal', { static: false })
redectModal!: any;
detailData: any = {
goodsList: [
{
perPrice: '22323',
goodsQuantity: '项目名称',
totalPrice: '角色',
},
{
perPrice: '2259595',
goodsQuantity: '项目名称2',
totalPrice: '角色',
},
]
};
isShow = false;
isVisible = false;
modalTitle = '有效期';
modalName = '';
ui!: SFUISchema;
schema!: SFSchema;
@ViewChild('sf', { static: false }) sf!: SFComponent;
schema1!: SFSchema;
@ViewChild('sf1', { static: false }) sf1!: SFComponent;
validData: any = ['suppliersType'];
suppliersData: any = {};
detailData: any = {};
@ViewChild('st', { static: false }) st!: STComponent;
columns: STColumn[] = [
{ title: '企业名称', index: 'perPrice', width: 300, className: 'text-center' },
{ title: '项目名称', index: 'goodsQuantity', width: 300, className: 'text-center' },
{ title: '角色', index: 'totalPrice', width: 300, className: 'text-center' },
{ title: '角色', index: 'totalPrice', width: 300, className: 'text-center' }
];
constructor(
private http: _HttpClient,
private modal: ModalHelper,
public service: UsermanageService,
private route: ActivatedRoute,
private modalHelper: ModalHelper,
private msgSrv: NzMessageService,
) {}
approvalOpinion = {
reason: '',
remark: ''
};
reasonTags = ['身份证照片太丑', '姓名与身份证号不匹配'];
constructor(private nzModalService: NzModalService, public service: UsermanageService, private route: ActivatedRoute) {}
ngOnInit() {
console.log(this.route.snapshot);
// this.initData();
this.initSF();
this.initSF1();
this.initData();
// this.launchSign();
}
/**
* 初始化查询表单
*/
initSF() {
this.schema = {
properties: {
_$expand: { type: 'boolean', ui: { hidden: true } },
effectiveDate: {
title: '有效期',
type: 'string',
ui: {
widget: 'date',
format: 'yyyy-MM-dd 00:00:00',
// hidden: this.modalName === 'effectiveDate' ? false : true,
} as SFDateWidgetSchema,
},
},
required: ['effectiveDate'],
};
this.ui = { '*': { spanLabelFixed: 120, grid: { span: 24 } } };
}
initSF1() {
this.schema1 = {
properties: {
_$expand: { type: 'boolean', ui: { hidden: true } },
suppliersType: {
type: 'string',
title: '类型',
enum: [
{ label: '非外部供应商', value: 0 },
{ label: '外部供应商', value: 1 },
],
default: '',
ui: {
widget: 'select',
change: (args: any) => {
console.log(args, 'args');
this.suppliersData.suppliersType = args;
if (args === 1) {
this.validData = ['suppliersType', 'externalSuppliersId'];
} else {
this.validData = ['suppliersType'];
this.suppliersData.externalSuppliersId = '';
}
this.initSF1();
},
},
},
externalSuppliersId: {
title: '外部供应商id',
type: 'string',
default: '',
ui: {
visibleIf: { suppliersType: (value: any) => value === 1 },
},
},
},
required: this.validData,
};
}
showModal(name: any) {
this.modalName = name;
if (name === 'effectiveDate') {
this.isShow = true;
} else {
this.isVisible = true;
}
}
async initData() {
console.log(this.route.snapshot, 'this.route.snapshot');
const params = {
tenantId: this.route.snapshot.params.id,
id: this.route.snapshot.params.id
// tenantId: this.route.snapshot.queryParams.tenantId,
};
const res = await this.service.asyncRequest(this.service.$api_get_one, params);
// // 商品资质
// if (res.enterpriseBusinessJson) {
// res.enterpriseBusinessJson.aptitudes = res.enterpriseBusinessJson?.aptitudes ? res.enterpriseBusinessJson.aptitudes.split(',') : [];
// }
// // // 申请人身份证证件
// // res.applyUserJson.imagelist = [];
// // res.applyUserJson.imagelist.push(res.applyUserJson.certificatePhotoFront);
// // res.applyUserJson.imagelist.push(res.applyUserJson.certificatePhotoBack);
// // res.applyUserJson.imagelist.push(res.applyUserJson.handCertificate);
// 法人身份证证件
const imagelist = [];
imagelist.push(res?.certificatePhotoFront);
imagelist.push(res?.certificatePhotoBack);
res.certificatePhoto = imagelist;
// 营业执照
res.enterpriseQualificationCertificate = res.enterpriseQualificationCertificate
? res.enterpriseQualificationCertificate.split(',')
: [];
// 返回所在地
res.enterpriseAddressCodeStr = await this.getRegionFullName(res.enterpriseAddressCode);
this.detailData = res;
this.suppliersData = {
suppliersType: res?.suppliersType,
externalSuppliersId: res?.externalSuppliersId,
};
}
/**
* 根据地区code查询地区详情
* @param code 地区代码
*/
async getRegionFullName(code: any) {
const params = {
regionCode: code,
};
const res = await this.service.asyncRequest(this.service.$api_get_one, params, 'POST', true);
// if (res && res.regionFullName) {
// const arr = res.regionFullName.split(',');
// res.regionFullName = arr.reverse().join('-');
// }
return res && res.regionFullName;
}
add() {
// this.modal
// .createStatic(FormEditComponent, { i: { id: 0 } })
// .subscribe(() => this.st.reload());
}
goBack() {
window.history.go(-1);
}
/**
* 冻结
*/
freezeOrResume(type: number) {
console.log(type)
// this.service.http
// .post(this.service.$api_set_freezeOrResume, {
// tenantId: this.route.snapshot.params.id,
// // tenantId: this.route.snapshot.queryParams.tenantId,
// status: type,
// })
// .subscribe((res) => {
// if (res.data === true) {
// if (type === 0) {
// this.service.msgSrv.success(`启用成功!`);
// } else if (type === 1) {
// this.service.msgSrv.success(`冻结成功!`);
// }
// this.ngOnInit();
// } else {
// this.service.msgSrv.error(res.msg || '操作失败!');
// }
// });
}
PayOrResume(type: number) {
console.log(type)
// this.service.http
// .post(this.service.$api_set_freezeOrResume, {
// tenantId: this.route.snapshot.params.id,
// // tenantId: this.route.snapshot.queryParams.tenantId,
// status: type,
// })
// .subscribe((res) => {
// if (res.data === true) {
// if (type === 0) {
// this.service.msgSrv.success(`启用成功!`);
// } else if (type === 1) {
// this.service.msgSrv.success(`冻结成功!`);
// }
// this.ngOnInit();
// } else {
// this.service.msgSrv.error(res.msg || '操作失败!');
// }
// });
}
handleCancel(name: any) {
if (name === 'effectiveDate') {
this.isShow = false;
} else {
this.isVisible = false;
}
}
handleOK(name: any) {
const params: any = {
tenantId: this.route.snapshot.params.id,
// tenantId: this.route.snapshot.queryParams.tenantId,
};
if (name === 'effectiveDate') {
params.effectiveDate = this.sf?.value?.effectiveDate;
} else {
Object.assign(params, this.sf1?.value);
}
this.service.http.post(this.service.$api_get_one, params).subscribe((res) => {
if (res.data === true) {
this.service.msgSrv.success(`编辑成功!`);
this.ngOnInit();
} else {
this.service.msgSrv.error(res.msg || '编辑失败!');
}
if (name === 'effectiveDate') {
this.isShow = false;
} else {
this.isVisible = false;
userAction(status: number) {
this.nzModalService.warning({
nzTitle: status === 1 ? '确定启用该用户吗?' : '确定冻结该用户吗?',
nzContent:
status === 1
? '停用后,该用户将被限制使用,不限于访问受限、无法发布货源等,请谨慎操作'
: '启用后,该用户将恢复正常使用功能,请再次确认',
nzOnOk: () => {
// this.service.request(this.service.$api_lock_user)
this.st.reload();
}
});
}
auditPass() {
this.nzModalService.confirm({
nzTitle: '审核通过',
nzContent: `是否确认通过(姓名:黄大仙)审核`,
nzOnOk: () => {}
});
}
auditNo() {
this.approvalOpinion = {
reason: '',
remark: ''
};
this.nzModalService.create({
nzTitle: '审核驳回',
nzContent: this.redectModal,
nzOnOk: () => {
if (!this.approvalOpinion?.remark) {
return false;
}
return;
}
});
}
ratify() {
ratify() {}
goBack() {
window.history.go(-1);
}
}

View File

@ -1,153 +1,57 @@
<!--
* @Author: your name
* @Date: 2021-11-29 15:22:34
* @LastEditTime: 2021-11-30 15:52:31
* @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\usercenter\components\freight\list\list.component.html
-->
<!-- 页头 -->
<page-header-wrapper [title]="'用户列表'"></page-header-wrapper>
<page-header-wrapper [title]="'员工列表'"></page-header-wrapper>
<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"
(formSubmit)="st?.load(1)"
(formReset)="resetSF()"
></sf>
<div nz-col [nzXl]="_$expand ? 24 : 18" [nzLg]="24" [nzSm]="24" [nzXs]="24">
<sf #sf [schema]="schema" [ui]="ui" [compact]="true" [button]="'none'"></sf>
</div>
<div nz-col [nzXl]="_$expand ? 24 : 6" [nzLg]="24" [nzSm]="24" [nzXs]="24" class="text-right">
<button nz-button nzType="primary" [disabled]="!sf.valid" [nzLoading]="service.http.loading"
(click)="st?.load(1)">查询</button>
<button nz-button (click)="resetSF()">重置</button>
<button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="st?.load(1)">导出</button>
<button nz-button nzType="link" (click)="expandToggle()">
{{ !_$expand ? '展开' : '收起' }}
<i nz-icon [nzType]="!_$expand ? 'down' : 'up'"></i>
</button>
</div>
<!-- [loading]="service.http.loading" -->
<!-- 查询字段大于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 (click)="resetSF()">重置</button>
<button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="st?.load(1)">导出</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>
<!-- 数据列表 -->
<!-- [data]="service.$api_get_supplier_page" -->
<st
#st
[bordered]="true"
[columns]="columns"
[data]='datalist'
<st #st [bordered]="true" [columns]="columns" [data]='service.$api_get_user_list'
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
[res]="{ reName: { list: 'data.records', total: 'data.total' }, process: dataProcess }"
[page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
[loadingDelay]="500"
[loading]="service.http.loading"
>
[res]="{ reName: { list: 'data.records', total: 'data.total' } }"
[page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }" [loadingDelay]="500"
[loading]="service.http.loading">
<ng-template st-row="enterpriseName" let-item let-index="index">
<div nz-tooltip [nzTooltipTitle]="item.enterpriseName">
<div
style="display: inline-block; max-width: 280px; margin: 0 auto; overflow: hidden; white-space: nowrap; text-overflow: ellipsis"
>
style="display: inline-block; max-width: 280px; margin: 0 auto; overflow: hidden; white-space: nowrap; text-overflow: ellipsis">
{{ item.enterpriseName }}
</div>
</div>
</ng-template>
<ng-template st-row="contactsPhone" let-item let-index="index">
<div
style="color: #52c41a;" (click)="daoyun(item)"
>
{{ item.contactsPhone }}
<div style="color: #52c41a;" (click)="addPromoter(item)">
{{ item.contactsPhone }}
</div>
</ng-template>
<ng-template st-row="stateCol" let-item let-index="index">
<nz-tag *ngIf="item.stateLocked" nzColor="error">冻结</nz-tag>
<nz-tag *elseBlock nzColor="success">正常</nz-tag>
</ng-template>
</st>
<nz-modal [(nzVisible)]="isVisible" [nzFooter]="nzModalFooter" nzTitle="推广业务员" (nzOnOk)="handleOK()" (nzOnCancel)="handleCancel()">
<ng-container *nzModalContent>
<sf #sf2 [schema]="schema2" [ui]="ui2" [compact]="false" [button]="'none'" [formData]="suppliersData"></sf>
</ng-container>
<ng-template #nzModalFooter>
<button nz-button nzType="default" (click)="handleCancel()">取消</button>
<button nz-button nzType="primary" (click)="handleOK()" [disabled]="">确认</button>
</ng-template>
</nz-modal>
</nz-card>
<nz-modal [(nzVisible)]="isVisibleFreeze" [nzFooter]="nzModalFooterFreeze" (nzOnOk)="handleOK()" (nzOnCancel)="handleCancel_freeze()">
<ng-container *nzModalContent>
<div class="ant-popover-message">
<i nz-icon="" nztheme="fill" class="anticon anticon-exclamation-circle ng-star-inserted">
<svg
viewBox="64 64 896 896"
focusable="false"
fill="currentColor"
width="1em"
height="1em"
class="ng-tns-c358-1487"
data-icon="exclamation-circle"
aria-hidden="true"
>
<path
d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 010-96 48.01 48.01 0 010 96z"
></path>
</svg>
</i>
<div class="ant-popover-message-title ng-star-inserted self-ant-popover-title" style="font-size: 16px">确定冻结该企业吗?</div>
<div class="ant-popover-message-title ng-star-inserted" style="color: red;">
停用后,该企业将被限制使用,不限于访问受限、无法发布货源等,请谨慎操作
</div>
</div>
</ng-container>
<ng-template #nzModalFooterFreeze>
<button nz-button nzType="default" (click)="handleCancel_freeze()">取消</button>
<button nz-button nzType="primary" (click)="handleOK()" [disabled]="">确认</button>
</ng-template>
</nz-modal>
<nz-modal [(nzVisible)]="isVisibleOpen" [nzFooter]="nzModalFooterOpen" (nzOnOk)="handleOK()" (nzOnCancel)="handleCancel_open()">
<ng-container *nzModalContent>
<div class="ant-popover-message">
<i nz-icon="" nztheme="fill" class="anticon anticon-exclamation-circle ng-star-inserted">
<svg
viewBox="64 64 896 896"
focusable="false"
fill="currentColor"
width="1em"
height="1em"
class="ng-tns-c358-1487"
data-icon="exclamation-circle"
aria-hidden="true"
>
<path
d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 010-96 48.01 48.01 0 010 96z"
></path>
</svg>
</i>
<div class="ant-popover-message-title ng-star-inserted self-ant-popover-title" style="font-size: 16px">确定启用该企业吗?</div>
<div class="ant-popover-message-title ng-star-inserted" style="color: red;">
启用后,该企业将恢复正常使用功能,请再次确认
</div>
</div>
</ng-container>
<ng-template #nzModalFooterOpen>
<button nz-button nzType="default" (click)="handleCancel_open()">取消</button>
<button nz-button nzType="primary" (click)="handleOK()" [disabled]="">确认</button>
</ng-template>
</nz-modal>
</nz-card>
<ng-template #promoterModal>
<div nz-row nzGutter="8">
<div nz-col nzSpan="24" se-container [labelWidth]="80">
<se [col]="1" label="手机号">
<input nz-input [(ngModel)]="promotersTelephone" />
</se>
</div>
</div>
</ng-template>

View File

@ -0,0 +1,6 @@
:host::ng-deep {
nz-range-picker {
width: 100%;
}
}

View File

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

View File

@ -1,75 +1,44 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { STColumn, STColumnBadge, STComponent, STData } from '@delon/abc/st';
import { SFComponent, SFSchema, SFUISchema } from '@delon/form';
import { SFComponent, SFDateWidgetSchema, SFSchema, SFUISchema } from '@delon/form';
import { NzModalService } from 'ng-zorro-antd/modal';
import { UsermanageService } from '../../../services/usercenter.service';
@Component({
selector: 'app-Freight-components-user',
templateUrl: './user.component.html',
styleUrls: ['./user.component.less'],
templateUrl: './user.component.html'
})
export class FreightComponentsUserComponent implements OnInit {
_$expand = false;
url = `/rule?_allow_anonymous=true`;
isVisible = false;
isVisibleFreeze = false;
isVisibleOpen = false;
ui!: SFUISchema;
ui2!: SFUISchema;
schema!: SFSchema;
schema2!: SFSchema;
columns!: STColumn[];
suppliersData: any;
datalist = [
{
storeName: '企业名称',
contactsName: '152746565',
enterpriseName: '湖南',
unifiedSocialCreditCode: '45454',
contactsPhone: '*97889461561',
effectiveDateStr: '废弃eww',
enStatusStr2: '正常',
enStatusStr3: '正常',
unifiedSocialCreditCode3: '常用服务',
unifiedSocialCreditCode2: '正常',
tenantId: 1
},
{
storeName: '企业名称',
contactsName: '152746565',
enterpriseName: '湖南',
unifiedSocialCreditCode: '45454',
contactsPhone: '*97889461561',
effectiveDateStr: '废弃eww',
enStatusStr2: '正常',
enStatusStr3: '正常',
unifiedSocialCreditCode3: '常用服务',
unifiedSocialCreditCode2: '正常',
tenantId: 2
},
]
ui: SFUISchema = { '*': { spanLabelFixed: 120, grid: { span: 8, gutter: 4 }, enter: () => this.st.load() } };
schema: SFSchema = this.initSF();
columns: STColumn[] = this.initST();
@ViewChild('st', { static: false }) st!: STComponent;
@ViewChild('sf', { static: false }) sf!: SFComponent;
@ViewChild('sf2', { static: false }) sf2!: SFComponent;
@ViewChild('promoterModal', { static: false })
promoterModal!: any;
promotersTelephone = '';
constructor(public service: UsermanageService, private modal: NzModalService, private router: Router, private ar: ActivatedRoute) {}
/**
* 查询字段个数navigate
*/
get queryFieldCount(): number {
return Object.keys(this.schema?.properties || {}).length;
}
/**
* 查询参数
*/
get reqParams() {
const params: any = {
...(this.sf && this.sf.value),
...(this.sf && this.sf.value)
};
if (this.sf?.value.effectiveDate) {
params.effectiveDateStart = this.sf?.value.effectiveDate[0];
params.effectiveDateEnd = this.sf?.value.effectiveDate[1];
Object.assign(params, {
time: {
start: this.sf?.value.effectiveDate[0],
end: this.sf?.value.effectiveDate[1]
}
});
// params.effectiveDateStart = this.sf?.value.effectiveDate[0];
// params.effectiveDateEnd = this.sf?.value.effectiveDate[1];
}
delete params.effectiveDate;
delete params.expand;
@ -77,120 +46,164 @@ export class FreightComponentsUserComponent implements OnInit {
}
get selectedRows() {
return this.st?.list.filter((item) => item.checked) || [];
return this.st?.list.filter(item => item.checked) || [];
}
ngOnInit() {
this.initSF();
this.initST();
this.initSF2();
this.ar.url.subscribe((params) => {
this.ar.url.subscribe(params => {
this.st?.load(1);
});
}
dataProcess(data: STData[]): STData[] {
return data.map((i, index) => {
i.showSortFlag = false;
return i;
addPromoter(item?: any) {
this.promotersTelephone = item?.promotersTelephone;
const modal = this.modal.create({
nzTitle: '推广业务员',
nzContent: this.promoterModal,
nzOnOk: () => {
if (!!!this.promotersTelephone) {
return false;
}
if (typeof this.promotersTelephone === 'string' && !/(^1\d{10}$)/.test(this.promotersTelephone)) {
return false;
}
this.service.request(this.service.$api_add_salesman, { ids: [item.id], salesmanMobile: this.promotersTelephone }).subscribe(res => {
if (res) {
this.service.msgSrv.success(item?.promotersTelephone ? '添加推广员成功' : '修改推广员成功');
}
this.st.load();
});
return;
}
});
}
initSF() {
this.schema = {
userAction(status: number) {
this.modal.warning({
nzTitle: status === 1 ? '确定启用该用户吗?' : '确定冻结该用户吗?',
nzContent:
status === 1
? '停用后,该用户将被限制使用,不限于访问受限、无法发布货源等,请谨慎操作'
: '启用后,该用户将恢复正常使用功能,请再次确认',
nzOnOk: () => {
// this.service.request(this.service.$api_lock_user)
this.st.reload();
}
});
}
expandToggle() {
this._$expand = !this._$expand;
this.sf?.setValue('/expand', this._$expand);
}
creat() {
this.router.navigate(['./new'], { relativeTo: this.ar });
}
/**
* 重置表单
*/
resetSF() {
this.sf.reset();
this._$expand = false;
}
initSF(): SFSchema {
return {
properties: {
expand: {
type: 'boolean',
ui: {
hidden: true,
},
hidden: true
}
},
name: {
title: '用户姓名',
type: 'string',
ui: {
placeholder: '请输入',
showRequired: false
}
},
storeName: { title: '用户姓名', type: 'string', ui: { showRequired: false } },
contactsName: {
title: '企业名称',
type: 'string',
ui: {
showRequired: false,
},
placeholder: '请输入',
showRequired: false
}
},
phone: {
telephone: {
title: '手机号',
type: 'string',
format: 'mobile',
maxLength: 11,
ui: {
placeholder: '请输入手机号',
},
placeholder: '请输入'
}
},
enStatus: {
stateLocked: {
type: 'string',
title: '货主状态',
title: '状态',
enum: [
{ label: '全部', value: '' },
{ label: '正常', value: 0 },
{ label: '冻结', value: 1 },
{ label: '废弃', value: 2 },
{ label: '冻结', value: 1 }
],
default: '',
ui: {
widget: 'select',
visibleIf: {
expand: (value: boolean) => value,
},
},
expand: (value: boolean) => value
}
}
},
yewuphone: {
title: '业务员手机号',
promotersTelephone: {
title: '推广业务员',
type: 'string',
format: 'mobile',
maxLength: 11,
ui: {
placeholder: '请输入手机号',
visibleIf: {
expand: (value: boolean) => value,
},
},
expand: (value: boolean) => value
}
}
},
},
};
this.ui = { '*': { spanLabelFixed: 180, grid: { span: 8, gutter: 4 }, enter: () => this.st.load() } };
}
initSF2() {
this.schema2 = {
properties: {
phone: {
title: '手机号',
effectiveDate: {
title: '申请时间',
type: 'string',
format: 'mobile',
maxLength: 11,
ui: {
placeholder: '请输入手机号',
},
},
},
widget: 'date',
mode: 'range',
format: 'yyyy-MM-dd',
visibleIf: {
expand: (value: boolean) => value
}
} as SFDateWidgetSchema
}
}
};
this.ui2 = { '*': { spanLabelFixed: 90, grid: { span: 16}, enter: () => this.st.load() } };
}
initST() {
this.columns = [
// { title: '', type: 'checkbox', className: 'text-center' },
{ title: '用户姓名', className: 'text-center', index: 'storeName' },
{ title: '手机号', className: 'text-center', index: 'contactsName' },
{ title: '身份证件号', className: 'text-center', render: 'enterpriseName' },
initST(): STColumn[] {
return [
{ title: '用户姓名', className: 'text-center', index: 'name' },
{ title: '手机号', className: 'text-center', index: 'telephone' },
{ title: '身份证件号', className: 'text-center', render: 'certificateNumber' },
{ title: '常用服务', className: 'text-center', index: 'unifiedSocialCreditCode' },
{ title: '推广业务员', className: 'text-center', index: 'contactsPhone',
render: 'contactsPhone'
},
{ title: '申请时间', className: 'text-center', index: 'unifiedSocialCreditCode2' },
{ title: '推广业务员', className: 'text-center', index: 'promotersTelephone', render: 'promotersTelephone' },
{ title: '申请时间', className: 'text-center', index: 'createTime', type: 'date' },
{
title: '状态',
className: 'text-center',
index: 'enStatusStr2',
index: 'stateLocked',
type: 'badge',
badge: {
: { text: '正常', color: 'success' },
: { text: '冻结', color: 'warning' },
: { text: '废弃', color: 'default' },
},
10: { text: '待审核', color: 'default' },
20: { text: ' 已成功', color: 'success' },
30: { text: '已驳回', color: 'warning' }
}
},
{
title: '操作',
@ -199,54 +212,20 @@ export class FreightComponentsUserComponent implements OnInit {
buttons: [
{
text: '查看',
click: (item) => {
this.router.navigate(['./view', item.tenantId], { relativeTo: this.ar });
},
click: (item: any) => {
this.router.navigate(['./view', item.id], { relativeTo: this.ar });
}
},
{
text: '冻结',
click: (item) => {
this.isVisibleFreeze = true
},
click: (item: any) => this.userAction(0)
},
{
text: '启用',
click: (item) => {
this.isVisibleOpen = true
console.log(item)
},
},
],
},
click: (item: any) => this.userAction(1)
}
]
}
];
}
daoyun(item: any) {
this.isVisible = true
}
expandToggle() {
this._$expand = !this._$expand;
this.sf?.setValue('/expand', this._$expand);
}
creat() {
this.router.navigate(['./new',], { relativeTo: this.ar });
}
/**
* 重置表单
*/
resetSF() {
this.sf.reset();
this._$expand = false;
}
handleOK() {
console.log(this.sf2.value)
}
handleCancel() {
this.isVisible = false
}
handleCancel_open() {
this.isVisibleOpen = false
}
handleCancel_freeze() {
this.isVisibleFreeze = false
}
}