1.4.6 • Published 11 months ago

winowe-ui v1.4.6

Weekly downloads
-
License
MIT
Repository
-
Last release
11 months ago

安装

npm install winowe-ui --save

使用

  • 全局注册使用全部组件
winoweui.nwInstall(Vue, { axios: request || axios })
  • 全局注册使用单个组件 compTable 除外
Vue.component(winoweui.compSearch.name, winoweui.compSearch)
Vue.component(winoweui.compMenus.name, winoweui.compMenus)
  • 全局注册使用 compTable 组件

使用 compTable 组件时候 vue 上面需要有$axios 存在

Vue.component(winoweui.compTable.name, winoweui.compTable)
  • 局部注册使用单个组件 compTable 除外

devideUpload

分片上传文件 file: input 获取到的文件信息,包含 file、content、message、status action: 文件上传的地址, 默认'/basic-gateway/basic-minio/upload/base64' processCb: 获取上传分片进度的回调函数 errorCb: 上传报错的回调 finallCb:所有分片上传完成的回调函数,包含每个分片返回的信息 headers:配置 headers 参数 size:分片的大小,以 B 为计算单位 application:存储桶,可以理解为业务模块 params: object{}对象,其他需要携带的上传参数


compMenus

基于 vue 和 elementUI 二次开发的菜单组件。

  • 示例
<template>
        <comp-menus :menus="menus" :value.sync="defaultMenu"></comp-menus>
</template>

<script>
export default {
    data() {
        return {
            defaultMenu: '/RoadProjectManagement/approvalTrafficOrganizationPlan',
            menus: [
                {
                    icon: 'icon-jifenguize',
                    id: 'zb2',
                    label: '一级菜单1',
                    labelCode: null,
                    menuType: '2',
                    menuUrl: '/dangerRoad',
                    parentId: null,
                    qxbs: 'ORDER:JCSB:MOTORCYCLE',
                    xtid: null,
                    children: [],
                },
                {
                    icon: 'icon-jiaotongshijianfenxi',
                    id: 'zb3',
                    label: '一级菜单2',
                    labelCode: null,
                    menuType: '1',
                    menuUrl: '/motorcycleMang1',
                    parentId: null,
                    qxbs: 'ORDER:JCSB:MOTORCYCLE',
                    xtid: null,
                    children: [
                        {
                            icon: 'icon-kapianmoshi',
                            id: 'zb31',
                            label: '二级菜单1',
                            labelCode: null,
                            menuType: '2',
                            menuUrl: '/roadIntegral',
                            parentId: 'zb3',
                            qxbs: 'ORDER:JCSB:MOTORCYCLE',
                            xtid: null,
                            children: [],
                        },
                        {
                            icon: 'icon-jinglingguanli',
                            id: 'zb32',
                            label: '二级菜单2',
                            labelCode: null,
                            menuType: '2',
                            menuUrl: '/tunnelIntegral',
                            parentId: 'zb3',
                            qxbs: 'ORDER:JCSB:MOTORCYCLE',
                            xtid: null,
                            children: [],
                        }
                    ],
                }
            ],
        }
    },
    created() {},
    methods: {},
}
</script>

compTable

基于 vue 和 elementUI 二次开发的表格组件,支持 el-table 基础功能,扩展分页查询,可支持动态和静态数据,目的是提高开发效率,减少代码量。 由于组件数据是通过组件内部请求发起,故需要将 axios 挂在到组件上;原因:分页时需要重新拉取数据,一般项目会对请求和返回头进行封装,例如设置 token,故将 axios 对象传入。 注:组件已与后端约定好数据返回格式

  • 示例
<template>
    <div class="app-table">
        <p>动态数据</p>
        <comp-table :rowKey="'lsh'" :cols="cols" :opts="opts" ref="comTable" class="mt16"></comp-table>
        <p>静态数据</p>
        <comp-table
            :rowKey="'lsh'"
            style="margin-top: 10px"
            :cols="cols"
            :opts="opts1"
            ref="comTable"
            class="mt16"
        ></comp-table>
    </div>
</template>

<script>
export default {
    data() {
        return {
            opts: {
                url: '/api/login',
            },
            opts1: {
                dataType: 'static',
                tableList: [
                    {
                        lsh: '123',
                        jylsh: '4234',
                        jcxdh: '153423',
                        jyjgbh: '1122413',
                    },
                    {
                        lsh: '124',
                        jylsh: '4234',
                        jcxdh: '153423',
                        jyjgbh: '1122413',
                    },
                ],
            },
            cols: [
                { isSelect: true,reserveSelection: true },
                { title: '序号',isIndex: true },
                { title: '流水号', key: 'lsh',sortable: true },
                { title: '检验流水号', key: 'jylsh' },
                { title: '检测线代号', key: 'jcxdh' },
                { title: '安检机构编码', key: 'jyjgbh' },
                {
                    title: '操作',
                    render: (h, p) => {
                        console.log(h)
                        return h(
                            'el-button',
                            {
                                props: {
                                    type: 'text',
                                },
                            },
                            ['编辑']
                        )
                    },
                },
            ],
        }
    },
    created() {
        for (let index = 0; index < 10; index++) {
            this.opts1.tableList.push({
                lsh: '124' + index,
                jylsh: '4234',
                jcxdh: '153423',
                jyjgbh: '1122413',
            })
        }
    },
    methods: {
        getRowKey(row) {
            console.log(row)
            return row.lsh
        },
    },
}
</script>
  • props
