Modules
Cipher
- Cipher
- .useSm2()
- .useSm3(msg, [options]) ⇒
* - .useSm4Encrypt(msg, key, [options]) ⇒
Uint8Array - .useSm4Decrypt(encryptData, key, [options]) ⇒
Uint8Array
Cipher.useSm2()
国密 sm2
Kind: static method of Cipher
Cipher.useSm3(msg, [options]) ⇒ *
国密 sm3 加密
Kind: static method of Cipher
| Param | Type | Default | Description |
|---|---|---|---|
| msg | string | 密码信息 | |
| [options] | Object | {} |
Cipher.useSm4Encrypt(msg, key, [options]) ⇒ Uint8Array
国密 sm4 加密
Kind: static method of Cipher
| Param | Type | Default | Description |
|---|---|---|---|
| msg | string | 密码信息 | |
| key | string | 秘钥 | |
| [options] | Object | {} |
Cipher.useSm4Decrypt(encryptData, key, [options]) ⇒ Uint8Array
国密 sm4 解密
Kind: static method of Cipher
| Param | Type | Default | Description |
|---|---|---|---|
| encryptData | string | 加密信息 | |
| key | string | 秘钥 | |
| [options] | Object | {} |
Datetime
- Datetime
- .useDayjs(date, [format]) ⇒
dayjs.Dayjs - .useDateFormat(date, [format]) ⇒
string - .useDateUnix(date) ⇒
number|string
- .useDayjs(date, [format]) ⇒
Datetime.useDayjs(date, [format]) ⇒ dayjs.Dayjs
根据格式创建 Dayjs 对象
Kind: static method of Datetime
| Param | Type | Default | Description |
|---|---|---|---|
| date | string | number | 日期字符 | |
| [format] | string | null | 日期格式 |
Datetime.useDateFormat(date, [format]) ⇒ string
格式化日期
Kind: static method of Datetime
| Param | Type | Default | Description |
|---|---|---|---|
| date | dayjs.Dayjs | Date | 日期对象 | |
| [format] | string | "YYYY-MM-DD HH:mm" | 日期格式 |
Datetime.useDateUnix(date) ⇒ number | string
获取日期的 Unix 时间戳
Kind: static method of Datetime
| Param | Type | Description |
|---|---|---|
| date | dayjs.Dayjs | Date | 日期对象 |
Form
Form.formLabel
表单布局
Kind: static constant of Form
Properties
| Name | Type | Description |
|---|---|---|
| formLabel.commonLabelCol | Object | { span: 8, xxl: 6 } |
| formLabel.commonWrapperCol | Object | { span: 12, xxl: 14 } |
| formLabel.commonWrapperOffset | Object | { xs: { offset: 8, span: 12 }, xxl: { offset: 6, span: 14 } } |
| formLabel.commonLabelFullCol | Object | { span: 8, xxl: 6 } |
| formLabel.commonWrapperFullCol | Object | { span: 16, xxl: 18 } |
| formLabel.commonWrapperFullOffset | Object | { xs: { offset: 8, span: 16 }, xxl: { offset: 6, span: 18 } } |
| formLabel.commonLabelPartCol | Object | { span: 4, xxl: 3 } |
| formLabel.commonWrapperPartCol | Object | { span: 20, xxl: 21 } |
| formLabel.commonWrapperPartOffset | Object | { xs: { offset: 4, span: 20 }, xxl: { offset: 3, span: 21 } } |
Form.useHiddenForm(options) ⇒ HTMLFormElement
创建一个隐藏的表单
Kind: static method of Form
| Param | Type | Default | Description |
|---|---|---|---|
| options | Object | ||
| options.url | string | 请求地址 | |
| options.data | Object | 发送的数据 | |
| [options.method] | string | "post" | 请求方法 |
| [options.csrfToken] | string | null | CSRF Token |
Form.useProcessStatus(res, ops)
处理请求结果
Kind: static method of Form
| Param | Type | Description |
|---|---|---|
| res | object | 请求结果 |
| res.status | string | 请求结果状态 |
| res.result | * | 请求结果信息 |
| ops | Object.<string, (string|function())> | 状态的处理对象 |
Form.useProcessStatusSuccess(res, success)
处理正确请求结果
Kind: static method of Form
| Param | Type | Description |
|---|---|---|
| res | object | 请求结果 |
| res.status | string | 请求结果状态 |
| res.result | * | 请求结果信息 |
| success | string | function | 状态的处理对象 |
Form.useFormFail(e)
处理表单提交失败
Kind: static method of Form
| Param | Type |
|---|---|
| e | * |
Form.useFormFormat(form, [format]) ⇒ Object
处理表单数据
Kind: static method of Form
| Param | Type | Description |
|---|---|---|
| form | Object | |
| [format] | Object | 需要处理的类型 |
| [format.date] | boolean | string | function | true: 转成时间戳,string: 为 Format 格式, 如 "YYYY-MM-DD", function: 自定义处理函数, 参数为 dayjs 对象 |
| [format.boolean] | boolean | 布尔值处理, 如果开启则 true 转成 1, false 转成 0 |
| [format.attachment] | string | function | string: 附件字段名, function: 自定义处理函数, 参数为附件对象 |
Interact
Interact.useModalConfirm(msg, [onOk], [loading], [onCancel]) ⇒ *
确认弹窗
Kind: static method of Interact
| Param | Type | Default | Description |
|---|---|---|---|
| msg | string | 提示信息 | |
| [onOk] | function | | 确认回调 |
| [loading] | boolean | false | 是否异步加载 |
| [onCancel] | function | | 取消回调 |
Network
- Network
- static
- .STATUS
- .useFetch([fetcher]) ⇒
Object - .usePage(pagination, refresh, [process]) ⇒
object
- inner
- ~get(url, [config]) ⇒
Promise - ~post(url, data, [config]) ⇒
Promise
- ~get(url, [config]) ⇒
- static
Network.STATUS
请求返回状态码
Kind: static constant of Network
Properties
| Name | Type | Description |
|---|---|---|
| STATUS.STATE_CODE_SUCCESS | string | SUCCESS 成功 |
| STATUS.STATE_CODE_FAIL | string | FAIL 失败 |
| STATUS.STATE_CODE_NOT_FOUND | string | NOT_FOUND 找不到资源 |
| STATUS.STATE_CODE_INFO_NOT_COMPLETE | string | INCOMPLETE 信息不完整 |
| STATUS.STATE_CODE_NOT_ALLOWED | string | NOT_ALLOWED 无权限 |
Network.useFetch([fetcher]) ⇒ Object
通用 AJAX 请求
Kind: static method of Network
| Param | Type | Description |
|---|---|---|
| [fetcher] | Object | 用于存储请求状态的对象 |
Network.usePage(pagination, refresh, [process]) ⇒ object
分页请求
Kind: static method of Network
Returns: object - pagination 分页对象
| Param | Type | Description |
|---|---|---|
| pagination | object | 分页对象 |
| pagination.uri | string | 请求地址 |
| [pagination.params] | object | 请求参数 |
| [pagination.page] | number | 当前页码 |
| pagination.finishedText | string | 加载完毕文本 |
| pagination.loading | boolean | 加载状态 |
| pagination.finished | boolean | 加载完毕 |
| pagination.error | boolean | 是否错误 |
| pagination.errorText | string | 错误文本 |
| pagination.empty | boolean | 是否无内容 |
| pagination.items | array | 分页数据 |
| refresh | boolean | 是否刷新 |
| [process] | function | 数据处理函数 |
Network~get(url, [config]) ⇒ Promise
get请求
Kind: inner method of Network
| Param | Type | Description |
|---|---|---|
| url | ||
| [config] | Object | axios config |
Network~post(url, data, [config]) ⇒ Promise
post请求
Kind: inner method of Network
| Param | Type | Description |
|---|---|---|
| url | string | |
| data | Object | |
| [config] | Object | axios config |
Uitls
Uitls.useLabelFromOptionsValue(value, options) ⇒ string
从 options 中根据 value 获取 label
Kind: static method of Uitls
| Param | Type | Description |
|---|---|---|
| value | string | number | 值 |
| options | Array | 选项 |
Uitls.useFindLabelsInValues(options, values, [adapter]) ⇒
从嵌套的 options 中根据 value 获取 label, 如 [1, 3] => ["东", "南"]
Kind: static method of Uitls
Returns: Array
| Param | Type | Default | Description |
|---|---|---|---|
| options | Array | 嵌套的选项 | |
| values | Array | 需要查找的值 | |
| [adapter] | Object | {value: "value",label: "label",children: "children"} | 选项适配器 |
Uitls.useFindLabelsFromPath(options, path, [adapter]) ⇒
从嵌套的 options 中根据 value 获取 label 路径, 如地区路径: [440000, 440100, 440113] => ["广东省", "广州市", " 番禺区"]
Kind: static method of Uitls
Returns: Array
| Param | Type | Default | Description |
|---|---|---|---|
| options | Array | 嵌套的选项 | |
| path | Array | 需要查找的值的路径数组 | |
| [adapter] | Object | {value: "value",label: "label",children: "children"} | 选项适配器 |
Uitls.useFindParentLabels(options, value, adapter) ⇒ *
从嵌套的 options 中根据 value 获取 label 路径, 如地区路径: 440113 => ["广东省", "广州市", " 番禺区"]
Kind: static method of Uitls
| Param |
|---|
| options |
| value |
| adapter |
Uitls.useFindParentValues(options, value, adapter) ⇒ *
从嵌套的 options 中根据 value 获取整个 values 路径, 如地区路径: 440113 => [440000, 440100, 440113]
Kind: static method of Uitls
| Param |
|---|
| options |
| value |
| adapter |