0.0.1 • Published 26 days ago

platform-render-component-web v0.0.1

Weekly downloads
-
License
-
Repository
-
Last release
26 days ago

platform-render-component-web

前端组件库vue3版本

项目中使用

下载platform-render-component-web

npm i platform-render-component-web

全局注册platform-render-component-web组件

import PlatformWebComponentV3 from 'platform-render-component-web'
createApp(App).use(PlatformWebComponentV3,{
    $global,
    $axios,
    $api: {
        platformApi: 平台API,
	    applicationApi: 应用API
    },
    useMenuStore,
    useDictStore,
    useUserStore
})

组件目录

  1. 卡片组件
  2. 部门级联选择器组件
  3. 描述列表组件
  4. 弹窗组件
  5. 人员弹窗选择组件
  6. 抽屉组件
  7. 表单组件
  8. 表单表格组件
  9. 附件在线预览组件
  10. 页面列表组件
  11. 表格组件
  12. jsx组件
  13. 动态组件
  14. svg组件
  15. 上传组件

卡片组件Card

Props
参数说明类型默认值
title标题string-
bodyStyle内容body样式object{padding: 0.625rem}
Slots
名称说明
title标题
例子
<Card title="卡片标题">
    ...
</Card>
<Card>
    <template #title>
        ...
    </template>
    ...
</Card>

部门级联选择器组件DepartmentCascader

Props
参数说明类型默认值
model-value / v-model绑定值,multiple为false时,类型为stringtrue时为arraystring / array-
options / v-model:options选中列表array-
multiple是否可多选booleanfalse
checkStrictly是否取消父子节点关联关系,可选择任意一级选项booleanfalse
Events
名称说明
change当绑定值变化时触发的事件,参数:value,list
例子
<DepartmentCascader v-model="formData.departmentValue" v-model:options="formData.departmentList" multiple></DepartmentCascader>

描述列表组件Description

Props
参数说明类型默认值
descriptionColumn列表项array-
formData表单数据object-
例子
<Description :formData="formData" :descriptionColumn="descriptionColumn" v-loading="loading">
    <template #file>
        ...
    </template>
</Description>
const formData = ref({});
const showPo = ref(false);
const descriptionColumn = [
    { field: 'value',label: '标题'},
    { field: 'value',show: showPo,label: 'PO号' },
    { field: 'value',dictType: 'deliveryOrderBusinessType',label: '商机阶段' },
    { componentName: markRaw(Upload),field: 'accessory',label: '附件',span: 24,disabled: true },
    { slot: 'file',label: '插槽'},
    { label: 'VNode',
        render: (h,params) => {
            return h('el-button',{
                link: true,
                type: 'primary',
                onClick: () => {
                    ...
                }
            },'预览')
        }
    },
]

弹窗组件Dialog

Props
参数说明类型默认值
model-value / v-model是否显示booleanfalse
title标题string-
width宽度string38.75rem
showClose是否显示右上角关闭按钮booleantrue
bodyStyle内容body样式object{padding: 0.625rem}
closeOnClickModal是否可以通过点击 modal 关闭 Dialogbooleanfalse
onClose自定义右上角关闭按钮点击事件Function-
Slots
名称说明
titleRight标题右侧
footer底部
例子
<Dialog v-model="dialogValue" title="弹窗标题">
    ...
</Dialog>

人员弹窗选择组件Person

Props
参数说明类型默认值
model-value / v-model是否显示booleanfalse
type单选或多选stringselection ,可选 radio
Events
名称说明
confirm回调参数:typeradio时是 object,typeselection时是 array

例子:

<Person v-model="showPersonDialog" type="radio" @confirm="handlePersonConfirm"></Person>

抽屉组件Drawer

Props
参数说明类型默认值
model-value / v-model是否显示booleanfalse
title标题string-
showClose是否显示右上角关闭按钮booleantrue
onClose自定义右上角关闭按钮点击事件Function-
Slots
名称说明
titleLeft标题左侧
titleRight标题右侧
footer底部
例子
<Drawer v-model="drawerValue" title="抽屉标题">
    ...
</Drawer>

表单组件Form

