import { construct } from "@aximario/json-tree"; import { IBaseResponse, TBaseResponse } from "../base/IBaseResponse"; import _ from "lodash"; import { TSkdwType, USER_ACNO_DATA_TYPE_NULL } from "../const/const_user_acno"; import { TWtui } from ".."; export interface IViewCtrlResponse extends IBaseResponse { asParent: number; ctrlCode: string; ctrlName: string; ctrlPara: string; compPath: string; entityID: string; formType: string; jsMethod: string; metaData: string; parentID: number; queuesBy: number; showCode: string; showName: string; uniqueID: number; userIndx: number; view4url: string; viewCode: string; viewIcon: string; viewMemo: string; viewName: string; viewPara: string; vitualID: number; whoBuild: number; withPara: string; wtuiMain: number; labelVal: string; viewIndx: number; withParaConv: IViewCtrlResponseWithParaConv; microURL: string; //虚拟字段 title: string; name: string; icon: string; } export class TViewCtrlResponse extends TBaseResponse implements IViewCtrlResponse { asParent: number = 0; ctrlCode: string = ""; ctrlName: string = ""; ctrlPara: string = ""; compPath: string = ""; entityID: string = ""; formType: string = ""; jsMethod: string = ""; metaData: string = ""; parentID: number = 0; queuesBy: number = 0; showCode: string = ""; showName: string = ""; uniqueID: number = 0; userIndx: number = 0; view4url: string = ""; viewCode: string = ""; viewIcon: string = ""; viewMemo: string = ""; viewName: string = ""; viewPara: string = ""; vitualID: number = 0; whoBuild: number = 0; withPara: string = ""; wtuiMain: number = 0; labelVal: string = ""; viewIndx: number = 0; withParaConv: IViewCtrlResponseWithParaConv = new TViewCtrlResponseWithParaConv(); title: string = ""; name: string = ""; icon: string = ""; microURL: string = ""; static toTree(listView: IViewCtrlResponse[]) { listView.forEach((element) => { element.title = element.viewName; element.name = element.view4url; element.icon = `iconfont ${element.viewIcon}`; element.children = []; }); return construct(listView, { id: "uniqueID", pid: "parentID", children: "children" }) as IViewCtrlResponse[]; } static parseJson(withPara: string) { const result: IViewCtrlResponseWithParaConv = new TViewCtrlResponseWithParaConv(); if (_.isEmpty(withPara)) { return result; } try { const temp = JSON.parse(withPara) as TViewCtrlResponseWithParaConv; return _.merge(result, temp); } catch (e: any) {} return result; } static toWtuiNode(viewCtrl: TWtui.IViewCtrlResponse) { const node = new TWtui.TWtuiNodeResponse(); _.merge(node, viewCtrl); node.nodeName = viewCtrl.viewName; node.wtuiView = viewCtrl.uniqueID; return node; } static toListWtuiNode(listViewCtrl: TWtui.IViewCtrlResponse[]) { return listViewCtrl.map((u) => this.toWtuiNode(u)); } } export interface IViewCtrlResponseWithParaConv { routerName: string; auth: boolean; keepAlive: boolean; componentName: string; unitMode: string; skdwType: TSkdwType; defaultKey: string; menuUUID: string; printUrl?: string; gzjgMain?: number; showTab: string | string[]; tabItems?: { key: string; tabsTitle: string; exportExcelFileName: string; }[]; changeUUID?: string; /** 角色名称 */ roleName?: string; /** 用户管理-重置的密码 */ resetPassword?: string; interfaceUUID?: string; //其他页面的UUID pathId?: string; // 附件的dictindx isShowSealName?: boolean; yzhtUUID?: string; //其他页面的UUID outboundMenuUUID?: string; //出库登记菜单的menuUUID,配置在下发功能菜单.取关联单使用 sysclasc: number; taskMain: number; } export class TViewCtrlResponseWithParaConv implements IViewCtrlResponseWithParaConv { routerName: string = ""; auth: boolean = true; keepAlive: boolean = false; componentName: string = ""; unitMode: string = ""; skdwType: TSkdwType = USER_ACNO_DATA_TYPE_NULL; defaultKey: string = ""; menuUUID: string = ""; gzjgMain?: number = 0; showTab: string | string[] = ""; tabItems?: { key: string; tabsTitle: string; exportExcelFileName: string; }[] = []; roleName: string = ""; changeUUID?: string = ""; interfaceUUID?: string = ""; //其他页面的UUID pathId?: string = ""; // 附件的dictindx isShowSealName?: boolean = false; yzhtUUID?: string = ""; //其他页面的UUID outboundMenuUUID?: string = ""; //出库登记菜单的menuUUID,配置在下发功能菜单.取关联单使用 sysclasc: number = 0; taskMain: number = 0; }