### 功能1:表单查询
表单支持类型:
1. input
2. select
3. cascader
4. date (date datetimerange)
表格支持功能:
字符串,图片预览(hover),json解析,数字解析,操作栏,select选择
功能预览图:
![JsonTable预览图](https://upload-images.jianshu.io/upload_images/17538702-2e524aab18777d8e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
以下为组件使用示例 以及配置项示例
```
<JsonTable
:searchColumns="searchColumns"
:tableColumns="tableColumns"
:service="localService"
:options="tabOptions"
@onformchange="handlechange"
@rowselectchange="handleRowSelectChange"
>
<!-- 查询表单与表格中间插槽 -->
<template v-slot:under-search-slot>
<div>
<el-button size="mini" type="primary">新增</el-button>
</div>
</template>
<!-- 操作栏插槽 -->
<template v-slot:op="scope">
<el-button type="danger" size="mini" @click="handleDelete(scope)">删除</el-button>
<el-button type="primary" size="mini" @click="handleCheck(scope)">查看</el-button>
</template>
</JsonTable>
```
Props:
`searchColumns`: 表单查询属性配置
`tableColumns`: 查询结果行字段配置
`service`: 请求,主要是配置查询请求
`options`: 表格设置
`onformchange`: 表单查询项change事件监听 参数为查询属性
`rowselectchange`: 带有select的表格选择时的select监听事件 参数为当前选中项
#### 表单查询属性:searchColumns Array
配置项说明:
label: String 表单项显示名称
prop: String 表单项属性(传给后端的字段)
clearable: Boolean 表单项内容是否可清除
placeholder: String 表单项placeholder
isSelect: Boolean 是否是select框(默认是input)
options: Array Select框和Cascader的options
isCascader: Boolean 是否是级联
isTime: String [date, datetimerange] 日期 或者日期时间范围(默认时间是Date格式内部已做转换处理为YYYY-MM-DD HH:MM:SS格式 如果需要时间戳格式可在组件源码中自行修改)
配置示例:
```
[
{
label: '姓名',
prop: 'name',
clearable: true,
placeholder: "请输入姓名"
},
{
label: '性别',
prop: 'sex',
clearable: true,
placeholder: "请选择",
isSelect: true,
options: [
{
prop: 'male',
name: '男'
},
{
prop: 'female',
name: '女'
}
]
},
{
label: '技能',
prop: 'skill',
clearable: true,
placeholder: "请选择",
isCascader: true,
options: [
{
value: "basic",
label: "Basic",
children: [
{
value: "layout",
label: "Layout 布局"
},
{
value: "color",
label: "Color 色彩"
},
{
value: "typography",
label: "Typography 字体"
},
{
value: "icon",
label: "Icon 图标"
},
{
value: "button",
label: "Button 按钮"
}
]
}
]
},
{
label: '出生日期',
prop: 'born',
clearable: true,
placeholder: "选择日期",
isTime: 'date',
valueFormat: '',
defaultTime: []
}
]
```
#### table表格各属性:
1. options Object 表格展现形式配置
配置项说明:
canCheck: Boolean 表格是否可勾选
hasIndex: Boolean 表格是否有序号
checkFixed: String [left right] 勾选checkbox固定位置
indexFixed: String [left right] 序号固定位置
opW: Number 操作栏宽度(当操作栏按钮较多时需要较宽宽度,默认为150)
autoRequest: Boolean 是否进入页面执行一次数据请求 默认为false
startUpdate: Date.now() // 监听该项有变化时更新请求
配置示例:
```
{
canCheck: true, // 是否可选择
hasIndex: true, // 是否有序号
checkFixed: 'left', // 选择固定位置
indexFixed: 'left', // 表序号固定位置
opW: 150,// 操作栏宽度
autoRequest: true, // 自动请求(第一次加载默认请求)
startUpdate: Date.now()
}
```
2. tableColumns 查询结果行字段配置
属性:tableColumns Array
配置项说明:
prop: String 对应后端返回表格数据字段
label: String 表格当前列名称
width: Number 当前列宽度
expandFunc: Boolean 是否有扩展功能(扩展功能包括图片预览,重写数据等等,当传递imgW,isMultiCell,render时该属性必传)
imgW: Number 图片预览时传递此参数,为预览图片宽度(图片默认是以tooltip展示的)
isMultiCell: Boolean 是否要重写数据(场景:后端返回json字符串,前端需要取其中某一个属性,或者后端给的是0,1这样的标识,需要前端转义为汉字 是 或者否)
render: Function 配合isMultiCell使用参数为当前表格的行数据,可以return可渲染数据,可以参考配置示例
配置示例
```
[
{
prop: 'name',
label: '姓名',
width: 150,
overflow: true
},
{
prop: 'age',
label: '年龄',
width: 150,
overflow: true
},
{ // 图片预览
prop: 'avatar',
label: '头像',
width: 150,
imgW: 300, // 设置该项表示预览图片
expandFunc: true // 是否有扩展功能,启用表格列插槽
},
{
prop: 'sex',
label: '性别',
width: 150,
overflow: true
},
{
prop: 'born',
label: '出生日期',
width: 150,
overflow: true
},
{
prop: 'phone',
label: '电话',
width: 150,
overflow: true
},
{
prop: 'zip',
label: '邮编',
width: 150,
overflow: true
},
{
prop: 'province',
label: '省份',
width: 150,
overflow: true
},
{
prop: 'city',
label: '市区',
width: 150,
overflow: true
},
{
prop: 'address',
label: '地址',
width: 150,
overflow: true
},
{
prop: 'loc',
label: '工位',
width: 150,
overflow: true
},
{
prop: 'createUser',
label: '创建人',
width: 150,
overflow: true
},
{
prop: 'auditUser',
label: '审核人',
width: 150,
overflow: true
},
{
prop: 'order',
label: '订单号',
width: 150,
overflow: true
},
{ // 场景: 后端字段是json字符串,需要前端解析其中某个字段
prop: 'jsonStr',
label: 'json解析',
width: 150,
overflow: true,
expandFunc: true,
isMultiCell: true,
render: (scope) => {
if (JSON.stringify(scope.row) !== '{}') {
return JSON.parse(scope.row.jsonStr).json;
}
return "--";
}
},
{ // 场景: 后端字段是数字0或1, 前端需要自己将数字转成汉字 比如0 待审核 1 已审核
prop: 'status',
label: '状态(0 1)',
width: 150,
overflow: true,
expandFunc: true,
isMultiCell: true,
render: (scope) => {
let status = scope.row.status;
if( status === 0) {
return "待审核";
} else if(status === 1) {
return "已审核";
}
return "--";
}
}
]
```
#### 请求接口配置属性
service Obejct
没有合适的资源?快使用搜索试试~ 我知道了~
基于vue3+elementPlus的后台管理系统模板实现
共63个文件
vue:22个
ts:12个
js:9个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 6 下载量 181 浏览量
2022-03-03
23:10:54
上传
评论 2
收藏 146KB RAR 举报
温馨提示
基于vue3+elementPlus的后台管理系统模板实现
资源推荐
资源详情
资源评论
收起资源包目录
基于vue3+elementPlus的后台管理系统模板实现.rar (63个子文件)
基于vue3+elementPlus的后台管理系统模板实现
.travis.yml 610B
vue.config.js 202B
package.json 2KB
Readme.txt 49B
.env.production 28B
.env.development 29B
package-lock.json 515KB
src
style
style.less 0B
theme.less 64B
variable.less 880B
transition.less 714B
mock
server.js 2KB
data copy.json 8KB
data.json 8KB
App.vue 664B
assets
logo.png 7KB
api
index.ts 359B
request
index.js 2KB
example.js 1KB
shims-vue.d.ts 169B
main.ts 588B
views
Tab.vue 652B
Button.vue 2KB
Date.vue 153B
Table.vue 3KB
Login.vue 3KB
Home.vue 3KB
Document.vue 373B
NotFound.vue 396B
Component.vue 2KB
Inner.vue 142B
Image.vue 623B
components
CommonList.vue 49KB
JsonTable
config.js 5KB
tableDataMock.js 13KB
index.vue 8KB
README.md 9KB
composition
useSearchForm.js 2KB
HelloWorld.vue 739B
typed-scss.d.ts 159B
typed-request.d.ts 77B
layout
index.vue 2KB
components
Sidebar
Sidebar.vue 2KB
index.vue 2KB
Drawer
index.vue 3KB
Header
index.vue 3KB
Tagsview
index.vue 2KB
Wrapper
index.vue 124B
composition
useTagViewApi.ts 2KB
useThemeApi.ts 306B
router
staticRoutes
index.ts 2KB
defaultRoutes
index.ts 498B
index.ts 580B
store
controls
index.ts 337B
index.ts 134B
.eslintrc.js 469B
tsconfig.json 770B
data.json 4KB
.gitignore 231B
public
index.html 613B
favicon.ico 4KB
.editorconfig 121B
babel.config.js 74B
共 63 条
- 1
爱吃苹果的Jemmy
- 粉丝: 74
- 资源: 1148
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页