fastlion-amis
Version:
一种MIS页面生成工具
637 lines (636 loc) • 18.8 kB
TypeScript
/// <reference types="shell" />
import { ShellResult } from './shell';
export declare type cameraRect = {
x: number;
y: number;
width: number;
height: number;
widthScreen: number;
heightScreen: number;
};
export declare type OfflineImg = {
tableName: string;
primaryKey: string;
primaryValue: string;
fieldName: string;
};
export declare type DeviceInfo = {
model: string;
name: string;
version: string;
versionName: string;
vendor: string;
density: number;
resolutionWidth: number;
resolutionHeight: number;
uuid: string;
scale: number;
isSupportFinger: boolean;
isTerminal: boolean;
};
declare type GPS = {
longtitude: number;
latitude: number;
adress: string;
contry: string;
province: string;
type: number;
};
export interface CompanyInfo {
envUrl: string;
msg?: string;
}
export declare type ImgInfo = {
dataurl: string;
filename: string;
};
export interface FLColumn {
dataType: string;
textAlign: number;
fieldName: string;
fieldCaption: string;
colspan: number;
rowspan: number;
children?: FLColumn[];
}
export interface FileUiObj {
fileName: string;
fileType: 'xlsx' | 'csv';
columns: FLColumn[];
pageHeader: string;
pageFooter: string;
}
export interface FileExportOver {
type: 0 | 1;
}
interface IChooseImage {
count?: number;
sizeType?: Array<'original' | 'compressed'>;
sourceType: 'album' | 'camera';
type?: string;
}
export interface IChooseFile {
count?: number;
type?: 'all' | 'video' | 'image' | 'file' | string;
}
export interface ITranslateText {
path: string;
}
interface IPlayVoice {
path: string;
playType: 1 | 2;
}
export interface ExternalUrlParms {
externalUrl: string;
fileName: string;
handleType: string;
}
export interface H5PrintParams {
printer: string;
count: number;
width: number;
domWidth: number;
height: number;
domHeight: number;
content: string;
status: number;
index: number;
itemFlag: string;
landscape: boolean;
itemCaption: string;
scale: number;
}
export declare class Shell {
private constructor();
/**
* 判断是否在壳环境
*/
static hasShell(): boolean;
/**
* window.onerror发送报错信息
*/
static sendError(content: string): Promise<ShellResult<unknown>>;
/**
*
* @param downloadAdd
*/
static restartApplication(): Promise<ShellResult<unknown>>;
/**
*
* @param code
*/
static setDownLoadUrl(downloadAdd: string): Promise<ShellResult<{
msg: string;
}>>;
/**
* 修改客户编码
* @param {string} code 客户编码
* @return {Promise<CompanyInfo>} 返回设备信息
*/
static toCompany(code: string): Promise<ShellResult<CompanyInfo>>;
static getCompanyCode(): Promise<ShellResult<{
companyCode: string;
}>>;
/**
* 获取设备信息
* @return {Promise<DeviceInfo>} 返回设备信息
*/
static getDevice(): Promise<ShellResult<DeviceInfo>>;
static wechatinLogin(): Promise<ShellResult<{
content: string;
msg: string;
}>>;
/**
* ping 网络检测
* @param data 多组ping数据
* @param success 成功回调
* @param info info为false回调
* @param fail 失败回调
*/
static startPing(data: obj<any>, success: ShellDoneHandler<{
content: obj[];
macAddress: any;
}>, info?: ShellDoneHandler<{
content: string;
}>, fail?: ShellFailHandler): boolean;
/**
* 操作PC多开的数据
* @param companyCode 公司编号
* @param environment 环境的MD5值
* @param key 环境下需要保存的key值,如果已经存在,则覆盖
* @param value 需要保存的值
* @param type //操作类型, 0表示查询,1表示新增,2表示删除,其它返回失败信息
*/
static moreOpenOperat({ companyCode, environment, key, value, type }: {
companyCode?: string;
environment?: any;
key?: string;
value?: string;
type: 0 | 1 | 2;
}): Promise<ShellResult<unknown>>;
/**
* 打开扫码功能
* @param {number} type 默认0,表示全部识别,1表示只识别英文和数字,2表示只识别数字,3表示只识别英文
* @param btn 可配置input(手动输入),voice(语音识别),image(图像识别)。
*/
static getScanCode(type?: 0 | 1 | 2 | 3, btn?: any): Promise<ShellResult<{
content: string;
msg: string;
scanMode?: string;
}>>;
/**
* 获取gps信息(Android,ios)
*/
static getGPS(): Promise<ShellResult<{
gps: obj<GPS>;
msg: string;
}>>;
/**
* 下载附件
* @param {string} url 附件地址
* 1保存 0:打开
* @return {Promise<ShellResult<{msg: string}>>}
*/
static download(url: string, name?: string, type?: number): Promise<ShellResult<{
msg: string;
}>>;
/**
* 打开网络文件
* @param {string} url 文件路径
*/
static openNetFile(url: string, fileName?: string): Promise<ShellResult<{
msg: string;
}>>;
/**
* 打开文件
*/
static openFile(type: number, path: string, params: string): Promise<ShellResult<{
msg: string;
}>>;
/**
* 保存图片
*/
static saveImg(img: string): Promise<ShellResult<{
msg: string;
}>>;
/**
*
* @param "shareType": String, //分享类型,wx,qq
* @param "content": String, //文字描述。
* @param "FileData": String, //图片也是文件的一种,存放data数据
* @param "url": String //链接
*/
static shareInfo(type: string, content: string, img: string, url: string): Promise<ShellResult<{
msg: string;
}>>;
/**
* 软件检测
*/
static checkSoftInfo(data: any): Promise<ShellResult<{
msg: string;
}>>;
/**
* 打印标签
* @param {string} blob 图片数据,base64格式
* @param {number} pieces 打印份数
* @param {string} driveName 打印机编码
* @param {number} width 纸张宽度
* @param {number} height 纸张高度
*/
/**
* 打印标签标签UI设置
* @param data 标签UI设置
*/
static setLabelUI(data: any, baseUrl: string): Promise<ShellResult<{
msg: string;
}>>;
/**
* 打印标签设置用户的配置
* @param data 用户的配置
*/
static setUserConfig(data: any): Promise<ShellResult<{
msg: string;
}>>;
/**
* 打印标签设置标签的数据
* @param dataList 数据
* @param meta 列名
*/
static setLabelData(data: obj): Promise<ShellResult<{
msg: string;
}>>;
/**
* 打印标签预览
* @param {number} pageIndex 预览的页数page
*/
static labelPreview(pageIndex: number): Promise<ShellResult<{
msg: string;
hasNextPage: boolean;
filePath: string[];
}>>;
/**
* 打印标签
* @param {number} printCount 打印份数
*/
static labelPrint(): Promise<ShellResult<{
msg: string;
}>>;
/**
* 清除上述的标签ui、用户设置、标签数据
*/
static clearLabelData(): Promise<ShellResult<{
msg: string;
}>>;
/**
* 批量打印文件
* @param {string} printer 打印机名称
* @param {Array<{name: string, filePath: string, count: number}>} printData 打印内容
* name文件名称,filePath文件路径,count打印份数
*/
static filePrint(printer: string, printData: Array<{
name: string;
filePath: string;
count: number;
}>): Promise<ShellResult<{
msg: string;
}>>;
/**
* 获取打印机列表信息
*/
static getPrinters(): Promise<ShellResult<{
driveList: Array<{
driveName: string;
driveCode: number;
}>;
}>>;
/**
* 推送消息注册
* @param flag 使用信鸽推送传入推送标识flag给壳注册,并把flag发送给后端(旧版使用的是(登录环境+用户名)MD5)
* 接收apns时flag不用传,调用信鸽注册时要传(.....)
* @return 返回值apns 是推送的pushId,发送给后端
*/
static registMessage(flag: string): Promise<ShellResult<{
apns: string;
}>>;
/**
* 图片压缩
*/
static getAttachment(data: {
maxHeight: number;
maxWidth: number;
maxSize: number;
minSize: number;
maxValue: number;
minValue: number;
multi: boolean;
type: number;
rect: cameraRect;
count: number;
offline?: {
tableName: string;
primaryKey: string;
primaryValue: string;
fieldName: string;
};
}, info: ShellDoneHandler<ImgInfo>, success: ShellDoneHandler<ImgInfo>, fail?: ShellFailHandler): boolean;
/**
* 打开调试工具(pc,Android,ios)
*/
static openDebug(): Promise<ShellResult<{}>>;
/**
* 指纹考勤长链接,进入页面时调用一次
* 只走success
*/
static openFinger(type: 0 | 1 | undefined, success: any, info: any): boolean;
/**
* 将指纹插入壳数据库
*/
static addFinger(userid: string, matchFinger: string, fingerType: number): Promise<ShellResult<unknown>>;
static closeFinger(): Promise<ShellResult<unknown>>;
/**
* 获取指纹 info调用形式
* @param {number} type 指纹类型;0: 匹配校验指纹, 1: 注册指纹; 默认1;
* @param success 成功回调
* @param info 实时回调
* @param fail 失败回调
*/
static fingerGet(type: 0 | 1 | undefined, success: ShellDoneHandler<{
fingerType: number;
finger: string;
}>, info?: ShellDoneHandler<{
text: string;
}>, fail?: ShellFailHandler): boolean;
static cancelFinger(fingerType: number): Promise<ShellResult<{
msg: string;
}>>;
/**
* 指纹验证
* @param {string} enterFinger 用户输入的指纹
* @param {string} matchFinger 本地需要匹配的指纹
* @param {string} fingerType 是那一种指纹器,值为0或1或2
*/
static verifyFinger(enterFinger: string, matchFinger: string, fingerType: number): Promise<ShellResult<{
matched: boolean;
}>>;
/**
* android清除历史
*/
static clearHistory(): Promise<ShellResult<unknown>>;
/**
* 卡西欧盘点上传
*/
static casioUpload(data: {
port: string;
speed: string;
url: string;
token: string;
}, success: ShellDoneHandler, fail: ShellFailHandler): boolean;
/**
* 卡西欧盘点下载
*/
static casioDownLoad(data: {
port: string;
speed: string;
url: string;
token: string;
}, success: ShellDoneHandler, fail: ShellFailHandler): boolean;
/**
* 截屏
*/
static screenShot(): Promise<ShellResult<unknown>>;
/**
* 开始录音
* @param type 类型,如果是0,只在结束的时候返回结果,如果是1,返回过程
*/
static startVoice(type: number | undefined, success: ShellDoneHandler, fail: ShellFailHandler, info: ShellDoneHandler): boolean;
/**
* 停止录音
*/
static stopVoice(): Promise<ShellResult<unknown>>;
/**
* 朗读文字
* @param content 要朗读的文字
*/
static readVoice(content: any): Promise<ShellResult<unknown>>;
/**
* 获取系统剪贴板的内容
*/
static getClipboardData(): Promise<ShellResult<{
content: string;
}>>;
/**
* 建表
* @param tableName 表名
* @param key 主键名称
*/
static execCreateTable(tableName: string, key: string): Promise<ShellResult<unknown>>;
/**
* 新增数据
* @param tableName 表名
* @param key 主键名称
* @param insertData 新增的数据
*/
static execInsert(tableName: string, insertData: obj[], key: string): Promise<ShellResult<unknown>>;
/**
* 查找表所有数据 或 单条数据
* @param tableName 表名
* @param key 主键名称 可不传
* @param keyValue 主键值 可不传
* 如果不传则代码查找表中所有数据
*/
static execFind(tableName: string, keyValue?: string, key?: string): Promise<ShellResult<{
content: string;
}>>;
/**
* 删除数据 或 表
* @param tableName 表名
* @param key 主键名称 可不传
* @param keyValue 主键值 可不传
* 如果不传则代码删除所有数据
*/
static execDelete(tableName: string, keyValue?: string, key?: string): Promise<ShellResult<unknown>>;
/**
* 更新数据
* @param tableName 表名
* @param key 主键名称
* @param updateData 要更新的数组
*/
static execUpdate(tableName: string, updateData: obj[], key: string): Promise<ShellResult<unknown>>;
/**
* 下载离线资源包
*/
static downloadImgZip(url: string, method: string, requestParam: obj): Promise<ShellResult<unknown>>;
/**
* 离线上传图片
*/
static offlineUloadImg(tableName: string, url: string, method: string): Promise<ShellResult<unknown>>;
/**
* 离线删除图片
*/
static deleteFile(tableName: string, primaryKey?: string, primaryValue?: string, fieldName?: string, path?: string): Promise<ShellResult<unknown>>;
/**
* 导入读取Excel
*/
static readExcel(url: string): Promise<ShellResult<{
totalNumber: number;
}>>;
/**
* 获取已导入的Excel的数据
*/
static getExcelData(startIndex: number, endIndex: number): Promise<ShellResult<{
data: obj<any>[];
totalNumber: number;
}>>;
/**
* 删除已导入的Excel的数据
*/
static clearExcel(): Promise<ShellResult<unknown>>;
/**
* 离线上传图片
*/
static setBadge(count: number): Promise<ShellResult<unknown>>;
/**
* 远程协助
*/
static remoteHelpStart(data: {
canControl?: boolean;
x?: number;
y?: number;
width?: number;
height?: number;
}): Promise<ShellResult<unknown>>;
/**
* 隐藏录制
*/
static hideRecord(): Promise<ShellResult<unknown>>;
/**
* 结束远程协助
*/
static remoteHelpStop(success: ShellDoneHandler, fail: ShellFailHandler): boolean;
/**
* 远程控制
*/
static remoteControl(): Promise<ShellResult<unknown>>;
/**
* 通知终端连接 socket
*/
static connectSocket(data: obj): Promise<ShellResult<unknown>>;
/**
* 通知终端断开 socket
*/
static closeSocket(): Promise<ShellResult<unknown>>;
/**
* 导出文件,发送ui给终端
*/
static jsExcelUi(data: FileUiObj): Promise<ShellResult<unknown>>;
/**
* 导出文件,传递数据给终端
*/
static jsExcelData(data: obj[]): Promise<ShellResult<unknown>>;
/**
* 导出文件,结束
*/
static jsExcelOver(data: FileExportOver): Promise<ShellResult<unknown>>;
/**
* 沟通反馈选择图片
*/
static chooseImage<T>(data: IChooseImage): Promise<ShellResult<T>>;
/**
* 上传
* path 要上传的临时文件地址
* url 上传的服务器地址
*/
static uploadFile<T>(data: {
path: string;
url: string;
chunkUpload?: boolean;
formData?: obj<any>;
header?: obj<any>;
}, info: ShellDoneHandler<{
percent: number;
}>, success: ShellDoneHandler<T>, fail?: ShellFailHandler): boolean;
/**
* @description 开始录音
*/
static startRecord(): Promise<ShellResult<unknown>>;
/**
* @description 取消录音
*/
static cancelRecord(): Promise<ShellResult<unknown>>;
/**
* @description 结束录音
*/
static stopRecord(): Promise<ShellResult<{
path: string;
time: number;
}>>;
/**
* @description 选择文件
*/
static chooseFile<T>(data: IChooseFile): Promise<ShellResult<T>>;
/**
* @description 语音转文字
* @path 音频地址
*/
static translateText(data: ITranslateText): Promise<ShellResult<{
text: string;
}>>;
/**
* @description 语音播放
* @path 音频地址
* @playType 1 扬声器 2听筒
*/
static playVoice<T>(data: IPlayVoice): Promise<ShellResult<T>>;
/**
* @description 停止播放语音
*/
static stopPlayVoice(): Promise<ShellResult<unknown>>;
static handleExternalUrl(data: ExternalUrlParms): Promise<ShellResult<{
msg: string;
}>>;
static h5Print(data: H5PrintParams): Promise<ShellResult<unknown>>;
static pdaEnableScan(isEnabled: boolean): Promise<ShellResult<unknown>>;
/**
* 预览文件
*/
static previewFile(data: {
urls: string[];
current?: number;
}): Promise<ShellResult<unknown>>;
/**
* 打开拍照
*/
static openCamera(count: number): Promise<ShellResult<{
tempFiles: any[];
}>>;
/**
* 文件压缩
*/
static compressImage(data: {
url: string;
maxHeight?: number;
maxWidth?: number;
maxSize?: number;
minSize?: number;
maxValue?: number;
minValue?: number;
}): Promise<ShellResult<{
tempFile: any;
}>>;
/**
* 下载文件流
*/
static downloadFileStream(data: {
url: string;
params?: obj<any>;
header?: obj<any>;
}): Promise<ShellResult<unknown>>;
/**
* android预览pdf
*/
static previewPdf(data: {
url: string;
name: string;
}): Promise<ShellResult<unknown>>;
}
export {};