Props
参数说明类型默认值
labelWidthlabel宽度string7.5rem
formColumn表单项array-
formData表单数据object-
Slots
名称说明
default默认插槽
*formColumn 中定义 slot 可用
事件
名称说明参数
validate对整个表单的内容进行验证,返回status,errObject-
resetFields重置该表单项,将其值重置为初始值,并移除校验结果-
clearValidate移除校验结果-
例子
<Form ref="FormRef" :formData="formData" :formColumn="formColumn" v-loading="loading">
    <template #file>
        ...
    </template>
</Description>
const formData = ref({});
const show = ref(false);
const formColumn = [
    { field: 'value',label: '标题',required: true,props: {},on: {}},
    { field: 'value',label: '隐藏',show: show},
    { field: 'value',label: '禁用',disabled: true},
    { componentName: 'el-select',field: 'value',dictType: 'dictType',label: '字典' },
    { componentName: 'el-select',field: 'value',optionList: [{code: 'code',name: 'name'}],label: '字典' },
    { slot: 'file',field: 'file',label: '插槽'}
]

表单表格组件FormTable

Props
参数说明类型默认值
loading表格loadingboolean-
formData表单数据object-
tableData表格数据array-
tableColumn表头项array-
tableField表格绑定的字段名,单元格校验必填时需传string-
height表格高度string / number100%
canAdd是否在表格底部显示添加按钮boolean-
onAdd自定义添加按钮事件Function-
Slots
名称说明
default默认插槽

使用default插槽后,tableColumn将无效

事件
名称说明参数
validate对整个表单的内容进行验证,返回status,errObject-
resetFields重置该表单项,将其值重置为初始值,并移除校验结果-
clearValidate移除校验结果-
例子
<FormTable :loading="loading" canAdd :tableData="formData.contactEntityList" tableField="contactEntityList" :tableColumn="tableColumn" :formData="formData">
    <template #slotHeaderName>
        ...
    </template>
    <template #slotName="{ row }">
        ...
    </template>
</FormTable>
const formData = ref({contactEntityList: []});
const tableData = ref([]);
const tableColumn = [
    { type: 'index',label: '序号',width: 60,fixed: 'left' },
    { prop: 'name',label: 'VNode',minWidth: 160,fixed: 'left',
        render: (h,params) => {
            return h('el-button',{
                link: true,
                type: 'primary',
                onClick: () => {
                    
                }
            },params.row.name)
        }
    },
    { slotHeader: 'slotHeaderName',prop: 'name',label: '标题插槽',minWidth: 100 },
    { slot: 'slotName',prop: 'slotName',label: '插槽',minWidth: 100 },
]

附件在线预览组件OnlinePreview

不支持 .xls.doc格式文件,如有需要,可自行转换成 .xlsx.docx格式

Props
参数说明类型默认值
model-value / v-model是否显示booleanfalse
title标题string-
src附件urlstring-
例子
<OnlinePreview v-model="showOnlinePreview" :title="onlinePreviewTitle" :src="onlinePreviewSrc"></OnlinePreview>

页面列表组件PageList

Props
参数说明类型默认值
class组件根标签classstring-
searchForm搜索表单数据object-
searchColumn搜索表单项array-
labelWidth搜索表单项label宽度string6.25rem
loading表格loadingboolean-
tableData表格数据array-
tableColumn表头项array-
currentPage表格当前页number1
pageSize表格每页条数number20
total表格总数量number0
showPagination是否显示分页booleantrue
Slots
名称说明
btnLeft按钮区域左侧
btnRight按钮区域右侧
事件
名称说明参数
setSelection设置选中row[]
例子
<PageList ref="PageList" :searchForm="searchForm" :searchColumn="searchColumn" :tableData="tableData" :tableColumn="tableColumn" v-model:currentPage="currentPage" v-model:pageSize="pageSize" :total="total" :loading="loading" @load="load">
    <template #file>
        ...
    </template>
    <template #btnLeft>
        <el-button type="primary"><el-icon><i-ep-Plus /></el-icon>新增客户</el-button>
        <el-button type="primary"><el-icon><i-ep-Refresh /></el-icon>刷新</el-button>
        <el-button type="primary"><el-icon><i-ep-Upload /></el-icon>导入</el-button>
    </template>
    <template #slotHeaderName>
        ...
    </template>
    <template #slotName="{ row }">
        ...
    </template>
    ...