参数说明类型可选值默认值
sizeTable 的尺寸Stringmedium / small / minimedium
exportName导出文件的名称excel 文件--
showHeader是否展示表头Boolean-true
rowStyle{row, rowIndex}行的 style 的回调方法,也可以使用一个固定的 Object 为所有行设置一样的 StyleObject / function-
rowKeyrow keyString / function-'id'
pagination分页配置,是否展示 show,分页大小:pageSize,页码按钮的数量,当总页数超过该值时会折叠 pagerCountObject{show:true,pageSize:0,pagerCount:5}--
border是否带有纵向边框Boolean-true
opts数据请求配置,必填 dataType 静态或动态数据类型,type 请求类型,url 请求地址,params 默认请求参数,tableList 静态数据 dataType 为 static 时生效Object{dataType: 'remote',type: 'get',url: '',params: '',tableList:[]}--
showIndex是否显示序号Boolean-false
cols表格列设置;reserveSelection 在 isSelect 为 true 时生效,一般情况设置首列为{isSelect: true,reserveSelection: true},checkSelectable 设置当前列是否可选,sortable 设置是否排序Array{title: '列名',key: '字段',isSelect:false,reserveSelection:true,checkSelectable:true,sortable: true,width:'宽度',expand:'是否展开',fixed:'浮动',renderHeader:'',render:(h,row)=>{}}
maxHeightTable 的最大高度。合法的值为数字或者单位为 px 的高度string/number----
stripe是否为斑马纹 tableBoolean-true
showOverflowTooltip表格列超出是否显示 tooltipBoolean-true
summaryConf合计行相关配置Object{summary: false, sumText: '',showSummary: '',objectSpanMethod: () => {},summaryMethod: () => {},}
highlightCurrentRow是否要高亮当前行Boolean-false
  • 函数
方法名说明参数
refresh刷新params:Object,可传入附加参数或覆盖已有参数
  • 事件
事件名说明参数
selectOne当用户手动勾选数据行的 Checkbox 时触发的事件selection, row
selectAll当用户手动勾选全选 Checkbox 时触发的事件selection
selection-change当选择项发生变化时会触发该事件selection
pagenum-change当页码发生变化时会触发该事件val
pagesize-change当每页数据条数发生变化时会触发该事件val
getDatadataType 为 remote 时,数据获取成功事件dataList,total,pageNum,pageSize
cellClick当某个单元格被点击时会触发该事件row, column, cell, event

compSearch

基于 vue 和 elementUI 二次开发的搜索组件。

  • 示例
<template>
        <comp-search
            :searchs="searchs"
            :labelWidth="labelWidth"
            :labelPosition="labelPosition"
            @search="search"
            @reset="reset"
            @changeSelect="change"
        ></comp-search>
</template>

