货主管理
This commit is contained in:
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user