Merge pull request #140 from cshaptx4869/patch-96
feat(PageContent): ✨ 操作栏增加render配置参数
This commit is contained in:
@@ -293,9 +293,10 @@
|
|||||||
<!-- 其他 -->
|
<!-- 其他 -->
|
||||||
<template v-else-if="typeof item === 'object'">
|
<template v-else-if="typeof item === 'object'">
|
||||||
<el-button
|
<el-button
|
||||||
|
v-if="item.render === undefined || item.render(scope.row)"
|
||||||
v-hasPerm="[`${contentConfig.pageName}:${item.auth}`]"
|
v-hasPerm="[`${contentConfig.pageName}:${item.auth}`]"
|
||||||
:icon="item.icon"
|
:icon="item.icon"
|
||||||
type="primary"
|
:type="item.type ?? 'primary'"
|
||||||
size="small"
|
size="small"
|
||||||
link
|
link
|
||||||
@click="
|
@click="
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ export type IObject = Record<string, any>;
|
|||||||
|
|
||||||
export interface IOperatData {
|
export interface IOperatData {
|
||||||
name: string;
|
name: string;
|
||||||
row: any;
|
row: IObject;
|
||||||
column: any;
|
column: IObject;
|
||||||
$index: number;
|
$index: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ export interface IContentConfig<T = any> {
|
|||||||
imageWidth?: number;
|
imageWidth?: number;
|
||||||
imageHeight?: number;
|
imageHeight?: number;
|
||||||
// list模板相关参数
|
// list模板相关参数
|
||||||
selectList?: Record<string, any>;
|
selectList?: IObject;
|
||||||
// switch模板相关参数
|
// switch模板相关参数
|
||||||
activeValue?: boolean | string | number;
|
activeValue?: boolean | string | number;
|
||||||
inactiveValue?: boolean | string | number;
|
inactiveValue?: boolean | string | number;
|
||||||
@@ -173,6 +173,8 @@ export interface IContentConfig<T = any> {
|
|||||||
icon?: string;
|
icon?: string;
|
||||||
name: string;
|
name: string;
|
||||||
text: string;
|
text: string;
|
||||||
|
type?: "primary" | "success" | "warning" | "danger" | "info";
|
||||||
|
render?: (row: IObject) => boolean;
|
||||||
}
|
}
|
||||||
>;
|
>;
|
||||||
// filter值拼接符
|
// filter值拼接符
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ const contentConfig: IContentConfig<UserQuery> = {
|
|||||||
{ label: "创建时间", align: "center", prop: "createTime", width: 180 },
|
{ label: "创建时间", align: "center", prop: "createTime", width: 180 },
|
||||||
{
|
{
|
||||||
label: "操作",
|
label: "操作",
|
||||||
|
align: "center",
|
||||||
fixed: "right",
|
fixed: "right",
|
||||||
width: 220,
|
width: 220,
|
||||||
templet: "tool",
|
templet: "tool",
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ const contentConfig: IContentConfig = {
|
|||||||
cols: [
|
cols: [
|
||||||
{ type: "index", width: 50, align: "center" },
|
{ type: "index", width: 50, align: "center" },
|
||||||
{ label: "ID", align: "center", prop: "id", show: false },
|
{ label: "ID", align: "center", prop: "id", show: false },
|
||||||
{ label: "用户名", align: "center", prop: "username" },
|
{ label: "文本", align: "center", prop: "username" },
|
||||||
{ label: "图片", align: "center", prop: "avatar", templet: "image" },
|
{ label: "图片", align: "center", prop: "avatar", templet: "image" },
|
||||||
{
|
{
|
||||||
label: "百分比",
|
label: "百分比",
|
||||||
@@ -63,7 +63,7 @@ const contentConfig: IContentConfig = {
|
|||||||
templet: "percent",
|
templet: "percent",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "价格",
|
label: "货币符",
|
||||||
align: "center",
|
align: "center",
|
||||||
prop: "price",
|
prop: "price",
|
||||||
templet: "price",
|
templet: "price",
|
||||||
@@ -86,7 +86,7 @@ const contentConfig: IContentConfig = {
|
|||||||
slotName: "status",
|
slotName: "status",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "状态",
|
label: "Switch",
|
||||||
align: "center",
|
align: "center",
|
||||||
prop: "status2",
|
prop: "status2",
|
||||||
templet: "switch",
|
templet: "switch",
|
||||||
@@ -96,20 +96,39 @@ const contentConfig: IContentConfig = {
|
|||||||
inactiveText: "禁用",
|
inactiveText: "禁用",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "排序",
|
label: "输入框",
|
||||||
align: "center",
|
align: "center",
|
||||||
prop: "sort",
|
prop: "sort",
|
||||||
templet: "input",
|
templet: "input",
|
||||||
inputType: "number",
|
inputType: "number",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "创建时间",
|
label: "日期格式化",
|
||||||
align: "center",
|
align: "center",
|
||||||
prop: "createTime",
|
prop: "createTime",
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
templet: "date",
|
templet: "date",
|
||||||
dateFormat: "YYYY/MM/DD HH:mm:ss",
|
dateFormat: "YYYY/MM/DD HH:mm:ss",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "操作栏",
|
||||||
|
align: "center",
|
||||||
|
fixed: "right",
|
||||||
|
width: 220,
|
||||||
|
templet: "tool",
|
||||||
|
operat: [
|
||||||
|
{
|
||||||
|
name: "reset_pwd",
|
||||||
|
auth: "password:reset",
|
||||||
|
icon: "refresh-left",
|
||||||
|
text: "重置密码",
|
||||||
|
type: "primary",
|
||||||
|
render(row) {
|
||||||
|
return row.id === 1;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,11 @@
|
|||||||
</page-modal>
|
</page-modal>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<page-content ref="contentRef" :content-config="contentConfig2">
|
<page-content
|
||||||
|
ref="contentRef"
|
||||||
|
:content-config="contentConfig2"
|
||||||
|
@operat-click="handleOperatClick"
|
||||||
|
>
|
||||||
<template #status="scope">
|
<template #status="scope">
|
||||||
<el-tag :type="scope.row[scope.prop] == 1 ? 'success' : 'info'">
|
<el-tag :type="scope.row[scope.prop] == 1 ? 'success' : 'info'">
|
||||||
{{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }}
|
{{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }}
|
||||||
|
|||||||
Reference in New Issue
Block a user