<script>
export default {
    data() {
        return {
            queryForm: {},
            labelWidth: '130px',
            labelPosition: 'right',
            searchs: [
                {
                    name: '阿斯顿撒多撒大撒大阿',
                    type: 'input',
                    key: 'name',
                    spacing: -1.2,
                    placeholder: '请输入名称',
                },
                {
                    name: '位置',
                    type: 'select',
                    list: [
                        {
                            name: '北京',
                            value: '1',
                            label: '北京',
                        },
                        {
                            name: '天津',
                            value: '4',
                            label: '天津',
                        },
                    ],
                    key: 'address',
                    placeholder: '请选择位置',
                },
                {
                    name: '单选',
                    type: 'radio',
                    list: [
                        {
                            name: '北京',
                            value: '1',
                            label: '北京',
                        },
                        {
                            name: '上海',
                            value: '2',
                            label: '上海',
                        },
                    ],
                    key: 'address',
                    placeholder: '请选择位置',
                },
                {
                    name: '日期时间',
                    type: 'datePicker',
                    key: 'datePicker1',
                },
                {
                    name: '数量',
                    type: 'inputNumber',
                    key: 'number',
                    min: 0,
                    max: 100,
                    placeholder: '请输入数量',
                },
                {
                    name: '状态',
                    type: 'cascader',
                    list: [
                        {
                            value: 'zhinan',
                            label: '指南',
                            children: [
                                {
                                    value: 'shejiyuanze',
                                    label: '设计原则',
                                    children: [
                                        {
                                            value: 'yizhi',
                                            label: '一致',
                                        },
                                        {
                                            value: 'kekong',
                                            label: '可控',
                                        },
                                    ],
                                },
                                {
                                    value: 'daohang',
                                    label: '导航',
                                    children: [
                                        {
                                            value: 'cexiangdaohang',
                                            label: '侧向导航',
                                        },
                                        {
                                            value: 'dingbudaohang',
                                            label: '顶部导航',
                                        },
                                    ],
                                },
                            ],
                        },
                        {
                            value: 'zujian',
                            label: '组件',
                            children: [
                                {
                                    value: 'basic',
                                    label: 'Basic',
                                    children: [
                                        {
                                            value: 'layout',
                                            label: 'Layout 布局',
                                        }
                                    ],
                                },
                                {
                                    value: 'form',
                                    label: 'Form',
                                    children: [
                                        {
                                            value: 'rate',
                                            label: 'Rate 评分',
                                        },
                                        {
                                            value: 'form',
                                            label: 'Form 表单',
                                        },
                                    ],
                                },
                            ]
                        },
                        {
                            value: 'ziyuan',
                            label: '资源',
                            children: [
                                {
                                    value: 'axure',
                                    label: 'Axure Components',
                                },
                                {
                                    value: 'sketch',
                                    label: 'Sketch Templates',
                                },
                                {
                                    value: 'jiaohu',
                                    label: '组件交互文档',
                                },
                            ],
                        },
                    ],
                    key: 'state',
                    isShowAllLevels: false,
                    props: { multiple: true, checkStrictly: true },
                    clearable: true,
                    collapseTags: true,
                    filterable: true,
                },
                {
                    name: '日期范围',
                    type: 'daterange',
                    key: 'daterange',
                },
            ],
        }
    },
    created() {},
    methods: {
        search2(val) {
            console.log(22222, val)
        },
        reset2() {
            console.log(10000)
        },
        search(val) {
            const params = {
                ...val,
                startTime: val.daterange ? val.daterange[0] : '',
                endTime: val.daterange ? val.daterange[1] : '',
            }
            delete params.daterange
            console.log(params)
        },
        reset(val) {
            const params = {
                ...val,
                startTime: '',
                endTime: '',
            }
            delete params.daterange
            console.log('搜索表单', params)
        },
        change(key, val) {
            console.log(key, val)
            console.log(this.queryForm)
        },
    },
}
</script>
  • props
参数说明类型可选值默认值
searchs搜索列表渲染的元素数组。每个数组对象包含{必填项 name:label 名称,type:元素类型,key:唯一的字段名;可配置项 spacing:配置 label 字间距;placeholder:框内提示文字,list:如果是下拉选择或级联选择需要传入数组,min:计数器允许的最小值数字,max:计数器允许的最大值数字,isShowAllLevels:级联选择框中是否显示选中值的完整路径,clearable:是否可以清空,collapseTags:多选模式下是否折叠 Tag,filterable:是否可搜索选项,props:级联选择器{ multiple: 是否多选, checkStrictly: 是否严格的遵守父子节点不互相关联 },multiple:下拉框是否多选,}Array--[]
showBtn是否显示按钮Booleantrue/falsetrue
widths单元素总宽度Number所有数字360
searchForm可设置搜索组件的默认值Object--{}
labelWidthlabel 的宽度String所有数字需要带单位 px80px
labelPositionlabel 的位置Stringleft/rightleft
  • 函数
方法名说明参数
search点击搜索按钮请求的form 表单数据
reset点击重置按钮返回请求的 form 表单值清空
changeSelectchange 事件对应的函数key:对应的键,value:选中的值
  • 事件
事件名说明参数
change下拉列表、时间选择、级联选择器等选择时触发的事件key:对应的键,value:选中的值
1.4.6

11 months ago

1.4.5

1 year ago

1.4.4

1 year ago

1.4.3

1 year ago

1.4.2

1 year ago

1.4.1

1 year ago

1.4.0

1 year ago

1.3.9

2 years ago

1.3.7

2 years ago

1.3.6

2 years ago

1.3.5

2 years ago

1.3.8

2 years ago

1.2.0

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.2.8

2 years ago

1.1.9

2 years ago

1.2.7

2 years ago

1.1.8

2 years ago

1.0.9

2 years ago

1.2.6

2 years ago

1.1.7

2 years ago

1.3.4

2 years ago

1.2.5

2 years ago

1.1.6

2 years ago

1.3.3

2 years ago

1.1.5

2 years ago

1.3.2

2 years ago

1.2.3

2 years ago

1.1.4

2 years ago

1.3.1

2 years ago

1.1.3

2 years ago

1.3.0

2 years ago

1.2.1

2 years ago

1.1.2

2 years ago

1.2.31

2 years ago

1.2.9

2 years ago

1.2.34

2 years ago

1.2.35

2 years ago

1.2.32

2 years ago

1.2.33

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago