1.0.13 • Published 4 years ago

em-element-ui1 v1.0.13

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

使用说明

em-element-ui该组件是基于Vue和element-ui开发,该组件主要用于快速开发列表的增删查改功能,只需配置页面上显示的字段,并对各个字段加上对应的显示规则即可显示。

安装

npm install element-ui -S
npm install em-element-ui -D

安装使用

import Vue from 'vue'
import Element from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css';

Vue.use(Element)

import emUI from 'em-element-ui'
Vue.use(emUI);

### DEMO演示

```html
<template>
    <div class="template-main">
        <em-table-list :tableListName="'collect'" :sourceData="sourceData" :source="source" :mode_list="mode_list" :page_status="page_status" :page_column="page_column" :select_list="select_list" @onListEvent="onListEvent"></em-table-list>
    </div>
</template>
<script>
    export default {
        name: 'collect',
        computed: {},
        data() {
            return {
                sourceData: [{
                    collectPartner: '10001',
                    businessLicense: '91110108MA01QC0B0T',
                    companyId: 'ENN123456789012345678',
                    companyName: 'test',
                    companyAddress: '河北廊坊',
                    status: 1
                }],
                source: 'data',
                mode_list: [],
                page_status: 29,
                page_column: [
                    {field: "collectPartner", name: "企业代码", fixed: "left", width: 90,
                        show: {type: 'text', ou: 1, placeholder: '企业代码', default: {}},
                        search: {type: 'text', obj: 'collectPartner', placeholder: '企业代码', default: {}},
                        rules: [
                            { required: true, message: '请输入名称!', trigger: 'blur' },
                            { min: 5, max: 32, message: '长度在 1 到 32 个字符', trigger: 'blur'},
                            { validator: function (rule, value, callback) {

                                }, message: '名称格式为汉字、字符和下划线', trigger:'blur'}]},
                    {field: "businessLicense", name: "信用代码", width: 190,
                        show: {type: 'text', ou: 1, placeholder: '社会信用统一代码'}},
                    {field: "companyId", name: "ID", width: 180},
                    {field: "companyName", name: "企业名称",
                        show: {type: 'text', ou: 1, placeholder: '企业名称'},
                        search: {type: 'text', obj: 'companyName', placeholder: '企业名称'}},
                    {field: "companyAddress", name: "企业地址",
                        show: {type: 'text', ou: 1, placeholder: '企业地址'}},
                    {field: "status", stype:'switch', name: "状态", formatter: 'status', width: 80, surl: '/', switchs: {key: 'companyId'},
                        show: {type: 'select', ou: 1, obj: 'status', placeholder: '状态'}},
                    {field: "useropts", stype:'opt', ispush: false, name: "操作", align: 'center', fixed: "right",
                        list:[
                            { type: 'add', size: 'small', icon: '', style: '', name: '新增'},
                            { type: 'edit', size: 'small', icon: '', style: '', name: '编辑'},
                            { type: 'del', size: 'small', icon: '', style: 'color: red', name: '删除'},
                            { type: 'exec', size: 'small', icon: '', name: '抽取'},
                        ]}
                ],
                select_list: {
                    status: [
                        {value: 0, label: '禁用'},
                        {value: 1, label: '启用'}
                    ],
                    companyList: {
                        url: '/',
                    }
                }
            }
        },
        created: function() {},
        methods: {
            onListEvent(){
                console.log(arguments)
            }
        }
    }

</script>

:::

列表属性描述

参数说明类型可选值默认值
tableListName列表对应名称string必填
sourcetable表数据的来源。data表示自定义数据; query是通过URL动态获取,如:table queryURLstringdata/queryquery
sourceDatasource值为data时使用array[]
rowKey表示table对应的字段显示下三角string-
mode_list修改和编译列表时,各个字段显示在不同的mode区域array[]
page_status控制显示内容,1:搜索条件;2:选择显示列;4:表格;8:分页功能;16:增加按钮;32:删除按钮;64:全局搜索控件int12
page_column列表对应字段array必填-
select_list列表中存在select组件,使用key-value对应object-

列表事件

事件名说明参数
onListEvent用于用户自定义事件,扩充接口。type为事件类型,row操作的行type, row

table queryURL

queryURL是一个已key-val方式传递,key代表是请求事件,如:add/edit/list/del和自定义事件,注意:key为name时,是新增和编辑左上角title提示;val为对象,描述如下: | 参数 | 说明 | 类型 | 可选值 | 默认值 | |---------- |-------------- |---------- |-------------------------------- |-------- | | url | 请求地址 | string | - | - | | method | 请求方式 | string | — | - | | name | 删除时回显字段 | string | — | - |

mode_list

参数说明类型可选值默认值
ou区域的主键int--
name区域的名称string-

select_list

参数说明类型可选值默认值
key字段的名字string--
value字段值,array:为静态值,如:{value: 0, label: '禁用'},{value: 1, label: '启用'};object:为动态获取值,如:{url: '/',keyVal: {value: 'oid', label: 'name'},node:'data', 'list',params: {page: 1, size: 10}}array/object-

page_column table

参数说明类型可选值默认值
field字段string--
stype显示信息类型string-
name字段名称string-
fixed字段是否固定stringleft/right-
width字段宽度int-
action动态请求该字段值string-
formatter根据key-val获取对应的值string-
sort字段是否排序boolean/stringtrue/false/customfalse
ispush提交表单时,该字段是否提交booleanfalse
align显示位置stringleft/center/rightleft
hide是否隐藏booleanfalse
show用于控制增加和编辑form表单使用,详细情况:mode_list add/editobject-
search用于控制查询条件,详细情况:mode_list searchobject-
rules用于控制文本框合法校验,详细情况:mode_list rulesarray-

mode_list add/edit

参数说明类型可选值默认值
type文本框类型string--
ou根据mode主键显示文本框int-
obj动态获取对应的值array-
isDisabled是否在修改时,可编辑该文本框booleanfalse
remote动态搜索远程服务器功能booleanfalse
findKey搜索的字段string-
paramKey参数内参数string-
value设置默认值string-
placeholder文本框描述string-

mode_list search

参数说明类型可选值默认值
type文本框类型string--
obj动态获取对应的值array-
placeholder文本框描述string-

mode_list rules

参数说明类型可选值默认值
required是否必输boolean-false
message错误提示消息string-
trigger触发校验array/stringblur/change-
min最小长度int-
max最大长队int-
validator自定义校验规则,function代表自定义方法string/function-