</PageList>
const searchForm = ref({});
const descriptionColumn = [
    { componentName: 'el-select',span: 6,label: '客户性质',field: 'goodsCode',dictType: 'deliveryOrderBusinessType',props: {},on: {}},
    { slot: 'file',label: '插槽'},
]
const tableData = ref([]);
const tableColumn = [
    { type: 'index',label: '序号',width: 60,fixed: 'left' },
    { prop: 'name',label: 'VNode',minWidth: 160,fixed: 'left',
        render: (h,params) => {
            return h('el-button',{
                link: true,
                type: 'primary',
                onClick: () => {
                    
                }
            },params.row.name)
        }
    },
    { slotHeader: 'slotHeaderName',prop: 'name',label: '标题插槽',minWidth: 100 },
    { slot: 'slotName',prop: 'slotName',label: '插槽',minWidth: 100 },
]

表格组件PageTable

Props
参数说明类型默认值
loading表格loadingboolean-
tableData表格数据array-
tableColumn表头项array-
currentPage表格当前页number1
pageSize表格每页条数number20
total表格总数量number0
showPagination是否显示分页booleantrue
height表格高度string / number100%
mountLoad是否渲染完成自调用一次 load 方法booleantrue
canAdd是否在表格底部显示添加按钮boolean-
onAdd自定义添加按钮事件Function-
Slots
名称说明
default默认插槽

使用default插槽后,tableColumn将无效

Events
名称说明
selectionChange回调参数: selection
事件
名称说明参数
setSelection设置选中row[]
例子
<PageTable :tableData="tableData" :tableColumn="tableColumn" :loading="loading" v-model:currentPage="currentPage" v-model:pageSize="pageSize" :total="total" @load="load">
    <template #slotHeaderName>
        ...
    </template>
    <template #slotName="{ row }">
        ...
    </template>
</PageTable>

<PageTable canAdd :onAdd="handleAddTable" :tableData="tableData" :tableColumn="tableColumn" :showPagination="false">
    <template #slotHeaderName>
        ...
    </template>
    <template #slotName="{ row }">
        ...
    </template>
</PageTable>
const tableData = ref([]);
const tableColumn = [
    { type: 'index',label: '序号',width: 60,fixed: 'left' },
    { prop: 'name',label: 'VNode',minWidth: 160,fixed: 'left',
        render: (h,params) => {
            return h('el-button',{
                link: true,
                type: 'primary',
                onClick: () => {
                    
                }
            },params.row.name)
        }
    },
    { slotHeader: 'slotHeaderName',prop: 'name',label: '标题插槽',minWidth: 100 },
    { slot: 'slotName',prop: 'slotName',label: '插槽',minWidth: 100 },
]

JSX组件Render

Props
参数说明类型默认值
renderJSX函数Function-
例子
<Render :render="render" v-bind="props" />

动态组件RenderComponent

Props
参数说明类型默认值
isvue动态组件comonentstring / object<component>div
Slots
名称说明
default默认插槽
title头部插槽
content内容插槽
footer尾部插槽

组件内部已导入el-input , el-select , el-date-picker , el-button 组件,is属性可以是以上字符串,除此之外,is属性需为Object<Component>类型

例子
<RenderComponent v-model="value" is="el-input"></RenderComponent>

svg组件SvgIcon

Props
参数说明类型默认值
fontSizesvg图标宽度和高度string-
namesvg图标名称string-
colorsvg图标颜色string-

搭配vite-plugin-svg-icons插件使用,指定svg图标所在文件夹

例子
<SvgIcon name="icon-no-found"></SvgIcon>

上传组件Upload

Props
参数说明类型默认值
model-value / v-model绑定值array-
listType附件列表显示方式stringpicture ,可选 picture-card , text
btnTextlistType为text或picture时,上传按钮的名称string上传文件
disabled是否禁用boolean-
Slots
名称说明
default自定义上传按钮
事件
名称说明
validate校验是否仍有附件正在上传中
例子
<Upload v-model="list" listType="picture-card"></Upload>