提交 bcc2eda1 编写于 作者: RedPig97's avatar RedPig97

update: 更新

上级 5cc87f7e
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<div style="flex-grow: {{#if item.psLayoutPos.grow}}{{item.psLayoutPos.grow}}{{else}}0{{/if}};"> <div style="flex-grow: {{#if item.psLayoutPos.grow}}{{item.psLayoutPos.grow}}{{else}}0{{/if}};">
<IbizFormItem name="{{item.codeName}}" label="{{item.caption}}"> <IbizFormItem name="{{item.codeName}}" label="{{item.caption}}">
{{#if item.psEditor}} {{#if item.psEditor}}
{{>(lookup . 'item.psEditor.editorType') item=item}} {{>(lookup . 'item.psEditor.editorType') item=item ctrlType="form"}}
{{/if}} {{/if}}
</IbizFormItem> </IbizFormItem>
</div> </div>
......
...@@ -3,19 +3,30 @@ import { IParam, IActionParam } from "@ibiz-core"; ...@@ -3,19 +3,30 @@ import { IParam, IActionParam } from "@ibiz-core";
import { onBeforeMount, ref, Ref } from "vue"; import { onBeforeMount, ref, Ref } from "vue";
interface ToolbarProps { interface ToolbarProps {
/**
* @description 名称
*/
name: string;
/** /**
* @description 工具栏模型 * @description 模式
*/ */
toolbarModel: IParam; mode: 'button' | 'link';
/**
* @description 行为模型
*/
actionModel: IParam[];
} }
interface toolbarEmit { interface toolbarEmit {
(name: "toolbarEvent", value: IActionParam): void; (name: "toolbarEvent", value: IActionParam): void;
} }
const props = withDefaults(defineProps<ToolbarProps>(), {}); const props = withDefaults(defineProps<ToolbarProps>(), {
mode: 'button',
});
const emit = defineEmits<toolbarEmit>(); const emit = defineEmits<toolbarEmit>();
const items: Ref<IParam[]> = ref(props.toolbarModel?.items || []); const items: Ref<IParam[]> = ref(props.actionModel || []);
console.log(items);
const getItemClass = (item: IParam) => { const getItemClass = (item: IParam) => {
//todo 样式表
return item.class; return item.class;
}; };
const getItemIcon = (item: IParam) => { const getItemIcon = (item: IParam) => {
...@@ -25,29 +36,32 @@ const getItemIcon = (item: IParam) => { ...@@ -25,29 +36,32 @@ const getItemIcon = (item: IParam) => {
}; };
const itemClick = (item: IParam) => { const itemClick = (item: IParam) => {
emit("toolbarEvent", { emit("toolbarEvent", {
tag: item.name, tag: props.name,
action: "toolbarEvent", action: "toolbarEvent",
data: item, data: item,
}); });
}; };
</script> </script>
<template> <template>
<div class="app-toolbar"> <div class="toolbar">
<template v-for="(item, index) in items" :key="index"> <a-space :class="`toolbar-${mode}`">
<template v-for="(item, index) in items" :key="index">
<a-tooltip <a-tooltip
v-if="Object.is(item.itemType, 'DEUIACTION')" v-if="Object.is(item.itemType, 'DEUIACTION')"
:title="item.tooltip" :title="item.tooltip"
> >
<!-- todo 无权限显示模式 -->
<a-button <a-button
v-show="true" v-show="true"
:class="['toolbar-item', getItemClass(item)]" :class="['toolbar-item', getItemClass(item)]"
:disabled="item.disabled" :disabled="item.disabled"
type="primary" :type="Object.is(mode,'link') ? 'link': 'primary'"
@click="itemClick(item)" @click="itemClick(item)"
> >
<a-icon v-show="item.showIcon" :type="getItemIcon(item)" /> <a-icon v-show="item.showIcon" :type="getItemIcon(item)" />
\{{ item.showCaption ? item.caption : "" }} \{{ item.showCaption ? item.caption : "" }}
</a-button> </a-button>
<div v-if="item.addSeparator" class="separator"></div>
</a-tooltip> </a-tooltip>
<a-dropdown v-else-if="Object.is(item.itemType, 'items')"> <a-dropdown v-else-if="Object.is(item.itemType, 'items')">
<a-menu slot="overlay" @click="itemClick"> <a-menu slot="overlay" @click="itemClick">
...@@ -72,15 +86,26 @@ const itemClick = (item: IParam) => { ...@@ -72,15 +86,26 @@ const itemClick = (item: IParam) => {
</a-tooltip> </a-tooltip>
</a-menu> </a-menu>
</a-dropdown> </a-dropdown>
</template> </template>
</a-space>
</div> </div>
</template> </template>
<style scoped> <style lang='scss'>
.app-toolbar { .toolbar {
} .toolbar-link {
.app-toolbar .toolbar-item { gap: 0 !important;
margin-right: 8px; .ant-space-item {
margin-bottom: 12px; position: relative;
.separator {
position: absolute;
right: 0;
top: 15%;
height: 70%;
width: 1px;
background: #1890ff;
}
}
}
} }
</style> </style>
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册