yasuo-sdk v1.6.4
yasuo-sdk
此项目提供以下功能: 1. 问题反馈集合 2. Table表格集合 3. 分页 4. 搜索栏 5. 页面整体布局包括 菜单,面包屑 layout等 6. 自定义表单 ...
使用方法:
npm install yasuo-sdk
// main.ts
import YasuoSdk from 'yasuo-sdk'
app.use(YasuoSdk)
发布方法
npm run build
// 更改 package.json version
version: 'x.x.x'
npm publish
feedbackQuestion(问题反馈)
<feedback-question
onHandleClickConfirm={(data: any) => {
handleClickFeedBack(data, 'ok')
}}
onHandleClickCancel={(data: any) => handleClickFeedBack(data, 'cancel')}
fileType="base64"
tips={i18n.global.t(
'仅允许上传jpeg/png图片格式, 且最多支持9张图片 (仅允许上传小于1M的图片,超过请改为截图上传)'
)}
isCurrentUrl
isNeedPaste
visible={feedbackQuestionObj.visible}
/>
属性名 | 说明 | 类型 | 默认值 |
---|---|---|---|
filteType | 所返回的图片格式,当设置为'base64时'返回编码,当设置为file时返回文件对象 | string | base64 |
tips | 反馈框底部备注信息 | stirng | 仅允许上传jpeg/png图片格式, 且最多支持9张图片 |
isCurrentCaptureScreen | 当提交反馈时是否需要截屏当前屏幕 | boolean | false |
isCurrentUrl | 当提交反馈时是否需要当前路由链接 | boolean | false |
isNeedPaste | 是否支持粘贴截图 | boolean | false |
limitNumber | 最大支持图片数量 | number | 9 |
onHandleClickConfirm | 单击确定的回调事件 | Function | |
onHandleClickCancel | 单机取消的回调事件 | Function |
Table(Table页合集)
<Table-index
class="tableIndex"
data={{
searchListData: {
list: [
{
label: '报告类型',
value: 'report_type',
type: 'select',
option: [
{
value: 'function_testing',
label: '功能测试'
},
{
value: 'performance_testing',
label: '性能测试'
}
]
}
],
onQuery: async (params: any) => {
console.log(params, 'params')
const response: any = await service({
url: '/api/v1/test_report/record',
method: 'get',
data: {
page: params?.page || 1,
page_size: params?.page_size || 10,
report_type: params?.report_type,
test_branch: params?.test_branch,
biz_id: 2,
create_user: params?.create_user,
dept_id: 795
}
})
console.log(response, 'roro')
return {
response: response?.results?.data || [],
total: response?.results?.total || 0
}
},
prefix: () => {
return (
<div>
<el-button type="primary">新增测试报告</el-button>
</div>
)
}
// suffix: () => {
// return <div>2222</div>
// }
},
// tableData: [],
stripe: true,
isPage: true,
isSearch: true,
tableColumns: [
{
label: '部门/业务',
prop: 'dept_name'
},
{
label: '报告类型',
prop: 'report_type'
},
{
label: '测试结果',
prop: 'test_result'
}
],
slots: {
header: ({ column, $index }: any) => {
return $index === 0 ? '部门/业务' : column.label
},
default: (record: any) => {
console.log(record, 'roroor')
}
}
}}
/>
属性名 | 说明 | 类型 | 默认值 |
---|---|---|---|
tableColumns | table的列数据 | Array | [] |
stripe | 是否开启斑马纹 | boolean | true |
slots | 请看element-table官方支持 | header default | |
isPage | 是否启用分页 | boolean | true |
isSearch | 是否启用顶部搜索栏 | boolean | true |
searchListData | 如果启用顶不搜索栏则必传 | SearchListType | {} |
SearchList(筛选栏列表)
<SearchListIndex
ref={searchList}
data={{
list: [
{
label: '报告类型',
value: 'report_type',
type: 'select',
option: [
{
value: 'function_testing',
label: '功能测试'
},
{
value: 'performance_testing',
label: '性能测试'
}
]
}
],
onQuery: async (params: any) => {
console.log(params, 'params')
const response: any = await service({
url: '/api/v1/test_report/record',
method: 'get',
data: {
page: params?.page || 1,
page_size: params?.page_size || 10,
report_type: params?.report_type,
test_branch: params?.test_branch,
biz_id: 2,
create_user: params?.create_user,
dept_id: 795
}
})
console.log(response, 'roro')
return {
response: response?.results?.data || [],
total: response?.results?.total || 0
}
},
prefix: () => {
return (
<div>
<el-button type="primary">新增测试报告</el-button>
</div>
)
},
suffix: () => {
return <div>2222</div>
}
}}
onHandleClickConfirm={handleClickConfirm}
onHandleClickCancel={handleClickCancel}
/>
属性名 | 说明 | 类型 | 默认值/返回值 |
---|---|---|---|
list | 筛选栏数据 | listType | [] |
onQuery | 筛选栏筛选接口 | Function | |
prefix | 筛选栏前置自定义 | Function | |
suffix | 筛选栏后置自定义 | Function | |
handleClickConfirm | 点击确定回调 | Function | 筛选条件数据 |
handleClickCancel | 点击重置回调 | Function |
listType:
属性名 | 说明 | 类型 | 默认值/返回值 |
---|---|---|---|
label | label | string | |
value | 绑定值 | string | |
type | 类型 | string | input,select,date,dateTime,cascader |
option | 部份类型需要的option | {value: stirng, label: string}[]> | [] |
Layout(整体结构)
<Layout-index
data={{
route: route.value,
routeList: RouteList,
userInfo: {
name: '亚索',
avatar: ''
},
isLang: true
}}
v-slots={{
container: () => {
return <router-view></router-view>
}
}}
/>
属性名 | 说明 | 类型 | 默认值/返回值 |
---|---|---|---|
routeList | 路由列表 | routeListType[] | [] |
route | vueRoute | vueRouteType | |
userInfo | 用户信息 | userInfoType | {} |
isLang | 是否需要切换语言 | boolean | true |
suffix | 后置自定义显示 | Function |
routeListType:
属性名 | 说明 | 类型 | 默认值/返回值 |
---|---|---|---|
path | 路由地址 | string | ‘/’ |
title | 路由标题 | string | |
icon | 路由图标(iconfly) | stirng | '' |
children | 子路由 | routeListType[] | [] |
menu | 是否在菜单展示 | boolean | true |
userInfoType:
属性名 | 说明 | 类型 | 默认值/返回值 |
---|---|---|---|
name | 用户姓名 | string | ‘’ |
avatar | 用户头像 | string | ’‘ |
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago