0.0.5 • Published 2 years ago
@gsjc/intelli-audit v0.0.5
@gsjc/intelli-audit
@gsjc/intelli-audit
提供GSCloud智能审核模块的表单部分的前端组件,隶属于JC项目。
安装
npm i @gsjc/intelli-audit
拷贝文件文件夹./node_modules/@gsjc/intelli-audit/assets/apps
至Web服务器目录,确保http://$server:$port/apps/jc/common/images/iaf/sidebarwindow-intelliCheck-top-bg.svg
等资源可访问。
安装包还提供了SystemJS格式文件。如果以SystemJS加载资源,确保http://$server:$port/apps/jc/common/@gsjc/intelli-audit.js
可访问。
文档
前端组件可以分别以静态组件、动态组件加载器和动态模块加载器三种方式集成到应用。
使用静态组件
引入模块
import { IAFModule } from '@gsjc/intelli-audit';
@NgModule({
imports: [
...
IAFModule
]
})
class YourModule {}
引入组件
import { Component, ViewChild } from '@angular/core';
import { IAFComponent, IAFRepository, BillData } fro
@Component({
selector: 'b-comp',
template: `
<div *ngIf="showAudit">
<jc-intelli-audit (onShow)="componentOnChow($event)"></jc-intelli-audit>
</div>
`
})
export class YourComponent {
showAudit: boolean;
@ViewChild(IAFComponent) iafCom : IAFComponent;
constructor(
private repository: IAFRepository
) {
this.showAudit = false;
}
ngOnInit() {
const billType = "CostPlan";
const financeYear = "";
this.repository.init(billType, financeYear).subscribe( result => this.showAudit = result);
}
componentOnShow(isShowed) {
const billData: BillData = {
id: "f3119804-cf29-456c-aa63-acfbecb67779",
code: "2022-10-14 15:48:05",
userId: "59ff6b26-70a1-4426-8b85-4d5fc8989509",
createDate: "2022-10-14 15:48:05",
companyId: "f8d4733f-e8fa-43e7-ba24-ecf52a7d3004"
};
if (isShowed) {
this.repository.create(billData).subscribe(record => {
this.iafCom.loadData(record);
this.repository.check(billData.id).subscribe(auditResult => {
console.log('Audit Result: ' + auditResult);
});
});
}
}
}
使用动态组件
引入模块
import { IAFModule } from '@gsjc/intelli-audit';
@NgModule({
imports: [
...
IAFModule
]
})
class YourModule {}
调用服务
import { IAFService } from '@gsjc/intelli-audit';
export class YourService {
constructor(
private iafService: IAFService
) { }
ngOnInit() {
const billType = "CostPlan";
const billId = "267c76db-f717-486e-b0ff-6b5a6d8ef99e";
const billCode = "2022-10-14 15:48:05";
const billUserId = "59ff6b26-70a1-4426-8b85-4d5fc8989509";
const billCompanyId = "f8d4733f-e8fa-43e7-ba24-ecf52a7d3004";
const billCreateDate = "2022-10-14 15:48:05";
const financeYear = "2022";
const containerElementId = "#root-layout";
this.iafService.audit(billType, billId, billCode, billUserId, billCompanyId, billCreateDate, financeYear, containerElementId).subscribe(
result => {
console.log("Audit Result: " + result);
}
);
}
}
使用动态模块
确保http://$server:$port/apps/jc/common/@gsjc/intelli-audit.js
静态JS资源可访问。
引入模块
...
import { IAFClientModule } from '@gsjc/intelli-audit';
@NgModule({
imports: [
...
IAFClientModule
]
})
YourModule
调用服务
import { IAFClient } from '@gsjc/intelli-audit';
export class YourService {
constructor(
private iafClient: IAFClient
) { }
ngOnInit() {
const billType = "CostPlan";
const billId = "267c76db-f717-486e-b0ff-6b5a6d8ef99e";
const billCode = "2022-10-14 15:48:05";
const billUserId = "59ff6b26-70a1-4426-8b85-4d5fc8989509";
const billCompanyId = "f8d4733f-e8fa-43e7-ba24-ecf52a7d3004";
const billCreateDate = "2022-10-14 15:48:05";
const financeYear = "2022";
const containerElementId = "#root-layout";
this.iafClient.audit(billType, billId, billCode, billUserId, billCompanyId, billCreateDate, financeYear, containerElementId).subscribe(
result => {
console.log("Audit Result: " + result);
}
);
}
}
API
IAFModule
智能审核模块,对外提供智能审核组件和智能审核服务。
class IAFModule {
}
包括:
IAFComponent
IAFService
IAFRepository
IAFClientModule
智能审核客户端模块
class IAFClientModule { }
包括:
IAFClient
IAFComponent
智能审核组件
class IAFComponent {
/**
* 悬浮窗收折事件
*/
@Output() onShow: EventEmitter<boolean>;
/**
* 加载数据
* @param record 审核记录
*/
loadData(record: IAFCheckRecord): void { }
}
IAFRepository
智能审核仓储
class IAFRepository {
/**
* 初始
* @param formType 单据类型
* @param financeYear 财务年度
* @returns 是否配置智能审核
*/
init(formType: string, financeYear?: string): Observable<boolean> { }
/**
* 创建单据审核记录
* @param data 单据数据
* @returns 单据审核记录
*/
create(data: BillData): Observable<IAFCheckRecord> { }
/**
* 检索单据审核记录
* @param id 单据内码
* @param fanm 未知
* @returns 单据审核记录
*/
retrieve(id: string): Observable<IAFCheckRecord> { }
/**
* 获取单据审核结果
* @param id 单据内码
* @returns 是否审核通过
*/
check(id: string): Observable<boolean> { }
}
IAFService
智能审核服务
IAFService.audit,获取智能审核报告并展示悬浮窗
class IAFService {
/**
* 获取智能审核报告并展示悬浮窗,采用动态组件加载的方式
* @param billType 单据类型
* @param billId 单据标识
* @param billCode 单据编号
* @param billUserId 制单人内码
* @param billCompanyId 单位内码
* @param billCreateDate 制单日期
* @param financeYear 财务年度
* @param containerElementId DOM容器元素标识
*/
audit(billType, billId, billCode, billUserId, billCompanyId, billCreateDate, financeYear, containerElementId): Observable<boolean> { }
}
IAFClient
智能审核前端客户端
class IAFClient {
/**
* 获取智能审核报告并展示悬浮窗,采用动态模块加载的方式
* @param billType 单据类型
* @param billId 单据标识
* @param billCode 单据编号
* @param billUserId 制单人内码
* @param billCompanyId 单位内码
* @param billCreateDate 制单日期
* @param financeYear 财务年度
* @param containerElementId DOM容器元素标识
*/
audit(billType: string, billId: string, billCode: string, billUserId: string, billCompanyId: string, billCreateDate: string, financeYear: string, containerElementId: string): Observable<boolean> { }
}
支持
email: ji.weipeng@foxmail.com