import _ from "lodash"; import { Const, TCore } from ".."; import { IPathResponse } from "../core"; import { TFlowDataResponse } from "../flow"; import { ICardMainResponse } from "./ICardMainResponse"; export interface IZcczResponse { whoBuild: number; userIndx: number; zcczIndx: number; parentID: number; hashCode: number; dataLevl: number; dataFrom: number; kjndKJQJ: number; dataStat: number; dataOrdr: number; dataHide: number; dataType: number; dataDate: number; dataTime: number; dataGUID: string; userMain: number; mastName: string; mastGUID: string; createBy: string; createAt: number; updateBy: string; updateAt: number; deleteBy: string; deleteAt: number; queuesBy: number; entityID: string; sourceND: number; menuMain: number; menuUUID: string; unitMain: number; deptMain: number; sqyhText: string; sqbmText: string; flowUndo: number; flowText: string; flowUser: string; /** 申请日期 */ zcczDate: number; /** 流程状态:(0:制单;1:送审;2:终审) */ zcczStat: number; /** 单据类型 */ zcczType: number; /** 单据编号 */ zcczCode: string; /** 待定 */ zcczName: string; /** 申请用途 */ zcczUses: string; /** 备注说明 */ zcczMemo: string; /** 资产数量 */ zcczSize: number; /** 资产原值 */ zcczZcyz: number; /** 累计折旧 */ zcczLjzj: number; /** 资产净值 */ zcczZcjz: number; /** 单位名称 */ unitText: string; /** 挂起状态 */ hideStat: number; lastDate: number; lastTime: number; flowMain: number; flowNode: number; flowStat: number; didFirst: number; lastMemo: string; userName: string; userGUID: string; listCard: ICardMainResponse[]; listPath: IPathResponse[]; /** 虚拟字段 */ cardIndx: ICardMainResponse[] | undefined; validVal: boolean; validMsg: string; } export class TZcczResponse implements IZcczResponse { whoBuild: number = 0; userIndx: number = 0; zcczIndx: number = 0; parentID: number = 0; hashCode: number = 0; dataLevl: number = 0; dataFrom: number = 0; kjndKJQJ: number = 0; dataStat: number = 0; dataOrdr: number = 0; dataHide: number = 0; dataType: number = 0; dataDate: number = 0; dataTime: number = 0; dataGUID: string = ""; userMain: number = 0; mastName: string = ""; mastGUID: string = ""; createBy: string = ""; createAt: number = 0; updateBy: string = ""; updateAt: number = 0; deleteBy: string = ""; deleteAt: number = 0; queuesBy: number = 0; entityID: string = ""; sourceND: number = 0; menuMain: number = 0; menuUUID: string = ""; unitMain: number = 0; deptMain: number = 0; sqyhText: string = ""; sqbmText: string = ""; flowUndo: number = 0; flowText: string = ""; flowUser: string = ""; zcczDate: number = 0; zcczStat: number = 0; zcczType: number = 0; zcczCode: string = ""; zcczName: string = ""; zcczUses: string = ""; zcczMemo: string = ""; zcczSize: number = 0; zcczZcyz: number = 0; zcczLjzj: number = 0; zcczZcjz: number = 0; unitText: string = ""; hideStat: number = 0; lastDate: number = 0; lastTime: number = 0; flowMain: number = 0; flowNode: number = 0; flowStat: number = 0; didFirst: number = 0; lastMemo: string = ""; userName: string = ""; userGUID: string = ""; /** 处置卡片 */ listCard: ICardMainResponse[] = []; listPath: IPathResponse[] = []; /** 虚拟字段 */ cardIndx: ICardMainResponse[] | undefined = undefined; validVal: boolean = false; validMsg: string = ""; static toFlowData(zccz: TZcczResponse): TFlowDataResponse { const result = new TFlowDataResponse(); result.whoBuild = zccz.whoBuild; result.userIndx = zccz.userIndx; result.flowMain = zccz.flowMain; result.flowNode = zccz.flowNode; result.notified = Const.Todo.CONST_STR_TODO_TYPE_TO_ZCCZ_WAIT; result.entityID = zccz.entityID; result.billMain = zccz.zcczIndx; result.billCode = zccz.zcczCode; result.billMemo = zccz.zcczMemo; result.createAt = zccz.createAt; result.mastName = zccz.mastName; result.createBy = zccz.createBy; result.unitMain = zccz.unitMain; result.deptMain = zccz.deptMain; result.menuUUID = zccz.menuUUID; result.flowStat = zccz.zcczStat; return result; } constructor(zccz: Partial = {}) { if (zccz) { _.merge(this, _.pick(zccz, Object.keys(this))); } } static toFlowDatas(zcczs: TZcczResponse[]): TFlowDataResponse[] { return zcczs.map((u) => this.toFlowData(u)); } static toTravel(zccz: TZcczResponse): TCore.ISysTravelResponse { const travel = new TCore.TSysTravelResponse(); travel.whoBuild = zccz.whoBuild; travel.flowMain = zccz.flowMain; travel.flowNode = zccz.flowNode; travel.billUUID = zccz.entityID; travel.billMain = zccz.zcczIndx; travel.billCode = zccz.zcczCode; travel.mastName = zccz.mastName; travel.createBy = zccz.createBy; travel.menuUUID = zccz.menuUUID; return travel; } /** 转换成记录日志需要的数据(第一层,不包含菜单) */ static toTravelData(data?: TZcczResponse | TZcczResponse[]): TCore.ISysTravelResponse[] { if (_.isNil(data)) { return []; } if (_.isArray(data)) { return data.map((u) => { return this.toTravel(u); }); } return [this.toTravel(data)]; } }