货主管理

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

@ -8,13 +8,14 @@ import { UsermanageService } from '../../../services/usercenter.service';
@Component({
selector: 'app-Freight-components-enterprise-audit',
templateUrl: './enterprise-audit.component.html',
styleUrls: ['./enterprise-audit.component.less'],
styleUrls: ['./enterprise-audit.component.less']
})
export class FreightComponentsEnterpriseAuditComponent implements OnInit {
_$expand = false;
ui!: SFUISchema;
schema!: SFSchema;
columns!: STColumn[];
ui: SFUISchema = { '*': { spanLabelFixed: 90, grid: { lg: 8, md: 12, sm: 12, xs: 24 } } };
schema: SFSchema = this.initSF();
enterColumns: STColumn[] = this.initEnterST();
adminColumns: STColumn[] = this.initAdminST();
@ViewChild('st', { static: false }) st!: STComponent;
@ViewChild('sf', { static: false }) sf!: SFComponent;
tabType = 1;
@ -22,80 +23,32 @@ export class FreightComponentsEnterpriseAuditComponent implements OnInit {
{
name: '企业审核',
type: 1,
isActived: false,
isActived: false
},
{
name: '企业管理员审核',
type: 2,
isActived: false,
},
isActived: false
}
];
datalist = [
{
storeName: '企业名称',
contactsName: '152746565',
enterpriseName: '湖南',
unifiedSocialCreditCode: '45454',
contactsPhone: '*97889461561',
effectiveDateStr: '废弃eww',
enStatusStr2: '已驳回',
enStatusStr3: '正常',
unifiedSocialCreditCode3: '常用服务',
unifiedSocialCreditCode2: '正常',
tenantId: 1,
id: 1
},
{
storeName: '企业名称',
contactsName: '152746565',
enterpriseName: '湖南',
unifiedSocialCreditCode: '45454',
contactsPhone: '*97889461561',
effectiveDateStr: '废弃eww',
enStatusStr2: '待审核',
enStatusStr3: '正常',
unifiedSocialCreditCode3: '常用服务',
unifiedSocialCreditCode2: '正常',
tenantId: 2,
id: 2
},
]
isVisible = false;
mdType!: any;
cateData = [];
// stApi = this.service.$api_get_labelList;
constructor(public service: UsermanageService, private router: Router, private modal: NzModalService,private ar: ActivatedRoute) {}
/**
* 查询字段个数
*/
get queryFieldCount(): number {
return Object.keys(this.schema?.properties || {}).length;
}
constructor(public service: UsermanageService, private router: Router, private modal: NzModalService, private ar: ActivatedRoute) {}
/**
* 查询参数
*/
get reqParams() {
const params = Object.assign({}, this.sf?.value || {}, {
flag: this.tabType,
flag: this.tabType
});
delete params._$expand;
return { ...params };
}
/**
* 选中行
*/
get selectedRows() {
return this.st?.list.filter((item) => item.checked) || [];
return { ...params, listSource: 1 };
}
/**
* 伸缩查询条件
*/
expandToggle() {
this._$expand = !this._$expand;
expandToggle(status: boolean) {
this._$expand = status;
this.sf?.setValue('/expand', this._$expand);
}
@ -109,90 +62,7 @@ export class FreightComponentsEnterpriseAuditComponent implements OnInit {
/**
* 程序初始化入口
*/
ngOnInit() {
this.initSF();
this.initST();
}
/**
* 初始化查询表单
*/
initSF() {
this.schema = {
properties: {
expand: { type: 'boolean', ui: { hidden: true } },
name: { title: '企业名称', type: 'string' },
contactsName: {
title: '联系人',
type: 'string',
ui: {
showRequired: false,
},
},
phone: {
title: '手机号',
type: 'string',
format: 'mobile',
maxLength: 11,
ui: {
placeholder: '请输入手机号',
},
},
enStatus2: {
type: 'string',
title: '状态',
enum: [
{ label: '全部', value: '' },
{ label: '正常', value: 0 },
{ label: '冻结', value: 1 },
{ label: '废弃', value: 2 },
],
default: '',
ui: {
widget: 'select',
visibleIf: {
expand: (value: boolean) => value,
},
},
},
},
};
this.ui = { '*': { spanLabelFixed: 100, grid: { span: 8, gutter: 4 } } };
}
/**
* 初始化数据列表
*/
initST() {
this.columns = [
{ title: '企业名称', className: 'text-center', index: 'storeName' },
{ title: '联系人', className: 'text-center', index: 'contactsName' },
{ title: '手机号', className: 'text-center', render: 'enterpriseName' },
{ title: '申请时间', className: 'text-center', index: 'unifiedSocialCreditCode' },
{
title: '状态',
className: 'text-center',
index: 'enStatusStr2',
type: 'badge',
badge: {
: { text: '待审核', color: 'success' },
: { text: '已驳回', color: 'warning' },
},
},
{ title: '常用服务', className: 'text-center', index: 'unifiedSocialCreditCode3' },
{ title: '推广业务员', className: 'text-center', index: 'unifiedSocialCreditCode2' },
{
title: '操作',
fixed: 'right',
width: '180px',
className: 'text-center',
buttons: [
{ text: '查看', click: (_record) => this.View(_record) },
],
},
];
}
ngOnInit() {}
/**
* 数据列表状态变化事件
@ -202,109 +72,151 @@ export class FreightComponentsEnterpriseAuditComponent implements OnInit {
}
/**
* 新增实例
* 查看详情
*/
View(record: any) {
console.log(record)
// this.router.navigate(['../add'], { relativeTo: this.ar });
this.router.navigate(['./view', record.tenantId], {
relativeTo: this.ar
this.router.navigate(['./view', record.id], {
relativeTo: this.ar
});
}
/**
* 编辑单个实例
* @param record 记录实例
*/
editOne(record: STData) {
// this.router.navigate(['../edit', record.uuid], { relativeTo: this.ar });
}
/**
* 删除单个实例
* @param record 记录实例
*/
delOne(record: STData) {
// let delApi = this.service.$api_label_deletebatch;
// if (this.tabType === 3) {
// delApi = this.service.$api_business_label_delete;
// } else {
// delApi = this.service.$api_label_deletebatch;
// }
this.modal.confirm({
nzTitle: '<i>删除确认</i>',
nzContent: `<b>即将删除 当前行数据,请仔细核对,避免误操作!<br>是否删除?</br>`,
nzOnOk: () =>
console.log('1')
// this.service.http.post(delApi, [record.id]).subscribe((res) => {
// console.log(res, 'del');
// if (res === true || res.data === true) {
// this.service.msgSrv.success('删除成功!');
// setTimeout(() => {
// this.st?.reload();
// }, 500);
// } else {
// this.service.msgSrv.error('删除失败!');
// }
// }),
});
}
/**
* 删除多个实例
*/
delMany(record: STData) {
this.modal.confirm({
nzTitle: '<i>删除确认</i>',
nzContent: `<b>即将删除 当前行数据,请仔细核对,避免误操作!<br>是否删除?</br>`,
nzOnOk: () =>
console.log('')
// this.service.http.post(this.service.$api_label_deletebatch, [record.id]).subscribe((res) => {
// if (res === true) {
// this.service.msgSrv.success('删除成功!');
// this.st?.reload();
// }
// }),
});
/*
const delData = this.st.list.filter((item) => item.checked).map((item) => item.id);
if (delData.length > 0) {
this.modal.confirm({
nzTitle: '<i>删除确认</i>',
nzContent: `<b>即将删除 <i>${delData.length}</i> 条数据,请仔细核对,避免误操作!<br>是否删除?</br>`,
nzOnOk: () =>
this.service.delMany(delData).subscribe((res) => {
if (res === true) {
this.service.msgSrv.success('数据删除成功!');
this.st?.reload();
}
}),
});
}
*/
}
// 切换Tab
changeTab(item: any) {
this.tabType = item.type;
console.log(item)
this.expandToggle(false);
this.sf?.reset();
// if (item.type === 3) {
// this.stApi = this.service.$api_get_business_labelList;
// } else {
// this.stApi = this.service.$api_get_labelList;
// }
// setTimeout(() => {
// this.tabs.forEach((i) => (i.isActived = false));
// item.isActived = !item.isActived;
// this.st.load(1);
// this.st.resetColumns();
// }, 500);
setTimeout(() => {
this.st.load(1);
}, 100);
}
// checkType(): boolean {
// return this.mdType === 2 ? true : false;
// }
/**
* 初始化数据列表
*/
initEnterST(): STColumn[] {
return [
{ title: '企业名称', className: 'text-center', index: 'enterpriseName' },
{ title: '联系人', className: 'text-center', index: 'contacter' },
{ title: '手机号', className: 'text-center', render: 'mobile' },
{ title: '申请时间', className: 'text-center', index: 'createTime' },
{
title: '审核状态',
className: 'text-center',
index: 'approvalStatus',
type: 'badge',
badge: {
10: { text: '待审核', color: 'processing' },
20: { text: '已成功', color: 'success' },
30: { text: '审核失败', color: 'warning' }
}
},
{
title: '常用服务',
className: 'text-center',
index: 'oftenUsedServices',
type: 'enum',
enum: { 10: '整车发货', 20: '大宗发货' }
},
{ title: '推广业务员', className: 'text-center', index: 'promotersTelephone' },
{
title: '操作',
fixed: 'right',
width: '180px',
className: 'text-center',
buttons: [{ text: '查看', click: _record => this.View(_record) }]
}
];
}
initAdminST(): STColumn[] {
return [
{ title: '企业名称', className: 'text-center', index: 'enterpriseName' },
{ title: '当前管理员', className: 'text-center', index: 'contacter' },
{ title: '当前管理员手机号', className: 'text-center', render: 'mobile' },
{ title: '转授对象', className: 'text-center', index: 'promotersTelephone' },
{ title: '转授对象手机号', className: 'text-center', index: 'promotersTelephone' },
{ title: '申请时间', className: 'text-center', index: 'createTime' },
{
title: '状态',
className: 'text-center',
index: 'approvalStatus',
type: 'badge',
badge: {
10: { text: '待审核', color: 'processing' },
20: { text: '已成功', color: 'success' },
30: { text: '审核失败', color: 'warning' }
}
},
{
title: '操作',
fixed: 'right',
width: '180px',
className: 'text-center',
buttons: [{ text: '审核', click: _record => this.View(_record) }]
}
];
}
/**
* 初始化查询表单
*/
initSF(): SFSchema {
return {
properties: {
expand: { type: 'boolean', ui: { hidden: true } },
enterpriseName: {
title: '企业名称',
type: 'string',
ui: {
placeholder: '请输入'
}
},
contactName: {
title: '联系人',
type: 'string',
ui: {
placeholder: '请输入',
visibleIf: {
expand: (value: boolean) => this.tabType === 1
}
}
},
contactName2: {
title: '管理员',
type: 'string',
ui: {
placeholder: '请输入',
visibleIf: {
expand: (value: boolean) => this.tabType !== 1
}
}
},
mobile: {
title: '手机号',
type: 'string',
format: 'mobile',
maxLength: 11,
ui: {
placeholder: '请输入'
}
},
lockedStatus: {
type: 'string',
title: '状态',
enum: [
{ label: '全部', value: '' },
{ label: '正常', value: 0 },
{ label: '冻结', value: 1 }
],
default: '',
ui: {
widget: 'select',
visibleIf: {
expand: (value: boolean) => value
}
}
}
}
};
}
}